@feigi/fleet-ctl 3.18.0 → 3.18.2

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.
@@ -16,7 +16,7 @@
16
16
  # missing (git would silently answer for the ENCLOSING repo instead, rc 0) are
17
17
  # all the unknown state — none of them is ever silently ahead:0, dirty:0, which
18
18
  # reads as "nothing here, safe to discard" and is indistinguishable from a
19
- # genuinely empty worktree. #82, #128.
19
+ # genuinely empty worktree.
20
20
  set -eu
21
21
 
22
22
  # Byte semantics for the `awk` and `paste` below — this script runs no `tr`,
@@ -25,12 +25,12 @@ set -eu
25
25
  # where the local filesystem refuses to hold the name. `paste -sd, -` is the
26
26
  # obvious one — fed `b\377ad.txt` then `plain.txt` it emits the single byte `b`
27
27
  # under `en_US.UTF-8` and the whole pair under `C`, exiting 0 both times, a
28
- # truncation carrying no stderr and no status. #582 measured the cost of
29
- # leaving this ambient in no-undo-audit.sh: a truncated list reported as a
28
+ # truncation carrying no stderr and no status. Leaving this ambient in
29
+ # no-undo-audit.sh was measured to cost the same: a truncated list reported as a
30
30
  # clean, confident answer.
31
31
  #
32
32
  # `awk` used to be the immune one — measured byte-identical under
33
- # `en_US.UTF-8` and `C` — and #617 ended that: `jesc` below turns git's octal
33
+ # `en_US.UTF-8` and `C` — and that has ended: `jesc` below turns git's octal
34
34
  # escapes back into bytes with `sprintf("%c", n)`, and that IS locale-sensitive.
35
35
  # Measured, `%c` with 195: gawk 5.4.1 emits the two-byte UTF-8 encoding of
36
36
  # U+00C3 under `en_US.UTF-8` and the single byte \303 under `C`; BWK awk
@@ -41,18 +41,18 @@ set -eu
41
41
  # Safe as a global: nothing in this script sorts, folds case, or uses a `[a-z]`
42
42
  # range or a POSIX class, so collation and case-folding — the two things
43
43
  # `LC_ALL=C` otherwise changes — have nothing here to act on. "Nothing" is an
44
- # inventory, not a hope: locale-pin-prose.test.mjs enforces it (#612), because
44
+ # inventory, not a hope: the locale-pin prose test enforces it, because
45
45
  # this sentence shipped false in no-undo-audit.sh and a `sort` added below
46
46
  # would otherwise leave every test in this suite green.
47
47
  export LC_ALL=C
48
48
 
49
49
  # Below the locale pin, not above it with `set -eu`: `unset` touches no
50
- # byte-sensitive tool, but locale-pin-prose.test.mjs treats ANY line here that
50
+ # byte-sensitive tool, but the locale-pin prose test treats ANY line here that
51
51
  # is not a comment, a blank, or `set -[eux]+` as work the pin must sit above,
52
52
  # and refuses on principle rather than on this line's own behaviour. Same
53
53
  # placement, same reason, as release-ticket.sh's copy.
54
54
  #
55
- # Both halves are measured on THIS script (#1020), and they break it in two
55
+ # Both halves are measured on THIS script, and they break it in two
56
56
  # different directions — which is why the line names both rather than the one
57
57
  # that happened to be found first.
58
58
  #
@@ -71,14 +71,14 @@ export LC_ALL=C
71
71
  # layout (`.worktrees/` gitignored, so the parent really is clean): a worktree
72
72
  # holding an uncommitted file comes back `dirty: 0, dirtyFiles: [],
73
73
  # readable: true` — a false CLEAN, at rc 0, indistinguishable from a worktree
74
- # that genuinely holds nothing. Same shape as #730's `showUntrackedFiles=no`
74
+ # that genuinely holds nothing. Same shape as a `showUntrackedFiles=no`
75
75
  # silence, reached through the environment instead of the config.
