@attalabs/vinaya 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/aeg-root/contracts/developer-reviewer.md +1 -1
- package/aeg-root/contracts/planner-operator.md +1 -1
- package/aeg-root/contracts/principal-operator.md +6 -6
- package/aeg-root/contracts/security-archivist.md +1 -1
- package/aeg-root/enforcement.md +14 -14
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +36 -37
- package/aeg-root/roles/developer.md +9 -5
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +15 -4
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +14 -6
- package/aeg-root/roles/security.md +22 -11
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +12 -11
- package/aeg-root/templates/brief-template.md +8 -6
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +10 -4
- package/dist/checks/bin/check-body-bare-digits.js +823 -595
- package/dist/checks/bin/check-branch-topology.js +796 -478
- package/dist/checks/bin/check-brief-shape.js +824 -596
- package/dist/checks/bin/check-changeset-coverage.js +1337 -747
- package/dist/checks/bin/check-closes-n.js +796 -478
- package/dist/checks/bin/check-coherence.js +914 -611
- package/dist/checks/bin/check-dead-branch-push.js +705 -462
- package/dist/checks/bin/check-dispatch-readiness.js +941 -624
- package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
- package/dist/checks/bin/check-doc-coverage.js +1339 -742
- package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
- package/dist/checks/bin/check-doctrine-portability.js +1332 -742
- package/dist/checks/bin/check-evidence-fresh.js +1339 -918
- package/dist/checks/bin/check-exec-bits.js +1331 -741
- package/dist/checks/bin/check-first-push-dispatch.js +917 -614
- package/dist/checks/bin/check-issue-assignment.js +796 -478
- package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
- package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
- package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
- package/dist/checks/bin/check-issue-surface-globs.js +925 -613
- package/dist/checks/bin/check-issue-title-grammar.js +705 -462
- package/dist/checks/bin/check-issue-tranche-label.js +705 -462
- package/dist/checks/bin/check-main-branch-refusal.js +705 -462
- package/dist/checks/bin/check-no-disk-state.js +705 -462
- package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
- package/dist/checks/bin/check-pr-report-density.js +705 -462
- package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
- package/dist/checks/bin/check-quoted-command.js +1816 -1228
- package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
- package/dist/checks/bin/check-registry-gates.js +993 -526
- package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
- package/dist/checks/bin/check-review-gate.js +832 -604
- package/dist/checks/bin/check-single-plan-pr.js +705 -462
- package/dist/checks/bin/check-surface-scope.js +796 -478
- package/dist/checks/bin/check-test-plan.js +705 -462
- package/dist/checks/bin/check-token-collection-wired.js +705 -462
- package/dist/checks/bin/check-workspace-escape.js +1332 -742
- package/dist/checks/bin/verify-dispatch.js +3849 -0
- package/dist/index.js +20876 -10091
- package/dist/lib/pre-push-cache-test-run.js +1045 -682
- package/dist/lib/pre-push-changed-files.js +16 -11
- package/dist/lib/pre-push-select-tests.js +785 -500
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1-acpmtfmrc35.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/dist/checks/bin/check-token-report.js +0 -6526
- package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
- package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seeded recorder the fixture executions are built with. Every time, event
|
|
3
|
+
* id, run id and commit below is drawn from a stream keyed by the seed and the
|
|
4
|
+
* execution's name — never from the clock, a random source, or a counter that
|
|
5
|
+
* outlives one call — so building the same execution twice yields the same
|
|
6
|
+
* bytes. Every valid line goes through the real `buildHeader`, so a header
|
|
7
|
+
* change reaches the fixtures and fails their test rather than drifting.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { createHash } from 'node:crypto'
|
|
11
|
+
import { buildHeader } from '../envelope'
|
|
12
|
+
import type { Host, Provenance, Role } from '../schema'
|
|
13
|
+
|
|
14
|
+
export const FIXTURE_SEED = 'vinaya-fixture-seed-1'
|
|
15
|
+
export const FIXTURE_REPO = 'example/fixture'
|
|
16
|
+
export const FIXTURE_EPOCH = '2026-09-01T00:00:00.000Z'
|
|
17
|
+
export const FIXTURE_VINAYA_VERSION = '0.35.0'
|
|
18
|
+
/** The CLI version of the low-trust line: older than the release that began attributing every line. */
|
|
19
|
+
export const LOW_TRUST_VINAYA_VERSION = '0.30.1'
|
|
20
|
+
|
|
21
|
+
const FIXTURE_DOCTRINE = 'fixture-doctrine'
|
|
22
|
+
const FIXTURE_HOSTNAME = 'fixture-host'
|
|
23
|
+
const ONE_DAY_MS = 86_400_000
|
|
24
|
+
|
|
25
|
+
/** How a reader is expected to classify a line: fully valid, a schema version no build knows, or a known version that fails validation. */
|
|
26
|
+
export type FixtureValidity = 'valid' | 'unknown_version' | 'invalid'
|
|
27
|
+
|
|
28
|
+
export type FixtureLine = { raw: string; validity: FixtureValidity }
|
|
29
|
+
|
|
30
|
+
/** The body of one event: its family and event name plus that family's own fields. `meta`, `subject` and `payload` come from the recorder. */
|
|
31
|
+
export type EventBody = { kind: string; event: string } & Record<string, unknown>
|
|
32
|
+
|
|
33
|
+
export type EmitOptions = {
|
|
34
|
+
role?: Role
|
|
35
|
+
round?: number
|
|
36
|
+
/** A commit: recorded on `subject.sha` and `meta.work.revision` together. Absent, the line records no commit at all. */
|
|
37
|
+
sha?: string
|
|
38
|
+
host?: Host
|
|
39
|
+
provenance?: Provenance
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** mulberry32 — a tiny seeded generator; quality is irrelevant here, determinism is the point. */
|
|
43
|
+
function stream(seed: string): () => number {
|
|
44
|
+
let state = createHash('sha256').update(seed).digest().readUInt32BE(0)
|
|
45
|
+
return () => {
|
|
46
|
+
state = (state + 0x6d2b79f5) | 0
|
|
47
|
+
let t = Math.imul(state ^ (state >>> 15), 1 | state)
|
|
48
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
|
|
49
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type Recorder = {
|
|
54
|
+
/** The Issue number every line of this execution belongs to. */
|
|
55
|
+
issue: number
|
|
56
|
+
/** The pull request number of this execution's task. */
|
|
57
|
+
pr: number
|
|
58
|
+
lines: FixtureLine[]
|
|
59
|
+
/** Hex digits drawn from the seeded stream. */
|
|
60
|
+
hex(length: number): string
|
|
61
|
+
/** An integer in `[min, max]` drawn from the seeded stream. */
|
|
62
|
+
int(min: number, max: number): number
|
|
63
|
+
/** A commit identifier drawn from the seeded stream. */
|
|
64
|
+
sha(): string
|
|
65
|
+
/** The next review comment id for this execution. */
|
|
66
|
+
commentId(): number
|
|
67
|
+
/** Milliseconds elapsed since the execution's first line. */
|
|
68
|
+
elapsedMs(): number
|
|
69
|
+
/** The current clock, as an ISO time, after advancing by a seeded step. */
|
|
70
|
+
tick(): Date
|
|
71
|
+
/** Builds the next valid line's object (advancing the clock and sequence) without storing it. */
|
|
72
|
+
build(body: EventBody, options?: EmitOptions): Record<string, unknown>
|
|
73
|
+
/** Stores an already-built object as a line. */
|
|
74
|
+
push(object: Record<string, unknown>, validity?: FixtureValidity): Record<string, unknown>
|
|
75
|
+
/** Stores raw text as it is. */
|
|
76
|
+
pushRaw(raw: string, validity: FixtureValidity): void
|
|
77
|
+
/** Builds and stores one valid line. */
|
|
78
|
+
emit(body: EventBody, options?: EmitOptions): Record<string, unknown>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* One recorder per execution. `index` places the execution on the calendar —
|
|
83
|
+
* each starts a day after the one before — and `name` keys its stream, so two
|
|
84
|
+
* executions never share ids. Nothing here survives the call that made it.
|
|
85
|
+
*/
|
|
86
|
+
export function createRecorder(seed: string, name: string, index: number, issue: number): Recorder {
|
|
87
|
+
const draw = stream(`${seed}:${name}`)
|
|
88
|
+
const startMs = Date.parse(FIXTURE_EPOCH) + index * ONE_DAY_MS
|
|
89
|
+
let clockMs = startMs
|
|
90
|
+
let seq = 0
|
|
91
|
+
let comment = 1000 + Math.floor(draw() * 1000)
|
|
92
|
+
const lines: FixtureLine[] = []
|
|
93
|
+
const hex = (length: number): string => {
|
|
94
|
+
let out = ''
|
|
95
|
+
while (out.length < length)
|
|
96
|
+
out += Math.floor(draw() * 0x10000)
|
|
97
|
+
.toString(16)
|
|
98
|
+
.padStart(4, '0')
|
|
99
|
+
return out.slice(0, length)
|
|
100
|
+
}
|
|
101
|
+
const int = (min: number, max: number): number => min + Math.floor(draw() * (max - min + 1))
|
|
102
|
+
const runId = `run-${name}-${hex(8)}`
|
|
103
|
+
const processId = `proc-${hex(8)}`
|
|
104
|
+
const tick = (): Date => {
|
|
105
|
+
clockMs += int(1000, 60_000)
|
|
106
|
+
return new Date(clockMs)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const recorder: Recorder = {
|
|
110
|
+
issue,
|
|
111
|
+
pr: issue + 100,
|
|
112
|
+
lines,
|
|
113
|
+
hex,
|
|
114
|
+
int,
|
|
115
|
+
sha: () => hex(12),
|
|
116
|
+
commentId: () => ++comment,
|
|
117
|
+
elapsedMs: () => clockMs - startMs,
|
|
118
|
+
tick,
|
|
119
|
+
build(body, options = {}) {
|
|
120
|
+
const header = buildHeader({
|
|
121
|
+
now: tick(),
|
|
122
|
+
runId,
|
|
123
|
+
seq: seq++,
|
|
124
|
+
repo: FIXTURE_REPO,
|
|
125
|
+
vinaya: FIXTURE_VINAYA_VERSION,
|
|
126
|
+
doctrine: FIXTURE_DOCTRINE,
|
|
127
|
+
host: options.host ?? 'loop',
|
|
128
|
+
hostname: FIXTURE_HOSTNAME,
|
|
129
|
+
env: {
|
|
130
|
+
...(options.role ? { role: options.role } : {}),
|
|
131
|
+
task: String(issue),
|
|
132
|
+
...(options.round !== undefined ? { round: String(options.round) } : {})
|
|
133
|
+
},
|
|
134
|
+
eventId: `evt-${hex(12)}`,
|
|
135
|
+
processId,
|
|
136
|
+
...(options.provenance ? { provenance: options.provenance } : {}),
|
|
137
|
+
...(options.sha ? { subject: { sha: options.sha } } : {})
|
|
138
|
+
})
|
|
139
|
+
if (options.sha && header.meta.schema === 3) header.meta.work.revision = options.sha
|
|
140
|
+
const { kind, event, ...fields } = body
|
|
141
|
+
return { ...header, kind, event, payload: {}, ...fields }
|
|
142
|
+
},
|
|
143
|
+
push(object, validity = 'valid') {
|
|
144
|
+
lines.push({ raw: JSON.stringify(object), validity })
|
|
145
|
+
return object
|
|
146
|
+
},
|
|
147
|
+
pushRaw(raw, validity) {
|
|
148
|
+
lines.push({ raw, validity })
|
|
149
|
+
},
|
|
150
|
+
emit(body, options) {
|
|
151
|
+
return recorder.push(recorder.build(body, options))
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return recorder
|
|
155
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { buildExecution, buildExecutions, EXECUTION_NAMES } from './executions'
|
|
2
|
+
export type { ExecutionName, FixtureExecution } from './executions'
|
|
3
|
+
export {
|
|
4
|
+
FIXTURE_EPOCH,
|
|
5
|
+
FIXTURE_REPO,
|
|
6
|
+
FIXTURE_SEED,
|
|
7
|
+
FIXTURE_VINAYA_VERSION,
|
|
8
|
+
LOW_TRUST_VINAYA_VERSION
|
|
9
|
+
} from './generator'
|
|
10
|
+
export type { FixtureLine, FixtureValidity } from './generator'
|
|
11
|
+
export { FACT_SHEETS } from './fact-sheets'
|
|
12
|
+
export type { FactSheet } from './fact-sheets'
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
export { buildHeader } from './envelope'
|
|
2
|
+
export { CODE_TOKEN_PATTERN } from './schema'
|
|
3
|
+
export {
|
|
4
|
+
CUSTOM_EVENT_MAX_FIELDS,
|
|
5
|
+
CUSTOM_EVENT_NAME_MAX_LENGTH,
|
|
6
|
+
CUSTOM_EVENT_NAME_PATTERN,
|
|
7
|
+
CUSTOM_EVENT_RESERVED_NAMESPACE,
|
|
8
|
+
CUSTOM_FIELD_NAME_MAX_LENGTH,
|
|
9
|
+
CUSTOM_FIELD_NAME_PATTERN,
|
|
10
|
+
CUSTOM_TEXT_MAX_LENGTH,
|
|
11
|
+
CustomEventDeclarationsSchema,
|
|
12
|
+
checkCustomEvent,
|
|
13
|
+
UNRECORDABLE_FIELD_NAME
|
|
14
|
+
} from './custom'
|
|
15
|
+
export type {
|
|
16
|
+
CustomEventCheck,
|
|
17
|
+
CustomEventDeclaration,
|
|
18
|
+
CustomEventDeclarations,
|
|
19
|
+
CustomEventRefusalReason,
|
|
20
|
+
CustomFieldType,
|
|
21
|
+
CustomFieldValue
|
|
22
|
+
} from './custom'
|
|
2
23
|
export type { HeaderInput } from './envelope'
|
|
24
|
+
export {
|
|
25
|
+
buildExecution,
|
|
26
|
+
buildExecutions,
|
|
27
|
+
EXECUTION_NAMES,
|
|
28
|
+
FACT_SHEETS,
|
|
29
|
+
FIXTURE_EPOCH,
|
|
30
|
+
FIXTURE_REPO,
|
|
31
|
+
FIXTURE_SEED,
|
|
32
|
+
FIXTURE_VINAYA_VERSION,
|
|
33
|
+
LOW_TRUST_VINAYA_VERSION
|
|
34
|
+
} from './fixtures'
|
|
35
|
+
export type { ExecutionName, FactSheet, FixtureExecution, FixtureLine, FixtureValidity } from './fixtures'
|
|
3
36
|
export { redact } from './redact'
|
|
4
37
|
export {
|
|
5
38
|
classifyStoredLine,
|
|
@@ -20,6 +53,7 @@ export type {
|
|
|
20
53
|
} from './store'
|
|
21
54
|
export {
|
|
22
55
|
CONFIDENCE_REASON_MAX_LENGTH,
|
|
56
|
+
CustomEventSchema,
|
|
23
57
|
DispatchEventSchema,
|
|
24
58
|
DevReviewLoopEventSchema,
|
|
25
59
|
EffectEventSchema,
|
|
@@ -30,6 +64,9 @@ export {
|
|
|
30
64
|
HandoffEventSchema,
|
|
31
65
|
HeaderMetaV1Schema,
|
|
32
66
|
HeaderMetaV2Schema,
|
|
67
|
+
HeaderMetaV3Schema,
|
|
68
|
+
WorkSchema,
|
|
69
|
+
FlowSchema,
|
|
33
70
|
HeaderSchema,
|
|
34
71
|
HostSchema,
|
|
35
72
|
HOST_VALUES,
|
|
@@ -46,6 +83,7 @@ export {
|
|
|
46
83
|
UsageEventSchema
|
|
47
84
|
} from './schema'
|
|
48
85
|
export type {
|
|
86
|
+
CustomEvent,
|
|
49
87
|
DispatchEvent,
|
|
50
88
|
DispatchOutcome,
|
|
51
89
|
DevReviewLoopEvent,
|
|
@@ -58,6 +96,9 @@ export type {
|
|
|
58
96
|
Header,
|
|
59
97
|
HeaderMetaV1,
|
|
60
98
|
HeaderMetaV2,
|
|
99
|
+
HeaderMetaV3,
|
|
100
|
+
Work,
|
|
101
|
+
Flow,
|
|
61
102
|
Host,
|
|
62
103
|
InputVersions,
|
|
63
104
|
Lineage,
|
|
@@ -73,3 +114,90 @@ export type {
|
|
|
73
114
|
UsageEvent,
|
|
74
115
|
UsageUnits
|
|
75
116
|
} from './schema'
|
|
117
|
+
export {
|
|
118
|
+
cacheContractCases,
|
|
119
|
+
createMemoryCache,
|
|
120
|
+
DEFAULT_SYNC_LOOKBACK,
|
|
121
|
+
DEFAULT_SYNC_MAX_PAGES,
|
|
122
|
+
DEFAULT_SYNC_PAGE_LIMIT,
|
|
123
|
+
isLowTrustVersion,
|
|
124
|
+
known,
|
|
125
|
+
LOW_TRUST_BELOW_VERSION,
|
|
126
|
+
normalizeStoredLine,
|
|
127
|
+
syncSource,
|
|
128
|
+
unknownBecause
|
|
129
|
+
} from './sync'
|
|
130
|
+
export type {
|
|
131
|
+
CacheContractCase,
|
|
132
|
+
Dataset,
|
|
133
|
+
DatasetRow,
|
|
134
|
+
JsonObject,
|
|
135
|
+
LogCache,
|
|
136
|
+
LogSource,
|
|
137
|
+
Measured,
|
|
138
|
+
NormalizedLine,
|
|
139
|
+
PutOutcome,
|
|
140
|
+
QuarantineRecord,
|
|
141
|
+
RowDeletion,
|
|
142
|
+
RowEdit,
|
|
143
|
+
RowOrigin,
|
|
144
|
+
RowTrust,
|
|
145
|
+
SourceCursor,
|
|
146
|
+
SourceGap,
|
|
147
|
+
SourceLine,
|
|
148
|
+
SourcePage,
|
|
149
|
+
SyncOptions,
|
|
150
|
+
SyncSummary,
|
|
151
|
+
UnknownableField
|
|
152
|
+
} from './sync'
|
|
153
|
+
export {
|
|
154
|
+
catchesAndEscapes,
|
|
155
|
+
changeSizeBands,
|
|
156
|
+
checkOutcomes,
|
|
157
|
+
completionByModel,
|
|
158
|
+
confidenceVsOutcome,
|
|
159
|
+
determinism,
|
|
160
|
+
NO_LABELS_REASON,
|
|
161
|
+
outcomesByInstructionVersion,
|
|
162
|
+
QUESTIONS,
|
|
163
|
+
recurringFindings,
|
|
164
|
+
reviewerStrictness,
|
|
165
|
+
timeByUnit,
|
|
166
|
+
usageByUnitAndRole
|
|
167
|
+
} from './questions'
|
|
168
|
+
export type {
|
|
169
|
+
CatchesAnswer,
|
|
170
|
+
ChangeSizeAnswer,
|
|
171
|
+
ChangeSizeBand,
|
|
172
|
+
CheckOutcome,
|
|
173
|
+
ChecksAnswer,
|
|
174
|
+
CompletionAnswer,
|
|
175
|
+
ConfidenceAnswer,
|
|
176
|
+
ConfidenceOutcome,
|
|
177
|
+
Coverage,
|
|
178
|
+
DeterminismAnswer,
|
|
179
|
+
FailureRecord,
|
|
180
|
+
HumanLabel,
|
|
181
|
+
HumanLabelKind,
|
|
182
|
+
JudgmentAnswer,
|
|
183
|
+
ModelCompletion,
|
|
184
|
+
OutcomesByVersionAnswer,
|
|
185
|
+
Question,
|
|
186
|
+
QuestionId,
|
|
187
|
+
RecurringFinding,
|
|
188
|
+
RecurringFindingsAnswer,
|
|
189
|
+
ReviewerStrictness,
|
|
190
|
+
RoleUsage,
|
|
191
|
+
RoundsToGreen,
|
|
192
|
+
SeverityFindings,
|
|
193
|
+
SizeBandOutcome,
|
|
194
|
+
Span,
|
|
195
|
+
TimeAnswer,
|
|
196
|
+
UnitTime,
|
|
197
|
+
UnitUsage,
|
|
198
|
+
UnknownFigure,
|
|
199
|
+
UsageAnswer,
|
|
200
|
+
UsageTotals,
|
|
201
|
+
VerdictFindings,
|
|
202
|
+
VersionOutcome
|
|
203
|
+
} from './questions'
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question 5 — does the product catch anything? (`apps/cli/specs/log-sync.md`,
|
|
3
|
+
* "The questions".) The recorded catches — a check failure (`gate` `checked`
|
|
4
|
+
* with `outcome: 'fail'`) and a review finding later resolved (a finding id
|
|
5
|
+
* named in a `findings_compared` line's `resolved` list) — and the observable
|
|
6
|
+
* escapes, which this task's boundary is explicit the Log never records on
|
|
7
|
+
* its own: a gate rejection is not automatically a prevented bug, and no
|
|
8
|
+
* recorded escape is not proof of zero escapes. An escape is counted only
|
|
9
|
+
* from a supplied `HumanLabel` of kind `'reversal'` or `'incident'` — never
|
|
10
|
+
* from a `'false_rejection'` label, which names the opposite case — and
|
|
11
|
+
* reads unknown, never zero, when no label was supplied at all.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { known, unknownBecause } from '../sync'
|
|
15
|
+
import type { Dataset, Measured } from '../sync'
|
|
16
|
+
import type { Coverage, UnknownFigure } from './common'
|
|
17
|
+
import { buildCoverage, rowsOfKinds, stringArrayField, textField, trustedRows } from './common'
|
|
18
|
+
import { NO_LABELS_REASON, type HumanLabel } from './labels'
|
|
19
|
+
|
|
20
|
+
export type CatchesAnswer = {
|
|
21
|
+
/** `gate` `checked` lines whose outcome is `'fail'`. */
|
|
22
|
+
checkFailures: number
|
|
23
|
+
/** Finding ids named in a `findings_compared` line's `resolved` list. */
|
|
24
|
+
findingsResolved: number
|
|
25
|
+
/** `checkFailures + findingsResolved`. */
|
|
26
|
+
catches: number
|
|
27
|
+
/** A `'reversal'` or `'incident'` label, counted; unknown with `'no labels recorded'` when no label was supplied at all. */
|
|
28
|
+
escapes: Measured<number>
|
|
29
|
+
coverage: Coverage
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const CATCHES_KINDS = ['gate', 'dev_review_loop']
|
|
33
|
+
|
|
34
|
+
/** Question 5: the catches the Log recorded, and the escapes a supplied label can name. */
|
|
35
|
+
export function catchesAndEscapes(dataset: Dataset, labels: readonly HumanLabel[] = []): CatchesAnswer {
|
|
36
|
+
const { rows, lowTrust } = trustedRows(dataset)
|
|
37
|
+
const used = rowsOfKinds(rows, CATCHES_KINDS)
|
|
38
|
+
const unknowns: UnknownFigure[] = []
|
|
39
|
+
|
|
40
|
+
let checkFailures = 0
|
|
41
|
+
let findingsResolved = 0
|
|
42
|
+
for (const row of used.withUnit) {
|
|
43
|
+
if (row.kind === 'gate' && row.event === 'checked' && textField(row, 'outcome') === 'fail') checkFailures++
|
|
44
|
+
else if (row.kind === 'dev_review_loop' && row.event === 'findings_compared')
|
|
45
|
+
findingsResolved += stringArrayField(row, 'resolved').length
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let escapes: Measured<number>
|
|
49
|
+
if (labels.length === 0) {
|
|
50
|
+
escapes = unknownBecause(NO_LABELS_REASON)
|
|
51
|
+
unknowns.push({ figure: 'escapes', reason: NO_LABELS_REASON })
|
|
52
|
+
} else {
|
|
53
|
+
escapes = known(labels.filter((label) => label.kind === 'reversal' || label.kind === 'incident').length)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
checkFailures,
|
|
58
|
+
findingsResolved,
|
|
59
|
+
catches: checkFailures + findingsResolved,
|
|
60
|
+
escapes,
|
|
61
|
+
coverage: buildCoverage(dataset, lowTrust, used, unknowns)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question 6 — which check catches most? (`apps/cli/specs/log-sync.md`,
|
|
3
|
+
* "The questions".) For each check named by a `gate` `checked` line, its
|
|
4
|
+
* failures and the correction time from each failure to the next `pass` of
|
|
5
|
+
* that same check for the same unit of work; across the whole dataset, the
|
|
6
|
+
* checks run, passed and skipped a `gate` `summary` line states. A false
|
|
7
|
+
* rejection is counted only from a supplied `HumanLabel` of kind
|
|
8
|
+
* `'false_rejection'` naming a unit this check failed for — never guessed
|
|
9
|
+
* from a failure alone, since a gate rejection is not automatically a
|
|
10
|
+
* prevented bug, and its opposite is not automatically a sound one either.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { known, unknownBecause } from '../sync'
|
|
14
|
+
import type { Dataset, DatasetRow, Measured } from '../sync'
|
|
15
|
+
import type { Coverage, UnknownFigure } from './common'
|
|
16
|
+
import { buildCoverage, compareText, groupBy, numberField, rowsOfKinds, textField, trustedRows } from './common'
|
|
17
|
+
import { NO_LABELS_REASON, type HumanLabel } from './labels'
|
|
18
|
+
|
|
19
|
+
const CHECKS_KINDS = ['gate']
|
|
20
|
+
|
|
21
|
+
export type CheckOutcome = {
|
|
22
|
+
check: string
|
|
23
|
+
failures: number
|
|
24
|
+
/** From each failure to the next `pass` of this check, for the same unit of work, ascending. Unknown when no failure of this check ever saw a later pass for its unit. */
|
|
25
|
+
correctionTimesMs: Measured<number[]>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type ChecksAnswer = {
|
|
29
|
+
/** Ascending by check name. */
|
|
30
|
+
checks: CheckOutcome[]
|
|
31
|
+
/** Checks run, summed from every `gate` `summary` line's own count. */
|
|
32
|
+
ran: number
|
|
33
|
+
/** Checks passed, the same way. */
|
|
34
|
+
passed: number
|
|
35
|
+
/** Checks skipped, the same way. */
|
|
36
|
+
skipped: number
|
|
37
|
+
/** A `'false_rejection'` label naming a unit this check failed for, counted; unknown with `'no labels recorded'` when no label was supplied at all. */
|
|
38
|
+
falseRejections: Measured<number>
|
|
39
|
+
coverage: Coverage
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type CheckedEvent = { time: number; unit: string; outcome: string | null }
|
|
43
|
+
|
|
44
|
+
function timeOf(row: DatasetRow): number {
|
|
45
|
+
return Date.parse(row.time)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The correction times from the first failure of a run to the next pass of
|
|
50
|
+
* the same check, for one unit, ascending — and how many failures saw none.
|
|
51
|
+
* A run of consecutive failures before a pass is one episode, corrected
|
|
52
|
+
* once, from its first failure — a later failure in the same open episode
|
|
53
|
+
* never restarts the clock or counts as its own uncorrected failure.
|
|
54
|
+
*/
|
|
55
|
+
function correctionsOf(events: readonly CheckedEvent[]): { times: number[]; uncorrected: number } {
|
|
56
|
+
const sorted = [...events].sort((a, b) => a.time - b.time)
|
|
57
|
+
const times: number[] = []
|
|
58
|
+
let uncorrected = 0
|
|
59
|
+
let episodeStart: number | null = null
|
|
60
|
+
let episodeFailures = 0
|
|
61
|
+
for (const event of sorted) {
|
|
62
|
+
if (event.outcome === 'fail') {
|
|
63
|
+
if (episodeStart === null) episodeStart = event.time
|
|
64
|
+
episodeFailures++
|
|
65
|
+
} else if (event.outcome === 'pass' && episodeStart !== null) {
|
|
66
|
+
times.push(event.time - episodeStart)
|
|
67
|
+
episodeStart = null
|
|
68
|
+
episodeFailures = 0
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (episodeStart !== null) uncorrected += episodeFailures
|
|
72
|
+
return { times: times.sort((a, b) => a - b), uncorrected }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Merges each unit's own corrections into one list for the check — an episode never crosses units. */
|
|
76
|
+
function correctionsAcrossUnits(events: readonly CheckedEvent[]): { times: number[]; uncorrected: number } {
|
|
77
|
+
const times: number[] = []
|
|
78
|
+
let uncorrected = 0
|
|
79
|
+
for (const unitEvents of groupBy(events, (e) => e.unit).values()) {
|
|
80
|
+
const result = correctionsOf(unitEvents)
|
|
81
|
+
times.push(...result.times)
|
|
82
|
+
uncorrected += result.uncorrected
|
|
83
|
+
}
|
|
84
|
+
return { times: times.sort((a, b) => a - b), uncorrected }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function outcomeOf(check: string, events: readonly CheckedEvent[], unknowns: UnknownFigure[]): CheckOutcome {
|
|
88
|
+
const failures = events.filter((e) => e.outcome === 'fail').length
|
|
89
|
+
const { times, uncorrected } = correctionsAcrossUnits(events)
|
|
90
|
+
let correctionTimesMs: Measured<number[]>
|
|
91
|
+
if (failures === 0) {
|
|
92
|
+
correctionTimesMs = unknownBecause(`no failure of ${check} was recorded`)
|
|
93
|
+
} else if (times.length === 0) {
|
|
94
|
+
correctionTimesMs = unknownBecause(`no failure of ${check} was followed by a pass of the same unit`)
|
|
95
|
+
} else {
|
|
96
|
+
correctionTimesMs = known(times)
|
|
97
|
+
if (uncorrected > 0)
|
|
98
|
+
unknowns.push({
|
|
99
|
+
figure: `${check}.correctionTimesMs`,
|
|
100
|
+
reason: `${uncorrected} of ${failures} failures of ${check} were never followed by a pass of the same unit`
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
if (!correctionTimesMs.known)
|
|
104
|
+
unknowns.push({ figure: `${check}.correctionTimesMs`, reason: correctionTimesMs.reason })
|
|
105
|
+
return { check, failures, correctionTimesMs }
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Question 6: failures and correction time by check, and the summary totals across every check run. */
|
|
109
|
+
export function checkOutcomes(dataset: Dataset, labels: readonly HumanLabel[] = []): ChecksAnswer {
|
|
110
|
+
const { rows, lowTrust } = trustedRows(dataset)
|
|
111
|
+
const used = rowsOfKinds(rows, CHECKS_KINDS)
|
|
112
|
+
const unknowns: UnknownFigure[] = []
|
|
113
|
+
|
|
114
|
+
const checkedRows = used.withUnit.filter((row) => row.event === 'checked')
|
|
115
|
+
const summaryRows = used.withUnit.filter((row) => row.event === 'summary')
|
|
116
|
+
|
|
117
|
+
const byCheck = groupBy(checkedRows, (row) => textField(row, 'check') ?? '')
|
|
118
|
+
const checks = [...byCheck.entries()]
|
|
119
|
+
.sort(([a], [b]) => compareText(a, b))
|
|
120
|
+
.map(([check, group]) =>
|
|
121
|
+
outcomeOf(
|
|
122
|
+
check,
|
|
123
|
+
group.map((row) => ({ time: timeOf(row), unit: row.workRef as string, outcome: textField(row, 'outcome') })),
|
|
124
|
+
unknowns
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
const ran = summaryRows.reduce((sum, row) => sum + (numberField(row, 'ran') ?? 0), 0)
|
|
129
|
+
const passed = summaryRows.reduce((sum, row) => sum + (numberField(row, 'passed') ?? 0), 0)
|
|
130
|
+
const skipped = summaryRows.reduce((sum, row) => sum + (numberField(row, 'skipped') ?? 0), 0)
|
|
131
|
+
|
|
132
|
+
const failedUnits = new Set<string>()
|
|
133
|
+
for (const row of checkedRows) if (textField(row, 'outcome') === 'fail') failedUnits.add(row.workRef as string)
|
|
134
|
+
|
|
135
|
+
let falseRejections: Measured<number>
|
|
136
|
+
if (labels.length === 0) {
|
|
137
|
+
falseRejections = unknownBecause(NO_LABELS_REASON)
|
|
138
|
+
unknowns.push({ figure: 'falseRejections', reason: NO_LABELS_REASON })
|
|
139
|
+
} else {
|
|
140
|
+
falseRejections = known(
|
|
141
|
+
labels.filter((label) => label.kind === 'false_rejection' && failedUnits.has(label.unit)).length
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return { checks, ran, passed, skipped, falseRejections, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
|
|
146
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What every question over the Vinaya Log shares (`apps/cli/specs/log-sync.md`,
|
|
3
|
+
* "The questions"): the rows a question may read, the coverage every answer
|
|
4
|
+
* states, and small readers over a row's untyped family body. A question is a
|
|
5
|
+
* pure function over a `Dataset` — no I/O, no clock — and picks its rows by
|
|
6
|
+
* comparing `kind` and `event` as text, never by switching over the families.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Dataset, DatasetRow, JsonObject } from '../sync'
|
|
10
|
+
|
|
11
|
+
/** One figure an answer could not compute, and why. */
|
|
12
|
+
export type UnknownFigure = { figure: string; reason: string }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What an answer read, so a reader can judge how far to trust it. Low-trust
|
|
16
|
+
* rows are left out of every figure and counted here; a gap or a quarantined
|
|
17
|
+
* line means the dataset itself is incomplete, so both are counted too.
|
|
18
|
+
*/
|
|
19
|
+
export type Coverage = {
|
|
20
|
+
/** Every row the dataset holds. */
|
|
21
|
+
rowsRead: number
|
|
22
|
+
/** Rows written by a CLI older than the low-trust threshold, left out of every figure. */
|
|
23
|
+
lowTrustLeftOut: number
|
|
24
|
+
/** Trusted rows of the kinds the question reads whose unit of work is unknown, left out of every unit figure. */
|
|
25
|
+
unitUnknown: number
|
|
26
|
+
/** Trusted rows of the kinds the question reads, with a known unit — the rows the figures are built from. */
|
|
27
|
+
rowsUsed: number
|
|
28
|
+
/** Gaps the dataset records: stretches of history no figure here can cover. */
|
|
29
|
+
gaps: number
|
|
30
|
+
/** Lines the dataset quarantined: they produced no row. */
|
|
31
|
+
quarantined: number
|
|
32
|
+
/** Every figure the answer could not compute, with the reason. */
|
|
33
|
+
unknowns: readonly UnknownFigure[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The rows a question may read: the dataset's rows without the low-trust ones, which are counted. */
|
|
37
|
+
export function trustedRows(dataset: Dataset): { rows: DatasetRow[]; lowTrust: number } {
|
|
38
|
+
const all = dataset.rows()
|
|
39
|
+
const rows = all.filter((row) => row.trust !== 'low')
|
|
40
|
+
return { rows, lowTrust: all.length - rows.length }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The unit of work a row belongs to: its work reference, or `null` when the line never recorded one. */
|
|
44
|
+
export function unitOf(row: DatasetRow): string | null {
|
|
45
|
+
return row.workRef
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Splits trusted rows of the wanted kinds into those with a known unit and the count without one. */
|
|
49
|
+
export function rowsOfKinds(
|
|
50
|
+
rows: readonly DatasetRow[],
|
|
51
|
+
kinds: readonly string[]
|
|
52
|
+
): { withUnit: Array<DatasetRow & { workRef: string }>; unitUnknown: number } {
|
|
53
|
+
const withUnit: Array<DatasetRow & { workRef: string }> = []
|
|
54
|
+
let unitUnknown = 0
|
|
55
|
+
for (const row of rows) {
|
|
56
|
+
if (!kinds.includes(row.kind)) continue
|
|
57
|
+
if (row.workRef === null) unitUnknown++
|
|
58
|
+
else withUnit.push({ ...row, workRef: row.workRef })
|
|
59
|
+
}
|
|
60
|
+
return { withUnit, unitUnknown }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function buildCoverage(
|
|
64
|
+
dataset: Dataset,
|
|
65
|
+
lowTrust: number,
|
|
66
|
+
used: { withUnit: readonly DatasetRow[]; unitUnknown: number },
|
|
67
|
+
unknowns: readonly UnknownFigure[]
|
|
68
|
+
): Coverage {
|
|
69
|
+
return {
|
|
70
|
+
rowsRead: dataset.rows().length,
|
|
71
|
+
lowTrustLeftOut: lowTrust,
|
|
72
|
+
unitUnknown: used.unitUnknown,
|
|
73
|
+
rowsUsed: used.withUnit.length,
|
|
74
|
+
gaps: dataset.gaps().length,
|
|
75
|
+
quarantined: dataset.quarantined().length,
|
|
76
|
+
unknowns
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** A string field of the row's family body, or `null` when absent or not a string. */
|
|
81
|
+
export function textField(row: DatasetRow, key: string): string | null {
|
|
82
|
+
const value: unknown = row.payload[key]
|
|
83
|
+
return typeof value === 'string' ? value : null
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** A finite number field of the row's family body, or `null` when absent, null or not a number. */
|
|
87
|
+
export function numberField(row: DatasetRow, key: string): number | null {
|
|
88
|
+
const value: unknown = row.payload[key]
|
|
89
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** An object field of the row's family body, or `null` when absent, null or not an object. */
|
|
93
|
+
export function objectField(row: DatasetRow, key: string): JsonObject | null {
|
|
94
|
+
const value: unknown = row.payload[key]
|
|
95
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) ? (value as JsonObject) : null
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** An array-of-strings field of the row's family body, or `[]` when absent or not an array of strings. */
|
|
99
|
+
export function stringArrayField(row: DatasetRow, key: string): string[] {
|
|
100
|
+
const value: unknown = row.payload[key]
|
|
101
|
+
return Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : []
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** An array-of-objects field of the row's family body: each element that is itself a plain object, in order; a non-object element is dropped. `[]` when the field is absent or not an array. */
|
|
105
|
+
export function objectArrayField(row: DatasetRow, key: string): JsonObject[] {
|
|
106
|
+
const value: unknown = row.payload[key]
|
|
107
|
+
if (!Array.isArray(value)) return []
|
|
108
|
+
return value.filter((item): item is JsonObject => typeof item === 'object' && item !== null && !Array.isArray(item))
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A string field of a plain JSON object (e.g. one element `objectArrayField` returned), or `null` when absent or not a string. */
|
|
112
|
+
export function textOf(object: JsonObject, key: string): string | null {
|
|
113
|
+
const value: unknown = object[key]
|
|
114
|
+
return typeof value === 'string' ? value : null
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A boolean field of the row's family body, or `null` when absent or not a boolean. */
|
|
118
|
+
export function booleanField(row: DatasetRow, key: string): boolean | null {
|
|
119
|
+
const value: unknown = row.payload[key]
|
|
120
|
+
return typeof value === 'boolean' ? value : null
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function compareText(a: string, b: string): number {
|
|
124
|
+
return a < b ? -1 : a > b ? 1 : 0
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Groups items by a key, keeping first-seen order inside each group. */
|
|
128
|
+
export function groupBy<T>(items: readonly T[], key: (item: T) => string): Map<string, T[]> {
|
|
129
|
+
const groups = new Map<string, T[]>()
|
|
130
|
+
for (const item of items) {
|
|
131
|
+
const k = key(item)
|
|
132
|
+
const group = groups.get(k)
|
|
133
|
+
if (group) group.push(item)
|
|
134
|
+
else groups.set(k, [item])
|
|
135
|
+
}
|
|
136
|
+
return groups
|
|
137
|
+
}
|