@attalabs/vinaya 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/aeg-root/enforcement.md +5 -4
- package/aeg-root/roles/developer/reference.md +24 -22
- package/aeg-root/roles/developer.md +4 -4
- package/aeg-root/roles/planner/reference.md +11 -0
- package/aeg-root/roles/reviewer.md +5 -3
- package/aeg-root/roles/security.md +3 -2
- package/aeg-root/state-machine.md +1 -1
- package/aeg-root/templates/brief-template.md +4 -4
- package/aeg-root/tranche-model.md +6 -0
- package/dist/checks/bin/check-body-bare-digits.js +139 -12
- package/dist/checks/bin/check-branch-topology.js +171 -13
- package/dist/checks/bin/check-brief-shape.js +139 -12
- package/dist/checks/bin/check-changeset-coverage.js +177 -17
- package/dist/checks/bin/check-closes-n.js +171 -13
- package/dist/checks/bin/check-coherence.js +171 -13
- package/dist/checks/bin/check-dead-branch-push.js +139 -12
- package/dist/checks/bin/check-dispatch-readiness.js +195 -23
- package/dist/checks/bin/check-doc-coverage-push.js +173 -13
- package/dist/checks/bin/check-doc-coverage.js +180 -13
- package/dist/checks/bin/check-doctrine-no-procedures.js +139 -12
- package/dist/checks/bin/check-doctrine-portability.js +173 -13
- package/dist/checks/bin/check-evidence-fresh.js +173 -13
- package/dist/checks/bin/check-exec-bits.js +173 -13
- package/dist/checks/bin/check-first-push-dispatch.js +171 -13
- package/dist/checks/bin/check-issue-assignment.js +171 -13
- package/dist/checks/bin/check-issue-milestone-attach.js +139 -12
- package/dist/checks/bin/check-issue-objectives-numbering.js +139 -12
- package/dist/checks/bin/check-issue-parts-coverage.js +139 -12
- package/dist/checks/bin/check-issue-surface-globs.js +171 -13
- package/dist/checks/bin/check-issue-title-grammar.js +139 -12
- package/dist/checks/bin/check-issue-tranche-label.js +139 -12
- package/dist/checks/bin/check-main-branch-refusal.js +139 -12
- package/dist/checks/bin/check-no-disk-state.js +139 -12
- package/dist/checks/bin/check-pr-premise-reassert.js +139 -12
- package/dist/checks/bin/check-pr-report-density.js +139 -12
- package/dist/checks/bin/check-principal-test-plan-wait.js +139 -12
- package/dist/checks/bin/check-quoted-command.js +173 -13
- package/dist/checks/bin/check-reader-resolvable-prose.js +173 -13
- package/dist/checks/bin/check-registry-gates.js +406 -68
- package/dist/checks/bin/check-retired-vocabulary.js +173 -13
- package/dist/checks/bin/check-review-gate.js +139 -12
- package/dist/checks/bin/check-single-plan-pr.js +139 -12
- package/dist/checks/bin/check-surface-scope.js +171 -13
- package/dist/checks/bin/check-test-plan.js +139 -12
- package/dist/checks/bin/check-token-collection-wired.js +139 -12
- package/dist/checks/bin/check-workspace-escape.js +173 -13
- package/dist/checks/bin/verify-dispatch.js +3849 -0
- package/dist/index.js +7348 -2095
- package/dist/lib/pre-push-cache-test-run.js +42 -2
- package/dist/lib/pre-push-changed-files.js +16 -11
- package/dist/lib/pre-push-select-tests.js +177 -21
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +33 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +31 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +214 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +11 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +5 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -145
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +63 -14
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +56 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +7 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +219 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +38 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/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/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.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.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.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.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.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.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.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.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/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]__04adkz-._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__14ui9sz._.js → [root-of-the-server]__0jdjsxe._.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/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_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/1-acpmtfmrc35.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3qtt1v3ya-ofe.js → 2f2y8xxok8zph.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3l56x8wjdzvaw.js → 2xevgia1h8g0y.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/dist/checks/bin/check-token-report.js +0 -6526
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vtfb0g813gki.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{yR5RsCxb1OGnYggiaO09S → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{yR5RsCxb1OGnYggiaO09S → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{yR5RsCxb1OGnYggiaO09S → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
|
@@ -35,23 +35,23 @@
|
|
|
35
35
|
* what the numbering and the "already published?" decision need.
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
-
import {
|
|
38
|
+
import type { RoundRecord } from './types'
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* The published
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* summary itself: the one honest "the summary was actually published" signal,
|
|
41
|
+
* The published marker line — `<!-- aeg:loop:published head=<sha>
|
|
42
|
+
* confidence=<round>:<cell>,… -->`, as `render-summary.ts` emits it. A
|
|
43
|
+
* principal-authored comment carrying this line is the ready-for-merge
|
|
44
|
+
* publication itself: the one honest "the loop actually published" signal,
|
|
46
45
|
* distinct from a round merely deciding `publish` (the control store's own
|
|
47
46
|
* `loop_state.phase === 'publish'` is written before `publishRound` runs, so
|
|
48
|
-
* it can never stand in for this).
|
|
47
|
+
* it can never stand in for this). Group 1 is the published head, group 2 the
|
|
48
|
+
* confidence entries.
|
|
49
49
|
*/
|
|
50
|
-
export const
|
|
50
|
+
export const PUBLISHED_MARKER_LINE = /^<!-- aeg:loop:published head=([0-9a-f]{7,64}) confidence=([^\s]*) -->$/
|
|
51
51
|
|
|
52
|
-
/** True when `body`
|
|
52
|
+
/** True when `body` carries the published marker verbatim on its own line — the caller has already confirmed the comment is principal-authored. */
|
|
53
53
|
export function isPublishedSummaryComment(body: string): boolean {
|
|
54
|
-
return body.split('\n').some((line) => line.trim()
|
|
54
|
+
return body.split('\n').some((line) => PUBLISHED_MARKER_LINE.test(line.trim()))
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -112,15 +112,15 @@ export type ReconstructedJournal = {
|
|
|
112
112
|
reviewGate: ReviewGateFact
|
|
113
113
|
/**
|
|
114
114
|
* `{ result: 'merged_ready' }` while a principal-authored ready-for-merge
|
|
115
|
-
*
|
|
115
|
+
* publication comment is actually on the forge AND the review gate has not
|
|
116
116
|
* FAILED against the pull request's CURRENT state (`ReviewGateFact`, whose
|
|
117
117
|
* own doc explains why an `'unknown'` gate is not a reopen). Concluded is a
|
|
118
118
|
* property of the pull request now, not a one-way latch it once passed
|
|
119
119
|
* through.
|
|
120
120
|
*
|
|
121
121
|
* The summary alone was the old signal, and it is sticky in a way the forge
|
|
122
|
-
* is not: the
|
|
123
|
-
* older head keeps reading "done forever" after a red gate, a newer
|
|
122
|
+
* is not: the published marker comment is never edited, so a publication posted
|
|
123
|
+
* for an older head keeps reading "done forever" after a red gate, a newer
|
|
124
124
|
* Principal ruling, a superseded brief or a moved head — observed on an
|
|
125
125
|
* adopter pull request whose every `--resume` was refused while the gate was
|
|
126
126
|
* red and a ruling sat unaddressed. The gate is the one evaluation already
|
package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts
CHANGED
|
@@ -1,181 +1,82 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* `renderPublishedMarker(journal, head)` — the publication comment. A single
|
|
3
|
+
* HTML comment line, invisible on the pull request, carrying what the loop's
|
|
4
|
+
* own readers need: that the loop published, the head it published, and each
|
|
5
|
+
* round's confidence. The round table is not posted — the Vinaya Log is the
|
|
6
|
+
* record of each round's findings and outcome. The line carries no `VERDICT:`,
|
|
7
|
+
* `Judged head:`, or `Objectives version:` label, so neither verdict extractor
|
|
8
|
+
* (`../verdict-extraction`) can read it as a real verdict.
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
SEVERITY_COLUMNS,
|
|
12
|
-
type Confidence,
|
|
13
|
-
type DeferredFindingRow,
|
|
14
|
-
type Journal,
|
|
15
|
-
type NotReviewedReason,
|
|
16
|
-
type RoundRecord
|
|
17
|
-
} from './types'
|
|
11
|
+
import { PUBLISHED_MARKER_LINE } from './journal-reconstruction'
|
|
12
|
+
import type { Confidence, Journal } from './types'
|
|
18
13
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* loop never asked this round for a confidence at all (round 1 never is), or
|
|
23
|
-
* it asked and the developer stated nothing readable.
|
|
24
|
-
*
|
|
25
|
-
* `CONFIDENCE_NOT_ASKED_CELL`'s glyph is also the count columns' own
|
|
26
|
-
* "nothing to report" cell (`countCells` below) — one glyph for one meaning
|
|
27
|
-
* across the table, rather than a second literal saying the same thing. Only
|
|
28
|
-
* the confidence column is read back out of a posted table, so the shared
|
|
29
|
-
* glyph never makes a count cell parseable as a confidence.
|
|
30
|
-
*/
|
|
31
|
-
export const CONFIDENCE_NOT_ASKED_CELL = '—'
|
|
14
|
+
/** The cell a round the loop never asked for a confidence at all (round 1 never is) writes. */
|
|
15
|
+
export const CONFIDENCE_NOT_ASKED_CELL = '-'
|
|
16
|
+
/** The cell a round that was asked, with no readable statement, writes. */
|
|
32
17
|
export const CONFIDENCE_ABSENT_CELL = 'absent'
|
|
33
18
|
|
|
34
|
-
/** The highest percentage
|
|
19
|
+
/** The highest percentage the marker ever records — the same ceiling `CONFIDENCE_LINE`'s own `0-100` grammar accepts, named here because the parser below refuses a figure that exceeds it. */
|
|
35
20
|
export const CONFIDENCE_MAX_PERCENT = 100
|
|
36
21
|
|
|
37
22
|
function confidenceCell(confidence: Confidence | null): string {
|
|
38
23
|
if (confidence === null) return CONFIDENCE_NOT_ASKED_CELL
|
|
39
24
|
if (confidence === 'absent') return CONFIDENCE_ABSENT_CELL
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* One round's count cells — numbers when the loop recorded this round's
|
|
45
|
-
* findings, the not-reported glyph when it never recorded them at all.
|
|
46
|
-
*
|
|
47
|
-
* A round the loop ASSESSED records every severity column, zeros included
|
|
48
|
-
* (`buildRoundRecord`, `assess-round.ts`), so a record carrying none of them
|
|
49
|
-
* is one whose counts have no source. Two kinds carry none: a round rebuilt
|
|
50
|
-
* from the pull request's own round markers after a restart, which name a
|
|
51
|
-
* round's number and head and carry no finding breakdown at all
|
|
52
|
-
* (`journal-reconstruction.ts`); and a round no reviewer ever saw — its gate
|
|
53
|
-
* was red, or a low confidence sent the developer back — which records no
|
|
54
|
-
* counts on purpose (`buildUnreviewedRecord`, `assess-round.ts`) and names why
|
|
55
|
-
* in its outcome cell (`outcomeCell` below). Writing `0` for those cells told a
|
|
56
|
-
* reader the round was clean — four rounds of a real task's published table
|
|
57
|
-
* read as zero findings when the truth was that nobody knew, and an unreviewed
|
|
58
|
-
* round read as a clean review that never ran. The distinction is whether the
|
|
59
|
-
* counts were recorded, never whether they are zero: a round the loop assessed
|
|
60
|
-
* and found nothing in still reads `0`, because that zero is a measurement.
|
|
61
|
-
*/
|
|
62
|
-
function countCells(record: RoundRecord): string[] {
|
|
63
|
-
const recorded = SEVERITY_COLUMNS.some((key) => record.countsBySeverity[key] !== undefined)
|
|
64
|
-
if (!recorded) return SEVERITY_COLUMNS.map(() => CONFIDENCE_NOT_ASKED_CELL)
|
|
65
|
-
return SEVERITY_COLUMNS.map((key) => String(record.countsBySeverity[key] ?? 0))
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The outcome cell. A round the loop assessed (or one rebuilt from a marker)
|
|
70
|
-
* prints its own `outcome` verbatim — the vocabulary `render-summary.test.ts`
|
|
71
|
-
* pins (`green`, `changes_requested`, `escalated`, `stopped`). A round no
|
|
72
|
-
* reviewer saw (`notReviewed` set, `buildUnreviewedRecord` in
|
|
73
|
-
* `assess-round.ts`) instead states that no review ran and why, so a reader
|
|
74
|
-
* never takes its `—` counts for a clean round the way the old `0` /
|
|
75
|
-
* `changes_requested` row read.
|
|
76
|
-
*/
|
|
77
|
-
const NOT_REVIEWED_REASON_TEXT: Record<NotReviewedReason, string> = {
|
|
78
|
-
checks_red: 'checks red',
|
|
79
|
-
low_confidence: 'low confidence',
|
|
80
|
-
mechanical_failure: 'mechanical failure'
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function outcomeCell(record: RoundRecord): string {
|
|
84
|
-
if (record.notReviewed !== undefined) return `not reviewed — ${NOT_REVIEWED_REASON_TEXT[record.notReviewed]}`
|
|
85
|
-
return record.outcome
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function row(record: RoundRecord): string {
|
|
89
|
-
return `| ${record.round} | ${countCells(record).join(' | ')} | ${confidenceCell(record.confidence)} | ${outcomeCell(record)} |`
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** The heading that opens the deferred-findings block, so a reader (and a test) can find it without matching a whole line. */
|
|
93
|
-
export const DEFERRED_FINDINGS_HEADING = 'Deferred findings (reported, not blocking this round):'
|
|
94
|
-
|
|
95
|
-
/** One deferred finding as the summary lists it (O4): its original severity, its `file:line` (or `(no location)` when it carried none), and why. */
|
|
96
|
-
export function renderDeferredFindingLine(round: number, f: DeferredFindingRow): string {
|
|
97
|
-
const where = f.location.length > 0 ? f.location : '(no location)'
|
|
98
|
-
return `- round ${round} — ${f.severity} ${where} — ${DEFERRAL_REASON_TEXT[f.reason]}`
|
|
25
|
+
return String(confidence.value)
|
|
99
26
|
}
|
|
100
27
|
|
|
101
28
|
/**
|
|
102
|
-
* The
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* what it was before this task on a run that deferred nothing. Deliberately
|
|
106
|
-
* NOT a `|`-delimited table: `parseSummaryConfidenceRows` reads the table by
|
|
107
|
-
* its pipe-delimited rows, so a plain-list block can never be misread as a
|
|
108
|
-
* round row.
|
|
29
|
+
* The published marker: `<!-- aeg:loop:published head=<sha> confidence=1:-,2:80,3:absent -->`.
|
|
30
|
+
* Each round contributes `<round>:<cell>` — a percentage, `absent` (asked, no
|
|
31
|
+
* readable statement) or `-` (never asked).
|
|
109
32
|
*/
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
for (const f of record.deferred ?? []) lines.push(renderDeferredFindingLine(record.round, f))
|
|
114
|
-
}
|
|
115
|
-
return lines.length === 0 ? [] : ['', DEFERRED_FINDINGS_HEADING, ...lines]
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function renderSummary(journal: Journal): string {
|
|
119
|
-
const header = SUMMARY_TABLE_HEADER
|
|
120
|
-
const divider = `| --- | ${SEVERITY_COLUMNS.map(() => '---').join(' | ')} | --- | --- |`
|
|
121
|
-
const rows = journal.rounds.map(row)
|
|
122
|
-
return [header, divider, ...rows, ...renderDeferredBlock(journal)].join('\n')
|
|
33
|
+
export function renderPublishedMarker(journal: Journal, head: string): string {
|
|
34
|
+
const confidence = journal.rounds.map((record) => `${record.round}:${confidenceCell(record.confidence)}`).join(',')
|
|
35
|
+
return `<!-- aeg:loop:published head=${head} confidence=${confidence} -->`
|
|
123
36
|
}
|
|
124
37
|
|
|
125
38
|
/**
|
|
126
|
-
* One round's confidence as
|
|
39
|
+
* One round's confidence as the marker records it, in three distinguishable
|
|
127
40
|
* states rather than two:
|
|
128
41
|
*
|
|
129
42
|
* - `asked: true` with a `percent` — the developer stated that figure;
|
|
130
43
|
* - `asked: true`, `percent: null` — the round WAS asked and the statement
|
|
131
|
-
* was missing or unreadable (the
|
|
44
|
+
* was missing or unreadable (the `absent` cell);
|
|
132
45
|
* - `asked: false`, `percent: null` — the loop never asked this round at all
|
|
133
|
-
* (
|
|
134
|
-
*
|
|
46
|
+
* (the `-` cell; round 1 is never asked), so a reader must not be told the
|
|
47
|
+
* developer skipped a statement.
|
|
135
48
|
*/
|
|
136
49
|
export type SummaryConfidenceRow = { round: number; percent: number | null; asked: boolean }
|
|
137
50
|
|
|
138
51
|
/**
|
|
139
|
-
* The inverse of `
|
|
140
|
-
* posted
|
|
141
|
-
*
|
|
142
|
-
* the table's shape and would drift the first time a column moved.
|
|
143
|
-
*
|
|
144
|
-
* Only rows this renderer could have produced are read: a leading round
|
|
145
|
-
* number, then one cell per severity column, then the confidence cell, then
|
|
146
|
-
* the outcome. Anything else in the comment — prose above or below the table,
|
|
147
|
-
* a differently-shaped table — yields no row at all rather than a guess.
|
|
52
|
+
* The inverse of `renderPublishedMarker` — the confidence entries read back out
|
|
53
|
+
* of a posted marker. Kept beside the renderer so the entry shape is written
|
|
54
|
+
* down once.
|
|
148
55
|
*
|
|
149
|
-
* This
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
56
|
+
* This is the boundary between pull-request comment text (which anybody with
|
|
57
|
+
* write access to a fork's branch can shape) and the confidence figure a tool
|
|
58
|
+
* result publishes, so the percentage is bounded HERE: an entry claiming more
|
|
59
|
+
* than `CONFIDENCE_MAX_PERCENT` is dropped rather than carried out of range. A
|
|
60
|
+
* comment with no marker line, and any entry not shaped `<round>:<cell>`,
|
|
61
|
+
* yields no row at all rather than a guess.
|
|
154
62
|
*/
|
|
155
63
|
export function parseSummaryConfidenceRows(body: string): SummaryConfidenceRow[] {
|
|
156
|
-
const cellCount = SEVERITY_COLUMNS.length + 3
|
|
157
64
|
const rows: SummaryConfidenceRow[] = []
|
|
158
65
|
for (const line of body.split('\n')) {
|
|
159
|
-
const
|
|
160
|
-
if (!
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
continue
|
|
66
|
+
const match = PUBLISHED_MARKER_LINE.exec(line.trim())
|
|
67
|
+
if (!match) continue
|
|
68
|
+
for (const entry of (match[2] as string).split(',')) {
|
|
69
|
+
const [roundText, cell] = entry.split(':')
|
|
70
|
+
const round = Number(roundText)
|
|
71
|
+
if (!Number.isInteger(round) || round <= 0 || cell === undefined) continue
|
|
72
|
+
if (cell === CONFIDENCE_NOT_ASKED_CELL) {
|
|
73
|
+
rows.push({ round, percent: null, asked: false })
|
|
74
|
+
} else if (cell === CONFIDENCE_ABSENT_CELL) {
|
|
75
|
+
rows.push({ round, percent: null, asked: true })
|
|
76
|
+
} else if (/^\d{1,3}$/.test(cell) && Number(cell) <= CONFIDENCE_MAX_PERCENT) {
|
|
77
|
+
rows.push({ round, percent: Number(cell), asked: true })
|
|
78
|
+
}
|
|
173
79
|
}
|
|
174
|
-
const percentMatch = /^(\d{1,3})%$/.exec(confidenceCellText)
|
|
175
|
-
if (!percentMatch) continue
|
|
176
|
-
const percent = Number(percentMatch[1])
|
|
177
|
-
if (percent > CONFIDENCE_MAX_PERCENT) continue
|
|
178
|
-
rows.push({ round, percent, asked: true })
|
|
179
80
|
}
|
|
180
81
|
return rows
|
|
181
82
|
}
|
|
@@ -19,7 +19,7 @@ type Envelope = { meta: unknown; subject: unknown }
|
|
|
19
19
|
type StripEnvelope<T> = T extends Envelope ? Omit<T, 'meta' | 'subject'> : never
|
|
20
20
|
export type DevReviewLoopEventInput = StripEnvelope<DevReviewLoopEvent>
|
|
21
21
|
|
|
22
|
-
/** O4's fixed column order — shared by `assess-round.ts` (counting)
|
|
22
|
+
/** O4's fixed column order — shared by `assess-round.ts` (counting) so every round records the same columns. */
|
|
23
23
|
export const SEVERITY_COLUMNS = ['blocker', 'major', 'minor', 'critical', 'high', 'medium', 'low'] as const
|
|
24
24
|
|
|
25
25
|
/** The built form's finding identity (spec §0 item 1) — no fingerprint hashing. */
|
|
@@ -42,7 +42,7 @@ export type FindingObservation = {
|
|
|
42
42
|
id: string
|
|
43
43
|
severity: string
|
|
44
44
|
/**
|
|
45
|
-
* The finding's own `file:line` (O4) — carried so the round
|
|
45
|
+
* The finding's own `file:line` (O4) — carried so the round record can name
|
|
46
46
|
* every deferred finding's location. Optional: an older extraction shape, or
|
|
47
47
|
* a finding with none, simply has none to report.
|
|
48
48
|
*/
|
|
@@ -209,6 +209,17 @@ export type Observations =
|
|
|
209
209
|
* vocabulary and rendering path every other pause reason already uses.
|
|
210
210
|
* `detail` is set for this reason too, naming the branch and the dirty
|
|
211
211
|
* file(s) observed.
|
|
212
|
+
*
|
|
213
|
+
* `'time_budget'`: the task's ACTIVE working time — the sum of the phases a
|
|
214
|
+
* driver spent developing, reviewing and awaiting confidence, never the hours
|
|
215
|
+
* it sat paused, published or driverless — passed `ReviewPolicy.maxTaskMinutes`.
|
|
216
|
+
* Unlike every other bound here it counts neither rounds nor attempts, so it is
|
|
217
|
+
* the one stop a loop cannot outrun by never advancing: time spent pushing,
|
|
218
|
+
* rebasing, waiting on checks and retrying all counts toward it (it is recorded
|
|
219
|
+
* as developing), while time waiting on a Principal does not. Decided by
|
|
220
|
+
* `assessRound` from the clock its caller reads (this module has none of its
|
|
221
|
+
* own); `detail` names the budget, the active time spent, and the active phases
|
|
222
|
+
* that time was summed from.
|
|
212
223
|
*/
|
|
213
224
|
export type PauseReason =
|
|
214
225
|
| 'escalation'
|
|
@@ -218,6 +229,7 @@ export type PauseReason =
|
|
|
218
229
|
| 'reappearance'
|
|
219
230
|
| 'repeat_finding'
|
|
220
231
|
| 'repeat_failure'
|
|
232
|
+
| 'time_budget'
|
|
221
233
|
| 'infrastructure'
|
|
222
234
|
| 'no_push'
|
|
223
235
|
| 'objectives_changed'
|
|
@@ -238,8 +250,10 @@ export type Decision =
|
|
|
238
250
|
* The pause's own narration, when the deciding component has one:
|
|
239
251
|
* `'infrastructure'` (the role and missing artifact(s) the driver
|
|
240
252
|
* observed), `'max_rounds'` (the configured cap), `'repeat_finding'`
|
|
241
|
-
* (the reviewer-qualified finding key(s) open two rounds running),
|
|
242
|
-
* `'repeat_failure'` (the exact failure message, unnormalised)
|
|
253
|
+
* (the reviewer-qualified finding key(s) open two rounds running),
|
|
254
|
+
* `'repeat_failure'` (the exact failure message, unnormalised), and
|
|
255
|
+
* `'time_budget'` (the budget, the active time spent, and the active
|
|
256
|
+
* phases it was summed from). Every
|
|
243
257
|
* other reason omits it here — the driver narrates several of them
|
|
244
258
|
* itself from facts it already holds (`deriveVerdictPauseDetail`).
|
|
245
259
|
*/
|
|
@@ -247,7 +261,7 @@ export type Decision =
|
|
|
247
261
|
}
|
|
248
262
|
|
|
249
263
|
/**
|
|
250
|
-
* The
|
|
264
|
+
* The journal's own outcome vocabulary — wider than `round_ended`'s
|
|
251
265
|
* schema-constrained `green | changes_requested | escalated`: a round whose
|
|
252
266
|
* processing triggered one of the assessment exits (max_rounds, confidence,
|
|
253
267
|
* reappearance) records `'stopped'` here, even though the log
|
|
@@ -258,9 +272,9 @@ export type Decision =
|
|
|
258
272
|
export type RoundOutcome = 'green' | 'changes_requested' | 'escalated' | 'stopped'
|
|
259
273
|
|
|
260
274
|
/**
|
|
261
|
-
* Why a round ended before any reviewer ran, for the
|
|
275
|
+
* Why a round ended before any reviewer ran, for the journal's outcome
|
|
262
276
|
* cell. A round no reviewer saw has no findings from any source, so it records
|
|
263
|
-
* no counts at all (an empty `countsBySeverity
|
|
277
|
+
* no counts at all (an empty `countsBySeverity`)
|
|
264
278
|
* rather than a zero that reads as a clean review — and this names the reason
|
|
265
279
|
* the outcome cell states instead of the log-parity `outcome` a reviewed round
|
|
266
280
|
* carries:
|
|
@@ -271,15 +285,17 @@ export type RoundOutcome = 'green' | 'changes_requested' | 'escalated' | 'stoppe
|
|
|
271
285
|
* without dispatching reviewers;
|
|
272
286
|
* - `'mechanical_failure'` — the same mechanical failure ended two
|
|
273
287
|
* consecutive attempts that never produced a head (`'repeat_failure'`),
|
|
274
|
-
* so no gate ever judged one and no reviewer ever saw it
|
|
288
|
+
* so no gate ever judged one and no reviewer ever saw it;
|
|
289
|
+
* - `'time_budget'` — the task's wall-clock budget ran out before this
|
|
290
|
+
* round reached review, so reviewers were never dispatched for it.
|
|
275
291
|
*
|
|
276
292
|
* `outcome` stays whatever the round would otherwise carry (both reasons are
|
|
277
293
|
* `changes_requested` today), so the `round_ended` log event a reader parses is
|
|
278
|
-
* unaffected — only the
|
|
294
|
+
* unaffected — only the `RoundRecord` the journal carries changes.
|
|
279
295
|
*/
|
|
280
|
-
export type NotReviewedReason = 'checks_red' | 'low_confidence' | 'mechanical_failure'
|
|
296
|
+
export type NotReviewedReason = 'checks_red' | 'low_confidence' | 'mechanical_failure' | 'time_budget'
|
|
281
297
|
|
|
282
|
-
/** One deferred finding, as the
|
|
298
|
+
/** One deferred finding, as the journal records it (O4) — its original severity, its `file:line`, and why this round set it aside, never its reported severity mutated. */
|
|
283
299
|
export type DeferredFindingRow = {
|
|
284
300
|
severity: string
|
|
285
301
|
/** The finding's own `file:line`, or `''` when it carried none. */
|
|
@@ -287,7 +303,7 @@ export type DeferredFindingRow = {
|
|
|
287
303
|
reason: DeferralReason
|
|
288
304
|
}
|
|
289
305
|
|
|
290
|
-
/** One
|
|
306
|
+
/** One round of the journal (O4) — counts only, no finding prose. */
|
|
291
307
|
export type RoundRecord = {
|
|
292
308
|
round: number
|
|
293
309
|
countsBySeverity: Record<string, number>
|
|
@@ -295,7 +311,7 @@ export type RoundRecord = {
|
|
|
295
311
|
outcome: RoundOutcome
|
|
296
312
|
/**
|
|
297
313
|
* Every finding this round set aside rather than let it block (O2/O3),
|
|
298
|
-
* carried so
|
|
314
|
+
* carried so a reader can list each with its original severity,
|
|
299
315
|
* location and reason (O4). Absent/`[]` for a round that deferred none, and
|
|
300
316
|
* for a marker-reconstructed round (its findings are unknown — see
|
|
301
317
|
* `journal-reconstruction.ts`).
|
|
@@ -304,7 +320,7 @@ export type RoundRecord = {
|
|
|
304
320
|
/**
|
|
305
321
|
* Set only for a round no reviewer saw (`buildUnreviewedRecord`,
|
|
306
322
|
* `assess-round.ts`): its counts are absent (empty `countsBySeverity`) and the
|
|
307
|
-
*
|
|
323
|
+
* the round's outcome names this reason. Absent for every round the loop
|
|
308
324
|
* assessed and for a round rebuilt from a marker — a marker-reconstructed
|
|
309
325
|
* round's counts are likewise unknown, but the round DID reach review, so it
|
|
310
326
|
* keeps its `outcome`, not a not-reviewed reason.
|
|
@@ -322,6 +338,39 @@ export type LoopConfig = {
|
|
|
322
338
|
models: Record<string, string>
|
|
323
339
|
/** The round cap — resolved by the driver from `ReviewPolicy.maxRounds` (repository config), never read here: this module has no config read of its own. */
|
|
324
340
|
maxRounds: number
|
|
341
|
+
/** The task's wall-clock budget in minutes — resolved by the driver from `ReviewPolicy.maxTaskMinutes`, same discipline as `maxRounds` above. `0` turns the budget off. */
|
|
342
|
+
maxTaskMinutes: number
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* How long this task has been running, and where that time went — read by the
|
|
347
|
+
* DRIVER and handed to `assessRound`, never measured here: this module has no
|
|
348
|
+
* clock, the same way it has no config read.
|
|
349
|
+
*
|
|
350
|
+
* `elapsedMs` is the task's ACTIVE working time: the sum of the phases a driver
|
|
351
|
+
* spent working the task forward (`activeBudgetMs` over `byPhaseMs` —
|
|
352
|
+
* developing, reviewing, awaiting confidence), and nothing else. Time the task
|
|
353
|
+
* sat `paused` waiting for a Principal, time it spent `publishing` an approved
|
|
354
|
+
* pull request, and any stretch with no driver running at all are excluded — so
|
|
355
|
+
* a task first started days ago is measured by the minutes it worked, not by
|
|
356
|
+
* its age. It is a sum over per-phase times the durable control records carry
|
|
357
|
+
* across a restart, so a driver that was killed, taken over, or re-execed
|
|
358
|
+
* itself continues one budget rather than beginning a fresh one.
|
|
359
|
+
*
|
|
360
|
+
* `byPhaseMs` is the FULL record of what the loop recorded against each phase
|
|
361
|
+
* it worked in, keyed by the phase names the loop persists (`dispatch_developer`,
|
|
362
|
+
* `dispatch_reviewers`, and so on) — inactive phases (`pause`, `publish`)
|
|
363
|
+
* included, so it is a faithful account of where all the time went. The budget
|
|
364
|
+
* is decided on `elapsedMs`, which sums only the active subset; a breakdown
|
|
365
|
+
* that is thin — a run whose earlier phases were recorded by a driver that has
|
|
366
|
+
* since died — still stops on time and simply reports less about where the
|
|
367
|
+
* time went. The `'time_budget'` pause's detail names only the active phases
|
|
368
|
+
* (`renderTaskBudgetDetail`), so the phases it lists sum to the time it reports
|
|
369
|
+
* as spent.
|
|
370
|
+
*/
|
|
371
|
+
export type TaskClock = {
|
|
372
|
+
elapsedMs: number
|
|
373
|
+
byPhaseMs: Record<string, number>
|
|
325
374
|
}
|
|
326
375
|
|
|
327
376
|
/** A round awaiting its `verdicts` observation, or awaiting a confidence re-ask — never both logged twice. */
|
|
@@ -18,12 +18,14 @@ export {
|
|
|
18
18
|
enforcementPublishedText,
|
|
19
19
|
evaluatePublishedProse,
|
|
20
20
|
extractShortVersion,
|
|
21
|
+
extractShortVersionAndChecklist,
|
|
21
22
|
publishedDoctrineBody,
|
|
22
23
|
readabilityErrors,
|
|
23
24
|
REFERENCE_HEADING,
|
|
24
25
|
ROLE_BLOCKS,
|
|
25
26
|
SHORT_VERSION_HEADING,
|
|
26
27
|
SHORT_VERSION_MAX_WORDS,
|
|
27
|
-
SHORT_VERSION_MIN_WORDS
|
|
28
|
+
SHORT_VERSION_MIN_WORDS,
|
|
29
|
+
WHAT_YOU_CHECK_HEADING
|
|
28
30
|
} from './published-prose'
|
|
29
31
|
export type { PublishedProseEntry, PublishedProseResult } from './published-prose'
|
|
@@ -49,6 +49,8 @@ import type { DocFrontmatter } from './types'
|
|
|
49
49
|
|
|
50
50
|
export const SHORT_VERSION_HEADING = 'The short version'
|
|
51
51
|
export const REFERENCE_HEADING = 'Reference'
|
|
52
|
+
/** The reviewer/security checklist heading a dispatched review pass carries alongside the short version. */
|
|
53
|
+
export const WHAT_YOU_CHECK_HEADING = 'What you check'
|
|
52
54
|
|
|
53
55
|
/** Words. Under the floor means something was dropped; over the ceiling means
|
|
54
56
|
* the reference is being summarised instead of the rule being stated. */
|
|
@@ -148,6 +150,34 @@ export function extractShortVersion(body: string): string | null {
|
|
|
148
150
|
return sectionBody(body, SHORT_VERSION_HEADING)
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
/** Strip the trailing `---` horizontal rule (and the blank lines around it) that closes every short version — the reviewer prompt carries the prose, never the rule (Traps to avoid). */
|
|
154
|
+
function stripTrailingRule(text: string): string {
|
|
155
|
+
return text.replace(/\n*-{3,}[ \t]*$/, '').trimEnd()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The published role doctrine a dispatched reviewer/security pass is handed as
|
|
160
|
+
* a fact: the role's short version (with the trailing `---` rule stripped),
|
|
161
|
+
* followed by its `## What you check` section verbatim when the body carries
|
|
162
|
+
* one. Reuses `extractShortVersion` so the injected short version and the
|
|
163
|
+
* `/docs` page can never disagree about what "published" means.
|
|
164
|
+
*
|
|
165
|
+
* Returns `null` when the body carries no `## The short version` at all — a
|
|
166
|
+
* body no resolvable role contract can have (`validateRoleContract` requires
|
|
167
|
+
* that section), so `null` here only ever names an unvalidated body. When the
|
|
168
|
+
* short version is present but `## What you check` is not, returns the short
|
|
169
|
+
* version alone rather than inventing a checklist: an adopter override missing
|
|
170
|
+
* the checklist heading is a Planner-level escalation (Stop conditions), never
|
|
171
|
+
* a fabricated section.
|
|
172
|
+
*/
|
|
173
|
+
export function extractShortVersionAndChecklist(body: string): string | null {
|
|
174
|
+
const shortRaw = extractShortVersion(body)
|
|
175
|
+
if (shortRaw === null) return null
|
|
176
|
+
const short = stripTrailingRule(shortRaw)
|
|
177
|
+
const whatYouCheck = sectionBody(body, WHAT_YOU_CHECK_HEADING)
|
|
178
|
+
return whatYouCheck === null ? short : `${short}\n\n## ${WHAT_YOU_CHECK_HEADING}\n\n${whatYouCheck}`
|
|
179
|
+
}
|
|
180
|
+
|
|
151
181
|
/**
|
|
152
182
|
* What a role/contract page renders, with a degradation ladder that never
|
|
153
183
|
* leaks the reference: the short version when present; otherwise the body
|
|
@@ -215,8 +215,12 @@ function extractVendorMentions(content: string): { name: string; index: number }
|
|
|
215
215
|
return found
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
/**
|
|
219
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Every inline-backtick span in `content`, tested against `CITED_PATH_PATTERN`.
|
|
220
|
+
* Exported so `registry-checks.ts`'s hook-path scan reuses this extractor
|
|
221
|
+
* rather than carrying a second one.
|
|
222
|
+
*/
|
|
223
|
+
export function extractCitedPaths(content: string): { cited: string; index: number }[] {
|
|
220
224
|
const found: { cited: string; index: number }[] = []
|
|
221
225
|
const spanPattern = /`([^`\n]+)`/g
|
|
222
226
|
let match: RegExpExecArray | null = spanPattern.exec(content)
|
|
@@ -150,7 +150,6 @@ export const CLI_CHECK_RING: Readonly<Record<string, 0 | 1 | 2>> = {
|
|
|
150
150
|
'quoted-command': 0,
|
|
151
151
|
'main-branch-refusal': 0,
|
|
152
152
|
'token-collection-wired': 0,
|
|
153
|
-
'token-report': 1,
|
|
154
153
|
'pr-premise-reassert': 0,
|
|
155
154
|
// The six write-only rules named apart — `ownWorkflow: true`
|
|
156
155
|
// each, same ring reasoning as `review-gate`/`body-bare-digits` above.
|