@feigi/fleet-ctl 3.23.36 → 3.23.38
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/cell-readout.mjs +38 -11
- 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,374 +0,0 @@
|
|
|
1
|
-
// #1433. Three PRs reviewed back-to-back from one omp `eval` cell left FOUR
|
|
2
|
-
// files modified in the checkout that cell was standing in — one specialist's
|
|
3
|
-
// mutation-test experiment per review reaching the repository through a
|
|
4
|
-
// RELATIVE path. Review specialists have no assigned worktree to fall back to
|
|
5
|
-
// (unlike implementers, whose own relative-path defect is #1411), and the
|
|
6
|
-
// controller reads every gate decision — instruments.sh, ci-state.mjs, any
|
|
7
|
-
// local `node --test` — out of that same tree, so a modified instrument
|
|
8
|
-
// silently changes what a later gate check reads.
|
|
9
|
-
//
|
|
10
|
-
// WHY THE FIX IS PROMPT PROSE AND NOT A `cwd` ARGUMENT. The preferred remedy
|
|
11
|
-
// was an explicit scratch cwd per specialist dispatch, passed through
|
|
12
|
-
// review-eval.mjs's `ompAgent()`. Neither dispatch primitive has one:
|
|
13
|
-
// eval's `agent()` takes `{ agent, label, schema, schemaMode, isolated, apply,
|
|
14
|
-
// merge, tools }` and `task`'s item shape carries no cwd either, and a
|
|
15
|
-
// non-isolated spawn runs with the PARENT's cwd. `isolated: true` is not that
|
|
16
|
-
// option renamed — it names no directory, it fails preflight wherever
|
|
17
|
-
// `task.isolation.enabled` is off, and it MERGES the child's changes back into
|
|
18
|
-
// the parent, which for a mutation-testing specialist means applying a
|
|
19
|
-
// deliberately broken tree to the checkout. review-eval.mjs's own header holds
|
|
20
|
-
// that determination with its sources; this file pins what the prompts say
|
|
21
|
-
// because of it.
|
|
22
|
-
//
|
|
23
|
-
// THREE PARTS, PINNED SEPARATELY, because the later two are inert without the
|
|
24
|
-
// first and each fails differently: the inherited cwd is NAMED as a tree the
|
|
25
|
-
// agent must not write to, `pwd` fixes which directory that is, and the
|
|
26
|
-
// `CWD-AUDIT:` line is what makes a CLEAN run say so. An audit reported only
|
|
27
|
-
// when it finds something is indistinguishable from one never run — the same
|
|
28
|
-
// reading `unrunReason` already applies to a shared test run reporting nothing, and
|
|
29
|
-
// the reason "four files dirty" was found by chance rather than by a report.
|
|
30
|
-
//
|
|
31
|
-
// WHY THESE PINS RENDER RATHER THAN GREP, and why the slice is the pin: same
|
|
32
|
-
// two reasons review-core-specialist-scratch.test.mjs states. The rules live
|
|
33
|
-
// inside template literals whose backticks are written escaped (`` \` ``), so
|
|
34
|
-
// a source-text pin passes just as happily on a prompt showing the agent a
|
|
35
|
-
// literal `\`; and all three prompts here carry the SAME wording, so a pin
|
|
36
|
-
// matched against the whole file would be satisfied by any one of them —
|
|
37
|
-
// which is the defect shape this ticket reports one dispatch at a time.
|
|
38
|
-
// Each prompt is extracted by its own `agent()` call's anchors through
|
|
39
|
-
// prompt-renderer.mjs and rendered, so the other two are outside it by
|
|
40
|
-
// construction. Measured, per prompt: reverting the block out of the
|
|
41
|
-
// specialist prompt alone reds that prompt's four tests and the shared marker
|
|
42
|
-
// pin below, leaving every refuter and snapshot test green; the mirror revert
|
|
43
|
-
// does the same the other way, and reverting the snapshot sentence reds its
|
|
44
|
-
// prose pin alone. Block-commenting a dispatch reds the whole file at
|
|
45
|
-
// extraction — it does not render as live text (strip-comments.mjs).
|
|
46
|
-
//
|
|
47
|
-
// THE CEILING, same as the sibling scratch pins': nothing here reaches the
|
|
48
|
-
// agent's own obedience. These pins settle what a dispatch is TOLD and what
|
|
49
|
-
// the schema can carry back — never where a specialist actually writes.
|
|
50
|
-
import { test } from "node:test";
|
|
51
|
-
import assert from "node:assert/strict";
|
|
52
|
-
import { phrase } from "./prose-pin.mjs";
|
|
53
|
-
import { promptRenderer } from "./prompt-renderer.mjs";
|
|
54
|
-
import { AUDIT_COMMAND, AUDIT_STATES, CWD_AUDIT_MARKER, EVERY_RUN, PWD_FIRST, REFUTER_CWD, REPORT_FIELD, SCRATCH_NAMED_REFUTER, SCRATCH_NAMED_SPECIALIST, SPECIALIST_CWD, auditLine } from "./cwd-isolation-pins.mjs";
|
|
55
|
-
import { FINDINGS_SCHEMA, VERDICT_SCHEMA, cwdAuditFrom, runReview } from "./review-core.mjs";
|
|
56
|
-
|
|
57
|
-
const FILE = "scripts/review-core.mjs";
|
|
58
|
-
const SNAP = { path: "/scr/run-1/snapshot-abc1234", head: "abc1234", runRoot: "/scr/run-1" };
|
|
59
|
-
|
|
60
|
-
// One specialist's, one refuter's and the snapshot agent's prompt. Every
|
|
61
|
-
// argument is fixed: these pins are about what the prompts SAY, not about how
|
|
62
|
-
// they vary, so nothing here needs to. `sharedRunNote`/`readRules`/
|
|
63
|
-
// `usableDiff`/`environmentNote` are stubs for the sibling pins' reason —
|
|
64
|
-
// binding them keeps a render that stops passing one throwing a
|
|
65
|
-
// ReferenceError instead of dropping a paragraph silently.
|
|
66
|
-
const specialist = promptRenderer({
|
|
67
|
-
file: FILE,
|
|
68
|
-
start: "`Review PR #${pr} (branch ${branch}) for: ",
|
|
69
|
-
end: "label: `review:",
|
|
70
|
-
scope: ["pr", "branch", "d", "snap", "worktree", "stats", "sharedRunNote", "sharedRun", "failureOwner", "readRules", "usableDiff", "environmentNote"],
|
|
71
|
-
what: "review-core.mjs's specialist prompt (opening `Review PR #${pr} (branch ${branch}) for: `, labelled `review:`)",
|
|
72
|
-
})(7, "feature/x", { key: "correctness", prompt: "does it do what it says" }, SNAP, "/repo/.worktrees/7-x", null, () => "SHARED RUN NOTE", {}, "correctness", () => "READ RULES", () => null, () => "TEST ENVIRONMENT");
|
|
73
|
-
|
|
74
|
-
const refuter = promptRenderer({
|
|
75
|
-
file: FILE,
|
|
76
|
-
start: "`Try to REFUTE this finding from PR #",
|
|
77
|
-
end: "{ label: `verify:",
|
|
78
|
-
scope: ["pr", "f", "snap", "stats", "d", "i", "fi", "readRules", "usableDiff", "environmentNote"],
|
|
79
|
-
what: "review-core.mjs's refuter prompt (opening `Try to REFUTE this finding from PR #`, labelled `verify:`)",
|
|
80
|
-
})(7, { claim: "the guard fails open", file: "a.js", line: 12, evidence: "line 12 has no else" }, SNAP, null, { key: "correctness" }, 0, 0, () => "READ RULES", () => null, () => "TEST ENVIRONMENT");
|
|
81
|
-
|
|
82
|
-
const snapshot = promptRenderer({
|
|
83
|
-
file: FILE,
|
|
84
|
-
start: "`In ${worktree}, cut an immutable review snapshot",
|
|
85
|
-
end: "{ label: `snapshot${forPr}`",
|
|
86
|
-
scope: ["worktree", "scratch", "runRootParent", "runRootPrefix", "pr", "harness"],
|
|
87
|
-
what: "review-core.mjs's snapshot prompt (opening `In ${worktree}, cut an immutable review snapshot`, labelled `snapshot:pr<N>`)",
|
|
88
|
-
})("/repo/.worktrees/7-x", "/scr", "/scr/pr7", "/scr/pr7/run-", 7, "omp");
|
|
89
|
-
|
|
90
|
-
// --- Part 1: the inherited cwd is named, as a tree not to write to ---------
|
|
91
|
-
// ONE contiguous span per prompt, never two assertions and never a `.{0,N}`
|
|
92
|
-
// gap — cwd-isolation-pins.mjs holds both spans and why their three clauses
|
|
93
|
-
// have to arrive together. Mutation-tested on each prompt: deleting any one of
|
|
94
|
-
// the three clauses, and splicing an exception between them ("…lands THERE,
|
|
95
|
-
// unless the command is read-only"), both red these.
|
|
96
|
-
test("the rendered specialist prompt names the cwd it inherits and says a relative path lands there", () => {
|
|
97
|
-
assert.match(
|
|
98
|
-
specialist,
|
|
99
|
-
phrase(SPECIALIST_CWD),
|
|
100
|
-
"review-core.mjs's specialist prompt no longer names the directory it is dispatched INTO — a specialist that does not know its cwd is the controller's checkout has no reason to leave it, " +
|
|
101
|
-
"which is how three reviews left four files modified there (#1433)",
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
test("the rendered refuter prompt names the cwd it inherits and says a relative path lands there", () => {
|
|
106
|
-
assert.match(
|
|
107
|
-
refuter,
|
|
108
|
-
phrase(`your shell does not start there: ${REFUTER_CWD}`),
|
|
109
|
-
"review-core.mjs's refuter prompt no longer names the directory it is dispatched INTO — a refuter applying a mutation is the likeliest writer of the four files #1433 measured",
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// --- Part 2: `pwd` first, and the inherited directory is a no-run zone -----
|
|
114
|
-
// Both halves in one span (PWD_FIRST, cwd-isolation-pins.mjs says why).
|
|
115
|
-
// Mutation-tested: demoting FIRST to "early" or dropping the no-run clause
|
|
116
|
-
// reds these.
|
|
117
|
-
for (const [name, prompt] of [
|
|
118
|
-
["specialist", specialist],
|
|
119
|
-
["refuter", refuter],
|
|
120
|
-
]) {
|
|
121
|
-
test(`the rendered ${name} prompt orders pwd as the first command and makes that directory a no-run zone`, () => {
|
|
122
|
-
assert.match(
|
|
123
|
-
prompt,
|
|
124
|
-
PWD_FIRST,
|
|
125
|
-
`review-core.mjs's ${name} prompt no longer fixes which directory it started in before running anything — the audit below then has no path to audit, and the cd rules guard a directory nothing identified (#1433)`,
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// --- Part 2.5 (#1721): where the snapshot/scratch dir are named, per prompt
|
|
131
|
-
// Each prompt's own claim (SCRATCH_NAMED_SPECIALIST / SCRATCH_NAMED_REFUTER,
|
|
132
|
-
// cwd-isolation-pins.mjs says why the two differ). Regression pin: reverting
|
|
133
|
-
// review-core.mjs's specialist prompt back to "above" while leaving this file on
|
|
134
|
-
// "in this prompt" passed the entire suite otherwise (measured at PR #1825's
|
|
135
|
-
// review) — nothing previously pinned past PWD_FIRST's "no-run zone from then
|
|
136
|
-
// on" on either prompt.
|
|
137
|
-
for (const [name, prompt, span] of [
|
|
138
|
-
["specialist", specialist, SCRATCH_NAMED_SPECIALIST],
|
|
139
|
-
["refuter", refuter, SCRATCH_NAMED_REFUTER],
|
|
140
|
-
]) {
|
|
141
|
-
test(`the rendered ${name} prompt states where the snapshot and scratch dir are named as absolute paths`, () => {
|
|
142
|
-
assert.match(
|
|
143
|
-
prompt,
|
|
144
|
-
span,
|
|
145
|
-
`review-core.mjs's ${name} prompt no longer makes this claim, or worded it to match "above" when its scratch dir is actually named later (#1721)`,
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// --- Part 3: the positive self-check, into a field the schema carries ------
|
|
151
|
-
// The audit command and the report contract are separate spans, each
|
|
152
|
-
// contiguous, for the reasons cwd-isolation-pins.mjs gives. Mutation-tested:
|
|
153
|
-
// dropping `-uall`, dropping the `showUntrackedFiles=no` reason, and replacing
|
|
154
|
-
// "every run, clean or not" with "when it printed anything" each red one of
|
|
155
|
-
// these.
|
|
156
|
-
test("the rendered specialist prompt audits the directory it started in, with the explicit untracked mode", () => {
|
|
157
|
-
assert.match(
|
|
158
|
-
specialist,
|
|
159
|
-
phrase(AUDIT_COMMAND),
|
|
160
|
-
"review-core.mjs's specialist prompt dropped the stray-write audit, or asks for bare `--porcelain` — which a `status.showUntrackedFiles=no` config silences into a false clean, the same false-clean class worktree-audit.sh's own `-uall` exists to deny (#1433)",
|
|
161
|
-
);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test("the rendered refuter prompt audits the directory it started in, with the explicit untracked mode", () => {
|
|
165
|
-
assert.match(
|
|
166
|
-
refuter,
|
|
167
|
-
phrase(AUDIT_COMMAND),
|
|
168
|
-
"review-core.mjs's refuter prompt dropped the stray-write audit, or asks for bare `--porcelain` (#1433)",
|
|
169
|
-
);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// The report contract, and the half a prose pin usually cannot reach: the
|
|
173
|
-
// field each prompt names has to be one its SCHEMA declares. Both schemas are
|
|
174
|
-
// `additionalProperties: false`, so a rule pointing at any other name is inert
|
|
175
|
-
// — the agent's audit is dropped in validation and the prompt still reads
|
|
176
|
-
// correct. The field name is EXTRACTED from the rendered prompt by
|
|
177
|
-
// REPORT_FIELD's capture group rather than transcribed here, so the pin fails
|
|
178
|
-
// in either direction: the prompt renaming the field, or the schema losing it.
|
|
179
|
-
for (const [name, prompt, schema, schemaName] of [
|
|
180
|
-
["specialist", specialist, FINDINGS_SCHEMA, "FINDINGS_SCHEMA"],
|
|
181
|
-
["refuter", refuter, VERDICT_SCHEMA, "VERDICT_SCHEMA"],
|
|
182
|
-
]) {
|
|
183
|
-
test(`the rendered ${name} prompt reports its audit into a field ${schemaName} actually carries, every run`, () => {
|
|
184
|
-
const named = prompt.match(REPORT_FIELD);
|
|
185
|
-
assert.ok(
|
|
186
|
-
named,
|
|
187
|
-
`review-core.mjs's ${name} prompt no longer names a report field for the CWD-AUDIT line — an audit the agent has nowhere to put is an audit the caller never sees (#1433)`,
|
|
188
|
-
);
|
|
189
|
-
assert.equal(schema.additionalProperties, false, `${schemaName} no longer refuses undeclared fields — this pin's premise (a wrongly-named field is DROPPED, not passed through) no longer holds; re-derive it`);
|
|
190
|
-
assert.ok(
|
|
191
|
-
Object.hasOwn(schema.properties, named[1]),
|
|
192
|
-
`review-core.mjs's ${name} prompt reports the audit in \`${named[1]}\`, which ${schemaName} does not declare — \`additionalProperties: false\` drops it, so the audit dies in validation with the prompt still reading correct`,
|
|
193
|
-
);
|
|
194
|
-
assert.ok(
|
|
195
|
-
schema.required.includes(named[1]),
|
|
196
|
-
`${schemaName} no longer REQUIRES \`${named[1]}\`, so an agent that omits the audit omits the whole field and validates anyway — the report has to ride a field the schema already insists on`,
|
|
197
|
-
);
|
|
198
|
-
// All three states, and the always clause. Two of the states are what keep
|
|
199
|
-
// the check POSITIVE: a prompt that spells out only `dirty` leaves a clean
|
|
200
|
-
// run and a never-run check reporting the same nothing, and `unrepo` is
|
|
201
|
-
// what stops a `fatal: not a git repository` — the honest answer whenever
|
|
202
|
-
// the inherited cwd is not a checkout — being read as a reason to report
|
|
203
|
-
// nothing at all.
|
|
204
|
-
for (const state of AUDIT_STATES) {
|
|
205
|
-
assert.match(
|
|
206
|
-
prompt,
|
|
207
|
-
auditLine(state),
|
|
208
|
-
`review-core.mjs's ${name} prompt no longer spells the \`${state}\` form of the audit line — the state it cannot spell is the state it will not report (#1433)`,
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
assert.match(
|
|
212
|
-
prompt,
|
|
213
|
-
EVERY_RUN,
|
|
214
|
-
`review-core.mjs's ${name} prompt no longer demands the audit line on a CLEAN run — an audit reported only when it finds something is indistinguishable from one never run, which is exactly how #1433's four files went unrecorded`,
|
|
215
|
-
);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Checked against each prompt individually (CWD_AUDIT_MARKER,
|
|
220
|
-
// cwd-isolation-pins.mjs) — a capture group around a fixed literal with no
|
|
221
|
-
// alternation inside it can only ever capture that same literal, so comparing
|
|
222
|
-
// `inSpecialist[1]` against `inRefuter[1]` (the prior shape of this test)
|
|
223
|
-
// could never fail as long as both prompts matched at all; the `assert.ok`
|
|
224
|
-
// above already covers that.
|
|
225
|
-
for (const [name, prompt] of [
|
|
226
|
-
["specialist", specialist],
|
|
227
|
-
["refuter", refuter],
|
|
228
|
-
]) {
|
|
229
|
-
test(`the rendered ${name} prompt names the CWD-AUDIT marker as a code span`, () => {
|
|
230
|
-
assert.match(
|
|
231
|
-
prompt,
|
|
232
|
-
CWD_AUDIT_MARKER,
|
|
233
|
-
`review-core.mjs's ${name} prompt no longer names the CWD-AUDIT marker as a code span — a reader cannot tell the literal from the prose around it`,
|
|
234
|
-
);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// --- The snapshot dispatch, whose rule is different ------------------------
|
|
239
|
-
// It is dispatched with the same inherited cwd, but it CREATES the scratch
|
|
240
|
-
// tree, so it has no scratch directory to `cd` into as a first command and
|
|
241
|
-
// gets the other half of the rule instead: every path it uses is absolute or
|
|
242
|
-
// `-C`-anchored, so nothing relative may be added to the block.
|
|
243
|
-
test("the rendered snapshot prompt says its own block is absolute by construction and forbids adding a relative path", () => {
|
|
244
|
-
assert.match(
|
|
245
|
-
snapshot,
|
|
246
|
-
phrase(
|
|
247
|
-
"Every path in the block above is absolute or `-C`-anchored on purpose: this dispatch carries no working directory of its own either, so you start in the controller's own checkout, and a relative path — a `tar -x` with no `-C`, a bare `git` — reads or writes THERE",
|
|
248
|
-
),
|
|
249
|
-
"review-core.mjs's snapshot prompt no longer says why its paths are absolute — the agent that mints the scratch tree is the one dispatch with no scratch dir to cd into, so the rule it gets is the only one it can follow (#1433)",
|
|
250
|
-
);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
// The other direction, and the one that keeps the sentence above from being
|
|
254
|
-
// aspirational: the block really is anchored. Every command line in the prompt
|
|
255
|
-
// is checked, so a bare `git status` or a `tar -x` with no `-C` added later
|
|
256
|
-
// reds HERE — where the prose claiming otherwise lives — rather than in a
|
|
257
|
-
// review that quietly measured the controller's checkout. Command lines are
|
|
258
|
-
// the 4-space-indented ones, which is how both blocks in this prompt are
|
|
259
|
-
// written; the prose that NAMES `tar -x` and `git` sits at column 0 and is not
|
|
260
|
-
// scanned, so this pin cannot be satisfied or broken by its own rule's wording.
|
|
261
|
-
test("every command line in the snapshot prompt is -C-anchored, cd-chained, or path-free", () => {
|
|
262
|
-
const lines = snapshot.split("\n").filter((l) => /^ {4}\S/.test(l));
|
|
263
|
-
assert.ok(lines.length >= 15, `only ${lines.length} indented command lines found in the snapshot prompt — the block was reshaped past what this pin scans; update it or restore the block`);
|
|
264
|
-
for (const line of lines) {
|
|
265
|
-
const cdChained = /cd\s+"\$\w+"\s+&&/.test(line);
|
|
266
|
-
for (const m of line.matchAll(/(?<![-\w])git\s+(?!-C\b)(\S+)/g)) {
|
|
267
|
-
assert.ok(
|
|
268
|
-
cdChained,
|
|
269
|
-
`the snapshot block runs \`git ${m[1]}\` with neither \`-C\` nor a chained \`cd\` on the same line — it answers about the directory the dispatch inherited, the controller's own checkout: ${line.trim()}`,
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
for (const m of line.matchAll(/(?<![-\w])tar\s+(\S+)/g)) {
|
|
273
|
-
assert.match(
|
|
274
|
-
line,
|
|
275
|
-
/tar\s[^|]*-C\s/,
|
|
276
|
-
`the snapshot block runs \`tar ${m[1]}\` with no \`-C\` — an extraction with no destination unpacks into the inherited cwd: ${line.trim()}`,
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// --- The specialist's audit reaching the payload (PR #1671 review, gap 1) --
|
|
283
|
-
// Part 3 above pins that the audit is NAMED and has somewhere valid to land;
|
|
284
|
-
// it does not pin that `runReview` ever reads it back out once it lands
|
|
285
|
-
// there. Measured against the PR #1671 review's own reproduction: a
|
|
286
|
-
// specialist that dutifully reported `CWD-AUDIT: dirty <checkout>` into
|
|
287
|
-
// `scope_searched` had that fact dropped before `runReview`'s return —
|
|
288
|
-
// `scope_searched` fed only `unrunReason`'s test-run check, which never reads
|
|
289
|
-
// it, so the audit dead-ended inside a field nothing else looked at.
|
|
290
|
-
// `cwdAuditFrom` extracts the line; the tests below pin that `runReview`
|
|
291
|
-
// folds its result into the payload under `cwdAudit`, and that a missing or
|
|
292
|
-
// misspelled line is flagged there rather than silently read as clean.
|
|
293
|
-
test("cwdAuditFrom reads each of the audit line's states, and flags its own absence", () => {
|
|
294
|
-
assert.deepEqual(cwdAuditFrom("grepped src/**/*.js for auth checks. CWD-AUDIT: clean /repo/.worktrees/7-x"), {
|
|
295
|
-
state: "clean",
|
|
296
|
-
line: "CWD-AUDIT: clean /repo/.worktrees/7-x",
|
|
297
|
-
});
|
|
298
|
-
assert.deepEqual(cwdAuditFrom("CWD-AUDIT: dirty /repo/.worktrees/7-x — M src/foo.js"), {
|
|
299
|
-
state: "dirty",
|
|
300
|
-
line: "CWD-AUDIT: dirty /repo/.worktrees/7-x — M src/foo.js",
|
|
301
|
-
});
|
|
302
|
-
assert.deepEqual(cwdAuditFrom("CWD-AUDIT: unrepo /repo/.worktrees/7-x"), {
|
|
303
|
-
state: "unrepo",
|
|
304
|
-
line: "CWD-AUDIT: unrepo /repo/.worktrees/7-x",
|
|
305
|
-
});
|
|
306
|
-
// No line at all.
|
|
307
|
-
assert.deepEqual(cwdAuditFrom("grepped src/**/*.js for auth checks"), { state: "missing", line: null });
|
|
308
|
-
// Misspelled — the ticket's own failure mode: a schema-valid string that
|
|
309
|
-
// never actually reports, because FINDINGS_SCHEMA has no pattern over it.
|
|
310
|
-
assert.deepEqual(cwdAuditFrom("CWD AUDIT: clean /repo/.worktrees/7-x"), { state: "missing", line: null });
|
|
311
|
-
assert.deepEqual(cwdAuditFrom(undefined), { state: "missing", line: null });
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
// A minimal fake host: every fact `runReview` otherwise gets from `gh`/`git`
|
|
315
|
-
// arrives inside the snapshot agent's own structured response — review-
|
|
316
|
-
// core.js never shells out itself, every command lives in a dispatched
|
|
317
|
-
// prompt (grep finds no `child_process` import in this file) — so a scripted
|
|
318
|
-
// `agent()` stub returning one canned object per dispatch label is a
|
|
319
|
-
// complete double for the whole pipeline, no real repository needed.
|
|
320
|
-
function fakeReviewHost(scopeSearched) {
|
|
321
|
-
return {
|
|
322
|
-
agent: async (_prompt, opts) => {
|
|
323
|
-
if (opts.label === "snapshot:pr7")
|
|
324
|
-
return {
|
|
325
|
-
runRoot: "/scr/pr7/run-ab12",
|
|
326
|
-
path: "/scr/pr7/run-ab12/snapshot-abc123",
|
|
327
|
-
head: "abc123",
|
|
328
|
-
pathVerified: true,
|
|
329
|
-
repoVerified: true,
|
|
330
|
-
testCmd: "node --test",
|
|
331
|
-
};
|
|
332
|
-
if (opts.label === "test-run:pr7") return { exitCode: 0, tests: 5, pass: 5, fail: 0 };
|
|
333
|
-
if (opts.label === "review:correctness:pr7")
|
|
334
|
-
return {
|
|
335
|
-
dimension: "correctness",
|
|
336
|
-
scope_searched: scopeSearched,
|
|
337
|
-
findings: [],
|
|
338
|
-
};
|
|
339
|
-
throw new Error(`fakeReviewHost: unexpected dispatch ${opts.label}`);
|
|
340
|
-
},
|
|
341
|
-
phase: () => {},
|
|
342
|
-
log: () => {},
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
test("runReview carries a specialist's dirty CWD-AUDIT into the payload's cwdAudit field", async () => {
|
|
347
|
-
const host = fakeReviewHost("CWD-AUDIT: dirty /repo/.worktrees/7-x — M src/foo.js");
|
|
348
|
-
const result = await runReview(host, {
|
|
349
|
-
pr: 7,
|
|
350
|
-
worktree: "/repo/.worktrees/7-x",
|
|
351
|
-
scratch: "/scr",
|
|
352
|
-
dimensions: ["correctness"],
|
|
353
|
-
});
|
|
354
|
-
assert.deepEqual(
|
|
355
|
-
result.cwdAudit,
|
|
356
|
-
[{ dimension: "correctness", state: "dirty", line: "CWD-AUDIT: dirty /repo/.worktrees/7-x — M src/foo.js" }],
|
|
357
|
-
"a specialist that reported a dirty checkout must have that fact reach the payload — silently dropping it is the exact defect PR #1671's review found (#1433)",
|
|
358
|
-
);
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
test("runReview flags a specialist's missing CWD-AUDIT line rather than reading it as clean", async () => {
|
|
362
|
-
const host = fakeReviewHost("grepped the diff for auth checks — nothing else searched");
|
|
363
|
-
const result = await runReview(host, {
|
|
364
|
-
pr: 7,
|
|
365
|
-
worktree: "/repo/.worktrees/7-x",
|
|
366
|
-
scratch: "/scr",
|
|
367
|
-
dimensions: ["correctness"],
|
|
368
|
-
});
|
|
369
|
-
assert.deepEqual(
|
|
370
|
-
result.cwdAudit,
|
|
371
|
-
[{ dimension: "correctness", state: "missing", line: null }],
|
|
372
|
-
"a specialist that satisfied FINDINGS_SCHEMA without ever emitting a CWD-AUDIT line must be flagged, not read as an unreported-but-clean run",
|
|
373
|
-
);
|
|
374
|
-
});
|