@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,130 +0,0 @@
|
|
|
1
|
-
// #141. `review-and-fix.md` establishes that `./agent-test` is not the command
|
|
2
|
-
// to hand a specialist in a review snapshot: `agent-test` is a TRACKED
|
|
3
|
-
// bootstrap (#55) present in any `git archive HEAD | tar -x` copy, and it
|
|
4
|
-
// materializes the runner via `claim-ticket.sh --write-runner`, which derives
|
|
5
|
-
// the isolation triple from the directory name — a snapshot is not a claimed
|
|
6
|
-
// worktree, so every snapshot in the fleet resolves to the same fixed ports.
|
|
7
|
-
// The "filesystem isolation is not stack isolation"
|
|
8
|
-
// guard in both run-team documents said the opposite — it paired the snapshot
|
|
9
|
-
// with `./agent-test` and closed with "say both, every time", handing a
|
|
10
|
-
// specialist on a snapshot a command that collides with every sibling's.
|
|
11
|
-
//
|
|
12
|
-
// The reason moved once, and the conclusion did not. Until #1056 the
|
|
13
|
-
// materialization simply FAILED there (`claim-ticket: not inside a git
|
|
14
|
-
// repository`, since a bare extraction has no `.git`); the snapshot is now
|
|
15
|
-
// `git init`ed at cut time, so the bootstrap succeeds and produces a runner
|
|
16
|
-
// that is the wrong command for a different, older reason — the stack this
|
|
17
|
-
// section is named for. Measured in a snapshot cut by the current block:
|
|
18
|
-
// `--write-runner` exits 0 and reports `ports derive from the issue number:
|
|
19
|
-
// postgres=16000 ollama=22000`.
|
|
20
|
-
//
|
|
21
|
-
// The two audiences are not interchangeable and neither pin below stands alone:
|
|
22
|
-
// the member in a worktree DOES have the runner and must keep being told to use
|
|
23
|
-
// it, so a sweep that strips `./agent-test` from the guard is the opposite
|
|
24
|
-
// failure and has to redden too.
|
|
25
|
-
//
|
|
26
|
-
// Why point rather than restate: the bullet immediately above this guard in
|
|
27
|
-
// run-team/SKILL.md reserves specialist tree isolation — snapshot provisioning
|
|
28
|
-
// included — to `review-and-fix.md`, so naming the specialist's command here
|
|
29
|
-
// would trade one contradiction for a duplicate that can drift. But a pointer
|
|
30
|
-
// outlives its target silently — measured, deleting review-and-fix.md's
|
|
31
|
-
// specialist-command bullet reddened nothing — so the third pin below holds the
|
|
32
|
-
// TARGET present instead of copying it.
|
|
33
|
-
//
|
|
34
|
-
// THE CEILING, same as agent-test-dir-prose.test.mjs: PRESENCE pins over a
|
|
35
|
-
// bounded slice. A later sentence re-pairing the snapshot with the runner stays
|
|
36
|
-
// green. Reflow stays green by design — `phrase()` matches across any run of
|
|
37
|
-
// whitespace, so run-team/SKILL.md's hard-wrapped copy and isolation.md's long
|
|
38
|
-
// lines take the same regexes.
|
|
39
|
-
import { test } from "node:test";
|
|
40
|
-
import assert from "node:assert/strict";
|
|
41
|
-
import { readFileSync, readdirSync } from "node:fs";
|
|
42
|
-
import { join } from "node:path";
|
|
43
|
-
import { between, phrase } from "./prose-pin.mjs";
|
|
44
|
-
|
|
45
|
-
const REPO = join(import.meta.dirname, "..");
|
|
46
|
-
const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
|
|
47
|
-
const RUN_TEAM = read("skills", "run-team", "SKILL.md");
|
|
48
|
-
const ISOLATION = read("skills", "run-team", "references", "isolation.md");
|
|
49
|
-
const REVIEW_AND_FIX = read("commands", "review-and-fix.md");
|
|
50
|
-
|
|
51
|
-
// Each row carries its label once: the row name is also `between()`'s `what`,
|
|
52
|
-
// so the test name and the doc named in a drift failure cannot disagree.
|
|
53
|
-
const slices = [
|
|
54
|
-
["run-team/SKILL.md", RUN_TEAM, "Filesystem isolation is not stack isolation", "Scratchpad paths need two levels"],
|
|
55
|
-
["references/isolation.md", ISOLATION, "## Filesystem isolation is not stack isolation", "## Scratchpad paths need two levels"],
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
for (const [name, text, from, to] of slices) {
|
|
59
|
-
const slice = () => between(text, from, to, name);
|
|
60
|
-
|
|
61
|
-
test(`${name} sends the specialist on a snapshot to review-and-fix.md for the command`, () => {
|
|
62
|
-
assert.match(slice(), phrase("`review-and-fix.md`"));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test(`${name} keeps \`./agent-test\` as the worktree audience's command`, () => {
|
|
66
|
-
assert.match(slice(), phrase("worktree uses `./agent-test`"));
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Both pins above POINT at review-and-fix.md rather than restate it, so the
|
|
71
|
-
// target's presence needs its own pin or the pointer orphans in silence. The end
|
|
72
|
-
// anchor is the generic next-bullet marker, not the following bullet's wording,
|
|
73
|
-
// which would make an unrelated rewrite of that bullet a boundary failure here.
|
|
74
|
-
// Bounded to the bullet so that a copy of the phrase anywhere else in the file
|
|
75
|
-
// cannot keep the pin satisfied with this bullet deleted.
|
|
76
|
-
test("review-and-fix.md still hands specialists the command both guards point at", () => {
|
|
77
|
-
const bullet = between(REVIEW_AND_FIX, "Give specialists a stack-free test command", "\n- **", "review-and-fix.md");
|
|
78
|
-
assert.match(bullet, phrase("the Test entrypoint, read off the Recipe cache"));
|
|
79
|
-
assert.match(bullet, phrase("`derive-testcmd.sh <worktree or main checkout> test` prints it"));
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// #1150: any member that dispatches a child writes the child's absolute scratch
|
|
83
|
-
// path into its prompt, and the child never derives its own. This bullet is the
|
|
84
|
-
// fallback dispatch site — a member hand-dispatching the specialists because the
|
|
85
|
-
// review could not run — so "their own scratch dir" has to name the directory
|
|
86
|
-
// and who resolves it, pinned with its path. Same bullet slice as above.
|
|
87
|
-
test("review-and-fix.md's fallback specialist dispatch assigns each specialist an absolute scratch path", () => {
|
|
88
|
-
const bullet = between(REVIEW_AND_FIX, "Give specialists a stack-free test command", "\n- **", "review-and-fix.md");
|
|
89
|
-
assert.match(
|
|
90
|
-
bullet,
|
|
91
|
-
phrase("`<scratch>/pr<N>/fleet-review-<key>/`, resolved to an absolute path that you write into that specialist's prompt; a specialist never derives its own"),
|
|
92
|
-
"the fallback specialist dispatch no longer names the directory each specialist gets, or no longer has the dispatcher write it, absolute, into the specialist's prompt",
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// The same contradiction in the other voice: a test file whose comment tells the
|
|
97
|
-
// reader to run it with the worktree runner. A specialist reads that comment on
|
|
98
|
-
// a snapshot, where the runner is not. `node --test <path>` is what most other
|
|
99
|
-
// suite comments here already say, and it runs in both trees — measured on the
|
|
100
|
-
// two files this replaced it in, from the worktree root and from a real
|
|
101
|
-
// `git archive HEAD | tar -x` snapshot (35 and 72 tests, 0 fail, in each; the
|
|
102
|
-
// snapshot carried no `agent-test`).
|
|
103
|
-
//
|
|
104
|
-
// The pattern is a runner invocation whose next token is a path — it holds a
|
|
105
|
-
// separator or ends in `.test.mjs` — so it skips agent-test-dir-prose.test.mjs,
|
|
106
|
-
// whose header discusses the runner as a subject rather than as an instruction.
|
|
107
|
-
// Narrower spellings were measured and rejected: anchoring on a literal
|
|
108
|
-
// `skills/` misses the same instruction written with a `./` on the path, a bare
|
|
109
|
-
// relative path, a quoted glob, or no `./` on the runner, and requiring the
|
|
110
|
-
// argument to end in `.test.mjs` drops the directory form the runner also takes.
|
|
111
|
-
// The `(?!\/\/)` is load-bearing rather than defensive: `\s+` must cross
|
|
112
|
-
// newlines to reach a block comment's continuation, and without the lookahead
|
|
113
|
-
// correct prose that merely ends a line on the runner's name reds too —
|
|
114
|
-
// measured at 7 of 71 reflow widths of agent-test-dir-prose.test.mjs's
|
|
115
|
-
// untouched header, against 0 with it.
|
|
116
|
-
//
|
|
117
|
-
// ITS CEILING: an instruction wrapped across two `//` continuation lines stays
|
|
118
|
-
// green. That is character-identical to wrapped prose about the runner, so no
|
|
119
|
-
// regex separates them; reword such a comment when you meet one.
|
|
120
|
-
//
|
|
121
|
-
// It stays a REGEX with its slashes escaped for a second reason: written as a
|
|
122
|
-
// plain string literal the pattern would occur in this file, and the scan would
|
|
123
|
-
// report itself.
|
|
124
|
-
test("no suite comment tells the reader to run it with the worktree runner", () => {
|
|
125
|
-
const dir = import.meta.dirname;
|
|
126
|
-
const offenders = readdirSync(dir)
|
|
127
|
-
.filter((f) => f.endsWith(".test.mjs"))
|
|
128
|
-
.filter((f) => /agent-test\s+(?!\/\/)\S*(?:\/|\.test\.mjs)/.test(readFileSync(join(dir, f), "utf8")));
|
|
129
|
-
assert.deepEqual(offenders, [], `name \`node --test <path>\` instead: ${offenders.join(", ")}`);
|
|
130
|
-
});
|
|
@@ -1,312 +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
|
-
|
|
6
|
-
// `board.html` is served as ONE self-contained file — board.mjs stages it with a
|
|
7
|
-
// single copyFileSync and createBoardServer routes only `/`, `/board.html` and
|
|
8
|
-
// `/board.json` — so its script is inline and there is nothing to import. The
|
|
9
|
-
// decision under test is lifted out of the SOURCE TEXT and evaluated instead,
|
|
10
|
-
// the same technique select-dimensions.test.mjs uses against scripts/review-core.mjs.
|
|
11
|
-
//
|
|
12
|
-
// Extraction to a module is deliberately NOT the shape here: it would need a
|
|
13
|
-
// second staged file and a fourth route, and a page that renders blank whenever
|
|
14
|
-
// the staging of that second file fails. Coupling to the literal spelling is the
|
|
15
|
-
// cheaper risk, because it breaks loudly, here.
|
|
16
|
-
const HTML = readFileSync(join(import.meta.dirname, "board.html"), "utf8");
|
|
17
|
-
|
|
18
|
-
// A lift reads a COPY. Three guards below keep that copy tied to the page: this
|
|
19
|
-
// one, so a second declaration cannot shadow the lifted one at runtime (a
|
|
20
|
-
// duplicate placed AFTER the real declaration wins by hoisting and is otherwise
|
|
21
|
-
// invisible to every lift); the call-site pin, so the page still routes through
|
|
22
|
-
// what is pinned; and the parse check, so the script the browser gets is valid.
|
|
23
|
-
for (const [name, re] of [
|
|
24
|
-
["spendView", /^function\s+spendView\s*\(/gm],
|
|
25
|
-
["k", /^const k = /gm],
|
|
26
|
-
]) {
|
|
27
|
-
test(`board.html declares ${name} exactly once at top level`, () => {
|
|
28
|
-
assert.equal(HTML.match(re)?.length, 1,
|
|
29
|
-
`${name} must be declared exactly once — a second top-level declaration wins at runtime and the lift below would still read the first`);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Slice to renderSpend's own body before matching, and drop comment lines: a
|
|
34
|
-
// whole-file assert.match is satisfied by any mention anywhere, including a
|
|
35
|
-
// commented-out one.
|
|
36
|
-
// Parameter names are matched as `\w+` throughout, never as the literal `sp`,
|
|
37
|
-
// and the whitespace around a declaration's name and paren is matched as `\s`,
|
|
38
|
-
// never as the literal single space. Neither a rename nor a reformat is a
|
|
39
|
-
// defect, and a lift that misses because of one throws where node registers no
|
|
40
|
-
// test at all — the file's whole total drops in silence rather than reporting a
|
|
41
|
-
// named failure. The duplicate guard above is deliberately `\s`-tolerant in the
|
|
42
|
-
// same places: loosening only that one lets a reformatted declaration pass the
|
|
43
|
-
// count and then die in the lift.
|
|
44
|
-
const renderSpend = HTML.match(/^function\s+renderSpend\s*\((\w+)\)\s*\{[\s\S]*?^\}$/m);
|
|
45
|
-
const renderSpendBody = renderSpend
|
|
46
|
-
? renderSpend[0].split("\n").filter((l) => !/^\s*\/\//.test(l)).join("\n")
|
|
47
|
-
: "";
|
|
48
|
-
|
|
49
|
-
test("renderSpend routes through spendView rather than re-deriving the branch", () => {
|
|
50
|
-
assert.ok(renderSpend, "board.html no longer declares renderSpend as a top-level function — update this test");
|
|
51
|
-
// Without this the whole decision can be disconnected in one token and every
|
|
52
|
-
// case below still passes, against a function the page never calls.
|
|
53
|
-
// The call, not the name it is bound to — a renamed local is not a defect.
|
|
54
|
-
assert.match(renderSpendBody, /=\s*spendView\(\w+\);/);
|
|
55
|
-
// The tri-state must not be re-tested in the renderer; that is what the split
|
|
56
|
-
// removed. The decision's own fields may be read freely; the raw argument
|
|
57
|
-
// reaches exactly one place, the spendView call, and nowhere else. Matching
|
|
58
|
-
// `if (…)` shapes instead pins one spelling of a re-derivation: a pattern
|
|
59
|
-
// anchored on the argument being followed by `.` or `)` is evaded by
|
|
60
|
-
// `if (sp && sp.error)`, by `if (sp?.error)`, and by `const { error } = sp`.
|
|
61
|
-
const bodySansCall = renderSpendBody
|
|
62
|
-
.slice(renderSpendBody.indexOf("{") + 1) // drop the signature
|
|
63
|
-
.replace(/=\s*spendView\(\w+\);/, ""); // and the one legitimate use
|
|
64
|
-
assert.doesNotMatch(bodySansCall, new RegExp(`\\b${renderSpend[1]}\\b`));
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// The test above pins that the decision is REACHED; these pin that each field
|
|
68
|
-
// lands in its own slot. Without them the panel can be miswired one token at a
|
|
69
|
-
// time and every case below still passes, because those only ever look at what
|
|
70
|
-
// spendView RETURNS: drop the hidden branch and a `kind:"hidden"` decision
|
|
71
|
-
// appends an empty `spend-wrap` every tick at run start — the #371 behaviour
|
|
72
|
-
// itself, a box where the panel must render nothing — or swap the two column
|
|
73
|
-
// lists, or the two header strings, and nothing goes red.
|
|
74
|
-
//
|
|
75
|
-
// Each column is pinned by ONE match that carries its heading and its rows
|
|
76
|
-
// together, and the backreference on the host local is the whole of it: a pin
|
|
77
|
-
// on the heading plus a separate pin on the list does not pin that the two
|
|
78
|
-
// belong to the same column, because each is satisfied by the OTHER column's
|
|
79
|
-
// call. Measured on the two-pin form: swapping the two lists, swapping the two
|
|
80
|
-
// headings, and feeding both calls the same host each left this file fully
|
|
81
|
-
// green, and a role column rendering the tool list is what the block exists to
|
|
82
|
-
// catch. The host stays `\w+` — renaming the local is not a defect; what is
|
|
83
|
-
// pinned is that the local a heading is appended to is the local its rows go
|
|
84
|
-
// to. Adjacency of those two statements is part of the pin: a wrapped
|
|
85
|
-
// `append(` survives the collapse below — the optional comma is the trailing
|
|
86
|
-
// one such a wrap picks up — but a statement spliced between a heading and its
|
|
87
|
-
// rows reds it, and that is a restructure worth reading, not a reflow.
|
|
88
|
-
//
|
|
89
|
-
// Left unpinned on purpose: the two `spendRows` option objects. Swapping those
|
|
90
|
-
// is green here, and it is the one wiring break that cannot pass for correct on
|
|
91
|
-
// the page — the callbacks read `.tool`/`.calls` off role rows and `.role`/
|
|
92
|
-
// `.agents` off tool rows, so every label in the column reads `undefined`,
|
|
93
|
-
// where a column silently fed the other list looks like a plausible panel.
|
|
94
|
-
// Pinning them would tie this file to the spelling of four callbacks.
|
|
95
|
-
//
|
|
96
|
-
// Matched against a whitespace-collapsed body: where a line breaks is not
|
|
97
|
-
// wiring, and a pin that reds on a reflow is a false alarm that trains the next
|
|
98
|
-
// reader to loosen it. `flat` is the idiom the *-prose.test.mjs files here use,
|
|
99
|
-
// plus paren-adjacent trimming, because the reflow a long call actually gets is
|
|
100
|
-
// a wrap straight after `(` — which collapsing alone leaves as `spendRows( host,`
|
|
101
|
-
// and every pin below would then miss. Spacing after a comma is left as the one
|
|
102
|
-
// space the collapse produces; the pins are written with it.
|
|
103
|
-
const renderSpendFlat = renderSpendBody
|
|
104
|
-
.replace(/\s+/g, " ").replace(/\( /g, "(").replace(/ \)/g, ")");
|
|
105
|
-
for (const [claim, re] of [
|
|
106
|
-
["the hidden decision appends nothing", /if \(\w+\.kind === "hidden"\) return;/],
|
|
107
|
-
["a text-only decision reaches the DOM", /el\("div", "spend-wrap", \w+\.text\)/],
|
|
108
|
-
["the lede string fills the lede slot", /el\("span", "lede", \w+\.lede\)/],
|
|
109
|
-
["the note string fills the note slot", /el\("span", "note", \w+\.note\)/],
|
|
110
|
-
["the role list fills the column headed `by role`", /(\w+)\.append\(el\("h3", null, "by role"\),?\); spendRows\(\1, \w+\.roles,/],
|
|
111
|
-
["the tool list fills the column headed by the tool heading", /(\w+)\.append\(el\("h3", null, \w+\.toolHeading\),?\); spendRows\(\1, \w+\.tools,/],
|
|
112
|
-
]) {
|
|
113
|
-
test(`renderSpend wires the decision through: ${claim}`, () => {
|
|
114
|
-
assert.match(renderSpendFlat, re);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Both the parse check right below and the K_SRC/VIEW_SRC lifts further down
|
|
119
|
-
// each read board.html's inline script via a single (non-global) match, so
|
|
120
|
-
// both assume the page carries exactly one <script> block: a second block —
|
|
121
|
-
// decoy or real, placed before OR after the renderer's own — is silently
|
|
122
|
-
// invisible to whichever occurrence that match happens to land on, and the
|
|
123
|
-
// duplicate-declaration guards above only ever catch a second `k`/`spendView`
|
|
124
|
-
// specifically, not every way a second block could misdirect these reads.
|
|
125
|
-
// Named as its own test and placed before both reads: asserting this inline,
|
|
126
|
-
// mixed into either read as a bare top-level statement, would throw during
|
|
127
|
-
// module load on failure and drop this whole file's test count to zero
|
|
128
|
-
// instead of reporting a named failure.
|
|
129
|
-
test("board.html carries exactly one <script> block", () => {
|
|
130
|
-
const blocks = [...HTML.matchAll(/<script>\n[\s\S]*?\n<\/script>/g)];
|
|
131
|
-
assert.equal(blocks.length, 1,
|
|
132
|
-
"board.html's parse check and its K_SRC/VIEW_SRC lifts below all assume exactly one " +
|
|
133
|
-
"<script> block — if a second is genuinely wanted, those reads need to become " +
|
|
134
|
-
"block-scoped rather than whole-file, and this assertion updated to match");
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
test("board.html's inline script parses", () => {
|
|
138
|
-
// An extraction is a restructure of this file's script; a broken one would not
|
|
139
|
-
// fail any other test in the suite, it would blank the page at runtime.
|
|
140
|
-
const m = HTML.match(/<script>\n([\s\S]*?)\n<\/script>/);
|
|
141
|
-
assert.ok(m, "board.html no longer carries its renderer in a bare inline <script> — update this test");
|
|
142
|
-
assert.doesNotThrow(() => new Function(`return function(){${m[1]}}`));
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// `spendView` closes over `k`, a module-level const declared above it, so the
|
|
146
|
-
// lift takes both. Left out, `k` is a ReferenceError rather than a wrong answer —
|
|
147
|
-
// it fails loud rather than pinning a stale result.
|
|
148
|
-
const K_SRC = HTML.match(/^const k = .*;$/m);
|
|
149
|
-
const VIEW_SRC = HTML.match(/^function\s+spendView\s*\(\w+\)\s*\{[\s\S]*?^\}$/m);
|
|
150
|
-
|
|
151
|
-
test("board.html still declares k and spendView in the shape this file lifts", () => {
|
|
152
|
-
// Named, and outside the lift itself: asserting inside it throws before node
|
|
153
|
-
// registers anything, which drops the file's total to zero and reports one
|
|
154
|
-
// file-level error instead of telling you which claim stopped holding.
|
|
155
|
-
assert.ok(K_SRC, "board.html no longer declares `k` as a one-line top-level const — update this test");
|
|
156
|
-
assert.ok(VIEW_SRC, "board.html no longer declares spendView as a top-level function — update this test");
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const spendView = K_SRC && VIEW_SRC
|
|
160
|
-
? new Function(`${K_SRC[0]}\n${VIEW_SRC[0]}\nreturn spendView;`)()
|
|
161
|
-
: () => { throw new Error("spendView could not be lifted from board.html — see the shape test above"); };
|
|
162
|
-
|
|
163
|
-
// A run whose transcripts all read fine. Fields are the ones gatherSpend returns,
|
|
164
|
-
// `ok: true` included — it is the tag the view routes on, not decoration (#959).
|
|
165
|
-
const ok = (o = {}) => ({
|
|
166
|
-
ok: true,
|
|
167
|
-
totals: { cacheWrite: 2_000_000, cacheRead: 500_000, output: 12_000, agents: 4 },
|
|
168
|
-
roles: [{ role: "reviewer", agents: 2, cacheWrite: 1_500_000, pct: 75 }],
|
|
169
|
-
tools: [{ tool: "Bash", calls: 9, cacheWrite: 400_000, pct: 40 }],
|
|
170
|
-
reviewPct: 75,
|
|
171
|
-
attributedPct: 60,
|
|
172
|
-
skipped: 0,
|
|
173
|
-
...o,
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
test("no spend yet hides the panel", () => {
|
|
177
|
-
// Normal at run start: gatherSpend returns null when there is no transcript
|
|
178
|
-
// dir to read and nothing was skipped.
|
|
179
|
-
assert.deepEqual(spendView(null), { kind: "hidden" });
|
|
180
|
-
assert.deepEqual(spendView(undefined), { kind: "hidden" });
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test("an error is shown, never hidden", () => {
|
|
184
|
-
// The operator has to act on this one, and stderr is not a channel: the board
|
|
185
|
-
// is launched backgrounded and the operator is watching the page.
|
|
186
|
-
assert.deepEqual(spendView({ ok: false, error: "no transcript dir for cwd /x" }),
|
|
187
|
-
{ kind: "error", text: "spend unavailable: no transcript dir for cwd /x" });
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test("a success object with no cache-write but a non-zero skipped count reports the skip, not nothing (#371)", () => {
|
|
191
|
-
// THE REGRESSION THIS FILE EXISTS FOR. renderSpend used to return early on a
|
|
192
|
-
// falsy cacheWrite and swallow `skipped` with it, so a run whose transcripts
|
|
193
|
-
// were unreadable rendered identically to a run that had not started. The fix
|
|
194
|
-
// shipped with nothing to pin it.
|
|
195
|
-
assert.deepEqual(spendView(ok({ totals: { cacheWrite: 0, cacheRead: 0, output: 0, agents: 0 }, skipped: 3 })),
|
|
196
|
-
{ kind: "note", text: "3 transcripts skipped; no spend recorded yet" });
|
|
197
|
-
// Same conflation one step earlier: totals absent entirely rather than zeroed.
|
|
198
|
-
assert.deepEqual(spendView({ ok: true, skipped: 1 }),
|
|
199
|
-
{ kind: "note", text: "1 transcript skipped; no spend recorded yet" });
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
test("no cache-write and nothing skipped is the one legitimate hide", () => {
|
|
203
|
-
// Zeroes would read as "this run was free", a worse lie than absence. With no
|
|
204
|
-
// skipped count there is nothing to report, so absence is correct here.
|
|
205
|
-
assert.deepEqual(spendView(ok({ totals: { cacheWrite: 0, cacheRead: 0, output: 0, agents: 0 }, skipped: 0 })),
|
|
206
|
-
{ kind: "hidden" });
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test("a funded run renders the panel, with both headline strings", () => {
|
|
210
|
-
const v = spendView(ok());
|
|
211
|
-
assert.equal(v.kind, "panel");
|
|
212
|
-
assert.equal(v.lede, "2.0M cache-write · 500k cache-read · 12k output · 4 agents · review 75%");
|
|
213
|
-
assert.equal(v.note, "ranked on cache-creation; tool split is attributed, not billed");
|
|
214
|
-
assert.equal(v.toolHeading, "by tool — 60% of cache-write attributed");
|
|
215
|
-
assert.deepEqual(v.roles, [{ role: "reviewer", agents: 2, cacheWrite: 1_500_000, pct: 75 }]);
|
|
216
|
-
assert.deepEqual(v.tools, [{ tool: "Bash", calls: 9, cacheWrite: 400_000, pct: 40 }]);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
test("a funded run still carries its skipped count into the panel note", () => {
|
|
220
|
-
// The skip does not stop mattering once there is spend to show: the count is
|
|
221
|
-
// live every tick, and the note is the only place it reaches the operator.
|
|
222
|
-
assert.equal(spendView(ok({ skipped: 2 })).note,
|
|
223
|
-
"2 transcripts skipped; ranked on cache-creation; tool split is attributed, not billed");
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
test("a fully unattributed run says 0%, and only an absent figure falls back", () => {
|
|
227
|
-
// The guard is `!= null`, not truthiness: 0% attributed is a real measurement
|
|
228
|
-
// and reads differently from "this build does not compute one".
|
|
229
|
-
assert.equal(spendView(ok({ attributedPct: 0 })).toolHeading, "by tool — 0% of cache-write attributed");
|
|
230
|
-
assert.equal(spendView(ok({ attributedPct: null })).toolHeading, "by tool");
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
test("the tool column is capped and both columns tolerate a missing list", () => {
|
|
234
|
-
const many = Array.from({ length: 12 }, (_, i) => ({ tool: `t${i}`, calls: 1, cacheWrite: 1, pct: 1 }));
|
|
235
|
-
assert.equal(spendView(ok({ tools: many })).tools.length, 8);
|
|
236
|
-
const bare = spendView(ok({ roles: undefined, tools: undefined }));
|
|
237
|
-
assert.deepEqual(bare.roles, []);
|
|
238
|
-
assert.deepEqual(bare.tools, []);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
test("#916: a damaged-line count reaches the panel note, distinctly from a skip", () => {
|
|
242
|
-
// Second tally, second phrase. `skipped` means the transcript contributed
|
|
243
|
-
// nothing; `damaged` means it contributed but the torn line's own tool_use
|
|
244
|
-
// blocks and output_tokens snapshot may be missing — cache_creation/
|
|
245
|
-
// cache_read repeat on every line of a turn and survive a mid-turn tear,
|
|
246
|
-
// so the phrase hedges rather than asserting the numbers beside it are wrong.
|
|
247
|
-
assert.equal(spendView(ok({ damaged: 1 })).note,
|
|
248
|
-
"1 damaged transcript line — spend may be incomplete; ranked on cache-creation; tool split is attributed, not billed");
|
|
249
|
-
// Both in one tick, plural wording, in the order the note lists them:
|
|
250
|
-
// most spend lost first. A phrase spliced into the wrong slot reds here.
|
|
251
|
-
assert.equal(spendView(ok({ skipped: 1, damaged: 3 })).note,
|
|
252
|
-
"1 transcript skipped; 3 damaged transcript lines — spend may be incomplete; ranked on cache-creation; tool split is attributed, not billed");
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
test("#916: a run whose only turn WAS the damaged line reports the damage, not nothing", () => {
|
|
256
|
-
// The worst case in the ticket, and the one measured on the tree before this
|
|
257
|
-
// fix: a transcript holding a single torn line and nothing else returned
|
|
258
|
-
// `kind: "hidden"` — the panel rendered NOTHING for a run whose entire spend
|
|
259
|
-
// had been destroyed, a fault presented as an idle run. cacheWrite is 0
|
|
260
|
-
// because the damaged line was the only cache-creation turn there was, so
|
|
261
|
-
// `skipped` is 0 and this branch is reachable by
|
|
262
|
-
// `damaged` alone.
|
|
263
|
-
assert.deepEqual(spendView(ok({ totals: { cacheWrite: 0, cacheRead: 0, output: 0, agents: 1 }, skipped: 0, damaged: 1 })),
|
|
264
|
-
{ kind: "note", text: "1 damaged transcript line; no spend recorded yet" });
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
test("#916: a clean empty run with damaged zero is still the one legitimate hide", () => {
|
|
268
|
-
// The no-false-positive half at the view layer: an unguarded push renders
|
|
269
|
-
// "0 damaged transcript lines; no spend recorded yet" over a run that has
|
|
270
|
-
// simply not started, which is the reverse of the conflation this panel
|
|
271
|
-
// removes. The funded branch's copy of that mutation reds the plain-note test
|
|
272
|
-
// above; this is the branch that one cannot see.
|
|
273
|
-
assert.deepEqual(spendView(ok({ totals: { cacheWrite: 0, cacheRead: 0, output: 0, agents: 0 }, skipped: 0, damaged: 0 })),
|
|
274
|
-
{ kind: "hidden" });
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
test("an error with no usable message still renders the error panel (#959)", () => {
|
|
278
|
-
// The case #371 pinned as broken and #959 fixed. gatherSpend's outer catch
|
|
279
|
-
// returns `{ ok: false, error: e.message }`, and `e.message` is "" for an
|
|
280
|
-
// error thrown without one and `undefined` for a thrown non-Error — two
|
|
281
|
-
// shapes that, under the old truthiness discriminant, missed the error branch,
|
|
282
|
-
// found no totals, and HID the panel: a fault rendered as an idle run.
|
|
283
|
-
//
|
|
284
|
-
// Both are one case now, because the tag decides and the message only words
|
|
285
|
-
// the text. That is the whole value of the reshape over a presence check,
|
|
286
|
-
// which would have fixed "" and left `undefined` hidden.
|
|
287
|
-
const shown = { kind: "error", text: "spend unavailable: no reason given" };
|
|
288
|
-
assert.deepEqual(spendView({ ok: false, error: "" }), shown);
|
|
289
|
-
assert.deepEqual(spendView({ ok: false, error: undefined }), shown);
|
|
290
|
-
assert.deepEqual(spendView({ ok: false }), shown);
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
test("the TAG decides the branch, never the presence or truthiness of another field (#959)", () => {
|
|
294
|
-
// What makes the reshape more than a fixed discriminant: nothing but `ok`
|
|
295
|
-
// says which case a payload is. A success payload that happens to carry an
|
|
296
|
-
// `error` key is still a success, so no future reader can reintroduce
|
|
297
|
-
// "the error field means it failed" and have the suite agree.
|
|
298
|
-
assert.equal(spendView(ok({ error: "left over from somewhere" })).kind, "panel");
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
test("an untagged payload is treated as an error, never as a success (#959)", () => {
|
|
302
|
-
// The wrongly-REFUSE direction, decided on purpose. `!sp.ok` means a stale
|
|
303
|
-
// `board.json` written by an older board.mjs renders "spend unavailable"
|
|
304
|
-
// rather than its panel — a visible wrong answer that self-heals on the next
|
|
305
|
-
// tick (~15s). The alternative bias, `sp.ok === false`, would route a legacy
|
|
306
|
-
// `{ error: "…" }` back to hidden, which is the invisible wrong answer this
|
|
307
|
-
// whole ticket exists to remove. Loud and temporary beats silent.
|
|
308
|
-
assert.equal(spendView({ totals: { cacheWrite: 2_000_000, cacheRead: 1, output: 1, agents: 1 }, reviewPct: 50 }).kind, "error");
|
|
309
|
-
// A legacy error payload keeps its message rather than losing it to the fallback.
|
|
310
|
-
assert.deepEqual(spendView({ error: "no transcript dir for cwd /x" }),
|
|
311
|
-
{ kind: "error", text: "spend unavailable: no transcript dir for cwd /x" });
|
|
312
|
-
});
|