@feigi/fleet-ctl 3.23.35 → 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,429 +0,0 @@
|
|
|
1
|
-
// #1584: a board payload names the workspace it describes and the port it was
|
|
2
|
-
// served on, and the page names the repo in its tab title and its header.
|
|
3
|
-
//
|
|
4
|
-
// Before this, two cockpits were two identical windows: `board.html` carried a
|
|
5
|
-
// constant `<title>` and a constant header, the model's `repo` field was never
|
|
6
|
-
// read by the page at all, and the only identity anywhere near the payload was
|
|
7
|
-
// the `workspace` key #1585's launch handshake stamped onto the SERVED copy
|
|
8
|
-
// after computeBoard() had already returned — so `board.mjs build` printed a
|
|
9
|
-
// snapshot that could not say which of two workspaces it came from.
|
|
10
|
-
//
|
|
11
|
-
// Driven through the real CLI, out of process: gather() reads process.argv
|
|
12
|
-
// directly and resolveCockpitInstance()'s git probe is a spawn, so the join
|
|
13
|
-
// under test only exists in a child. The page half is lifted out of
|
|
14
|
-
// board.html's source text and called as a pure function — the page is served
|
|
15
|
-
// as one self-contained file with no build step and no DOM harness, the same
|
|
16
|
-
// seam spend-view.test.mjs and ledger-read-require-file.test.mjs already use.
|
|
17
|
-
//
|
|
18
|
-
// A separate file rather than more of board.test.mjs, for the reason
|
|
19
|
-
// board-prev-shape.test.mjs gives: the fleet runs several implementers at
|
|
20
|
-
// once and two PRs appending to one test file conflict, which costs the PR
|
|
21
|
-
// its CI entirely.
|
|
22
|
-
|
|
23
|
-
import { test } from "node:test";
|
|
24
|
-
import assert from "node:assert/strict";
|
|
25
|
-
import { spawnSync, spawn } from "node:child_process";
|
|
26
|
-
import { rmSync, readFileSync, realpathSync, symlinkSync } from "node:fs";
|
|
27
|
-
import { tempDir } from "./temp-dir.mjs";
|
|
28
|
-
import { join } from "node:path";
|
|
29
|
-
import { fileURLToPath } from "node:url";
|
|
30
|
-
import { resolveCockpitInstance } from "./board.mjs";
|
|
31
|
-
import { gitEnv } from "./git-env.mjs";
|
|
32
|
-
import { writeExecStub } from "./exec-stub.mjs";
|
|
33
|
-
|
|
34
|
-
const SCRIPT = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
35
|
-
const HTML = readFileSync(new URL("./board.html", import.meta.url), "utf8");
|
|
36
|
-
|
|
37
|
-
// The port this file hardcoded before instance resolution existed, and the one
|
|
38
|
-
// the degrade arm still answers with. Spelled out rather than imported because
|
|
39
|
-
// board.mjs does not export it — the same copy board.test.mjs's window rows
|
|
40
|
-
// keep, and a drift would fail the degrade row below loudly.
|
|
41
|
-
const PORT_BASE = 8123;
|
|
42
|
-
|
|
43
|
-
// A PATH carrying git, a gh stub, and nothing else: every board built here
|
|
44
|
-
// stays offline, and `node` is deliberately unreachable so gather()'s ledger
|
|
45
|
-
// read fails fast instead of shelling out to a real ledger.mjs. None of these
|
|
46
|
-
// tests asserts a ticket.
|
|
47
|
-
function shimPath(ghBody) {
|
|
48
|
-
const bin = tempDir("board-id-bin-");
|
|
49
|
-
const real = spawnSync("sh", ["-c", "command -v git"], { encoding: "utf8" });
|
|
50
|
-
assert.equal(real.status, 0, "test setup: no git on PATH to shim, so the resolved arm cannot be reached");
|
|
51
|
-
symlinkSync(real.stdout.trim(), join(bin, "git"));
|
|
52
|
-
writeExecStub(join(bin, "gh"), ghBody);
|
|
53
|
-
return bin;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Every gh read fails: each one goes through tryRun, which catches and
|
|
57
|
-
// degrades, so the board still builds and `repo` stays null.
|
|
58
|
-
const GH_FAILS = "#!/bin/sh\nexit 1\n";
|
|
59
|
-
|
|
60
|
-
// Answers only `gh repo view`, with the identity this instance should render.
|
|
61
|
-
const ghNamed = (nameWithOwner) => "#!/bin/sh\ncase \"$1 $2\" in\n\"repo view\") "
|
|
62
|
-
+ `echo '{"nameWithOwner":"${nameWithOwner}","url":"https://example.test/${nameWithOwner}"}' ;;\n`
|
|
63
|
-
+ "*) exit 1 ;;\nesac\n";
|
|
64
|
-
|
|
65
|
-
// realpath, not the bare mkdtemp path: on darwin $TMPDIR lives under /var,
|
|
66
|
-
// which is a symlink to /private/var, and resolveCockpitInstance canonicalises
|
|
67
|
-
// the workspace it derives. Comparing against the unresolved form would fail
|
|
68
|
-
// on the symlink rather than on the behaviour.
|
|
69
|
-
function gitRepo(prefix) {
|
|
70
|
-
const dir = realpathSync(tempDir(prefix));
|
|
71
|
-
// GIT_DIR/GIT_WORK_TREE scrubbed off the fixture too: under an ambient one
|
|
72
|
-
// `git init` exits 0 having re-inited whichever directory the variable
|
|
73
|
-
// names, leaving this one silently not a repository.
|
|
74
|
-
const init = spawnSync("git", ["init", "-q"], { cwd: dir, stdio: "ignore", env: gitEnv() });
|
|
75
|
-
assert.equal(init.status, 0, "test setup: git init must succeed");
|
|
76
|
-
return dir;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// HOME is redirected at every child: gatherSpend() scans $HOME for this cwd's
|
|
80
|
-
// omp session transcripts, and pointing it at an empty directory keeps these
|
|
81
|
-
// runs off the machine's real session tree.
|
|
82
|
-
function runBuild(cwd, bin) {
|
|
83
|
-
const home = tempDir("board-id-home-");
|
|
84
|
-
const r = spawnSync(process.execPath, [SCRIPT, "build"], {
|
|
85
|
-
cwd, encoding: "utf8", timeout: 20000,
|
|
86
|
-
env: { ...process.env, PATH: bin, HOME: home },
|
|
87
|
-
});
|
|
88
|
-
rmSync(home, { recursive: true, force: true });
|
|
89
|
-
return r;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
test("CLI: a built snapshot names the workspace it describes and the port that workspace is served on", () => {
|
|
93
|
-
const bin = shimPath(GH_FAILS), repo = gitRepo("board-id-build-");
|
|
94
|
-
try {
|
|
95
|
-
const r = runBuild(repo, bin);
|
|
96
|
-
assert.equal(r.status, 0, r.stderr);
|
|
97
|
-
const board = JSON.parse(r.stdout);
|
|
98
|
-
assert.ok(Array.isArray(board.tickets), `stdout must still be a board model: ${r.stdout.slice(0, 200)}`);
|
|
99
|
-
|
|
100
|
-
assert.equal(board.workspace, repo,
|
|
101
|
-
"a snapshot that cannot name its workspace is the anonymous file this ticket exists to remove");
|
|
102
|
-
// The port is the DERIVED one — the port this workspace's cockpit answers
|
|
103
|
-
// on, which is what makes a stray file self-identifying. Computed through
|
|
104
|
-
// the exported seam rather than hardcoded, so the hash algorithm stays
|
|
105
|
-
// free to be tested where it is defined, but the real CLI reached it
|
|
106
|
-
// through a real `git rev-parse`, which is the join under test.
|
|
107
|
-
const expected = resolveCockpitInstance({ cwd: repo, gitCommonDir: ".git" });
|
|
108
|
-
assert.equal(board.port, expected.port);
|
|
109
|
-
assert.notEqual(board.port, null);
|
|
110
|
-
} finally { for (const d of [bin, repo]) rmSync(d, { recursive: true, force: true }); }
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// The fallback half of the same claim. A build outside any checkout has no
|
|
114
|
-
// workspace to name — but it must still SAY so, with both keys present and
|
|
115
|
-
// null where the identity is unknown, rather than dropping the fields and
|
|
116
|
-
// leaving a reader unable to tell an old payload from a degraded one.
|
|
117
|
-
test("CLI: a build with no resolvable workspace still carries both keys — null workspace, base port", () => {
|
|
118
|
-
const bin = shimPath(GH_FAILS);
|
|
119
|
-
const cwd = realpathSync(tempDir("board-id-nogit-"));
|
|
120
|
-
try {
|
|
121
|
-
const r = runBuild(cwd, bin);
|
|
122
|
-
assert.equal(r.status, 0, r.stderr);
|
|
123
|
-
// Without this the row passes vacuously: a cwd that turned out to be
|
|
124
|
-
// inside some repository would take the resolved arm and never reach the
|
|
125
|
-
// degrade this test is about.
|
|
126
|
-
assert.match(r.stderr, /could not resolve --git-common-dir/, r.stderr);
|
|
127
|
-
const board = JSON.parse(r.stdout);
|
|
128
|
-
assert.ok("workspace" in board && "port" in board,
|
|
129
|
-
`both identity keys must be present even when there is no instance: ${r.stdout.slice(0, 200)}`);
|
|
130
|
-
assert.equal(board.workspace, null);
|
|
131
|
-
assert.equal(board.port, PORT_BASE);
|
|
132
|
-
} finally { for (const d of [bin, cwd]) rmSync(d, { recursive: true, force: true }); }
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const withTimeout = (pr, ms, what) => Promise.race([
|
|
136
|
-
pr,
|
|
137
|
-
new Promise((_, rej) => setTimeout(() => rej(new Error(`timed out waiting for ${what}`)), ms).unref()),
|
|
138
|
-
]);
|
|
139
|
-
|
|
140
|
-
function serveProcess(cwd, bin) {
|
|
141
|
-
const home = tempDir("board-id-home-");
|
|
142
|
-
const p = spawn(process.execPath, [SCRIPT, "serve", "--port", "0", "--interval", "3600"],
|
|
143
|
-
{ cwd, env: { ...process.env, PATH: bin, HOME: home }, stdio: ["ignore", "ignore", "pipe"] });
|
|
144
|
-
p.stderr.setEncoding("utf8");
|
|
145
|
-
let buf = "";
|
|
146
|
-
const port = new Promise((res, rej) => {
|
|
147
|
-
p.stderr.on("data", (d) => {
|
|
148
|
-
buf += d;
|
|
149
|
-
const m = buf.match(/cockpit on http:\/\/localhost:(\d+)/);
|
|
150
|
-
if (m) res(Number(m[1]));
|
|
151
|
-
});
|
|
152
|
-
p.on("exit", (code) => rej(new Error(`serve exited (${code}) before announcing: ${buf}`)));
|
|
153
|
-
});
|
|
154
|
-
return { p, port };
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// The announcement comes BEFORE the first tick (#1660 publishes identity at
|
|
158
|
-
// bind time so a racing launch's probe has something to read), so the first
|
|
159
|
-
// payload on the wire can still be that stub. Poll for a real tick rather than
|
|
160
|
-
// racing it — `generatedAt` is the field only computeBoard() produces.
|
|
161
|
-
async function builtBoard(port) {
|
|
162
|
-
const ms = 20000, deadline = Date.now() + ms;
|
|
163
|
-
for (;;) {
|
|
164
|
-
const res = await fetch(`http://localhost:${port}/board.json`);
|
|
165
|
-
if (res.status === 200) {
|
|
166
|
-
const body = await res.json();
|
|
167
|
-
if (typeof body.generatedAt === "number") return body;
|
|
168
|
-
} else { await res.arrayBuffer(); }
|
|
169
|
-
if (Date.now() > deadline) throw new Error(`no built board on port ${port} after ${ms}ms`);
|
|
170
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// The end-to-end claim the whole ticket is for: two cockpits up at once are
|
|
175
|
-
// two DIFFERENT windows — different identity in the payload, and a different
|
|
176
|
-
// name in the tab strip and the header, each naming its own repo.
|
|
177
|
-
//
|
|
178
|
-
// `--port 0` on both, deliberately, and not only to keep the test off this
|
|
179
|
-
// machine's derived ports: an ephemeral bind is the one case where the port
|
|
180
|
-
// the caller asked for and the port the board is reachable on differ, so the
|
|
181
|
-
// payload echoing the REQUEST would say `port: 0` here and nowhere else.
|
|
182
|
-
test("CLI: two concurrent cockpits carry two identities, and their titles name two different repos", async () => {
|
|
183
|
-
const binA = shimPath(ghNamed("acme/one")), binB = shimPath(ghNamed("acme/two"));
|
|
184
|
-
const repoA = gitRepo("board-id-a-"), repoB = gitRepo("board-id-b-");
|
|
185
|
-
const procs = [];
|
|
186
|
-
try {
|
|
187
|
-
const a = serveProcess(repoA, binA), b = serveProcess(repoB, binB);
|
|
188
|
-
procs.push(a.p, b.p);
|
|
189
|
-
const [portA, portB] = await withTimeout(Promise.all([a.port, b.port]), 20000, "both cockpits to announce");
|
|
190
|
-
const [boardA, boardB] = await withTimeout(
|
|
191
|
-
Promise.all([builtBoard(portA), builtBoard(portB)]), 20000, "both cockpits to build a board");
|
|
192
|
-
|
|
193
|
-
assert.equal(boardA.workspace, repoA);
|
|
194
|
-
assert.equal(boardB.workspace, repoB);
|
|
195
|
-
assert.notEqual(boardA.workspace, boardB.workspace, "two workspaces cannot share one identity");
|
|
196
|
-
|
|
197
|
-
// The port SERVED, not the port requested: both asked for 0.
|
|
198
|
-
assert.equal(boardA.port, portA);
|
|
199
|
-
assert.equal(boardB.port, portB);
|
|
200
|
-
assert.notEqual(boardA.port, boardB.port);
|
|
201
|
-
|
|
202
|
-
assert.equal(boardA.repo, "acme/one");
|
|
203
|
-
assert.equal(boardB.repo, "acme/two");
|
|
204
|
-
assert.notEqual(boardTitle(boardA.repo), boardTitle(boardB.repo),
|
|
205
|
-
"two boards rendering one title is the defect this ticket names");
|
|
206
|
-
assert.match(boardTitle(boardA.repo), /acme\/one/);
|
|
207
|
-
assert.match(boardTitle(boardB.repo), /acme\/two/);
|
|
208
|
-
} finally {
|
|
209
|
-
for (const p of procs) p.kill("SIGKILL");
|
|
210
|
-
for (const d of [binA, binB, repoA, repoB]) rmSync(d, { recursive: true, force: true });
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
// ── the page ────────────────────────────────────────────────────────────────
|
|
215
|
-
//
|
|
216
|
-
// A lift reads a COPY, so the guards below keep that copy tied to the page: a
|
|
217
|
-
// second top-level declaration would win at runtime by hoisting while the lift
|
|
218
|
-
// still read the first.
|
|
219
|
-
|
|
220
|
-
for (const [name, re] of [
|
|
221
|
-
["TITLE", /^const TITLE = /gm],
|
|
222
|
-
["boardTitle", /^function\s+boardTitle\s*\(/gm],
|
|
223
|
-
]) {
|
|
224
|
-
test(`board.html declares ${name} exactly once at top level`, () => {
|
|
225
|
-
assert.equal(HTML.match(re)?.length, 1,
|
|
226
|
-
`${name} must be declared exactly once — a second top-level declaration wins at runtime and the lift below would still read the first`);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const TITLE_SRC = HTML.match(/^const TITLE = .*$/m);
|
|
231
|
-
const BOARD_TITLE_SRC = HTML.match(/^function\s+boardTitle\s*\(.*$/m);
|
|
232
|
-
|
|
233
|
-
test("board.html still declares TITLE and boardTitle in the shape this file lifts", () => {
|
|
234
|
-
// Named and outside the lift: an assertion thrown during the lift itself
|
|
235
|
-
// runs before node registers any test here, which reports one opaque
|
|
236
|
-
// file-level error instead of naming the claim that stopped holding.
|
|
237
|
-
assert.ok(TITLE_SRC, "board.html no longer declares TITLE as a one-line top-level const — update this test");
|
|
238
|
-
assert.ok(BOARD_TITLE_SRC, "board.html no longer declares boardTitle as a one-line top-level function — update this test");
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
const boardTitle = TITLE_SRC && BOARD_TITLE_SRC
|
|
242
|
-
? new Function(`${TITLE_SRC[0]}\n${BOARD_TITLE_SRC[0]}\nreturn boardTitle;`)()
|
|
243
|
-
: () => { throw new Error("boardTitle could not be lifted from board.html — see the shape test above"); };
|
|
244
|
-
|
|
245
|
-
test("boardTitle names the repo when the payload carries one", () => {
|
|
246
|
-
assert.equal(boardTitle("acme/one"), "fleet cockpit — acme/one");
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// The three ways a payload arrives with no repo to name, all of which used to
|
|
250
|
-
// be impossible to get wrong because the page never read the field: `gh repo
|
|
251
|
-
// view` failed (null), it answered malformed ("" via gather's `?? repo`
|
|
252
|
-
// chain), and the identity stub served before the first tick carries no
|
|
253
|
-
// `repo` key at all (undefined). Rendering `fleet cockpit — undefined` on any
|
|
254
|
-
// of them is worse than the constant this replaces.
|
|
255
|
-
test("boardTitle falls back to the bare constant for every no-repo shape", () => {
|
|
256
|
-
for (const v of [null, undefined, ""]) {
|
|
257
|
-
assert.equal(boardTitle(v), "fleet cockpit", `a ${JSON.stringify(v)} repo must render today's constant`);
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
// Ties the fallback to what the page actually shows before any poll returns —
|
|
262
|
-
// a drifting copy in the markup would leave the tab flickering between two
|
|
263
|
-
// spellings of the same constant on the first tick.
|
|
264
|
-
test("the page's own <title> and header are the constant boardTitle falls back to", () => {
|
|
265
|
-
const title = HTML.match(/<title>([^<]*)<\/title>/);
|
|
266
|
-
assert.ok(title, "board.html no longer carries a <title> — update this test");
|
|
267
|
-
assert.equal(title[1], boardTitle(null));
|
|
268
|
-
const h1 = HTML.match(/<h1[^>]*\sid="heading"[^>]*>([^<]*)<\/h1>/);
|
|
269
|
-
assert.ok(h1, "board.html no longer carries the heading element render writes to — update this test");
|
|
270
|
-
assert.equal(h1[1], "🛰 " + boardTitle(null));
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// A DOM this page's own script can write to, without a browser: render() is
|
|
274
|
-
// lifted out of board.html's source (the same seam boardTitle above uses)
|
|
275
|
-
// and run against a document stub just capable enough to hold the writes —
|
|
276
|
-
// children are kept (so a test can read back what a column holds), innerHTML
|
|
277
|
-
// writes are still swallowed as a clearing no-op (the setter below), and
|
|
278
|
-
// style writes land on a plain object but nothing here reads them back.
|
|
279
|
-
class FakeNode {
|
|
280
|
-
constructor() { this.children = []; this.style = {}; }
|
|
281
|
-
set innerHTML(_) { this.children = []; }
|
|
282
|
-
append(...nodes) { this.children.push(...nodes); }
|
|
283
|
-
replaceChildren(...nodes) { this.children = nodes; }
|
|
284
|
-
}
|
|
285
|
-
function fakeDocument() {
|
|
286
|
-
const byId = new Map();
|
|
287
|
-
return {
|
|
288
|
-
title: "",
|
|
289
|
-
createElement: () => new FakeNode(),
|
|
290
|
-
createTextNode: (text) => ({ text }),
|
|
291
|
-
getElementById(id) {
|
|
292
|
-
if (!byId.has(id)) byId.set(id, new FakeNode());
|
|
293
|
-
return byId.get(id);
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// `poll()`'s call at the bottom is the one line this lift must never run —
|
|
299
|
-
// it fetches immediately, which a test document has nothing to answer.
|
|
300
|
-
const SCRIPT_SRC = HTML.match(/<script>([\s\S]*)<\/script>/)?.[1]
|
|
301
|
-
?.replace(/\bpoll\(\);\s*$/, "");
|
|
302
|
-
|
|
303
|
-
test("board.html's <script> still declares render in the shape this file lifts", () => {
|
|
304
|
-
assert.ok(SCRIPT_SRC, "board.html no longer has a lift-able <script> body — update this test");
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
function renderHarness() {
|
|
308
|
-
const document = fakeDocument();
|
|
309
|
-
const render = new Function("document", `${SCRIPT_SRC}\nreturn render;`)(document);
|
|
310
|
-
return { document, render };
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const baseModel = () => ({
|
|
314
|
-
interval: 15, repoUrl: null, generatedAt: Date.now(),
|
|
315
|
-
attention: [], tickets: [], spend: null, queue: {}, filed: [],
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
// The regression this ticket exists to prevent, pinned on the OBSERVABLE
|
|
319
|
-
// rewrite rather than the source text: a board whose repo read fails on a
|
|
320
|
-
// later tick must go back to the bare constant. A gate on the repo being
|
|
321
|
-
// present — however many tokens of indirection sit between the gate and the
|
|
322
|
-
// literal `.repo` — leaves the title pinned from a tick that is no longer
|
|
323
|
-
// current, and this catches that by calling render() twice and reading what
|
|
324
|
-
// it actually wrote, not how it decided to write it.
|
|
325
|
-
test("render rewrites the title and header on every tick, reverting when repo disappears", () => {
|
|
326
|
-
const { document, render } = renderHarness();
|
|
327
|
-
render({ ...baseModel(), repo: "acme/one" });
|
|
328
|
-
assert.equal(document.title, "fleet cockpit — acme/one");
|
|
329
|
-
assert.equal(document.getElementById("heading").textContent, "🛰 fleet cockpit — acme/one");
|
|
330
|
-
|
|
331
|
-
render({ ...baseModel(), repo: null });
|
|
332
|
-
assert.equal(document.title, "fleet cockpit",
|
|
333
|
-
"a repo that stops resolving must clear the tab title on the very next render, not leave the prior tick's name showing");
|
|
334
|
-
assert.equal(document.getElementById("heading").textContent, "🛰 fleet cockpit");
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
// #1848: each column scrolls on its own (#1759), and a scroll offset lives on
|
|
338
|
-
// the element — so a tick that throws the columns away and builds new ones
|
|
339
|
-
// resets every column to the top within one poll. The columns must be the
|
|
340
|
-
// SAME nodes tick after tick, while what they hold is the new tick's alone:
|
|
341
|
-
// a column that kept its node by appending onto last tick's cards would show
|
|
342
|
-
// every ticket twice and a stale count.
|
|
343
|
-
test("render keeps each column's node across ticks and rewrites only what it holds", () => {
|
|
344
|
-
const { document, render } = renderHarness();
|
|
345
|
-
const board = document.getElementById("board");
|
|
346
|
-
render({ ...baseModel(), tickets: [
|
|
347
|
-
{ issue: 1, column: "POOL" }, { issue: 2, column: "POOL" }, { issue: 3, column: "REVIEW" },
|
|
348
|
-
] });
|
|
349
|
-
const before = [...board.children];
|
|
350
|
-
assert.equal(before.length, 5);
|
|
351
|
-
|
|
352
|
-
render({ ...baseModel(), tickets: [{ issue: 4, column: "POOL" }] });
|
|
353
|
-
assert.equal(board.children.length, 5, "a tick must not add a second set of columns");
|
|
354
|
-
board.children.forEach((col, i) => assert.equal(col, before[i],
|
|
355
|
-
"a column rebuilt as a new node loses its scroll position on every poll"));
|
|
356
|
-
|
|
357
|
-
const [pool, , review] = board.children;
|
|
358
|
-
const count = (col) => col.children[0].children[0].textContent;
|
|
359
|
-
const issues = (col) => col.children.slice(1).map((c) => c.children[0].children[0].textContent);
|
|
360
|
-
assert.equal(count(pool), "1");
|
|
361
|
-
assert.deepEqual(issues(pool), ["#4"], "a column must hold this tick's cards, not last tick's as well");
|
|
362
|
-
assert.equal(count(review), "0");
|
|
363
|
-
assert.deepEqual(issues(review), []);
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// #1857 review: colNodes' persistent nodes meant a ticket that makes card()
|
|
367
|
-
// throw (a non-array `flags`, hitting `for (const f of t.flags || [])`) left
|
|
368
|
-
// every column at or after the throw point silently stuck on the previous
|
|
369
|
-
// tick while columns before it updated — a mixed-tick board indistinguishable
|
|
370
|
-
// from a healthy render. Building every column's contents before writing any
|
|
371
|
-
// of them to the DOM means a throw leaves ALL columns on the previous tick
|
|
372
|
-
// together, never a mix.
|
|
373
|
-
test("a malformed ticket that makes card() throw leaves every column on the previous tick, never a mix", () => {
|
|
374
|
-
const { document, render } = renderHarness();
|
|
375
|
-
const board = document.getElementById("board");
|
|
376
|
-
render({ ...baseModel(), tickets: [
|
|
377
|
-
{ issue: 1, column: "POOL" }, { issue: 2, column: "REVIEW" },
|
|
378
|
-
] });
|
|
379
|
-
const count = (col) => col.children[0].children[0].textContent;
|
|
380
|
-
assert.equal(count(board.children[0]), "1", "POOL");
|
|
381
|
-
assert.equal(count(board.children[2]), "1", "REVIEW");
|
|
382
|
-
|
|
383
|
-
// POOL comes before REVIEW in COLUMNS order and gets a real, valid change;
|
|
384
|
-
// REVIEW gets the malformed ticket that makes card() throw. A build that
|
|
385
|
-
// writes POOL to the DOM before reaching REVIEW's throw would let POOL show
|
|
386
|
-
// this tick's data while REVIEW is stuck on last tick's — the mix this test
|
|
387
|
-
// exists to catch.
|
|
388
|
-
assert.throws(() => render({ ...baseModel(), tickets: [
|
|
389
|
-
{ issue: 1, column: "POOL" }, { issue: 3, column: "POOL" }, { issue: 4, column: "REVIEW", flags: 42 },
|
|
390
|
-
] }), /is not iterable/, "a non-array flags value must still surface as a thrown error, not swallow silently");
|
|
391
|
-
|
|
392
|
-
assert.equal(count(board.children[0]), "1",
|
|
393
|
-
"POOL must NOT have updated to this tick's count of 2 — a column written before the throw is the mixed-tick bug this test exists to catch");
|
|
394
|
-
assert.equal(count(board.children[2]), "1", "REVIEW must also stay on the previous tick, consistent with POOL");
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
// #1584 adds a second reader of the model's repo IDENTITY (`acme/one`) beside
|
|
398
|
-
// the long-standing reader of its repo URL. A card's PR link must keep
|
|
399
|
-
// resolving against the URL — the field that carries the host, so links work
|
|
400
|
-
// on GitHub Enterprise — or a card clicked on one board opens nothing, or the
|
|
401
|
-
// wrong thing.
|
|
402
|
-
test("card still builds its PR link from the model's repoUrl, not from the repo name", () => {
|
|
403
|
-
const card = HTML.match(/^function\s+card\s*\(\w+\)\s*\{[\s\S]*?^\}$/m);
|
|
404
|
-
assert.ok(card, "board.html no longer declares card as a top-level function — update this test");
|
|
405
|
-
assert.match(card[0], /a\.href\s*=\s*\(?\s*repoUrl\s*\)?\s*\?\s*repoUrl\s*\+/,
|
|
406
|
-
"the PR link must be built from repoUrl; the repo name is not a URL");
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// #2108 review: capMsg used to be reachable only through the single-slot
|
|
410
|
-
// stale-banner element, behind a stale/stall/ledger priority chain — a
|
|
411
|
-
// co-occurring higher-priority message masked it completely, on a tick that
|
|
412
|
-
// left it exactly as unreported as the pre-#2108 silent truncation it exists
|
|
413
|
-
// to disclose. The footer does not compete for that slot.
|
|
414
|
-
test("#2108: a capped-read notice reaches the footer even when a higher-priority banner wins the single slot", () => {
|
|
415
|
-
const { document, render } = renderHarness();
|
|
416
|
-
const banner = document.getElementById("stale-banner");
|
|
417
|
-
const foot = document.getElementById("footer");
|
|
418
|
-
const capNotice = "the open-PR read hit its --limit, so a PR past it shows REVIEW with CI unknown";
|
|
419
|
-
|
|
420
|
-
render({ ...baseModel(), capNotice });
|
|
421
|
-
assert.match(banner.textContent, /open-PR read hit its --limit/, "capMsg alone must still win the empty banner slot");
|
|
422
|
-
assert.ok(foot.children.some((c) => c.textContent?.includes("open-PR read hit its --limit")),
|
|
423
|
-
"capMsg must also reach the footer when nothing else is competing for the banner");
|
|
424
|
-
|
|
425
|
-
render({ ...baseModel(), ledgerState: "unread", capNotice });
|
|
426
|
-
assert.match(banner.textContent, /ledger not read/, "the higher-priority ledger banner must still win the single slot");
|
|
427
|
-
assert.ok(foot.children.some((c) => c.textContent?.includes("open-PR read hit its --limit")),
|
|
428
|
-
"a co-occurring ledger banner must not silently drop the cap notice — it has no other surface once the banner slot is taken");
|
|
429
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// #1597: the cockpit half of the liveness mark — the banner board.html draws
|
|
2
|
-
// from a run's liveness verdict, and the wiring that carries a mark written by
|
|
3
|
-
// fleet-heartbeat.mjs through to the board board.mjs builds.
|
|
4
|
-
//
|
|
5
|
-
// The wiring half drives the real scripts out of process, in a throwaway
|
|
6
|
-
// repository.
|
|
7
|
-
//
|
|
8
|
-
// A separate file rather than more of board.test.mjs, for the reason
|
|
9
|
-
// ledger-read-require-file.test.mjs gives: the fleet runs several implementers
|
|
10
|
-
// at once and two PRs appending to one test file conflict, which costs the PR
|
|
11
|
-
// its CI entirely. These tests first landed at the end of that file, whose
|
|
12
|
-
// header scopes it to #816 — which is the same conflict, one file over.
|
|
13
|
-
|
|
14
|
-
import { test } from "node:test";
|
|
15
|
-
import assert from "node:assert/strict";
|
|
16
|
-
import { spawnSync } from "node:child_process";
|
|
17
|
-
import { readFileSync, existsSync } from "node:fs";
|
|
18
|
-
import { tempDir } from "./temp-dir.mjs";
|
|
19
|
-
import { join } from "node:path";
|
|
20
|
-
import { fileURLToPath } from "node:url";
|
|
21
|
-
import { writeExecStub } from "./exec-stub.mjs";
|
|
22
|
-
|
|
23
|
-
const BOARD = fileURLToPath(new URL("./board.mjs", import.meta.url));
|
|
24
|
-
const HTML = readFileSync(new URL("./board.html", import.meta.url), "utf8");
|
|
25
|
-
|
|
26
|
-
// ── the liveness banner (#1597) ──────────────────────────────────────────────
|
|
27
|
-
//
|
|
28
|
-
// Same lift technique and the same reason as ledgerBanner in
|
|
29
|
-
// ledger-read-require-file.test.mjs: the page is one self-contained file and
|
|
30
|
-
// its decisions are reachable only through their source text. The
|
|
31
|
-
// declaration-count guard comes first for the same hoisting reason.
|
|
32
|
-
|
|
33
|
-
test("board.html declares livenessBanner exactly once at top level", () => {
|
|
34
|
-
assert.equal(HTML.match(/^function\s+livenessBanner\s*\(/gm)?.length, 1,
|
|
35
|
-
"livenessBanner must be declared exactly once — a second declaration wins at runtime and the lift below would still read the first");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const LIVENESS_SRC = HTML.match(/^function\s+livenessBanner\s*\(\w+\)\s*\{[\s\S]*?^\}$/m);
|
|
39
|
-
|
|
40
|
-
test("board.html still declares livenessBanner in the shape this file lifts", () => {
|
|
41
|
-
assert.ok(LIVENESS_SRC, "board.html no longer declares livenessBanner as a top-level function — update this test");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const livenessBanner = LIVENESS_SRC
|
|
45
|
-
? new Function(`${LIVENESS_SRC[0]}\nreturn livenessBanner;`)()
|
|
46
|
-
: () => { throw new Error("livenessBanner could not be lifted from board.html — see the shape test above"); };
|
|
47
|
-
|
|
48
|
-
test("livenessBanner renders the verdict's own words and composes none of its own", () => {
|
|
49
|
-
// The page must not phrase this. compute-board.mjs builds `text` through
|
|
50
|
-
// fleet-state.mjs's stallReport(), the same function fleet-tick prints, so
|
|
51
|
-
// a rewrite of one surface cannot leave the other describing the same dead
|
|
52
|
-
// run differently. A banner that reworded here would be a second answer.
|
|
53
|
-
const text = "heartbeat STALLED: last beat 2026-01-01T00:00:00.000Z (90m ago, 70m past the 20m interval it promised)"
|
|
54
|
-
+ " — the beat stopped without a recorded reason; 3 ticket(s) claimed and in flight, pool supply 4";
|
|
55
|
-
assert.equal(livenessBanner({ kind: "stale", text }), "⚠ " + text);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("livenessBanner stays silent for a run with nothing to report", () => {
|
|
59
|
-
// Null is the healthy verdict AND the run that never beat — computeBoard
|
|
60
|
-
// collapses both, because a banner that fires on a beating fleet is a
|
|
61
|
-
// banner the operator learns to read past, which costs it the one night it
|
|
62
|
-
// exists for.
|
|
63
|
-
assert.equal(livenessBanner(null), null);
|
|
64
|
-
assert.equal(livenessBanner(undefined), null,
|
|
65
|
-
"a board.json written before this field existed must render, not warn");
|
|
66
|
-
// And a payload carrying the key with no words is not a banner either: an
|
|
67
|
-
// empty amber strip claims a verdict the board does not hold.
|
|
68
|
-
assert.equal(livenessBanner({ kind: "stale" }), null);
|
|
69
|
-
assert.equal(livenessBanner({ kind: "stale", text: "" }), null);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// ── the mark's wiring, end to end (#1597) ────────────────────────────────────
|
|
73
|
-
//
|
|
74
|
-
// Everything above tests the cockpit's halves in isolation, and the one
|
|
75
|
-
// failure none of them can see is the one that matters most here: the
|
|
76
|
-
// heartbeat and the board agreeing on WHICH FILE. A cockpit reading a path
|
|
77
|
-
// nothing writes renders a permanently empty liveness surface, and every
|
|
78
|
-
// other test in this repo stays green while it does — the panel is supposed
|
|
79
|
-
// to be empty on a healthy run, so "no banner" is indistinguishable from
|
|
80
|
-
// "wired to nowhere".
|
|
81
|
-
//
|
|
82
|
-
// So this drives the real fleet-heartbeat.mjs and the real board.mjs through
|
|
83
|
-
// their own default path resolution, in a throwaway repository, and asserts
|
|
84
|
-
// the mark one wrote reaches the board the other built.
|
|
85
|
-
test("a mark written by the real heartbeat reaches the real board (#1597)", () => {
|
|
86
|
-
const repo = tempDir("board-liveness-e2e-");
|
|
87
|
-
assert.equal(spawnSync("git", ["init", "-q", repo], { encoding: "utf8" }).status, 0);
|
|
88
|
-
const bin = tempDir("board-liveness-bin-");
|
|
89
|
-
writeExecStub(join(bin, "gh"), "#!/bin/sh\nexit 1\n");
|
|
90
|
-
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` };
|
|
91
|
-
|
|
92
|
-
// `--stop` rather than a beat: a deliberate stop is reported at once, where
|
|
93
|
-
// a live beat would have to be backdated by hand — and backdating means
|
|
94
|
-
// writing the file this test is trying to prove nobody has to write by hand.
|
|
95
|
-
// No --state either, on purpose: the default resolution IS the subject.
|
|
96
|
-
const heartbeat = fileURLToPath(new URL("./fleet-heartbeat.mjs", import.meta.url));
|
|
97
|
-
const stop = spawnSync(process.execPath, [heartbeat, "--stop", "budget exhausted"],
|
|
98
|
-
{ cwd: repo, encoding: "utf8", env });
|
|
99
|
-
assert.equal(stop.status, 0, stop.stderr);
|
|
100
|
-
assert.equal(existsSync(join(repo, ".fleet", "heartbeat.json")), true,
|
|
101
|
-
"the heartbeat did not write where this test expected — the premise is gone, not the wiring");
|
|
102
|
-
|
|
103
|
-
const build = spawnSync(process.execPath, [BOARD, "build"], { cwd: repo, encoding: "utf8", env });
|
|
104
|
-
assert.equal(build.status, 0, build.stderr);
|
|
105
|
-
const model = JSON.parse(build.stdout);
|
|
106
|
-
assert.ok(model.liveness, "the board found no mark — the two scripts disagree about the state file's path");
|
|
107
|
-
assert.equal(model.liveness.kind, "stopped");
|
|
108
|
-
assert.match(model.liveness.text, /recorded reason: budget exhausted/);
|
|
109
|
-
// The gh stub fails every read and there is no ledger file at all — both
|
|
110
|
-
// inputs `claimed`/`supply` derive from never actually read, so the report
|
|
111
|
-
// must say `unknown`, not smuggle a false "0" past a failure that never
|
|
112
|
-
// happened to land on a real empty state (#1732 follow-up: the old
|
|
113
|
-
// behaviour here silently reported "0 claimed, pool supply 0" off exactly
|
|
114
|
-
// this failure, indistinguishable from a genuinely empty, healthy read).
|
|
115
|
-
assert.equal(model.liveness.claimed, null);
|
|
116
|
-
assert.equal(model.liveness.supply, null);
|
|
117
|
-
assert.match(model.liveness.text, /unknown ticket\(s\) claimed and in flight/);
|
|
118
|
-
assert.match(model.liveness.text, /pool supply unknown/);
|
|
119
|
-
});
|