@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,95 +0,0 @@
|
|
|
1
|
-
// #2102: `fleet-review-runner.agent.md`'s `spawns` frontmatter must allow
|
|
2
|
-
// exactly the agent types `runReviewOnOmp` (review-core.mjs) actually
|
|
3
|
-
// dispatches from inside its own eval cell — omp denies every spawn by
|
|
4
|
-
// default, and the runner declared neither `spawns` nor `tools` until this
|
|
5
|
-
// fix, so every dispatch failed with `Cannot spawn '<name>'. Allowed: none`.
|
|
6
|
-
//
|
|
7
|
-
// This pin derives BOTH sides from source instead of hand-copying either:
|
|
8
|
-
// the declared side from the frontmatter's own `spawns:` line, the dispatched
|
|
9
|
-
// side from review-core.mjs's exported `SPAWNED_AGENT_TYPES` (itself derived
|
|
10
|
-
// from `DEFAULT_DIMENSIONS` plus the snapshot/verifier constants, not a
|
|
11
|
-
// second hand-copied list — see review-core.mjs's own comment on that
|
|
12
|
-
// export). A dimension added to `DEFAULT_DIMENSIONS` without a matching
|
|
13
|
-
// `spawns` entry, or a `spawns` entry that stops matching a dispatched type,
|
|
14
|
-
// fails this test in either direction — and so does a NAME repeated on
|
|
15
|
-
// either side (a duplicate `spawns` entry, or two dispatch sites colliding
|
|
16
|
-
// on one `agentType`), which a bare Set-vs-Set compare would otherwise
|
|
17
|
-
// collapse away silently (#2102 review).
|
|
18
|
-
import { test } from "node:test";
|
|
19
|
-
import assert from "node:assert/strict";
|
|
20
|
-
import { readFileSync, existsSync } from "node:fs";
|
|
21
|
-
import { join } from "node:path";
|
|
22
|
-
import { parseFrontmatter } from "./frontmatter-check.mjs";
|
|
23
|
-
import { SNAPSHOT_AGENT_TYPE, SPAWNED_AGENT_TYPES, TEST_RUN_AGENT_TYPE, VERIFIER_AGENT_TYPE } from "./review-core.mjs";
|
|
24
|
-
|
|
25
|
-
const REPO = join(import.meta.dirname, "..");
|
|
26
|
-
const RUNNER_PATH = join(REPO, "agents", "fleet-review-runner.agent.md");
|
|
27
|
-
const CORE_PATH = join(REPO, "scripts", "review-core.mjs");
|
|
28
|
-
|
|
29
|
-
function declaredSpawns() {
|
|
30
|
-
const text = readFileSync(RUNNER_PATH, "utf8");
|
|
31
|
-
const { fields, error } = parseFrontmatter(text);
|
|
32
|
-
assert.equal(error, undefined, `fleet-review-runner.agent.md frontmatter failed to parse: ${error}`);
|
|
33
|
-
const field = fields.find((f) => f.key === "spawns");
|
|
34
|
-
assert.ok(field, "fleet-review-runner.agent.md declares no spawns field");
|
|
35
|
-
return { field, fields };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
test("fleet-review-runner's spawns allowlist is exactly the set runReviewOnOmp dispatches", () => {
|
|
39
|
-
const { field } = declaredSpawns();
|
|
40
|
-
const declaredList = field.value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
41
|
-
const declared = new Set(declaredList);
|
|
42
|
-
assert.equal(
|
|
43
|
-
declaredList.length,
|
|
44
|
-
declared.size,
|
|
45
|
-
`fleet-review-runner's spawns allowlist lists a name more than once: ${declaredList.join(", ")}`,
|
|
46
|
-
);
|
|
47
|
-
const dispatched = new Set(SPAWNED_AGENT_TYPES);
|
|
48
|
-
assert.equal(
|
|
49
|
-
SPAWNED_AGENT_TYPES.length,
|
|
50
|
-
dispatched.size,
|
|
51
|
-
"SPAWNED_AGENT_TYPES has a duplicate agentType — two of snapshot/a DEFAULT_DIMENSIONS entry/verifier are " +
|
|
52
|
-
`colliding, so one would never actually dispatch under its own identity: ${SPAWNED_AGENT_TYPES.join(", ")}`,
|
|
53
|
-
);
|
|
54
|
-
assert.deepEqual(
|
|
55
|
-
[...declared].sort(),
|
|
56
|
-
[...dispatched].sort(),
|
|
57
|
-
`fleet-review-runner's spawns allowlist (${[...declared].sort().join(", ")}) must equal the ` +
|
|
58
|
-
`set runReviewOnOmp actually dispatches (${[...dispatched].sort().join(", ")}) — a mismatch ` +
|
|
59
|
-
"either silently denies a real dispatch again or over-grants a spawn nothing needs",
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test("fleet-review-runner declares no tools: list — that would drop eval", () => {
|
|
64
|
-
const { fields } = declaredSpawns();
|
|
65
|
-
assert.ok(
|
|
66
|
-
!fields.some((f) => f.key === "tools"),
|
|
67
|
-
"fleet-review-runner.agent.md must not declare tools: — a restricted tool list would drop eval, " +
|
|
68
|
-
"which the runner's whole job (running one eval cell) requires",
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test("every agent type fleet-review-runner is allowed to spawn has a definition file", () => {
|
|
73
|
-
for (const name of SPAWNED_AGENT_TYPES) {
|
|
74
|
-
const p = join(REPO, "agents", `${name}.agent.md`);
|
|
75
|
-
assert.ok(existsSync(p), `${name} (in SPAWNED_AGENT_TYPES) has no agent definition file at ${p}`);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test("review-core.mjs's snapshot/test-run/verifier dispatch sites reference the exported constants, not a hardcoded duplicate", () => {
|
|
80
|
-
// #2102 review: SPAWNED_AGENT_TYPES and the runner's spawns pin above both
|
|
81
|
-
// derive from SNAPSHOT_AGENT_TYPE/TEST_RUN_AGENT_TYPE/VERIFIER_AGENT_TYPE, never from the
|
|
82
|
-
// dispatch call sites themselves — so a call site quietly reverted to a
|
|
83
|
-
// hardcoded string literal (instead of the constant) would leave both
|
|
84
|
-
// pins green while review-core.mjs's real dispatch silently drifts from
|
|
85
|
-
// what SPAWNED_AGENT_TYPES claims. Independent of what the constants are
|
|
86
|
-
// currently defined to equal: this only checks that each call site still
|
|
87
|
-
// references the constant BY NAME.
|
|
88
|
-
const source = readFileSync(CORE_PATH, "utf8");
|
|
89
|
-
assert.equal(SNAPSHOT_AGENT_TYPE, "fleet-review-snapshot");
|
|
90
|
-
assert.match(source, /agentType:\s*SNAPSHOT_AGENT_TYPE\b/);
|
|
91
|
-
assert.equal(TEST_RUN_AGENT_TYPE, "fleet-review-test-run");
|
|
92
|
-
assert.match(source, /agentType:\s*TEST_RUN_AGENT_TYPE\b/);
|
|
93
|
-
assert.equal(VERIFIER_AGENT_TYPE, "fleet-review-verifier");
|
|
94
|
-
assert.match(source, /agentType:\s*VERIFIER_AGENT_TYPE\b/);
|
|
95
|
-
});
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
// #1802 (spec docs/specs/2026-09-24-slot-based-fleet-loop-design.md § 3 §1,
|
|
2
|
-
// §2, §5, §7). `runReviewToFile` is the whole of the omp review runner's job —
|
|
3
|
-
// agents/fleet-review-runner.agent.md's one eval cell calls it and reports
|
|
4
|
-
// what it returns — so the runner's contract is pinned here, where it can be
|
|
5
|
-
// run, rather than in the agent's prose:
|
|
6
|
-
//
|
|
7
|
-
// - the full result object lands at `<scratch>/review-<pr>.json`, and the
|
|
8
|
-
// return carries only the digest, the path and the ledger token;
|
|
9
|
-
// - a throw or an empty return is retried ONCE; a second failure reports
|
|
10
|
-
// `failed` with both errors and names the fallback reviewer
|
|
11
|
-
// `review-pr-<pr>-b`, writing no file;
|
|
12
|
-
// - a dispatch mistake (no absolute scratch, a non-numeric pr) is refused
|
|
13
|
-
// before the review runs at all — it is not a review failure, so it must
|
|
14
|
-
// neither burn two 20-minute runs nor send the controller to the fallback.
|
|
15
|
-
//
|
|
16
|
-
// `run` is injected: the real one is `runReviewOnOmp`, which reads eval's
|
|
17
|
-
// `agent()`/`phase()`/`log()` prelude globals and cannot run under node.
|
|
18
|
-
import { test } from "node:test";
|
|
19
|
-
import assert from "node:assert/strict";
|
|
20
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
21
|
-
import { tempDir } from "./temp-dir.mjs";
|
|
22
|
-
import { join } from "node:path";
|
|
23
|
-
import { runReviewToFile } from "./review-eval.mjs";
|
|
24
|
-
import { DIGEST_KEYS } from "./review-core.mjs";
|
|
25
|
-
|
|
26
|
-
const RESULT = {
|
|
27
|
-
pr: 7,
|
|
28
|
-
head: "abc123",
|
|
29
|
-
resume: null,
|
|
30
|
-
testEnvironment: "The snapshot is a verified repository.",
|
|
31
|
-
dimensionsRun: ["correctness"],
|
|
32
|
-
dimensionsUnrun: [],
|
|
33
|
-
cwdAudit: [{ dimension: "correctness", state: "clean", line: "CWD-AUDIT: clean /repo" }],
|
|
34
|
-
counts: { survived: 1, refuted: 2, unverified: 3, crashed: 0 },
|
|
35
|
-
snapshot: "/scr/pr7/run-ab12/snapshot-abc123",
|
|
36
|
-
survived: [{ claim: "s" }],
|
|
37
|
-
refuted: [{ claim: "r1" }, { claim: "r2" }],
|
|
38
|
-
unverified: [{ claim: "u1" }, { claim: "u2" }, { claim: "u3" }],
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const scratch = () => tempDir("review-runner-");
|
|
42
|
-
|
|
43
|
-
// A `run` that answers from a script, one entry per call; an `Error` entry is
|
|
44
|
-
// thrown. Counts calls so a test can say how many reviews it cost.
|
|
45
|
-
function scriptedRun(answers) {
|
|
46
|
-
const calls = [];
|
|
47
|
-
const run = async (args) => {
|
|
48
|
-
calls.push(args);
|
|
49
|
-
const a = answers[Math.min(calls.length, answers.length) - 1];
|
|
50
|
-
if (a instanceof Error) throw a;
|
|
51
|
-
return a;
|
|
52
|
-
};
|
|
53
|
-
return { run, calls };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
test("a completed review writes the whole result to <scratch>/review-<pr>.json and returns only the digest", async () => {
|
|
57
|
-
const dir = scratch();
|
|
58
|
-
const { run, calls } = scriptedRun([RESULT]);
|
|
59
|
-
const out = await runReviewToFile({ pr: 7, branch: "b", worktree: "/wt", testCmd: "node --test", scratch: dir }, run);
|
|
60
|
-
assert.equal(calls.length, 1);
|
|
61
|
-
assert.equal(out.status, "completed");
|
|
62
|
-
assert.equal(out.path, join(dir, "review-7.json"));
|
|
63
|
-
assert.deepEqual(JSON.parse(readFileSync(out.path, "utf8")), RESULT, "the file is not the bare result object");
|
|
64
|
-
assert.deepEqual(Object.keys(out.digest), DIGEST_KEYS);
|
|
65
|
-
for (const bulk of ["snapshot", "survived", "refuted", "unverified"]) {
|
|
66
|
-
assert.equal(bulk in out.digest, false, `the report carries ${bulk} — findings must reach the fix-applier through the file, not the controller`);
|
|
67
|
-
}
|
|
68
|
-
assert.equal(out.ledger, "reviewed=abc123:1/2/3", "the ledger token is not reviewed=<head>:<survived>/<refuted>/<unverified>");
|
|
69
|
-
assert.equal(out.attempts, 1);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test("the args reach the review unchanged — the runner adds and drops nothing", async () => {
|
|
73
|
-
const dir = scratch();
|
|
74
|
-
const args = { pr: "7", branch: "feature/x", worktree: "/repo/.worktrees/7-x", testCmd: "node --test", scratch: dir };
|
|
75
|
-
const { run, calls } = scriptedRun([RESULT]);
|
|
76
|
-
await runReviewToFile(args, run);
|
|
77
|
-
assert.deepEqual(calls[0], args);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test("a thrown first run is retried once, and the second run's result is the one written", async () => {
|
|
81
|
-
const dir = scratch();
|
|
82
|
-
const { run, calls } = scriptedRun([new Error("snapshot agent returned no tree"), RESULT]);
|
|
83
|
-
const out = await runReviewToFile({ pr: 7, scratch: dir, worktree: "/wt" }, run);
|
|
84
|
-
assert.equal(calls.length, 2);
|
|
85
|
-
assert.equal(out.status, "completed");
|
|
86
|
-
assert.equal(out.attempts, 2);
|
|
87
|
-
assert.match(out.errors[0], /snapshot agent returned no tree/, "the first failure vanished from the report");
|
|
88
|
-
assert.deepEqual(JSON.parse(readFileSync(out.path, "utf8")), RESULT);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("an empty return is a failure too, and is retried", async () => {
|
|
92
|
-
const dir = scratch();
|
|
93
|
-
const { run, calls } = scriptedRun([undefined, RESULT]);
|
|
94
|
-
const out = await runReviewToFile({ pr: 7, scratch: dir, worktree: "/wt" }, run);
|
|
95
|
-
assert.equal(calls.length, 2);
|
|
96
|
-
assert.equal(out.status, "completed");
|
|
97
|
-
assert.match(out.errors[0], /empty/);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// #1813: a truthy, object-shaped result missing `.counts` (e.g. a `run`
|
|
101
|
-
// callback that resolves to the finding buckets without the wrapper) must not
|
|
102
|
-
// reach the `mkdir`/`writeFile` below before the shape is checked — otherwise
|
|
103
|
-
// the destructure of `result.counts` on the next line throws OUTSIDE this
|
|
104
|
-
// function's own retry try/catch, and the half-written file it already put on
|
|
105
|
-
// disk is left there for a fix-applier to mistake for a completed review.
|
|
106
|
-
test("a result missing .counts is a failure too, retried, and leaves no half-written file", async () => {
|
|
107
|
-
const dir = scratch();
|
|
108
|
-
const malformed = { pr: 7, head: "abc123", survived: [], refuted: [], unverified: [] };
|
|
109
|
-
const { run, calls } = scriptedRun([malformed, RESULT]);
|
|
110
|
-
const out = await runReviewToFile({ pr: 7, scratch: dir, worktree: "/wt" }, run);
|
|
111
|
-
assert.equal(calls.length, 2, "the malformed attempt was retried, not thrown past");
|
|
112
|
-
assert.equal(out.status, "completed");
|
|
113
|
-
assert.match(out.errors[0], /empty/);
|
|
114
|
-
assert.deepEqual(JSON.parse(readFileSync(out.path, "utf8")), RESULT, "only the second, well-formed result was ever written");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("two malformed results in a row report failed and write no file", async () => {
|
|
118
|
-
const dir = scratch();
|
|
119
|
-
const malformed = { pr: 7, head: "abc123", survived: [], refuted: [], unverified: [] };
|
|
120
|
-
const { run, calls } = scriptedRun([malformed, malformed]);
|
|
121
|
-
const out = await runReviewToFile({ pr: 7, scratch: dir, worktree: "/wt" }, run);
|
|
122
|
-
assert.equal(calls.length, 2);
|
|
123
|
-
assert.equal(out.status, "failed");
|
|
124
|
-
assert.equal(out.fallback, "review-pr-7-b");
|
|
125
|
-
assert.equal(existsSync(join(dir, "review-7.json")), false, "a malformed result left a partial file behind");
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test("a second failure reports failed with BOTH errors, names the -b fallback, and writes no file", async () => {
|
|
129
|
-
const dir = scratch();
|
|
130
|
-
const { run, calls } = scriptedRun([new Error("first: spend limit"), null]);
|
|
131
|
-
const out = await runReviewToFile({ pr: 7, scratch: dir, worktree: "/wt" }, run);
|
|
132
|
-
assert.equal(calls.length, 2, "the retry is ONE re-run, not a loop");
|
|
133
|
-
assert.equal(out.status, "failed");
|
|
134
|
-
assert.equal(out.errors.length, 2);
|
|
135
|
-
assert.match(out.errors[0], /first: spend limit/);
|
|
136
|
-
assert.match(out.errors[1], /empty/);
|
|
137
|
-
assert.equal(out.fallback, "review-pr-7-b");
|
|
138
|
-
assert.equal(existsSync(join(dir, "review-7.json")), false, "a failed review left a result file a controller would read as a review");
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test("a scratch that is missing or relative is refused before any review runs", async () => {
|
|
142
|
-
for (const bad of [undefined, "", "scratch/fleet", "./x"]) {
|
|
143
|
-
const { run, calls } = scriptedRun([RESULT]);
|
|
144
|
-
await assert.rejects(runReviewToFile({ pr: 7, scratch: bad, worktree: "/wt" }, run), /args\.scratch must be an absolute path/, JSON.stringify(bad));
|
|
145
|
-
assert.equal(calls.length, 0, `${JSON.stringify(bad)}: a review ran for a dispatch whose result file could land in the kernel's cwd`);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// #2323. A scratch the controller already partitioned is a dispatch mistake,
|
|
150
|
-
// not a review failure: runReview would throw it, and without this the runner
|
|
151
|
-
// would retry it and name a fallback reviewer for a review that never ran.
|
|
152
|
-
test("a scratch already ending in pr<N> is refused before any review runs, not retried", async () => {
|
|
153
|
-
for (const bad of ["/x/pr7", "/x/pr7/", "/x/pr42"]) {
|
|
154
|
-
const { run, calls } = scriptedRun([RESULT]);
|
|
155
|
-
await assert.rejects(runReviewToFile({ pr: 7, scratch: bad, worktree: "/wt" }, run), /pass the scratch root/, bad);
|
|
156
|
-
assert.equal(calls.length, 0, `${bad}: a partitioned scratch reached the review`);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
test("a pr that is not a PR number is refused before any review runs", async () => {
|
|
161
|
-
for (const bad of [undefined, "my-branch", "7/../../x", -7]) {
|
|
162
|
-
const { run, calls } = scriptedRun([RESULT]);
|
|
163
|
-
await assert.rejects(runReviewToFile({ pr: bad, scratch: scratch(), worktree: "/wt" }, run), /args\.pr must be a PR number/, JSON.stringify(bad));
|
|
164
|
-
assert.equal(calls.length, 0);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
@@ -1,140 +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
|
-
|
|
7
|
-
// #1349 (per #1303's gap 3): no `agent()` call anywhere in the review port —
|
|
8
|
-
// the shared scripts/review-core.mjs or the omp shim scripts/review-eval.mjs
|
|
9
|
-
// — may pass `model` or `effort` directly. Measured on omp:
|
|
10
|
-
// `agent(prompt, {model, effort})` silently resolves to the baseline model,
|
|
11
|
-
// zero effect, no error. Every dispatch instead names a fleet-owned
|
|
12
|
-
// definition whose OWN frontmatter carries the tier. This file is the
|
|
13
|
-
// general-purpose guard select-dimensions.test.mjs's dispatch-shape pins do
|
|
14
|
-
// not generalize: that file pins SPECIFIC call sites; this one finds every
|
|
15
|
-
// `agent(` call in the audited files and inspects its options object
|
|
16
|
-
// directly, so a NEW call site added later is covered without anyone
|
|
17
|
-
// remembering to extend a list.
|
|
18
|
-
const REPO = join(import.meta.dirname, "..");
|
|
19
|
-
const FILES = {
|
|
20
|
-
"scripts/review-core.mjs": readFileSync(join(REPO, "scripts", "review-core.mjs"), "utf8"),
|
|
21
|
-
"scripts/review-eval.mjs": readFileSync(join(REPO, "scripts", "review-eval.mjs"), "utf8"),
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Every `agent(` call site's own options-object text, brace-balanced from the
|
|
25
|
-
// FIRST `{` after the call's opening paren to its matching close. Comments
|
|
26
|
-
// stripped first so a commented-out `model:` cannot satisfy or defeat this —
|
|
27
|
-
// the same policy every other pin in this directory takes with `stripComments`
|
|
28
|
-
// (strip-comments.mjs's header explains the measured reason).
|
|
29
|
-
function agentCallOptionBlocks(code) {
|
|
30
|
-
const blocks = [];
|
|
31
|
-
const callRe = /\bagent\(/g;
|
|
32
|
-
let m;
|
|
33
|
-
while ((m = callRe.exec(code))) {
|
|
34
|
-
// Find the options object: the first top-level `{` after the call opens,
|
|
35
|
-
// skipping over the prompt argument (a template literal or string, which
|
|
36
|
-
// may itself contain `{`/`}` — e.g. `${d.key}` interpolations). Track
|
|
37
|
-
// paren depth so a nested `agent(...)` inside a prompt string is not
|
|
38
|
-
// mistaken for this call's own close.
|
|
39
|
-
let i = callRe.lastIndex;
|
|
40
|
-
let depth = 1; // the `(` this call just opened
|
|
41
|
-
let inTemplate = 0; // nesting depth of backtick template literals
|
|
42
|
-
let braceStart = -1;
|
|
43
|
-
for (; i < code.length && depth > 0; i++) {
|
|
44
|
-
const c = code[i];
|
|
45
|
-
if (c === "`") inTemplate = inTemplate ? inTemplate - 1 : inTemplate + 1;
|
|
46
|
-
if (inTemplate) continue;
|
|
47
|
-
if (c === "(") depth++;
|
|
48
|
-
else if (c === ")") depth--;
|
|
49
|
-
else if (c === "{" && braceStart === -1 && depth === 1) braceStart = i;
|
|
50
|
-
}
|
|
51
|
-
if (braceStart !== -1) {
|
|
52
|
-
// Brace-balance from braceStart to find the matching `}`.
|
|
53
|
-
let bd = 0, j = braceStart;
|
|
54
|
-
for (; j < code.length; j++) {
|
|
55
|
-
if (code[j] === "{") bd++;
|
|
56
|
-
else if (code[j] === "}") { bd--; if (bd === 0) { j++; break; } }
|
|
57
|
-
}
|
|
58
|
-
blocks.push(code.slice(braceStart, j));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return blocks;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
test("agentCallOptionBlocks finds every options object and stops at its own close", () => {
|
|
65
|
-
const sample = 'x = agent(`hi ${a.b}`, { label: "a", schema: S1 }); y = agent("p2", { label: "b" });';
|
|
66
|
-
const blocks = agentCallOptionBlocks(sample);
|
|
67
|
-
assert.equal(blocks.length, 2);
|
|
68
|
-
assert.match(blocks[0], /label: "a"/);
|
|
69
|
-
assert.doesNotMatch(blocks[0], /label: "b"/);
|
|
70
|
-
assert.match(blocks[1], /label: "b"/);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// Matches `model`/`effort` as an object key in every shape JS allows: bare
|
|
74
|
-
// (`model:`), quoted (`"model":`/`'model':`), and computed
|
|
75
|
-
// (`[modelKey]:`/`["model"]:`/`['effort']:`). Review finding on #1349's PR
|
|
76
|
-
// (#1361): the original bare-only regex (`\bmodel\s*:`) does not match
|
|
77
|
-
// `"model":` at all — the closing quote sits between the word and the
|
|
78
|
-
// colon — so a mutation as small as quoting the key would have shipped
|
|
79
|
-
// silently past this guard. The computed form is included for the same
|
|
80
|
-
// reason a bracket-indexed key is still a real property: `{ [x]: y }` sets
|
|
81
|
-
// whatever string `x` evaluates to, and `x` being the literal `"model"` (or
|
|
82
|
-
// a variable spelled `modelKey`/`modelOverride`/… — the bracket's CONTENTS,
|
|
83
|
-
// not just a literal) is the shape a reviewer next time might reach for to
|
|
84
|
-
// route around a bare-word check.
|
|
85
|
-
function hasTierKey(block, name) {
|
|
86
|
-
const bare = new RegExp(`\\b${name}\\s*:`);
|
|
87
|
-
const quoted = new RegExp(`["']${name}["']\\s*:`);
|
|
88
|
-
const computed = new RegExp(`\\[[^\\]]*${name}[^\\]]*\\]\\s*:`, "i");
|
|
89
|
-
return bare.test(block) || quoted.test(block) || computed.test(block);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Mutation-tested: this must RED the moment a `model`/`effort` key is
|
|
93
|
-
// reintroduced anywhere in an audited file's `agent(` call, and must NOT red
|
|
94
|
-
// on a comment mentioning either word (review-core.mjs's own removal
|
|
95
|
-
// comments say "model"/"effort" repeatedly, by design).
|
|
96
|
-
for (const [name, source] of Object.entries(FILES)) {
|
|
97
|
-
test(`${name}: no agent() call carries model or effort`, () => {
|
|
98
|
-
const code = stripComments(source);
|
|
99
|
-
const blocks = agentCallOptionBlocks(code);
|
|
100
|
-
assert.ok(blocks.length > 0, `${name}: no agent( call found at all — update this test if the file's shape changed`);
|
|
101
|
-
for (const block of blocks) {
|
|
102
|
-
assert.ok(!hasTierKey(block, "model"), `${name}: an agent() call carries \`model\` — #1349 forbids this entirely`);
|
|
103
|
-
assert.ok(!hasTierKey(block, "effort"), `${name}: an agent() call carries \`effort\` — #1349 forbids this entirely`);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// The mutation check, run directly against synthetic mutants rather than
|
|
109
|
-
// against the real files (which must stay clean): confirms the checker
|
|
110
|
-
// itself actually catches every key SHAPE it claims to, not only the bare
|
|
111
|
-
// one.
|
|
112
|
-
test("the checker reds on a synthetic mutation that reintroduces model/effort, bare, quoted, or computed", () => {
|
|
113
|
-
const bareModel = agentCallOptionBlocks(stripComments('agent(prompt, { label: "snapshot", model: "haiku", schema: S });'))[0];
|
|
114
|
-
assert.ok(hasTierKey(bareModel, "model"));
|
|
115
|
-
|
|
116
|
-
const quotedModel = agentCallOptionBlocks(stripComments('agent(prompt, { label: "snapshot", "model": "haiku", schema: S });'))[0];
|
|
117
|
-
assert.ok(hasTierKey(quotedModel, "model"), "a quoted \"model\": key was not caught");
|
|
118
|
-
|
|
119
|
-
const computedModel = agentCallOptionBlocks(stripComments('agent(prompt, { label: "snapshot", [modelKey]: "haiku", schema: S });'))[0];
|
|
120
|
-
assert.ok(hasTierKey(computedModel, "model"), "a computed [modelKey]: key was not caught");
|
|
121
|
-
|
|
122
|
-
const bareEffort = agentCallOptionBlocks(stripComments('agent(prompt, { label: "verify", effort: "low", schema: S });'))[0];
|
|
123
|
-
assert.ok(hasTierKey(bareEffort, "effort"));
|
|
124
|
-
|
|
125
|
-
const quotedEffort = agentCallOptionBlocks(stripComments("agent(prompt, { label: \"verify\", 'effort': \"low\", schema: S });"))[0];
|
|
126
|
-
assert.ok(hasTierKey(quotedEffort, "effort"), "a quoted 'effort': key was not caught");
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// The counterpart to the mutation check: a call carrying `agentType`/`agent`
|
|
130
|
-
// (the legitimate dispatch lever) must NOT be flagged — a checker that reds
|
|
131
|
-
// on everything is not a check. `agentType` itself contains the substring
|
|
132
|
-
// "Type", not "model"/"effort", so the broadened regexes must not fire on it
|
|
133
|
-
// either — tested explicitly since a careless `\b${name}` widening could.
|
|
134
|
-
test("the checker does not false-positive on a legitimate agentType/agent dispatch", () => {
|
|
135
|
-
const clean = agentCallOptionBlocks(stripComments(
|
|
136
|
-
'agent(prompt, { label: "review:x", agentType: "fleet-review-correctness", schema: S });',
|
|
137
|
-
))[0];
|
|
138
|
-
assert.ok(!hasTierKey(clean, "model"));
|
|
139
|
-
assert.ok(!hasTierKey(clean, "effort"));
|
|
140
|
-
});
|