@feigi/fleet-ctl 3.23.36 → 3.23.37
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/package.json +1 -1
- package/scripts/main-checkout.mjs +1 -1
- package/scripts/member-write-guard.mjs +1 -1
- package/scripts/repo-root.mjs +1 -1
- package/skills/run-team/references/reaping.md +1 -1
- package/scripts/agent-test-dir-prose.test.mjs +0 -59
- package/scripts/agent-test.test.mjs +0 -1640
- package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
- package/scripts/ambient-git-vars-prose.test.mjs +0 -192
- package/scripts/ancestry-check-position-prose.test.mjs +0 -175
- package/scripts/apply-ruleset.test.mjs +0 -421
- package/scripts/arg-header-probes-prose.test.mjs +0 -394
- package/scripts/arg.test.mjs +0 -1354
- package/scripts/board-cli.test.mjs +0 -710
- package/scripts/board-identity.test.mjs +0 -429
- package/scripts/board-liveness-banner.test.mjs +0 -119
- package/scripts/board-prev-shape.test.mjs +0 -228
- package/scripts/board-tryparse-null.test.mjs +0 -119
- package/scripts/board.test.mjs +0 -3121
- package/scripts/brief-after-cut-prose.test.mjs +0 -53
- package/scripts/candidates-exit3-prose.test.mjs +0 -302
- package/scripts/candidates.test.mjs +0 -2312
- package/scripts/caveat-unification-prose.test.mjs +0 -98
- package/scripts/cell-readout.test.mjs +0 -615
- package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
- package/scripts/ci-completes-premise-prose.test.mjs +0 -257
- package/scripts/ci-state-prose.test.mjs +0 -113
- package/scripts/ci-state.test.mjs +0 -1933
- package/scripts/ci-vacuous-green.test.mjs +0 -368
- package/scripts/citation-sweep-prose.test.mjs +0 -1712
- package/scripts/claim-lifecycle.test.mjs +0 -187
- package/scripts/claim-ticket.test.mjs +0 -1122
- package/scripts/closing-keyword-prose.test.mjs +0 -193
- package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
- package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
- package/scripts/compute-board.test.mjs +0 -1214
- package/scripts/compute-spend.test.mjs +0 -517
- package/scripts/consumer-technology-prose.test.mjs +0 -126
- package/scripts/cross-repo-citation-prose.test.mjs +0 -155
- package/scripts/cwd-isolation-pins.mjs +0 -83
- package/scripts/dedupe-guard-prose.test.mjs +0 -243
- package/scripts/delete-merged-branch.test.mjs +0 -576
- package/scripts/derive-testcmd.test.mjs +0 -595
- package/scripts/diff-stats.test.mjs +0 -404
- package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
- package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
- package/scripts/dispositions-check.test.mjs +0 -936
- package/scripts/dispositions-gate-prose.test.mjs +0 -129
- package/scripts/drop-merged-label.test.mjs +0 -479
- package/scripts/exec-stub.mjs +0 -93
- package/scripts/exec-stub.test.mjs +0 -69
- package/scripts/expected-jobs-prose.test.mjs +0 -80
- package/scripts/fan-out-authorization-prose.test.mjs +0 -80
- package/scripts/filing-bar-seat-prose.test.mjs +0 -242
- package/scripts/filing-claim-bar-prose.test.mjs +0 -166
- package/scripts/finisher-died-prose.test.mjs +0 -31
- package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
- package/scripts/finisher-halt-prose.test.mjs +0 -106
- package/scripts/finisher-name-prose.test.mjs +0 -134
- package/scripts/finisher-own-tree-prose.test.mjs +0 -299
- package/scripts/finisher-pin-race-prose.test.mjs +0 -339
- package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
- package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
- package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
- package/scripts/fleet-bootstrap.test.mjs +0 -75
- package/scripts/fleet-heartbeat.test.mjs +0 -450
- package/scripts/fleet-provenance.test.mjs +0 -138
- package/scripts/fleet-run.test.mjs +0 -90
- package/scripts/fleet-state.test.mjs +0 -460
- package/scripts/fleet-tick-prose.test.mjs +0 -300
- package/scripts/fleet-tick.test.mjs +0 -2444
- package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
- package/scripts/frontmatter-check.test.mjs +0 -436
- package/scripts/git-env.test.mjs +0 -149
- package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
- package/scripts/gone-walk.test.mjs +0 -213
- package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
- package/scripts/head-moved-after-label-prose.test.mjs +0 -233
- package/scripts/immutable-body-claim-prose.test.mjs +0 -204
- package/scripts/implementer-model-tier.test.mjs +0 -235
- package/scripts/inflight-citation-prose.test.mjs +0 -144
- package/scripts/inflight-exit2-prose.test.mjs +0 -81
- package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
- package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
- package/scripts/inflight.test.mjs +0 -2882
- package/scripts/injection-control-prose.test.mjs +0 -404
- package/scripts/install-root-audit.test.mjs +0 -464
- package/scripts/instrument-check-prose.test.mjs +0 -235
- package/scripts/instruments.test.mjs +0 -787
- package/scripts/is-cli.test.mjs +0 -99
- package/scripts/issue-tracker-prose.test.mjs +0 -71
- package/scripts/json.test.mjs +0 -364
- package/scripts/ledger-dispatch.test.mjs +0 -927
- package/scripts/ledger-grammar.test.mjs +0 -227
- package/scripts/ledger-read-require-file.test.mjs +0 -197
- package/scripts/ledger-rotate.test.mjs +0 -142
- package/scripts/ledger.test.mjs +0 -3436
- package/scripts/line-distance-prose.test.mjs +0 -245
- package/scripts/liveness-rationale-prose.test.mjs +0 -83
- package/scripts/locale-pin-prose.test.mjs +0 -189
- package/scripts/main-checkout.test.mjs +0 -332
- package/scripts/member-outcome-prose.test.mjs +0 -167
- package/scripts/member-outcomes-header.test.mjs +0 -129
- package/scripts/member-outcomes-prose.test.mjs +0 -63
- package/scripts/member-outcomes.test.mjs +0 -638
- package/scripts/member-prompt-prose.test.mjs +0 -165
- package/scripts/member-record.test.mjs +0 -541
- package/scripts/member-write-guard.test.mjs +0 -214
- package/scripts/merge-commit-probe-prose.test.mjs +0 -122
- package/scripts/merge-gate.test.mjs +0 -613
- package/scripts/muted-git-guard-sweep.test.mjs +0 -493
- package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
- package/scripts/net-watchdog-prose.test.mjs +0 -79
- package/scripts/net.test.mjs +0 -211
- package/scripts/no-ci-gate-prose.test.mjs +0 -108
- package/scripts/no-undo-audit.test.mjs +0 -3961
- package/scripts/no-wave.test.mjs +0 -138
- package/scripts/node-floor-sweep.test.mjs +0 -611
- package/scripts/pointer-target-prose.test.mjs +0 -186
- package/scripts/pr-cost.test.mjs +0 -521
- package/scripts/pr-overlap.test.mjs +0 -692
- package/scripts/printf-die-sweep.test.mjs +0 -384
- package/scripts/prompt-renderer.mjs +0 -40
- package/scripts/prompt-renderer.test.mjs +0 -68
- package/scripts/prose-pin.mjs +0 -807
- package/scripts/prose-pin.test.mjs +0 -1034
- package/scripts/prove-merge.test.mjs +0 -995
- package/scripts/pull-table-relabel-prose.test.mjs +0 -60
- package/scripts/quiet-payload-prose.test.mjs +0 -222
- package/scripts/reap-cherry-check-prose.test.mjs +0 -80
- package/scripts/reap.test.mjs +0 -4432
- package/scripts/reaping-prose.test.mjs +0 -239
- package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
- package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
- package/scripts/recipe-derivation-prose.test.mjs +0 -112
- package/scripts/recipe-prove.test.mjs +0 -1042
- package/scripts/refuter-scratch-prose.test.mjs +0 -135
- package/scripts/release-label-required-prose.test.mjs +0 -71
- package/scripts/release-label-split-prose.test.mjs +0 -184
- package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
- package/scripts/release-ticket.test.mjs +0 -5099
- package/scripts/renovate-release-contract.test.mjs +0 -379
- package/scripts/repo-root.test.mjs +0 -873
- package/scripts/reporter-output-rule-prose.test.mjs +0 -208
- package/scripts/review-agent-report-only.test.mjs +0 -49
- package/scripts/review-core-booking.test.mjs +0 -35
- package/scripts/review-core-cwd-isolation.test.mjs +0 -374
- package/scripts/review-core-reads.test.mjs +0 -478
- package/scripts/review-core-refuter-scratch.test.mjs +0 -148
- package/scripts/review-core-scratch-refusal.test.mjs +0 -64
- package/scripts/review-core-shared-test-run.test.mjs +0 -275
- package/scripts/review-core-snapshot-path.test.mjs +0 -830
- package/scripts/review-core-specialist-scratch.test.mjs +0 -191
- package/scripts/review-core-testcmd.test.mjs +0 -335
- package/scripts/review-core-unrun.test.mjs +0 -566
- package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
- package/scripts/review-eval-resolver-path.test.mjs +0 -55
- package/scripts/review-host-fixture.mjs +0 -89
- package/scripts/review-in-run-retry.test.mjs +0 -211
- package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
- package/scripts/review-path-default.test.mjs +0 -796
- package/scripts/review-runner-spawns.test.mjs +0 -95
- package/scripts/review-runner.test.mjs +0 -166
- package/scripts/review-tier-audit.test.mjs +0 -140
- package/scripts/run-artifact-pr-prose.test.mjs +0 -341
- package/scripts/run-merge-bot-prose.test.mjs +0 -1413
- package/scripts/run-team-local-hook.test.mjs +0 -442
- package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
- package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
- package/scripts/section-between-guard-prose.test.mjs +0 -379
- package/scripts/select-dimensions.test.mjs +0 -674
- package/scripts/shared-refusal.test.mjs +0 -388
- package/scripts/shell-traps-prose.test.mjs +0 -504
- package/scripts/shortlist.test.mjs +0 -380
- package/scripts/slow-transport.mjs +0 -72
- package/scripts/snapshot-repo.test.mjs +0 -1006
- package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
- package/scripts/spend-view.test.mjs +0 -312
- package/scripts/staleness-qualifier-prose.test.mjs +0 -251
- package/scripts/staleness-verdict-prose.test.mjs +0 -142
- package/scripts/staleness.test.mjs +0 -893
- package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
- package/scripts/stash-prohibition-prose.test.mjs +0 -313
- package/scripts/strip-comments.mjs +0 -44
- package/scripts/temp-dir.mjs +0 -47
- package/scripts/ticket-router.test.mjs +0 -981
- package/scripts/tier-check.test.mjs +0 -828
- package/scripts/tier-outcomes-header.test.mjs +0 -518
- package/scripts/tier-outcomes.test.mjs +0 -572
- package/scripts/tier-roles.test.mjs +0 -535
- package/scripts/tracker-block-copy-prose.test.mjs +0 -288
- package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
- package/scripts/unattended-git-sweep.test.mjs +0 -142
- package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
- package/scripts/verify-sha.test.mjs +0 -692
- package/scripts/watcher-degraded-block.test.mjs +0 -369
- package/scripts/watcher-key-prose.test.mjs +0 -106
- package/scripts/within-run-pair-prose.test.mjs +0 -212
- package/scripts/worktree-audit.test.mjs +0 -1408
- package/scripts/worktree-head-prose.test.mjs +0 -276
- package/scripts/worktree-listing-sweep.test.mjs +0 -217
- package/scripts/worktree-model-prose.test.mjs +0 -216
- package/scripts/worktree-porcelain.mjs +0 -35
- package/scripts/worktree-porcelain.test.mjs +0 -102
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { test } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { stripComments } from "./strip-comments.mjs";
|
|
6
|
-
import { between, phrase } from "./prose-pin.mjs";
|
|
7
|
-
import { verdictFor, resumeFor } from "./review-core.mjs";
|
|
8
|
-
|
|
9
|
-
// The band `unverified` had two producers and one shape. A `suggestion` skips
|
|
10
|
-
// the adversarial pass because the workflow budgets that band 0 refuters, and a
|
|
11
|
-
// finding whose refuters were all dispatched and all died reaches the same band
|
|
12
|
-
// with the same empty vote list — so a consumer read "nothing looked, on
|
|
13
|
-
// purpose" and "nothing looked, by accident" off byte-identical objects (#591).
|
|
14
|
-
//
|
|
15
|
-
// Nothing in this suite could see that: both shapes were produced inside the
|
|
16
|
-
// verify closure, which no test can reach, and the two were equal anyway, so
|
|
17
|
-
// even a test that reached them would have had nothing to assert a difference
|
|
18
|
-
// against. This file is that missing eye — it drives BOTH shapes and asserts
|
|
19
|
-
// they differ.
|
|
20
|
-
//
|
|
21
|
-
// Pins that read source read CODE, not SOURCE: `stripComments` exists because
|
|
22
|
-
// pins in this directory were measured vacuous against a field commented out
|
|
23
|
-
// (see strip-comments.mjs), and a pin written against raw source passes with
|
|
24
|
-
// the thing it pins dead.
|
|
25
|
-
const REPO = join(import.meta.dirname, "..");
|
|
26
|
-
const SOURCE = readFileSync(join(REPO, "scripts", "review-core.mjs"), "utf8");
|
|
27
|
-
const CODE = stripComments(SOURCE);
|
|
28
|
-
|
|
29
|
-
// --- the discriminant -----------------------------------------------------
|
|
30
|
-
|
|
31
|
-
// #591's case, and the only assertion that would have caught the defect: both
|
|
32
|
-
// calls are the `unverified` band, both carry no surviving vote, and a consumer
|
|
33
|
-
// must still be able to tell them apart from the payload alone.
|
|
34
|
-
test("a policy skip and a crash reach the same band and differ on refutersDispatched", () => {
|
|
35
|
-
const skipped = verdictFor(0, []);
|
|
36
|
-
const crashed = verdictFor(2, [null, null]);
|
|
37
|
-
|
|
38
|
-
assert.equal(skipped.verdict, "unverified", "a band with 0 refuters budgeted is not unverified");
|
|
39
|
-
assert.equal(crashed.verdict, "unverified", "every refuter died and the finding did not land in unverified");
|
|
40
|
-
|
|
41
|
-
// The vote list is what a consumer had BEFORE this field, and it is equal on
|
|
42
|
-
// both — pinned here so the discriminant cannot quietly become "read the
|
|
43
|
-
// votes", which is the read that could not tell them apart.
|
|
44
|
-
assert.deepEqual(skipped.votes, [], "a policy skip carries votes that were never cast");
|
|
45
|
-
assert.deepEqual(crashed.votes, [], "a crashed refuter left a vote behind — `votes` no longer filters the dead");
|
|
46
|
-
|
|
47
|
-
assert.equal(skipped.refutersDispatched, 0, "a policy skip reports refuters it never dispatched");
|
|
48
|
-
assert.ok(
|
|
49
|
-
crashed.refutersDispatched > 0,
|
|
50
|
-
"a finding whose refuters all crashed reports none dispatched — indistinguishable from a policy skip again (#591)",
|
|
51
|
-
);
|
|
52
|
-
assert.notDeepEqual(
|
|
53
|
-
skipped,
|
|
54
|
-
crashed,
|
|
55
|
-
"the two populations are byte-identical again — this is the defect #591 fixed, restored",
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// The other half, and the one a suite of only-crashed fixtures would not pin:
|
|
60
|
-
// what this must still ACCEPT. Routing both `unverified` producers through one
|
|
61
|
-
// function is a restructure, and a restructure that changed the majority rule
|
|
62
|
-
// would pass every assertion above while silently re-banding real findings.
|
|
63
|
-
test("the majority rule survives the extraction — a live vote list still bands as it did", () => {
|
|
64
|
-
const yes = { refuted: false };
|
|
65
|
-
const no = { refuted: true };
|
|
66
|
-
|
|
67
|
-
assert.equal(verdictFor(2, [yes, yes]).verdict, "survived", "an unrefuted finding no longer survives");
|
|
68
|
-
assert.equal(verdictFor(2, [no, no]).verdict, "refuted", "a unanimously refuted finding no longer refutes");
|
|
69
|
-
// The tie is `refuted * 2 >= live.length`, so a 1-1 split refutes. Pinned
|
|
70
|
-
// because it is the branch an inverted comparison keeps green on every other
|
|
71
|
-
// input, and because it is the one the controller is told to read the votes
|
|
72
|
-
// on rather than the band.
|
|
73
|
-
assert.equal(verdictFor(2, [yes, no]).verdict, "refuted", "a 1-1 split no longer refutes");
|
|
74
|
-
// A dead refuter alongside live ones is filtered, so it neither votes nor
|
|
75
|
-
// changes the denominator: one live unrefuted vote out of two dispatched is
|
|
76
|
-
// survived, not a tie.
|
|
77
|
-
assert.equal(verdictFor(2, [yes, null]).verdict, "survived", "a crashed refuter is being counted as a vote");
|
|
78
|
-
assert.equal(
|
|
79
|
-
verdictFor(3, [yes, null]).refutersDispatched,
|
|
80
|
-
3,
|
|
81
|
-
"refutersDispatched reports the surviving votes rather than the dispatch — the count that makes a crash visible",
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// --- the call sites -------------------------------------------------------
|
|
86
|
-
|
|
87
|
-
// The lift proves `verdictFor` classifies correctly; it cannot prove the script
|
|
88
|
-
// calls it. Both producers of the band are pinned as text, because a call site
|
|
89
|
-
// is the half no lifted function can see — and one of the two calling it while
|
|
90
|
-
// the other keeps its own inline copy is exactly the state #591 describes.
|
|
91
|
-
//
|
|
92
|
-
// Each is pinned as the WHOLE returned expression, spread included, and not as
|
|
93
|
-
// a span that any mention of `verdictFor` inside it satisfies. A span is the
|
|
94
|
-
// weaker pin and it does not hold: `stripComments` documents its own ceiling —
|
|
95
|
-
// an inline `/* */` and a trailing `//` keep their text — so a revert that
|
|
96
|
-
// rebuilds the object inline and leaves the call named in a surviving comment
|
|
97
|
-
// puts the pinned token back where the span reads it. Measured on both spans
|
|
98
|
-
// while they were still written that way: each revert passed with its comment
|
|
99
|
-
// and failed without it, which is the pin discriminating on comment text.
|
|
100
|
-
test("both producers of the unverified band route through verdictFor", () => {
|
|
101
|
-
assert.match(
|
|
102
|
-
CODE,
|
|
103
|
-
/if \(n === 0\) return Promise\.resolve\(\{ \.\.\.f, dimension: d\.key, \.\.\.verdictFor\(0, \[\]\) \}\);/,
|
|
104
|
-
"the policy-skip branch builds its own verdict again instead of routing through verdictFor (#591)",
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
// #1813 (crash isolation) turned the single-argument `.then((votes) => {...})`
|
|
108
|
-
// into a two-argument `.then(onFulfilled, onRejected)`: a `retryCrashed`
|
|
109
|
-
// rejection (both dispatches of the refuter pair crashed) must still land
|
|
110
|
-
// in `unverified` through `verdictFor`, not propagate into the shared
|
|
111
|
-
// `Promise.all` and erase every OTHER finding in the dimension. Both
|
|
112
|
-
// branches are pinned in the SAME `.then(...)` call — a revert that keeps
|
|
113
|
-
// the rejected branch but drops the fulfilled one (or the reverse) fails
|
|
114
|
-
// this just as a revert to the old single-argument shape does.
|
|
115
|
-
assert.match(
|
|
116
|
-
CODE,
|
|
117
|
-
/\.then\(\s*\(votes\) => \(\{ \.\.\.f, dimension: d\.key, \.\.\.verdictFor\(n, votes\) \}\),\s*\(\) => \(\{ \.\.\.f, dimension: d\.key, \.\.\.verdictFor\(n, \[\]\) \}\),\s*\);/,
|
|
118
|
-
"the post-refuter .then() no longer routes both the fulfilled and the crashed-refuter branch through verdictFor (#591, #1813)",
|
|
119
|
-
);
|
|
120
|
-
// The dispatched count is what the discriminant IS, so a call passing a
|
|
121
|
-
// literal or a re-derived value would pin nothing. `n` is the value the
|
|
122
|
-
// policy-skip branch tests, which is what makes the field free.
|
|
123
|
-
assert.match(CODE, /const n = verifiersForRun\(f\.severity\)/, "the dispatched count is no longer `n` — update this test");
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// --- the resume path ------------------------------------------------------
|
|
127
|
-
|
|
128
|
-
// A crash-heavy `unverified` is DEFERRED: omp's eval has no cached-replay
|
|
129
|
-
// mechanism (ADR 0004/0005, #1349 gap 1), so a relaunch re-dispatches every
|
|
130
|
-
// agent() live rather than resuming only the calls that died — the response
|
|
131
|
-
// is defer, reported and not acted on. That was true before this ticket and
|
|
132
|
-
// was written down nowhere a reader of the result would meet it.
|
|
133
|
-
test("the returned object carries resume alongside the three bands", () => {
|
|
134
|
-
const tail = CODE.slice(CODE.lastIndexOf("return {"));
|
|
135
|
-
for (const key of ["survived", "refuted", "unverified"]) {
|
|
136
|
-
assert.match(tail, new RegExp(`\\b${key}\\b`), `the return no longer surfaces ${key} — an existing consumer just broke`);
|
|
137
|
-
}
|
|
138
|
-
assert.match(tail, /\bresume\b/, "the return never surfaces resume — the recovery path dies in the script (#591)");
|
|
139
|
-
assert.match(
|
|
140
|
-
CODE,
|
|
141
|
-
/reported, not acted on/,
|
|
142
|
-
"the resume string no longer tells the reader what to do with a crashed population — omp has no cached-replay mechanism, so the instruction is defer, not relaunch",
|
|
143
|
-
);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// The field being present is not the field being right. This drives the real
|
|
147
|
-
// classification over both populations of the band — the half `resume` exists
|
|
148
|
-
// for and the half it must stay quiet on — because a source-text pin on the
|
|
149
|
-
// predicate that separates them passes against its own deletion: measured while
|
|
150
|
-
// the filter was still inline at the report block, deleting it left this file's
|
|
151
|
-
// tests green.
|
|
152
|
-
test("the crash population is the dispatched-refuter half of unverified, and only it arms resume", () => {
|
|
153
|
-
const skipped = { severity: "suggestion", verdict: "unverified", votes: [], refutersDispatched: 0 };
|
|
154
|
-
const crashed = { severity: "critical", verdict: "unverified", votes: [], refutersDispatched: 2 };
|
|
155
|
-
|
|
156
|
-
const quiet = resumeFor([skipped]);
|
|
157
|
-
assert.deepEqual(quiet.crashed, [], "a policy skip counts as a crashed refuter — the two populations read alike again (#591)");
|
|
158
|
-
assert.equal(quiet.resume, null, "a run where nothing died is told to relaunch — the instruction is boilerplate, not a signal");
|
|
159
|
-
|
|
160
|
-
const armed = resumeFor([skipped, crashed]);
|
|
161
|
-
assert.deepEqual(armed.crashed, [crashed], "the crash population no longer separates a dead refuter from a policy skip (#591)");
|
|
162
|
-
assert.match(
|
|
163
|
-
armed.resume,
|
|
164
|
-
/reported, not acted on/,
|
|
165
|
-
"refuters died and the payload names no way to recover them — the findings nobody looked at get deferred instead",
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
// The classification above is reachable from a test whether or not the report
|
|
169
|
-
// block still calls it, so the call is pinned too — dropping the call is the
|
|
170
|
-
// mutation this file stayed green against.
|
|
171
|
-
assert.match(
|
|
172
|
-
CODE,
|
|
173
|
-
/const \{ crashed, resume \} = resumeFor\(unverified\);/,
|
|
174
|
-
"the report no longer derives its crash population and resume from resumeFor (#591)",
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// --- the reading rules ----------------------------------------------------
|
|
179
|
-
|
|
180
|
-
// The rule that saves a reader — a finding whose refuters ran and crashed
|
|
181
|
-
// always defers — predates the field it can now be checked against, and it
|
|
182
|
-
// lived in more than one file. A rule re-expressed in one copy and left resting
|
|
183
|
-
// on the reader in the other is the defect moved, not fixed.
|
|
184
|
-
const RULE_FILES = [
|
|
185
|
-
["commands/review-and-fix.md", "A finding in `unverified` whose refuters ran and", "Only a `survived` finding"],
|
|
186
|
-
["skills/run-team/SKILL.md", "Apply `survived` findings. A finding in `unverified`", "Severity records how much"],
|
|
187
|
-
];
|
|
188
|
-
|
|
189
|
-
for (const [rel, from, to] of RULE_FILES) {
|
|
190
|
-
test(`${rel}'s crashed-refuter rule cites the discriminant`, () => {
|
|
191
|
-
const doc = readFileSync(join(REPO, rel), "utf8");
|
|
192
|
-
const rule = between(doc, from, to, rel);
|
|
193
|
-
assert.match(
|
|
194
|
-
rule,
|
|
195
|
-
phrase("refutersDispatched"),
|
|
196
|
-
`${rel} still asks the reader to remember which population a finding is in — the rule names no field to check (#591)`,
|
|
197
|
-
);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// The controller is the other reader, and it meets the return shape rather than
|
|
202
|
-
// the apply rule. A field nobody is told to read is a field nobody reads.
|
|
203
|
-
test("run-team's Reviewers section documents the discriminant and the resume path", () => {
|
|
204
|
-
const doc = readFileSync(join(REPO, "skills/run-team/SKILL.md"), "utf8");
|
|
205
|
-
const shape = between(doc, "It returns `{pr, head, resume, testEnvironment,", "**`dimensionsRun` is the dispatch", "run-team/SKILL.md");
|
|
206
|
-
assert.match(shape, phrase("refutersDispatched"), "run-team/SKILL.md documents a return shape whose two unverified populations still read alike");
|
|
207
|
-
assert.match(shape, phrase("resume"), "run-team/SKILL.md documents the crashed band without the recovery it has");
|
|
208
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { test } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync, existsSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
|
-
// Review finding on #1349's PR (#1361): `fleet-run scriptPathFor` joins
|
|
7
|
-
// `path.join(installPath, "scripts", script)` — the Resolver ALREADY places
|
|
8
|
-
// the caller under `scripts/`, and does no existence check on the result
|
|
9
|
-
// (`--path` "print the resolved path; do not exec"). Every prose site that
|
|
10
|
-
// told a caller to run `fleet-run --path scripts/review-eval.mjs` therefore
|
|
11
|
-
// resolved to `<installPath>/scripts/scripts/review-eval.mjs` — a path one
|
|
12
|
-
// level too deep that would only fail LOUDLY once something tried to
|
|
13
|
-
// `import()` it, never at the Resolver call itself. The correct invocation
|
|
14
|
-
// is `--path review-eval.mjs`, bare — `scripts/` is implicit.
|
|
15
|
-
//
|
|
16
|
-
// This is the existence check the Resolver itself does not perform: pin it
|
|
17
|
-
// here, against this repo's own `plugin/` tree standing in for an install
|
|
18
|
-
// root (`scriptPathFor`'s own join, replicated rather than imported — the
|
|
19
|
-
// Resolver is a standalone file placed outside the plugin by hand, per its
|
|
20
|
-
// own header, and importing it would need it to travel with a module it
|
|
21
|
-
// does not carry).
|
|
22
|
-
const REPO = join(import.meta.dirname, "..");
|
|
23
|
-
|
|
24
|
-
function scriptPathFor(installPath, script) {
|
|
25
|
-
return join(installPath, "scripts", script);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
test("the correct --path form resolves to a file that actually exists", () => {
|
|
29
|
-
const correct = scriptPathFor(REPO, "review-eval.mjs");
|
|
30
|
-
assert.ok(existsSync(correct), `${correct} does not exist — review-eval.mjs moved or was renamed`);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("the double-scripts/ form (the mistake this pins against) does not exist", () => {
|
|
34
|
-
const wrong = scriptPathFor(REPO, "scripts/review-eval.mjs");
|
|
35
|
-
assert.ok(
|
|
36
|
-
!existsSync(wrong),
|
|
37
|
-
`${wrong} exists — either a stray directory was created, or scriptPathFor's join changed and the prose sites need re-checking`,
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// The prose sites: review-eval.mjs's own usage comment, plus every doc site
|
|
42
|
-
// that tells a caller how to load it. All three must spell the bare form.
|
|
43
|
-
const SITES = [
|
|
44
|
-
{ path: ["scripts", "review-eval.mjs"], what: "review-eval.mjs's own usage comment" },
|
|
45
|
-
{ path: ["commands", "review-and-fix.md"], what: "review-and-fix.md's OMP invocation line" },
|
|
46
|
-
{ path: ["skills", "run-team", "SKILL.md"], what: "SKILL.md's OMP invocation line" },
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
for (const { path, what } of SITES) {
|
|
50
|
-
test(`${what} spells the bare --path form, never the doubled scripts/ one`, () => {
|
|
51
|
-
const text = readFileSync(join(REPO, ...path), "utf8");
|
|
52
|
-
assert.match(text, /--path review-eval\.mjs\b/, `${what} no longer names the correct --path invocation`);
|
|
53
|
-
assert.doesNotMatch(text, /--path scripts\/review-eval\.mjs/, `${what} regressed to the doubled scripts/ form`);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// Shared `runReview(host, args)` test double, extracted from
|
|
2
|
-
// review-in-run-retry.test.mjs so review-path-default.test.mjs's own return-
|
|
3
|
-
// shape pin can drive a REAL `runReview` call instead of re-parsing
|
|
4
|
-
// review-core.mjs's source text for its `return {` — the retired script's
|
|
5
|
-
// own return literal was the ONLY thing that pin ever read;
|
|
6
|
-
// ADR 0014 (omp-only) leaves review-core.mjs as the one body to run.
|
|
7
|
-
//
|
|
8
|
-
// review-core.mjs's own pipeline contract, mirrored here: a null stage-1
|
|
9
|
-
// result never reaches stage 2, with a throw landing in the same null slot —
|
|
10
|
-
// the shape `defaultPipeline` (review-core.mjs) already has, restated as a
|
|
11
|
-
// scripted double so a caller needs no host beyond what it drives itself.
|
|
12
|
-
export async function pipeline(items, stage1, stage2) {
|
|
13
|
-
return Promise.all(
|
|
14
|
-
items.map(async (item) => {
|
|
15
|
-
let r1;
|
|
16
|
-
try {
|
|
17
|
-
r1 = await stage1(item);
|
|
18
|
-
} catch {
|
|
19
|
-
r1 = null;
|
|
20
|
-
}
|
|
21
|
-
if (!r1) return null;
|
|
22
|
-
try {
|
|
23
|
-
return await stage2(r1, item);
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
export const parallel = (fns) => Promise.all(fns.map((fn) => fn()));
|
|
31
|
-
|
|
32
|
-
export const ARGS = { pr: 7, branch: "feature/x", worktree: "/repo/.worktrees/7-x", scratch: "/scr", testCmd: "node --test", dimensions: ["correctness"] };
|
|
33
|
-
export const SNAP = {
|
|
34
|
-
runRoot: "/scr/pr7/run-ab12",
|
|
35
|
-
path: "/scr/pr7/run-ab12/snapshot-abc123",
|
|
36
|
-
head: "abc123",
|
|
37
|
-
pathVerified: true,
|
|
38
|
-
repoVerified: true,
|
|
39
|
-
testCmd: "node --test",
|
|
40
|
-
};
|
|
41
|
-
// #2315. The shared test run's agent report — the `test-run` dispatch every
|
|
42
|
-
// review makes once, before any specialist. Clean, so a script that is about
|
|
43
|
-
// something else need not answer it; one that is about it names its own.
|
|
44
|
-
export const SHARED = { exitCode: 0, tests: 5, pass: 5, fail: 0 };
|
|
45
|
-
export const review = (findings) => ({
|
|
46
|
-
dimension: "correctness",
|
|
47
|
-
scope_searched: "CWD-AUDIT: clean /repo",
|
|
48
|
-
findings,
|
|
49
|
-
});
|
|
50
|
-
export const finding = (severity) => ({ severity, claim: `a ${severity} claim`, file: "a.js", line: 3, evidence: "line 3 has no else" });
|
|
51
|
-
export const vote = (refuted) => ({ refuted, reason: "measured. CWD-AUDIT: clean /repo" });
|
|
52
|
-
|
|
53
|
-
// A host whose `agent()` answers each dispatch label from a script, one entry
|
|
54
|
-
// per call in dispatch order (the last entry repeats), and counts the calls.
|
|
55
|
-
// An `Error` entry is thrown rather than returned. Counting happens
|
|
56
|
-
// synchronously on the call, so the two refuters of one pair are calls 1 and
|
|
57
|
-
// 2 of their label, and a re-dispatched pair is calls 3 and 4. A script with
|
|
58
|
-
// no `test-run` entry gets `[SHARED]` for it; every other unscripted label
|
|
59
|
-
// throws. `prompts` records each dispatch's prompt under its label.
|
|
60
|
-
//
|
|
61
|
-
// Every label review-core.mjs dispatches ends in `:pr<N>`; scripts, `calls`
|
|
62
|
-
// and `prompts` key on the label WITHOUT it (`review:correctness`), so a case
|
|
63
|
-
// reads the same whatever PR it reviews. `labels` keeps each label as
|
|
64
|
-
// dispatched, in order.
|
|
65
|
-
export function scriptedHost(script) {
|
|
66
|
-
const calls = {};
|
|
67
|
-
const prompts = {};
|
|
68
|
-
const labels = [];
|
|
69
|
-
return {
|
|
70
|
-
calls,
|
|
71
|
-
prompts,
|
|
72
|
-
labels,
|
|
73
|
-
host: {
|
|
74
|
-
agent: async (prompt, opts) => {
|
|
75
|
-
labels.push(opts.label);
|
|
76
|
-
const label = opts.label.replace(/:pr\d+$/, "");
|
|
77
|
-
const n = (calls[label] = (calls[label] ?? 0) + 1);
|
|
78
|
-
(prompts[label] ??= []).push(prompt);
|
|
79
|
-
const seq = script[label] ?? (label === "test-run" ? [SHARED] : undefined);
|
|
80
|
-
if (!seq) throw new Error(`scriptedHost: unexpected dispatch ${opts.label}`);
|
|
81
|
-
const answer = seq[Math.min(n, seq.length) - 1];
|
|
82
|
-
if (answer instanceof Error) throw answer;
|
|
83
|
-
return answer === null ? null : structuredClone(answer);
|
|
84
|
-
},
|
|
85
|
-
phase: () => {},
|
|
86
|
-
log: () => {},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
// #1802 (spec docs/specs/2026-09-24-slot-based-fleet-loop-design.md § 3 §2, §6).
|
|
2
|
-
// Two changes to the review's own result, in review-core.mjs's own body:
|
|
3
|
-
//
|
|
4
|
-
// 1. Crash repair inside the run. Each crashed specialist is re-dispatched
|
|
5
|
-
// once, and each refuter pair whose every vote died is re-dispatched once
|
|
6
|
-
// as a pair, before the result is assembled. What still fails lands in
|
|
7
|
-
// `dimensionsUnrun` / `unverified` as before, and `resume` now means
|
|
8
|
-
// "crashed again after the in-run retry".
|
|
9
|
-
// 2. Digest first. The small fields a controller acts on lead the returned
|
|
10
|
-
// object and the bulky finding arrays trail it, so a large review's
|
|
11
|
-
// digest is available without depending on (or risking truncation from)
|
|
12
|
-
// the finding arrays that follow it (before this, `resume` was LAST).
|
|
13
|
-
//
|
|
14
|
-
// Driven through a SCRIPTED HOST rather than a mocked runReview: `agent`,
|
|
15
|
-
// `pipeline`, `parallel`, `phase`, `log` are exactly the parameters
|
|
16
|
-
// runReview takes off `host`, so the retry and the digest ordering are
|
|
17
|
-
// exercised as review-core.mjs's own wiring runs them, never a re-derived
|
|
18
|
-
// copy of what that wiring is supposed to do. The fixtures below are shared
|
|
19
|
-
// with review-path-default.test.mjs's own return-shape pin, via
|
|
20
|
-
// review-host-fixture.mjs.
|
|
21
|
-
import { test } from "node:test";
|
|
22
|
-
import assert from "node:assert/strict";
|
|
23
|
-
import { runReview, DIGEST_KEYS, digestOf } from "./review-core.mjs";
|
|
24
|
-
import { pipeline, parallel, ARGS, SNAP, SHARED, review, finding, vote, scriptedHost } from "./review-host-fixture.mjs";
|
|
25
|
-
|
|
26
|
-
const COPIES = [["review-core.mjs", (host, args) => runReview({ ...host, pipeline, parallel }, args)]];
|
|
27
|
-
|
|
28
|
-
for (const [name, run] of COPIES) {
|
|
29
|
-
test(`${name}: a specialist that crashes once is re-dispatched, and its review lands`, async () => {
|
|
30
|
-
const { host, calls } = scriptedHost({ snapshot: [SNAP], "review:correctness": [null, review([])] });
|
|
31
|
-
const result = await run(host, ARGS);
|
|
32
|
-
assert.equal(calls["review:correctness"], 2, "a crashed specialist was not re-dispatched in-run");
|
|
33
|
-
assert.deepEqual(result.dimensionsUnrun, [], "the re-dispatched specialist's review was not used");
|
|
34
|
-
assert.equal(result.cwdAudit.length, 1);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test(`${name}: a thrown specialist dispatch is a crash too, and is re-dispatched`, async () => {
|
|
38
|
-
const { host, calls } = scriptedHost({ snapshot: [SNAP], "review:correctness": [new Error("spend limit"), review([])] });
|
|
39
|
-
const result = await run(host, ARGS);
|
|
40
|
-
assert.equal(calls["review:correctness"], 2);
|
|
41
|
-
assert.deepEqual(result.dimensionsUnrun, []);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test(`${name}: a specialist that crashes twice is dispatched exactly twice, then named unrun`, async () => {
|
|
45
|
-
const { host, calls } = scriptedHost({ snapshot: [SNAP], "review:correctness": [null] });
|
|
46
|
-
const result = await run(host, ARGS);
|
|
47
|
-
assert.equal(calls["review:correctness"], 2, "the retry is ONE re-dispatch, not a loop");
|
|
48
|
-
assert.equal(result.dimensionsUnrun.length, 1);
|
|
49
|
-
assert.equal(result.dimensionsUnrun[0].dimension, "correctness");
|
|
50
|
-
assert.match(result.dimensionsUnrun[0].reason, /returned nothing/);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// #2315: the suite is the review's one shared run now, and it is never
|
|
54
|
-
// re-dispatched either — a crashed test-run agent may already have launched
|
|
55
|
-
// the command, so a retry would be a second full run.
|
|
56
|
-
test(`${name}: a specialist that RETURNED over a shared run that ran nothing is not a crash — never re-dispatched`, async () => {
|
|
57
|
-
const { host, calls } = scriptedHost({
|
|
58
|
-
snapshot: [SNAP],
|
|
59
|
-
"test-run": [{ exitCode: 0, tests: 0, pass: 0, fail: 0 }],
|
|
60
|
-
"review:correctness": [review([])],
|
|
61
|
-
});
|
|
62
|
-
const result = await run(host, ARGS);
|
|
63
|
-
assert.equal(calls["review:correctness"], 1, "a returned-but-unrun review was re-dispatched as if it had crashed");
|
|
64
|
-
assert.equal(calls["test-run"], 1);
|
|
65
|
-
assert.equal(result.dimensionsUnrun.length, 1);
|
|
66
|
-
assert.match(result.dimensionsUnrun[0].reason, /0 tests/);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test(`${name}: a crashed shared test run is dispatched once, never retried, and every dimension is unrun`, async () => {
|
|
70
|
-
for (const crash of [null, new Error("spend limit")]) {
|
|
71
|
-
const { host, calls } = scriptedHost({
|
|
72
|
-
snapshot: [SNAP],
|
|
73
|
-
"test-run": [crash, SHARED],
|
|
74
|
-
"review:correctness": [review([])],
|
|
75
|
-
"review:tests": [review([])],
|
|
76
|
-
});
|
|
77
|
-
const result = await run(host, { ...ARGS, dimensions: ["correctness", "tests"] });
|
|
78
|
-
assert.equal(calls["test-run"], 1, "the shared test run was re-dispatched — a second full-suite launch");
|
|
79
|
-
assert.deepEqual(
|
|
80
|
-
result.dimensionsUnrun.map((u) => u.dimension),
|
|
81
|
-
["correctness", "tests"],
|
|
82
|
-
);
|
|
83
|
-
for (const u of result.dimensionsUnrun) assert.match(u.reason, /no counts|returned nothing/);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test(`${name}: a refuter pair whose every vote died is re-dispatched once, as a pair`, async () => {
|
|
88
|
-
const { host, calls } = scriptedHost({
|
|
89
|
-
snapshot: [SNAP],
|
|
90
|
-
"review:correctness": [review([finding("critical")])],
|
|
91
|
-
"verify:correctness": [null, null, vote(false), vote(false)],
|
|
92
|
-
});
|
|
93
|
-
const result = await run(host, ARGS);
|
|
94
|
-
assert.equal(calls["verify:correctness"], 4, "a wholly crashed refuter pair was not re-dispatched as a pair");
|
|
95
|
-
assert.equal(result.survived.length, 1);
|
|
96
|
-
assert.equal(result.survived[0].refutersDispatched, 2);
|
|
97
|
-
assert.deepEqual(result.counts, { survived: 1, refuted: 0, unverified: 0, crashed: 0 });
|
|
98
|
-
assert.equal(result.resume, null, "a pair the retry recovered still reads as crashed");
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test(`${name}: a pair that crashes again after the retry is unverified, counted crashed, and resume says so`, async () => {
|
|
102
|
-
const { host, calls } = scriptedHost({
|
|
103
|
-
snapshot: [SNAP],
|
|
104
|
-
"review:correctness": [review([finding("critical")])],
|
|
105
|
-
"verify:correctness": [null],
|
|
106
|
-
});
|
|
107
|
-
const result = await run(host, ARGS);
|
|
108
|
-
assert.equal(calls["verify:correctness"], 4, "the pair retry is ONE re-dispatch, not a loop");
|
|
109
|
-
assert.equal(result.unverified.length, 1);
|
|
110
|
-
assert.equal(result.unverified[0].refutersDispatched, 2);
|
|
111
|
-
assert.deepEqual(result.counts, { survived: 0, refuted: 0, unverified: 1, crashed: 1 });
|
|
112
|
-
assert.match(result.resume, /in-run retry/, "resume no longer says the crash survived the in-run retry");
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// #1813: a REJECTED dispatch (not a resolved `null`) is the shape every
|
|
116
|
-
// real `parallel()`/`agent()` failure actually takes on omp — see
|
|
117
|
-
// `retryCrashed`'s own doc comment: "that second answer is final, THROWN or
|
|
118
|
-
// not". Before this fix, a finding whose refuter pair rejected on both
|
|
119
|
-
// `retryCrashed` attempts propagated that rejection into the shared,
|
|
120
|
-
// findings-level `parallel()` (a bare `Promise.all`), which discarded every
|
|
121
|
-
// OTHER finding under the same dimension — including ones whose refuters
|
|
122
|
-
// fully succeeded — and reported the whole dimension `dimensionsUnrun`
|
|
123
|
-
// with the misleading "the reviewer returned nothing" reason, even though
|
|
124
|
-
// the specialist's review DID come back with real findings.
|
|
125
|
-
test(`${name}: a finding whose refuter pair rejects on both retry attempts does not erase its dimension-mates' verdicts`, async () => {
|
|
126
|
-
const crashing = finding("critical");
|
|
127
|
-
const surviving = finding("important");
|
|
128
|
-
const calls = { crashing: 0, surviving: 0 };
|
|
129
|
-
const host = {
|
|
130
|
-
agent: async (prompt, opts) => {
|
|
131
|
-
if (opts.label === "snapshot:pr7") return structuredClone(SNAP);
|
|
132
|
-
if (opts.label === "test-run:pr7") return structuredClone(SHARED);
|
|
133
|
-
if (opts.label === "review:correctness:pr7") return structuredClone(review([crashing, surviving]));
|
|
134
|
-
if (opts.label === "verify:correctness:pr7") {
|
|
135
|
-
if (prompt.includes(crashing.claim)) {
|
|
136
|
-
calls.crashing++;
|
|
137
|
-
throw new Error(`refuter crash ${calls.crashing}`);
|
|
138
|
-
}
|
|
139
|
-
if (prompt.includes(surviving.claim)) {
|
|
140
|
-
calls.surviving++;
|
|
141
|
-
return structuredClone(vote(false));
|
|
142
|
-
}
|
|
143
|
-
throw new Error("scriptedHost: unexpected verify prompt");
|
|
144
|
-
}
|
|
145
|
-
throw new Error(`scriptedHost: unexpected dispatch ${opts.label}`);
|
|
146
|
-
},
|
|
147
|
-
phase: () => {},
|
|
148
|
-
log: () => {},
|
|
149
|
-
};
|
|
150
|
-
const result = await run(host, ARGS);
|
|
151
|
-
assert.equal(calls.crashing, 4, "the crashing pair is dispatched twice per attempt, across both retryCrashed attempts");
|
|
152
|
-
assert.equal(calls.surviving, 2, "the surviving pair's own refuters are undisturbed by the other finding's crash");
|
|
153
|
-
assert.equal(result.survived.length, 1, "a fully-verified sibling finding must not be erased by another finding's crash");
|
|
154
|
-
assert.equal(result.survived[0].claim, surviving.claim);
|
|
155
|
-
assert.equal(result.unverified.length, 1, "the crashed finding is reported unverified, not silently dropped");
|
|
156
|
-
assert.equal(result.unverified[0].claim, crashing.claim);
|
|
157
|
-
assert.equal(result.unverified[0].refutersDispatched, 2);
|
|
158
|
-
assert.deepEqual(result.dimensionsUnrun, [], "the dimension itself ran and returned real findings — it must not read as unrun");
|
|
159
|
-
assert.deepEqual(result.counts, { survived: 1, refuted: 0, unverified: 1, crashed: 1 });
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test(`${name}: a pair with one live vote did not crash — it is ruled on that vote, not re-dispatched`, async () => {
|
|
163
|
-
const { host, calls } = scriptedHost({
|
|
164
|
-
snapshot: [SNAP],
|
|
165
|
-
"review:correctness": [review([finding("important")])],
|
|
166
|
-
"verify:correctness": [null, vote(true)],
|
|
167
|
-
});
|
|
168
|
-
const result = await run(host, ARGS);
|
|
169
|
-
assert.equal(calls["verify:correctness"], 2, "a pair with a surviving vote was re-dispatched as if every refuter had died");
|
|
170
|
-
assert.equal(result.refuted.length, 1);
|
|
171
|
-
assert.deepEqual(result.counts, { survived: 0, refuted: 1, unverified: 0, crashed: 0 });
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test(`${name}: a suggestion's 0-refuter budget is policy, not a crash — nothing is dispatched for it`, async () => {
|
|
175
|
-
const { host, calls } = scriptedHost({ snapshot: [SNAP], "review:correctness": [review([finding("suggestion")])] });
|
|
176
|
-
const result = await run(host, ARGS);
|
|
177
|
-
assert.equal(calls["verify:correctness"], undefined, "a 0-refuter suggestion bought a refuter dispatch");
|
|
178
|
-
assert.equal(result.unverified.length, 1);
|
|
179
|
-
assert.equal(result.unverified[0].refutersDispatched, 0);
|
|
180
|
-
assert.deepEqual(result.counts, { survived: 0, refuted: 0, unverified: 1, crashed: 0 });
|
|
181
|
-
assert.equal(result.resume, null);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
test(`${name}: the digest leads the returned object, so it is a prefix of the serialized result`, async () => {
|
|
185
|
-
const { host } = scriptedHost({
|
|
186
|
-
snapshot: [SNAP],
|
|
187
|
-
"review:correctness": [review([finding("critical"), finding("suggestion")])],
|
|
188
|
-
"verify:correctness": [vote(false)],
|
|
189
|
-
});
|
|
190
|
-
const result = await run(host, ARGS);
|
|
191
|
-
assert.deepEqual(Object.keys(result), [...DIGEST_KEYS, "snapshot", "survived", "refuted", "unverified"]);
|
|
192
|
-
// The consumer-visible property, not the key list: the pre-cutover
|
|
193
|
-
// harness hands the controller the FIRST ~8 KB of the serialized result,
|
|
194
|
-
// so every digest field has to be serialized before the first byte of a
|
|
195
|
-
// finding array.
|
|
196
|
-
const whole = JSON.stringify(result);
|
|
197
|
-
const digest = JSON.stringify(digestOf(result));
|
|
198
|
-
assert.ok(whole.startsWith(digest.slice(0, -1) + ","), "a bulk field is serialized ahead of the digest — a large review truncates it away");
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// The accept half of the digest helper: every digest key, nothing else, and in
|
|
203
|
-
// the result's own order — a digest that dropped `resume` is the defect this
|
|
204
|
-
// reorder exists to fix, one layer up.
|
|
205
|
-
test("digestOf keeps exactly the digest keys, in order, and leaves the finding arrays behind", async () => {
|
|
206
|
-
const { host } = scriptedHost({ snapshot: [SNAP], "review:correctness": [review([finding("suggestion")])] });
|
|
207
|
-
const result = await runReview({ ...host, pipeline, parallel }, ARGS);
|
|
208
|
-
const digest = digestOf(result);
|
|
209
|
-
assert.deepEqual(Object.keys(digest), DIGEST_KEYS);
|
|
210
|
-
for (const bulk of ["snapshot", "survived", "refuted", "unverified"]) assert.equal(bulk in digest, false, bulk);
|
|
211
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { test } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
|
-
// #1349's own acceptance text: `grep -n 'pr-review-toolkit' skills/
|
|
7
|
-
// commands/` returns nothing — the six vendored names are never DISPATCHED.
|
|
8
|
-
// Scoped to those two directories deliberately, not the whole `plugin/`
|
|
9
|
-
// tree: `agents/fleet-review-*.agent.md`'s credit comments plainly name the
|
|
10
|
-
// vendored source they adapted a prompt from (review finding on #1361 — an
|
|
11
|
-
// earlier revision obfuscated the slug there to satisfy an over-widened
|
|
12
|
-
// reading of this same criterion, which helped nobody and made the credit
|
|
13
|
-
// harder to verify). Attribution prose and dispatch names are different
|
|
14
|
-
// claims; this pins the one #1349 actually makes.
|
|
15
|
-
const REPO = join(import.meta.dirname, "..");
|
|
16
|
-
|
|
17
|
-
function allFiles(dir) {
|
|
18
|
-
const out = [];
|
|
19
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
20
|
-
const full = join(dir, entry.name);
|
|
21
|
-
if (entry.isDirectory()) out.push(...allFiles(full));
|
|
22
|
-
else out.push(full);
|
|
23
|
-
}
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
test("no file under skills/ or commands/ mentions the retired vendor plugin", () => {
|
|
28
|
-
for (const dir of ["skills", "commands"]) {
|
|
29
|
-
for (const file of allFiles(join(REPO, dir))) {
|
|
30
|
-
const text = readFileSync(file, "utf8");
|
|
31
|
-
assert.doesNotMatch(text, /pr-review-toolkit/, `${file} still mentions pr-review-toolkit`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// The counterpart: agents/ deliberately DOES name it, in plain text, as
|
|
37
|
-
// attribution — this is not covered by the criterion above and must not be
|
|
38
|
-
// "fixed" into the same obfuscated shape a prior revision tried.
|
|
39
|
-
test("agents/fleet-review-*.agent.md credit the vendored source plainly, not obfuscated", () => {
|
|
40
|
-
const dims = ["correctness", "silent-failure", "tests", "comments", "types", "simplify"];
|
|
41
|
-
for (const key of dims) {
|
|
42
|
-
const text = readFileSync(join(REPO, "agents", `fleet-review-${key}.agent.md`), "utf8");
|
|
43
|
-
assert.match(text, /pr-review-toolkit/, `fleet-review-${key}.agent.md no longer plainly credits the vendored plugin`);
|
|
44
|
-
}
|
|
45
|
-
});
|