@attalabs/vinaya 0.31.0 → 0.33.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 +2 -3
- package/aeg-root/contracts/principal-operator.md +18 -5
- package/aeg-root/roles/developer/reference.md +3 -3
- package/aeg-root/roles/operator.md +69 -16
- package/aeg-root/roles/planner/reference.md +1 -1
- package/aeg-root/roles/tranche-archivist.md +1 -0
- package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
- package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
- package/aeg-root/templates/pr-report-template.md +7 -2
- package/dist/checks/bin/check-body-bare-digits.js +340 -101
- package/dist/checks/bin/check-branch-topology.js +184 -105
- package/dist/checks/bin/check-brief-shape.js +333 -94
- package/dist/checks/bin/check-changeset-coverage.js +1028 -248
- package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
- package/dist/checks/bin/check-closes-n.js +184 -105
- package/dist/checks/bin/check-coherence.js +345 -145
- package/dist/checks/bin/check-dead-branch-push.js +179 -59
- package/dist/checks/bin/check-dispatch-readiness.js +350 -150
- package/dist/checks/bin/check-doc-coverage-push.js +1011 -231
- package/dist/checks/bin/check-doc-coverage.js +1015 -235
- package/dist/checks/bin/check-doctrine-no-procedures.js +333 -94
- package/dist/checks/bin/check-doctrine-portability.js +1013 -233
- package/dist/checks/bin/check-evidence-fresh.js +1010 -222
- package/dist/checks/bin/check-exec-bits.js +1009 -229
- package/dist/checks/bin/check-first-push-dispatch.js +343 -145
- package/dist/checks/bin/check-issue-assignment.js +186 -107
- package/dist/checks/bin/check-issue-milestone-attach.js +176 -56
- package/dist/checks/bin/check-issue-objectives-numbering.js +176 -56
- package/dist/checks/bin/check-issue-parts-coverage.js +176 -56
- package/dist/checks/bin/check-issue-surface-globs.js +363 -143
- package/dist/checks/bin/check-issue-title-grammar.js +176 -56
- package/dist/checks/bin/check-issue-tranche-label.js +176 -56
- package/dist/checks/bin/check-main-branch-refusal.js +176 -56
- package/dist/checks/bin/check-no-disk-state.js +176 -56
- package/dist/checks/bin/check-pr-premise-reassert.js +333 -92
- package/dist/checks/bin/check-pr-report-density.js +176 -56
- package/dist/checks/bin/check-principal-test-plan-wait.js +176 -54
- package/dist/checks/bin/check-quoted-command.js +999 -217
- package/dist/checks/bin/check-reader-resolvable-prose.js +1011 -229
- package/dist/checks/bin/check-registry-gates.js +186 -56
- package/dist/checks/bin/check-retired-vocabulary.js +997 -215
- package/dist/checks/bin/check-review-gate.js +403 -203
- package/dist/checks/bin/check-single-plan-pr.js +176 -56
- package/dist/checks/bin/check-surface-scope.js +184 -105
- package/dist/checks/bin/check-test-plan.js +176 -54
- package/dist/checks/bin/check-token-collection-wired.js +182 -57
- package/dist/checks/bin/check-token-report.js +178 -58
- package/dist/checks/bin/check-workspace-escape.js +1011 -229
- package/dist/index.js +5971 -3489
- package/dist/lib/pre-push-cache-test-run.js +4431 -0
- package/dist/lib/pre-push-select-tests.js +799 -110
- package/package.json +3 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +212 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +27 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +379 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +239 -110
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +184 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +488 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +314 -56
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -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/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.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/api/coherence/route.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +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.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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
- 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]__074w9nf._.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]__0r7e54g._.js → [root-of-the-server]__18paley._.js} +1 -1
- 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]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
- 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/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.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/_15gdg48._.js +5 -5
- 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/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- 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/0bjnj-5fy4e7l.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -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/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
|
-
|
|
5
|
-
// src/checks/bin/check-review-gate.ts
|
|
6
|
-
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7
4
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
5
|
var GATE_AUDIENCE = {
|
|
9
6
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1037,7 +1034,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
1037
1034
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
1038
1035
|
|
|
1039
1036
|
// ../../node_modules/fast-content-type-parse/index.js
|
|
1040
|
-
var NullObject = function
|
|
1037
|
+
var NullObject = function NullObject() {};
|
|
1041
1038
|
NullObject.prototype = Object.create(null);
|
|
1042
1039
|
var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
|
|
1043
1040
|
var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
|
|
@@ -1781,27 +1778,27 @@ function splitTableRow(row) {
|
|
|
1781
1778
|
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1782
1779
|
}
|
|
1783
1780
|
// ../../packages/aeg-core/src/blast-radius-domains.ts
|
|
1784
|
-
function resolveWorkspaceEntry(
|
|
1785
|
-
if (
|
|
1786
|
-
const baseDir =
|
|
1781
|
+
function resolveWorkspaceEntry(entry, listDirs) {
|
|
1782
|
+
if (entry.endsWith("/*")) {
|
|
1783
|
+
const baseDir = entry.slice(0, -2);
|
|
1787
1784
|
return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
|
|
1788
1785
|
}
|
|
1789
|
-
if (
|
|
1786
|
+
if (entry.includes("*"))
|
|
1790
1787
|
return [];
|
|
1791
|
-
return [
|
|
1788
|
+
return [entry];
|
|
1792
1789
|
}
|
|
1793
1790
|
// ../../packages/aeg-core/src/consumer-enumeration.ts
|
|
1794
1791
|
function deriveWorkspaceMemberDirs(workspaces, listDirs) {
|
|
1795
|
-
const positive = workspaces.filter((
|
|
1796
|
-
const negative = workspaces.filter((
|
|
1792
|
+
const positive = workspaces.filter((entry) => !entry.startsWith("!"));
|
|
1793
|
+
const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
|
|
1797
1794
|
const excluded = new Set;
|
|
1798
|
-
for (const
|
|
1799
|
-
for (const member of resolveWorkspaceEntry(
|
|
1795
|
+
for (const entry of negative) {
|
|
1796
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs))
|
|
1800
1797
|
excluded.add(member);
|
|
1801
1798
|
}
|
|
1802
1799
|
const members = new Set;
|
|
1803
|
-
for (const
|
|
1804
|
-
for (const member of resolveWorkspaceEntry(
|
|
1800
|
+
for (const entry of positive) {
|
|
1801
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs)) {
|
|
1805
1802
|
if (!excluded.has(member))
|
|
1806
1803
|
members.add(member);
|
|
1807
1804
|
}
|
|
@@ -2047,12 +2044,24 @@ function extractBaseSha(comment) {
|
|
|
2047
2044
|
const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
|
|
2048
2045
|
return m ? m[1].toLowerCase() : null;
|
|
2049
2046
|
}
|
|
2050
|
-
var
|
|
2047
|
+
var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
|
|
2048
|
+
function parseFindingState(description) {
|
|
2049
|
+
const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
|
|
2050
|
+
if (!m)
|
|
2051
|
+
return { id: null, state: null };
|
|
2052
|
+
return { id: `F${m[1]}`, state: m[2] ?? null };
|
|
2053
|
+
}
|
|
2054
|
+
var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
|
|
2051
2055
|
function extractFindingSeverities(comment) {
|
|
2052
|
-
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) =>
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
+
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
|
|
2057
|
+
const { id, state } = parseFindingState(m[3] ?? "");
|
|
2058
|
+
return {
|
|
2059
|
+
severity: m[1],
|
|
2060
|
+
location: m[2],
|
|
2061
|
+
id,
|
|
2062
|
+
state
|
|
2063
|
+
};
|
|
2064
|
+
});
|
|
2056
2065
|
}
|
|
2057
2066
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
2058
2067
|
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
@@ -2125,15 +2134,15 @@ function summarizeTranscript(jsonl) {
|
|
|
2125
2134
|
const line = rawLine.trim();
|
|
2126
2135
|
if (!line)
|
|
2127
2136
|
continue;
|
|
2128
|
-
let
|
|
2137
|
+
let entry;
|
|
2129
2138
|
try {
|
|
2130
|
-
|
|
2139
|
+
entry = JSON.parse(line);
|
|
2131
2140
|
} catch {
|
|
2132
2141
|
continue;
|
|
2133
2142
|
}
|
|
2134
|
-
if (!
|
|
2143
|
+
if (!entry || typeof entry !== "object")
|
|
2135
2144
|
continue;
|
|
2136
|
-
const obj =
|
|
2145
|
+
const obj = entry;
|
|
2137
2146
|
if (obj.type !== "assistant")
|
|
2138
2147
|
continue;
|
|
2139
2148
|
const message = obj.message;
|
|
@@ -2466,6 +2475,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
|
|
|
2466
2475
|
});
|
|
2467
2476
|
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
|
|
2468
2477
|
}
|
|
2478
|
+
function isConsequentialFinding(finding) {
|
|
2479
|
+
return finding.state !== "resolved";
|
|
2480
|
+
}
|
|
2481
|
+
function consequentialFindings(findings) {
|
|
2482
|
+
return findings.filter((f) => isConsequentialFinding(f));
|
|
2483
|
+
}
|
|
2469
2484
|
function evaluateCodeReview(findings, policy) {
|
|
2470
2485
|
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2471
2486
|
}
|
|
@@ -2981,7 +2996,7 @@ function isStep0Block(content) {
|
|
|
2981
2996
|
}
|
|
2982
2997
|
function checkCommandsCarryOutput(prBody) {
|
|
2983
2998
|
const errors = [];
|
|
2984
|
-
for (const [
|
|
2999
|
+
for (const [label, num] of [
|
|
2985
3000
|
["5", 5],
|
|
2986
3001
|
["6", 6]
|
|
2987
3002
|
]) {
|
|
@@ -2995,7 +3010,7 @@ function checkCommandsCarryOutput(prBody) {
|
|
|
2995
3010
|
continue;
|
|
2996
3011
|
const next = blocks[i + 1];
|
|
2997
3012
|
if (!next || isCommandBlock(next.content)) {
|
|
2998
|
-
errors.push(`brief-validation commands carry output: §${
|
|
3013
|
+
errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
|
|
2999
3014
|
}
|
|
3000
3015
|
}
|
|
3001
3016
|
}
|
|
@@ -3432,8 +3447,8 @@ function stripPartBackticks(text) {
|
|
|
3432
3447
|
function partWordCount(text) {
|
|
3433
3448
|
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3434
3449
|
}
|
|
3435
|
-
function looksLikeFilePath(
|
|
3436
|
-
const stripped =
|
|
3450
|
+
function looksLikeFilePath(entry) {
|
|
3451
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3437
3452
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3438
3453
|
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3439
3454
|
return extMatch !== null && extMatch.index > 0;
|
|
@@ -3919,14 +3934,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3919
3934
|
const referenced = extractClosesReferences(prBody);
|
|
3920
3935
|
if (taskIssueRefs) {
|
|
3921
3936
|
for (const n of referenced) {
|
|
3922
|
-
const
|
|
3923
|
-
if (!
|
|
3937
|
+
const ref = taskIssueRefs.get(n);
|
|
3938
|
+
if (!ref)
|
|
3924
3939
|
continue;
|
|
3925
|
-
const expectedBranch = `task/${
|
|
3940
|
+
const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
|
|
3926
3941
|
if (branch !== expectedBranch) {
|
|
3927
3942
|
return {
|
|
3928
3943
|
ok: false,
|
|
3929
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3944
|
+
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.`
|
|
3930
3945
|
};
|
|
3931
3946
|
}
|
|
3932
3947
|
}
|
|
@@ -3935,15 +3950,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3935
3950
|
if (!ref)
|
|
3936
3951
|
return { ok: true };
|
|
3937
3952
|
if (ref.kind === "issue") {
|
|
3938
|
-
const
|
|
3939
|
-
if (!referenced.has(
|
|
3953
|
+
const expectedIssue = ref.issueNumber;
|
|
3954
|
+
if (!referenced.has(expectedIssue)) {
|
|
3940
3955
|
return {
|
|
3941
3956
|
ok: false,
|
|
3942
|
-
expectedIssue
|
|
3943
|
-
message: `closes-n: PR body does not contain \`Closes #${
|
|
3957
|
+
expectedIssue,
|
|
3958
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3944
3959
|
};
|
|
3945
3960
|
}
|
|
3946
|
-
return { ok: true, expectedIssue
|
|
3961
|
+
return { ok: true, expectedIssue };
|
|
3947
3962
|
}
|
|
3948
3963
|
const trancheSlug = ref.tranche;
|
|
3949
3964
|
const taskId = ref.taskId;
|
|
@@ -3989,8 +4004,8 @@ function extractIssue(body) {
|
|
|
3989
4004
|
const anchorNums = closesRefs(anchored);
|
|
3990
4005
|
if (anchorNums.length === 0)
|
|
3991
4006
|
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
3992
|
-
const
|
|
3993
|
-
return { issue
|
|
4007
|
+
const issue = anchorNums[0];
|
|
4008
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
|
|
3994
4009
|
}
|
|
3995
4010
|
const headerNums = closesRefs(headerRegion(stripped));
|
|
3996
4011
|
if (bodyNums.length === 0)
|
|
@@ -4059,15 +4074,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4059
4074
|
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4060
4075
|
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4061
4076
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4062
|
-
const
|
|
4077
|
+
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4063
4078
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4064
4079
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4065
4080
|
return {
|
|
4066
|
-
bound: head && base && briefHashBound &&
|
|
4081
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4067
4082
|
head,
|
|
4068
4083
|
base,
|
|
4069
4084
|
briefHash: briefHashBound,
|
|
4070
|
-
objectivesVersion
|
|
4085
|
+
objectivesVersion,
|
|
4071
4086
|
rulingOrdinal,
|
|
4072
4087
|
policyDigest: policyDigestBound
|
|
4073
4088
|
};
|
|
@@ -4098,8 +4113,8 @@ function checkReviewGate(input) {
|
|
|
4098
4113
|
let codeReviewPolicyEvaluation;
|
|
4099
4114
|
let securityPolicyEvaluation;
|
|
4100
4115
|
try {
|
|
4101
|
-
codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
|
|
4102
|
-
securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
|
|
4116
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
|
|
4117
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4103
4118
|
} catch (err) {
|
|
4104
4119
|
return {
|
|
4105
4120
|
verdict: "fail",
|
|
@@ -5180,11 +5195,27 @@ var ObservedSchema = z.object({
|
|
|
5180
5195
|
var TaskStatusInputSchema = z.object({
|
|
5181
5196
|
task: TaskToolRefSchema.optional()
|
|
5182
5197
|
}).merge(PageRequestSchema).strict();
|
|
5198
|
+
var TaskConfidenceSchema = z.object({
|
|
5199
|
+
round: z.number().int().positive(),
|
|
5200
|
+
percent: z.number().int().min(0).max(100).nullable(),
|
|
5201
|
+
source: z.enum(["stated", "published-summary"])
|
|
5202
|
+
}).strict();
|
|
5203
|
+
var TaskPhaseHistorySchema = z.object({
|
|
5204
|
+
typicalPhaseMinutes: z.number().nonnegative(),
|
|
5205
|
+
typicalPhaseSamples: z.number().int().positive()
|
|
5206
|
+
}).strict();
|
|
5183
5207
|
var TaskStatusItemSchema = z.object({
|
|
5184
5208
|
task: TaskToolRefSchema,
|
|
5185
5209
|
issue: z.number().int().positive(),
|
|
5186
5210
|
pr: z.number().int().positive().nullable(),
|
|
5187
|
-
state: z.string()
|
|
5211
|
+
state: z.string(),
|
|
5212
|
+
round: z.number().int().positive().nullable().optional(),
|
|
5213
|
+
phase: z.string().min(1).nullable().optional(),
|
|
5214
|
+
minutesInPhase: z.number().nonnegative().nullable().optional(),
|
|
5215
|
+
phaseIsCurrent: z.boolean().nullable().optional(),
|
|
5216
|
+
lastConfidence: TaskConfidenceSchema.nullable().optional(),
|
|
5217
|
+
lastConfidenceUnread: z.boolean().optional(),
|
|
5218
|
+
phaseHistory: TaskPhaseHistorySchema.nullable().optional()
|
|
5188
5219
|
}).merge(ObservedSchema);
|
|
5189
5220
|
var TaskStatusResultSchema = z.object({
|
|
5190
5221
|
items: z.array(TaskStatusItemSchema),
|
|
@@ -5196,7 +5227,7 @@ var EscalationInputsSchema = z.object({
|
|
|
5196
5227
|
round: z.number().int().nonnegative(),
|
|
5197
5228
|
head: z.string(),
|
|
5198
5229
|
branch: z.string(),
|
|
5199
|
-
prNumber: z.number().int().positive()
|
|
5230
|
+
prNumber: z.number().int().positive().nullable()
|
|
5200
5231
|
});
|
|
5201
5232
|
var EscalationEvidenceSchema = z.object({
|
|
5202
5233
|
round: z.number().int().nonnegative(),
|
|
@@ -5232,13 +5263,45 @@ var TaskEscalationReadResultSchema = z.object({
|
|
|
5232
5263
|
items: z.array(TaskEscalationPacketSchema),
|
|
5233
5264
|
nextCursor: z.string().nullable()
|
|
5234
5265
|
}).merge(ObservedSchema);
|
|
5235
|
-
var
|
|
5236
|
-
|
|
5237
|
-
|
|
5266
|
+
var TaskPrCheckSchema = z.object({
|
|
5267
|
+
name: z.string(),
|
|
5268
|
+
required: z.boolean(),
|
|
5269
|
+
status: z.string(),
|
|
5270
|
+
conclusion: z.string().nullable(),
|
|
5271
|
+
detailsUrl: z.string().nullable(),
|
|
5272
|
+
failureSummary: z.string().nullable()
|
|
5273
|
+
});
|
|
5274
|
+
var TaskPrVerdictSchema = z.object({
|
|
5275
|
+
role: z.enum(["code-review", "security"]),
|
|
5276
|
+
value: z.string(),
|
|
5277
|
+
judgedHead: z.string().nullable(),
|
|
5278
|
+
objectivesVersion: z.string().nullable()
|
|
5279
|
+
});
|
|
5280
|
+
var TaskPrPauseSchema = z.object({
|
|
5281
|
+
reason: z.string(),
|
|
5282
|
+
body: z.string()
|
|
5283
|
+
});
|
|
5284
|
+
var TaskPrReviewRecordSchema = z.object({
|
|
5285
|
+
verdicts: z.array(TaskPrVerdictSchema),
|
|
5286
|
+
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5287
|
+
summaryTable: z.string().nullable(),
|
|
5288
|
+
pause: TaskPrPauseSchema.nullable()
|
|
5289
|
+
});
|
|
5290
|
+
var TaskPrReadInputSchema = z.object({
|
|
5291
|
+
task: TaskToolRefSchema,
|
|
5292
|
+
pr: z.number().int().positive().optional()
|
|
5238
5293
|
}).strict();
|
|
5294
|
+
var TaskPrReadResultSchema = z.object({
|
|
5295
|
+
task: TaskToolRefSchema,
|
|
5296
|
+
issue: z.number().int().positive(),
|
|
5297
|
+
pr: z.number().int().positive(),
|
|
5298
|
+
head: z.string().nullable(),
|
|
5299
|
+
checks: z.array(TaskPrCheckSchema),
|
|
5300
|
+
review: TaskPrReviewRecordSchema
|
|
5301
|
+
}).merge(ObservedSchema);
|
|
5239
5302
|
var TaskStartResultSchema = z.object({
|
|
5240
5303
|
requestId: z.string().min(1),
|
|
5241
|
-
run:
|
|
5304
|
+
run: TaskToolRefSchema,
|
|
5242
5305
|
started: z.boolean(),
|
|
5243
5306
|
startedAt: z.string(),
|
|
5244
5307
|
mode: z.literal("attended")
|
|
@@ -5252,7 +5315,7 @@ var TaskCancelInputSchema = z.object({
|
|
|
5252
5315
|
}).strict();
|
|
5253
5316
|
var TaskResumeResultSchema = z.object({
|
|
5254
5317
|
task: z.number().int().positive(),
|
|
5255
|
-
pr: z.number().int().positive(),
|
|
5318
|
+
pr: z.number().int().positive().nullable(),
|
|
5256
5319
|
escalationId: z.string().min(1),
|
|
5257
5320
|
outcome: z.enum(["started", "already_resumed"]),
|
|
5258
5321
|
authenticatedBy: z.string().min(1),
|
|
@@ -5261,7 +5324,7 @@ var TaskResumeResultSchema = z.object({
|
|
|
5261
5324
|
var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
|
|
5262
5325
|
var TaskCancelResultSchema = z.object({
|
|
5263
5326
|
task: z.number().int().positive(),
|
|
5264
|
-
pr: z.number().int().positive(),
|
|
5327
|
+
pr: z.number().int().positive().nullable(),
|
|
5265
5328
|
escalationId: z.string().min(1),
|
|
5266
5329
|
outcome: TaskCancelOutcomeSchema,
|
|
5267
5330
|
authenticatedBy: z.string().min(1),
|
|
@@ -5272,6 +5335,7 @@ var TASK_TOOL_NAMES = [
|
|
|
5272
5335
|
"task_start",
|
|
5273
5336
|
"task_status",
|
|
5274
5337
|
"task_escalation_read",
|
|
5338
|
+
"task_pr_read",
|
|
5275
5339
|
"task_resume",
|
|
5276
5340
|
"task_cancel"
|
|
5277
5341
|
];
|
|
@@ -5499,6 +5563,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5499
5563
|
}
|
|
5500
5564
|
return findings;
|
|
5501
5565
|
}
|
|
5566
|
+
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5567
|
+
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5568
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5569
|
+
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5502
5570
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5503
5571
|
import { createHash as createHash5 } from "node:crypto";
|
|
5504
5572
|
|
|
@@ -6037,6 +6105,7 @@ function redact(value, home) {
|
|
|
6037
6105
|
return value;
|
|
6038
6106
|
}
|
|
6039
6107
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6108
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6040
6109
|
function metaOf(obj) {
|
|
6041
6110
|
if (obj === null || typeof obj !== "object")
|
|
6042
6111
|
return null;
|
|
@@ -6059,11 +6128,61 @@ function recordIdentity(obj) {
|
|
|
6059
6128
|
}
|
|
6060
6129
|
return null;
|
|
6061
6130
|
}
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6131
|
+
function schemaVersionOf(obj) {
|
|
6132
|
+
const meta = metaOf(obj);
|
|
6133
|
+
const schema = meta?.schema;
|
|
6134
|
+
return typeof schema === "number" ? schema : null;
|
|
6135
|
+
}
|
|
6136
|
+
function isKnownSchema(version) {
|
|
6137
|
+
return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
|
|
6138
|
+
}
|
|
6139
|
+
function classifyStoredLine(raw, home) {
|
|
6140
|
+
let obj;
|
|
6141
|
+
try {
|
|
6142
|
+
obj = JSON.parse(raw);
|
|
6143
|
+
} catch {
|
|
6144
|
+
return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
|
|
6145
|
+
}
|
|
6146
|
+
const version = schemaVersionOf(obj);
|
|
6147
|
+
if (version === null) {
|
|
6148
|
+
return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
|
|
6149
|
+
}
|
|
6150
|
+
if (!isKnownSchema(version)) {
|
|
6151
|
+
return {
|
|
6152
|
+
status: "unknown_version",
|
|
6153
|
+
identity: recordIdentity(obj),
|
|
6154
|
+
schema: version,
|
|
6155
|
+
raw,
|
|
6156
|
+
reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
|
|
6157
|
+
};
|
|
6158
|
+
}
|
|
6159
|
+
const result = LogEventSchema.safeParse(obj);
|
|
6160
|
+
if (!result.success) {
|
|
6161
|
+
return {
|
|
6162
|
+
status: "invalid",
|
|
6163
|
+
identity: recordIdentity(obj),
|
|
6164
|
+
raw,
|
|
6165
|
+
reason: result.error.issues[0]?.message ?? "schema violation"
|
|
6166
|
+
};
|
|
6167
|
+
}
|
|
6168
|
+
const event = result.data;
|
|
6169
|
+
const identity = recordIdentity(event);
|
|
6170
|
+
if (identity === null) {
|
|
6171
|
+
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6172
|
+
}
|
|
6173
|
+
const redacted = redact(event, home);
|
|
6174
|
+
const provenance = version === 2 ? event.meta.provenance ?? null : null;
|
|
6175
|
+
return {
|
|
6176
|
+
status: "ok",
|
|
6177
|
+
identity,
|
|
6178
|
+
runId: event.meta.run_id,
|
|
6179
|
+
seq: event.meta.seq,
|
|
6180
|
+
schema: version,
|
|
6181
|
+
provenance,
|
|
6182
|
+
event,
|
|
6183
|
+
postLine: JSON.stringify(redacted)
|
|
6184
|
+
};
|
|
6185
|
+
}
|
|
6067
6186
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6068
6187
|
import { z as z3 } from "zod";
|
|
6069
6188
|
var isoTimestamp = z3.string().min(1);
|
|
@@ -6200,8 +6319,12 @@ function emitCheckError(error) {
|
|
|
6200
6319
|
`);
|
|
6201
6320
|
}
|
|
6202
6321
|
|
|
6322
|
+
// src/lib/review-gate-input.ts
|
|
6323
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
6324
|
+
|
|
6203
6325
|
// src/lib/config.ts
|
|
6204
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
6326
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6327
|
+
import { promisify as promisify4 } from "node:util";
|
|
6205
6328
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6206
6329
|
import { homedir } from "node:os";
|
|
6207
6330
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -6228,10 +6351,10 @@ var CheckEntrySchema = z4.object({
|
|
|
6228
6351
|
ownWorkflow: z4.boolean().optional(),
|
|
6229
6352
|
principalOwed: z4.literal(true).optional(),
|
|
6230
6353
|
validates: z4.enum(["body", "issue"]).optional()
|
|
6231
|
-
}).superRefine((
|
|
6232
|
-
if (!
|
|
6354
|
+
}).superRefine((entry, ctx) => {
|
|
6355
|
+
if (!entry.env)
|
|
6233
6356
|
return;
|
|
6234
|
-
for (const [key, value] of Object.entries(
|
|
6357
|
+
for (const [key, value] of Object.entries(entry.env)) {
|
|
6235
6358
|
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
6236
6359
|
continue;
|
|
6237
6360
|
const members = value.anyOf;
|
|
@@ -6388,18 +6511,19 @@ var VinayaConfigSchema = z4.object({
|
|
|
6388
6511
|
});
|
|
6389
6512
|
}
|
|
6390
6513
|
}).optional(),
|
|
6391
|
-
logPublish: z4.
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
}).refine((v) => v.
|
|
6400
|
-
message: "
|
|
6401
|
-
}).
|
|
6402
|
-
|
|
6514
|
+
logPublish: z4.unknown().refine((v) => v === undefined, {
|
|
6515
|
+
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6516
|
+
}),
|
|
6517
|
+
runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6518
|
+
logs: z4.object({
|
|
6519
|
+
folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6520
|
+
url: z4.string().url().optional(),
|
|
6521
|
+
headers: z4.record(z4.string()).optional()
|
|
6522
|
+
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6523
|
+
message: "logs: set at most one of folder/url"
|
|
6524
|
+
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6525
|
+
message: "logs: headers requires url"
|
|
6526
|
+
}).optional()
|
|
6403
6527
|
});
|
|
6404
6528
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
6405
6529
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -6444,32 +6568,39 @@ function globalTokensCollectIgnoredWarning(path) {
|
|
|
6444
6568
|
function globalRuntimeDirIgnoredWarning(path) {
|
|
6445
6569
|
return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
|
|
6446
6570
|
}
|
|
6571
|
+
var emittedGlobalKeyWarnings = new Set;
|
|
6572
|
+
function warnGlobalKeyIgnoredOnce(message) {
|
|
6573
|
+
if (emittedGlobalKeyWarnings.has(message))
|
|
6574
|
+
return;
|
|
6575
|
+
emittedGlobalKeyWarnings.add(message);
|
|
6576
|
+
console.error(`⚠ ${message}`);
|
|
6577
|
+
}
|
|
6447
6578
|
function stripGlobalOnlyKeys(config, path) {
|
|
6448
6579
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
6449
6580
|
return config;
|
|
6450
6581
|
let result = config;
|
|
6451
6582
|
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
6452
|
-
|
|
6583
|
+
warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
|
|
6453
6584
|
result = { ...result, checks: undefined };
|
|
6454
6585
|
}
|
|
6455
6586
|
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
6456
|
-
|
|
6587
|
+
warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
|
|
6457
6588
|
result = { ...result, roles: undefined };
|
|
6458
6589
|
}
|
|
6459
6590
|
if (result.principals && result.principals.length > 0) {
|
|
6460
|
-
|
|
6591
|
+
warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
|
|
6461
6592
|
result = { ...result, principals: undefined };
|
|
6462
6593
|
}
|
|
6463
6594
|
if (result.releaseActor) {
|
|
6464
|
-
|
|
6595
|
+
warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
|
|
6465
6596
|
result = { ...result, releaseActor: undefined };
|
|
6466
6597
|
}
|
|
6467
6598
|
if (result.tokens) {
|
|
6468
|
-
|
|
6599
|
+
warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
|
|
6469
6600
|
result = { ...result, tokens: undefined };
|
|
6470
6601
|
}
|
|
6471
6602
|
if (result.runtimeDir) {
|
|
6472
|
-
|
|
6603
|
+
warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
|
|
6473
6604
|
result = { ...result, runtimeDir: undefined };
|
|
6474
6605
|
}
|
|
6475
6606
|
return result;
|
|
@@ -6502,26 +6633,102 @@ function resolveReviewPolicy(config) {
|
|
|
6502
6633
|
maxRounds
|
|
6503
6634
|
};
|
|
6504
6635
|
}
|
|
6505
|
-
function
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6636
|
+
function resolveRuntimeDirSetting(config) {
|
|
6637
|
+
return config?.runtimeDir ?? null;
|
|
6638
|
+
}
|
|
6639
|
+
function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
|
|
6640
|
+
const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
|
|
6641
|
+
return anchored !== null && anchored === localRuntimeDir ? anchored : null;
|
|
6642
|
+
}
|
|
6643
|
+
function resolveLogsSetting(config) {
|
|
6644
|
+
const raw = config?.logs;
|
|
6645
|
+
if (!raw)
|
|
6646
|
+
return null;
|
|
6647
|
+
if (raw.url !== undefined)
|
|
6648
|
+
return { url: raw.url, headers: raw.headers };
|
|
6649
|
+
if (raw.folder !== undefined)
|
|
6650
|
+
return { folder: raw.folder };
|
|
6651
|
+
return null;
|
|
6652
|
+
}
|
|
6653
|
+
function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
6654
|
+
const anchored = resolveLogsSetting(trustAnchorConfig);
|
|
6655
|
+
if (!anchored)
|
|
6656
|
+
return null;
|
|
6657
|
+
if ("url" in local)
|
|
6658
|
+
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6659
|
+
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6660
|
+
}
|
|
6661
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6662
|
+
if (!headers)
|
|
6663
|
+
return;
|
|
6664
|
+
const resolved = {};
|
|
6665
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
6666
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6512
6667
|
}
|
|
6668
|
+
return resolved;
|
|
6669
|
+
}
|
|
6670
|
+
function trustAnchorRepo() {
|
|
6671
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6672
|
+
if (fromRunner)
|
|
6673
|
+
return fromRunner;
|
|
6513
6674
|
try {
|
|
6514
6675
|
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6515
6676
|
encoding: "utf-8",
|
|
6516
6677
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6517
|
-
})
|
|
6518
|
-
|
|
6519
|
-
return m?.[1] && m[2] ? wellFormed(`${m[1]}/${m[2]}`) : null;
|
|
6678
|
+
});
|
|
6679
|
+
return trustAnchorRepoFromRemoteUrl(url);
|
|
6520
6680
|
} catch {
|
|
6521
6681
|
return null;
|
|
6522
6682
|
}
|
|
6523
6683
|
}
|
|
6684
|
+
async function trustAnchorRepoAsync() {
|
|
6685
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6686
|
+
if (fromRunner)
|
|
6687
|
+
return fromRunner;
|
|
6688
|
+
try {
|
|
6689
|
+
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6690
|
+
encoding: "utf-8",
|
|
6691
|
+
timeout: 1e4
|
|
6692
|
+
});
|
|
6693
|
+
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6694
|
+
} catch {
|
|
6695
|
+
return null;
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
function wellFormedRepoSlug(slug) {
|
|
6699
|
+
return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
6700
|
+
}
|
|
6701
|
+
function trustAnchorRepoFromRunner() {
|
|
6702
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
6703
|
+
return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
|
|
6704
|
+
}
|
|
6705
|
+
function trustAnchorRepoFromRemoteUrl(url) {
|
|
6706
|
+
const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
6707
|
+
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6708
|
+
}
|
|
6709
|
+
var execFileAsync4 = promisify4(execFile4);
|
|
6710
|
+
function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
6711
|
+
const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
|
|
6712
|
+
if (!ref)
|
|
6713
|
+
return null;
|
|
6714
|
+
if (env.GITHUB_ACTIONS !== "true")
|
|
6715
|
+
return null;
|
|
6716
|
+
if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
|
|
6717
|
+
return null;
|
|
6718
|
+
return ref;
|
|
6719
|
+
}
|
|
6720
|
+
function readTrustAnchorConfigAtRef(ref) {
|
|
6721
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6722
|
+
encoding: "utf-8",
|
|
6723
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
6724
|
+
timeout: 1e4
|
|
6725
|
+
});
|
|
6726
|
+
return Buffer.from(raw, "utf-8").toString("base64");
|
|
6727
|
+
}
|
|
6524
6728
|
function ghFetchTrustAnchorConfig() {
|
|
6729
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6730
|
+
if (probeRef)
|
|
6731
|
+
return readTrustAnchorConfigAtRef(probeRef);
|
|
6525
6732
|
const repo = trustAnchorRepo();
|
|
6526
6733
|
if (!repo)
|
|
6527
6734
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
@@ -6530,6 +6737,21 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6530
6737
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6531
6738
|
});
|
|
6532
6739
|
}
|
|
6740
|
+
async function ghFetchTrustAnchorConfigAsync() {
|
|
6741
|
+
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
6742
|
+
if (probeRef) {
|
|
6743
|
+
const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6744
|
+
encoding: "utf-8",
|
|
6745
|
+
timeout: 1e4
|
|
6746
|
+
});
|
|
6747
|
+
return Buffer.from(stdout, "utf-8").toString("base64");
|
|
6748
|
+
}
|
|
6749
|
+
const repo = await trustAnchorRepoAsync();
|
|
6750
|
+
if (!repo)
|
|
6751
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6752
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6753
|
+
return stdout;
|
|
6754
|
+
}
|
|
6533
6755
|
function firstLine(err) {
|
|
6534
6756
|
return err?.message?.split(`
|
|
6535
6757
|
`)[0] ?? "unknown error";
|
|
@@ -6544,16 +6766,35 @@ function isMissingFileError(err) {
|
|
|
6544
6766
|
return /\b404\b|not found/i.test(haystack);
|
|
6545
6767
|
}
|
|
6546
6768
|
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
6547
|
-
const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6548
|
-
`);
|
|
6549
6769
|
let base64;
|
|
6550
6770
|
try {
|
|
6551
|
-
base64 = fetcher()
|
|
6771
|
+
base64 = fetcher();
|
|
6552
6772
|
} catch (err) {
|
|
6553
|
-
|
|
6554
|
-
warn(firstLine(err));
|
|
6555
|
-
return null;
|
|
6773
|
+
return trustAnchorFetchFailed(err);
|
|
6556
6774
|
}
|
|
6775
|
+
return parseTrustAnchorContent(base64);
|
|
6776
|
+
}
|
|
6777
|
+
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
6778
|
+
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
6779
|
+
let base64;
|
|
6780
|
+
try {
|
|
6781
|
+
base64 = await fetcher();
|
|
6782
|
+
} catch (err) {
|
|
6783
|
+
return trustAnchorFetchFailed(err, warn);
|
|
6784
|
+
}
|
|
6785
|
+
return parseTrustAnchorContent(base64, warn);
|
|
6786
|
+
}
|
|
6787
|
+
function warnTrustAnchorFallback(why) {
|
|
6788
|
+
process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6789
|
+
`);
|
|
6790
|
+
}
|
|
6791
|
+
function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
6792
|
+
if (!isMissingFileError(err))
|
|
6793
|
+
warn(firstLine(err));
|
|
6794
|
+
return null;
|
|
6795
|
+
}
|
|
6796
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
6797
|
+
const base64 = content.trim();
|
|
6557
6798
|
if (!base64)
|
|
6558
6799
|
return null;
|
|
6559
6800
|
try {
|
|
@@ -6607,8 +6848,10 @@ function patchIdAt(base, sha) {
|
|
|
6607
6848
|
}
|
|
6608
6849
|
}
|
|
6609
6850
|
|
|
6610
|
-
// src/
|
|
6611
|
-
|
|
6851
|
+
// src/lib/review-gate-input.ts
|
|
6852
|
+
function failure(message, agentRecoveryPrompt) {
|
|
6853
|
+
return { ok: false, failure: { message, agentRecoveryPrompt } };
|
|
6854
|
+
}
|
|
6612
6855
|
function fetchPr(prNumber) {
|
|
6613
6856
|
try {
|
|
6614
6857
|
const out = execFileSync4("gh", ["pr", "view", String(prNumber), "--json", "number,comments,labels,headRefName,headRefOid,baseRefName,body"], {
|
|
@@ -6637,87 +6880,45 @@ function fetchIssueCommentsForBrief(issueNumber) {
|
|
|
6637
6880
|
function resolveBriefHash(pr, principalAllowlist) {
|
|
6638
6881
|
const { issue } = extractIssue(pr.body);
|
|
6639
6882
|
if (issue === null)
|
|
6640
|
-
return null;
|
|
6883
|
+
return { ok: true, value: null };
|
|
6641
6884
|
let comments;
|
|
6642
6885
|
try {
|
|
6643
6886
|
comments = fetchIssueCommentsForBrief(issue);
|
|
6644
6887
|
} catch (err) {
|
|
6645
6888
|
if (isIssueNotFoundError(err)) {
|
|
6646
|
-
|
|
6647
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6648
|
-
check: CHECK_NAME,
|
|
6649
|
-
severity: "error",
|
|
6650
|
-
message: `review-gate severity:infra — Issue #${issue} does not resolve via \`gh issue view\` — cannot verify the brief-hash binding for a PR whose linked Issue no longer exists.`,
|
|
6651
|
-
agent_recovery_prompt: `Restore Issue #${issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`
|
|
6652
|
-
});
|
|
6653
|
-
process.exit(1);
|
|
6889
|
+
return failure(`review-gate severity:infra — Issue #${issue} does not resolve via \`gh issue view\` — cannot verify the brief-hash binding for a PR whose linked Issue no longer exists.`, `Restore Issue #${issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`);
|
|
6654
6890
|
}
|
|
6655
|
-
|
|
6656
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6657
|
-
check: CHECK_NAME,
|
|
6658
|
-
severity: "error",
|
|
6659
|
-
message: `review-gate severity:infra — could not fetch Issue #${issue}'s comments via \`gh issue view\` to resolve its frozen-brief hash: ${err.message}`,
|
|
6660
|
-
agent_recovery_prompt: "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`."
|
|
6661
|
-
});
|
|
6662
|
-
process.exit(1);
|
|
6891
|
+
return failure(`review-gate severity:infra — could not fetch Issue #${issue}'s comments via \`gh issue view\` to resolve its frozen-brief hash: ${err.message}`, "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`.");
|
|
6663
6892
|
}
|
|
6664
6893
|
const frozen = resolveNewestFrozenBrief(comments, principalAllowlist);
|
|
6665
|
-
return frozen ? briefHash(frozen.content) : null;
|
|
6894
|
+
return { ok: true, value: frozen ? briefHash(frozen.content) : null };
|
|
6666
6895
|
}
|
|
6667
6896
|
function resolveObjectivesVersion(pr) {
|
|
6668
6897
|
const { issue } = extractIssue(pr.body);
|
|
6669
6898
|
const source = resolveObjectivesSource(pr.body, issue, OBJECTIVES_SINCE_ISSUE);
|
|
6670
6899
|
if (source.kind === "none")
|
|
6671
|
-
return null;
|
|
6900
|
+
return { ok: true, value: null };
|
|
6672
6901
|
if (source.kind === "issue") {
|
|
6673
6902
|
let issueBody;
|
|
6674
6903
|
try {
|
|
6675
6904
|
issueBody = fetchIssueBodyForObjectives(source.issue);
|
|
6676
6905
|
} catch (err) {
|
|
6677
6906
|
if (isIssueNotFoundError(err)) {
|
|
6678
|
-
|
|
6679
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6680
|
-
check: CHECK_NAME,
|
|
6681
|
-
severity: "error",
|
|
6682
|
-
message: `review-gate severity:infra — Issue #${source.issue} does not resolve via \`gh issue view\` — cannot verify the objectives-version binding for a PR whose linked Issue is at/above the objectives cutover.`,
|
|
6683
|
-
agent_recovery_prompt: `Restore Issue #${source.issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`
|
|
6684
|
-
});
|
|
6685
|
-
process.exit(1);
|
|
6907
|
+
return failure(`review-gate severity:infra — Issue #${source.issue} does not resolve via \`gh issue view\` — cannot verify the objectives-version binding for a PR whose linked Issue is at/above the objectives cutover.`, `Restore Issue #${source.issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`);
|
|
6686
6908
|
}
|
|
6687
|
-
|
|
6688
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6689
|
-
check: CHECK_NAME,
|
|
6690
|
-
severity: "error",
|
|
6691
|
-
message: `review-gate severity:infra — could not fetch Issue #${source.issue}'s body via \`gh issue view\` to resolve its objectives version: ${err.message}`,
|
|
6692
|
-
agent_recovery_prompt: "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`."
|
|
6693
|
-
});
|
|
6694
|
-
process.exit(1);
|
|
6909
|
+
return failure(`review-gate severity:infra — could not fetch Issue #${source.issue}'s body via \`gh issue view\` to resolve its objectives version: ${err.message}`, "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`.");
|
|
6695
6910
|
}
|
|
6696
6911
|
const parsed = objectivesOf(issueBody);
|
|
6697
6912
|
if (!parsed.ok) {
|
|
6698
|
-
|
|
6699
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6700
|
-
check: CHECK_NAME,
|
|
6701
|
-
severity: "error",
|
|
6702
|
-
message: `review-gate severity:infra — Issue #${source.issue}'s \`## Objectives\` section does not parse (${parsed.errors.join("; ")}) — cannot verify the objectives-version binding.`,
|
|
6703
|
-
agent_recovery_prompt: `Fix Issue #${source.issue}'s \`## Objectives\` section, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`
|
|
6704
|
-
});
|
|
6705
|
-
process.exit(1);
|
|
6913
|
+
return failure(`review-gate severity:infra — Issue #${source.issue}'s \`## Objectives\` section does not parse (${parsed.errors.join("; ")}) — cannot verify the objectives-version binding.`, `Fix Issue #${source.issue}'s \`## Objectives\` section, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`);
|
|
6706
6914
|
}
|
|
6707
|
-
return objectivesVersion(parsed.objectives);
|
|
6915
|
+
return { ok: true, value: objectivesVersion(parsed.objectives) };
|
|
6708
6916
|
}
|
|
6709
6917
|
const own = objectivesOf(pr.body);
|
|
6710
6918
|
if (!own.ok) {
|
|
6711
|
-
|
|
6712
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6713
|
-
check: CHECK_NAME,
|
|
6714
|
-
severity: "error",
|
|
6715
|
-
message: `review-gate severity:infra — this PR body's own \`## Objectives\` section does not parse (${own.errors.join("; ")}) — cannot verify the objectives-version binding.`,
|
|
6716
|
-
agent_recovery_prompt: "Fix the PR body's `## Objectives` section, or have a principal apply the `vinaya/waiver:review` label, then re-run `vinaya check review-gate`."
|
|
6717
|
-
});
|
|
6718
|
-
process.exit(1);
|
|
6919
|
+
return failure(`review-gate severity:infra — this PR body's own \`## Objectives\` section does not parse (${own.errors.join("; ")}) — cannot verify the objectives-version binding.`, "Fix the PR body's `## Objectives` section, or have a principal apply the `vinaya/waiver:review` label, then re-run `vinaya check review-gate`.");
|
|
6719
6920
|
}
|
|
6720
|
-
return objectivesVersion(own.objectives);
|
|
6921
|
+
return { ok: true, value: objectivesVersion(own.objectives) };
|
|
6721
6922
|
}
|
|
6722
6923
|
function shaFromLsRemote(branch) {
|
|
6723
6924
|
try {
|
|
@@ -6753,60 +6954,34 @@ function resolveTrueHeadSha(pr) {
|
|
|
6753
6954
|
}
|
|
6754
6955
|
return trueSha;
|
|
6755
6956
|
}
|
|
6756
|
-
function fetchWaiverLabelActor(prNumber,
|
|
6957
|
+
function fetchWaiverLabelActor(prNumber, label) {
|
|
6757
6958
|
try {
|
|
6758
6959
|
const out = execFileSync4("gh", ["api", `repos/{owner}/{repo}/issues/${prNumber}/timeline`, "--paginate"], {
|
|
6759
6960
|
encoding: "utf8",
|
|
6760
6961
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6761
6962
|
});
|
|
6762
6963
|
const events = JSON.parse(out);
|
|
6763
|
-
const matches = events.filter((e) => e.event === "labeled" && e.label?.name ===
|
|
6964
|
+
const matches = events.filter((e) => e.event === "labeled" && e.label?.name === label);
|
|
6764
6965
|
const last = matches[matches.length - 1];
|
|
6765
6966
|
return last?.actor?.login ?? null;
|
|
6766
6967
|
} catch {
|
|
6767
6968
|
return null;
|
|
6768
6969
|
}
|
|
6769
6970
|
}
|
|
6770
|
-
function
|
|
6771
|
-
const prNumberStr = process.env.PR_NUMBER;
|
|
6772
|
-
if (!prNumberStr) {
|
|
6773
|
-
process.exit(0);
|
|
6774
|
-
}
|
|
6775
|
-
const prNumber = Number(prNumberStr);
|
|
6971
|
+
function assembleReviewGateInput(prNumber) {
|
|
6776
6972
|
const pr = fetchPr(prNumber);
|
|
6777
6973
|
if (!pr) {
|
|
6778
|
-
|
|
6779
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6780
|
-
check: CHECK_NAME,
|
|
6781
|
-
severity: "error",
|
|
6782
|
-
message: `review-gate severity:infra — could not fetch PR #${prNumber} via \`gh\`.`,
|
|
6783
|
-
agent_recovery_prompt: "Confirm `gh auth status` passes and PR_NUMBER is correct, then re-run `vinaya check review-gate`."
|
|
6784
|
-
});
|
|
6785
|
-
process.exit(1);
|
|
6974
|
+
return failure(`review-gate severity:infra — could not fetch PR #${prNumber} via \`gh\`.`, "Confirm `gh auth status` passes and PR_NUMBER is correct, then re-run `vinaya check review-gate`.");
|
|
6786
6975
|
}
|
|
6787
6976
|
const labels = pr.labels.map((l) => l.name);
|
|
6788
6977
|
const waiverLabelActor = labels.includes(WAIVER_LABEL_REVIEW) ? fetchWaiverLabelActor(prNumber, WAIVER_LABEL_REVIEW) : null;
|
|
6789
6978
|
const headSha = resolveTrueHeadSha(pr);
|
|
6790
6979
|
if (!headSha) {
|
|
6791
|
-
|
|
6792
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6793
|
-
check: CHECK_NAME,
|
|
6794
|
-
severity: "error",
|
|
6795
|
-
message: `review-gate severity:infra — could not resolve PR #${prNumber}'s true head via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`,
|
|
6796
|
-
agent_recovery_prompt: "Confirm the branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`."
|
|
6797
|
-
});
|
|
6798
|
-
process.exit(1);
|
|
6980
|
+
return failure(`review-gate severity:infra — could not resolve PR #${prNumber}'s true head via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`, "Confirm the branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`.");
|
|
6799
6981
|
}
|
|
6800
6982
|
const baseSha = resolveBaseSha(pr);
|
|
6801
6983
|
if (!baseSha) {
|
|
6802
|
-
|
|
6803
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6804
|
-
check: CHECK_NAME,
|
|
6805
|
-
severity: "error",
|
|
6806
|
-
message: `review-gate severity:infra — could not resolve PR #${prNumber}'s base branch \`${pr.baseRefName}\`'s tip via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`,
|
|
6807
|
-
agent_recovery_prompt: "Confirm the base branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`."
|
|
6808
|
-
});
|
|
6809
|
-
process.exit(1);
|
|
6984
|
+
return failure(`review-gate severity:infra — could not resolve PR #${prNumber}'s base branch \`${pr.baseRefName}\`'s tip via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`, "Confirm the base branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`.");
|
|
6810
6985
|
}
|
|
6811
6986
|
const trustAnchorConfig = loadTrustAnchorConfig();
|
|
6812
6987
|
const principalAllowlist = resolvePrincipalAllowlist(trustAnchorConfig);
|
|
@@ -6814,14 +6989,7 @@ function main() {
|
|
|
6814
6989
|
try {
|
|
6815
6990
|
reviewPolicy = resolveReviewPolicy(trustAnchorConfig);
|
|
6816
6991
|
} catch (err) {
|
|
6817
|
-
|
|
6818
|
-
schema: CHECK_SCHEMA_VERSION,
|
|
6819
|
-
check: CHECK_NAME,
|
|
6820
|
-
severity: "error",
|
|
6821
|
-
message: `review-gate severity:infra — ${err instanceof Error ? err.message : String(err)}`,
|
|
6822
|
-
agent_recovery_prompt: "Fix `reviewPolicy` in the default branch's `vinaya.config.json` to a known severity on each role's own scale, then re-run `vinaya check review-gate`."
|
|
6823
|
-
});
|
|
6824
|
-
process.exit(1);
|
|
6992
|
+
return failure(`review-gate severity:infra — ${err instanceof Error ? err.message : String(err)}`, "Fix `reviewPolicy` in the default branch's `vinaya.config.json` to a known severity on each role's own scale, then re-run `vinaya check review-gate`.");
|
|
6825
6993
|
}
|
|
6826
6994
|
const waived = isWaiverLabelActorVerified({
|
|
6827
6995
|
label: WAIVER_LABEL_REVIEW,
|
|
@@ -6829,19 +6997,51 @@ function main() {
|
|
|
6829
6997
|
labelActor: waiverLabelActor,
|
|
6830
6998
|
principalAllowlist
|
|
6831
6999
|
});
|
|
6832
|
-
const
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
7000
|
+
const comments = pr.comments.map((c) => ({ body: c.body, author: c.author?.login ?? null }));
|
|
7001
|
+
const resolvedObjectivesVersion = waived ? { ok: true, value: null } : resolveObjectivesVersion(pr);
|
|
7002
|
+
if (!resolvedObjectivesVersion.ok)
|
|
7003
|
+
return resolvedObjectivesVersion;
|
|
7004
|
+
const resolvedBriefHash = waived ? { ok: true, value: null } : resolveBriefHash(pr, principalAllowlist);
|
|
7005
|
+
if (!resolvedBriefHash.ok)
|
|
7006
|
+
return resolvedBriefHash;
|
|
7007
|
+
return {
|
|
7008
|
+
ok: true,
|
|
7009
|
+
input: {
|
|
7010
|
+
comments,
|
|
7011
|
+
labels,
|
|
7012
|
+
waiverLabelActor,
|
|
7013
|
+
principalAllowlist,
|
|
7014
|
+
headSha,
|
|
7015
|
+
patchIdOf: (sha) => patchIdAt(pr.baseRefName, sha),
|
|
7016
|
+
baseSha,
|
|
7017
|
+
objectivesVersion: resolvedObjectivesVersion.value,
|
|
7018
|
+
rulingOrdinal: newestPrincipalRulingOrdinal(comments, principalAllowlist),
|
|
7019
|
+
policy: reviewPolicy,
|
|
7020
|
+
briefHash: resolvedBriefHash.value
|
|
7021
|
+
}
|
|
7022
|
+
};
|
|
7023
|
+
}
|
|
7024
|
+
|
|
7025
|
+
// src/checks/bin/check-review-gate.ts
|
|
7026
|
+
var CHECK_NAME = "review-gate";
|
|
7027
|
+
function main() {
|
|
7028
|
+
const prNumberStr = process.env.PR_NUMBER;
|
|
7029
|
+
if (!prNumberStr) {
|
|
7030
|
+
process.exit(0);
|
|
7031
|
+
}
|
|
7032
|
+
const prNumber = Number(prNumberStr);
|
|
7033
|
+
const assembly = assembleReviewGateInput(prNumber);
|
|
7034
|
+
if (!assembly.ok) {
|
|
7035
|
+
emitCheckError({
|
|
7036
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
7037
|
+
check: CHECK_NAME,
|
|
7038
|
+
severity: "error",
|
|
7039
|
+
message: assembly.failure.message,
|
|
7040
|
+
agent_recovery_prompt: assembly.failure.agentRecoveryPrompt
|
|
7041
|
+
});
|
|
7042
|
+
process.exit(1);
|
|
7043
|
+
}
|
|
7044
|
+
const result = checkReviewGate(assembly.input);
|
|
6845
7045
|
if (result.verdict === "fail") {
|
|
6846
7046
|
emitCheckError({
|
|
6847
7047
|
schema: CHECK_SCHEMA_VERSION,
|