76
76
  unset GIT_DIR GIT_WORK_TREE
77
77
 
78
78
  NAME=worktree-audit
79
79
  die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 2; }
80
80
 
81
- # No positional argument (#525). A caller-supplied path was silently discarded
81
+ # No positional argument. A caller-supplied path was silently discarded
82
82
  # — no `$#` check, no usage — so a missing worktree returned a full audit of
83
83
  # every OTHER worktree at exit 0, first row the main checkout. Refuse loudly
84
84
  # instead of adding a filter: this script's whole contract is "every worktree,
@@ -87,7 +87,7 @@ die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 2; }
87
87
  # the json_lib guard below, so a refusal never emits a truncated array.
88
88
  [ $# -eq 0 ] || die "takes no arguments; audits every worktree"
89
89
 
90
- # The escaping helpers (#119). json.sh's header holds the sourcing contract and
90
+ # The escaping helpers. json.sh's header holds the sourcing contract and
91
91
  # the measurements behind it. This script defines no exit 1 at all, so a bare 1
92
92
  # out of it is a code its caller has no reading for. Placed here, above the
93
93
  # opening `[`, so a missing library refuses before the array is started rather
@@ -98,7 +98,7 @@ json_lib="$(dirname "$0")/json.sh"
98
98
  # shellcheck source=json.sh
99
99
  . "$json_lib" || die "$json_lib failed to load"
100
100
 
101
- # The worktree readers (#551, #725). worktree.sh's header holds the sourcing
101
+ # The worktree readers. worktree.sh's header holds the sourcing
102
102
  # contract and the measurements behind it, and json.sh's holds the `[ -r ]`
103
103
  # reasoning both guards share. Above the opening `[` for the reason the json_lib
104
104
  # guard is: a missing library must refuse before the array is started.
@@ -108,7 +108,7 @@ wt_lib="$(dirname "$0")/worktree.sh"
108
108
  # shellcheck source=worktree.sh
109
109
  . "$wt_lib" || die "$wt_lib failed to load"
110
110
  # One unknown state, one place: null counts, readable:false, one reason. Seven
111
- # call sites below reach this function — #2220's admin-dir-unreadable arm
111
+ # call sites below reach this function — the admin-dir-unreadable arm
112
112
  # among them — and differ in nothing but that reason, so one more added
113
113
  # later cannot half-set the quadruple and emit a record whose counts
114
114
  # contradict its own `readable` field. The MISSING branch stays spelled out —
@@ -120,12 +120,12 @@ unknown() { readable=false; ahead=null; dirty=null; files=""; note=; printf '
120
120
  # on a claim branch lands HEAD on a commit `origin/main` already has — so a
121
121
  # count from HEAD alone read such a worktree as `ahead:0, dirty:0`, the
122
122
  # "nothing here" row, while the branch it holds carries unpushed commits.
123
- # `wt_op_state` (#2218) reads the held branch out of the admin dir; this sets
123
+ # `wt_op_state` reads the held branch out of the admin dir; this sets
124
124
  # `held` to those refs, relabels `short` with their short names and `note`
125
125
  # with the operation, for the count below to run over HEAD and `held`
126
126
  # together: that union is the branch's own commits plus whatever a rebase
127
127
  # has replayed so far onto HEAD alone. Attached rows are untouched. 1: the
128
- # admin dir cannot be read, so whether a branch is held is unknown. #2220
128
+ # admin dir cannot be read, so whether a branch is held is unknown.
129
129
  #
130
130
  # A bisect started from a detached HEAD writes that HEAD's SHA, not a branch,
131
131
  # into BISECT_START, and `wt_op_state` still returns it as `refs/heads/<sha>`
@@ -140,7 +140,7 @@ op_held() {
140
140
  for h in $wt_op_held; do
141
141
  sha=$(git -C "$wt" rev-parse --verify "${h#refs/heads/}^{commit}" 2>/dev/null) || sha=
142
142
  # A bisect-from-detached-HEAD write drops here because `$h` never names a
143
- # real ref (#2218: it is HEAD's own SHA reread as `refs/heads/<sha>`). The
143
+ # real ref (it is HEAD's own SHA reread as `refs/heads/<sha>`). The
144
144
  # sha=name match alone cannot tell that case apart from a real branch that
145
145
  # happens to be NAMED as the 40-hex string it also resolves to — so the
146
146
  # second, structural check is what actually distinguishes them: a real
@@ -153,7 +153,7 @@ op_held() {
153
153
  [ -n "$held" ] || return 0
154
154
  short=
155
155
  for h in $held; do short="${short:+$short }${h#refs/heads/}"; done
156
- # `$wt_op` names only the LAST admin marker `wt_op_state` found (#2218's own
156
+ # `$wt_op` names only the LAST admin marker `wt_op_state` found (its own
157
157
  # last-wins scan), so it cannot tell a worktree with ONE operation from one
158
158
  # with a rebase stopped and a bisect then started on top of it — both leave
159
159
  # BISECT_LOG present and `wt_op=BISECT_LOG`, even though the branch actually
@@ -176,8 +176,8 @@ op_held() {
176
176
  }
177
177
 
178
178
  base=${BASE_REF:-origin/main}
179
- # Only a remote-tracking ref is accepted — the accept-list reap.sh:156 (#924)
180
- # and release-ticket.sh:229 (#1320) both carry, and this script had none of.
179
+ # Only a remote-tracking ref is accepted — the accept-list reap.sh and
180
+ # release-ticket.sh both carry, and this script had none of.
181
181
  # Unlike those two, this script is audit-only: it prints ahead/dirty counts
182
182
  # to stdout and never itself writes to git state, so a fleet controller
183
183
  # acting on a wrong number is the whole blast radius, not this process. That
@@ -194,7 +194,7 @@ case "$base" in
194
194
  *) die "BASE_REF must be a remote-tracking ref, got '$base'";;
195
195
  esac
196
196
 
197
- # release-ticket.sh (#1320) found the same bug in the same default: `origin/
197
+ # release-ticket.sh found the same bug in the same default: `origin/
198
198
  # main` is a SHORTHAND, and git resolves a shorthand through its own
199
199
  # disambiguation order (gitrevisions: refs/<name>, refs/tags/<name>,
200
200
  # refs/heads/<name>, refs/remotes/<name>, …), in which refs/remotes/origin/
@@ -203,15 +203,14 @@ esac
203
203
  # branch, and every measurement against the bare shorthand then answers
204
204
  # about the tag's target instead: `ahead` silently reads 0 against a
205
205
  # worktree that genuinely carries unpushed work, exactly the "nothing here"
206
- # signal #82, #128 established this script's readers trust.
206
+ # signal the header says readers take as safe to discard.
207
207
  #
208
208
  # The fix is to stop MEASURING against the shorthand: qualify it to the full
209
209
  # refs/remotes/ path, where there is nothing left to disambiguate, unless it
210
210
  # is already qualified. The accept-list above is what makes this qualify
211
- # step safe rather than a guess — #924 recorded qualifying as unavailable
212
- # without one, because BASE_REF could otherwise name a tag, a SHA or a local
213
- # branch, leaving no prefix that is always correct. $base itself is left
214
- # unqualified — it never appears in this script's JSON output, only in
211
+ # step safe rather than a guess — BASE_REF could otherwise name a tag, a SHA
212
+ # or a local branch, leaving no prefix that is always correct. $base itself
213
+ # is left unqualified — it never appears in this script's JSON output, only in
215
214
  # `die` text, where the shorthand spelling is what an operator expects to
216
215
  # read.
217
216
  case "$base" in
@@ -242,13 +241,13 @@ printf '['
242
241
  # read past it, AND end the `read -r` line below — two truncations, and the loop
243
242
  # saw a shorter path than even the awk had. `wt_listing` swaps both separators
244
243
  # before either stage runs, so the path arrives on one line; `nl_path` below is
245
- # what refuses to stat it. #551
244
+ # what refuses to stat it.
246
245
  #
247
246
  # The path goes LAST, and the branch first, because the tab this awk delimits
248
247
  # with is itself a byte a path may hold — and `read -r wt br` split such a path
249
248
  # at it, reporting a truncated `MISSING on disk` for a worktree that is present
250
249
  # and clean, with the tail of its path swallowed into the branch field. That is
251
- # #551's own defect shape surviving in #551's own rewrite. With the path last,
250
+ # the newline-path defect's own shape surviving in its own rewrite. With the path last,
252
251
  # `read` assigns the whole remainder of the line to the final name whatever it
253
252
  # holds, so no byte in a path can split it. The branch cannot take that slot: a
254
253
  # ref name rejects a tab outright, which is what makes it safe to read first.
@@ -262,7 +261,7 @@ while IFS="$(printf '\t')" read -r br wt; do
262
261
  # substituted byte as a space, so the entry still names which worktree could
263
262
  # not be audited, whole, with the byte neutralised. The same ceiling
264
263
  # inflight.sh's probe 3 records, and here it costs a diagnosis rather than a
265
- # verdict. #551
264
+ # verdict.
266
265
  if nl_path "$wt"; then
267
266
  unknown "path holds a newline — git's own listing cannot be read back to a name this script can stat"
268
267
  elif [ -d "$wt" ]; then
@@ -280,7 +279,7 @@ while IFS="$(printf '\t')" read -r br wt; do
280
279
  # `git worktree list --porcelain` emits a `branch refs/heads/...` line for
281
280
  # it, so a `[gone]` branch checked out there binds reap.sh's own `$wt` to
282
281
  # it — and handles that shape explicitly before its own `-f` linkage guard
283
- # (#128 reference shape) rather than by construction. Here the guard itself
282
+ # rather than by construction. Here the guard itself
284
283
  # must accept both: a real git dir always has `HEAD` sitting directly in
285
284
  # it, and an empty stand-in directory or a dangling symlink — the two
286
285
  # shapes a broken/deleted linkage takes, and what leaks the parent's status
@@ -292,7 +291,7 @@ while IFS="$(printf '\t')" read -r br wt; do
292
291
  if [ -x "$wt" ] && [ ! -f "$wt/.git" ] && [ ! -f "$wt/.git/HEAD" ]; then
293
292
  unknown "no .git linkage — git would answer for the enclosing repo, not this worktree"
294
293
  # Below the linkage guard, never above it: `wt_op_state` asks git FROM
295
- # `$wt`, which without a linkage answers for the enclosing repo. #2220
294
+ # `$wt`, which without a linkage answers for the enclosing repo.
296
295
  elif ! op_held; then
297
296
  unknown "cannot read its admin dir — a rebase or bisect there may hold a branch HEAD no longer points at"
298
297
  # Chain on `&&`, not `|| echo 0`: a piped `wc -l` always exits 0 even when
@@ -300,23 +299,23 @@ while IFS="$(printf '\t')" read -r br wt; do
300
299
  # never fires and a permissions/corruption failure reads as "0 ahead, 0
301
300
  # dirty" — indistinguishable from a genuinely clean worktree.
302
301
  #
303
- # `-uall`: #730 (see reap.sh's branch sweep for the full explanation) — a
302
+ # `-uall` (see reap.sh's branch sweep for the full explanation) — a
304
303
  # bare `--porcelain` reads `dirty: 0` over a dirty tree under
305
304
  # `status.showUntrackedFiles = no`, and the `&&` chain above, built
306
305
  # precisely so a failure to look is never scored as clean, cannot see it
307
306
  # either, because the status IS 0.
308
307
  #
309
308
  # `-uall` over `-unormal` here specifically, unlike reap.sh's `--ignored`
310
- # reason-string probe (which switched to `-unormal`, same PR): this
309
+ # reason-string probe (which uses `-unormal`): this
311
310
  # report's `dirtyFiles[]` is what a fleet controller reads to decide
312
- # whether a replacement member would REDO work or DESTROY it, and #617
311
+ # whether a replacement member would REDO work or DESTROY it, and this script
313
312
  # already invested in translating git's C-quoting to JSON precisely so
314
313
  # `dirtyFiles[]` round-trips to the real path on disk — infrastructure
315
314
  # that exists to let the array name individual files, not just
316
315
  # directories. `-unormal` would collapse an untracked directory to one
317
316
  # entry, silently dropping that granularity for whoever reads this
318
317
  # array. Proven, not just asserted: see the nested-directory test in
319
- # worktree-audit.test.mjs.
318
+ # this script's tests.
320
319
  #
321
320
  # `$held` unquoted: a space-separated list of full `refs/heads/` names,
322
321
  # empty for every attached row, and a ref name holds no space or glob byte.
@@ -332,9 +331,9 @@ while IFS="$(printf '\t')" read -r br wt; do
332
331
  # git 2.50.1 — and C-quoting is NOT JSON escaping. `\303\251` for the `é`
333
332
  # in `café.txt` is an invalid JSON escape, so ONE such file made the whole
334
333
  # array unparseable and cost the caller every other worktree's entry too.
335
- # #617 settled the open half of that: TRANSLATE git's form into JSON's, so
334
+ # The open half of that is settled: TRANSLATE git's form into JSON's, so
336
335
  # `dirtyFiles[]` round-trips to the real name on disk. The alternative
337
- # #617 weighed — JSON-escape the C-quoted text itself — parses, but hands
336
+ # considered — JSON-escape the C-quoted text itself — parses, but hands
338
337
  # a fleet controller a string it cannot pass back to the filesystem, which
339
338
  # is the same defect `nl_path` above refuses rather than reports.
340
339
  #
@@ -355,14 +354,14 @@ while IFS="$(printf '\t')" read -r br wt; do
355
354
  # `jesc` meets \000 as three literal digit characters (git's own octal
356
355
  # spelling of the byte), never as an embedded NUL, so the exclusion that
357
356
  # protects `tr` does not apply here. Emits the same five short forms, and
358
- # leaves \177 alone (#146).
357
+ # leaves \177 alone.
359
358
  if jfiles=$(printf '%s\n' "$status_out" | awk '
360
359
  # git C-quoting to JSON, byte for byte. An UNQUOTED path is returned
361
360
  # untouched: git quotes for `"`, `\`, any control byte and any byte with
362
361
  # the high bit set, so what it left bare is printable ASCII with nothing
363
362
  # JSON needs escaped. `index("01234567", c)`, not a `[0-7]` bracket range
364
- # — locale-pin-prose.test.mjs scans this file for collation ranges and a
365
- # range here would read as one (#612). git spells an octal escape with
363
+ # — the locale-pin prose test scans this file for collation ranges and a
364
+ # range here would read as one. git spells an octal escape with
366
365
  # exactly three digits, so the two lookahead reads below always land.
367
366
  # jesc_err is a global, deliberately never reset: an unrecognized escape
368
367
  # exits the awk program (below) before a second call could matter, so
@@ -379,7 +378,7 @@ while IFS="$(printf '\t')" read -r br wt; do
379
378
  out = out (n < 32 ? " " : sprintf("%c", n))
380
379
  } else if (c=="a" || c=="v") out=out " "
381
380
  else if (index("bfnrt\\\"", c) > 0) out=out "\\" c
382
- # An escape letter git 2.50.1 never emits (the #617 enumeration
381
+ # An escape letter git 2.50.1 never emits (the enumeration
383
382
  # above is exhaustive against it) — dead code under real git, same
384
383
  # as the header states. Fail loud rather than pass the byte through
385
384
  # unescaped: this file has one rule above every other one, never
@@ -402,7 +401,7 @@ while IFS="$(printf '\t')" read -r br wt; do
402
401
  # unescaped closing quote, which the scan below finds. Reading the
403
402
  # whole rename line as one path put the quotes git had already added
404
403
  # inside the pair added below: one such file made the WHOLE payload
405
- # unparseable, taking every other worktree entry down with it (#82).
404
+ # unparseable, taking every other worktree entry down with it.
406
405
  if (substr($0,1,1) ~ /[RC]/) {
407
406
  if (substr(p,1,1) == "\"") {
408
407
  for (i=2; i<=length(p); i++) {
@@ -420,7 +419,7 @@ while IFS="$(printf '\t')" read -r br wt; do
420
419
  # Checked here, not after the pipeline: `awk ... | paste -sd, -` would
421
420
  # otherwise report the PASTE exit status, and paste never fails on
422
421
  # this input — the jesc_err below would kill awk with nothing
423
- # downstream ever finding out (#617 suggestion 3).
422
+ # downstream ever finding out.
424
423
  if (jesc_err != "") {
425
424
  print "jesc: unrecognized C-quote escape \\" jesc_err > "/dev/stderr"
426
425
  exit 1
@@ -444,11 +443,11 @@ while IFS="$(printf '\t')" read -r br wt; do
444
443
  # so a DANGLING symlink is `-e` false and `-L` true, and without this it fell
445
444
  # past both this arm and `gone` into "an ancestor could not be read" — prose
446
445
  # that is false of a path whose every ancestor was read fine. `gone` now
447
- # refuses it too (#725), so this arm is where it lands, and the diagnosis
446
+ # refuses it too, so this arm is where it lands, and the diagnosis
448
447
  # below is true of it: a link IS there, and it is not a directory. The
449
448
  # wording stays hedged deliberately — a dangling worktree link is rc-0
450
449
  # residue OR release-ticket.sh's rc-255 halt path with the claim still live,
451
- # and only the hedge is true of both (#728).
450
+ # and only the hedge is true of both.
452
451
  #
453
452
  # `-d` false does not mean "not there". A registered worktree path replaced
454
453
  # by a regular file, a symlink to one, or a FIFO is all three still LISTED
@@ -471,7 +470,7 @@ while IFS="$(printf '\t')" read -r br wt; do
471
470
  # filename and accepts both. This script's whole output is one array, so a
472
471
  # single unescaped byte costs the caller every entry, not just this one.
473
472
  # `$files` is NOT wrapped here: its elements arrive already quoted and already
474
- # JSON-escaped, by `jesc` in the `files=` awk above (#617).
473
+ # JSON-escaped, by `jesc` in the `files=` awk above.
475
474
  # `die` rather than a null field, unlike reap.sh: nothing has been mutated
476
475
  # here, so refusing costs no record of work already done.
477
476
  wt_j=$(jstr "$wt") && short_j=$(jstr "$short") \
@@ -986,7 +986,9 @@ newest `impl-` member of a ticket whose row carries none of the three
986
986
  verdicts, whether that member is still running or already settled `bailed`,
987
987
  `killed` or `released`, and `HOLD (tier mismatch impl-<N>)` for a mismatched
988
988
  one. Only the newest member counts, so a replacement (`impl-<N>-b`) is what
989
- clears a mismatch — and is then owed its own check. The tick never reads a
989
+ clears a mismatch — and is then owed its own check. A mismatch on a ticket
990
+ whose issue is already CLOSED holds nothing: the tick probes that issue and
991
+ drops it, since there is nothing left to replace. The tick never reads a
990
992
  transcript: clear an unchecked hold by running the check on that member with
991
993
  `session`. A settled member's check works only when its transcript exists;
992
994
  without one, the verdict is `tier-unverifiable` for a member settled `killed`