create-agent-rig 0.4.0 → 0.6.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/CHANGELOG.md +316 -11
- package/README.md +58 -19
- package/package.json +2 -1
- package/packages/cli/dist/commands/create.js +8 -3
- package/packages/cli/dist/commands/init.js +85 -34
- package/packages/cli/dist/commands/upgrade.js +112 -30
- package/packages/cli/dist/index.js +81 -19
- package/packages/cli/dist/lib/copy-tree.js +35 -6
- package/packages/cli/dist/lib/init-settings.js +12 -0
- package/packages/cli/dist/lib/install-set.js +6 -8
- package/packages/cli/dist/lib/manifest.js +31 -9
- package/packages/cli/dist/lib/safe-path.js +30 -0
- package/scripts/prepare.mjs +1 -1
- package/templates/agent-os/init/AGENTS.md +199 -0
- package/templates/agent-os/init/CLAUDE.md +69 -9
- package/templates/agent-os/stack/aws-cdk/.agents/skills/post-deploy-verify/SKILL.md +105 -0
- package/templates/agent-os/stack/aws-cdk/.agents/skills/ro-debug/SKILL.md +117 -0
- package/templates/agent-os/stack/aws-cdk/.claude/agents/cdk-diff-reviewer.md +41 -3
- package/templates/agent-os/stack/aws-cdk/.claude/rules/aws-cdk.md +1 -1
- package/templates/agent-os/stack/aws-cdk/.claude/skills/post-deploy-verify/SKILL.md +41 -0
- package/templates/agent-os/stack/aws-cdk/.codex/agents/cdk-diff-reviewer.toml +4 -0
- package/templates/agent-os/stack/node-ts/.claude/rules/node-ts.md +29 -0
- package/templates/agent-os/universal/.agents/skills/check-premises/SKILL.md +236 -0
- package/templates/agent-os/universal/.agents/skills/loop/SKILL.md +958 -0
- package/templates/agent-os/universal/.agents/skills/new-invariant/SKILL.md +102 -0
- package/templates/agent-os/universal/.agents/skills/new-invariant/guard-invariant.example.mjs +78 -0
- package/templates/agent-os/universal/.agents/skills/new-invariant/guard-invariant.example.test.mjs +89 -0
- package/templates/agent-os/universal/.agents/skills/pr-ship/SKILL.md +396 -0
- package/templates/agent-os/universal/.agents/skills/worktree-task/SKILL.md +73 -0
- package/templates/agent-os/universal/.claude/agents/code-reviewer.md +40 -1
- package/templates/agent-os/universal/.claude/agents/prose-reviewer.md +71 -1
- package/templates/agent-os/universal/.claude/agents/security-scanner.md +40 -0
- package/templates/agent-os/universal/.claude/hooks/gate-stop-dod.mjs +301 -26
- package/templates/agent-os/universal/.claude/hooks/guard-bash.mjs +43 -5
- package/templates/agent-os/universal/.claude/hooks/guard-core-purity.mjs +25 -11
- package/templates/agent-os/universal/.claude/hooks/guard-rulebook.mjs +127 -0
- package/templates/agent-os/universal/.claude/hooks/guard-secret-file.mjs +180 -0
- package/templates/agent-os/universal/.claude/hooks/guard-web-boundary.mjs +32 -13
- package/templates/agent-os/universal/.claude/hooks/inject-rules.mjs +175 -7
- package/templates/agent-os/universal/.claude/hooks/lib/edit-input.mjs +503 -0
- package/templates/agent-os/universal/.claude/rules/autonomy.md +69 -1
- package/templates/agent-os/universal/.claude/rules/invariants.md +104 -19
- package/templates/agent-os/universal/.claude/rules/workflow.md +55 -5
- package/templates/agent-os/universal/.claude/scripts/decision-router.mjs +1260 -0
- package/templates/agent-os/universal/.claude/scripts/detect-missed-gate.mjs +65 -2
- package/templates/agent-os/universal/.claude/scripts/doctor.mjs +351 -0
- package/templates/agent-os/universal/.claude/scripts/git-env.mjs +49 -0
- package/templates/agent-os/universal/.claude/scripts/lib/gate-coverage.mjs +306 -0
- package/templates/agent-os/universal/.claude/scripts/lib/revalidation-points.mjs +28 -0
- package/templates/agent-os/universal/.claude/scripts/lib/secrets.mjs +490 -0
- package/templates/agent-os/universal/.claude/scripts/lib/verdict.mjs +462 -0
- package/templates/agent-os/universal/.claude/scripts/preflight.mjs +33 -17
- package/templates/agent-os/universal/.claude/scripts/queue/as-of.mjs +51 -0
- package/templates/agent-os/universal/.claude/scripts/queue/checkout.mjs +149 -0
- package/templates/agent-os/universal/.claude/scripts/queue/core.mjs +809 -28
- package/templates/agent-os/universal/.claude/scripts/queue/gate-rounds.mjs +160 -0
- package/templates/agent-os/universal/.claude/scripts/queue/github-issues.mjs +95 -16
- package/templates/agent-os/universal/.claude/scripts/queue/index.mjs +543 -15
- package/templates/agent-os/universal/.claude/scripts/queue/jira.mjs +457 -47
- package/templates/agent-os/universal/.claude/scripts/queue/plan-md.mjs +289 -25
- package/templates/agent-os/universal/.claude/scripts/queue/state.mjs +197 -0
- package/templates/agent-os/universal/.claude/scripts/revalidate.mjs +316 -0
- package/templates/agent-os/universal/.claude/scripts/revalidation-report.mjs +180 -0
- package/templates/agent-os/universal/.claude/scripts/run-journal.mjs +435 -0
- package/templates/agent-os/universal/.claude/scripts/run-state.mjs +539 -0
- package/templates/agent-os/universal/.claude/scripts/stop-flag.mjs +15 -8
- package/templates/agent-os/universal/.claude/scripts/unattended-flag.mjs +239 -0
- package/templates/agent-os/universal/.claude/scripts/verdict.mjs +198 -0
- package/templates/agent-os/universal/.claude/settings.json +11 -2
- package/templates/agent-os/universal/.claude/skills/check-premises/SKILL.md +118 -7
- package/templates/agent-os/universal/.claude/skills/loop/SKILL.md +667 -38
- package/templates/agent-os/universal/.claude/skills/pr-ship/SKILL.md +359 -26
- package/templates/agent-os/universal/.codex/agents/code-reviewer.toml +4 -0
- package/templates/agent-os/universal/.codex/agents/prose-reviewer.toml +4 -0
- package/templates/agent-os/universal/.codex/agents/security-scanner.toml +4 -0
- package/templates/agent-os/universal/.codex/agents/test-writer.toml +4 -0
- package/templates/agent-os/universal/.codex/hooks.json +70 -0
- package/templates/agent-os/universal/AGENTS.md +166 -0
- package/templates/agent-os/universal/CLAUDE.md +49 -14
- package/templates/agent-os/universal/PLAN.md +7 -40
- package/templates/agent-os/universal/docs/decisions/closing-a-task.md +98 -0
- package/templates/agent-os/universal/docs/decisions/codex-adapter.md +108 -0
- package/templates/agent-os/universal/docs/decisions/fail-open-guards.md +43 -0
- package/templates/agent-os/universal/docs/decisions/gate-coverage.md +83 -0
- package/templates/agent-os/universal/docs/decisions/review-lanes.md +72 -0
- package/templates/agent-os/universal/docs/decisions/run-directory.md +44 -0
- package/templates/agent-os/universal/docs/decisions/spacing-rations-mechanisms.md +125 -0
- package/templates/agent-os/universal/docs/decisions/stop-conditions-in-a-file.md +46 -0
- package/templates/agent-os/universal/docs/decisions/two-empty-endings.md +74 -0
- package/templates/agent-os/universal/journal/README.md +101 -0
- package/templates/agent-os/universal/layers.json +45 -2
- package/templates/hash-history.json +310 -49
- package/templates/release-ledger.json +9 -0
- package/templates/skeleton/aws-serverless/.github/workflows/deploy.yml +34 -1
- package/templates/skeleton/aws-serverless/README.md +91 -9
- package/templates/skeleton/aws-serverless/apps/web/src/lib/api.ts +9 -2
- package/templates/skeleton/aws-serverless/gitignore +37 -0
- package/templates/skeleton/aws-serverless/infra/bin/app.ts +73 -13
- package/templates/skeleton/aws-serverless/infra/lib/app-stack.ts +136 -4
- package/templates/skeleton/aws-serverless/infra/lib/web-stack.ts +14 -1
- package/templates/skeleton/aws-serverless/infra/test/allowed-origins.test.ts +301 -0
- package/templates/skeleton/aws-serverless/infra/test/app-composition.test.ts +137 -0
- package/templates/skeleton/aws-serverless/infra/test/app-stack.test.ts +36 -20
- package/templates/skeleton/aws-serverless/infra/test/web-stack.test.ts +15 -12
- package/templates/skeleton/aws-serverless/services/api/src/handlers/create-note.ts +33 -6
- package/templates/skeleton/aws-serverless/services/api/src/handlers/list-notes.ts +18 -5
- package/templates/skeleton/aws-serverless/services/api/src/usecases/create-note.ts +11 -0
- package/templates/skeleton/aws-serverless/services/api/test/create-note.handler.test.ts +120 -1
- package/templates/skeleton/aws-serverless/services/api/test/list-notes.test.ts +72 -1
- package/templates/skeleton/node-service/README.md +11 -1
- package/templates/skeleton/node-service/gitignore +34 -0
- package/templates/skeleton/node-service/packages/db/src/note-store.ts +47 -10
- package/templates/skeleton/node-service/packages/db/test/note-store.test.ts +20 -0
- package/templates/skeleton/node-service/services/api/src/main.ts +2 -9
- package/templates/skeleton/node-service/services/api/src/server.ts +93 -10
- package/templates/skeleton/node-service/services/api/src/static-dir.ts +20 -0
- package/templates/skeleton/node-service/services/api/test/server.test.ts +98 -13
- package/templates/skeleton/node-service/services/api/test/static-dir.test.ts +28 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate coverage — did every reviewer this round asked for actually answer, and
|
|
3
|
+
* for the commit being merged?
|
|
4
|
+
*
|
|
5
|
+
* Three writers already record the three halves of a gate round, and until this
|
|
6
|
+
* module existed nothing compared them:
|
|
7
|
+
*
|
|
8
|
+
* - `decision-router.mjs` journals the set the route ASKED FOR, on the lane it
|
|
9
|
+
* actually took (`gate: "review-routing:<lane>"`, with `reviewers`);
|
|
10
|
+
* - `pr-ship` journals the set it actually LAUNCHED, with the head it launched
|
|
11
|
+
* against (`gate: "reviewer-fan-out"`);
|
|
12
|
+
* - each verdict that PARSED is journalled under the reviewer's own name.
|
|
13
|
+
*
|
|
14
|
+
* The two failures that hide in the gap between them both end in a merge that
|
|
15
|
+
* reads as fully gated: a reviewer the router named and nobody started, and a
|
|
16
|
+
* reviewer that answered — about a commit two pushes ago.
|
|
17
|
+
*
|
|
18
|
+
* 🔴 **A verdict that names no commit is not coverage of this one.** `headSha` is
|
|
19
|
+
* optional in the schema — every report written before it existed omits one — and
|
|
20
|
+
* reading absence as "it must have meant the head I am holding" is the inference
|
|
21
|
+
* the schema's own limit 6 forbids. It gets its own list rather than a pass.
|
|
22
|
+
*
|
|
23
|
+
* 🔴 **No fan-out record is not a clean round.** A run whose journal records no
|
|
24
|
+
* fan-out has not been shown to be covered, it has been shown to be unreadable —
|
|
25
|
+
* and four empty lists are exactly what a clean round looks like. That case
|
|
26
|
+
* answers `ok: false` and says why in `reason`. A missing fan-out, a missing route,
|
|
27
|
+
* an unconsumed route, a fan-out missing its head commit, and a fan-out for a different head
|
|
28
|
+
* commit are the unreadable-round answers; each reason names the evidence boundary the journal
|
|
29
|
+
* could not establish.
|
|
30
|
+
*
|
|
31
|
+
* 🔴 **A round is judged against its OWN route, not the run's last one.** The
|
|
32
|
+
* answers are scoped to the records after the last fan-out; the route needs the
|
|
33
|
+
* mirror of that, and not having it made the refusal above vacuous in the case it
|
|
34
|
+
* was written for. A run directory spans several rounds and several PRs, so an
|
|
35
|
+
* earlier round's route would otherwise satisfy a later round that journalled
|
|
36
|
+
* none — and its *set* would be inherited too, which after a `deterministic` lane
|
|
37
|
+
* means `neverLaunched` is empty for the rest of the run whatever the route asked
|
|
38
|
+
* for. So the route that counts is the last one carrying `reviewers` **between the
|
|
39
|
+
* previous fan-out and the last one**: the route that produced the fan-out being
|
|
40
|
+
* judged.
|
|
41
|
+
*
|
|
42
|
+
* 🔴 **An unconsumed route after the last fan-out is an unreadable boundary.**
|
|
43
|
+
* The journal cannot say whether this round's fan-out record is missing or the
|
|
44
|
+
* router was re-run after a completed fan-out. Both readings refuse coverage;
|
|
45
|
+
* re-running the fan-out for this head records the boundary either one needs.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** The gate name `pr-ship` writes its fan-out under. */
|
|
49
|
+
const FAN_OUT = 'reviewer-fan-out';
|
|
50
|
+
|
|
51
|
+
/** Every lane the router reports on shares this prefix; only the taken one carries a set. */
|
|
52
|
+
const ROUTING = 'review-routing:';
|
|
53
|
+
|
|
54
|
+
const gateOf = (record) => (typeof record?.gate === 'string' ? record.gate : '');
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The reviewer names in a journalled set.
|
|
58
|
+
*
|
|
59
|
+
* `recordDecision` checks for a list of strings and nothing about what a name
|
|
60
|
+
* is, so a blank one is dropped here rather than reported as a reviewer nobody
|
|
61
|
+
* can launch.
|
|
62
|
+
*/
|
|
63
|
+
const namesOf = (value) =>
|
|
64
|
+
Array.isArray(value) ? value.filter((name) => typeof name === 'string' && name.trim() !== '') : [];
|
|
65
|
+
|
|
66
|
+
/** Order-preserving, because the output is read by a human looking for a name. */
|
|
67
|
+
const uniq = (names) => [...new Set(names)];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The shortest commit id the verdict schema accepts, and the floor a prefix
|
|
71
|
+
* match needs to be worth anything (`lib/verdict.mjs`, `isCommitId`).
|
|
72
|
+
*/
|
|
73
|
+
const SHORTEST_COMMIT = 7;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The lengths a COMPLETE commit id has: sha-1 and sha-256.
|
|
77
|
+
*
|
|
78
|
+
* An abbreviation resolves against a complete id and nothing else. Without this,
|
|
79
|
+
* any strict extension of a full id prefix-matched it — a 50-character value
|
|
80
|
+
* built by appending to a 40-character commit was counted as coverage of that
|
|
81
|
+
* commit, and it passes the schema (7–64 hex), so it arrives through the fully
|
|
82
|
+
* validated path rather than as obvious junk.
|
|
83
|
+
*/
|
|
84
|
+
const COMPLETE_COMMIT_LENGTHS = new Set([40, 64]);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Are these two ids the same commit?
|
|
88
|
+
*
|
|
89
|
+
* 🔴 **Not string equality, and the difference is a false HOLD.** The schema
|
|
90
|
+
* accepts an abbreviated id, so a reviewer may answer `b4e3ef0` about the commit
|
|
91
|
+
* `git rev-parse HEAD` prints in full — the same commit, written shorter. Exact
|
|
92
|
+
* comparison reports that as answered-for-another-commit and holds the merge on
|
|
93
|
+
* honest work, which is the way a guard loses the room.
|
|
94
|
+
*
|
|
95
|
+
* So: equal ids match, and otherwise the shorter must be a prefix of a
|
|
96
|
+
* **complete** one, case-insensitively — the way git resolves an abbreviation.
|
|
97
|
+
* Two bounds, each closing one direction:
|
|
98
|
+
*
|
|
99
|
+
* - **the floor.** Both must reach `SHORTEST_COMMIT`. A shorter value is one the
|
|
100
|
+
* verdict schema refuses, and stretching it into a match would let a value
|
|
101
|
+
* nothing accepted decide that a gate was covered. ⚠ The journal is the other
|
|
102
|
+
* way in and it does not apply that schema (`run-journal.mjs` takes `headSha`
|
|
103
|
+
* as any non-blank string), so this floor is enforced here on its own account,
|
|
104
|
+
* not on the strength of an upstream check.
|
|
105
|
+
* - **the ceiling.** The longer must be a complete id. An abbreviation resolves
|
|
106
|
+
* against a whole commit; a value that merely *extends* one is not that commit
|
|
107
|
+
* written shorter, and counting it as coverage fails in the unsafe direction.
|
|
108
|
+
*
|
|
109
|
+
* One case is decided rather than left ambiguous: a 40-character value that
|
|
110
|
+
* prefixes a 64-character one matches, because the longer is complete. It could
|
|
111
|
+
* be a sha-256 abbreviated to 40 or a sha-1 with characters appended, and nothing
|
|
112
|
+
* here can resolve which — a pure function has no repository to ask. The first
|
|
113
|
+
* reading is the one an honest run produces.
|
|
114
|
+
*/
|
|
115
|
+
const sameCommit = (one, other) => {
|
|
116
|
+
if (one.length < SHORTEST_COMMIT || other.length < SHORTEST_COMMIT) return false;
|
|
117
|
+
const first = one.toLowerCase();
|
|
118
|
+
const second = other.toLowerCase();
|
|
119
|
+
if (first === second) return true;
|
|
120
|
+
const [shorter, longer] = first.length <= second.length ? [first, second] : [second, first];
|
|
121
|
+
if (!COMPLETE_COMMIT_LENGTHS.has(longer.length)) return false;
|
|
122
|
+
return longer.startsWith(shorter);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Which reviewers are outstanding for `headSha`, and in which of the four ways.
|
|
127
|
+
*
|
|
128
|
+
* @param {{ records?: unknown, headSha?: unknown }} input
|
|
129
|
+
* `records` is `readRun(...).decisions` — the run's decision journal, in
|
|
130
|
+
* journal order. `headSha` is the commit the round is about.
|
|
131
|
+
* @returns {{
|
|
132
|
+
* ok: boolean, routed: string[], launched: string[],
|
|
133
|
+
* neverLaunched: string[], unanswered: string[],
|
|
134
|
+
* unattributed: string[], stale: string[], reason?: string,
|
|
135
|
+
* }}
|
|
136
|
+
*/
|
|
137
|
+
export const coverageOf = ({ records, headSha } = {}) => {
|
|
138
|
+
const journal = Array.isArray(records) ? records : [];
|
|
139
|
+
const target = typeof headSha === 'string' ? headSha : '';
|
|
140
|
+
|
|
141
|
+
// One forward pass, keeping the LAST of each: a branch gets a second gate
|
|
142
|
+
// round after fixes, and the round's whole question is whether THIS round's
|
|
143
|
+
// reviewers answered. An earlier fan-out answers about a round already over.
|
|
144
|
+
//
|
|
145
|
+
// `pendingRoute` is what makes the route round-scoped: a routing record is held
|
|
146
|
+
// until a fan-out consumes it, and each fan-out takes only what was journalled
|
|
147
|
+
// since the previous one. Nothing survives a fan-out, so no round can inherit
|
|
148
|
+
// the round before it.
|
|
149
|
+
let pendingRoute = null;
|
|
150
|
+
let routeOfRound = null;
|
|
151
|
+
let fanOutAt = -1;
|
|
152
|
+
let launchedNames = [];
|
|
153
|
+
let fanOutHead = null;
|
|
154
|
+
|
|
155
|
+
for (let index = 0; index < journal.length; index += 1) {
|
|
156
|
+
const record = journal[index];
|
|
157
|
+
const gate = gateOf(record);
|
|
158
|
+
// Only the taken lane carries a set; a declined lane's line has no
|
|
159
|
+
// `reviewers` key at all, and reading one off it would compare the answers
|
|
160
|
+
// against a lane nobody took.
|
|
161
|
+
if (gate.startsWith(ROUTING) && Array.isArray(record?.reviewers)) {
|
|
162
|
+
// A set was RECORDED, which is a different fact from the set being empty.
|
|
163
|
+
// The `deterministic` lane legitimately routes nobody; a round that never
|
|
164
|
+
// journalled a route knows nothing about who should have been launched.
|
|
165
|
+
pendingRoute = namesOf(record.reviewers);
|
|
166
|
+
}
|
|
167
|
+
if (gate === FAN_OUT) {
|
|
168
|
+
fanOutAt = index;
|
|
169
|
+
launchedNames = namesOf(record?.reviewers);
|
|
170
|
+
fanOutHead = typeof record?.headSha === 'string' ? record.headSha : null;
|
|
171
|
+
routeOfRound = pendingRoute;
|
|
172
|
+
pendingRoute = null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (pendingRoute !== null) {
|
|
177
|
+
return {
|
|
178
|
+
ok: false,
|
|
179
|
+
routed: uniq(pendingRoute),
|
|
180
|
+
launched: [],
|
|
181
|
+
neverLaunched: [],
|
|
182
|
+
unanswered: [],
|
|
183
|
+
unattributed: [],
|
|
184
|
+
stale: [],
|
|
185
|
+
reason:
|
|
186
|
+
'a routed reviewer set was journalled after the last fan-out, so the round ' +
|
|
187
|
+
'boundary is unreadable: either this round\'s fan-out record is missing, or the ' +
|
|
188
|
+
'router ran again after the fan-out. Rerun the fan-out step for this head so ' +
|
|
189
|
+
'the round it belongs to has a record.',
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const routeRecorded = routeOfRound !== null;
|
|
194
|
+
const routedNames = routeOfRound ?? [];
|
|
195
|
+
|
|
196
|
+
const routed = uniq(routedNames);
|
|
197
|
+
|
|
198
|
+
if (fanOutAt === -1) {
|
|
199
|
+
return {
|
|
200
|
+
ok: false,
|
|
201
|
+
routed,
|
|
202
|
+
launched: [],
|
|
203
|
+
neverLaunched: [],
|
|
204
|
+
unanswered: [],
|
|
205
|
+
unattributed: [],
|
|
206
|
+
stale: [],
|
|
207
|
+
reason:
|
|
208
|
+
'this run journalled no reviewer fan-out, so there is no set to check the verdicts ' +
|
|
209
|
+
'against. That is not a round with nothing outstanding — it is a round nothing can ' +
|
|
210
|
+
'read, and the two look identical from the lists alone.',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (fanOutHead === null) {
|
|
215
|
+
return {
|
|
216
|
+
ok: false,
|
|
217
|
+
routed: [],
|
|
218
|
+
launched: [],
|
|
219
|
+
neverLaunched: [],
|
|
220
|
+
unanswered: [],
|
|
221
|
+
unattributed: [],
|
|
222
|
+
stale: [],
|
|
223
|
+
reason:
|
|
224
|
+
'the last reviewer fan-out names no head commit, so it cannot be coverage of ' +
|
|
225
|
+
'this one. Rerun the fan-out step for this head and record the commit it launched.',
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (!sameCommit(fanOutHead, target)) {
|
|
230
|
+
return {
|
|
231
|
+
ok: false,
|
|
232
|
+
routed: [],
|
|
233
|
+
launched: [],
|
|
234
|
+
neverLaunched: [],
|
|
235
|
+
unanswered: [],
|
|
236
|
+
unattributed: [],
|
|
237
|
+
stale: [],
|
|
238
|
+
reason:
|
|
239
|
+
'the last reviewer fan-out names a different head commit, so its launched set ' +
|
|
240
|
+
'does not cover this one. Rerun the fan-out step for this head before reading verdicts.',
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const launched = uniq(launchedNames);
|
|
245
|
+
// Answers are the records that come AFTER the fan-out. A verdict from the
|
|
246
|
+
// previous round is still in the journal, and a reader that scanned the whole
|
|
247
|
+
// file would find an answer and report the current round covered.
|
|
248
|
+
const after = journal.slice(fanOutAt + 1);
|
|
249
|
+
|
|
250
|
+
// The lane is a floor and never a ceiling — the triggers may only ADD
|
|
251
|
+
// reviewers — so a launched set larger than the routed one is the ordinary
|
|
252
|
+
// case and is not a finding. Only the other direction is.
|
|
253
|
+
const neverLaunched = routed.filter((name) => !launched.includes(name));
|
|
254
|
+
|
|
255
|
+
const unanswered = [];
|
|
256
|
+
const unattributed = [];
|
|
257
|
+
const stale = [];
|
|
258
|
+
|
|
259
|
+
for (const name of launched) {
|
|
260
|
+
// Matched by gate name, which is what keeps another writer's record — the
|
|
261
|
+
// router's own line, `pr-ship`'s, a deploy verdict — from being read as a
|
|
262
|
+
// reviewer's answer.
|
|
263
|
+
const commits = after
|
|
264
|
+
.filter((record) => gateOf(record) === name)
|
|
265
|
+
.map((record) => record?.headSha)
|
|
266
|
+
.filter((commit) => typeof commit === 'string' && commit !== '');
|
|
267
|
+
|
|
268
|
+
const answered = after.some((record) => gateOf(record) === name);
|
|
269
|
+
if (!answered) {
|
|
270
|
+
unanswered.push(name);
|
|
271
|
+
} else if (commits.some((commit) => sameCommit(commit, target))) {
|
|
272
|
+
// Covered. A HOLD counts here exactly as a SHIP does: coverage is about
|
|
273
|
+
// who spoke for which commit, never about what they said.
|
|
274
|
+
} else if (commits.length === 0) {
|
|
275
|
+
unattributed.push(name);
|
|
276
|
+
} else {
|
|
277
|
+
stale.push(name);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const outstanding =
|
|
282
|
+
neverLaunched.length + unanswered.length + unattributed.length + stale.length;
|
|
283
|
+
|
|
284
|
+
return {
|
|
285
|
+
ok: routeRecorded && outstanding === 0,
|
|
286
|
+
routed,
|
|
287
|
+
launched,
|
|
288
|
+
neverLaunched,
|
|
289
|
+
unanswered,
|
|
290
|
+
unattributed,
|
|
291
|
+
stale,
|
|
292
|
+
// Unlike the missing fan-out, this one still has a launched set and answers
|
|
293
|
+
// to compare, so the four lists are computed and returned — the reason says
|
|
294
|
+
// which half of the check could not run, rather than replacing the half that
|
|
295
|
+
// could.
|
|
296
|
+
...(routeRecorded
|
|
297
|
+
? {}
|
|
298
|
+
: {
|
|
299
|
+
reason:
|
|
300
|
+
'this round journalled no routed reviewer set, so `neverLaunched` was compared ' +
|
|
301
|
+
'against nothing: a reviewer the route asked for and nobody launched would not ' +
|
|
302
|
+
'appear. An empty route that WAS recorded is a different answer, and so is a ' +
|
|
303
|
+
'route belonging to an earlier round — neither is this one.',
|
|
304
|
+
}),
|
|
305
|
+
};
|
|
306
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The revalidation points — ONE spelling of the fact (AR-137).
|
|
3
|
+
*
|
|
4
|
+
* `queue/index.mjs next` writes the SELECT record; `revalidate.mjs` writes the
|
|
5
|
+
* other two and answers outcomes at all three; `revalidation-report.mjs`
|
|
6
|
+
* counts all three. Before this module each carried its own list, and one
|
|
7
|
+
* computed a fourth (`['SELECT', ...POINTS]`). Four spellings of one fact is
|
|
8
|
+
* how a point gets added to the report and not to the script, silently.
|
|
9
|
+
*
|
|
10
|
+
* `REVALIDATES` is DERIVED, not restated: the asymmetry that SELECT is written
|
|
11
|
+
* elsewhere is encoded here once, where a reader looks for it.
|
|
12
|
+
*
|
|
13
|
+
* The prose that names these points is kept in step by a two-direction check —
|
|
14
|
+
* the generator's test/template/correspondence.test.ts › "every point the
|
|
15
|
+
* module knows is named by the loop or pr-ship skill, and vice versa".
|
|
16
|
+
*
|
|
17
|
+
* Maintenance and noise cost, recorded (AR-137): adding a point touches this
|
|
18
|
+
* list and the prose that names it as `--point X` or `point: X`, and the check
|
|
19
|
+
* says which side was forgotten. The check reads only the `loop` and `pr-ship`
|
|
20
|
+
* skills — a point named anywhere else is invisible to it — and it parses
|
|
21
|
+
* those two by that exact spelling, so a rewording breaks it loudly, as a named
|
|
22
|
+
* failure, never silently.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export const POINTS = Object.freeze(['SELECT', 'BEFORE_PR', 'BEFORE_CLOSE']);
|
|
26
|
+
|
|
27
|
+
/** What `revalidate.mjs` can revalidate itself: every point but SELECT. */
|
|
28
|
+
export const REVALIDATES = Object.freeze(POINTS.filter((point) => point !== 'SELECT'));
|