@attalabs/vinaya 0.32.0 → 0.34.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 +1 -1
- package/aeg-root/contracts/principal-operator.md +18 -5
- package/aeg-root/enforcement.md +1 -1
- package/aeg-root/glossary.md +4 -0
- package/aeg-root/roles/developer.md +3 -0
- package/aeg-root/roles/operator.md +89 -16
- package/aeg-root/roles/planner/reference.md +3 -2
- package/aeg-root/roles/planner.md +3 -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/brief-template.md +9 -7
- package/aeg-root/templates/pr-report-template.md +3 -1
- package/dist/checks/bin/check-body-bare-digits.js +213 -41
- package/dist/checks/bin/check-branch-topology.js +164 -41
- package/dist/checks/bin/check-brief-shape.js +219 -46
- package/dist/checks/bin/check-changeset-coverage.js +669 -152
- package/dist/checks/bin/check-closes-n.js +164 -41
- package/dist/checks/bin/check-coherence.js +220 -43
- package/dist/checks/bin/check-dead-branch-push.js +159 -40
- package/dist/checks/bin/check-dispatch-readiness.js +218 -42
- package/dist/checks/bin/check-doc-coverage-push.js +665 -148
- package/dist/checks/bin/check-doc-coverage.js +667 -150
- package/dist/checks/bin/check-doctrine-no-procedures.js +213 -41
- package/dist/checks/bin/check-doctrine-portability.js +666 -149
- package/dist/checks/bin/check-evidence-fresh.js +643 -125
- package/dist/checks/bin/check-exec-bits.js +663 -146
- package/dist/checks/bin/check-first-push-dispatch.js +218 -42
- package/dist/checks/bin/check-issue-assignment.js +164 -41
- package/dist/checks/bin/check-issue-milestone-attach.js +159 -40
- package/dist/checks/bin/check-issue-objectives-numbering.js +685 -41
- package/dist/checks/bin/check-issue-parts-coverage.js +159 -40
- package/dist/checks/bin/check-issue-surface-globs.js +258 -48
- package/dist/checks/bin/check-issue-title-grammar.js +159 -40
- package/dist/checks/bin/check-issue-tranche-label.js +159 -40
- package/dist/checks/bin/check-main-branch-refusal.js +159 -40
- package/dist/checks/bin/check-no-disk-state.js +159 -40
- package/dist/checks/bin/check-pr-premise-reassert.js +213 -41
- package/dist/checks/bin/check-pr-report-density.js +159 -40
- package/dist/checks/bin/check-principal-test-plan-wait.js +159 -40
- package/dist/checks/bin/check-quoted-command.js +586 -103
- package/dist/checks/bin/check-reader-resolvable-prose.js +637 -111
- package/dist/checks/bin/check-registry-gates.js +159 -40
- package/dist/checks/bin/check-retired-vocabulary.js +586 -103
- package/dist/checks/bin/check-review-gate.js +284 -152
- package/dist/checks/bin/check-single-plan-pr.js +159 -40
- package/dist/checks/bin/check-surface-scope.js +164 -41
- package/dist/checks/bin/check-test-plan.js +159 -40
- package/dist/checks/bin/check-token-collection-wired.js +159 -40
- package/dist/checks/bin/check-token-report.js +159 -40
- package/dist/checks/bin/check-workspace-escape.js +664 -147
- package/dist/index.js +3932 -1118
- package/dist/lib/pre-push-cache-test-run.js +507 -72
- package/dist/lib/pre-push-select-tests.js +136 -13
- package/package.json +1 -1
- 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 +222 -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 +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +219 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +97 -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 +425 -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 +254 -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 +208 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +80 -28
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +92 -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-phase-history.ts +194 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +712 -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 +368 -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]__0r7e54g._.js → [root-of-the-server]__07uhu5z._.js} +1 -1
- 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]__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/0ko698wh8xx2g.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 0q9p7c6vn-x2w.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 2174nz5he_oc4.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3xnma0-359j17.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/0bm4nrrzwc7zi.css +0 -1
- 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/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The round journal is the task's, not the driver's — and it is rebuilt from
|
|
3
|
+
* the control store and the forge's own principal-authored markers, NEVER
|
|
4
|
+
* from a log event. The Vinaya Log is fail-open telemetry: it "is never the
|
|
5
|
+
* authority for dispatch, approval, publication or recovery" (Log tech spec,
|
|
6
|
+
* §1), so no reconstruction here reads a `dev_review_loop` event, a flushed
|
|
7
|
+
* log comment, or the telemetry outbox. This closes the dependency the Log
|
|
8
|
+
* spec forbade before the log destination moves off the tracker — a rebuild
|
|
9
|
+
* that replayed the loop's own flushed log events would break the moment
|
|
10
|
+
* those events stopped going to the tracker.
|
|
11
|
+
*
|
|
12
|
+
* This module is the PURE half of the rebuild: given the round numbers the
|
|
13
|
+
* forge's own principal-authored developer round markers carry, whether a
|
|
14
|
+
* ready-for-merge summary was actually published to the forge, and the review
|
|
15
|
+
* gate's verdict on the pull request's current state, hand back one
|
|
16
|
+
* `RoundRecord` per round plus where the next round should start numbering.
|
|
17
|
+
* The impure caller (`journal-history.ts`, `@attalabs/vinaya`) gathers those
|
|
18
|
+
* facts: it reads the pull request's principal-authored comments and evaluates
|
|
19
|
+
* the gate, never a log line. Nothing here performs a forge read or a gate
|
|
20
|
+
* evaluation of its own — the gate's verdict arrives as an input fact, which is
|
|
21
|
+
* what keeps this half pure and testable in every combination. The control
|
|
22
|
+
* store's own authoritative round is recovered separately by the driver
|
|
23
|
+
* (`recoverLoopState`), and is deliberately NOT folded into the numbering here
|
|
24
|
+
* — see `reconstructRounds`.
|
|
25
|
+
*
|
|
26
|
+
* Honest about what the forge markers carry: a developer round marker
|
|
27
|
+
* (`<!-- aeg:developer:round-<n> -->`) names only the round's own number and
|
|
28
|
+
* head — never a per-severity finding breakdown, a confidence value, or the
|
|
29
|
+
* round's wall time / files changed. Those had a source only in the log
|
|
30
|
+
* events this rebuild no longer reads, so a reconstructed round carries an
|
|
31
|
+
* empty `countsBySeverity`, a `null` confidence, and the totals read `0`
|
|
32
|
+
* (O3: "the summary says it is unavailable for that round" rather than a
|
|
33
|
+
* fabricated number). What the markers DO carry — the round's own existence
|
|
34
|
+
* and number, and whether the run reached a published summary — is exactly
|
|
35
|
+
* what the numbering and the "already published?" decision need.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { SEVERITY_COLUMNS, type RoundRecord } from './types'
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The published summary's own header row, byte-for-byte as `render-summary.ts`
|
|
42
|
+
* emits it — both derived from `SEVERITY_COLUMNS`, so the detector here and
|
|
43
|
+
* the renderer there can never drift about what a summary comment looks like.
|
|
44
|
+
* A principal-authored comment carrying this line is the ready-for-merge
|
|
45
|
+
* summary itself: the one honest "the summary was actually published" signal,
|
|
46
|
+
* distinct from a round merely deciding `publish` (the control store's own
|
|
47
|
+
* `loop_state.phase === 'publish'` is written before `publishRound` runs, so
|
|
48
|
+
* it can never stand in for this).
|
|
49
|
+
*/
|
|
50
|
+
export const SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(' | ')} | confidence | outcome |`
|
|
51
|
+
|
|
52
|
+
/** True when `body` is (or contains, verbatim on its own line) the published summary's header — the caller has already confirmed the comment is principal-authored. */
|
|
53
|
+
export function isPublishedSummaryComment(body: string): boolean {
|
|
54
|
+
return body.split('\n').some((line) => line.trim() === SUMMARY_TABLE_HEADER)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The forge-derived facts a rebuild is handed. `roundMarkers` are the round
|
|
59
|
+
* numbers read off every principal-authored developer round marker on the
|
|
60
|
+
* pull request (order and duplicates irrelevant — deduplicated here).
|
|
61
|
+
* `summaryPublished` is whether a principal-authored summary comment exists,
|
|
62
|
+
* and `summaryUrl` is that comment's own address when one does.
|
|
63
|
+
* `reviewGate` is the review gate's verdict on the pull request's CURRENT
|
|
64
|
+
* state.
|
|
65
|
+
*/
|
|
66
|
+
export type ReconstructionInput = {
|
|
67
|
+
roundMarkers: readonly number[]
|
|
68
|
+
summaryPublished: boolean
|
|
69
|
+
/** The published summary comment's own url, or `null` when none is on the forge (or the caller could not resolve one). */
|
|
70
|
+
summaryUrl?: string | null
|
|
71
|
+
/**
|
|
72
|
+
* The review gate's verdict on the pull request's CURRENT head, objectives
|
|
73
|
+
* version, newest ruling, frozen brief and policy — the second half of
|
|
74
|
+
* "concluded" (see `journalFinalized`). The caller evaluates it
|
|
75
|
+
* (`checkReviewGate`; nothing here ever reads the forge) and hands the
|
|
76
|
+
* answer in.
|
|
77
|
+
*/
|
|
78
|
+
reviewGate: ReviewGateFact
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* What the caller could learn about the review gate.
|
|
83
|
+
*
|
|
84
|
+
* - `'pass'`/`'fail'` — the gate genuinely evaluated, against the pull
|
|
85
|
+
* request's current state.
|
|
86
|
+
* - `'unknown'` — nobody asked (no summary is on the forge, so the answer
|
|
87
|
+
* could not change the outcome), or the evaluation could not be made at all
|
|
88
|
+
* (a failed forge read, an unresolvable head, a thrown evaluation).
|
|
89
|
+
*
|
|
90
|
+
* `'unknown'` deliberately does NOT reopen a published review: it is the
|
|
91
|
+
* absence of evidence, not evidence the review moved on, and the two failure
|
|
92
|
+
* directions are not symmetric. Reading it as "reopened" makes one transient
|
|
93
|
+
* `gh` hiccup dispatch a whole extra review round against a task that was
|
|
94
|
+
* genuinely finished, and post its comments — the "a rerun posts nothing
|
|
95
|
+
* twice" invariant, lost for a fact nobody could check. Reading it as "no new
|
|
96
|
+
* information" costs at most one refusal that names the unevaluable gate
|
|
97
|
+
* (`concludedLoopRefusal`) and clears itself on the next attempt. The merge
|
|
98
|
+
* gate is unaffected either way: the `review-gate` check fails CLOSED on every
|
|
99
|
+
* one of these same unresolvable facts, so nothing merges on an unknown here.
|
|
100
|
+
*/
|
|
101
|
+
export type ReviewGateFact = 'pass' | 'fail' | 'unknown'
|
|
102
|
+
|
|
103
|
+
export type ReconstructedJournal = {
|
|
104
|
+
rounds: RoundRecord[]
|
|
105
|
+
/** Deliberately `0`: per-round wall time has no control-record or forge source, so it is reported unavailable rather than a fabricated sum (O3). */
|
|
106
|
+
totalWallMs: number
|
|
107
|
+
/** Deliberately `0`: per-round files-changed has no control-record or forge source, so it is reported unavailable rather than a fabricated sum (O3). */
|
|
108
|
+
totalFilesChanged: number
|
|
109
|
+
/** The published summary comment's own url, or `null` when no summary is on the forge (or the caller could not resolve one). Carried even when the gate is red, so a refusal can name where the summary was posted. */
|
|
110
|
+
summaryUrl: string | null
|
|
111
|
+
/** The gate verdict this journal was reconstructed against, carried so a refusal can say the gate could not be evaluated rather than implying it passed. */
|
|
112
|
+
reviewGate: ReviewGateFact
|
|
113
|
+
/**
|
|
114
|
+
* `{ result: 'merged_ready' }` while a principal-authored ready-for-merge
|
|
115
|
+
* summary comment is actually on the forge AND the review gate has not
|
|
116
|
+
* FAILED against the pull request's CURRENT state (`ReviewGateFact`, whose
|
|
117
|
+
* own doc explains why an `'unknown'` gate is not a reopen). Concluded is a
|
|
118
|
+
* property of the pull request now, not a one-way latch it once passed
|
|
119
|
+
* through.
|
|
120
|
+
*
|
|
121
|
+
* The summary alone was the old signal, and it is sticky in a way the forge
|
|
122
|
+
* is not: the summary table records no head, so a summary posted for an
|
|
123
|
+
* older head keeps reading "done forever" after a red gate, a newer
|
|
124
|
+
* Principal ruling, a superseded brief or a moved head — observed on an
|
|
125
|
+
* adopter pull request whose every `--resume` was refused while the gate was
|
|
126
|
+
* red and a ruling sat unaddressed. The gate is the one evaluation already
|
|
127
|
+
* bound to all of those, so asking it about the current state is what makes
|
|
128
|
+
* this reopen when any of them moves.
|
|
129
|
+
*
|
|
130
|
+
* A round that decided `publish` but crashed before the summary landed (a
|
|
131
|
+
* `gh` failure mid-publish) still leaves NO summary comment, so this still
|
|
132
|
+
* reads `null` and no caller mistakes that crash for a completion — the
|
|
133
|
+
* distinction the old log-derived `journal_finalized` deferral drew is
|
|
134
|
+
* unchanged, now with a second condition in front of it. Consumers test this
|
|
135
|
+
* through `isConcludedJournal` below; `'stopped'` is retained in the type
|
|
136
|
+
* for parity with the shape this replaces but is never produced here.
|
|
137
|
+
*/
|
|
138
|
+
journalFinalized: { result: 'merged_ready' | 'stopped' } | null
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* One `RoundRecord` per distinct developer round marker found on the forge,
|
|
143
|
+
* sorted ascending. Deliberately marker-derived ONLY: the control store's own
|
|
144
|
+
* `loop_state.round` is the driver's authoritative current round and is
|
|
145
|
+
* clamped in separately by `recoverLoopState` (`dev-review-loop.ts`'s round
|
|
146
|
+
* bump), NEVER folded into the numbering here. Were it folded in, an attach
|
|
147
|
+
* whose control store records an in-flight round `k` (its markers not yet on
|
|
148
|
+
* the forge) would reconstruct `k` rounds and bump the next round to `k+1`,
|
|
149
|
+
* skipping the very round the control store says is still running — the
|
|
150
|
+
* "recovers from the control store alone" fixture proves round `k` must be
|
|
151
|
+
* kept, so this function must not carry it past `nextRoundNumber`.
|
|
152
|
+
*
|
|
153
|
+
* `countsBySeverity`/`confidence` are unavailable from a marker (O3): empty and
|
|
154
|
+
* `null`, never a guessed count. `outcome` is `'changes_requested'` — the
|
|
155
|
+
* loop only posts a later round's marker after the prior round concluded
|
|
156
|
+
* changes-requested and re-dispatched the developer, so every reconstructed
|
|
157
|
+
* round is one the loop moved past; the published/green round is the live
|
|
158
|
+
* run's own computed record, never one rebuilt here.
|
|
159
|
+
*/
|
|
160
|
+
export function reconstructRounds(input: ReconstructionInput): ReconstructedJournal {
|
|
161
|
+
const distinct = [...new Set(input.roundMarkers)].sort((a, b) => a - b)
|
|
162
|
+
const rounds: RoundRecord[] = distinct.map((round) => ({
|
|
163
|
+
round,
|
|
164
|
+
countsBySeverity: {},
|
|
165
|
+
confidence: null,
|
|
166
|
+
outcome: 'changes_requested'
|
|
167
|
+
}))
|
|
168
|
+
const concluded = input.summaryPublished && input.reviewGate !== 'fail'
|
|
169
|
+
return {
|
|
170
|
+
rounds,
|
|
171
|
+
totalWallMs: 0,
|
|
172
|
+
totalFilesChanged: 0,
|
|
173
|
+
summaryUrl: input.summaryUrl ?? null,
|
|
174
|
+
reviewGate: input.reviewGate,
|
|
175
|
+
journalFinalized: concluded ? { result: 'merged_ready' } : null
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The ONE predicate every reader of "is this task's review concluded?" calls
|
|
181
|
+
* — the `--resume` replayed-resolution refusal, the attach's round-history
|
|
182
|
+
* seeding, and the held-clean carry path's "already published?" check alike.
|
|
183
|
+
* A second hand-written `=== 'merged_ready'` test at any of those sites is how
|
|
184
|
+
* they drifted apart before: two of them treated a posted summary as final
|
|
185
|
+
* while the pull request's own gate said otherwise.
|
|
186
|
+
*/
|
|
187
|
+
export function isConcludedJournal(journal: ReconstructedJournal): boolean {
|
|
188
|
+
return journal.journalFinalized?.result === 'merged_ready'
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The refusal text for a resume against a genuinely concluded review — `null`
|
|
193
|
+
* when the journal is not concluded, so a caller reads "no refusal owed" from
|
|
194
|
+
* the same call that renders one. Names the round the summary concluded at and
|
|
195
|
+
* where that summary is, rather than the storage layer's own
|
|
196
|
+
* consumed-resolution wording, which describes a mechanism the reader did not
|
|
197
|
+
* ask about and hid the real reason the loop would not continue.
|
|
198
|
+
*
|
|
199
|
+
* Degrades rather than inventing: a journal with no round markers at all (a
|
|
200
|
+
* summary posted on a pull request whose round comments were deleted) names no
|
|
201
|
+
* round, an unresolvable summary url says so, and a gate that could not be
|
|
202
|
+
* evaluated at all is named as such rather than left to read as though the gate
|
|
203
|
+
* had been asked and passed.
|
|
204
|
+
*/
|
|
205
|
+
export function concludedLoopRefusal(journal: ReconstructedJournal): string | null {
|
|
206
|
+
if (!isConcludedJournal(journal)) return null
|
|
207
|
+
const newest = journal.rounds[journal.rounds.length - 1]
|
|
208
|
+
const at = newest === undefined ? '' : ` at round ${newest.round}`
|
|
209
|
+
const where =
|
|
210
|
+
journal.summaryUrl === null ? 'summary posted, comment url unavailable' : `summary posted ${journal.summaryUrl}`
|
|
211
|
+
const gateNote = journal.reviewGate === 'unknown' ? '; review gate could not be evaluated' : ''
|
|
212
|
+
return `loop already concluded${at} (${where}${gateNote})`
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Where a fresh round should start numbering after reconstruction — `1` when there is no prior history at all. */
|
|
216
|
+
export function nextRoundNumber(rounds: readonly RoundRecord[]): number {
|
|
217
|
+
if (rounds.length === 0) return 1
|
|
218
|
+
return Math.max(...rounds.map((r) => r.round)) + 1
|
|
219
|
+
}
|
package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `renderSummary(journal)` — the publication comment. One markdown table, rows per round, counts and the
|
|
3
|
+
* outcome only — no finding prose, and no line either verdict extractor
|
|
4
|
+
* (`../verdict-extraction`) would read as a real verdict: no `VERDICT:`,
|
|
5
|
+
* `Judged head:`, or `Objectives version:` label anywhere in the output.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { SUMMARY_TABLE_HEADER } from './journal-reconstruction'
|
|
9
|
+
import { SEVERITY_COLUMNS, type Confidence, type Journal, type RoundRecord } from './types'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The two non-numeric cells this table writes, named once so the parser below
|
|
13
|
+
* reads the same literals the renderer wrote. They are DIFFERENT facts: the
|
|
14
|
+
* loop never asked this round for a confidence at all (round 1 never is), or
|
|
15
|
+
* it asked and the developer stated nothing readable.
|
|
16
|
+
*/
|
|
17
|
+
export const CONFIDENCE_NOT_ASKED_CELL = '—'
|
|
18
|
+
export const CONFIDENCE_ABSENT_CELL = 'absent'
|
|
19
|
+
|
|
20
|
+
/** The highest percentage this table ever records — the same ceiling `CONFIDENCE_LINE`'s own `0-100` grammar accepts, named here because the parser below refuses a row that exceeds it. */
|
|
21
|
+
export const CONFIDENCE_MAX_PERCENT = 100
|
|
22
|
+
|
|
23
|
+
function confidenceCell(confidence: Confidence | null): string {
|
|
24
|
+
if (confidence === null) return CONFIDENCE_NOT_ASKED_CELL
|
|
25
|
+
if (confidence === 'absent') return CONFIDENCE_ABSENT_CELL
|
|
26
|
+
return `${confidence.value}%`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function row(record: RoundRecord): string {
|
|
30
|
+
const counts = SEVERITY_COLUMNS.map((key) => String(record.countsBySeverity[key] ?? 0))
|
|
31
|
+
return `| ${record.round} | ${counts.join(' | ')} | ${confidenceCell(record.confidence)} | ${record.outcome} |`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function renderSummary(journal: Journal): string {
|
|
35
|
+
const header = SUMMARY_TABLE_HEADER
|
|
36
|
+
const divider = `| --- | ${SEVERITY_COLUMNS.map(() => '---').join(' | ')} | --- | --- |`
|
|
37
|
+
const rows = journal.rounds.map(row)
|
|
38
|
+
return [header, divider, ...rows].join('\n')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* One round's confidence as this table records it, in three distinguishable
|
|
43
|
+
* states rather than two:
|
|
44
|
+
*
|
|
45
|
+
* - `asked: true` with a `percent` — the developer stated that figure;
|
|
46
|
+
* - `asked: true`, `percent: null` — the round WAS asked and the statement
|
|
47
|
+
* was missing or unreadable (the table's own `absent` cell);
|
|
48
|
+
* - `asked: false`, `percent: null` — the loop never asked this round at all
|
|
49
|
+
* (its `—` cell; round 1 is never asked), so the round has no confidence
|
|
50
|
+
* to report and a reader must not be told the developer skipped one.
|
|
51
|
+
*/
|
|
52
|
+
export type SummaryConfidenceRow = { round: number; percent: number | null; asked: boolean }
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The inverse of `row` above — the confidence column read back out of a
|
|
56
|
+
* posted summary table. Kept here, beside the renderer, so the column's
|
|
57
|
+
* position is written down once: a reader elsewhere would have to hand-copy
|
|
58
|
+
* the table's shape and would drift the first time a column moved.
|
|
59
|
+
*
|
|
60
|
+
* Only rows this renderer could have produced are read: a leading round
|
|
61
|
+
* number, then one cell per severity column, then the confidence cell, then
|
|
62
|
+
* the outcome. Anything else in the comment — prose above or below the table,
|
|
63
|
+
* a differently-shaped table — yields no row at all rather than a guess.
|
|
64
|
+
*
|
|
65
|
+
* This function is the boundary between pull-request comment text (which
|
|
66
|
+
* anybody with write access to a fork's branch can shape) and the confidence
|
|
67
|
+
* figure a tool result publishes, so the percentage is bounded HERE: a cell
|
|
68
|
+
* claiming more than `CONFIDENCE_MAX_PERCENT` is dropped rather than carried
|
|
69
|
+
* out of range into a caller that declares `0-100`.
|
|
70
|
+
*/
|
|
71
|
+
export function parseSummaryConfidenceRows(body: string): SummaryConfidenceRow[] {
|
|
72
|
+
const cellCount = SEVERITY_COLUMNS.length + 3
|
|
73
|
+
const rows: SummaryConfidenceRow[] = []
|
|
74
|
+
for (const line of body.split('\n')) {
|
|
75
|
+
const trimmed = line.trim()
|
|
76
|
+
if (!trimmed.startsWith('|') || !trimmed.endsWith('|')) continue
|
|
77
|
+
const cells = trimmed.slice(1, -1).split('|')
|
|
78
|
+
if (cells.length !== cellCount) continue
|
|
79
|
+
const round = Number((cells[0] as string).trim())
|
|
80
|
+
if (!Number.isInteger(round) || round <= 0) continue
|
|
81
|
+
const confidenceCellText = (cells[cellCount - 2] as string).trim()
|
|
82
|
+
if (confidenceCellText === CONFIDENCE_NOT_ASKED_CELL) {
|
|
83
|
+
rows.push({ round, percent: null, asked: false })
|
|
84
|
+
continue
|
|
85
|
+
}
|
|
86
|
+
if (confidenceCellText === CONFIDENCE_ABSENT_CELL) {
|
|
87
|
+
rows.push({ round, percent: null, asked: true })
|
|
88
|
+
continue
|
|
89
|
+
}
|
|
90
|
+
const percentMatch = /^(\d{1,3})%$/.exec(confidenceCellText)
|
|
91
|
+
if (!percentMatch) continue
|
|
92
|
+
const percent = Number(percentMatch[1])
|
|
93
|
+
if (percent > CONFIDENCE_MAX_PERCENT) continue
|
|
94
|
+
rows.push({ round, percent, asked: true })
|
|
95
|
+
}
|
|
96
|
+
return rows
|
|
97
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dev-review-loop's own types — the
|
|
3
|
+
* policy half of the loop spec (Linear "Tech spec — Developer Review Loop",
|
|
4
|
+
* rev 4, §16). Pure — no `fs`, no `fetch`, no `process.env`, no vendor name,
|
|
5
|
+
* no prompt anywhere in this directory.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { DevReviewLoopEvent } from '../log'
|
|
9
|
+
|
|
10
|
+
type Envelope = { meta: unknown; subject: unknown }
|
|
11
|
+
/**
|
|
12
|
+
* The same shape `apps/cli/src/lib/log-sink.ts`'s `LogEventInput` derives
|
|
13
|
+
* from `LogEvent` — mirrored here, scoped to `DevReviewLoopEvent` only,
|
|
14
|
+
* because this package can never import from `apps/cli` (the surface runs
|
|
15
|
+
* one way). `assessRound`'s caller (the driver) passes each returned event
|
|
16
|
+
* straight to the injected `log()`, which fills `meta`/`subject` itself.
|
|
17
|
+
*/
|
|
18
|
+
type StripEnvelope<T> = T extends Envelope ? Omit<T, 'meta' | 'subject'> : never
|
|
19
|
+
export type DevReviewLoopEventInput = StripEnvelope<DevReviewLoopEvent>
|
|
20
|
+
|
|
21
|
+
/** O4's fixed column order — shared by `assess-round.ts` (counting) and `render-summary.ts` (rendering) so the two never drift apart. */
|
|
22
|
+
export const SEVERITY_COLUMNS = ['blocker', 'major', 'minor', 'critical', 'high', 'medium', 'low'] as const
|
|
23
|
+
|
|
24
|
+
/** The built form's finding identity (spec §0 item 1) — no fingerprint hashing. */
|
|
25
|
+
export type FindingState = 'open' | 'fix-claimed' | 'reproduced' | 'resolved' | null
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The optional fields mirror
|
|
29
|
+
* `ReviewFindingSchema` (`log/schema.ts`) field-for-field — `severityScale`
|
|
30
|
+
* names which scale `severity` is read against (a free string: this
|
|
31
|
+
* doctrine already has a code-review scale and a security scale, and a
|
|
32
|
+
* third reviewer type should never need a schema change to name its own);
|
|
33
|
+
* `policyTreatment` is a SEPARATE fact from `severity` — the same reported
|
|
34
|
+
* severity can bind or not bind a verdict depending on the effective policy
|
|
35
|
+
* threshold and the body-located-prose cap, so the two are never conflated
|
|
36
|
+
* here either; `confidence`/`confidenceScale`/`confidenceSource` are
|
|
37
|
+
* optional and self-reported, left unset rather than fabricated wherever no
|
|
38
|
+
* reviewer grammar produces one yet.
|
|
39
|
+
*/
|
|
40
|
+
export type FindingObservation = {
|
|
41
|
+
id: string
|
|
42
|
+
severity: string
|
|
43
|
+
state: FindingState
|
|
44
|
+
severityScale?: string
|
|
45
|
+
policyTreatment?: 'blocking' | 'non_blocking' | 'unavailable'
|
|
46
|
+
confidence?: number
|
|
47
|
+
confidenceScale?: string
|
|
48
|
+
confidenceSource?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type VerdictObservation = {
|
|
52
|
+
role: 'reviewer' | 'security'
|
|
53
|
+
verdict: 'APPROVE' | 'REQUEST CHANGES' | 'PASS' | 'FAIL' | 'ESCALATE'
|
|
54
|
+
objectives: { id: string; met: boolean }[]
|
|
55
|
+
findings: FindingObservation[]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** `spec §6.7`: required, but only ever recorded — never branches except by this task's Principal ruling (§2). */
|
|
59
|
+
export type Confidence = { value: number; reason?: string } | 'absent'
|
|
60
|
+
|
|
61
|
+
/** The round's own diff stats — computed by the driver (git, time), never by this pure module. */
|
|
62
|
+
export type RoundStats = {
|
|
63
|
+
baseHead: string
|
|
64
|
+
head: string
|
|
65
|
+
filesChanged: number
|
|
66
|
+
insertions: number
|
|
67
|
+
deletions: number
|
|
68
|
+
wallMs: number
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* One round is up to two `assessRound` calls: a `gate` observation (the
|
|
73
|
+
* mechanical check result for the round's new head, carrying the
|
|
74
|
+
* developer's confidence when round ≥ 2 requires one), then, only once the
|
|
75
|
+
* gate passes and confidence clears, a `verdicts` observation. A `gate`
|
|
76
|
+
* observation with `confidence: 'absent'` may repeat once, for the same
|
|
77
|
+
* round, before the loop pauses (spec §6.7's bounded re-ask).
|
|
78
|
+
*/
|
|
79
|
+
export type Observations =
|
|
80
|
+
| ({ kind: 'gate' } & { round: number; green: boolean; confidence?: Confidence; stats: RoundStats })
|
|
81
|
+
| ({ kind: 'verdicts' } & {
|
|
82
|
+
round: number
|
|
83
|
+
verdicts: VerdictObservation[]
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* `'infrastructure'`: a review
|
|
88
|
+
* role's work directory carried no `findings.txt`/`report.txt` (or, on a
|
|
89
|
+
* task with objectives, no `objectives.txt`) on two consecutive fresh
|
|
90
|
+
* dispatches — never a verdict, a mechanical-gate stall, or an escalation.
|
|
91
|
+
* The driver detects and retries this itself (it reads no verdict here at
|
|
92
|
+
* all); this member exists so the pause it falls back to on a second
|
|
93
|
+
* failure shares the same vocabulary and rendering path every other pause
|
|
94
|
+
* reason already uses, rather than a second, parallel pause shape.
|
|
95
|
+
*
|
|
96
|
+
* `'objectives_changed'`: the
|
|
97
|
+
* objectives version the driver resolved when it dispatched this round's
|
|
98
|
+
* reviewers no longer matches the version it resolves once their verdicts
|
|
99
|
+
* are back — a principal posted an objectives edit mid-round. Like
|
|
100
|
+
* `'infrastructure'`, the driver detects and decides this itself (comparing
|
|
101
|
+
* two resolutions it fetched is not something `assessRound` can do from an
|
|
102
|
+
* `Observations` value); this member exists so that pause shares the same
|
|
103
|
+
* vocabulary and rendering path every other pause reason already uses.
|
|
104
|
+
*
|
|
105
|
+
* `'ruling_posted'`: the newest
|
|
106
|
+
* principal ruling ordinal the driver resolved when it dispatched this
|
|
107
|
+
* round's reviewers no longer matches the ordinal it resolves once their
|
|
108
|
+
* verdicts are back — a principal posted a ruling mid-round. Same shape as
|
|
109
|
+
* `'objectives_changed'` in every respect: the driver detects and decides
|
|
110
|
+
* it itself, and this member exists only so the pause shares the same
|
|
111
|
+
* vocabulary and rendering path every other pause reason already uses.
|
|
112
|
+
*
|
|
113
|
+
* `'stale_driver'`: the base branch
|
|
114
|
+
* moved past a commit touching the driver's own code
|
|
115
|
+
* (`apps/cli/src/lib/dev-review-loop.ts`, `apps/cli/src/commands/
|
|
116
|
+
* review-post.ts`, or this package) since the loop started — same shape
|
|
117
|
+
* again: the driver compares its recorded start-of-loop base head against a
|
|
118
|
+
* freshly re-read one and decides this itself, so a running driver never
|
|
119
|
+
* publishes verdicts an updated gate would refuse.
|
|
120
|
+
*
|
|
121
|
+
* `'brief_superseded'`: the
|
|
122
|
+
* frozen brief's own hash the driver resolved when it dispatched this
|
|
123
|
+
* round's reviewers no longer matches the hash it resolves once their
|
|
124
|
+
* verdicts are back — a Planner superseded the frozen brief mid-round.
|
|
125
|
+
* Same shape as `'objectives_changed'`/`'ruling_posted'`: the driver
|
|
126
|
+
* detects and decides it itself (via the shared `compareManifest`, not a
|
|
127
|
+
* hand-rolled inequality), and this member exists only so the pause shares
|
|
128
|
+
* the same vocabulary and rendering path every other pause reason uses.
|
|
129
|
+
*
|
|
130
|
+
* `'policy_changed'`: the effective review policy's
|
|
131
|
+
* digest the driver resolved at dispatch time no longer matches the one it
|
|
132
|
+
* resolves once verdicts are back — same shape again. In practice a single
|
|
133
|
+
* loop run resolves its policy once and never re-reads it, so this branch
|
|
134
|
+
* is reachable only if a future change makes that re-read live; it exists
|
|
135
|
+
* now so the manifest's comparison is symmetric on every field, matching
|
|
136
|
+
* what the merge gate (which DOES re-resolve policy fresh on every run)
|
|
137
|
+
* already checks.
|
|
138
|
+
*
|
|
139
|
+
* `'no_push'`: a developer turn
|
|
140
|
+
* ended with a dirty worktree or local commits ahead of the remote, and no
|
|
141
|
+
* new head appeared on the branch even after one foreground resume asking
|
|
142
|
+
* it to commit and push. Same shape as the driver-decided reasons above:
|
|
143
|
+
* `devReviewLoop` detects and decides this itself (reading the worktree's
|
|
144
|
+
* own git status, not something `assessRound` can see from an
|
|
145
|
+
* `Observations` value) — it exists only so this pause shares the same
|
|
146
|
+
* vocabulary and rendering path every other pause reason already uses.
|
|
147
|
+
* `detail` is set for this reason too, naming the branch and the dirty
|
|
148
|
+
* file(s) observed.
|
|
149
|
+
*/
|
|
150
|
+
export type PauseReason =
|
|
151
|
+
| 'escalation'
|
|
152
|
+
| 'max_rounds'
|
|
153
|
+
| 'no_progress'
|
|
154
|
+
| 'confidence'
|
|
155
|
+
| 'reappearance'
|
|
156
|
+
| 'infrastructure'
|
|
157
|
+
| 'no_push'
|
|
158
|
+
| 'objectives_changed'
|
|
159
|
+
| 'ruling_posted'
|
|
160
|
+
| 'stale_driver'
|
|
161
|
+
| 'brief_superseded'
|
|
162
|
+
| 'policy_changed'
|
|
163
|
+
|
|
164
|
+
export type Decision =
|
|
165
|
+
| { type: 'dispatch_developer'; reason?: 'confidence' }
|
|
166
|
+
| { type: 'dispatch_reviewers' }
|
|
167
|
+
| { type: 'ask_confidence' }
|
|
168
|
+
| { type: 'publish' }
|
|
169
|
+
| {
|
|
170
|
+
type: 'pause'
|
|
171
|
+
reason: PauseReason
|
|
172
|
+
/** Set only for `'infrastructure'` — the role and missing artifact(s) the driver observed; every other reason omits it. */
|
|
173
|
+
detail?: string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The summary's own outcome vocabulary — wider than `round_ended`'s
|
|
178
|
+
* schema-constrained `green | changes_requested | escalated`: a round whose
|
|
179
|
+
* processing triggered one of the assessment exits (max_rounds, confidence,
|
|
180
|
+
* reappearance) records `'stopped'` here, even though the log
|
|
181
|
+
* event for that same round still reports `changes_requested` (the schema
|
|
182
|
+
* has no fifth value) — the journal, not the per-event log line, is where
|
|
183
|
+
* the loop's own verdict on that round belongs.
|
|
184
|
+
*/
|
|
185
|
+
export type RoundOutcome = 'green' | 'changes_requested' | 'escalated' | 'stopped'
|
|
186
|
+
|
|
187
|
+
/** One row of the published summary (`renderSummary`, O4) — counts only, no finding prose. */
|
|
188
|
+
export type RoundRecord = {
|
|
189
|
+
round: number
|
|
190
|
+
countsBySeverity: Record<string, number>
|
|
191
|
+
confidence: Confidence | null
|
|
192
|
+
outcome: RoundOutcome
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type Journal = { rounds: RoundRecord[] }
|
|
196
|
+
|
|
197
|
+
export type LoopConfig = {
|
|
198
|
+
/** Set once by the driver at loop start (`startLoop`, spec §16) — never generated here; this module has no random source. */
|
|
199
|
+
loopId: string
|
|
200
|
+
task: number
|
|
201
|
+
reviewers: string[]
|
|
202
|
+
models: Record<string, string>
|
|
203
|
+
/** The round cap — resolved by the driver from `ReviewPolicy.maxRounds` (repository config), never read here: this module has no config read of its own. */
|
|
204
|
+
maxRounds: number
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** A round awaiting its `verdicts` observation, or awaiting a confidence re-ask — never both logged twice. */
|
|
208
|
+
export type PendingRound = {
|
|
209
|
+
round: number
|
|
210
|
+
stats: RoundStats
|
|
211
|
+
confidenceAskCount: number
|
|
212
|
+
confidence: Confidence | null
|
|
213
|
+
/** The id → state map of every prior round combined, for the reappearance check. */
|
|
214
|
+
priorIds: Map<string, string | null>
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export type LoopState = {
|
|
218
|
+
config: LoopConfig
|
|
219
|
+
rounds: RoundRecord[]
|
|
220
|
+
pending: PendingRound | null
|
|
221
|
+
/** The one extra developer turn the confidence rule (§2) grants after a below-50 round — spent once, ever. */
|
|
222
|
+
extraTurnUsed: boolean
|
|
223
|
+
/** The most recent round's combined id → state map, carried forward for the next round's comparison. */
|
|
224
|
+
lastIds: Map<string, string | null>
|
|
225
|
+
/** Running sums for `journal_finalized` — updated once per concluded round, never recomputed from `rounds` (which carries counts only, not diff stats). */
|
|
226
|
+
totalWallMs: number
|
|
227
|
+
totalFilesChanged: number
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function initialLoopState(config: LoopConfig): LoopState {
|
|
231
|
+
return {
|
|
232
|
+
config,
|
|
233
|
+
rounds: [],
|
|
234
|
+
pending: null,
|
|
235
|
+
extraTurnUsed: false,
|
|
236
|
+
lastIds: new Map(),
|
|
237
|
+
totalWallMs: 0,
|
|
238
|
+
totalFilesChanged: 0
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -57,7 +57,7 @@ export type DiagramNode = {
|
|
|
57
57
|
crosses?: 'into-github' | 'none'
|
|
58
58
|
/** The node's name **for a reader**, when its `label` is an identifier rather
|
|
59
59
|
* than words. `role`/`contract` nodes label themselves with their doctrine id
|
|
60
|
-
* (`
|
|
60
|
+
* (`planner`, `archivist-tranche-archivist`) because that id is the
|
|
61
61
|
* node's identity — routes, doc paths and edge endpoints all key off it, so
|
|
62
62
|
* it cannot be prettified in place. This carries the doc's own `title:`
|
|
63
63
|
* frontmatter instead, and every renderer showing a name to a person prefers
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Direct-main-push detection
|
|
3
|
-
* Part 3 — item 1). Pure — no `fs`, no `gh`/`git` shell-outs. The CLI shim
|
|
2
|
+
* Direct-main-push detection. Pure — no `fs`, no `gh`/`git` shell-outs. The CLI shim
|
|
4
3
|
* (`bin/check-direct-main-push.ts`) makes the one forge call (the
|
|
5
4
|
* commits→pulls association API: `GET /repos/{owner}/{repo}/commits/{sha}/pulls`,
|
|
6
5
|
* which GitHub documents as returning "the merged Pull Request that
|