@attalabs/vinaya 0.35.0 → 0.37.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 +9 -10
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +13 -16
- package/aeg-root/roles/developer.md +7 -3
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +23 -8
- package/aeg-root/roles/planner.md +2 -0
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +11 -3
- package/aeg-root/roles/security.md +19 -9
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +11 -10
- package/aeg-root/templates/brief-template.md +10 -4
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +4 -4
- package/dist/checks/bin/check-body-bare-digits.js +2081 -1883
- package/dist/checks/bin/check-branch-topology.js +1376 -1139
- package/dist/checks/bin/check-brief-shape.js +2081 -1883
- package/dist/checks/bin/check-changeset-coverage.js +2564 -2025
- package/dist/checks/bin/check-closes-n.js +1376 -1139
- package/dist/checks/bin/check-coherence.js +1480 -1228
- package/dist/checks/bin/check-dead-branch-push.js +1339 -1156
- package/dist/checks/bin/check-dispatch-readiness.js +1480 -1228
- package/dist/checks/bin/check-doc-coverage-push.js +2563 -2024
- package/dist/checks/bin/check-doc-coverage.js +2565 -2026
- package/dist/checks/bin/check-doctrine-no-procedures.js +2081 -1883
- package/dist/checks/bin/check-doctrine-portability.js +2563 -2024
- package/dist/checks/bin/check-evidence-fresh.js +1906 -1536
- package/dist/checks/bin/check-exec-bits.js +2136 -1597
- package/dist/checks/bin/check-first-push-dispatch.js +1480 -1228
- package/dist/checks/bin/check-issue-assignment.js +1376 -1139
- package/dist/checks/bin/check-issue-milestone-attach.js +1339 -1156
- package/dist/checks/bin/check-issue-objectives-numbering.js +2081 -1883
- package/dist/checks/bin/check-issue-parts-coverage.js +1339 -1156
- package/dist/checks/bin/check-issue-surface-globs.js +1488 -1227
- package/dist/checks/bin/check-issue-title-grammar.js +1339 -1156
- package/dist/checks/bin/check-issue-tranche-label.js +1339 -1156
- package/dist/checks/bin/check-main-branch-refusal.js +1342 -1159
- package/dist/checks/bin/check-no-disk-state.js +1342 -1159
- package/dist/checks/bin/check-pr-premise-reassert.js +2081 -1883
- package/dist/checks/bin/check-pr-report-density.js +1342 -1159
- package/dist/checks/bin/check-principal-test-plan-wait.js +1342 -1159
- package/dist/checks/bin/check-quoted-command.js +4063 -3526
- package/dist/checks/bin/check-reader-resolvable-prose.js +4082 -3533
- package/dist/checks/bin/check-registry-gates.js +1363 -1167
- package/dist/checks/bin/check-retired-vocabulary.js +4057 -3520
- package/dist/checks/bin/check-review-gate.js +2081 -1883
- package/dist/checks/bin/check-single-plan-pr.js +1339 -1156
- package/dist/checks/bin/check-surface-scope.js +1376 -1139
- package/dist/checks/bin/check-test-plan.js +1339 -1156
- package/dist/checks/bin/check-token-collection-wired.js +1342 -1159
- package/dist/checks/bin/check-token-report.js +1409 -1342
- package/dist/checks/bin/check-workspace-escape.js +2562 -2023
- package/dist/index.js +14171 -6490
- package/dist/lib/pre-push-cache-test-run.js +1044 -641
- package/dist/lib/pre-push-select-tests.js +641 -444
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +257 -10
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +2 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +69 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +139 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +27 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +757 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
- 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.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]__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]__0zc_0gx._.js → [root-of-the-server]__14ui9sz._.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/0vtfb0g813gki.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/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/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/{3ip5z3cf43bgo.js → 3l56x8wjdzvaw.js} +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3goaig_rysc6p.js → 3qtt1v3ya-ofe.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- 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/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/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/3u9emqjwpd0t9.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/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
|
@@ -1888,45 +1888,6 @@ var DERIVED_STATUSES = [
|
|
|
1888
1888
|
"incoherent"
|
|
1889
1889
|
];
|
|
1890
1890
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1891
|
-
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1892
|
-
function rowFromCells(cells) {
|
|
1893
|
-
if (cells.length < 7)
|
|
1894
|
-
return null;
|
|
1895
|
-
const phase = (cells[0] ?? "").trim();
|
|
1896
|
-
if (!phase)
|
|
1897
|
-
return null;
|
|
1898
|
-
return {
|
|
1899
|
-
phase,
|
|
1900
|
-
role: (cells[1] ?? "").trim(),
|
|
1901
|
-
agentModel: (cells[2] ?? "").trim(),
|
|
1902
|
-
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1903
|
-
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1904
|
-
cost: parseCostCell(cells[5] ?? ""),
|
|
1905
|
-
date: (cells[6] ?? "").trim()
|
|
1906
|
-
};
|
|
1907
|
-
}
|
|
1908
|
-
function parseIntCell(cell) {
|
|
1909
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1910
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1911
|
-
return null;
|
|
1912
|
-
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1913
|
-
if (!/^-?\d+$/.test(normalized))
|
|
1914
|
-
return null;
|
|
1915
|
-
return Number(normalized);
|
|
1916
|
-
}
|
|
1917
|
-
function parseCostCell(cell) {
|
|
1918
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1919
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1920
|
-
return null;
|
|
1921
|
-
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1922
|
-
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1923
|
-
return null;
|
|
1924
|
-
return Number(normalized);
|
|
1925
|
-
}
|
|
1926
|
-
function isEmDashOrDash(s) {
|
|
1927
|
-
const t = s.trim();
|
|
1928
|
-
return t === "—" || t === "-" || t === "–";
|
|
1929
|
-
}
|
|
1930
1891
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1931
1892
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1932
1893
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1942,61 +1903,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1942
1903
|
return false;
|
|
1943
1904
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1944
1905
|
}
|
|
1945
|
-
|
|
1946
|
-
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1947
|
-
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1948
|
-
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1949
|
-
function parseTokenReportEntries(body) {
|
|
1950
|
-
const lines = body.split(/\r?\n/);
|
|
1951
|
-
const headingIdxs = [];
|
|
1952
|
-
lines.forEach((line, i) => {
|
|
1953
|
-
if (TOKEN_REPORT_HEADING.test(line))
|
|
1954
|
-
headingIdxs.push(i);
|
|
1955
|
-
});
|
|
1956
|
-
const out = [];
|
|
1957
|
-
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1958
|
-
const start = headingIdxs[h] + 1;
|
|
1959
|
-
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1960
|
-
const section = lines.slice(start, end).join(`
|
|
1961
|
-
`);
|
|
1962
|
-
const tableRows = parseTableSection(section);
|
|
1963
|
-
if (tableRows.length > 0) {
|
|
1964
|
-
out.push(...tableRows);
|
|
1965
|
-
continue;
|
|
1966
|
-
}
|
|
1967
|
-
const inlineRow = parseInlineFieldList(section);
|
|
1968
|
-
if (inlineRow)
|
|
1969
|
-
out.push(inlineRow);
|
|
1970
|
-
}
|
|
1971
|
-
return out;
|
|
1972
|
-
}
|
|
1973
|
-
function parseTableSection(section) {
|
|
1974
|
-
const lines = section.split(/\r?\n/);
|
|
1975
|
-
let i = 0;
|
|
1976
|
-
for (;i < lines.length; i++) {
|
|
1977
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1978
|
-
break;
|
|
1979
|
-
}
|
|
1980
|
-
if (i + 1 >= lines.length)
|
|
1981
|
-
return [];
|
|
1982
|
-
i += 2;
|
|
1983
|
-
const out = [];
|
|
1984
|
-
for (;i < lines.length; i++) {
|
|
1985
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
1986
|
-
if (!trimmed.startsWith("|"))
|
|
1987
|
-
break;
|
|
1988
|
-
const row = rowFromCells(splitTableRow(trimmed));
|
|
1989
|
-
if (row)
|
|
1990
|
-
out.push(row);
|
|
1991
|
-
}
|
|
1992
|
-
return out;
|
|
1993
|
-
}
|
|
1994
|
-
function parseInlineFieldList(section) {
|
|
1995
|
-
const m = section.match(INLINE_FIELD_LIST);
|
|
1996
|
-
if (!m)
|
|
1997
|
-
return null;
|
|
1998
|
-
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1999
|
-
}
|
|
2000
1906
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2001
1907
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2002
1908
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2445,10 +2351,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2445
2351
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2446
2352
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2447
2353
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2354
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2448
2355
|
var DEFAULT_REVIEW_POLICY = {
|
|
2449
2356
|
codeReviewThreshold: "BLOCKER",
|
|
2450
2357
|
securityThreshold: "HIGH",
|
|
2451
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2358
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2359
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2452
2360
|
};
|
|
2453
2361
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2454
2362
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2468,16 +2376,42 @@ function blockingSeverities(scale, threshold) {
|
|
|
2468
2376
|
}
|
|
2469
2377
|
return scale.slice(0, idx + 1);
|
|
2470
2378
|
}
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2379
|
+
var DEFERRAL_REASON_TEXT = {
|
|
2380
|
+
"unchanged-line": "unchanged line",
|
|
2381
|
+
"outside-surface": "outside the Surface"
|
|
2382
|
+
};
|
|
2383
|
+
var SECURITY_HIGH_AND_ABOVE = blockingSeverities(SECURITY_SEVERITY_ORDER, "HIGH");
|
|
2384
|
+
function classifyFinding(finding, scale, threshold, context = {}) {
|
|
2385
|
+
if (!scale.includes(finding.severity)) {
|
|
2386
|
+
throw new Error(`classifyFinding: severity "${finding.severity}" is not one of ${scale.join(" > ")}`);
|
|
2387
|
+
}
|
|
2388
|
+
const location = finding.location;
|
|
2389
|
+
const effectiveSeverity = location !== undefined && isProseLocation(location) ? PROSE_CAP_SEVERITY : finding.severity;
|
|
2390
|
+
const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
|
|
2391
|
+
if (!wouldBlock)
|
|
2392
|
+
return { outcome: "non_blocking", deferralReason: null };
|
|
2393
|
+
const hasLocation = location !== undefined && location.length > 0;
|
|
2394
|
+
if (hasLocation && context.inSurface && !context.inSurface(location)) {
|
|
2395
|
+
return { outcome: "deferred", deferralReason: "outside-surface" };
|
|
2396
|
+
}
|
|
2397
|
+
if (hasLocation && context.changedLine && !SECURITY_HIGH_AND_ABOVE.includes(effectiveSeverity)) {
|
|
2398
|
+
if (!context.changedLine(location)) {
|
|
2399
|
+
return { outcome: "deferred", deferralReason: "unchanged-line" };
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
return { outcome: "blocking", deferralReason: null };
|
|
2403
|
+
}
|
|
2404
|
+
function evaluateReviewFindings(findings, scale, threshold, context = {}) {
|
|
2405
|
+
const blockingFindings = [];
|
|
2406
|
+
const deferredFindings = [];
|
|
2407
|
+
for (const f of findings) {
|
|
2408
|
+
const c = classifyFinding(f, scale, threshold, context);
|
|
2409
|
+
if (c.outcome === "blocking")
|
|
2410
|
+
blockingFindings.push(f);
|
|
2411
|
+
else if (c.outcome === "deferred")
|
|
2412
|
+
deferredFindings.push({ finding: f, reason: c.deferralReason });
|
|
2413
|
+
}
|
|
2414
|
+
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings, deferredFindings };
|
|
2481
2415
|
}
|
|
2482
2416
|
function isConsequentialFinding(finding) {
|
|
2483
2417
|
return finding.state !== "resolved";
|
|
@@ -2485,11 +2419,11 @@ function isConsequentialFinding(finding) {
|
|
|
2485
2419
|
function consequentialFindings(findings) {
|
|
2486
2420
|
return findings.filter((f) => isConsequentialFinding(f));
|
|
2487
2421
|
}
|
|
2488
|
-
function evaluateCodeReview(findings, policy) {
|
|
2489
|
-
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2422
|
+
function evaluateCodeReview(findings, policy, context = {}) {
|
|
2423
|
+
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold, context);
|
|
2490
2424
|
}
|
|
2491
|
-
function evaluateSecurityReview(findings, policy) {
|
|
2492
|
-
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold);
|
|
2425
|
+
function evaluateSecurityReview(findings, policy, context = {}) {
|
|
2426
|
+
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold, context);
|
|
2493
2427
|
}
|
|
2494
2428
|
function isKnownSeverity(scale, value) {
|
|
2495
2429
|
return scale.includes(value);
|
|
@@ -2823,11 +2757,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2823
2757
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2824
2758
|
}
|
|
2825
2759
|
function checkWorktreeStep0(prBody) {
|
|
2826
|
-
if (/git worktree add/.test(prBody))
|
|
2760
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2827
2761
|
return { status: "pass", errors: [] };
|
|
2828
2762
|
return {
|
|
2829
2763
|
status: "fail",
|
|
2830
|
-
errors: [
|
|
2764
|
+
errors: [
|
|
2765
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2766
|
+
]
|
|
2831
2767
|
};
|
|
2832
2768
|
}
|
|
2833
2769
|
function checkStopConditions(prBody) {
|
|
@@ -3017,7 +2953,8 @@ function isCommandBlock(content) {
|
|
|
3017
2953
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3018
2954
|
}
|
|
3019
2955
|
function isStep0Block(content) {
|
|
3020
|
-
|
|
2956
|
+
const first = firstNonBlankLine(content);
|
|
2957
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3021
2958
|
}
|
|
3022
2959
|
function checkCommandsCarryOutput(prBody) {
|
|
3023
2960
|
const errors = [];
|
|
@@ -3403,1513 +3340,1602 @@ function checkPrReportDensity(prBody) {
|
|
|
3403
3340
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3404
3341
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3405
3342
|
}
|
|
3406
|
-
// ../../packages/aeg-core/src/
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
{ name: "Sizing", pattern: "Sizing" },
|
|
3414
|
-
{ name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
|
|
3415
|
-
{ name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
|
|
3416
|
-
{ name: "Traps to avoid", pattern: "Traps" },
|
|
3417
|
-
{ name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
|
|
3418
|
-
{ name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
|
|
3419
|
-
{ name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
|
|
3343
|
+
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3344
|
+
var PRODUCT_SLUG_SCOPE = [
|
|
3345
|
+
"apps/cli/src",
|
|
3346
|
+
".github/workflows",
|
|
3347
|
+
".vinaya",
|
|
3348
|
+
"apps/cli/README.md",
|
|
3349
|
+
"packages/sources/README.md"
|
|
3420
3350
|
];
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
const errors = [];
|
|
3424
|
-
for (const f of RATIONALE_FIELDS) {
|
|
3425
|
-
if (!hasRationaleField(body, f.pattern)) {
|
|
3426
|
-
errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
|
|
3427
|
-
continue;
|
|
3428
|
-
}
|
|
3429
|
-
if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
|
|
3430
|
-
errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
|
|
3431
|
-
}
|
|
3432
|
-
}
|
|
3433
|
-
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3434
|
-
}
|
|
3435
|
-
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3436
|
-
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3437
|
-
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3438
|
-
return { status: "pass", errors: [] };
|
|
3439
|
-
const result = objectivesOf(body);
|
|
3440
|
-
if (result.ok)
|
|
3441
|
-
return { status: "pass", errors: [] };
|
|
3442
|
-
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
3351
|
+
function isUnderOrEqual(path, prefix) {
|
|
3352
|
+
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3443
3353
|
}
|
|
3444
|
-
function
|
|
3445
|
-
|
|
3446
|
-
const heading = headingRe.exec(body);
|
|
3447
|
-
if (!heading)
|
|
3448
|
-
return null;
|
|
3449
|
-
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3450
|
-
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3451
|
-
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3354
|
+
function isProductScopeFile(path) {
|
|
3355
|
+
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
3452
3356
|
}
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
const start = text.indexOf("`", i);
|
|
3457
|
-
if (start === -1)
|
|
3458
|
-
return false;
|
|
3459
|
-
const end = text.indexOf("`", start + 1);
|
|
3460
|
-
if (end === -1)
|
|
3461
|
-
return false;
|
|
3462
|
-
if (text.slice(start + 1, end).includes("/"))
|
|
3463
|
-
return true;
|
|
3464
|
-
i = end + 1;
|
|
3465
|
-
}
|
|
3466
|
-
return false;
|
|
3357
|
+
var SHIPS_PREFIX = "aeg-root/";
|
|
3358
|
+
function shipsArchivePrefix(shipsPrefix) {
|
|
3359
|
+
return `${shipsPrefix}tranches/completed/`;
|
|
3467
3360
|
}
|
|
3468
|
-
var
|
|
3469
|
-
function
|
|
3470
|
-
|
|
3361
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3362
|
+
function normalizeSpecPath(entry) {
|
|
3363
|
+
let out = entry.replace(/\\/g, "/");
|
|
3364
|
+
while (out.startsWith("./"))
|
|
3365
|
+
out = out.slice(2);
|
|
3366
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3367
|
+
while (out.endsWith("/"))
|
|
3368
|
+
out = out.slice(0, -1);
|
|
3369
|
+
return out;
|
|
3471
3370
|
}
|
|
3472
|
-
function
|
|
3473
|
-
|
|
3371
|
+
function isSpecFile2(path, specPaths) {
|
|
3372
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
3373
|
+
return true;
|
|
3374
|
+
if (!path.endsWith(".md"))
|
|
3375
|
+
return false;
|
|
3376
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
3474
3377
|
}
|
|
3475
|
-
function
|
|
3476
|
-
|
|
3477
|
-
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3478
|
-
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3479
|
-
return extMatch !== null && extMatch.index > 0;
|
|
3378
|
+
function isClaudeMdFile(path) {
|
|
3379
|
+
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3480
3380
|
}
|
|
3481
|
-
function
|
|
3482
|
-
|
|
3381
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
3382
|
+
if (path.startsWith(shipsPrefix)) {
|
|
3383
|
+
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3384
|
+
}
|
|
3385
|
+
if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
|
|
3386
|
+
return "reader-facing";
|
|
3387
|
+
}
|
|
3388
|
+
if (isClaudeMdFile(path))
|
|
3389
|
+
return "internal";
|
|
3390
|
+
if (isSpecFile2(path, specPaths))
|
|
3391
|
+
return "spec";
|
|
3392
|
+
if (isProductScopeFile(path))
|
|
3393
|
+
return "product";
|
|
3394
|
+
return null;
|
|
3483
3395
|
}
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
if (
|
|
3487
|
-
return
|
|
3488
|
-
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3489
|
-
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3490
|
-
const errors = [];
|
|
3491
|
-
if (!inLine)
|
|
3492
|
-
errors.push("`## Surface` has no `in:` line.");
|
|
3493
|
-
if (!outLine)
|
|
3494
|
-
errors.push("`## Surface` has no `out:` line.");
|
|
3495
|
-
if (errors.length > 0)
|
|
3496
|
-
return { ok: false, errors };
|
|
3497
|
-
const inGlobs = splitGlobList(inLine[1]);
|
|
3498
|
-
const outGlobs = splitGlobList(outLine[1]);
|
|
3499
|
-
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3500
|
-
if (looksLikeFilePath(g)) {
|
|
3501
|
-
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3502
|
-
}
|
|
3396
|
+
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3397
|
+
function stripNonProse(path, content) {
|
|
3398
|
+
if (path.endsWith(".md")) {
|
|
3399
|
+
return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
|
|
3503
3400
|
}
|
|
3504
|
-
if (
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
3401
|
+
if (path.endsWith(".tsx") || path.endsWith(".ts")) {
|
|
3402
|
+
return content.replace(/\/\*.*?\*\//gs, (m) => m.replace(/[^\n]/g, "")).replace(/(^|[^:])\/\/[^\n]*/g, (m) => m.replace(/[^\n]/g, ""));
|
|
3403
|
+
}
|
|
3404
|
+
return content;
|
|
3509
3405
|
}
|
|
3510
|
-
function
|
|
3511
|
-
|
|
3512
|
-
const p = path.replace(/\/+$/, "");
|
|
3513
|
-
if (g === "*")
|
|
3514
|
-
return !p.includes("/");
|
|
3515
|
-
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3406
|
+
function stripNonProseForProduct(path, content) {
|
|
3407
|
+
return path.endsWith(".md") ? stripNonProse(path, content) : content;
|
|
3516
3408
|
}
|
|
3517
|
-
function
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
for (const glob of surface.value.in) {
|
|
3523
|
-
if (!resolvesToFile(glob)) {
|
|
3524
|
-
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3525
|
-
}
|
|
3409
|
+
function lineAt(content, index) {
|
|
3410
|
+
let line = 1;
|
|
3411
|
+
for (let i = 0;i < index; i++) {
|
|
3412
|
+
if (content.charCodeAt(i) === 10)
|
|
3413
|
+
line++;
|
|
3526
3414
|
}
|
|
3527
|
-
return
|
|
3415
|
+
return line;
|
|
3528
3416
|
}
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
}
|
|
3538
|
-
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3417
|
+
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
3418
|
+
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
3419
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
3420
|
+
function legacySlugPattern(legacySlugs) {
|
|
3421
|
+
if (legacySlugs.length === 0)
|
|
3422
|
+
return null;
|
|
3423
|
+
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3424
|
+
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3539
3425
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
const
|
|
3546
|
-
const
|
|
3547
|
-
const
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3426
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3427
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3428
|
+
}
|
|
3429
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3430
|
+
const findings = [];
|
|
3431
|
+
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3432
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3433
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3434
|
+
const patterns = [
|
|
3435
|
+
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3436
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3437
|
+
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3438
|
+
];
|
|
3439
|
+
const productPatterns = [
|
|
3440
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3441
|
+
];
|
|
3442
|
+
const specPatterns = [
|
|
3443
|
+
...patterns,
|
|
3444
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3445
|
+
];
|
|
3446
|
+
for (const file of files) {
|
|
3447
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3448
|
+
if (!cls || cls === "internal")
|
|
3449
|
+
continue;
|
|
3450
|
+
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3451
|
+
continue;
|
|
3452
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3563
3453
|
continue;
|
|
3454
|
+
const blocking = cls === "product" || cls === "spec";
|
|
3455
|
+
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3456
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3457
|
+
const fileFindings = [];
|
|
3458
|
+
for (const { pattern, what, group } of patternsToRun) {
|
|
3459
|
+
pattern.lastIndex = 0;
|
|
3460
|
+
let match = pattern.exec(scrubbed);
|
|
3461
|
+
while (match !== null) {
|
|
3462
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3463
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3464
|
+
fileFindings.push({
|
|
3465
|
+
file: file.path,
|
|
3466
|
+
line: lineAt(scrubbed, citedIndex),
|
|
3467
|
+
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3468
|
+
blocking
|
|
3469
|
+
});
|
|
3470
|
+
match = pattern.exec(scrubbed);
|
|
3471
|
+
}
|
|
3564
3472
|
}
|
|
3565
|
-
const
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
if (errors.length > 0)
|
|
3572
|
-
return { ok: false, errors };
|
|
3573
|
-
return { ok: true, value: parts };
|
|
3574
|
-
}
|
|
3575
|
-
function checkPartsCiteDefinedObjectives(body) {
|
|
3576
|
-
const parts = parseIssueParts(body);
|
|
3577
|
-
const objectives = objectivesOf(body);
|
|
3578
|
-
if (!parts.ok || !objectives.ok)
|
|
3579
|
-
return { status: "pass", errors: [] };
|
|
3580
|
-
const definedIds = new Set(objectives.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
3581
|
-
const errors = [];
|
|
3582
|
-
for (const part of parts.value) {
|
|
3583
|
-
for (const objectiveId of part.objectiveIds) {
|
|
3584
|
-
if (!definedIds.has(objectiveId)) {
|
|
3585
|
-
errors.push(`issue-validation Parts: Part ${part.n} cites O${objectiveId}, which the Issue's own \`## Objectives\` section does not define.`);
|
|
3473
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3474
|
+
if (limit !== undefined) {
|
|
3475
|
+
if (fileFindings.length <= limit)
|
|
3476
|
+
continue;
|
|
3477
|
+
for (const f of fileFindings) {
|
|
3478
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3586
3479
|
}
|
|
3587
3480
|
}
|
|
3481
|
+
findings.push(...fileFindings);
|
|
3588
3482
|
}
|
|
3589
|
-
return
|
|
3590
|
-
}
|
|
3591
|
-
function isTaskIssueLabelSet(labels) {
|
|
3592
|
-
return hasLabel("tranche", labels);
|
|
3593
|
-
}
|
|
3594
|
-
function checkTrancheLabelPresence(_body, _labels) {
|
|
3595
|
-
return { status: "pass", errors: [] };
|
|
3596
|
-
}
|
|
3597
|
-
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
3598
|
-
if (!isTaskIssueLabelSet(labels))
|
|
3599
|
-
return { status: "pass", errors: [] };
|
|
3600
|
-
if (resolvedMilestoneTitle === null)
|
|
3601
|
-
return { status: "pass", errors: [] };
|
|
3602
|
-
if (currentMilestoneTitle === resolvedMilestoneTitle)
|
|
3603
|
-
return { status: "pass", errors: [] };
|
|
3604
|
-
return {
|
|
3605
|
-
status: "fail",
|
|
3606
|
-
errors: [
|
|
3607
|
-
`issue-validation milestone attach: this task Issue's tranche label resolves to Milestone "${resolvedMilestoneTitle}", but its live Milestone is ${currentMilestoneTitle === null ? "unset" : `"${currentMilestoneTitle}"`} — attach it to "${resolvedMilestoneTitle}".`
|
|
3608
|
-
]
|
|
3609
|
-
};
|
|
3610
|
-
}
|
|
3611
|
-
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
3612
|
-
function isControlCodePoint(codePoint) {
|
|
3613
|
-
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
3614
|
-
}
|
|
3615
|
-
function isDisplayControlCodePoint(codePoint) {
|
|
3616
|
-
return codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
3483
|
+
return findings;
|
|
3617
3484
|
}
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
const shown = values.slice(0, MESSAGE_VALUE_COUNT_MAX).map((v) => `\`${forMessage(v)}\``);
|
|
3621
|
-
const rest = values.length - shown.length;
|
|
3622
|
-
return rest > 0 ? `${shown.join(", ")} and ${rest} more` : shown.join(", ");
|
|
3485
|
+
function escapeTerm(term) {
|
|
3486
|
+
return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3623
3487
|
}
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
const
|
|
3627
|
-
|
|
3628
|
-
const codePoint = ch.codePointAt(0) ?? 0;
|
|
3629
|
-
if (isControlCodePoint(codePoint) || isDisplayControlCodePoint(codePoint))
|
|
3630
|
-
continue;
|
|
3631
|
-
kept.push(ch);
|
|
3632
|
-
}
|
|
3633
|
-
const cleaned = kept.join("").trim();
|
|
3634
|
-
if (cleaned.length === 0)
|
|
3635
|
-
return "(unprintable)";
|
|
3636
|
-
const points = Array.from(cleaned);
|
|
3637
|
-
return points.length > MESSAGE_VALUE_MAX ? `${points.slice(0, MESSAGE_VALUE_MAX).join("")}…` : cleaned;
|
|
3488
|
+
function containsWholeWord(text, term) {
|
|
3489
|
+
const escaped = escapeTerm(term);
|
|
3490
|
+
const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
|
|
3491
|
+
return re.test(text);
|
|
3638
3492
|
}
|
|
3639
|
-
function
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
const errors = [];
|
|
3648
|
-
if (field.unreadable) {
|
|
3649
|
-
return {
|
|
3650
|
-
status: "fail",
|
|
3651
|
-
errors: [
|
|
3652
|
-
`issue-validation project registry: the body has an unterminated code fence, so its \`**Project:**\` field could not be read reliably — the fence runs to end of body (CommonMark, and how the forge renders it), swallowing everything after it including the foot field where the declaration lives by convention. Read from the raw body the field says ${residueForMessage(field.unparsed) || "(nothing)"}, but a line inside a swallowed region may be a quoted example rather than a real declaration, so this gate refuses rather than guessing which. Balance the fences — every opening run of backticks or tildes needs a closing run at least as long — and the field reads normally.`
|
|
3653
|
-
]
|
|
3654
|
-
};
|
|
3655
|
-
}
|
|
3656
|
-
const unregistered = field.names.filter((p) => !known.has(p));
|
|
3657
|
-
if (unregistered.length > 0) {
|
|
3658
|
-
const caseHints = unregistered.map((p) => {
|
|
3659
|
-
const row = [...known].find((k) => k.toLowerCase() === p.toLowerCase());
|
|
3660
|
-
return row ? `\`${forMessage(p)}\` differs from the registered \`${forMessage(row)}\` only in case` : null;
|
|
3661
|
-
}).filter((h) => h !== null);
|
|
3662
|
-
errors.push(`issue-validation project registry: the \`**Project:**\` field declares ${unregistered.map(forMessage).join(", ")} — no such row in \`.vinaya/projects.md\`, which is the authority for valid project names (registered: ${registeredList}). Fix the name, or register the project with \`vinaya init product <name> --path <folder>\` first; an unregistered project has no specs to read and no per-project state to update.${caseHints.length > 0 ? ` Note: ${caseHints.join("; ")} — project names are matched exactly, because every downstream consumer compares them literally.` : ""} This reads the same field \`projectsFromBody\` derives the task's project from, so a name here that is not a row is a task that resolves to a project that does not exist.`);
|
|
3663
|
-
}
|
|
3664
|
-
if (field.names.length === 0) {
|
|
3665
|
-
const residue = field.unparsed.length > 0 ? ` — ${residueForMessage(field.unparsed)}` : " — the field is empty";
|
|
3666
|
-
errors.push(`issue-validation project registry: the \`**Project:**\` field is present but resolves to no project name${residue} (registered: ${registeredList}). A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); prose, a parenthetical, or a sentence in this field resolves to no project at all, and this gate cannot check a name it never receives — which is how a declaration like this used to pass. Write the registered name on its own, or register the project with \`vinaya init product <name> --path <folder>\` first. If the task genuinely touches no registered project, omit the field rather than explaining its absence inside it — \`checkIssueRationale\` already requires the \`Project(s) + blast radius\` narrative field for that.`);
|
|
3667
|
-
} else if (field.unparsed.length > 0) {
|
|
3668
|
-
errors.push(`issue-validation project registry: the \`**Project:**\` field declares a value that is not a project name — ${residueForMessage(field.unparsed)} (registered: ${registeredList}). The rest of the field parsed, so this is a name the gate silently could not check rather than a field it could not read at all. A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); write it on its own, or drop it if it names no project.`);
|
|
3493
|
+
function findWholeWordLine(content, term) {
|
|
3494
|
+
const lines = content.split(`
|
|
3495
|
+
`);
|
|
3496
|
+
let lineNo = 0;
|
|
3497
|
+
for (const line of lines) {
|
|
3498
|
+
lineNo++;
|
|
3499
|
+
if (containsWholeWord(line, term))
|
|
3500
|
+
return lineNo;
|
|
3669
3501
|
}
|
|
3670
|
-
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
3671
|
-
}
|
|
3672
|
-
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
3673
|
-
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
3674
|
-
|
|
3675
|
-
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
3676
|
-
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
3677
|
-
var TRANCHE_BRANCH_PATTERN = /^task\/([^/]+)\/([^/]+)$/;
|
|
3678
|
-
function parseTaskBranchIdentity(branch) {
|
|
3679
|
-
const issueMatch = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
3680
|
-
if (issueMatch)
|
|
3681
|
-
return { kind: "issue", issueNumber: Number(issueMatch[1]) };
|
|
3682
|
-
const trancheMatch = TRANCHE_BRANCH_PATTERN.exec(branch);
|
|
3683
|
-
if (trancheMatch)
|
|
3684
|
-
return { kind: "tranche", tranche: trancheMatch[1], taskId: trancheMatch[2] };
|
|
3685
3502
|
return null;
|
|
3686
3503
|
}
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
3504
|
+
function definesOrLinksGlossary(content, term) {
|
|
3505
|
+
const escaped = escapeTerm(term);
|
|
3506
|
+
const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
|
|
3507
|
+
if (definesInline)
|
|
3508
|
+
return true;
|
|
3509
|
+
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3694
3510
|
}
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
const
|
|
3698
|
-
|
|
3699
|
-
if (!
|
|
3700
|
-
continue;
|
|
3701
|
-
if (e.facts.stateReason === "not_planned")
|
|
3511
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
3512
|
+
const findings = [];
|
|
3513
|
+
for (const file of files) {
|
|
3514
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3515
|
+
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
3702
3516
|
continue;
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3517
|
+
const scrubbed = stripNonProse(file.path, file.content);
|
|
3518
|
+
for (const term of glossaryTerms) {
|
|
3519
|
+
const line = findWholeWordLine(scrubbed, term);
|
|
3520
|
+
if (line === null)
|
|
3706
3521
|
continue;
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
});
|
|
3715
|
-
}
|
|
3716
|
-
}
|
|
3717
|
-
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
3718
|
-
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
3719
|
-
return {
|
|
3720
|
-
check: "A1",
|
|
3721
|
-
status,
|
|
3722
|
-
failures,
|
|
3723
|
-
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
3724
|
-
};
|
|
3725
|
-
}
|
|
3726
|
-
function checkA3(entries) {
|
|
3727
|
-
const failures = [];
|
|
3728
|
-
for (const e of entries) {
|
|
3729
|
-
if (!e.facts)
|
|
3730
|
-
continue;
|
|
3731
|
-
if (e.facts.prState === "merged" && e.facts.issueState !== "closed") {
|
|
3732
|
-
failures.push({
|
|
3733
|
-
code: "auto-close-misfire",
|
|
3734
|
-
issue: e.task.issue,
|
|
3735
|
-
tranche: e.trancheSlug,
|
|
3736
|
-
task: e.task.id,
|
|
3737
|
-
reason: "Closing PR is merged but Issue is still open (GitHub auto-close misfire)",
|
|
3738
|
-
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
3522
|
+
if (definesOrLinksGlossary(scrubbed, term))
|
|
3523
|
+
continue;
|
|
3524
|
+
findings.push({
|
|
3525
|
+
file: file.path,
|
|
3526
|
+
line,
|
|
3527
|
+
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3528
|
+
blocking: false
|
|
3739
3529
|
});
|
|
3740
3530
|
}
|
|
3741
3531
|
}
|
|
3742
|
-
|
|
3743
|
-
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
3744
|
-
return {
|
|
3745
|
-
check: "A3",
|
|
3746
|
-
status,
|
|
3747
|
-
failures,
|
|
3748
|
-
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
3749
|
-
};
|
|
3532
|
+
return findings;
|
|
3750
3533
|
}
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
continue;
|
|
3773
|
-
const topologySet = topologyIssuesBySlug.get(slug) ?? new Set;
|
|
3774
|
-
for (const num of openNums) {
|
|
3775
|
-
if (!topologySet.has(num)) {
|
|
3776
|
-
failures.push({
|
|
3777
|
-
code: "orphan-task",
|
|
3778
|
-
issue: num,
|
|
3779
|
-
tranche: slug,
|
|
3780
|
-
reason: `Issue #${num} is open and labeled ${trancheLabel(slug)} but does not appear in the topology file`
|
|
3781
|
-
});
|
|
3534
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
|
|
3535
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
|
|
3536
|
+
function extractComments(path, content) {
|
|
3537
|
+
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3538
|
+
return content.replace(/[^\n]/g, "");
|
|
3539
|
+
let state = "code";
|
|
3540
|
+
let out = "";
|
|
3541
|
+
const n = content.length;
|
|
3542
|
+
let i = 0;
|
|
3543
|
+
const blank = (ch) => ch === `
|
|
3544
|
+
` ? `
|
|
3545
|
+
` : " ";
|
|
3546
|
+
while (i < n) {
|
|
3547
|
+
const c = content[i];
|
|
3548
|
+
const next = i + 1 < n ? content[i + 1] : "";
|
|
3549
|
+
if (state === "code") {
|
|
3550
|
+
if (c === "/" && next === "/") {
|
|
3551
|
+
state = "line-comment";
|
|
3552
|
+
out += c;
|
|
3553
|
+
i++;
|
|
3554
|
+
continue;
|
|
3782
3555
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3556
|
+
if (c === "/" && next === "*") {
|
|
3557
|
+
state = "block-comment";
|
|
3558
|
+
out += c;
|
|
3559
|
+
i++;
|
|
3560
|
+
continue;
|
|
3561
|
+
}
|
|
3562
|
+
if (c === "'") {
|
|
3563
|
+
state = "single-quote";
|
|
3564
|
+
out += blank(c);
|
|
3565
|
+
i++;
|
|
3566
|
+
continue;
|
|
3567
|
+
}
|
|
3568
|
+
if (c === '"') {
|
|
3569
|
+
state = "double-quote";
|
|
3570
|
+
out += blank(c);
|
|
3571
|
+
i++;
|
|
3572
|
+
continue;
|
|
3573
|
+
}
|
|
3574
|
+
if (c === "`") {
|
|
3575
|
+
state = "template";
|
|
3576
|
+
out += blank(c);
|
|
3577
|
+
i++;
|
|
3578
|
+
continue;
|
|
3802
3579
|
}
|
|
3580
|
+
out += blank(c);
|
|
3581
|
+
i++;
|
|
3582
|
+
continue;
|
|
3803
3583
|
}
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3584
|
+
if (state === "line-comment") {
|
|
3585
|
+
if (c === `
|
|
3586
|
+
`) {
|
|
3587
|
+
state = "code";
|
|
3588
|
+
out += `
|
|
3589
|
+
`;
|
|
3590
|
+
i++;
|
|
3809
3591
|
continue;
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3592
|
+
}
|
|
3593
|
+
out += c;
|
|
3594
|
+
i++;
|
|
3595
|
+
continue;
|
|
3596
|
+
}
|
|
3597
|
+
if (state === "block-comment") {
|
|
3598
|
+
if (c === "*" && next === "/") {
|
|
3599
|
+
out += c;
|
|
3600
|
+
out += next;
|
|
3601
|
+
state = "code";
|
|
3602
|
+
i += 2;
|
|
3819
3603
|
continue;
|
|
3820
3604
|
}
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3605
|
+
out += c === `
|
|
3606
|
+
` ? `
|
|
3607
|
+
` : c;
|
|
3608
|
+
i++;
|
|
3609
|
+
continue;
|
|
3610
|
+
}
|
|
3611
|
+
const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
|
|
3612
|
+
if (c === "\\") {
|
|
3613
|
+
out += blank(c);
|
|
3614
|
+
i++;
|
|
3615
|
+
if (i < n) {
|
|
3616
|
+
out += blank(content[i]);
|
|
3617
|
+
i++;
|
|
3618
|
+
}
|
|
3619
|
+
continue;
|
|
3620
|
+
}
|
|
3621
|
+
if (c === closer) {
|
|
3622
|
+
state = "code";
|
|
3623
|
+
out += blank(c);
|
|
3624
|
+
i++;
|
|
3625
|
+
continue;
|
|
3829
3626
|
}
|
|
3627
|
+
out += blank(c);
|
|
3628
|
+
i++;
|
|
3830
3629
|
}
|
|
3831
|
-
|
|
3832
|
-
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
3833
|
-
return {
|
|
3834
|
-
check: "T3",
|
|
3835
|
-
status,
|
|
3836
|
-
failures,
|
|
3837
|
-
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
3838
|
-
};
|
|
3630
|
+
return out;
|
|
3839
3631
|
}
|
|
3840
|
-
function
|
|
3841
|
-
const
|
|
3842
|
-
|
|
3843
|
-
|
|
3632
|
+
function checkSourceComments(files, allowlist = []) {
|
|
3633
|
+
const findings = [];
|
|
3634
|
+
const allowed = new Set(allowlist);
|
|
3635
|
+
const patterns = [
|
|
3636
|
+
{ pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
|
|
3637
|
+
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3638
|
+
];
|
|
3639
|
+
for (const file of files) {
|
|
3640
|
+
if (!file.path.endsWith(".ts"))
|
|
3844
3641
|
continue;
|
|
3845
|
-
if (
|
|
3642
|
+
if (allowed.has(file.path))
|
|
3846
3643
|
continue;
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
tranche: e.trancheSlug,
|
|
3858
|
-
task: e.task.id,
|
|
3859
|
-
reason: `INTERNAL: parsed a self-dependency (depends-on ${dep}) — this is a parser bug in parseRationaleDeps, not a real dependency. Please report it upstream.`
|
|
3860
|
-
});
|
|
3861
|
-
continue;
|
|
3862
|
-
}
|
|
3863
|
-
const depFacts = depEntry.facts;
|
|
3864
|
-
const depClosed = depFacts?.issueState === "closed";
|
|
3865
|
-
if (!depClosed) {
|
|
3866
|
-
failures.push({
|
|
3867
|
-
code: "dispatched-on-unmet-deps",
|
|
3868
|
-
issue: e.task.issue,
|
|
3869
|
-
tranche: e.trancheSlug,
|
|
3870
|
-
task: e.task.id,
|
|
3871
|
-
reason: `Task has open PR but depends-on ${dep} (issue #${depEntry.task.issue ?? "?"}) is not closed`
|
|
3644
|
+
const comments = extractComments(file.path, file.content);
|
|
3645
|
+
for (const { pattern, what } of patterns) {
|
|
3646
|
+
pattern.lastIndex = 0;
|
|
3647
|
+
let match = pattern.exec(comments);
|
|
3648
|
+
while (match !== null) {
|
|
3649
|
+
findings.push({
|
|
3650
|
+
file: file.path,
|
|
3651
|
+
line: lineAt(comments, match.index),
|
|
3652
|
+
message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
|
|
3653
|
+
blocking: false
|
|
3872
3654
|
});
|
|
3655
|
+
match = pattern.exec(comments);
|
|
3873
3656
|
}
|
|
3874
3657
|
}
|
|
3875
3658
|
}
|
|
3876
|
-
return
|
|
3659
|
+
return findings;
|
|
3877
3660
|
}
|
|
3878
|
-
function
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3661
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3662
|
+
return [
|
|
3663
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3664
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
3665
|
+
];
|
|
3883
3666
|
}
|
|
3884
|
-
function
|
|
3885
|
-
const
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3893
|
-
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
3894
|
-
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3895
|
-
];
|
|
3896
|
-
if (errors.length === 0)
|
|
3897
|
-
continue;
|
|
3898
|
-
failures.push({
|
|
3899
|
-
code: "missing-rationale-field",
|
|
3900
|
-
issue: issue.number,
|
|
3901
|
-
tranche: slug,
|
|
3902
|
-
reason: `Issue #${issue.number} fails the rationale gate: ${errors.join(" | ")}`,
|
|
3903
|
-
grandfathered: grandfatheredIssues.has(issue.number)
|
|
3904
|
-
});
|
|
3905
|
-
}
|
|
3667
|
+
function parseGlossaryTerms(glossaryContent) {
|
|
3668
|
+
const terms = [];
|
|
3669
|
+
const re = /^\*\*(.+?)\*\* —/gm;
|
|
3670
|
+
let match = re.exec(glossaryContent);
|
|
3671
|
+
while (match !== null) {
|
|
3672
|
+
if (match[1] !== undefined)
|
|
3673
|
+
terms.push(match[1]);
|
|
3674
|
+
match = re.exec(glossaryContent);
|
|
3906
3675
|
}
|
|
3907
|
-
|
|
3908
|
-
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
3909
|
-
return {
|
|
3910
|
-
check: "R1",
|
|
3911
|
-
status,
|
|
3912
|
-
failures,
|
|
3913
|
-
note: status === "info" ? `${failures.length} grandfathered task Issue(s) predate this check's grammar (rationale fields and/or the project registry)` : undefined
|
|
3914
|
-
};
|
|
3676
|
+
return terms;
|
|
3915
3677
|
}
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3678
|
+
|
|
3679
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3680
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3681
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3682
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3683
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3684
|
+
function isValidCitedFilePath(path) {
|
|
3685
|
+
if (path.length === 0)
|
|
3686
|
+
return false;
|
|
3687
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3688
|
+
return false;
|
|
3689
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3690
|
+
return false;
|
|
3691
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3692
|
+
}
|
|
3693
|
+
function quotedCommandLineAt(content, index) {
|
|
3694
|
+
let line = 1;
|
|
3695
|
+
for (let i = 0;i < index; i++) {
|
|
3696
|
+
if (content.charCodeAt(i) === 10)
|
|
3697
|
+
line++;
|
|
3698
|
+
}
|
|
3699
|
+
return line;
|
|
3700
|
+
}
|
|
3701
|
+
function extractQuotedText(raw) {
|
|
3702
|
+
const trimmed = raw.trim();
|
|
3703
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3704
|
+
if (fenced)
|
|
3705
|
+
return (fenced[1] ?? "").trim();
|
|
3706
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3707
|
+
if (inline)
|
|
3708
|
+
return (inline[1] ?? "").trim();
|
|
3709
|
+
return trimmed;
|
|
3710
|
+
}
|
|
3711
|
+
function findQuotesInFile(path, content) {
|
|
3712
|
+
const masked = maskCode(content);
|
|
3713
|
+
const quotes = [];
|
|
3714
|
+
START_PATTERN.lastIndex = 0;
|
|
3715
|
+
let start = START_PATTERN.exec(masked);
|
|
3716
|
+
while (start !== null) {
|
|
3717
|
+
const citedFile = start[1];
|
|
3718
|
+
const innerStart = start.index + start[0].length;
|
|
3719
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3720
|
+
if (end === null) {
|
|
3721
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3722
|
+
start = START_PATTERN.exec(masked);
|
|
3924
3723
|
continue;
|
|
3925
|
-
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
3926
|
-
if (allClosed) {
|
|
3927
|
-
failures.push({
|
|
3928
|
-
code: "archive-recommended",
|
|
3929
|
-
tranche: f.slug,
|
|
3930
|
-
reason: "Active tranche has no open task-Issues — consider archiving to completed/"
|
|
3931
|
-
});
|
|
3932
3724
|
}
|
|
3725
|
+
const innerEnd = innerStart + end.index;
|
|
3726
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3727
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3728
|
+
if (quotedText.length > 0) {
|
|
3729
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3733
|
+
start = START_PATTERN.exec(masked);
|
|
3933
3734
|
}
|
|
3934
|
-
return
|
|
3935
|
-
check: "L1",
|
|
3936
|
-
status: "info",
|
|
3937
|
-
failures,
|
|
3938
|
-
note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
|
|
3939
|
-
};
|
|
3940
|
-
}
|
|
3941
|
-
function checkL3(files) {
|
|
3942
|
-
const active = files.filter((f) => !f.archived);
|
|
3943
|
-
return {
|
|
3944
|
-
check: "L3",
|
|
3945
|
-
status: "info",
|
|
3946
|
-
failures: [],
|
|
3947
|
-
note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
|
|
3948
|
-
};
|
|
3735
|
+
return quotes;
|
|
3949
3736
|
}
|
|
3950
|
-
function
|
|
3951
|
-
const
|
|
3952
|
-
const
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3737
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3738
|
+
const quotes = [];
|
|
3739
|
+
for (const file of files) {
|
|
3740
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3741
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3742
|
+
continue;
|
|
3743
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3957
3744
|
}
|
|
3958
|
-
return
|
|
3745
|
+
return quotes;
|
|
3959
3746
|
}
|
|
3960
|
-
function
|
|
3961
|
-
const
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
}
|
|
3747
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3748
|
+
const findings = [];
|
|
3749
|
+
for (const quote of citedQuotes) {
|
|
3750
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3751
|
+
if (content === undefined) {
|
|
3752
|
+
findings.push({
|
|
3753
|
+
file: quote.file,
|
|
3754
|
+
line: quote.line,
|
|
3755
|
+
citedFile: quote.citedFile,
|
|
3756
|
+
quotedText: quote.quotedText,
|
|
3757
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3758
|
+
});
|
|
3759
|
+
continue;
|
|
3974
3760
|
}
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
ok: false,
|
|
3984
|
-
expectedIssue,
|
|
3985
|
-
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3986
|
-
};
|
|
3761
|
+
if (!content.includes(quote.quotedText)) {
|
|
3762
|
+
findings.push({
|
|
3763
|
+
file: quote.file,
|
|
3764
|
+
line: quote.line,
|
|
3765
|
+
citedFile: quote.citedFile,
|
|
3766
|
+
quotedText: quote.quotedText,
|
|
3767
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3768
|
+
});
|
|
3987
3769
|
}
|
|
3988
|
-
return { ok: true, expectedIssue };
|
|
3989
|
-
}
|
|
3990
|
-
const trancheSlug = ref.tranche;
|
|
3991
|
-
const taskId = ref.taskId;
|
|
3992
|
-
const trancheFile = trancheFiles.find((f) => f.slug === trancheSlug);
|
|
3993
|
-
if (!trancheFile) {
|
|
3994
|
-
return {
|
|
3995
|
-
ok: false,
|
|
3996
|
-
message: `closes-n: branch "${branch}" references tranche "${trancheSlug}" but no topology file found at aeg-root/tranches/${trancheSlug}.md. Ensure the tranche file exists before opening the PR.`
|
|
3997
|
-
};
|
|
3998
|
-
}
|
|
3999
|
-
const task = trancheFile.tranche.tasks.find((t) => t.id === taskId);
|
|
4000
|
-
if (!task) {
|
|
4001
|
-
return {
|
|
4002
|
-
ok: false,
|
|
4003
|
-
message: `closes-n: branch "${branch}" references task "${taskId}" not found in ${trancheSlug} topology. Verify the task ID matches the tranche file.`
|
|
4004
|
-
};
|
|
4005
|
-
}
|
|
4006
|
-
if (task.issue === null) {
|
|
4007
|
-
return {
|
|
4008
|
-
ok: false,
|
|
4009
|
-
message: `closes-n: task "${taskId}" in "${trancheSlug}" has no Issue number (#TBD). The Planner must cut the Issue before this PR can be validated.`
|
|
4010
|
-
};
|
|
4011
|
-
}
|
|
4012
|
-
const expectedIssue = task.issue;
|
|
4013
|
-
if (!referenced.has(expectedIssue)) {
|
|
4014
|
-
return {
|
|
4015
|
-
ok: false,
|
|
4016
|
-
expectedIssue,
|
|
4017
|
-
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for task "${taskId}" in tranche "${trancheSlug}"). Add it to the PR body Summary section.`
|
|
4018
|
-
};
|
|
4019
3770
|
}
|
|
4020
|
-
return
|
|
3771
|
+
return findings;
|
|
4021
3772
|
}
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
3773
|
+
|
|
3774
|
+
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3775
|
+
function hasRationaleField(body, labelPattern) {
|
|
3776
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
3777
|
+
return re.test(body);
|
|
4025
3778
|
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
3779
|
+
var RATIONALE_FIELDS = [
|
|
3780
|
+
{ name: "Boundary", pattern: "Boundary" },
|
|
3781
|
+
{ name: "Sizing", pattern: "Sizing" },
|
|
3782
|
+
{ name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
|
|
3783
|
+
{ name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
|
|
3784
|
+
{ name: "Traps to avoid", pattern: "Traps" },
|
|
3785
|
+
{ name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
|
|
3786
|
+
{ name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
|
|
3787
|
+
{ name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
|
|
3788
|
+
];
|
|
3789
|
+
var DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale";
|
|
3790
|
+
function checkIssueRationale(body) {
|
|
3791
|
+
const errors = [];
|
|
3792
|
+
for (const f of RATIONALE_FIELDS) {
|
|
3793
|
+
if (!hasRationaleField(body, f.pattern)) {
|
|
3794
|
+
errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
|
|
3795
|
+
continue;
|
|
3796
|
+
}
|
|
3797
|
+
if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
|
|
3798
|
+
errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
|
|
3799
|
+
}
|
|
4036
3800
|
}
|
|
4037
|
-
|
|
4038
|
-
if (bodyNums.length === 0)
|
|
4039
|
-
return { issue: null, extraIssues: [], outsideHeader: false };
|
|
4040
|
-
const issue = headerNums.length > 0 ? headerNums[0] : bodyNums[0];
|
|
4041
|
-
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: headerNums.length === 0 };
|
|
4042
|
-
}
|
|
4043
|
-
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4044
|
-
import { createHash as createHash4 } from "node:crypto";
|
|
4045
|
-
function briefHash(brief) {
|
|
4046
|
-
return createHash4("sha256").update(`${brief}
|
|
4047
|
-
`).digest("hex");
|
|
3801
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
4048
3802
|
}
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
3803
|
+
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3804
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3805
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3806
|
+
return { status: "pass", errors: [] };
|
|
3807
|
+
const result = objectivesOf(body);
|
|
3808
|
+
if (result.ok)
|
|
3809
|
+
return { status: "pass", errors: [] };
|
|
3810
|
+
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
4055
3811
|
}
|
|
4056
|
-
function
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
3812
|
+
function topLevelSectionText(body, headingName) {
|
|
3813
|
+
const headingRe = new RegExp(`^##[ \\t]*${headingName}[ \\t]*$`, "im");
|
|
3814
|
+
const heading = headingRe.exec(body);
|
|
3815
|
+
if (!heading)
|
|
3816
|
+
return null;
|
|
3817
|
+
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3818
|
+
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3819
|
+
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
4060
3820
|
}
|
|
4061
|
-
function
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
3821
|
+
function partHasBacktickedPath(text) {
|
|
3822
|
+
let i = 0;
|
|
3823
|
+
while (i < text.length) {
|
|
3824
|
+
const start = text.indexOf("`", i);
|
|
3825
|
+
if (start === -1)
|
|
3826
|
+
return false;
|
|
3827
|
+
const end = text.indexOf("`", start + 1);
|
|
3828
|
+
if (end === -1)
|
|
3829
|
+
return false;
|
|
3830
|
+
if (text.slice(start + 1, end).includes("/"))
|
|
3831
|
+
return true;
|
|
3832
|
+
i = end + 1;
|
|
3833
|
+
}
|
|
3834
|
+
return false;
|
|
4069
3835
|
}
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
if (!echoed.baseSha)
|
|
4074
|
-
return false;
|
|
4075
|
-
return currentBase.toLowerCase().startsWith(echoed.baseSha.toLowerCase());
|
|
3836
|
+
var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
|
|
3837
|
+
function stripPartBackticks(text) {
|
|
3838
|
+
return text.replace(/`[^`\n]*`/g, " ");
|
|
4076
3839
|
}
|
|
4077
|
-
function
|
|
4078
|
-
|
|
4079
|
-
return true;
|
|
4080
|
-
return echoed.objectivesVersion === currentVersion;
|
|
3840
|
+
function partWordCount(text) {
|
|
3841
|
+
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
4081
3842
|
}
|
|
4082
|
-
function
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
3843
|
+
function looksLikeFilePath(entry) {
|
|
3844
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3845
|
+
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3846
|
+
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3847
|
+
return extMatch !== null && extMatch.index > 0;
|
|
4086
3848
|
}
|
|
4087
|
-
function
|
|
4088
|
-
|
|
4089
|
-
return true;
|
|
4090
|
-
return echoed.briefHash === currentHash;
|
|
3849
|
+
function splitGlobList(raw) {
|
|
3850
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
4091
3851
|
}
|
|
4092
|
-
function
|
|
4093
|
-
|
|
3852
|
+
function parseIssueSurface(body) {
|
|
3853
|
+
const section = topLevelSectionText(body, "Surface");
|
|
3854
|
+
if (section === null)
|
|
3855
|
+
return { ok: false, errors: ["no `## Surface` heading found in the body."] };
|
|
3856
|
+
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3857
|
+
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3858
|
+
const errors = [];
|
|
3859
|
+
if (!inLine)
|
|
3860
|
+
errors.push("`## Surface` has no `in:` line.");
|
|
3861
|
+
if (!outLine)
|
|
3862
|
+
errors.push("`## Surface` has no `out:` line.");
|
|
3863
|
+
if (errors.length > 0)
|
|
3864
|
+
return { ok: false, errors };
|
|
3865
|
+
const inGlobs = splitGlobList(inLine[1]);
|
|
3866
|
+
const outGlobs = splitGlobList(outLine[1]);
|
|
3867
|
+
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3868
|
+
if (looksLikeFilePath(g)) {
|
|
3869
|
+
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
if (inGlobs.length === 0)
|
|
3873
|
+
errors.push("`## Surface`'s `in:` line resolved to zero globs.");
|
|
3874
|
+
if (errors.length > 0)
|
|
3875
|
+
return { ok: false, errors };
|
|
3876
|
+
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
4094
3877
|
}
|
|
4095
|
-
function
|
|
4096
|
-
const
|
|
4097
|
-
const
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4102
|
-
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4103
|
-
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4104
|
-
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4105
|
-
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4106
|
-
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4107
|
-
return {
|
|
4108
|
-
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4109
|
-
head,
|
|
4110
|
-
base,
|
|
4111
|
-
briefHash: briefHashBound,
|
|
4112
|
-
objectivesVersion,
|
|
4113
|
-
rulingOrdinal,
|
|
4114
|
-
policyDigest: policyDigestBound
|
|
4115
|
-
};
|
|
3878
|
+
function globCoversPath(glob, path) {
|
|
3879
|
+
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3880
|
+
const p = path.replace(/\/+$/, "");
|
|
3881
|
+
if (g === "*")
|
|
3882
|
+
return !p.includes("/");
|
|
3883
|
+
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
4116
3884
|
}
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
const
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
});
|
|
4127
|
-
if (waived) {
|
|
4128
|
-
return {
|
|
4129
|
-
verdict: "pass",
|
|
4130
|
-
reason: `\`${WAIVER_LABEL_REVIEW}\` label is actor-verified — review requirement waived for this PR.`,
|
|
4131
|
-
waived: true
|
|
4132
|
-
};
|
|
3885
|
+
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
3886
|
+
const surface = parseIssueSurface(body);
|
|
3887
|
+
if (!surface.ok)
|
|
3888
|
+
return { status: "pass", errors: [] };
|
|
3889
|
+
const errors = [];
|
|
3890
|
+
for (const glob of surface.value.in) {
|
|
3891
|
+
if (!resolvesToFile(glob)) {
|
|
3892
|
+
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3893
|
+
}
|
|
4133
3894
|
}
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
const
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4145
|
-
} catch (err) {
|
|
4146
|
-
return {
|
|
4147
|
-
verdict: "fail",
|
|
4148
|
-
reason: `a verdict comment carries a finding severity this repository's policy does not recognize: ${err instanceof Error ? err.message : String(err)}`,
|
|
4149
|
-
waived: false
|
|
4150
|
-
};
|
|
3895
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3896
|
+
}
|
|
3897
|
+
function checkSurfaceScope(changedFiles, outGlobs) {
|
|
3898
|
+
if (outGlobs.length === 0)
|
|
3899
|
+
return { ok: true };
|
|
3900
|
+
const violations = [];
|
|
3901
|
+
for (const file of changedFiles) {
|
|
3902
|
+
const glob = outGlobs.find((g) => globCoversPath(g, file));
|
|
3903
|
+
if (glob)
|
|
3904
|
+
violations.push({ file, glob });
|
|
4151
3905
|
}
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
const
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
};
|
|
4182
|
-
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
4183
|
-
const securityBinding = compareManifest(securityEchoed, currentManifest, input.patchIdOf);
|
|
4184
|
-
const codeReviewBound = codeReviewBinding.head;
|
|
4185
|
-
const securityBound = securityBinding.head;
|
|
4186
|
-
const codeReviewObjectivesBound = codeReviewBinding.objectivesVersion;
|
|
4187
|
-
const securityObjectivesBound = securityBinding.objectivesVersion;
|
|
4188
|
-
const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
|
|
4189
|
-
const securityRulingsBound = securityBinding.rulingOrdinal;
|
|
4190
|
-
if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
|
|
4191
|
-
return {
|
|
4192
|
-
verdict: "pass",
|
|
4193
|
-
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.`,
|
|
4194
|
-
waived: false
|
|
4195
|
-
};
|
|
3906
|
+
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3907
|
+
}
|
|
3908
|
+
var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
|
|
3909
|
+
function parseIssueParts(body) {
|
|
3910
|
+
const section = topLevelSectionText(body, "Parts");
|
|
3911
|
+
if (section === null)
|
|
3912
|
+
return { ok: false, errors: ["no `## Parts` heading found in the body."] };
|
|
3913
|
+
const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
3914
|
+
const parts = [];
|
|
3915
|
+
const errors = [];
|
|
3916
|
+
for (const line of lines) {
|
|
3917
|
+
const m = ISSUE_PART_LINE_RE.exec(line);
|
|
3918
|
+
if (!m) {
|
|
3919
|
+
errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
|
|
3920
|
+
continue;
|
|
3921
|
+
}
|
|
3922
|
+
const n = Number.parseInt(m[1], 10);
|
|
3923
|
+
const refs = m[2];
|
|
3924
|
+
const text = m[3].trim();
|
|
3925
|
+
if (text.length === 0) {
|
|
3926
|
+
errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
|
|
3927
|
+
continue;
|
|
3928
|
+
}
|
|
3929
|
+
if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
3930
|
+
errors.push(`Part ${n} is little more than a file path — a Part names an outcome and symbols, never a bare path.`);
|
|
3931
|
+
continue;
|
|
3932
|
+
}
|
|
3933
|
+
const objectiveIds = [...refs.matchAll(/O(\d+)/g)].map((r) => Number.parseInt(r[1], 10));
|
|
3934
|
+
parts.push({ n, objectiveIds, text });
|
|
4196
3935
|
}
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
4200
|
-
} else if (!codeReviewPolicyClean) {
|
|
4201
|
-
problems.push(`code-reviewer verdict says APPROVE but carries a finding (${codeReviewPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's code-review policy threshold (${policy.codeReviewThreshold}) — a reviewer's own APPROVE never overrides policy`);
|
|
4202
|
-
} else if (!codeReviewBound) {
|
|
4203
|
-
problems.push(`the newest code-review verdict covers ${codeReview.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
4204
|
-
} else if (!codeReviewBinding.base) {
|
|
4205
|
-
problems.push(`the newest code-review verdict was cast against base ${codeReview.baseSha ?? "no recorded base"}, the PR's base is now ${currentManifest.baseSha ?? "unresolved"} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`);
|
|
4206
|
-
} else if (!codeReviewObjectivesBound) {
|
|
4207
|
-
problems.push(`the newest code-review verdict was cast against objectives version ${codeReview.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
4208
|
-
} else if (!codeReviewRulingsBound) {
|
|
4209
|
-
problems.push(`the newest code-review verdict was cast against ruling ordinal ${codeReview.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4210
|
-
} else if (!codeReviewBinding.briefHash) {
|
|
4211
|
-
problems.push(`the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4212
|
-
} else if (!codeReviewBinding.policyDigest) {
|
|
4213
|
-
problems.push(`the newest code-review verdict was cast against review policy digest ${codeReview.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
3936
|
+
if (parts.length === 0) {
|
|
3937
|
+
errors.push("the `## Parts` section has no well-formed `Part <n> (<refs>) — <outcome>` lines.");
|
|
4214
3938
|
}
|
|
4215
|
-
if (
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
3939
|
+
if (errors.length > 0)
|
|
3940
|
+
return { ok: false, errors };
|
|
3941
|
+
return { ok: true, value: parts };
|
|
3942
|
+
}
|
|
3943
|
+
function checkPartsCiteDefinedObjectives(body) {
|
|
3944
|
+
const parts = parseIssueParts(body);
|
|
3945
|
+
const objectives = objectivesOf(body);
|
|
3946
|
+
if (!parts.ok || !objectives.ok)
|
|
3947
|
+
return { status: "pass", errors: [] };
|
|
3948
|
+
const definedIds = new Set(objectives.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
3949
|
+
const errors = [];
|
|
3950
|
+
for (const part of parts.value) {
|
|
3951
|
+
for (const objectiveId of part.objectiveIds) {
|
|
3952
|
+
if (!definedIds.has(objectiveId)) {
|
|
3953
|
+
errors.push(`issue-validation Parts: Part ${part.n} cites O${objectiveId}, which the Issue's own \`## Objectives\` section does not define.`);
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
4231
3956
|
}
|
|
4232
|
-
|
|
3957
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3958
|
+
}
|
|
3959
|
+
function isTaskIssueLabelSet(labels) {
|
|
3960
|
+
return hasLabel("tranche", labels);
|
|
3961
|
+
}
|
|
3962
|
+
function checkTrancheLabelPresence(_body, _labels) {
|
|
3963
|
+
return { status: "pass", errors: [] };
|
|
3964
|
+
}
|
|
3965
|
+
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
3966
|
+
if (!isTaskIssueLabelSet(labels))
|
|
3967
|
+
return { status: "pass", errors: [] };
|
|
3968
|
+
if (resolvedMilestoneTitle === null)
|
|
3969
|
+
return { status: "pass", errors: [] };
|
|
3970
|
+
if (currentMilestoneTitle === resolvedMilestoneTitle)
|
|
3971
|
+
return { status: "pass", errors: [] };
|
|
4233
3972
|
return {
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
3973
|
+
status: "fail",
|
|
3974
|
+
errors: [
|
|
3975
|
+
`issue-validation milestone attach: this task Issue's tranche label resolves to Milestone "${resolvedMilestoneTitle}", but its live Milestone is ${currentMilestoneTitle === null ? "unset" : `"${currentMilestoneTitle}"`} — attach it to "${resolvedMilestoneTitle}".`
|
|
3976
|
+
]
|
|
4237
3977
|
};
|
|
4238
3978
|
}
|
|
4239
|
-
var
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
|
|
3979
|
+
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
3980
|
+
function isControlCodePoint(codePoint) {
|
|
3981
|
+
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
4243
3982
|
}
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
4247
|
-
let best = 0;
|
|
4248
|
-
for (const c of comments) {
|
|
4249
|
-
if (!isPrincipal(c.author, allowlist))
|
|
4250
|
-
continue;
|
|
4251
|
-
const firstLine = (c.body.split(`
|
|
4252
|
-
`)[0] ?? "").trim();
|
|
4253
|
-
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
4254
|
-
if (!m)
|
|
4255
|
-
continue;
|
|
4256
|
-
const k = Number.parseInt(m[1], 10);
|
|
4257
|
-
if (k > best)
|
|
4258
|
-
best = k;
|
|
4259
|
-
}
|
|
4260
|
-
return best;
|
|
3983
|
+
function isDisplayControlCodePoint(codePoint) {
|
|
3984
|
+
return codePoint >= 8203 && codePoint <= 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
4261
3985
|
}
|
|
4262
|
-
|
|
4263
|
-
function
|
|
4264
|
-
const
|
|
4265
|
-
|
|
3986
|
+
var MESSAGE_VALUE_COUNT_MAX = 5;
|
|
3987
|
+
function residueForMessage(values) {
|
|
3988
|
+
const shown = values.slice(0, MESSAGE_VALUE_COUNT_MAX).map((v) => `\`${forMessage(v)}\``);
|
|
3989
|
+
const rest = values.length - shown.length;
|
|
3990
|
+
return rest > 0 ? `${shown.join(", ")} and ${rest} more` : shown.join(", ");
|
|
4266
3991
|
}
|
|
4267
|
-
var
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
if (TABLE_ROW_PATTERN.test(line)) {
|
|
4276
|
-
const headerLine = line;
|
|
4277
|
-
const sepLine = lines[i + 1] ?? "";
|
|
4278
|
-
if (!SEPARATOR_ROW_PATTERN.test(sepLine)) {
|
|
4279
|
-
i++;
|
|
4280
|
-
continue;
|
|
4281
|
-
}
|
|
4282
|
-
const headers = splitRow(headerLine);
|
|
4283
|
-
const rows = [];
|
|
4284
|
-
let j = i + 2;
|
|
4285
|
-
while (j < lines.length && TABLE_ROW_PATTERN.test(lines[j] ?? "")) {
|
|
4286
|
-
rows.push({ cells: splitRow(lines[j] ?? ""), line: j + 1 });
|
|
4287
|
-
j++;
|
|
4288
|
-
}
|
|
4289
|
-
return { headers, rows };
|
|
4290
|
-
}
|
|
4291
|
-
i++;
|
|
3992
|
+
var MESSAGE_VALUE_MAX = 64;
|
|
3993
|
+
function forMessage(value) {
|
|
3994
|
+
const kept = [];
|
|
3995
|
+
for (const ch of value.replace(/\s+/g, " ")) {
|
|
3996
|
+
const codePoint = ch.codePointAt(0) ?? 0;
|
|
3997
|
+
if (isControlCodePoint(codePoint) || isDisplayControlCodePoint(codePoint))
|
|
3998
|
+
continue;
|
|
3999
|
+
kept.push(ch);
|
|
4292
4000
|
}
|
|
4293
|
-
|
|
4001
|
+
const cleaned = kept.join("").trim();
|
|
4002
|
+
if (cleaned.length === 0)
|
|
4003
|
+
return "(unprintable)";
|
|
4004
|
+
const points = Array.from(cleaned);
|
|
4005
|
+
return points.length > MESSAGE_VALUE_MAX ? `${points.slice(0, MESSAGE_VALUE_MAX).join("")}…` : cleaned;
|
|
4294
4006
|
}
|
|
4295
|
-
function
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4007
|
+
function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
4008
|
+
if (registeredNames.length === 0)
|
|
4009
|
+
return { status: "pass", errors: [] };
|
|
4010
|
+
const field = projectFieldFromBody(body);
|
|
4011
|
+
if (!field.declared)
|
|
4012
|
+
return { status: "pass", errors: [] };
|
|
4013
|
+
const known = new Set(registeredNames.map((n) => n.trim()));
|
|
4014
|
+
const registeredList = [...registeredNames].map(forMessage).join(", ");
|
|
4015
|
+
const errors = [];
|
|
4016
|
+
if (field.unreadable) {
|
|
4017
|
+
return {
|
|
4018
|
+
status: "fail",
|
|
4019
|
+
errors: [
|
|
4020
|
+
`issue-validation project registry: the body has an unterminated code fence, so its \`**Project:**\` field could not be read reliably — the fence runs to end of body (CommonMark, and how the forge renders it), swallowing everything after it including the foot field where the declaration lives by convention. Read from the raw body the field says ${residueForMessage(field.unparsed) || "(nothing)"}, but a line inside a swallowed region may be a quoted example rather than a real declaration, so this gate refuses rather than guessing which. Balance the fences — every opening run of backticks or tildes needs a closing run at least as long — and the field reads normally.`
|
|
4021
|
+
]
|
|
4022
|
+
};
|
|
4299
4023
|
}
|
|
4300
|
-
|
|
4024
|
+
const unregistered = field.names.filter((p) => !known.has(p));
|
|
4025
|
+
if (unregistered.length > 0) {
|
|
4026
|
+
const caseHints = unregistered.map((p) => {
|
|
4027
|
+
const row = [...known].find((k) => k.toLowerCase() === p.toLowerCase());
|
|
4028
|
+
return row ? `\`${forMessage(p)}\` differs from the registered \`${forMessage(row)}\` only in case` : null;
|
|
4029
|
+
}).filter((h) => h !== null);
|
|
4030
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field declares ${unregistered.map(forMessage).join(", ")} — no such row in \`.vinaya/projects.md\`, which is the authority for valid project names (registered: ${registeredList}). Fix the name, or register the project with \`vinaya init product <name> --path <folder>\` first; an unregistered project has no specs to read and no per-project state to update.${caseHints.length > 0 ? ` Note: ${caseHints.join("; ")} — project names are matched exactly, because every downstream consumer compares them literally.` : ""} This reads the same field \`projectsFromBody\` derives the task's project from, so a name here that is not a row is a task that resolves to a project that does not exist.`);
|
|
4031
|
+
}
|
|
4032
|
+
if (field.names.length === 0) {
|
|
4033
|
+
const residue = field.unparsed.length > 0 ? ` — ${residueForMessage(field.unparsed)}` : " — the field is empty";
|
|
4034
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field is present but resolves to no project name${residue} (registered: ${registeredList}). A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); prose, a parenthetical, or a sentence in this field resolves to no project at all, and this gate cannot check a name it never receives — which is how a declaration like this used to pass. Write the registered name on its own, or register the project with \`vinaya init product <name> --path <folder>\` first. If the task genuinely touches no registered project, omit the field rather than explaining its absence inside it — \`checkIssueRationale\` already requires the \`Project(s) + blast radius\` narrative field for that.`);
|
|
4035
|
+
} else if (field.unparsed.length > 0) {
|
|
4036
|
+
errors.push(`issue-validation project registry: the \`**Project:**\` field declares a value that is not a project name — ${residueForMessage(field.unparsed)} (registered: ${registeredList}). The rest of the field parsed, so this is a name the gate silently could not check rather than a field it could not read at all. A project name is a slug (\`[a-z0-9][a-z0-9-]*\`, matched exactly); write it on its own, or drop it if it names no project.`);
|
|
4037
|
+
}
|
|
4038
|
+
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
4301
4039
|
}
|
|
4302
|
-
|
|
4303
|
-
|
|
4040
|
+
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
4041
|
+
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
4042
|
+
var FILE_EXTENSIONS = new Set([
|
|
4043
|
+
"ts",
|
|
4044
|
+
"tsx",
|
|
4045
|
+
"js",
|
|
4046
|
+
"jsx",
|
|
4047
|
+
"mjs",
|
|
4048
|
+
"cjs",
|
|
4049
|
+
"json",
|
|
4050
|
+
"jsonc",
|
|
4051
|
+
"md",
|
|
4052
|
+
"mdx",
|
|
4053
|
+
"yml",
|
|
4054
|
+
"yaml",
|
|
4055
|
+
"txt",
|
|
4056
|
+
"sh",
|
|
4057
|
+
"lock",
|
|
4058
|
+
"toml",
|
|
4059
|
+
"ndjson",
|
|
4060
|
+
"html",
|
|
4061
|
+
"css"
|
|
4062
|
+
]);
|
|
4304
4063
|
|
|
4305
|
-
// ../../packages/aeg-core/src/
|
|
4306
|
-
var
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
const
|
|
4313
|
-
if (
|
|
4314
|
-
return
|
|
4315
|
-
|
|
4316
|
-
return trimmed;
|
|
4064
|
+
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
4065
|
+
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
4066
|
+
var TRANCHE_BRANCH_PATTERN = /^task\/([^/]+)\/([^/]+)$/;
|
|
4067
|
+
function parseTaskBranchIdentity(branch) {
|
|
4068
|
+
const issueMatch = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
4069
|
+
if (issueMatch)
|
|
4070
|
+
return { kind: "issue", issueNumber: Number(issueMatch[1]) };
|
|
4071
|
+
const trancheMatch = TRANCHE_BRANCH_PATTERN.exec(branch);
|
|
4072
|
+
if (trancheMatch)
|
|
4073
|
+
return { kind: "tranche", tranche: trancheMatch[1], taskId: trancheMatch[2] };
|
|
4074
|
+
return null;
|
|
4317
4075
|
}
|
|
4318
|
-
|
|
4319
|
-
|
|
4076
|
+
|
|
4077
|
+
// ../../packages/aeg-core/src/coherence-checks.ts
|
|
4078
|
+
var COHERENCE_ENFORCED_FROM = "2026-07-01";
|
|
4079
|
+
function isGrandfathered(isoDate) {
|
|
4080
|
+
if (!isoDate)
|
|
4081
|
+
return false;
|
|
4082
|
+
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
4320
4083
|
}
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
const
|
|
4325
|
-
|
|
4326
|
-
const headingLine = findHeadingLine(lines, pattern);
|
|
4327
|
-
if (headingLine === null)
|
|
4084
|
+
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4085
|
+
function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
4086
|
+
const failures = [];
|
|
4087
|
+
for (const e of entries) {
|
|
4088
|
+
if (!e.facts)
|
|
4328
4089
|
continue;
|
|
4329
|
-
|
|
4330
|
-
if (!table)
|
|
4090
|
+
if (e.facts.stateReason === "not_planned")
|
|
4331
4091
|
continue;
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
for (const row of table.rows) {
|
|
4336
|
-
const cells = row.cells;
|
|
4337
|
-
if (cells.length < 3)
|
|
4092
|
+
if (e.facts.issueState === "closed" && e.facts.prState !== "merged") {
|
|
4093
|
+
const handClosed = e.facts.stateReason === "completed" && isPrincipal(e.facts.closedByActor, principalAllowlist);
|
|
4094
|
+
if (handClosed)
|
|
4338
4095
|
continue;
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
|
|
4347
|
-
result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
|
|
4348
|
-
}
|
|
4349
|
-
}
|
|
4350
|
-
return result;
|
|
4351
|
-
}
|
|
4352
|
-
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4353
|
-
function checkG1(rows, existsFn) {
|
|
4354
|
-
const findings = [];
|
|
4355
|
-
for (const row of rows) {
|
|
4356
|
-
if (row.implementation === "")
|
|
4357
|
-
continue;
|
|
4358
|
-
if (!existsFn(row.implementation)) {
|
|
4359
|
-
findings.push({
|
|
4360
|
-
row: row.action,
|
|
4361
|
-
path: row.implementation,
|
|
4362
|
-
reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
|
|
4096
|
+
failures.push({
|
|
4097
|
+
code: "closed-without-merge",
|
|
4098
|
+
issue: e.task.issue,
|
|
4099
|
+
tranche: e.trancheSlug,
|
|
4100
|
+
task: e.task.id,
|
|
4101
|
+
reason: `Issue closed but closing PR is not merged (prState: ${e.facts.prState})`,
|
|
4102
|
+
grandfathered: isGrandfathered(e.facts.closedAt)
|
|
4363
4103
|
});
|
|
4364
4104
|
}
|
|
4365
4105
|
}
|
|
4366
|
-
|
|
4106
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
4107
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
4108
|
+
return {
|
|
4109
|
+
check: "A1",
|
|
4110
|
+
status,
|
|
4111
|
+
failures,
|
|
4112
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4113
|
+
};
|
|
4367
4114
|
}
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
4373
|
-
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
4374
|
-
};
|
|
4375
|
-
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
4376
|
-
function checkG2(rows, candidateFiles) {
|
|
4377
|
-
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
4378
|
-
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
4379
|
-
const findings = [];
|
|
4380
|
-
for (const path of candidateFiles) {
|
|
4381
|
-
if (implementations.has(path))
|
|
4382
|
-
continue;
|
|
4383
|
-
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
4384
|
-
continue;
|
|
4385
|
-
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
4386
|
-
continue;
|
|
4387
|
-
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
4388
|
-
continue;
|
|
4389
|
-
const candidateNames = claimedCheckNames(path);
|
|
4390
|
-
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
4115
|
+
function checkA3(entries) {
|
|
4116
|
+
const failures = [];
|
|
4117
|
+
for (const e of entries) {
|
|
4118
|
+
if (!e.facts)
|
|
4391
4119
|
continue;
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
findings.push({
|
|
4401
|
-
row: row.action,
|
|
4402
|
-
path: row.implementation,
|
|
4403
|
-
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
4404
|
-
});
|
|
4405
|
-
}
|
|
4406
|
-
}
|
|
4407
|
-
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4408
|
-
}
|
|
4409
|
-
function checkG3(ring0Rows, crossingFiles) {
|
|
4410
|
-
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
4411
|
-
const findings = [];
|
|
4412
|
-
for (const path of crossingFiles) {
|
|
4413
|
-
if (!ring0Implementations.has(path)) {
|
|
4414
|
-
findings.push({
|
|
4415
|
-
path,
|
|
4416
|
-
reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
|
|
4120
|
+
if (e.facts.prState === "merged" && e.facts.issueState !== "closed") {
|
|
4121
|
+
failures.push({
|
|
4122
|
+
code: "auto-close-misfire",
|
|
4123
|
+
issue: e.task.issue,
|
|
4124
|
+
tranche: e.trancheSlug,
|
|
4125
|
+
task: e.task.id,
|
|
4126
|
+
reason: "Closing PR is merged but Issue is still open (GitHub auto-close misfire)",
|
|
4127
|
+
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
4417
4128
|
});
|
|
4418
4129
|
}
|
|
4419
4130
|
}
|
|
4420
|
-
|
|
4131
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
4132
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
4133
|
+
return {
|
|
4134
|
+
check: "A3",
|
|
4135
|
+
status,
|
|
4136
|
+
failures,
|
|
4137
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4138
|
+
};
|
|
4421
4139
|
}
|
|
4422
|
-
function
|
|
4423
|
-
const
|
|
4424
|
-
for (const
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4140
|
+
function checkT1(entries) {
|
|
4141
|
+
const failures = [];
|
|
4142
|
+
for (const e of entries) {
|
|
4143
|
+
if (e.task.issue === null)
|
|
4144
|
+
continue;
|
|
4145
|
+
if (e.facts === undefined) {
|
|
4146
|
+
failures.push({
|
|
4147
|
+
code: "phantom-issue-ref",
|
|
4148
|
+
issue: e.task.issue,
|
|
4149
|
+
tranche: e.trancheSlug,
|
|
4150
|
+
task: e.task.id,
|
|
4151
|
+
reason: `Issue #${e.task.issue} in topology does not resolve to a real GitHub Issue`
|
|
4432
4152
|
});
|
|
4433
4153
|
}
|
|
4434
4154
|
}
|
|
4435
|
-
return { check: "
|
|
4155
|
+
return { check: "T1", status: failures.length > 0 ? "fail" : "pass", failures };
|
|
4436
4156
|
}
|
|
4437
|
-
function
|
|
4438
|
-
const
|
|
4439
|
-
const
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
}
|
|
4452
|
-
}
|
|
4453
|
-
}
|
|
4454
|
-
for (const role of roles) {
|
|
4455
|
-
if (role.performs.length === 0) {
|
|
4456
|
-
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
|
|
4457
|
-
}
|
|
4458
|
-
if (role.refuses_when.trim() === "") {
|
|
4459
|
-
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
|
|
4157
|
+
function checkT2(openIssuesBySlug, topologyIssuesBySlug, ciTrancheSlug) {
|
|
4158
|
+
const failures = [];
|
|
4159
|
+
for (const [slug, openNums] of openIssuesBySlug) {
|
|
4160
|
+
if (ciTrancheSlug && slug !== ciTrancheSlug)
|
|
4161
|
+
continue;
|
|
4162
|
+
const topologySet = topologyIssuesBySlug.get(slug) ?? new Set;
|
|
4163
|
+
for (const num of openNums) {
|
|
4164
|
+
if (!topologySet.has(num)) {
|
|
4165
|
+
failures.push({
|
|
4166
|
+
code: "orphan-task",
|
|
4167
|
+
issue: num,
|
|
4168
|
+
tranche: slug,
|
|
4169
|
+
reason: `Issue #${num} is open and labeled ${trancheLabel(slug)} but does not appear in the topology file`
|
|
4170
|
+
});
|
|
4171
|
+
}
|
|
4460
4172
|
}
|
|
4461
4173
|
}
|
|
4462
|
-
return { check: "
|
|
4174
|
+
return { check: "T2", status: failures.length > 0 ? "fail" : "pass", failures };
|
|
4463
4175
|
}
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4176
|
+
function scopeT2ToPlanPr(result, isPlanPr) {
|
|
4177
|
+
if (isPlanPr || result.status !== "fail")
|
|
4178
|
+
return result;
|
|
4179
|
+
return {
|
|
4180
|
+
...result,
|
|
4181
|
+
status: "info",
|
|
4182
|
+
note: result.note ?? "T2 findings are non-blocking outside plan PRs (point-of-power principle) — see aeg-root/enforcement.md."
|
|
4183
|
+
};
|
|
4469
4184
|
}
|
|
4470
|
-
function
|
|
4471
|
-
|
|
4472
|
-
|
|
4185
|
+
function checkT3(entries, ciTrancheSlug, enrichedEntries, forgeUnavailableSlugs) {
|
|
4186
|
+
const preEnforcement = new Set;
|
|
4187
|
+
if (enrichedEntries) {
|
|
4188
|
+
for (const e of enrichedEntries) {
|
|
4189
|
+
if (isGrandfathered(e.facts?.closedAt) || isGrandfathered(e.facts?.mergedAt)) {
|
|
4190
|
+
preEnforcement.add(e.trancheSlug);
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4473
4193
|
}
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
if (
|
|
4477
|
-
|
|
4194
|
+
const failures = [];
|
|
4195
|
+
for (const e of entries) {
|
|
4196
|
+
if (!e.archived && e.task.issue === null) {
|
|
4197
|
+
if (ciTrancheSlug && e.trancheSlug !== ciTrancheSlug)
|
|
4198
|
+
continue;
|
|
4199
|
+
if (forgeUnavailableSlugs?.has(e.trancheSlug)) {
|
|
4200
|
+
failures.push({
|
|
4201
|
+
code: "tbd-in-active-tranche",
|
|
4202
|
+
issue: null,
|
|
4203
|
+
tranche: e.trancheSlug,
|
|
4204
|
+
task: e.task.id,
|
|
4205
|
+
reason: `Task ${e.task.id} in active tranche has no Issue ref (#TBD or empty), but forge data for tranche "${e.trancheSlug}" was unavailable — cannot evaluate grandfather status, not silently failed`,
|
|
4206
|
+
grandfathered: true
|
|
4207
|
+
});
|
|
4208
|
+
continue;
|
|
4209
|
+
}
|
|
4210
|
+
failures.push({
|
|
4211
|
+
code: "tbd-in-active-tranche",
|
|
4212
|
+
issue: null,
|
|
4213
|
+
tranche: e.trancheSlug,
|
|
4214
|
+
task: e.task.id,
|
|
4215
|
+
reason: `Task ${e.task.id} in active tranche has no Issue ref (#TBD or empty) — the model requires all active tasks to have Issue numbers`,
|
|
4216
|
+
grandfathered: preEnforcement.has(e.trancheSlug)
|
|
4217
|
+
});
|
|
4478
4218
|
}
|
|
4479
4219
|
}
|
|
4480
|
-
|
|
4220
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
4221
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
4222
|
+
return {
|
|
4223
|
+
check: "T3",
|
|
4224
|
+
status,
|
|
4225
|
+
failures,
|
|
4226
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4227
|
+
};
|
|
4481
4228
|
}
|
|
4482
|
-
function
|
|
4483
|
-
const
|
|
4484
|
-
for (const
|
|
4485
|
-
if (
|
|
4229
|
+
function checkD1(entries, issueToEntry, taskToEntry) {
|
|
4230
|
+
const failures = [];
|
|
4231
|
+
for (const e of entries) {
|
|
4232
|
+
if (!e.facts)
|
|
4486
4233
|
continue;
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4234
|
+
if (e.facts.prState !== "open")
|
|
4235
|
+
continue;
|
|
4236
|
+
for (const dep of e.task.dependsOn) {
|
|
4237
|
+
const depEntry = resolveDepEntry(dep, e.trancheSlug, issueToEntry, taskToEntry);
|
|
4238
|
+
if (!depEntry)
|
|
4239
|
+
continue;
|
|
4240
|
+
const sameTask = depEntry.trancheSlug === e.trancheSlug && depEntry.task.id === e.task.id;
|
|
4241
|
+
const sameIssue = depEntry.task.issue !== null && e.task.issue !== null && depEntry.task.issue === e.task.issue;
|
|
4242
|
+
if (sameTask || sameIssue) {
|
|
4243
|
+
failures.push({
|
|
4244
|
+
code: "d1-self-dependency",
|
|
4245
|
+
issue: e.task.issue,
|
|
4246
|
+
tranche: e.trancheSlug,
|
|
4247
|
+
task: e.task.id,
|
|
4248
|
+
reason: `INTERNAL: parsed a self-dependency (depends-on ${dep}) — this is a parser bug in parseRationaleDeps, not a real dependency. Please report it upstream.`
|
|
4249
|
+
});
|
|
4250
|
+
continue;
|
|
4251
|
+
}
|
|
4252
|
+
const depFacts = depEntry.facts;
|
|
4253
|
+
const depClosed = depFacts?.issueState === "closed";
|
|
4254
|
+
if (!depClosed) {
|
|
4255
|
+
failures.push({
|
|
4256
|
+
code: "dispatched-on-unmet-deps",
|
|
4257
|
+
issue: e.task.issue,
|
|
4258
|
+
tranche: e.trancheSlug,
|
|
4259
|
+
task: e.task.id,
|
|
4260
|
+
reason: `Task has open PR but depends-on ${dep} (issue #${depEntry.task.issue ?? "?"}) is not closed`
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4494
4263
|
}
|
|
4495
4264
|
}
|
|
4496
|
-
return { check: "
|
|
4265
|
+
return { check: "D1", status: failures.length > 0 ? "fail" : "pass", failures };
|
|
4497
4266
|
}
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
"apps/cli/README.md",
|
|
4504
|
-
"packages/sources/README.md"
|
|
4505
|
-
];
|
|
4506
|
-
function isUnderOrEqual(path, prefix) {
|
|
4507
|
-
return path === prefix || path.startsWith(`${prefix}/`);
|
|
4508
|
-
}
|
|
4509
|
-
function isProductScopeFile(path) {
|
|
4510
|
-
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
4267
|
+
function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
|
|
4268
|
+
const issueMatch = dep.match(/^#(\d+)$/);
|
|
4269
|
+
if (issueMatch?.[1])
|
|
4270
|
+
return issueToEntry.get(Number(issueMatch[1]));
|
|
4271
|
+
return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
|
|
4511
4272
|
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4273
|
+
function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
|
|
4274
|
+
const failures = [];
|
|
4275
|
+
for (const [slug, issues] of issuesBySlug) {
|
|
4276
|
+
for (const issue of issues) {
|
|
4277
|
+
if (!isTaskIssueLabelSet(issue.labels))
|
|
4278
|
+
continue;
|
|
4279
|
+
const errors = [
|
|
4280
|
+
...checkIssueRationale(issue.body).errors,
|
|
4281
|
+
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
4282
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
4283
|
+
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
4284
|
+
];
|
|
4285
|
+
if (errors.length === 0)
|
|
4286
|
+
continue;
|
|
4287
|
+
failures.push({
|
|
4288
|
+
code: "missing-rationale-field",
|
|
4289
|
+
issue: issue.number,
|
|
4290
|
+
tranche: slug,
|
|
4291
|
+
reason: `Issue #${issue.number} fails the rationale gate: ${errors.join(" | ")}`,
|
|
4292
|
+
grandfathered: grandfatheredIssues.has(issue.number)
|
|
4293
|
+
});
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
4297
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
4298
|
+
return {
|
|
4299
|
+
check: "R1",
|
|
4300
|
+
status,
|
|
4301
|
+
failures,
|
|
4302
|
+
note: status === "info" ? `${failures.length} grandfathered task Issue(s) predate this check's grammar (rationale fields and/or the project registry)` : undefined
|
|
4303
|
+
};
|
|
4515
4304
|
}
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4305
|
+
function checkL1(files, entriesBySlug) {
|
|
4306
|
+
const failures = [];
|
|
4307
|
+
for (const f of files) {
|
|
4308
|
+
if (f.archived)
|
|
4309
|
+
continue;
|
|
4310
|
+
const entries = entriesBySlug.get(f.slug) ?? [];
|
|
4311
|
+
const withFacts = entries.filter((e) => e.facts !== undefined);
|
|
4312
|
+
if (withFacts.length === 0)
|
|
4313
|
+
continue;
|
|
4314
|
+
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
4315
|
+
if (allClosed) {
|
|
4316
|
+
failures.push({
|
|
4317
|
+
code: "archive-recommended",
|
|
4318
|
+
tranche: f.slug,
|
|
4319
|
+
reason: "Active tranche has no open task-Issues — consider archiving to completed/"
|
|
4320
|
+
});
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
return {
|
|
4324
|
+
check: "L1",
|
|
4325
|
+
status: "info",
|
|
4326
|
+
failures,
|
|
4327
|
+
note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
|
|
4328
|
+
};
|
|
4525
4329
|
}
|
|
4526
|
-
function
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4330
|
+
function checkL3(files) {
|
|
4331
|
+
const active = files.filter((f) => !f.archived);
|
|
4332
|
+
return {
|
|
4333
|
+
check: "L3",
|
|
4334
|
+
status: "info",
|
|
4335
|
+
failures: [],
|
|
4336
|
+
note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
|
|
4337
|
+
};
|
|
4532
4338
|
}
|
|
4533
|
-
function
|
|
4534
|
-
|
|
4339
|
+
function extractClosesReferences(prBody) {
|
|
4340
|
+
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#(\d+)/gi;
|
|
4341
|
+
const stripped = stripCode(prBody);
|
|
4342
|
+
const searchIn = anchoredRegion(stripped, "CLOSES") ?? stripped;
|
|
4343
|
+
const referenced = new Set;
|
|
4344
|
+
for (const hit of searchIn.matchAll(closesPattern)) {
|
|
4345
|
+
referenced.add(Number(hit[1]));
|
|
4346
|
+
}
|
|
4347
|
+
return referenced;
|
|
4535
4348
|
}
|
|
4536
|
-
function
|
|
4537
|
-
|
|
4538
|
-
|
|
4349
|
+
function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
4350
|
+
const referenced = extractClosesReferences(prBody);
|
|
4351
|
+
if (taskIssueRefs) {
|
|
4352
|
+
for (const n of referenced) {
|
|
4353
|
+
const ref = taskIssueRefs.get(n);
|
|
4354
|
+
if (!ref)
|
|
4355
|
+
continue;
|
|
4356
|
+
const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
|
|
4357
|
+
if (branch !== expectedBranch) {
|
|
4358
|
+
return {
|
|
4359
|
+
ok: false,
|
|
4360
|
+
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
|
|
4361
|
+
};
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4539
4364
|
}
|
|
4540
|
-
|
|
4541
|
-
|
|
4365
|
+
const ref = parseTaskBranchIdentity(branch);
|
|
4366
|
+
if (!ref)
|
|
4367
|
+
return { ok: true };
|
|
4368
|
+
if (ref.kind === "issue") {
|
|
4369
|
+
const expectedIssue = ref.issueNumber;
|
|
4370
|
+
if (!referenced.has(expectedIssue)) {
|
|
4371
|
+
return {
|
|
4372
|
+
ok: false,
|
|
4373
|
+
expectedIssue,
|
|
4374
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
4375
|
+
};
|
|
4376
|
+
}
|
|
4377
|
+
return { ok: true, expectedIssue };
|
|
4542
4378
|
}
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
}
|
|
4551
|
-
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
4552
|
-
function stripNonProse(path, content) {
|
|
4553
|
-
if (path.endsWith(".md")) {
|
|
4554
|
-
return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
|
|
4379
|
+
const trancheSlug = ref.tranche;
|
|
4380
|
+
const taskId = ref.taskId;
|
|
4381
|
+
const trancheFile = trancheFiles.find((f) => f.slug === trancheSlug);
|
|
4382
|
+
if (!trancheFile) {
|
|
4383
|
+
return {
|
|
4384
|
+
ok: false,
|
|
4385
|
+
message: `closes-n: branch "${branch}" references tranche "${trancheSlug}" but no topology file found at aeg-root/tranches/${trancheSlug}.md. Ensure the tranche file exists before opening the PR.`
|
|
4386
|
+
};
|
|
4555
4387
|
}
|
|
4556
|
-
|
|
4557
|
-
|
|
4388
|
+
const task = trancheFile.tranche.tasks.find((t) => t.id === taskId);
|
|
4389
|
+
if (!task) {
|
|
4390
|
+
return {
|
|
4391
|
+
ok: false,
|
|
4392
|
+
message: `closes-n: branch "${branch}" references task "${taskId}" not found in ${trancheSlug} topology. Verify the task ID matches the tranche file.`
|
|
4393
|
+
};
|
|
4558
4394
|
}
|
|
4559
|
-
|
|
4395
|
+
if (task.issue === null) {
|
|
4396
|
+
return {
|
|
4397
|
+
ok: false,
|
|
4398
|
+
message: `closes-n: task "${taskId}" in "${trancheSlug}" has no Issue number (#TBD). The Planner must cut the Issue before this PR can be validated.`
|
|
4399
|
+
};
|
|
4400
|
+
}
|
|
4401
|
+
const expectedIssue = task.issue;
|
|
4402
|
+
if (!referenced.has(expectedIssue)) {
|
|
4403
|
+
return {
|
|
4404
|
+
ok: false,
|
|
4405
|
+
expectedIssue,
|
|
4406
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for task "${taskId}" in tranche "${trancheSlug}"). Add it to the PR body Summary section.`
|
|
4407
|
+
};
|
|
4408
|
+
}
|
|
4409
|
+
return { ok: true, expectedIssue };
|
|
4560
4410
|
}
|
|
4561
|
-
|
|
4562
|
-
|
|
4411
|
+
// ../../packages/aeg-core/src/archive-task.ts
|
|
4412
|
+
function closesRefs(text) {
|
|
4413
|
+
return [...new Set([...text.matchAll(/Closes #(\d+)/gi)].map((m) => Number(m[1])))];
|
|
4563
4414
|
}
|
|
4564
|
-
function
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4415
|
+
function extractIssue(body) {
|
|
4416
|
+
const stripped = stripCode(body);
|
|
4417
|
+
const bodyNums = closesRefs(stripped);
|
|
4418
|
+
const anchored = anchoredRegion(stripped, "CLOSES");
|
|
4419
|
+
if (anchored !== null) {
|
|
4420
|
+
const anchorNums = closesRefs(anchored);
|
|
4421
|
+
if (anchorNums.length === 0)
|
|
4422
|
+
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
4423
|
+
const issue = anchorNums[0];
|
|
4424
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
|
|
4569
4425
|
}
|
|
4570
|
-
|
|
4426
|
+
const headerNums = closesRefs(headerRegion(stripped));
|
|
4427
|
+
if (bodyNums.length === 0)
|
|
4428
|
+
return { issue: null, extraIssues: [], outsideHeader: false };
|
|
4429
|
+
const issue = headerNums.length > 0 ? headerNums[0] : bodyNums[0];
|
|
4430
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: headerNums.length === 0 };
|
|
4571
4431
|
}
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
return null;
|
|
4578
|
-
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4579
|
-
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4432
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4433
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
4434
|
+
function briefHash(brief) {
|
|
4435
|
+
return createHash4("sha256").update(`${brief}
|
|
4436
|
+
`).digest("hex");
|
|
4580
4437
|
}
|
|
4581
|
-
function
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
4587
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
4588
|
-
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
4589
|
-
];
|
|
4590
|
-
const productPatterns = [
|
|
4591
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4592
|
-
];
|
|
4593
|
-
const specPatterns = [
|
|
4594
|
-
...patterns,
|
|
4595
|
-
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
4596
|
-
];
|
|
4597
|
-
for (const file of files) {
|
|
4598
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
4599
|
-
if (!cls || cls === "internal")
|
|
4600
|
-
continue;
|
|
4601
|
-
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
4602
|
-
continue;
|
|
4603
|
-
if (cls === "spec" && grandfathered.has(file.path))
|
|
4604
|
-
continue;
|
|
4605
|
-
const blocking = cls === "product" || cls === "spec";
|
|
4606
|
-
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4607
|
-
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4608
|
-
for (const { pattern, what, group } of patternsToRun) {
|
|
4609
|
-
pattern.lastIndex = 0;
|
|
4610
|
-
let match = pattern.exec(scrubbed);
|
|
4611
|
-
while (match !== null) {
|
|
4612
|
-
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4613
|
-
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4614
|
-
findings.push({
|
|
4615
|
-
file: file.path,
|
|
4616
|
-
line: lineAt(scrubbed, citedIndex),
|
|
4617
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4618
|
-
blocking
|
|
4619
|
-
});
|
|
4620
|
-
match = pattern.exec(scrubbed);
|
|
4621
|
-
}
|
|
4622
|
-
}
|
|
4623
|
-
}
|
|
4624
|
-
return findings;
|
|
4438
|
+
function policyDigest(policy) {
|
|
4439
|
+
return createHash4("sha256").update(JSON.stringify({
|
|
4440
|
+
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4441
|
+
securityThreshold: policy.securityThreshold
|
|
4442
|
+
})).digest("hex");
|
|
4625
4443
|
}
|
|
4626
|
-
function
|
|
4627
|
-
|
|
4444
|
+
function isBoundToHead(echoed, headSha) {
|
|
4445
|
+
if (!echoed.headSha)
|
|
4446
|
+
return false;
|
|
4447
|
+
return headSha.toLowerCase().startsWith(echoed.headSha.toLowerCase());
|
|
4628
4448
|
}
|
|
4629
|
-
function
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4449
|
+
function isBoundByPatchIdentity(echoed, headSha, patchIdOf) {
|
|
4450
|
+
if (patchIdOf === undefined || !echoed.headSha)
|
|
4451
|
+
return false;
|
|
4452
|
+
const judged = patchIdOf(echoed.headSha);
|
|
4453
|
+
const current = patchIdOf(headSha);
|
|
4454
|
+
if (judged === null || current === null)
|
|
4455
|
+
return false;
|
|
4456
|
+
return judged === current;
|
|
4633
4457
|
}
|
|
4634
|
-
function
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
if (containsWholeWord(line, term))
|
|
4641
|
-
return lineNo;
|
|
4642
|
-
}
|
|
4643
|
-
return null;
|
|
4458
|
+
function isBoundToBase(echoed, currentBase) {
|
|
4459
|
+
if (currentBase === null)
|
|
4460
|
+
return true;
|
|
4461
|
+
if (!echoed.baseSha)
|
|
4462
|
+
return false;
|
|
4463
|
+
return currentBase.toLowerCase().startsWith(echoed.baseSha.toLowerCase());
|
|
4644
4464
|
}
|
|
4645
|
-
function
|
|
4646
|
-
|
|
4647
|
-
const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
|
|
4648
|
-
if (definesInline)
|
|
4465
|
+
function isBoundToObjectives(echoed, currentVersion) {
|
|
4466
|
+
if (currentVersion === null)
|
|
4649
4467
|
return true;
|
|
4650
|
-
return
|
|
4468
|
+
return echoed.objectivesVersion === currentVersion;
|
|
4469
|
+
}
|
|
4470
|
+
function isBoundToRulings(echoed, currentOrdinal) {
|
|
4471
|
+
if (echoed.rulingOrdinal === null)
|
|
4472
|
+
return currentOrdinal === 0;
|
|
4473
|
+
return echoed.rulingOrdinal === currentOrdinal;
|
|
4474
|
+
}
|
|
4475
|
+
function isBoundToBriefHash(echoed, currentHash) {
|
|
4476
|
+
if (currentHash === null)
|
|
4477
|
+
return true;
|
|
4478
|
+
return echoed.briefHash === currentHash;
|
|
4479
|
+
}
|
|
4480
|
+
function isBoundToPolicy(echoed, currentDigest) {
|
|
4481
|
+
return echoed.policyDigest === currentDigest;
|
|
4482
|
+
}
|
|
4483
|
+
function compareManifest(echoed, current, patchIdOf) {
|
|
4484
|
+
const exactHead = isBoundToHead(echoed, current.headSha);
|
|
4485
|
+
const patchHead = exactHead ? false : isBoundByPatchIdentity(echoed, current.headSha, patchIdOf);
|
|
4486
|
+
const head = exactHead || patchHead;
|
|
4487
|
+
const echoedShaLen = echoed.baseSha?.length ?? 0;
|
|
4488
|
+
const currentShaLen = current.baseSha?.length ?? 0;
|
|
4489
|
+
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4490
|
+
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4491
|
+
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4492
|
+
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4493
|
+
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4494
|
+
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4495
|
+
return {
|
|
4496
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4497
|
+
head,
|
|
4498
|
+
base,
|
|
4499
|
+
briefHash: briefHashBound,
|
|
4500
|
+
objectivesVersion,
|
|
4501
|
+
rulingOrdinal,
|
|
4502
|
+
policyDigest: policyDigestBound
|
|
4503
|
+
};
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4506
|
+
// ../../packages/aeg-core/src/review-gate.ts
|
|
4507
|
+
function renderGateDeferred(deferred) {
|
|
4508
|
+
if (deferred.length === 0)
|
|
4509
|
+
return "";
|
|
4510
|
+
const items = deferred.map((d) => {
|
|
4511
|
+
const where = d.finding.location && d.finding.location.length > 0 ? d.finding.location : "(no location)";
|
|
4512
|
+
return `${d.finding.severity} ${where} (${DEFERRAL_REASON_TEXT[d.reason]})`;
|
|
4513
|
+
}).join("; ");
|
|
4514
|
+
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4515
|
+
}
|
|
4516
|
+
function checkReviewGate(input) {
|
|
4517
|
+
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
4518
|
+
const waived = isWaiverLabelActorVerified({
|
|
4519
|
+
label: WAIVER_LABEL_REVIEW,
|
|
4520
|
+
labels: input.labels,
|
|
4521
|
+
labelActor: input.waiverLabelActor,
|
|
4522
|
+
principalAllowlist
|
|
4523
|
+
});
|
|
4524
|
+
if (waived) {
|
|
4525
|
+
return {
|
|
4526
|
+
verdict: "pass",
|
|
4527
|
+
reason: `\`${WAIVER_LABEL_REVIEW}\` label is actor-verified — review requirement waived for this PR.`,
|
|
4528
|
+
waived: true
|
|
4529
|
+
};
|
|
4530
|
+
}
|
|
4531
|
+
const verified = input.comments.filter((c) => isPrincipal(c.author, principalAllowlist));
|
|
4532
|
+
const ignoredCount = input.comments.filter((c) => !isPrincipal(c.author, principalAllowlist) && c.body.includes("VERDICT")).length;
|
|
4533
|
+
const verifiedBodies = verified.map((c) => c.body);
|
|
4534
|
+
const codeReview = extractCodeReviewVerdict(verifiedBodies);
|
|
4535
|
+
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
4536
|
+
const policy = input.policy ?? DEFAULT_REVIEW_POLICY;
|
|
4537
|
+
let codeReviewPolicyEvaluation;
|
|
4538
|
+
let securityPolicyEvaluation;
|
|
4539
|
+
try {
|
|
4540
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy, input.deferralContext);
|
|
4541
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy, input.deferralContext);
|
|
4542
|
+
} catch (err) {
|
|
4543
|
+
return {
|
|
4544
|
+
verdict: "fail",
|
|
4545
|
+
reason: `a verdict comment carries a finding severity this repository's policy does not recognize: ${err instanceof Error ? err.message : String(err)}`,
|
|
4546
|
+
waived: false
|
|
4547
|
+
};
|
|
4548
|
+
}
|
|
4549
|
+
const codeReviewTextClean = codeReview.value === "APPROVE";
|
|
4550
|
+
const securityTextClean = security.value === "PASS";
|
|
4551
|
+
const codeReviewPolicyClean = codeReviewPolicyEvaluation.outcome === "clean";
|
|
4552
|
+
const securityPolicyClean = securityPolicyEvaluation.outcome === "clean";
|
|
4553
|
+
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4554
|
+
const securityClean = securityTextClean && securityPolicyClean;
|
|
4555
|
+
const currentManifest = {
|
|
4556
|
+
headSha: input.headSha,
|
|
4557
|
+
baseSha: input.baseSha ?? null,
|
|
4558
|
+
briefHash: input.briefHash ?? null,
|
|
4559
|
+
objectivesVersion: input.objectivesVersion,
|
|
4560
|
+
rulingOrdinal: input.rulingOrdinal,
|
|
4561
|
+
policyDigest: policyDigest(policy)
|
|
4562
|
+
};
|
|
4563
|
+
const codeReviewEchoed = {
|
|
4564
|
+
headSha: codeReview.headSha,
|
|
4565
|
+
baseSha: codeReview.baseSha,
|
|
4566
|
+
briefHash: codeReview.briefHash,
|
|
4567
|
+
objectivesVersion: codeReview.objectivesVersion,
|
|
4568
|
+
rulingOrdinal: codeReview.rulingOrdinal,
|
|
4569
|
+
policyDigest: codeReview.policyDigest
|
|
4570
|
+
};
|
|
4571
|
+
const securityEchoed = {
|
|
4572
|
+
headSha: security.headSha,
|
|
4573
|
+
baseSha: security.baseSha,
|
|
4574
|
+
briefHash: security.briefHash,
|
|
4575
|
+
objectivesVersion: security.objectivesVersion,
|
|
4576
|
+
rulingOrdinal: security.rulingOrdinal,
|
|
4577
|
+
policyDigest: security.policyDigest
|
|
4578
|
+
};
|
|
4579
|
+
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
4580
|
+
const securityBinding = compareManifest(securityEchoed, currentManifest, input.patchIdOf);
|
|
4581
|
+
const codeReviewBound = codeReviewBinding.head;
|
|
4582
|
+
const securityBound = securityBinding.head;
|
|
4583
|
+
const codeReviewObjectivesBound = codeReviewBinding.objectivesVersion;
|
|
4584
|
+
const securityObjectivesBound = securityBinding.objectivesVersion;
|
|
4585
|
+
const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
|
|
4586
|
+
const securityRulingsBound = securityBinding.rulingOrdinal;
|
|
4587
|
+
const deferredNote = renderGateDeferred([
|
|
4588
|
+
...codeReviewPolicyEvaluation.deferredFindings,
|
|
4589
|
+
...securityPolicyEvaluation.deferredFindings
|
|
4590
|
+
]);
|
|
4591
|
+
if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
|
|
4592
|
+
return {
|
|
4593
|
+
verdict: "pass",
|
|
4594
|
+
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.${deferredNote}`,
|
|
4595
|
+
waived: false
|
|
4596
|
+
};
|
|
4597
|
+
}
|
|
4598
|
+
const problems = [];
|
|
4599
|
+
if (!codeReviewTextClean) {
|
|
4600
|
+
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
4601
|
+
} else if (!codeReviewPolicyClean) {
|
|
4602
|
+
problems.push(`code-reviewer verdict says APPROVE but carries a finding (${codeReviewPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's code-review policy threshold (${policy.codeReviewThreshold}) — a reviewer's own APPROVE never overrides policy`);
|
|
4603
|
+
} else if (!codeReviewBound) {
|
|
4604
|
+
problems.push(`the newest code-review verdict covers ${codeReview.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
4605
|
+
} else if (!codeReviewBinding.base) {
|
|
4606
|
+
problems.push(`the newest code-review verdict was cast against base ${codeReview.baseSha ?? "no recorded base"}, the PR's base is now ${currentManifest.baseSha ?? "unresolved"} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`);
|
|
4607
|
+
} else if (!codeReviewObjectivesBound) {
|
|
4608
|
+
problems.push(`the newest code-review verdict was cast against objectives version ${codeReview.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
4609
|
+
} else if (!codeReviewRulingsBound) {
|
|
4610
|
+
problems.push(`the newest code-review verdict was cast against ruling ordinal ${codeReview.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4611
|
+
} else if (!codeReviewBinding.briefHash) {
|
|
4612
|
+
problems.push(`the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4613
|
+
} else if (!codeReviewBinding.policyDigest) {
|
|
4614
|
+
problems.push(`the newest code-review verdict was cast against review policy digest ${codeReview.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
4615
|
+
}
|
|
4616
|
+
if (!securityTextClean) {
|
|
4617
|
+
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
4618
|
+
} else if (!securityPolicyClean) {
|
|
4619
|
+
problems.push(`security-review verdict says PASS but carries a finding (${securityPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's security policy threshold (${policy.securityThreshold}) — a reviewer's own PASS never overrides policy`);
|
|
4620
|
+
} else if (!securityBound) {
|
|
4621
|
+
problems.push(`the newest security-review verdict covers ${security.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
4622
|
+
} else if (!securityBinding.base) {
|
|
4623
|
+
problems.push(`the newest security-review verdict was cast against base ${security.baseSha ?? "no recorded base"}, the PR's base is now ${currentManifest.baseSha ?? "unresolved"} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`);
|
|
4624
|
+
} else if (!securityObjectivesBound) {
|
|
4625
|
+
problems.push(`the newest security-review verdict was cast against objectives version ${security.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
4626
|
+
} else if (!securityRulingsBound) {
|
|
4627
|
+
problems.push(`the newest security-review verdict was cast against ruling ordinal ${security.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4628
|
+
} else if (!securityBinding.briefHash) {
|
|
4629
|
+
problems.push(`the newest security-review verdict was cast against brief hash ${security.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4630
|
+
} else if (!securityBinding.policyDigest) {
|
|
4631
|
+
problems.push(`the newest security-review verdict was cast against review policy digest ${security.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
4632
|
+
}
|
|
4633
|
+
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4634
|
+
return {
|
|
4635
|
+
verdict: "fail",
|
|
4636
|
+
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}${deferredNote}`,
|
|
4637
|
+
waived: false
|
|
4638
|
+
};
|
|
4639
|
+
}
|
|
4640
|
+
var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
|
|
4641
|
+
var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
|
|
4642
|
+
function isChangesetsReleasePr(branch, author, expectedAuthor) {
|
|
4643
|
+
return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
|
|
4651
4644
|
}
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4645
|
+
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
4646
|
+
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
4647
|
+
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
4648
|
+
let best = 0;
|
|
4649
|
+
for (const c of comments) {
|
|
4650
|
+
if (!isPrincipal(c.author, allowlist))
|
|
4657
4651
|
continue;
|
|
4658
|
-
const
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
file: file.path,
|
|
4667
|
-
line,
|
|
4668
|
-
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
4669
|
-
blocking: false
|
|
4670
|
-
});
|
|
4671
|
-
}
|
|
4652
|
+
const firstLine = (c.body.split(`
|
|
4653
|
+
`)[0] ?? "").trim();
|
|
4654
|
+
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
4655
|
+
if (!m)
|
|
4656
|
+
continue;
|
|
4657
|
+
const k = Number.parseInt(m[1], 10);
|
|
4658
|
+
if (k > best)
|
|
4659
|
+
best = k;
|
|
4672
4660
|
}
|
|
4673
|
-
return
|
|
4661
|
+
return best;
|
|
4674
4662
|
}
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
let i =
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
if (
|
|
4692
|
-
state = "line-comment";
|
|
4693
|
-
out += c;
|
|
4694
|
-
i++;
|
|
4695
|
-
continue;
|
|
4696
|
-
}
|
|
4697
|
-
if (c === "/" && next === "*") {
|
|
4698
|
-
state = "block-comment";
|
|
4699
|
-
out += c;
|
|
4700
|
-
i++;
|
|
4701
|
-
continue;
|
|
4702
|
-
}
|
|
4703
|
-
if (c === "'") {
|
|
4704
|
-
state = "single-quote";
|
|
4705
|
-
out += blank(c);
|
|
4706
|
-
i++;
|
|
4707
|
-
continue;
|
|
4708
|
-
}
|
|
4709
|
-
if (c === '"') {
|
|
4710
|
-
state = "double-quote";
|
|
4711
|
-
out += blank(c);
|
|
4712
|
-
i++;
|
|
4713
|
-
continue;
|
|
4714
|
-
}
|
|
4715
|
-
if (c === "`") {
|
|
4716
|
-
state = "template";
|
|
4717
|
-
out += blank(c);
|
|
4718
|
-
i++;
|
|
4719
|
-
continue;
|
|
4720
|
-
}
|
|
4721
|
-
out += blank(c);
|
|
4722
|
-
i++;
|
|
4723
|
-
continue;
|
|
4724
|
-
}
|
|
4725
|
-
if (state === "line-comment") {
|
|
4726
|
-
if (c === `
|
|
4727
|
-
`) {
|
|
4728
|
-
state = "code";
|
|
4729
|
-
out += `
|
|
4730
|
-
`;
|
|
4663
|
+
// ../../packages/aeg-core/src/markdown-table.ts
|
|
4664
|
+
function splitRow(line) {
|
|
4665
|
+
const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
4666
|
+
return trimmed.split("|").map((cell) => cell.trim());
|
|
4667
|
+
}
|
|
4668
|
+
var TABLE_ROW_PATTERN = /^\s*\|.*\|\s*$/;
|
|
4669
|
+
var SEPARATOR_ROW_PATTERN = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
|
|
4670
|
+
function findTable(lines, fromLine, stopAtHeading = true) {
|
|
4671
|
+
let i = fromLine - 1;
|
|
4672
|
+
while (i < lines.length) {
|
|
4673
|
+
const line = lines[i] ?? "";
|
|
4674
|
+
if (stopAtHeading && i > fromLine - 1 && /^##\s/.test(line))
|
|
4675
|
+
return null;
|
|
4676
|
+
if (TABLE_ROW_PATTERN.test(line)) {
|
|
4677
|
+
const headerLine = line;
|
|
4678
|
+
const sepLine = lines[i + 1] ?? "";
|
|
4679
|
+
if (!SEPARATOR_ROW_PATTERN.test(sepLine)) {
|
|
4731
4680
|
i++;
|
|
4732
4681
|
continue;
|
|
4733
4682
|
}
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
out += c;
|
|
4741
|
-
out += next;
|
|
4742
|
-
state = "code";
|
|
4743
|
-
i += 2;
|
|
4744
|
-
continue;
|
|
4745
|
-
}
|
|
4746
|
-
out += c === `
|
|
4747
|
-
` ? `
|
|
4748
|
-
` : c;
|
|
4749
|
-
i++;
|
|
4750
|
-
continue;
|
|
4751
|
-
}
|
|
4752
|
-
const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
|
|
4753
|
-
if (c === "\\") {
|
|
4754
|
-
out += blank(c);
|
|
4755
|
-
i++;
|
|
4756
|
-
if (i < n) {
|
|
4757
|
-
out += blank(content[i]);
|
|
4758
|
-
i++;
|
|
4683
|
+
const headers = splitRow(headerLine);
|
|
4684
|
+
const rows = [];
|
|
4685
|
+
let j = i + 2;
|
|
4686
|
+
while (j < lines.length && TABLE_ROW_PATTERN.test(lines[j] ?? "")) {
|
|
4687
|
+
rows.push({ cells: splitRow(lines[j] ?? ""), line: j + 1 });
|
|
4688
|
+
j++;
|
|
4759
4689
|
}
|
|
4760
|
-
|
|
4761
|
-
}
|
|
4762
|
-
if (c === closer) {
|
|
4763
|
-
state = "code";
|
|
4764
|
-
out += blank(c);
|
|
4765
|
-
i++;
|
|
4766
|
-
continue;
|
|
4690
|
+
return { headers, rows };
|
|
4767
4691
|
}
|
|
4768
|
-
out += blank(c);
|
|
4769
4692
|
i++;
|
|
4770
4693
|
}
|
|
4771
|
-
return
|
|
4694
|
+
return null;
|
|
4772
4695
|
}
|
|
4773
|
-
function
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
{ pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
|
|
4778
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
4779
|
-
];
|
|
4780
|
-
for (const file of files) {
|
|
4781
|
-
if (!file.path.endsWith(".ts"))
|
|
4782
|
-
continue;
|
|
4783
|
-
if (allowed.has(file.path))
|
|
4784
|
-
continue;
|
|
4785
|
-
const comments = extractComments(file.path, file.content);
|
|
4786
|
-
for (const { pattern, what } of patterns) {
|
|
4787
|
-
pattern.lastIndex = 0;
|
|
4788
|
-
let match = pattern.exec(comments);
|
|
4789
|
-
while (match !== null) {
|
|
4790
|
-
findings.push({
|
|
4791
|
-
file: file.path,
|
|
4792
|
-
line: lineAt(comments, match.index),
|
|
4793
|
-
message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
|
|
4794
|
-
blocking: false
|
|
4795
|
-
});
|
|
4796
|
-
match = pattern.exec(comments);
|
|
4797
|
-
}
|
|
4798
|
-
}
|
|
4696
|
+
function findHeadingLine(lines, pattern) {
|
|
4697
|
+
for (let i = 0;i < lines.length; i++) {
|
|
4698
|
+
if (pattern.test(lines[i] ?? ""))
|
|
4699
|
+
return i + 1;
|
|
4799
4700
|
}
|
|
4800
|
-
return
|
|
4801
|
-
}
|
|
4802
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4803
|
-
return [
|
|
4804
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4805
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4806
|
-
];
|
|
4701
|
+
return null;
|
|
4807
4702
|
}
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4703
|
+
// ../../packages/aeg-core/src/diagram-model.ts
|
|
4704
|
+
import matter from "gray-matter";
|
|
4705
|
+
|
|
4706
|
+
// ../../packages/aeg-core/src/registry-parse.ts
|
|
4707
|
+
var RING_HEADINGS = [
|
|
4708
|
+
{ ring: "ring0", pattern: /^##\s+Ring 0\b/ },
|
|
4709
|
+
{ ring: "ring1", pattern: /^##\s+Ring 1\b/ },
|
|
4710
|
+
{ ring: "ring2", pattern: /^##\s+Ring 2\b/ }
|
|
4711
|
+
];
|
|
4712
|
+
function stripBackticks2(cell) {
|
|
4713
|
+
const trimmed = cell.trim();
|
|
4714
|
+
if (trimmed.length >= 2 && trimmed.startsWith("`") && trimmed.endsWith("`")) {
|
|
4715
|
+
return trimmed.slice(1, -1);
|
|
4816
4716
|
}
|
|
4817
|
-
return
|
|
4717
|
+
return trimmed;
|
|
4818
4718
|
}
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4719
|
+
function stripBold(cell) {
|
|
4720
|
+
return cell.trim().replace(/\*\*/g, "");
|
|
4721
|
+
}
|
|
4722
|
+
function parseEnforcementRegistry(content) {
|
|
4723
|
+
const lines = content.split(`
|
|
4724
|
+
`);
|
|
4725
|
+
const result = [];
|
|
4726
|
+
for (const { ring, pattern } of RING_HEADINGS) {
|
|
4727
|
+
const headingLine = findHeadingLine(lines, pattern);
|
|
4728
|
+
if (headingLine === null)
|
|
4729
|
+
continue;
|
|
4730
|
+
const table = findTable(lines, headingLine + 1);
|
|
4731
|
+
if (!table)
|
|
4732
|
+
continue;
|
|
4733
|
+
const descriptionIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "description");
|
|
4734
|
+
const implementationIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "implementation");
|
|
4735
|
+
const audienceIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "audience");
|
|
4736
|
+
for (const row of table.rows) {
|
|
4737
|
+
const cells = row.cells;
|
|
4738
|
+
if (cells.length < 3)
|
|
4739
|
+
continue;
|
|
4740
|
+
const action = stripBold(cells[0] ?? "");
|
|
4741
|
+
const summary = stripBackticks2(cells[1] ?? "");
|
|
4742
|
+
const category = stripBackticks2(cells[2] ?? "");
|
|
4743
|
+
const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
|
|
4744
|
+
const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
|
|
4745
|
+
const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
|
|
4746
|
+
const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
|
|
4747
|
+
const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
|
|
4748
|
+
result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
return result;
|
|
4833
4752
|
}
|
|
4834
|
-
|
|
4753
|
+
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4754
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4755
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4756
|
+
function basename(path) {
|
|
4757
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4758
|
+
}
|
|
4759
|
+
function lineOf(content, index) {
|
|
4835
4760
|
let line = 1;
|
|
4836
|
-
for (let i = 0;i < index; i++)
|
|
4761
|
+
for (let i = 0;i < index; i++)
|
|
4837
4762
|
if (content.charCodeAt(i) === 10)
|
|
4838
4763
|
line++;
|
|
4839
|
-
}
|
|
4840
4764
|
return line;
|
|
4841
4765
|
}
|
|
4842
|
-
function
|
|
4843
|
-
const
|
|
4844
|
-
const
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4766
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4767
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4768
|
+
const findings = [];
|
|
4769
|
+
const flag = (doc, token, index) => {
|
|
4770
|
+
findings.push({
|
|
4771
|
+
path: doc.path,
|
|
4772
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4773
|
+
});
|
|
4774
|
+
};
|
|
4775
|
+
for (const doc of docs) {
|
|
4776
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4777
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4778
|
+
continue;
|
|
4779
|
+
if (!shipped.has(cited))
|
|
4780
|
+
flag(doc, cited, index);
|
|
4781
|
+
}
|
|
4782
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4783
|
+
let match = spanPattern.exec(doc.content);
|
|
4784
|
+
while (match !== null) {
|
|
4785
|
+
const token = match[1] ?? "";
|
|
4786
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4787
|
+
flag(doc, token, match.index);
|
|
4788
|
+
match = spanPattern.exec(doc.content);
|
|
4789
|
+
}
|
|
4790
|
+
}
|
|
4791
|
+
return findings;
|
|
4851
4792
|
}
|
|
4852
|
-
function
|
|
4853
|
-
const
|
|
4854
|
-
const
|
|
4855
|
-
|
|
4856
|
-
let start = START_PATTERN.exec(masked);
|
|
4857
|
-
while (start !== null) {
|
|
4858
|
-
const citedFile = start[1];
|
|
4859
|
-
const innerStart = start.index + start[0].length;
|
|
4860
|
-
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
4861
|
-
if (end === null) {
|
|
4862
|
-
START_PATTERN.lastIndex = innerStart;
|
|
4863
|
-
start = START_PATTERN.exec(masked);
|
|
4793
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4794
|
+
const findings = [];
|
|
4795
|
+
for (const row of rows) {
|
|
4796
|
+
if (row.implementation === "")
|
|
4864
4797
|
continue;
|
|
4798
|
+
if (!existsFn(row.implementation)) {
|
|
4799
|
+
findings.push({
|
|
4800
|
+
row: row.action,
|
|
4801
|
+
path: row.implementation,
|
|
4802
|
+
reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
|
|
4803
|
+
});
|
|
4865
4804
|
}
|
|
4866
|
-
const innerEnd = innerStart + end.index;
|
|
4867
|
-
if (isValidCitedFilePath(citedFile)) {
|
|
4868
|
-
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
4869
|
-
if (quotedText.length > 0) {
|
|
4870
|
-
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
4871
|
-
}
|
|
4872
|
-
}
|
|
4873
|
-
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
4874
|
-
start = START_PATTERN.exec(masked);
|
|
4875
4805
|
}
|
|
4876
|
-
|
|
4806
|
+
if (hookRefs)
|
|
4807
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4808
|
+
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4877
4809
|
}
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4810
|
+
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
4811
|
+
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
4812
|
+
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
4813
|
+
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
4814
|
+
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
4815
|
+
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
4816
|
+
};
|
|
4817
|
+
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
4818
|
+
function checkG2(rows, candidateFiles) {
|
|
4819
|
+
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
4820
|
+
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
4821
|
+
const findings = [];
|
|
4822
|
+
for (const path of candidateFiles) {
|
|
4823
|
+
if (implementations.has(path))
|
|
4883
4824
|
continue;
|
|
4884
|
-
|
|
4825
|
+
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
4826
|
+
continue;
|
|
4827
|
+
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
4828
|
+
continue;
|
|
4829
|
+
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
4830
|
+
continue;
|
|
4831
|
+
const candidateNames = claimedCheckNames(path);
|
|
4832
|
+
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
4833
|
+
continue;
|
|
4834
|
+
findings.push({
|
|
4835
|
+
path,
|
|
4836
|
+
reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
|
|
4837
|
+
});
|
|
4885
4838
|
}
|
|
4886
|
-
|
|
4839
|
+
for (const row of rows) {
|
|
4840
|
+
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
4841
|
+
if (carriesPlaceholder) {
|
|
4842
|
+
findings.push({
|
|
4843
|
+
row: row.action,
|
|
4844
|
+
path: row.implementation,
|
|
4845
|
+
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
4846
|
+
});
|
|
4847
|
+
}
|
|
4848
|
+
}
|
|
4849
|
+
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4887
4850
|
}
|
|
4888
|
-
function
|
|
4851
|
+
function checkG3(ring0Rows, crossingFiles) {
|
|
4852
|
+
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
4889
4853
|
const findings = [];
|
|
4890
|
-
for (const
|
|
4891
|
-
|
|
4892
|
-
if (content === undefined) {
|
|
4854
|
+
for (const path of crossingFiles) {
|
|
4855
|
+
if (!ring0Implementations.has(path)) {
|
|
4893
4856
|
findings.push({
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
citedFile: quote.citedFile,
|
|
4897
|
-
quotedText: quote.quotedText,
|
|
4898
|
-
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
4857
|
+
path,
|
|
4858
|
+
reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
|
|
4899
4859
|
});
|
|
4900
|
-
continue;
|
|
4901
4860
|
}
|
|
4902
|
-
|
|
4861
|
+
}
|
|
4862
|
+
return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4863
|
+
}
|
|
4864
|
+
function checkG4(content, resolveFn) {
|
|
4865
|
+
const cited = new Set;
|
|
4866
|
+
for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
|
|
4867
|
+
cited.add(Number(hit[1]));
|
|
4868
|
+
}
|
|
4869
|
+
const findings = [];
|
|
4870
|
+
for (const n of cited) {
|
|
4871
|
+
if (!resolveFn(n)) {
|
|
4903
4872
|
findings.push({
|
|
4904
|
-
|
|
4905
|
-
line: quote.line,
|
|
4906
|
-
citedFile: quote.citedFile,
|
|
4907
|
-
quotedText: quote.quotedText,
|
|
4908
|
-
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
4873
|
+
reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
|
|
4909
4874
|
});
|
|
4910
4875
|
}
|
|
4911
4876
|
}
|
|
4912
|
-
return findings;
|
|
4877
|
+
return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4878
|
+
}
|
|
4879
|
+
function checkG5(roles, contracts) {
|
|
4880
|
+
const roleIds = new Set(roles.map((r) => r.role_id));
|
|
4881
|
+
const findings = [];
|
|
4882
|
+
for (const contract of contracts) {
|
|
4883
|
+
if (!roleIds.has(contract.producer)) {
|
|
4884
|
+
findings.push({
|
|
4885
|
+
path: contract.file,
|
|
4886
|
+
reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
if (!roleIds.has(contract.consumer)) {
|
|
4890
|
+
findings.push({
|
|
4891
|
+
path: contract.file,
|
|
4892
|
+
reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
|
|
4893
|
+
});
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
for (const role of roles) {
|
|
4897
|
+
if (role.performs.length === 0) {
|
|
4898
|
+
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
|
|
4899
|
+
}
|
|
4900
|
+
if (role.refuses_when.trim() === "") {
|
|
4901
|
+
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4904
|
+
return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4905
|
+
}
|
|
4906
|
+
var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
|
|
4907
|
+
var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
|
|
4908
|
+
function basenameNoExt(path) {
|
|
4909
|
+
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
4910
|
+
return base.replace(/\.ts$/, "");
|
|
4911
|
+
}
|
|
4912
|
+
function claimedCheckNames(implementation) {
|
|
4913
|
+
if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
|
|
4914
|
+
return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
|
|
4915
|
+
}
|
|
4916
|
+
if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
|
|
4917
|
+
const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
|
|
4918
|
+
if (audience && isShipped(audience)) {
|
|
4919
|
+
return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4922
|
+
return [];
|
|
4923
|
+
}
|
|
4924
|
+
function checkG6(rows, registeredCheckNames) {
|
|
4925
|
+
const findings = [];
|
|
4926
|
+
for (const row of rows) {
|
|
4927
|
+
if (row.audience !== "product")
|
|
4928
|
+
continue;
|
|
4929
|
+
const candidates = claimedCheckNames(row.implementation);
|
|
4930
|
+
if (!candidates.some((name) => registeredCheckNames.has(name))) {
|
|
4931
|
+
findings.push({
|
|
4932
|
+
row: row.action,
|
|
4933
|
+
path: row.implementation,
|
|
4934
|
+
reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
|
|
4935
|
+
});
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4913
4939
|
}
|
|
4914
4940
|
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4915
4941
|
function checkDeadBranchPush(input) {
|
|
@@ -5332,7 +5358,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5332
5358
|
var TaskPrReviewRecordSchema = z.object({
|
|
5333
5359
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5334
5360
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5335
|
-
summaryTable: z.string().nullable(),
|
|
5336
5361
|
pause: TaskPrPauseSchema.nullable()
|
|
5337
5362
|
});
|
|
5338
5363
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5379,16 +5404,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5379
5404
|
authenticatedFrom: z.string().min(1),
|
|
5380
5405
|
fencedEffectKeys: z.array(z.string())
|
|
5381
5406
|
});
|
|
5382
|
-
var TASK_TOOL_NAMES = [
|
|
5383
|
-
"task_start",
|
|
5384
|
-
"task_status",
|
|
5385
|
-
"task_escalation_read",
|
|
5386
|
-
"task_pr_read",
|
|
5387
|
-
"task_resume",
|
|
5388
|
-
"task_cancel"
|
|
5389
|
-
];
|
|
5390
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5391
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
5392
5407
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5393
5408
|
function parseTaskBranch(branch) {
|
|
5394
5409
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5619,15 +5634,69 @@ var NO_GATE_CUTOVERS = {
|
|
|
5619
5634
|
briefRulesSincePr: null,
|
|
5620
5635
|
agentBoxesRefusedSincePr: null
|
|
5621
5636
|
};
|
|
5622
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5623
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5624
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5625
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5626
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5627
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
5628
|
-
|
|
5629
5637
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5638
|
+
import { z as z3 } from "zod";
|
|
5639
|
+
|
|
5640
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5630
5641
|
import { z as z2 } from "zod";
|
|
5642
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5643
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5644
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5645
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5646
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5647
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5648
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5649
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5650
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5651
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5652
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5653
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5654
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5655
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5656
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5657
|
+
const refuse = (message, path = []) => {
|
|
5658
|
+
ctx.addIssue({
|
|
5659
|
+
code: z2.ZodIssueCode.custom,
|
|
5660
|
+
path: [name, ...path],
|
|
5661
|
+
message: `logs.events "${name}": ${message}`
|
|
5662
|
+
});
|
|
5663
|
+
};
|
|
5664
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5665
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5666
|
+
}
|
|
5667
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5668
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5669
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5670
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5671
|
+
}
|
|
5672
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5673
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5674
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5675
|
+
}
|
|
5676
|
+
for (const [field, type] of fieldEntries) {
|
|
5677
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5678
|
+
refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
|
|
5679
|
+
}
|
|
5680
|
+
if (typeof type === "string")
|
|
5681
|
+
continue;
|
|
5682
|
+
if (type.length === 0) {
|
|
5683
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5684
|
+
}
|
|
5685
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5686
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5687
|
+
}
|
|
5688
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5689
|
+
if (bad.length > 0) {
|
|
5690
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5691
|
+
}
|
|
5692
|
+
if (new Set(type).size !== type.length) {
|
|
5693
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
});
|
|
5698
|
+
|
|
5699
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5631
5700
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5632
5701
|
var ROLE_VALUES = [
|
|
5633
5702
|
"planner",
|
|
@@ -5638,244 +5707,297 @@ var ROLE_VALUES = [
|
|
|
5638
5707
|
"archivist",
|
|
5639
5708
|
"architect"
|
|
5640
5709
|
];
|
|
5641
|
-
var RoleSchema =
|
|
5710
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5642
5711
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5643
|
-
var HostSchema =
|
|
5712
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5644
5713
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5645
5714
|
var headerMetaCore = {
|
|
5646
|
-
ts:
|
|
5647
|
-
run_id:
|
|
5648
|
-
seq:
|
|
5649
|
-
repo:
|
|
5650
|
-
vinaya:
|
|
5651
|
-
doctrine:
|
|
5715
|
+
ts: z3.string(),
|
|
5716
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5717
|
+
seq: z3.number().int().nonnegative(),
|
|
5718
|
+
repo: z3.string().nullable(),
|
|
5719
|
+
vinaya: z3.string(),
|
|
5720
|
+
doctrine: z3.string(),
|
|
5652
5721
|
host: HostSchema,
|
|
5653
|
-
machine:
|
|
5722
|
+
machine: z3.string()
|
|
5654
5723
|
};
|
|
5655
|
-
var HeaderMetaV1Schema =
|
|
5656
|
-
schema:
|
|
5724
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5725
|
+
schema: z3.literal(1),
|
|
5657
5726
|
...headerMetaCore
|
|
5658
5727
|
}).strict();
|
|
5659
|
-
var LineageSchema =
|
|
5660
|
-
run:
|
|
5661
|
-
attempt:
|
|
5662
|
-
parent:
|
|
5728
|
+
var LineageSchema = z3.object({
|
|
5729
|
+
run: z3.string().nullable(),
|
|
5730
|
+
attempt: z3.number().int().nullable(),
|
|
5731
|
+
parent: z3.string().nullable()
|
|
5663
5732
|
}).strict();
|
|
5664
|
-
var InputVersionsSchema =
|
|
5665
|
-
objectives_version:
|
|
5666
|
-
brief_hash:
|
|
5667
|
-
ruling_ordinal:
|
|
5668
|
-
policy_digest:
|
|
5733
|
+
var InputVersionsSchema = z3.object({
|
|
5734
|
+
objectives_version: z3.string().nullable(),
|
|
5735
|
+
brief_hash: z3.string().nullable(),
|
|
5736
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5737
|
+
policy_digest: z3.string().nullable()
|
|
5669
5738
|
}).strict();
|
|
5670
|
-
var ProvenanceSchema =
|
|
5671
|
-
var HeaderMetaV2Schema =
|
|
5672
|
-
schema:
|
|
5739
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5740
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5741
|
+
schema: z3.literal(2),
|
|
5673
5742
|
...headerMetaCore,
|
|
5674
|
-
event_id:
|
|
5675
|
-
process_id:
|
|
5676
|
-
actor_id:
|
|
5743
|
+
event_id: z3.string().min(1),
|
|
5744
|
+
process_id: z3.string().min(1),
|
|
5745
|
+
actor_id: z3.string().nullable(),
|
|
5677
5746
|
lineage: LineageSchema,
|
|
5678
5747
|
input_versions: InputVersionsSchema,
|
|
5679
5748
|
provenance: ProvenanceSchema
|
|
5680
5749
|
}).strict();
|
|
5681
|
-
var
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
role: z2.union([RoleSchema, z2.literal("unattributed")]),
|
|
5687
|
-
round: z2.number().int().optional(),
|
|
5688
|
-
objectives_version: z2.string().optional()
|
|
5750
|
+
var WorkSchema = z3.object({
|
|
5751
|
+
ref: z3.string().nullable(),
|
|
5752
|
+
repo: z3.string().nullable(),
|
|
5753
|
+
change: z3.string().nullable(),
|
|
5754
|
+
revision: z3.string().nullable()
|
|
5689
5755
|
}).strict();
|
|
5690
|
-
var
|
|
5756
|
+
var FlowSchema = z3.object({
|
|
5757
|
+
id: z3.string().nullable(),
|
|
5758
|
+
version: z3.string().nullable()
|
|
5759
|
+
}).strict();
|
|
5760
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5761
|
+
schema: z3.literal(3),
|
|
5762
|
+
...headerMetaCore,
|
|
5763
|
+
event_id: z3.string().min(1),
|
|
5764
|
+
process_id: z3.string().min(1),
|
|
5765
|
+
actor_id: z3.string().nullable(),
|
|
5766
|
+
lineage: LineageSchema,
|
|
5767
|
+
input_versions: InputVersionsSchema,
|
|
5768
|
+
provenance: ProvenanceSchema,
|
|
5769
|
+
work: WorkSchema,
|
|
5770
|
+
flow: FlowSchema,
|
|
5771
|
+
runtime: z3.string().nullable(),
|
|
5772
|
+
source: z3.string().nullable()
|
|
5773
|
+
}).strict();
|
|
5774
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5775
|
+
var SubjectSchema = z3.object({
|
|
5776
|
+
issue: z3.number().int().nullable(),
|
|
5777
|
+
pr: z3.number().int().optional(),
|
|
5778
|
+
sha: z3.string().optional(),
|
|
5779
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5780
|
+
round: z3.number().int().optional(),
|
|
5781
|
+
objectives_version: z3.string().optional()
|
|
5782
|
+
}).strict();
|
|
5783
|
+
var HeaderSchema = z3.object({
|
|
5691
5784
|
meta: HeaderMetaSchema,
|
|
5692
5785
|
subject: SubjectSchema
|
|
5693
5786
|
}).strict();
|
|
5694
5787
|
var envelopeTail = {
|
|
5695
|
-
duration_ms:
|
|
5696
|
-
payload:
|
|
5788
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5789
|
+
payload: z3.object({}).strict()
|
|
5697
5790
|
};
|
|
5698
|
-
var ReviewFindingSchema =
|
|
5699
|
-
id:
|
|
5700
|
-
severity:
|
|
5701
|
-
state:
|
|
5702
|
-
severity_scale:
|
|
5703
|
-
policy_treatment:
|
|
5704
|
-
confidence:
|
|
5705
|
-
confidence_scale:
|
|
5706
|
-
confidence_source:
|
|
5791
|
+
var ReviewFindingSchema = z3.object({
|
|
5792
|
+
id: z3.string(),
|
|
5793
|
+
severity: z3.string(),
|
|
5794
|
+
state: z3.string().optional(),
|
|
5795
|
+
severity_scale: z3.string().optional(),
|
|
5796
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5797
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5798
|
+
confidence_scale: z3.string().optional(),
|
|
5799
|
+
confidence_source: z3.string().optional()
|
|
5707
5800
|
}).strict();
|
|
5708
|
-
var DispatchOutcomeSchema =
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
type:
|
|
5712
|
-
pr:
|
|
5713
|
-
head:
|
|
5714
|
-
comment_id:
|
|
5801
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5802
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5803
|
+
z3.object({
|
|
5804
|
+
type: z3.literal("round_pushed"),
|
|
5805
|
+
pr: z3.number().int(),
|
|
5806
|
+
head: z3.string(),
|
|
5807
|
+
comment_id: z3.number().int()
|
|
5715
5808
|
}).strict(),
|
|
5716
|
-
|
|
5717
|
-
type:
|
|
5718
|
-
verdict:
|
|
5719
|
-
head:
|
|
5720
|
-
comment_id:
|
|
5721
|
-
objectives:
|
|
5722
|
-
findings:
|
|
5809
|
+
z3.object({
|
|
5810
|
+
type: z3.literal("verdict"),
|
|
5811
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5812
|
+
head: z3.string(),
|
|
5813
|
+
comment_id: z3.number().int(),
|
|
5814
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5815
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5723
5816
|
}).strict(),
|
|
5724
|
-
|
|
5725
|
-
type:
|
|
5726
|
-
class:
|
|
5727
|
-
comment_id:
|
|
5817
|
+
z3.object({
|
|
5818
|
+
type: z3.literal("escalation"),
|
|
5819
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5820
|
+
comment_id: z3.number().int()
|
|
5728
5821
|
}).strict(),
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5822
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5823
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5824
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5825
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5733
5826
|
]);
|
|
5734
5827
|
var dispatchShared = {
|
|
5735
5828
|
meta: HeaderMetaSchema,
|
|
5736
5829
|
subject: SubjectSchema,
|
|
5737
|
-
kind:
|
|
5830
|
+
kind: z3.literal("dispatch"),
|
|
5738
5831
|
...envelopeTail,
|
|
5739
5832
|
target_role: RoleSchema,
|
|
5740
|
-
model:
|
|
5741
|
-
round:
|
|
5742
|
-
effect_id:
|
|
5833
|
+
model: z3.string(),
|
|
5834
|
+
round: z3.number().int().optional(),
|
|
5835
|
+
effect_id: z3.string()
|
|
5743
5836
|
};
|
|
5744
|
-
var dispatchUsageField =
|
|
5745
|
-
var DispatchEventSchema =
|
|
5746
|
-
|
|
5747
|
-
|
|
5837
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5838
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5839
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5840
|
+
z3.object({
|
|
5748
5841
|
...dispatchShared,
|
|
5749
|
-
event:
|
|
5842
|
+
event: z3.literal("outcome_received"),
|
|
5750
5843
|
outcome: DispatchOutcomeSchema,
|
|
5751
5844
|
usage: dispatchUsageField
|
|
5752
5845
|
}).strict(),
|
|
5753
|
-
|
|
5846
|
+
z3.object({
|
|
5754
5847
|
...dispatchShared,
|
|
5755
|
-
event:
|
|
5756
|
-
reason:
|
|
5848
|
+
event: z3.literal("dispatch_failed"),
|
|
5849
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
5757
5850
|
usage: dispatchUsageField
|
|
5758
5851
|
}).strict()
|
|
5759
5852
|
]);
|
|
5853
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5854
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5855
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5856
|
+
role: RoleSchema,
|
|
5857
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5858
|
+
blockers: z3.number().int().nonnegative()
|
|
5859
|
+
}).strict();
|
|
5760
5860
|
var loopShared = {
|
|
5761
5861
|
meta: HeaderMetaSchema,
|
|
5762
5862
|
subject: SubjectSchema,
|
|
5763
|
-
kind:
|
|
5863
|
+
kind: z3.literal("dev_review_loop"),
|
|
5764
5864
|
...envelopeTail,
|
|
5765
|
-
loop_id:
|
|
5865
|
+
loop_id: z3.string()
|
|
5766
5866
|
};
|
|
5767
|
-
var DevReviewLoopEventSchema =
|
|
5768
|
-
|
|
5867
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5868
|
+
z3.object({
|
|
5769
5869
|
...loopShared,
|
|
5770
|
-
event:
|
|
5771
|
-
task:
|
|
5772
|
-
policy:
|
|
5773
|
-
max_rounds:
|
|
5774
|
-
reviewers:
|
|
5775
|
-
models:
|
|
5870
|
+
event: z3.literal("loop_started"),
|
|
5871
|
+
task: z3.number().int(),
|
|
5872
|
+
policy: z3.object({
|
|
5873
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
5874
|
+
reviewers: z3.array(RoleSchema),
|
|
5875
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5776
5876
|
}).strict()
|
|
5777
5877
|
}).strict(),
|
|
5778
|
-
|
|
5779
|
-
|
|
5878
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
5879
|
+
z3.object({
|
|
5780
5880
|
...loopShared,
|
|
5781
|
-
event:
|
|
5782
|
-
round:
|
|
5783
|
-
head:
|
|
5784
|
-
green:
|
|
5785
|
-
confidence_value:
|
|
5786
|
-
confidence_reason:
|
|
5787
|
-
confidence_unavailable:
|
|
5788
|
-
extra_turn_spent:
|
|
5881
|
+
event: z3.literal("gate_result_read"),
|
|
5882
|
+
round: z3.number().int(),
|
|
5883
|
+
head: z3.string(),
|
|
5884
|
+
green: z3.boolean(),
|
|
5885
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
5886
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
5887
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
5888
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5789
5889
|
}).strict(),
|
|
5790
|
-
|
|
5890
|
+
z3.object({
|
|
5791
5891
|
...loopShared,
|
|
5792
|
-
event:
|
|
5793
|
-
round:
|
|
5794
|
-
head:
|
|
5795
|
-
all_approve:
|
|
5796
|
-
blockers:
|
|
5797
|
-
findings:
|
|
5892
|
+
event: z3.literal("verdicts_read"),
|
|
5893
|
+
round: z3.number().int(),
|
|
5894
|
+
head: z3.string(),
|
|
5895
|
+
all_approve: z3.boolean(),
|
|
5896
|
+
blockers: z3.number().int().nonnegative(),
|
|
5897
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
5898
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5798
5899
|
}).strict(),
|
|
5799
|
-
|
|
5900
|
+
z3.object({
|
|
5800
5901
|
...loopShared,
|
|
5801
|
-
event:
|
|
5802
|
-
round:
|
|
5803
|
-
open:
|
|
5804
|
-
resolved:
|
|
5805
|
-
new:
|
|
5806
|
-
recurring:
|
|
5902
|
+
event: z3.literal("findings_compared"),
|
|
5903
|
+
round: z3.number().int(),
|
|
5904
|
+
open: z3.array(z3.string()),
|
|
5905
|
+
resolved: z3.array(z3.string()),
|
|
5906
|
+
new: z3.array(z3.string()),
|
|
5907
|
+
recurring: z3.array(z3.string())
|
|
5807
5908
|
}).strict(),
|
|
5808
|
-
|
|
5909
|
+
z3.object({
|
|
5809
5910
|
...loopShared,
|
|
5810
|
-
event:
|
|
5811
|
-
round:
|
|
5812
|
-
condition:
|
|
5911
|
+
event: z3.literal("stop_condition_met"),
|
|
5912
|
+
round: z3.number().int(),
|
|
5913
|
+
condition: z3.enum([
|
|
5813
5914
|
"green",
|
|
5814
5915
|
"max_rounds",
|
|
5815
5916
|
"no_progress",
|
|
5816
5917
|
"escalated",
|
|
5817
5918
|
"principal_stop",
|
|
5818
5919
|
"confidence",
|
|
5819
|
-
"reappearance"
|
|
5920
|
+
"reappearance",
|
|
5921
|
+
"repeat_finding",
|
|
5922
|
+
"repeat_failure",
|
|
5923
|
+
"time_budget"
|
|
5820
5924
|
])
|
|
5821
5925
|
}).strict(),
|
|
5822
|
-
|
|
5926
|
+
z3.object({
|
|
5927
|
+
...loopShared,
|
|
5928
|
+
event: z3.literal("paused"),
|
|
5929
|
+
round: z3.number().int(),
|
|
5930
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
5931
|
+
reason_code: CodeTokenSchema.optional()
|
|
5932
|
+
}).strict(),
|
|
5933
|
+
z3.object({
|
|
5934
|
+
...loopShared,
|
|
5935
|
+
event: z3.literal("resumed"),
|
|
5936
|
+
round: z3.number().int(),
|
|
5937
|
+
by: z3.enum(["principal", "driver"])
|
|
5938
|
+
}).strict(),
|
|
5939
|
+
z3.object({
|
|
5823
5940
|
...loopShared,
|
|
5824
|
-
event:
|
|
5825
|
-
round:
|
|
5826
|
-
|
|
5941
|
+
event: z3.literal("cancelled"),
|
|
5942
|
+
round: z3.number().int(),
|
|
5943
|
+
by: z3.literal("principal")
|
|
5827
5944
|
}).strict(),
|
|
5828
|
-
|
|
5945
|
+
z3.object({
|
|
5829
5946
|
...loopShared,
|
|
5830
|
-
event:
|
|
5831
|
-
round:
|
|
5832
|
-
|
|
5947
|
+
event: z3.literal("unpushed_work_resume"),
|
|
5948
|
+
round: z3.number().int(),
|
|
5949
|
+
branch: z3.string(),
|
|
5950
|
+
detail: z3.string()
|
|
5833
5951
|
}).strict(),
|
|
5834
|
-
|
|
5952
|
+
z3.object({
|
|
5835
5953
|
...loopShared,
|
|
5836
|
-
event:
|
|
5837
|
-
round:
|
|
5838
|
-
|
|
5954
|
+
event: z3.literal("round_ended"),
|
|
5955
|
+
round: z3.number().int(),
|
|
5956
|
+
base_head: z3.string(),
|
|
5957
|
+
head: z3.string(),
|
|
5958
|
+
files_changed: z3.number().int().nonnegative(),
|
|
5959
|
+
insertions: z3.number().int().nonnegative(),
|
|
5960
|
+
deletions: z3.number().int().nonnegative(),
|
|
5961
|
+
wall_ms: z3.number().nonnegative(),
|
|
5962
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5839
5963
|
}).strict(),
|
|
5840
|
-
|
|
5964
|
+
z3.object({
|
|
5841
5965
|
...loopShared,
|
|
5842
|
-
event:
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5966
|
+
event: z3.literal("journal_finalized"),
|
|
5967
|
+
rounds: z3.number().int().nonnegative(),
|
|
5968
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
5969
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
5970
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
5971
|
+
final_head: z3.string(),
|
|
5972
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5846
5973
|
}).strict(),
|
|
5847
|
-
|
|
5974
|
+
z3.object({
|
|
5848
5975
|
...loopShared,
|
|
5849
|
-
event:
|
|
5850
|
-
round:
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
insertions: z2.number().int().nonnegative(),
|
|
5855
|
-
deletions: z2.number().int().nonnegative(),
|
|
5856
|
-
wall_ms: z2.number().nonnegative(),
|
|
5857
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
5976
|
+
event: z3.literal("infrastructure_retry"),
|
|
5977
|
+
round: z3.number().int(),
|
|
5978
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
5979
|
+
attempts: z3.number().int().positive(),
|
|
5980
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5858
5981
|
}).strict(),
|
|
5859
|
-
|
|
5982
|
+
z3.object({
|
|
5860
5983
|
...loopShared,
|
|
5861
|
-
event:
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
final_head: z2.string(),
|
|
5867
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
5984
|
+
event: z3.literal("driver_heartbeat"),
|
|
5985
|
+
task: z3.number().int(),
|
|
5986
|
+
pr: z3.number().int().positive().optional(),
|
|
5987
|
+
round: z3.number().int(),
|
|
5988
|
+
phase: z3.string()
|
|
5868
5989
|
}).strict(),
|
|
5869
|
-
|
|
5990
|
+
z3.object({
|
|
5870
5991
|
...loopShared,
|
|
5871
|
-
event:
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5992
|
+
event: z3.literal("driver_exited"),
|
|
5993
|
+
task: z3.number().int(),
|
|
5994
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
5995
|
+
last_decision: z3.string(),
|
|
5996
|
+
exit_code: z3.number().int().optional(),
|
|
5997
|
+
error_class: CodeTokenSchema.optional()
|
|
5876
5998
|
}).strict()
|
|
5877
5999
|
]);
|
|
5878
|
-
var ForgeOpSchema =
|
|
6000
|
+
var ForgeOpSchema = z3.enum([
|
|
5879
6001
|
"pr.create",
|
|
5880
6002
|
"pr.comment",
|
|
5881
6003
|
"pr.body.replace",
|
|
@@ -5889,24 +6011,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5889
6011
|
"label.add",
|
|
5890
6012
|
"label.remove"
|
|
5891
6013
|
]);
|
|
5892
|
-
var ForgeWriteTargetSchema =
|
|
5893
|
-
issue:
|
|
5894
|
-
pr:
|
|
6014
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6015
|
+
issue: z3.number().int().optional(),
|
|
6016
|
+
pr: z3.number().int().optional()
|
|
5895
6017
|
}).strict();
|
|
5896
6018
|
var forgeWriteShared = {
|
|
5897
6019
|
meta: HeaderMetaSchema,
|
|
5898
6020
|
subject: SubjectSchema,
|
|
5899
|
-
kind:
|
|
6021
|
+
kind: z3.literal("forge_write"),
|
|
5900
6022
|
...envelopeTail,
|
|
5901
6023
|
op: ForgeOpSchema,
|
|
5902
6024
|
target: ForgeWriteTargetSchema
|
|
5903
6025
|
};
|
|
5904
|
-
var ForgeWriteEventSchema =
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
6026
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6027
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6028
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6029
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5908
6030
|
]);
|
|
5909
|
-
var GateOutcomeSchema =
|
|
6031
|
+
var GateOutcomeSchema = z3.enum([
|
|
5910
6032
|
"pass",
|
|
5911
6033
|
"fail",
|
|
5912
6034
|
"wait",
|
|
@@ -5919,61 +6041,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5919
6041
|
var gateShared = {
|
|
5920
6042
|
meta: HeaderMetaSchema,
|
|
5921
6043
|
subject: SubjectSchema,
|
|
5922
|
-
kind:
|
|
6044
|
+
kind: z3.literal("gate"),
|
|
5923
6045
|
...envelopeTail,
|
|
5924
|
-
check:
|
|
5925
|
-
check_version:
|
|
5926
|
-
policy_version:
|
|
5927
|
-
input_fingerprint:
|
|
6046
|
+
check: z3.string(),
|
|
6047
|
+
check_version: z3.string().nullable(),
|
|
6048
|
+
policy_version: z3.string().nullable(),
|
|
6049
|
+
input_fingerprint: z3.string().nullable()
|
|
5928
6050
|
};
|
|
5929
|
-
var GateEventSchema =
|
|
5930
|
-
|
|
6051
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6052
|
+
z3.object({
|
|
5931
6053
|
...gateShared,
|
|
5932
|
-
event:
|
|
6054
|
+
event: z3.literal("checked"),
|
|
5933
6055
|
outcome: GateOutcomeSchema,
|
|
5934
|
-
reason:
|
|
6056
|
+
reason: z3.string().optional()
|
|
6057
|
+
}).strict(),
|
|
6058
|
+
z3.object({
|
|
6059
|
+
meta: HeaderMetaSchema,
|
|
6060
|
+
subject: SubjectSchema,
|
|
6061
|
+
kind: z3.literal("gate"),
|
|
6062
|
+
...envelopeTail,
|
|
6063
|
+
event: z3.literal("summary"),
|
|
6064
|
+
ran: z3.number().int().nonnegative(),
|
|
6065
|
+
passed: z3.number().int().nonnegative(),
|
|
6066
|
+
failed: z3.number().int().nonnegative(),
|
|
6067
|
+
skipped: z3.number().int().nonnegative(),
|
|
6068
|
+
failed_checks: z3.array(z3.string())
|
|
5935
6069
|
}).strict()
|
|
5936
6070
|
]);
|
|
5937
|
-
var OperationResultSchema =
|
|
6071
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
5938
6072
|
var operationShared = {
|
|
5939
6073
|
meta: HeaderMetaSchema,
|
|
5940
6074
|
subject: SubjectSchema,
|
|
5941
|
-
kind:
|
|
6075
|
+
kind: z3.literal("operation"),
|
|
5942
6076
|
...envelopeTail,
|
|
5943
|
-
operation:
|
|
5944
|
-
target:
|
|
6077
|
+
operation: z3.string(),
|
|
6078
|
+
target: z3.string().nullable()
|
|
5945
6079
|
};
|
|
5946
|
-
var OperationEventSchema =
|
|
5947
|
-
|
|
6080
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6081
|
+
z3.object({
|
|
5948
6082
|
...operationShared,
|
|
5949
|
-
event:
|
|
6083
|
+
event: z3.literal("completed"),
|
|
5950
6084
|
result: OperationResultSchema,
|
|
5951
|
-
error_class:
|
|
6085
|
+
error_class: z3.string().nullable(),
|
|
6086
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
5952
6087
|
}).strict()
|
|
5953
6088
|
]);
|
|
5954
|
-
var UsageUnitsSchema =
|
|
5955
|
-
input:
|
|
5956
|
-
output:
|
|
5957
|
-
cache:
|
|
6089
|
+
var UsageUnitsSchema = z3.object({
|
|
6090
|
+
input: z3.number().nonnegative().nullable(),
|
|
6091
|
+
output: z3.number().nonnegative().nullable(),
|
|
6092
|
+
cache: z3.number().nonnegative().nullable()
|
|
5958
6093
|
}).strict();
|
|
5959
6094
|
var usageShared = {
|
|
5960
6095
|
meta: HeaderMetaSchema,
|
|
5961
6096
|
subject: SubjectSchema,
|
|
5962
|
-
kind:
|
|
6097
|
+
kind: z3.literal("usage"),
|
|
5963
6098
|
...envelopeTail,
|
|
5964
|
-
model:
|
|
5965
|
-
source:
|
|
5966
|
-
semantics:
|
|
6099
|
+
model: z3.string().nullable(),
|
|
6100
|
+
source: z3.string(),
|
|
6101
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
5967
6102
|
};
|
|
5968
|
-
var UsageEventSchema =
|
|
5969
|
-
|
|
6103
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6104
|
+
z3.object({
|
|
5970
6105
|
...usageShared,
|
|
5971
|
-
event:
|
|
6106
|
+
event: z3.literal("observed"),
|
|
5972
6107
|
units: UsageUnitsSchema,
|
|
5973
|
-
unknown_reason:
|
|
6108
|
+
unknown_reason: z3.string().nullable()
|
|
5974
6109
|
}).strict()
|
|
5975
6110
|
]);
|
|
5976
|
-
var RoleAttemptOutcomeSchema =
|
|
6111
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
5977
6112
|
"completed",
|
|
5978
6113
|
"incomplete",
|
|
5979
6114
|
"infrastructure_failed",
|
|
@@ -5984,17 +6119,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
5984
6119
|
var roleAttemptShared = {
|
|
5985
6120
|
meta: HeaderMetaSchema,
|
|
5986
6121
|
subject: SubjectSchema,
|
|
5987
|
-
kind:
|
|
6122
|
+
kind: z3.literal("role_attempt"),
|
|
5988
6123
|
...envelopeTail,
|
|
5989
|
-
actor:
|
|
5990
|
-
attempt:
|
|
5991
|
-
effect_id:
|
|
5992
|
-
model:
|
|
6124
|
+
actor: z3.string().nullable(),
|
|
6125
|
+
attempt: z3.number().int().nullable(),
|
|
6126
|
+
effect_id: z3.string(),
|
|
6127
|
+
model: z3.string().nullable()
|
|
5993
6128
|
};
|
|
5994
|
-
var RoleAttemptEventSchema =
|
|
5995
|
-
|
|
6129
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6130
|
+
z3.object({
|
|
5996
6131
|
...roleAttemptShared,
|
|
5997
|
-
event:
|
|
6132
|
+
event: z3.literal("attempted"),
|
|
5998
6133
|
outcome: RoleAttemptOutcomeSchema,
|
|
5999
6134
|
usage: dispatchUsageField
|
|
6000
6135
|
}).strict()
|
|
@@ -6002,42 +6137,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
6002
6137
|
var handoffShared = {
|
|
6003
6138
|
meta: HeaderMetaSchema,
|
|
6004
6139
|
subject: SubjectSchema,
|
|
6005
|
-
kind:
|
|
6140
|
+
kind: z3.literal("handoff"),
|
|
6006
6141
|
...envelopeTail,
|
|
6007
|
-
class:
|
|
6008
|
-
reason:
|
|
6142
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6143
|
+
reason: z3.string()
|
|
6009
6144
|
};
|
|
6010
|
-
var HandoffEventSchema =
|
|
6011
|
-
|
|
6145
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6146
|
+
z3.object({
|
|
6012
6147
|
...handoffShared,
|
|
6013
|
-
event:
|
|
6014
|
-
requested_decision:
|
|
6148
|
+
event: z3.literal("raised"),
|
|
6149
|
+
requested_decision: z3.string().nullable()
|
|
6015
6150
|
}).strict(),
|
|
6016
|
-
|
|
6151
|
+
z3.object({
|
|
6017
6152
|
...handoffShared,
|
|
6018
|
-
event:
|
|
6019
|
-
resolution:
|
|
6020
|
-
resolved_by:
|
|
6153
|
+
event: z3.literal("resolved"),
|
|
6154
|
+
resolution: z3.string().nullable(),
|
|
6155
|
+
resolved_by: z3.string().nullable()
|
|
6021
6156
|
}).strict()
|
|
6022
6157
|
]);
|
|
6023
|
-
var EffectTargetSchema =
|
|
6024
|
-
kind:
|
|
6025
|
-
ref:
|
|
6158
|
+
var EffectTargetSchema = z3.object({
|
|
6159
|
+
kind: z3.string(),
|
|
6160
|
+
ref: z3.string()
|
|
6026
6161
|
}).strict();
|
|
6027
6162
|
var effectShared = {
|
|
6028
6163
|
meta: HeaderMetaSchema,
|
|
6029
6164
|
subject: SubjectSchema,
|
|
6030
|
-
kind:
|
|
6165
|
+
kind: z3.literal("effect"),
|
|
6031
6166
|
...envelopeTail,
|
|
6032
|
-
effect_id:
|
|
6167
|
+
effect_id: z3.string(),
|
|
6033
6168
|
target: EffectTargetSchema
|
|
6034
6169
|
};
|
|
6035
|
-
var EffectEventSchema =
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6170
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6171
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6172
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6173
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6174
|
+
]);
|
|
6175
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6176
|
+
var customShared = {
|
|
6177
|
+
meta: HeaderMetaV3Schema,
|
|
6178
|
+
subject: SubjectSchema,
|
|
6179
|
+
kind: z3.literal("custom"),
|
|
6180
|
+
...envelopeTail
|
|
6181
|
+
};
|
|
6182
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6183
|
+
z3.object({
|
|
6184
|
+
...customShared,
|
|
6185
|
+
event: z3.literal("recorded"),
|
|
6186
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6187
|
+
fields: z3.record(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH).regex(CUSTOM_FIELD_NAME_PATTERN), CustomFieldValueSchema).refine((f) => Object.keys(f).length <= CUSTOM_EVENT_MAX_FIELDS, {
|
|
6188
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6189
|
+
})
|
|
6190
|
+
}).strict()
|
|
6039
6191
|
]);
|
|
6040
|
-
var LogEventSchema =
|
|
6192
|
+
var LogEventSchema = z3.union([
|
|
6041
6193
|
DispatchEventSchema,
|
|
6042
6194
|
DevReviewLoopEventSchema,
|
|
6043
6195
|
ForgeWriteEventSchema,
|
|
@@ -6046,10 +6198,11 @@ var LogEventSchema = z2.union([
|
|
|
6046
6198
|
UsageEventSchema,
|
|
6047
6199
|
RoleAttemptEventSchema,
|
|
6048
6200
|
HandoffEventSchema,
|
|
6049
|
-
EffectEventSchema
|
|
6201
|
+
EffectEventSchema,
|
|
6202
|
+
CustomEventSchema
|
|
6050
6203
|
]);
|
|
6051
|
-
|
|
6052
6204
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6205
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6053
6206
|
function isRole(value) {
|
|
6054
6207
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6055
6208
|
}
|
|
@@ -6086,18 +6239,27 @@ function roundFromEnv(round) {
|
|
|
6086
6239
|
const n = Number(round);
|
|
6087
6240
|
return Number.isInteger(n) ? n : undefined;
|
|
6088
6241
|
}
|
|
6242
|
+
function prFromEnv(pr) {
|
|
6243
|
+
if (pr === undefined || pr === "")
|
|
6244
|
+
return;
|
|
6245
|
+
const n = Number(pr);
|
|
6246
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6247
|
+
}
|
|
6089
6248
|
function buildHeader(input) {
|
|
6090
6249
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6091
6250
|
const round = roundFromEnv(input.env.round);
|
|
6251
|
+
const pr = prFromEnv(input.env.pr);
|
|
6092
6252
|
const subject = {
|
|
6093
6253
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6094
6254
|
role,
|
|
6095
6255
|
...round !== undefined ? { round } : {},
|
|
6256
|
+
...pr !== undefined ? { pr } : {},
|
|
6096
6257
|
...input.subject ?? {}
|
|
6097
6258
|
};
|
|
6259
|
+
const issue = subject.issue;
|
|
6098
6260
|
return {
|
|
6099
6261
|
meta: {
|
|
6100
|
-
schema:
|
|
6262
|
+
schema: 3,
|
|
6101
6263
|
ts: input.now.toISOString(),
|
|
6102
6264
|
run_id: input.runId,
|
|
6103
6265
|
seq: input.seq,
|
|
@@ -6120,7 +6282,19 @@ function buildHeader(input) {
|
|
|
6120
6282
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6121
6283
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6122
6284
|
},
|
|
6123
|
-
provenance: provenanceFor(input)
|
|
6285
|
+
provenance: provenanceFor(input),
|
|
6286
|
+
work: {
|
|
6287
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6288
|
+
repo: input.repo,
|
|
6289
|
+
change: null,
|
|
6290
|
+
revision: null
|
|
6291
|
+
},
|
|
6292
|
+
flow: {
|
|
6293
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6294
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6295
|
+
},
|
|
6296
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6297
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6124
6298
|
},
|
|
6125
6299
|
subject
|
|
6126
6300
|
};
|
|
@@ -6163,7 +6337,7 @@ function redact(value, home) {
|
|
|
6163
6337
|
return value;
|
|
6164
6338
|
}
|
|
6165
6339
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6166
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6340
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6167
6341
|
function metaOf(obj) {
|
|
6168
6342
|
if (obj === null || typeof obj !== "object")
|
|
6169
6343
|
return null;
|
|
@@ -6229,7 +6403,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6229
6403
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6230
6404
|
}
|
|
6231
6405
|
const redacted = redact(event, home);
|
|
6232
|
-
const provenance = version
|
|
6406
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6233
6407
|
return {
|
|
6234
6408
|
status: "ok",
|
|
6235
6409
|
identity,
|
|
@@ -6242,134 +6416,143 @@ function classifyStoredLine(raw, home) {
|
|
|
6242
6416
|
};
|
|
6243
6417
|
}
|
|
6244
6418
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6245
|
-
import { z as
|
|
6246
|
-
var isoTimestamp =
|
|
6247
|
-
var taskId =
|
|
6248
|
-
var epochNumber =
|
|
6249
|
-
var RunRecordSchema =
|
|
6250
|
-
version:
|
|
6251
|
-
kind:
|
|
6419
|
+
import { z as z4 } from "zod";
|
|
6420
|
+
var isoTimestamp = z4.string().min(1);
|
|
6421
|
+
var taskId = z4.number().int().positive();
|
|
6422
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6423
|
+
var RunRecordSchema = z4.object({
|
|
6424
|
+
version: z4.literal(1),
|
|
6425
|
+
kind: z4.literal("run"),
|
|
6252
6426
|
task: taskId,
|
|
6253
|
-
runId:
|
|
6254
|
-
pid:
|
|
6255
|
-
host:
|
|
6427
|
+
runId: z4.string().min(1),
|
|
6428
|
+
pid: z4.number().int().positive(),
|
|
6429
|
+
host: z4.string().min(1),
|
|
6256
6430
|
startedAt: isoTimestamp,
|
|
6257
|
-
childStartedAt:
|
|
6258
|
-
childCommand:
|
|
6431
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6432
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6259
6433
|
}).strict();
|
|
6260
|
-
var InputRecordSchema =
|
|
6261
|
-
version:
|
|
6262
|
-
kind:
|
|
6434
|
+
var InputRecordSchema = z4.object({
|
|
6435
|
+
version: z4.literal(1),
|
|
6436
|
+
kind: z4.literal("input"),
|
|
6263
6437
|
task: taskId,
|
|
6264
|
-
runId:
|
|
6265
|
-
source:
|
|
6266
|
-
pr:
|
|
6267
|
-
round:
|
|
6438
|
+
runId: z4.string().min(1),
|
|
6439
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6440
|
+
pr: z4.number().int().positive().nullable(),
|
|
6441
|
+
round: z4.number().int().nonnegative(),
|
|
6268
6442
|
recordedAt: isoTimestamp
|
|
6269
6443
|
}).strict();
|
|
6270
|
-
var OwnershipRecordSchema =
|
|
6271
|
-
version:
|
|
6272
|
-
kind:
|
|
6444
|
+
var OwnershipRecordSchema = z4.object({
|
|
6445
|
+
version: z4.literal(1),
|
|
6446
|
+
kind: z4.literal("ownership"),
|
|
6273
6447
|
task: taskId,
|
|
6274
6448
|
epoch: epochNumber,
|
|
6275
|
-
ownerId:
|
|
6276
|
-
pid:
|
|
6277
|
-
host:
|
|
6449
|
+
ownerId: z4.string().min(1),
|
|
6450
|
+
pid: z4.number().int().positive(),
|
|
6451
|
+
host: z4.string().min(1),
|
|
6278
6452
|
acquiredAt: isoTimestamp
|
|
6279
6453
|
}).strict();
|
|
6280
|
-
var TransitionRecordSchema =
|
|
6281
|
-
version:
|
|
6282
|
-
kind:
|
|
6454
|
+
var TransitionRecordSchema = z4.object({
|
|
6455
|
+
version: z4.literal(1),
|
|
6456
|
+
kind: z4.literal("transition"),
|
|
6283
6457
|
task: taskId,
|
|
6284
6458
|
epoch: epochNumber,
|
|
6285
|
-
seq:
|
|
6286
|
-
from:
|
|
6287
|
-
to:
|
|
6288
|
-
detail:
|
|
6459
|
+
seq: z4.number().int().nonnegative(),
|
|
6460
|
+
from: z4.string().min(1),
|
|
6461
|
+
to: z4.string().min(1),
|
|
6462
|
+
detail: z4.string().optional(),
|
|
6289
6463
|
at: isoTimestamp
|
|
6290
6464
|
}).strict();
|
|
6291
|
-
var ManifestRecordSchema =
|
|
6292
|
-
version:
|
|
6293
|
-
kind:
|
|
6465
|
+
var ManifestRecordSchema = z4.object({
|
|
6466
|
+
version: z4.literal(1),
|
|
6467
|
+
kind: z4.literal("manifest"),
|
|
6294
6468
|
task: taskId,
|
|
6295
6469
|
round: epochNumber,
|
|
6296
|
-
repository:
|
|
6297
|
-
pr:
|
|
6298
|
-
branch:
|
|
6299
|
-
baseSha:
|
|
6300
|
-
headSha:
|
|
6301
|
-
briefHash:
|
|
6302
|
-
objectivesVersion:
|
|
6470
|
+
repository: z4.string().min(1),
|
|
6471
|
+
pr: z4.number().int().positive(),
|
|
6472
|
+
branch: z4.string().min(1),
|
|
6473
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6474
|
+
headSha: z4.string().min(1),
|
|
6475
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6476
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6303
6477
|
rulingOrdinal: epochNumber,
|
|
6304
|
-
policyDigest:
|
|
6478
|
+
policyDigest: z4.string().min(1),
|
|
6305
6479
|
recordedAt: isoTimestamp
|
|
6306
6480
|
}).strict();
|
|
6307
|
-
var roundHeadIdentity =
|
|
6308
|
-
var LoopBudgetsSchema =
|
|
6309
|
-
mechanicalRetries:
|
|
6310
|
-
reviewRounds:
|
|
6311
|
-
infrastructureRetries:
|
|
6481
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6482
|
+
var LoopBudgetsSchema = z4.object({
|
|
6483
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6484
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6485
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6312
6486
|
}).strict();
|
|
6313
|
-
var LoopStateRecordSchema =
|
|
6314
|
-
version:
|
|
6315
|
-
kind:
|
|
6487
|
+
var LoopStateRecordSchema = z4.object({
|
|
6488
|
+
version: z4.literal(1),
|
|
6489
|
+
kind: z4.literal("loop_state"),
|
|
6316
6490
|
task: taskId,
|
|
6317
|
-
round:
|
|
6318
|
-
phase:
|
|
6319
|
-
pauseReason:
|
|
6491
|
+
round: z4.number().int().positive(),
|
|
6492
|
+
phase: z4.string().min(1),
|
|
6493
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6320
6494
|
budgets: LoopBudgetsSchema,
|
|
6321
6495
|
heldResult: roundHeadIdentity.nullable(),
|
|
6322
6496
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6497
|
+
repeatMemory: z4.object({
|
|
6498
|
+
blockingFindings: z4.array(z4.string()),
|
|
6499
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6500
|
+
}).strict().optional(),
|
|
6501
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6502
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6503
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6323
6504
|
recordedAt: isoTimestamp
|
|
6324
6505
|
}).strict();
|
|
6325
|
-
var EffectRecordSchema =
|
|
6326
|
-
version:
|
|
6327
|
-
kind:
|
|
6506
|
+
var EffectRecordSchema = z4.object({
|
|
6507
|
+
version: z4.literal(1),
|
|
6508
|
+
kind: z4.literal("effect"),
|
|
6328
6509
|
task: taskId,
|
|
6329
|
-
key:
|
|
6330
|
-
operation:
|
|
6331
|
-
target:
|
|
6332
|
-
inputVersion:
|
|
6333
|
-
payloadDigest:
|
|
6334
|
-
status:
|
|
6335
|
-
url:
|
|
6510
|
+
key: z4.string().min(1),
|
|
6511
|
+
operation: z4.string().min(1),
|
|
6512
|
+
target: z4.string().min(1),
|
|
6513
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6514
|
+
payloadDigest: z4.string().min(1),
|
|
6515
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6516
|
+
url: z4.string().optional(),
|
|
6336
6517
|
recordedAt: isoTimestamp
|
|
6337
6518
|
}).strict();
|
|
6338
|
-
var EscalationRecordSchema =
|
|
6339
|
-
version:
|
|
6340
|
-
kind:
|
|
6519
|
+
var EscalationRecordSchema = z4.object({
|
|
6520
|
+
version: z4.literal(1),
|
|
6521
|
+
kind: z4.literal("escalation"),
|
|
6341
6522
|
task: taskId,
|
|
6342
|
-
escalationId:
|
|
6523
|
+
escalationId: z4.string().min(1),
|
|
6343
6524
|
round: epochNumber,
|
|
6344
|
-
head:
|
|
6345
|
-
branch:
|
|
6346
|
-
pr:
|
|
6347
|
-
runId:
|
|
6348
|
-
pid:
|
|
6349
|
-
host:
|
|
6350
|
-
agent:
|
|
6351
|
-
reason:
|
|
6352
|
-
detail:
|
|
6353
|
-
evidence:
|
|
6354
|
-
attemptedRecovery:
|
|
6355
|
-
requestedDecision:
|
|
6356
|
-
recipient:
|
|
6357
|
-
briefHash:
|
|
6358
|
-
objectivesVersion:
|
|
6525
|
+
head: z4.string().min(1),
|
|
6526
|
+
branch: z4.string().min(1),
|
|
6527
|
+
pr: z4.number().int().positive().nullable(),
|
|
6528
|
+
runId: z4.string().min(1),
|
|
6529
|
+
pid: z4.number().int().positive(),
|
|
6530
|
+
host: z4.string().min(1),
|
|
6531
|
+
agent: z4.string().min(1).optional(),
|
|
6532
|
+
reason: z4.string().min(1),
|
|
6533
|
+
detail: z4.string().optional(),
|
|
6534
|
+
evidence: z4.string().optional(),
|
|
6535
|
+
attemptedRecovery: z4.string().min(1),
|
|
6536
|
+
requestedDecision: z4.string().min(1),
|
|
6537
|
+
recipient: z4.string().min(1),
|
|
6538
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6539
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6359
6540
|
rulingOrdinal: epochNumber,
|
|
6360
|
-
policyDigest:
|
|
6541
|
+
policyDigest: z4.string().min(1),
|
|
6361
6542
|
recordedAt: isoTimestamp
|
|
6362
6543
|
}).strict();
|
|
6363
|
-
var ResolutionRecordSchema =
|
|
6364
|
-
version:
|
|
6365
|
-
kind:
|
|
6544
|
+
var ResolutionRecordSchema = z4.object({
|
|
6545
|
+
version: z4.literal(1),
|
|
6546
|
+
kind: z4.literal("resolution"),
|
|
6366
6547
|
task: taskId,
|
|
6367
|
-
escalationId:
|
|
6368
|
-
decision:
|
|
6369
|
-
authenticatedBy:
|
|
6370
|
-
authenticatedFrom:
|
|
6548
|
+
escalationId: z4.string().min(1),
|
|
6549
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6550
|
+
authenticatedBy: z4.string().min(1),
|
|
6551
|
+
authenticatedFrom: z4.string().min(1),
|
|
6371
6552
|
consumedAt: isoTimestamp
|
|
6372
6553
|
}).strict();
|
|
6554
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6555
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6373
6556
|
// src/checks/contract.ts
|
|
6374
6557
|
var CHECK_SCHEMA_VERSION = 1;
|
|
6375
6558
|
function emitCheckError(error) {
|
|
@@ -6386,29 +6569,29 @@ import { promisify as promisify4 } from "node:util";
|
|
|
6386
6569
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6387
6570
|
import { homedir } from "node:os";
|
|
6388
6571
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6389
|
-
import { z as
|
|
6572
|
+
import { z as z5 } from "zod";
|
|
6390
6573
|
|
|
6391
6574
|
// src/lib/agent-vendors.ts
|
|
6392
6575
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
6393
6576
|
|
|
6394
6577
|
// src/lib/config.ts
|
|
6395
|
-
var EnvEntrySchema =
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6578
|
+
var EnvEntrySchema = z5.union([
|
|
6579
|
+
z5.literal(true),
|
|
6580
|
+
z5.object({ optional: z5.literal(true) }),
|
|
6581
|
+
z5.object({ anyOf: z5.array(z5.string()).min(2) }),
|
|
6582
|
+
z5.string()
|
|
6400
6583
|
]);
|
|
6401
|
-
var CheckEntrySchema =
|
|
6402
|
-
run:
|
|
6403
|
-
scope:
|
|
6404
|
-
include:
|
|
6405
|
-
args:
|
|
6406
|
-
timeoutMs:
|
|
6407
|
-
env:
|
|
6408
|
-
requiresOpenPr:
|
|
6409
|
-
ownWorkflow:
|
|
6410
|
-
principalOwed:
|
|
6411
|
-
validates:
|
|
6584
|
+
var CheckEntrySchema = z5.object({
|
|
6585
|
+
run: z5.string(),
|
|
6586
|
+
scope: z5.enum(["diff", "full"]),
|
|
6587
|
+
include: z5.array(z5.string()).optional(),
|
|
6588
|
+
args: z5.array(z5.string()).optional(),
|
|
6589
|
+
timeoutMs: z5.number().optional(),
|
|
6590
|
+
env: z5.record(z5.string(), EnvEntrySchema).optional(),
|
|
6591
|
+
requiresOpenPr: z5.boolean().optional(),
|
|
6592
|
+
ownWorkflow: z5.boolean().optional(),
|
|
6593
|
+
principalOwed: z5.literal(true).optional(),
|
|
6594
|
+
validates: z5.enum(["body", "issue"]).optional()
|
|
6412
6595
|
}).superRefine((entry, ctx) => {
|
|
6413
6596
|
if (!entry.env)
|
|
6414
6597
|
return;
|
|
@@ -6418,22 +6601,22 @@ var CheckEntrySchema = z4.object({
|
|
|
6418
6601
|
const members = value.anyOf;
|
|
6419
6602
|
if (new Set(members).size !== members.length) {
|
|
6420
6603
|
ctx.addIssue({
|
|
6421
|
-
code:
|
|
6604
|
+
code: z5.ZodIssueCode.custom,
|
|
6422
6605
|
message: `env.${key}.anyOf has duplicate members`,
|
|
6423
6606
|
path: ["env", key, "anyOf"]
|
|
6424
6607
|
});
|
|
6425
6608
|
}
|
|
6426
6609
|
if (!members.includes(key)) {
|
|
6427
6610
|
ctx.addIssue({
|
|
6428
|
-
code:
|
|
6611
|
+
code: z5.ZodIssueCode.custom,
|
|
6429
6612
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
6430
6613
|
path: ["env", key, "anyOf"]
|
|
6431
6614
|
});
|
|
6432
6615
|
}
|
|
6433
6616
|
}
|
|
6434
6617
|
});
|
|
6435
|
-
var RoleEntrySchema =
|
|
6436
|
-
contract:
|
|
6618
|
+
var RoleEntrySchema = z5.object({
|
|
6619
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
6437
6620
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
6438
6621
|
})
|
|
6439
6622
|
});
|
|
@@ -6457,17 +6640,17 @@ var BRIEF_BUILTINS = [
|
|
|
6457
6640
|
"briefSections",
|
|
6458
6641
|
"milestoneShape"
|
|
6459
6642
|
];
|
|
6460
|
-
var BriefSectionSchema =
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6643
|
+
var BriefSectionSchema = z5.union([
|
|
6644
|
+
z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
|
|
6645
|
+
z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
|
|
6646
|
+
z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
|
|
6647
|
+
z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
|
|
6465
6648
|
]);
|
|
6466
|
-
var BriefSchemaSchema =
|
|
6467
|
-
pr:
|
|
6468
|
-
issue:
|
|
6469
|
-
milestone:
|
|
6470
|
-
ack:
|
|
6649
|
+
var BriefSchemaSchema = z5.object({
|
|
6650
|
+
pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6651
|
+
issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6652
|
+
milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6653
|
+
ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
|
|
6471
6654
|
});
|
|
6472
6655
|
function isSafeRepoRelPath(p) {
|
|
6473
6656
|
if (p.length === 0)
|
|
@@ -6476,7 +6659,7 @@ function isSafeRepoRelPath(p) {
|
|
|
6476
6659
|
return false;
|
|
6477
6660
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
6478
6661
|
}
|
|
6479
|
-
var SafeRepoRelPath =
|
|
6662
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
6480
6663
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
6481
6664
|
});
|
|
6482
6665
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -6486,22 +6669,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
6486
6669
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
6487
6670
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
6488
6671
|
});
|
|
6489
|
-
var ManagedBlockRecordSchema =
|
|
6672
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
6490
6673
|
path: ManagedHookBlockPath,
|
|
6491
|
-
marker:
|
|
6492
|
-
comment:
|
|
6674
|
+
marker: z5.string(),
|
|
6675
|
+
comment: z5.enum(["hash", "html"])
|
|
6493
6676
|
});
|
|
6494
|
-
var ManagedManifestSchema =
|
|
6495
|
-
version:
|
|
6496
|
-
files:
|
|
6497
|
-
blocks:
|
|
6498
|
-
labels:
|
|
6499
|
-
agents:
|
|
6677
|
+
var ManagedManifestSchema = z5.object({
|
|
6678
|
+
version: z5.number().int().positive(),
|
|
6679
|
+
files: z5.array(SafeRepoRelPath),
|
|
6680
|
+
blocks: z5.array(ManagedBlockRecordSchema),
|
|
6681
|
+
labels: z5.array(z5.string()),
|
|
6682
|
+
agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
|
|
6500
6683
|
});
|
|
6501
|
-
var ProjectEntrySchema =
|
|
6502
|
-
name:
|
|
6503
|
-
description:
|
|
6504
|
-
path:
|
|
6684
|
+
var ProjectEntrySchema = z5.object({
|
|
6685
|
+
name: z5.string().min(1),
|
|
6686
|
+
description: z5.string().min(1).optional(),
|
|
6687
|
+
path: z5.string().min(1).optional()
|
|
6505
6688
|
});
|
|
6506
6689
|
function parseTokensCollectDeclaration(value) {
|
|
6507
6690
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -6512,87 +6695,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
6512
6695
|
return null;
|
|
6513
6696
|
return { interpreter, script };
|
|
6514
6697
|
}
|
|
6515
|
-
var VinayaConfigSchema =
|
|
6516
|
-
rings:
|
|
6517
|
-
ring1_forgeWriteInterception:
|
|
6518
|
-
ring2_asyncAudits:
|
|
6698
|
+
var VinayaConfigSchema = z5.object({
|
|
6699
|
+
rings: z5.object({
|
|
6700
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
6701
|
+
ring2_asyncAudits: z5.boolean()
|
|
6519
6702
|
}).optional(),
|
|
6520
|
-
checks:
|
|
6521
|
-
roles:
|
|
6703
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
6704
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
6522
6705
|
briefSchema: BriefSchemaSchema.optional(),
|
|
6523
6706
|
managed: ManagedManifestSchema.optional(),
|
|
6524
|
-
principals:
|
|
6525
|
-
releaseActor:
|
|
6526
|
-
ci:
|
|
6527
|
-
tokens:
|
|
6528
|
-
collect:
|
|
6707
|
+
principals: z5.array(z5.string()).min(1).optional(),
|
|
6708
|
+
releaseActor: z5.string().min(1).optional(),
|
|
6709
|
+
ci: z5.object({ setup: z5.string().min(1) }).optional(),
|
|
6710
|
+
tokens: z5.object({
|
|
6711
|
+
collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
6529
6712
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
6530
6713
|
})
|
|
6531
6714
|
}).optional(),
|
|
6532
|
-
blastRadius:
|
|
6533
|
-
proseGates:
|
|
6534
|
-
doctrineRoot:
|
|
6535
|
-
readerFacingPrefix:
|
|
6536
|
-
readerFacingSuffix:
|
|
6537
|
-
legacySlugDir:
|
|
6538
|
-
sourceComments:
|
|
6539
|
-
globs:
|
|
6540
|
-
allowlist:
|
|
6541
|
-
severity:
|
|
6715
|
+
blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
|
|
6716
|
+
proseGates: z5.object({
|
|
6717
|
+
doctrineRoot: z5.string().min(1).optional(),
|
|
6718
|
+
readerFacingPrefix: z5.string().min(1).optional(),
|
|
6719
|
+
readerFacingSuffix: z5.string().min(1).optional(),
|
|
6720
|
+
legacySlugDir: z5.string().min(1).optional(),
|
|
6721
|
+
sourceComments: z5.object({
|
|
6722
|
+
globs: z5.array(z5.string().min(1)).optional(),
|
|
6723
|
+
allowlist: z5.array(z5.string().min(1)).optional(),
|
|
6724
|
+
severity: z5.enum(["warning", "error"]).optional()
|
|
6542
6725
|
}).optional(),
|
|
6543
|
-
specGrandfather:
|
|
6544
|
-
specPaths:
|
|
6726
|
+
specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
|
|
6727
|
+
specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6545
6728
|
message: "must be a repository-relative path, not an absolute one"
|
|
6546
6729
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6547
6730
|
message: "must stay inside the repository — no `..` segment"
|
|
6548
6731
|
})).optional()
|
|
6549
6732
|
}).optional(),
|
|
6550
|
-
projects:
|
|
6551
|
-
dispatch:
|
|
6552
|
-
timeoutMs:
|
|
6553
|
-
killGraceMs:
|
|
6554
|
-
agent:
|
|
6555
|
-
|
|
6733
|
+
projects: z5.array(ProjectEntrySchema).optional(),
|
|
6734
|
+
dispatch: z5.object({
|
|
6735
|
+
timeoutMs: z5.number().int().positive().optional(),
|
|
6736
|
+
killGraceMs: z5.number().int().positive().optional(),
|
|
6737
|
+
agent: z5.enum(["claude", "codex", "gemini"]).optional()
|
|
6738
|
+
}).optional(),
|
|
6739
|
+
reviewPolicy: z5.object({
|
|
6740
|
+
codeReviewThreshold: z5.string().min(1).optional(),
|
|
6741
|
+
securityThreshold: z5.string().min(1).optional(),
|
|
6742
|
+
maxRounds: z5.number().optional(),
|
|
6743
|
+
maxTaskMinutes: z5.number().optional()
|
|
6556
6744
|
}).optional(),
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
securityThreshold: z4.string().min(1).optional(),
|
|
6560
|
-
maxRounds: z4.number().optional()
|
|
6745
|
+
securityScan: z5.object({
|
|
6746
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
6561
6747
|
}).optional(),
|
|
6562
|
-
gateCutovers:
|
|
6563
|
-
objectivesSinceIssue:
|
|
6564
|
-
briefSectionsSinceIssue:
|
|
6565
|
-
documentationSinceIssue:
|
|
6566
|
-
briefRulesSincePr:
|
|
6567
|
-
agentBoxesRefusedSincePr:
|
|
6748
|
+
gateCutovers: z5.object({
|
|
6749
|
+
objectivesSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6750
|
+
briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6751
|
+
documentationSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6752
|
+
briefRulesSincePr: z5.number().int().nonnegative().optional(),
|
|
6753
|
+
agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
|
|
6568
6754
|
}).optional(),
|
|
6569
|
-
|
|
6570
|
-
|
|
6755
|
+
planning: z5.object({
|
|
6756
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
6571
6757
|
}).optional(),
|
|
6572
|
-
|
|
6573
|
-
|
|
6758
|
+
prePush: z5.object({
|
|
6759
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
6760
|
+
}).optional(),
|
|
6761
|
+
report: z5.object({
|
|
6762
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
6574
6763
|
}).superRefine((report, ctx) => {
|
|
6575
6764
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6576
6765
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6577
6766
|
ctx.addIssue({
|
|
6578
|
-
code:
|
|
6767
|
+
code: z5.ZodIssueCode.custom,
|
|
6579
6768
|
path: ["commandTimeoutMs"],
|
|
6580
6769
|
message: "must be at most 3600000 (1 hour)"
|
|
6581
6770
|
});
|
|
6582
6771
|
}
|
|
6583
6772
|
}).optional(),
|
|
6584
|
-
logPublish:
|
|
6773
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
6585
6774
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6586
6775
|
}),
|
|
6587
|
-
runtimeDir:
|
|
6588
|
-
logs:
|
|
6589
|
-
folder:
|
|
6590
|
-
url:
|
|
6591
|
-
headers:
|
|
6776
|
+
runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6777
|
+
logs: z5.object({
|
|
6778
|
+
folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6779
|
+
url: z5.string().url().optional(),
|
|
6780
|
+
headers: z5.record(z5.string()).optional(),
|
|
6781
|
+
readHeaders: z5.record(z5.string()).optional(),
|
|
6782
|
+
events: CustomEventDeclarationsSchema.optional()
|
|
6592
6783
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6593
6784
|
message: "logs: set at most one of folder/url"
|
|
6594
6785
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6595
6786
|
message: "logs: headers requires url"
|
|
6787
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
6788
|
+
message: "logs: readHeaders requires url"
|
|
6596
6789
|
}).optional()
|
|
6597
6790
|
});
|
|
6598
6791
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
@@ -6697,10 +6890,15 @@ function resolveReviewPolicy(config) {
|
|
|
6697
6890
|
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6698
6891
|
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6699
6892
|
}
|
|
6893
|
+
const maxTaskMinutes = raw.maxTaskMinutes ?? DEFAULT_REVIEW_POLICY.maxTaskMinutes;
|
|
6894
|
+
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
6895
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
6896
|
+
}
|
|
6700
6897
|
return {
|
|
6701
6898
|
codeReviewThreshold,
|
|
6702
6899
|
securityThreshold,
|
|
6703
|
-
maxRounds
|
|
6900
|
+
maxRounds,
|
|
6901
|
+
maxTaskMinutes
|
|
6704
6902
|
};
|
|
6705
6903
|
}
|
|
6706
6904
|
function resolveGateCutovers(config) {
|