@feigi/fleet-ctl 3.24.1 → 3.24.3
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/arg.mjs +59 -56
- package/scripts/board.html +22 -22
- package/scripts/board.mjs +143 -145
- package/scripts/candidates.mjs +48 -48
- package/scripts/compute-board.mjs +39 -38
- package/scripts/git-env.mjs +21 -22
- package/scripts/repo-root.mjs +35 -32
package/package.json
CHANGED
package/scripts/arg.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// has(), sweep(), stray(), the three refusal rules
|
|
3
3
|
// isFlagLike()/hasEqualsForm()/isDigits(), and writeAll() — the short-write
|
|
4
4
|
// and EAGAIN retry loop every script's own stdout/stderr write routes
|
|
5
|
-
// through
|
|
6
|
-
//
|
|
5
|
+
// through.
|
|
6
|
+
// These helpers were five drifting copies of arg(), three of has(), seven of die() in
|
|
7
7
|
// two incompatible shapes — one paste behind on any guard fix. One copy now;
|
|
8
8
|
// a fix to the contract lands here once and reaches every caller that routes
|
|
9
9
|
// through the helper it fixes.
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
// argv reader cannot call arg()/has() at all, because those refuse under a
|
|
19
19
|
// GENERATED message ("--<name> needs a value") and such a reader exists
|
|
20
20
|
// precisely to refuse under its own ("--file needs a path"). ledger.mjs
|
|
21
|
-
// splices --file/--require-file out of argv itself
|
|
21
|
+
// splices --file/--require-file out of argv itself and
|
|
22
22
|
// member-outcomes.mjs reads its own --file, so both were out of arg()'s
|
|
23
23
|
// reach — and both answered that by copying the expression, which is a
|
|
24
24
|
// requirement recorded where nothing executes it.
|
|
25
25
|
//
|
|
26
|
-
//
|
|
26
|
+
// That gap is closed: the rules are stated once, as isFlagLike() and
|
|
27
27
|
// hasEqualsForm() below, and BOTH readers import and call them while keeping
|
|
28
28
|
// their own wording. No script now restates one of these rules as a value
|
|
29
29
|
// guard instead of calling it. That is executed, not documented —
|
|
30
|
-
//
|
|
30
|
+
// a test reds when a copy is re-inlined, including one
|
|
31
31
|
// re-inlined behaviour-identically, which no behavioural test can see. Read
|
|
32
32
|
// the current division with `grep -n 'from "./arg.mjs"'
|
|
33
33
|
// scripts/*.mjs | grep -v test` rather than trusting a list
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
// importing this file refuses its command line through a die() bound from
|
|
52
52
|
// here, and a module that binds none has no command line to refuse a flag on
|
|
53
53
|
// — review-core.mjs, which imports isDigits alone and is itself imported by
|
|
54
|
-
// review-eval.mjs, joined the `scripts/*.mjs` glob when
|
|
54
|
+
// review-eval.mjs, joined the `scripts/*.mjs` glob when it was renamed from
|
|
55
55
|
// `.js`. A future script that refuses WITHOUT makeDie falls out of this grep;
|
|
56
56
|
// that is the price of the filter, named here rather than hidden. Read that output
|
|
57
57
|
// for the roster — the scripts this header names exemplify a way of
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
// fleet-tick.mjs is the one script still outside arg()/has(), and
|
|
61
61
|
// deliberately: it parses its flags with node:util's parseArgs, so its
|
|
62
62
|
// unknown-flag, required-flag and range refusals are a separate edit site on
|
|
63
|
-
// its own terms. Its integer guard is no longer one of them —
|
|
64
|
-
//
|
|
63
|
+
// its own terms. Its integer guard is no longer one of them — the digits
|
|
64
|
+
// grammar has its own predicate (isDigits() below) precisely because
|
|
65
65
|
// isFlagLike() cannot express it, and int() now calls that instead of
|
|
66
66
|
// hand-writing the third spelling. What stays fleet-tick's own there is the
|
|
67
67
|
// `String(raw).trim()` its input needs and the wording of its refusal, not
|
|
@@ -82,15 +82,15 @@
|
|
|
82
82
|
|
|
83
83
|
import { writeSync } from "node:fs";
|
|
84
84
|
|
|
85
|
-
//
|
|
85
|
+
// ONE write-retry loop, not three. Resuming a short write and waiting
|
|
86
86
|
// out an EAGAIN are properties of the FD, not of any one caller, so die()
|
|
87
87
|
// below, ci-state.mjs's verdict writes and staleness.mjs's verdict() all
|
|
88
88
|
// route through writeAll() instead of each hand-rolling the same
|
|
89
89
|
// while/try/subarray. They were three independent copies held in step by a
|
|
90
90
|
// comment reading "mirrors emit()" and by nothing executable — which is
|
|
91
91
|
// exactly how one of them (ci-state.mjs's emit()) stayed the only one with no
|
|
92
|
-
// retry cap at all. board.mjs's fault() is the fourth site and
|
|
93
|
-
//
|
|
92
|
+
// retry cap at all. board.mjs's fault() is the fourth site, and it stays
|
|
93
|
+
// outside this file deliberately — its own comment says why.
|
|
94
94
|
const MAX_EAGAIN_RETRIES = 200;
|
|
95
95
|
|
|
96
96
|
// Shared across every retry: Atomics.wait never writes or notifies it, so one
|
|
@@ -104,7 +104,7 @@ const IDLE = new Int32Array(new SharedArrayBuffer(4));
|
|
|
104
104
|
// full — the state an fd reaches once a stream has been initialised on it
|
|
105
105
|
// (console.error does that to fd 2) and enough output is queued behind it. It
|
|
106
106
|
// either SHORT-WRITES, returning the count it managed and throwing nothing at
|
|
107
|
-
// all, silently truncating with no diagnostic for a catch to see
|
|
107
|
+
// all, silently truncating with no diagnostic for a catch to see;
|
|
108
108
|
// or it throws EAGAIN. So this resumes from writeSync's own return value
|
|
109
109
|
// until the buffer is empty, and reads EAGAIN as "momentarily full", waiting
|
|
110
110
|
// 1ms for the reader rather than treating it as failure. The wait is what
|
|
@@ -112,7 +112,7 @@ const IDLE = new Int32Array(new SharedArrayBuffer(4));
|
|
|
112
112
|
// bare `continue` burned a full core for the whole stall where the 1ms wait
|
|
113
113
|
// burned almost none, both delivering the same bytes.
|
|
114
114
|
//
|
|
115
|
-
// The EAGAIN retry is CAPPED
|
|
115
|
+
// The EAGAIN retry is CAPPED. Uncapped, a reader that stays open but
|
|
116
116
|
// never drains — not merely a slow one — spins here forever, and every caller
|
|
117
117
|
// is one whose whole job is to finish and report an exit code, so an
|
|
118
118
|
// indefinite hang trades that guarantee away. Past the cap this gives up on
|
|
@@ -141,7 +141,7 @@ export function writeAll(fd, text) {
|
|
|
141
141
|
return true;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
// die() is writeSync, not console.error
|
|
144
|
+
// die() is writeSync, not console.error. On a pipe,
|
|
145
145
|
// process.stderr.write is ASYNC and process.exit() discards whatever is
|
|
146
146
|
// still queued — a large forwarded child stderr (gh's own) eats the refusal
|
|
147
147
|
// line that follows it, because the refusal is queued last and dropped
|
|
@@ -158,9 +158,9 @@ export function makeDie(name) {
|
|
|
158
158
|
// The try covers the TEMPLATE as well as the write, and that is the whole
|
|
159
159
|
// of its job: uncaught, a throwing msg — or anything escaping writeAll —
|
|
160
160
|
// skips process.exit(2) and drops the process to Node's default exit 1,
|
|
161
|
-
// inverting the caller's own exit-code contract
|
|
161
|
+
// inverting the caller's own exit-code contract. Hoisting the
|
|
162
162
|
// string out to writeAll's argument list reintroduces precisely that,
|
|
163
|
-
// which is why
|
|
163
|
+
// which is why a test pin requires it to sit inside.
|
|
164
164
|
// writeAll's false return is ignored on purpose, and says no more than
|
|
165
165
|
// this function always promised: the message may be lost, the exit code
|
|
166
166
|
// may not.
|
|
@@ -173,7 +173,7 @@ export function makeDie(name) {
|
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
//
|
|
176
|
+
// A flag given with no value must never read as the flag being
|
|
177
177
|
// absent. Every arg()-reading call site falls back with `||`/`??`, so a
|
|
178
178
|
// trailing flag used to silently substitute a default — the malformed
|
|
179
179
|
// invocation reading as a successful one.
|
|
@@ -183,19 +183,19 @@ export function makeDie(name) {
|
|
|
183
183
|
// `--flag=value` form `indexOf` cannot see (`arg()` would otherwise report
|
|
184
184
|
// the flag absent and the caller would fall back exactly as if it were).
|
|
185
185
|
// Rejecting a `--`-prefixed value does forfeit a real capability — a value
|
|
186
|
-
// that legitimately starts with `--` — and staleness.mjs
|
|
186
|
+
// that legitimately starts with `--` — and staleness.mjs is a caller
|
|
187
187
|
// that can want one: its `--gone`/`--present` value is a string quoted out of
|
|
188
|
-
// a ticket,
|
|
188
|
+
// a ticket, such as `--label ready-for-agent`. Refusing loudly here
|
|
189
189
|
// still beats silently taking the next flag as this one's value, so this
|
|
190
|
-
// guard itself does not bend for it. staleness.mjs
|
|
190
|
+
// guard itself does not bend for it. staleness.mjs instead opts a
|
|
191
191
|
// caller in per flag with its own end-of-options separator, `--gone --
|
|
192
192
|
// '<value>'`, read before arg() ever sees the value — bare, with no `--`
|
|
193
193
|
// immediately before it, this refusal still stands unchanged.
|
|
194
|
-
//
|
|
194
|
+
// The two predicates immediately below ARE those rules, exported so a
|
|
195
195
|
// caller that cannot route through arg()/has() consumes them instead of
|
|
196
196
|
// copying the expression — the header above says which callers and why.
|
|
197
197
|
// isDigits(), further down, is a third export on the same terms for a
|
|
198
|
-
// different rule
|
|
198
|
+
// different rule; these two are the ones this paragraph is about.
|
|
199
199
|
//
|
|
200
200
|
// What travels is the RULE, never the refusal text: each caller keeps its own
|
|
201
201
|
// die() wording, which is the constraint that made copying look necessary in
|
|
@@ -204,7 +204,7 @@ export function makeDie(name) {
|
|
|
204
204
|
// flag they typed and not the grammar behind it.
|
|
205
205
|
//
|
|
206
206
|
// Plain exports, not factories, because neither takes a script NAME — one is a
|
|
207
|
-
// predicate over a value, the other over an argv. That is also why
|
|
207
|
+
// predicate over a value, the other over an argv. That is also why a
|
|
208
208
|
// proposed makeCli(NAME) collapse of makeDie/makeArg/makeHas cannot absorb
|
|
209
209
|
// them whichever way it lands: those three exist to BIND a name, and these
|
|
210
210
|
// have no name to bind.
|
|
@@ -237,7 +237,7 @@ export function makeArg(die) {
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
//
|
|
240
|
+
// A boolean flag written --name=value must refuse, not read as
|
|
241
241
|
// absent — same fail-open class as arg()'s `=` guard above, but
|
|
242
242
|
// boolean-specific wording: there is no value to take, so "needs a
|
|
243
243
|
// space-separated value" would lie.
|
|
@@ -248,7 +248,7 @@ export function makeHas(die) {
|
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
//
|
|
251
|
+
// The digits rule, stated once. A non-numeric `--pr` was first closed in
|
|
252
252
|
// ci-state.mjs alone, and the identical shape stayed live in its siblings.
|
|
253
253
|
// Measured on the pre-fix tree against a stub `gh` that ANSWERS, the way a
|
|
254
254
|
// real one does for a branch ref: `diff-stats.mjs --pr abc` reached
|
|
@@ -266,13 +266,14 @@ export function makeHas(die) {
|
|
|
266
266
|
// payload field. Its members are ci-state.mjs, diff-stats.mjs and
|
|
267
267
|
// pr-overlap.mjs, and all three now route through numArg() below. A sweep for
|
|
268
268
|
// the flag NAME finds two of the three, which is how the third stayed open
|
|
269
|
-
// through
|
|
269
|
+
// through that first fix's review.
|
|
270
270
|
//
|
|
271
271
|
// Stated here rather than a third time at the call sites, because the
|
|
272
272
|
// invariant had no single expression: ci-state.mjs spelled it `/^[0-9]+$/`
|
|
273
273
|
// while fleet-tick.mjs's int() spells it `/^\d+$/` over a parseArgs value,
|
|
274
|
-
// each with its own wording.
|
|
275
|
-
// to stop exactly this drift, and a fourth spelling IS
|
|
274
|
+
// each with its own wording. This shared module exists, over an earlier "no
|
|
275
|
+
// shared module" ruling, to stop exactly this drift, and a fourth spelling IS
|
|
276
|
+
// the drift.
|
|
276
277
|
|
|
277
278
|
// `+`, so the empty string is not a number. arg() already refuses that value
|
|
278
279
|
// through isFlagLike, but this predicate's other consumers do not read argv
|
|
@@ -300,7 +301,7 @@ export function makeHas(die) {
|
|
|
300
301
|
// this same invariant (claim-ticket.sh, inflight.sh, release-ticket.sh,
|
|
301
302
|
// drop-merged-label.sh) carries an extra `0?*` clause that refuses them, and
|
|
302
303
|
// this rule deliberately does not adopt it — tightening here would refuse a
|
|
303
|
-
// `--pr 007` that
|
|
304
|
+
// `--pr 007` that the already-shipped guard accepts, which is a behaviour change
|
|
304
305
|
// dressed as a de-duplication.
|
|
305
306
|
//
|
|
306
307
|
// A plain export rather than a factory, for the reason isFlagLike and
|
|
@@ -322,8 +323,9 @@ export function isDigits(value) {
|
|
|
322
323
|
// header's "what travels is the RULE, never the refusal text", applied to a
|
|
323
324
|
// product whose two refusals genuinely differ in that respect.
|
|
324
325
|
//
|
|
325
|
-
// This also discharges
|
|
326
|
-
// positionally. That guard had to sit BELOW
|
|
326
|
+
// This also discharges the original ci-state.mjs guard's placement rule
|
|
327
|
+
// structurally instead of positionally. That guard had to sit BELOW
|
|
328
|
+
// ci-state.mjs's usage die because
|
|
327
329
|
// RegExp.test coerces `null` to "null": hoisted above it, an omitted `--pr`
|
|
328
330
|
// was answered with a complaint about a number and the usage line never
|
|
329
331
|
// printed. numArg() only ever tests a value it actually read, so the refusal
|
|
@@ -343,14 +345,15 @@ function readNum(die, arg, name) {
|
|
|
343
345
|
return Number(raw);
|
|
344
346
|
}
|
|
345
347
|
|
|
346
|
-
//
|
|
348
|
+
// The guards above all answer "was this flag given well?", and none of
|
|
347
349
|
// them can answer "was a flag given that nothing reads?". A MISSPELLED name is
|
|
348
350
|
// simply never looked for, so `ci-state.mjs --pr 5 --basee main` computed a
|
|
349
351
|
// real verdict against the DEFAULT base and exited 0/1 with no refusal — the
|
|
350
|
-
// same fail-open harm as
|
|
351
|
-
// value, an unread flag. It bites hardest where the
|
|
352
|
-
// by a model each run (ci-state.mjs,
|
|
353
|
-
// one landing: a doc naming
|
|
352
|
+
// same fail-open harm as a valueless flag reading as absent, reached from the
|
|
353
|
+
// other side: not an absent value, an unread flag. It bites hardest where the
|
|
354
|
+
// caller is markdown re-read by a model each run (ci-state.mjs,
|
|
355
|
+
// candidates.mjs), and one landing is already on record: a doc naming
|
|
356
|
+
// `--label` where the flag is `--require-label`.
|
|
354
357
|
//
|
|
355
358
|
// Only `--`-prefixed tokens are its business. Everything else is positional and
|
|
356
359
|
// is not — board.mjs's `build`/`serve` subcommands, and every valued flag's
|
|
@@ -358,7 +361,7 @@ function readNum(die, arg, name) {
|
|
|
358
361
|
// above refuses `--base --other` outright, so there is nothing to skip over and
|
|
359
362
|
// no need to know here which names take a value.
|
|
360
363
|
//
|
|
361
|
-
//
|
|
364
|
+
// That leftover class — a bare or single-dash token nothing reads,
|
|
362
365
|
// `ci-state.mjs --pr 42 basee main` or `-basee` — is not this function's fix,
|
|
363
366
|
// and stays out of scope here for the same reason board.mjs's subcommands are:
|
|
364
367
|
// this sweep still refuses ONLY a `--`-prefixed token, unchanged.
|
|
@@ -384,7 +387,7 @@ function readNum(die, arg, name) {
|
|
|
384
387
|
// needs a value"; both exit 2, both name a real error, both refuse before gh.
|
|
385
388
|
//
|
|
386
389
|
// candidates.mjs deliberately does NOT route through this. It accepts no
|
|
387
|
-
// positionals, so its parseArgs
|
|
390
|
+
// positionals, so its parseArgs additionally refuses a bare
|
|
388
391
|
// `candidates.mjs ready-for-agent` — which this cannot, board.mjs's
|
|
389
392
|
// subcommands being exactly that shape. Strictly stronger there; leave it.
|
|
390
393
|
//
|
|
@@ -393,9 +396,9 @@ function readNum(die, arg, name) {
|
|
|
393
396
|
// DATA — `check
|
|
394
397
|
// "--require-file silently absent when value missing"` works today and is the
|
|
395
398
|
// shape of issue titles in this repo — so this sweep would refuse working
|
|
396
|
-
// invocations, which
|
|
397
|
-
//
|
|
398
|
-
//
|
|
399
|
+
// invocations, which is worse than the bug. ledger.mjs NARROWED that gap
|
|
400
|
+
// without routing through this sweep, rather than closing it, and later
|
|
401
|
+
// narrowed it again: ledger.mjs's own refuseStrayInCheckTail() is read on
|
|
399
402
|
// `check`'s tail ALONE, and refuses a `--`-prefixed token there only when it
|
|
400
403
|
// shares that tail with something else — the shape an unquoted stray flag
|
|
401
404
|
// makes, never the shape a one-argument subject makes — so a subject that
|
|
@@ -405,7 +408,7 @@ function readNum(die, arg, name) {
|
|
|
405
408
|
// tracker query, so `the --basee flag is unread` is queried as `unread basee
|
|
406
409
|
// flag`.
|
|
407
410
|
//
|
|
408
|
-
//
|
|
411
|
+
// refuseStrayInCheckTail() was widened again, past `--`-prefixed tokens: it
|
|
409
412
|
// also refuses a bare ONE-dash spelling of ledger.mjs's own flag names
|
|
410
413
|
// (`-require-file` for `--require-file`), matched by name rather than
|
|
411
414
|
// prefix, still only when the tail carries something besides it. ledger.mjs
|
|
@@ -414,13 +417,13 @@ function readNum(die, arg, name) {
|
|
|
414
417
|
//
|
|
415
418
|
// `check` alone, on a documented-convention test that ledger.mjs states once
|
|
416
419
|
// on refuseStrayInCheckTail() itself, with the docs and the measurement behind
|
|
417
|
-
// it
|
|
420
|
+
// it — not restated here, and not restated at its call site either.
|
|
418
421
|
// What guards the other three instead is ledger.mjs's refuseStrayInId(), a
|
|
419
422
|
// bare prefix test on the id slot ahead of the tail, where a `--` token is
|
|
420
423
|
// never data.
|
|
421
424
|
//
|
|
422
425
|
// It is the LENGTH gate that spares the legitimate case, not the prefix test
|
|
423
|
-
// — refuseStrayInId()'s id-slot prefix test is now `startsWith("-")
|
|
426
|
+
// — refuseStrayInId()'s id-slot prefix test is now `startsWith("-")`,
|
|
424
427
|
// no longer the same one this sweep uses (`startsWith("--")`). The id slot
|
|
425
428
|
// can take the stricter single-dash test because no free text ever lives
|
|
426
429
|
// there — a legitimate id is bare digits, optionally `#`-prefixed. This
|
|
@@ -429,10 +432,10 @@ function readNum(die, arg, name) {
|
|
|
429
432
|
// above can't either. A prefix test with no length gate was measured
|
|
430
433
|
// refusing the legitimate subject.
|
|
431
434
|
//
|
|
432
|
-
//
|
|
435
|
+
// That narrowing does not make this file's cost disappear; it buys a smaller version of
|
|
433
436
|
// the same cost. An unquoted subject carrying a `--` word is a working
|
|
434
437
|
// invocation ledger.mjs's `check` now refuses too: `check the --basee flag is
|
|
435
|
-
// unread` answered at exit 0 before
|
|
438
|
+
// unread` answered at exit 0 before that narrowing and exits 2 after it. The residual
|
|
436
439
|
// that stays open and owned is a lone stray with no subject beside it, still
|
|
437
440
|
// taken as the subject, which ledger.mjs's own comment prices.
|
|
438
441
|
function refuseUnknown(die, known) {
|
|
@@ -443,19 +446,19 @@ function refuseUnknown(die, known) {
|
|
|
443
446
|
}
|
|
444
447
|
}
|
|
445
448
|
|
|
446
|
-
//
|
|
449
|
+
// sweep() above only ever refuses a `--`-prefixed token — deliberately,
|
|
447
450
|
// per its own comment, because staying ignorant of which names take a value
|
|
448
451
|
// is what keeps it from having to refuse board.mjs's `build`/`serve` or any
|
|
449
452
|
// flag's own value. That leaves the OTHER half of "was a flag given that
|
|
450
453
|
// nothing reads?" open: a bare word or a single dash, which sweep's
|
|
451
454
|
// `startsWith("--")` check was never going to catch — `ci-state.mjs --pr 42
|
|
452
455
|
// basee main` runs the compare against the DEFAULT base and reports a real,
|
|
453
|
-
// wrong verdict at exit 0/1, the same fail-open harm
|
|
454
|
-
// positional side rather than the misspelled-flag side. `-basee` is the
|
|
456
|
+
// wrong verdict at exit 0/1, the same fail-open harm sweep() closes, reached
|
|
457
|
+
// from the positional side rather than the misspelled-flag side. `-basee` is the
|
|
455
458
|
// likelier typo of the two, since the caller plainly meant a flag.
|
|
456
459
|
//
|
|
457
|
-
// Widening sweep's own bound past `--` cannot fix this —
|
|
458
|
-
//
|
|
460
|
+
// Widening sweep's own bound past `--` cannot fix this — the sweep is ruled
|
|
461
|
+
// never to refuse tokens outside that bound, and
|
|
459
462
|
// board.mjs's subcommands are exactly the shape a widened sweep would catch
|
|
460
463
|
// by mistake. Nor can `startsWith("-")`: it refuses a legitimate negative
|
|
461
464
|
// value such as `--spend-since -1`, which arg() accepts today. The only way
|
|
@@ -495,7 +498,7 @@ function refuseStrays(die, flags, positionals) {
|
|
|
495
498
|
}
|
|
496
499
|
}
|
|
497
500
|
|
|
498
|
-
//
|
|
501
|
+
// ONE declaration of a script's flags, and every reader bound to it.
|
|
499
502
|
// `flags` maps each name to "value" or "bool"; `positionals` is the grammar
|
|
500
503
|
// refuseStrays() above accepts ahead of the flags (board.mjs's
|
|
501
504
|
// `build`/`serve`). One key per flag, so a name cannot be declared both ways.
|
|
@@ -526,7 +529,7 @@ function refuseStrays(die, flags, positionals) {
|
|
|
526
529
|
// That refusal goes through die() at exit 2, never a thrown Error: exit 1 is
|
|
527
530
|
// a verdict in ci-state.mjs (not green), merge-gate.mjs (blocked) and
|
|
528
531
|
// tier-roles.mjs (check failed), which is the inversion makeDie() exists to
|
|
529
|
-
// prevent
|
|
532
|
+
// prevent. It is worded `bug:` because only the script's own
|
|
530
533
|
// source can reach it — no command line can make a correct table disagree
|
|
531
534
|
// with a correct read.
|
|
532
535
|
//
|
|
@@ -540,7 +543,7 @@ function refuseStrays(die, flags, positionals) {
|
|
|
540
543
|
// the needle.
|
|
541
544
|
//
|
|
542
545
|
// The TABLE, by contrast, is copied once here, before anything derives from
|
|
543
|
-
// it
|
|
546
|
+
// it: sweep() takes its names at construction while the other readers
|
|
544
547
|
// look a name up per call, so a caller mutating its own `flags` object
|
|
545
548
|
// afterwards would leave arg() accepting a name sweep() refuses. With the
|
|
546
549
|
// copy, no reader sees a later mutation, and no kind the construction check
|
|
@@ -548,10 +551,10 @@ function refuseStrays(die, flags, positionals) {
|
|
|
548
551
|
// object stays its own, unchanged — the line gitEnv() in git-env.mjs holds
|
|
549
552
|
// for its caller's `base` too.
|
|
550
553
|
//
|
|
551
|
-
//
|
|
554
|
+
// `flags` not being a plain object at all — `null`, or absent
|
|
552
555
|
// because a caller typed `{ flag: {...} }` instead of `{ flags: {...} }` and
|
|
553
556
|
// this destructures it to `undefined` — used to throw a TypeError straight
|
|
554
|
-
// out of `Object.keys(undefined)`, before
|
|
557
|
+
// out of `Object.keys(undefined)`, before the copy below was introduced.
|
|
555
558
|
// `{ ...undefined }` and `{ ...null }` both spread to `{}` without
|
|
556
559
|
// complaint, so the copy would otherwise turn a loud construction-time crash
|
|
557
560
|
// into a silently empty flag table whose every read fails later, elsewhere,
|
package/scripts/board.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
:root { color-scheme: dark; --bg:#0d1117; --panel:#161b22; --line:#30363d;
|
|
9
9
|
--fg:#e6edf3; --dim:#8b949e; --red:#f85149; --amber:#d29922; --green:#3fb950; --blue:#58a6ff; }
|
|
10
10
|
* { box-sizing: border-box; }
|
|
11
|
-
/* The page is the window's height
|
|
11
|
+
/* The page is the window's height: header, banner, attention strip,
|
|
12
12
|
spend panel and footer keep their natural height and never shrink; #board
|
|
13
13
|
takes the rest, and each column scrolls on its own past that. The board's
|
|
14
14
|
min-height is the floor for a window too short for the fixed parts — they
|
|
@@ -91,7 +91,7 @@ const COLUMNS = ["POOL", "IMPLEMENTING", "REVIEW", "READY", "MERGED"];
|
|
|
91
91
|
let interval = 15;
|
|
92
92
|
let repoUrl = null; // full repo URL from the model (carries the host) — PR links, GHE-safe
|
|
93
93
|
|
|
94
|
-
// The instance's name, for the tab strip and the header
|
|
94
|
+
// The instance's name, for the tab strip and the header. Two cockpits
|
|
95
95
|
// are two WORKSPACES, and until this the pair rendered one constant twice —
|
|
96
96
|
// the operator's only way to tell two open windows apart was to read the
|
|
97
97
|
// tickets on them. `repo` has ridden the payload since the board existed and
|
|
@@ -99,7 +99,7 @@ let repoUrl = null; // full repo URL from the model (carries the host) — PR li
|
|
|
99
99
|
//
|
|
100
100
|
// Truthiness, not a null check: `gh repo view` failing leaves gather()'s
|
|
101
101
|
// `repo` null, a malformed answer can leave it "", and the identity stub
|
|
102
|
-
// served before the first tick
|
|
102
|
+
// served before the first tick carries no `repo` key at all. All
|
|
103
103
|
// three mean "this board cannot name its repo", and all three must render
|
|
104
104
|
// today's constant rather than `fleet cockpit — undefined`.
|
|
105
105
|
//
|
|
@@ -136,15 +136,15 @@ function spendRows(host, items, { label, value, pct, highlight }) {
|
|
|
136
136
|
// branching lives here rather than in renderSpend below because this page has no
|
|
137
137
|
// other test seam: it is served as one self-contained file, so a test reaches
|
|
138
138
|
// this decision only by lifting it out of the source and calling it directly,
|
|
139
|
-
// which
|
|
139
|
+
// which a test does. That gap is not academic — the falsy-cacheWrite
|
|
140
140
|
// case below shipped broken and its fix shipped untested, because until this
|
|
141
|
-
// split there was nothing a test could call
|
|
141
|
+
// split there was nothing a test could call.
|
|
142
142
|
//
|
|
143
143
|
// `kind` is the tag the renderer switches on; "hidden" appends nothing at all.
|
|
144
144
|
// Both text-only outcomes carry the same `text` field because both render as one
|
|
145
145
|
// `spend-wrap` div, differing only in wording.
|
|
146
146
|
function spendView(sp) {
|
|
147
|
-
//
|
|
147
|
+
// The damaged-lines phrase, shared by both the early note-only branch and the funded
|
|
148
148
|
// panel's note below, so a rewording can't update one copy and silently
|
|
149
149
|
// miss the other. It names the LINES, not the files: one transcript can
|
|
150
150
|
// hold several damaged lines, and "1 transcript damaged" would read as a
|
|
@@ -156,7 +156,7 @@ function spendView(sp) {
|
|
|
156
156
|
// launched backgrounded and the operator is watching this page, not a log.
|
|
157
157
|
//
|
|
158
158
|
// Switch on `ok`, gatherSpend's explicit tag, and never on `error`. Reading
|
|
159
|
-
// the error case off `error`'s truthiness was
|
|
159
|
+
// the error case off `error`'s truthiness was a bug: `{ error: "" }` and
|
|
160
160
|
// `{ error: undefined }` — both of which the producer's outer catch can emit,
|
|
161
161
|
// from a message-less throw and a thrown non-Error — matched neither this
|
|
162
162
|
// branch nor a success shape, so they fell through, found no totals, and HID
|
|
@@ -179,7 +179,7 @@ function spendView(sp) {
|
|
|
179
179
|
// rendered identically to "nothing yet". stderr does not cover it (see
|
|
180
180
|
// above), so the note goes out on its own, without the zeroed two-column body.
|
|
181
181
|
if (!sp.totals || !sp.totals.cacheWrite) {
|
|
182
|
-
//
|
|
182
|
+
// The damaged-lines worst case: when a damaged line WAS the run's only cache-creation
|
|
183
183
|
// turn there is nothing left to sum, so cache-write is 0 with `skipped`
|
|
184
184
|
// also 0 — a freshly-dispatched agent with no cache-creation turn flushed
|
|
185
185
|
// yet can land here too, which is why `damaged` alone, without `skipped`,
|
|
@@ -198,7 +198,7 @@ function spendView(sp) {
|
|
|
198
198
|
lede: `${k(sp.totals.cacheWrite)} cache-write · ${k(sp.totals.cacheRead)} cache-read · ${k(sp.totals.output)} output · ${sp.totals.agents} agents · review ${sp.reviewPct.toFixed(0)}%`,
|
|
199
199
|
// `skipped` means "contributed nothing"; `damaged` means "contributed, but
|
|
200
200
|
// may be missing the torn line's tool_use blocks and output_tokens
|
|
201
|
-
// snapshot"
|
|
201
|
+
// snapshot" — cache_creation/cache_read repeat on every line
|
|
202
202
|
// of a turn and survive a mid-turn tear, so the panel's totals are not
|
|
203
203
|
// necessarily short. Two different
|
|
204
204
|
// lies, so two different phrases, both routed through the one channel that
|
|
@@ -282,27 +282,27 @@ function render(m) {
|
|
|
282
282
|
span.append(el("span", "flag", (t.flags || []).join(" ")));
|
|
283
283
|
att.append(span);
|
|
284
284
|
}
|
|
285
|
-
// columns — each built once and kept, its contents rewritten every tick
|
|
286
|
-
//
|
|
285
|
+
// columns — each built once and kept, its contents rewritten every tick.
|
|
286
|
+
// A column scrolls on its own and a scroll offset lives on
|
|
287
287
|
// the element, so a tick that threw the columns away and built new ones
|
|
288
288
|
// jumped every column back to the top within one poll. Keeping the node
|
|
289
289
|
// keeps its scroll — and a scroll still in flight — with nothing to save
|
|
290
290
|
// or restore. #board's own children ARE the column cache: nothing else
|
|
291
291
|
// ever appends to or clears #board, so board.children[i] is always
|
|
292
|
-
// COLUMNS[i]'s node and no separate Map is needed to remember it
|
|
293
|
-
//
|
|
294
|
-
// silently stale against it, never disagree usefully
|
|
292
|
+
// COLUMNS[i]'s node and no separate Map is needed to remember it: a
|
|
293
|
+
// Map here could only ever agree with board.children or go
|
|
294
|
+
// silently stale against it, never disagree usefully. Every column's
|
|
295
295
|
// contents are built before any of them reach the DOM, so a ticket that
|
|
296
296
|
// makes card() throw partway through leaves EVERY column on the previous
|
|
297
297
|
// tick together — never some columns on the new tick and others frozen on
|
|
298
298
|
// the old one, a mixed-tick board that could look like a normal render
|
|
299
|
-
// (
|
|
299
|
+
// (poll()'s own catch below still banners the failure).
|
|
300
300
|
const board = document.getElementById("board");
|
|
301
301
|
const q = m.queue || {};
|
|
302
302
|
const next = COLUMNS.map((name) => {
|
|
303
303
|
const inCol = (m.tickets || []).filter((t) => t.column === name);
|
|
304
304
|
const h = el("h2", null, name + " ");
|
|
305
|
-
//
|
|
305
|
+
// POOL's own count is `q.pool` — the same number, except that a
|
|
306
306
|
// capped pool read makes it `"100+"`, and a header reading a bare 100
|
|
307
307
|
// beside a footer reading 100+ would be the exact claim the `+` retracts.
|
|
308
308
|
h.append(el("span", null, String(name === "POOL" ? q.pool ?? inCol.length : inCol.length)));
|
|
@@ -314,7 +314,7 @@ function render(m) {
|
|
|
314
314
|
col.replaceChildren(...next[i]);
|
|
315
315
|
});
|
|
316
316
|
renderSpend(m.spend);
|
|
317
|
-
//
|
|
317
|
+
// Computed here, ahead of the footer, not only inside the banner
|
|
318
318
|
// arm below. The banner is a single slot behind a stale/stall/ledger
|
|
319
319
|
// priority chain (next section): whenever any of those also fires on the
|
|
320
320
|
// same tick, that chain's capMsg arm never runs, and an open-PR cap has no
|
|
@@ -334,8 +334,8 @@ function render(m) {
|
|
|
334
334
|
(m.filed || []).map((f) => "#" + f.issue).join(" "));
|
|
335
335
|
foot.append(filed);
|
|
336
336
|
// freshness
|
|
337
|
-
//
|
|
338
|
-
//
|
|
337
|
+
// Exactly one payload reaches this page without a `generatedAt` —
|
|
338
|
+
// the identity stub, written at bind time so a racing launch's probe has
|
|
339
339
|
// something to read. The page can now SEE it, because the cockpit answers
|
|
340
340
|
// HTTP while its first tick is still computing where it used to answer
|
|
341
341
|
// nothing at all until the tick was done. Only computeBoard() sets the
|
|
@@ -346,7 +346,7 @@ function render(m) {
|
|
|
346
346
|
const banner = document.getElementById("stale-banner");
|
|
347
347
|
const ledgerMsg = ledgerBanner(m.ledgerState);
|
|
348
348
|
const stallMsg = livenessBanner(m.liveness);
|
|
349
|
-
//
|
|
349
|
+
// Best-effort placement in the single banner slot when nothing
|
|
350
350
|
// higher-priority holds it — ranked last, since stale/a stall/an unread
|
|
351
351
|
// ledger each say the board is wrong wholesale, versus this notice, which
|
|
352
352
|
// only says it may be short at one edge. The footer append above is what
|
|
@@ -375,7 +375,7 @@ function render(m) {
|
|
|
375
375
|
} else { banner.style.display = "none"; banner.className = ""; }
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
// The heartbeat's mark, rendered
|
|
378
|
+
// The heartbeat's mark, rendered. A dead run's tickets keep the label
|
|
379
379
|
// that marks them in flight, and the candidate scan EXCLUDES that label, so a
|
|
380
380
|
// run that stopped silently costs the night AND strands its tickets out of
|
|
381
381
|
// sight of the next run's scans. This is the surface that says so while the
|
|
@@ -402,7 +402,7 @@ function livenessBanner(l) {
|
|
|
402
402
|
return l && l.text ? "⚠ " + l.text : null;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
// Three ledger states, three renderings
|
|
405
|
+
// Three ledger states, three renderings. `read` refuses an absent ledger
|
|
406
406
|
// under --require-file now, so gather() can tell "there was no ledger to read"
|
|
407
407
|
// from "read it, nothing filed yet" from "read it, the answer would not parse".
|
|
408
408
|
// All three used to arrive here as the same empty lists and drew the same empty
|