@feigi/fleet-ctl 3.17.7 → 3.18.1
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/compute-board.mjs +19 -9
- package/scripts/compute-board.test.mjs +91 -0
- package/scripts/finisher-died-prose.test.mjs +31 -0
- package/scripts/fleet-tick-prose.test.mjs +1 -0
- package/scripts/fleet-tick.mjs +20 -9
- package/scripts/fleet-tick.test.mjs +12 -1
- package/scripts/inflight.sh +62 -62
- package/scripts/no-undo-audit.sh +52 -53
- package/scripts/worktree-audit.sh +43 -44
- package/skills/run-team/SKILL.md +14 -0
package/scripts/inflight.sh
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
# found it. Exit 2 from a probe failure carries a payload — the same shape as
|
|
15
15
|
# 0 and 1, plus an "unknown" list naming which probes could not look.
|
|
16
16
|
#
|
|
17
|
-
# Four failures still exit 2 with no payload at all
|
|
18
|
-
# in docs/specs/2026-07-23-fleet-plugin-design.md lists. Three of them land
|
|
17
|
+
# Four failures still exit 2 with no payload at all. Three of them land
|
|
19
18
|
# before anything has been established: a bad argument, not being inside a git
|
|
20
19
|
# repository, and no such issue. That last one fires inside probe 1, after its
|
|
21
20
|
# own `gh issue view` has already run — it is not a pre-probe check, it is the
|
|
@@ -23,14 +22,14 @@
|
|
|
23
22
|
# recording one probe's unknown. The fourth is the opposite end: the verdict
|
|
24
23
|
# itself cannot be written at all, which fails after every probe has finished,
|
|
25
24
|
# with everything established and no way to say it. An evidence string that
|
|
26
|
-
# cannot be rendered is NOT one of the four
|
|
25
|
+
# cannot be rendered is NOT one of the four: the verdict is already
|
|
27
26
|
# correct at that point, and a formatter breaking must not retract it — that
|
|
28
27
|
# field is emitted as JSON null instead, on the payload the verdict already
|
|
29
28
|
# earned. No gap left in that: `jstr`'s own `sed` stage used to be invisible —
|
|
30
29
|
# a pipeline reports only its LAST stage, so a failed `sed` rendered the field
|
|
31
30
|
# as "", the same value "found nothing" uses, with no null and no stderr line.
|
|
32
31
|
# json.sh captures each fallible stage and reads its status, so that failure now
|
|
33
|
-
# reaches `add_evidence` and lands in the null branch like any other
|
|
32
|
+
# reaches `add_evidence` and lands in the null branch like any other.
|
|
34
33
|
set -eu
|
|
35
34
|
|
|
36
35
|
# Byte semantics for the `tr`, `sed` and `awk` below. There is no `grep`: this
|
|
@@ -42,7 +41,7 @@ set -eu
|
|
|
42
41
|
# paths. Under a UTF-8 locale BSD `tr` and `sed` exit 1 on a byte that is not
|
|
43
42
|
# valid UTF-8 — `sed` emitting nothing at all, measured.
|
|
44
43
|
#
|
|
45
|
-
# `awk` is NOT immune, and reap.sh's own
|
|
44
|
+
# `awk` is NOT immune, and reap.sh's own fixture measured the earlier
|
|
46
45
|
# claim here false: it is byte-identical only when every rule matches at an
|
|
47
46
|
# ANCHOR before the bad byte, never needing to convert it — a rule that must
|
|
48
47
|
# SCAN PAST the byte to decide dies instead (BWK awk, macOS: rc 2, `towc:
|
|
@@ -55,19 +54,19 @@ set -eu
|
|
|
55
54
|
#
|
|
56
55
|
# Such a byte reaches us from a fetched tree even where the local filesystem
|
|
57
56
|
# refuses to hold the name, and inside `$(...)` a `tr` failure empties the
|
|
58
|
-
# cause out of the diagnostic without a trace.
|
|
59
|
-
# leaving this ambient in no-undo-audit.sh: a truncated list reported as a
|
|
57
|
+
# cause out of the diagnostic without a trace. The cost of
|
|
58
|
+
# leaving this ambient in no-undo-audit.sh was measured: a truncated list reported as a
|
|
60
59
|
# clean, confident answer.
|
|
61
60
|
#
|
|
62
61
|
# Safe as a global: nothing in this script sorts, folds case, or holds a POSIX
|
|
63
62
|
# class. It does use ONE collation range — `*[!0-9]*`, the issue-number guard
|
|
64
63
|
# below — and a range IS locale-sensitive by spec, its members drawn from the
|
|
65
64
|
# collation sequence rather than the codepoint order. Measured inert here
|
|
66
|
-
#
|
|
65
|
+
# — `0-9` matches the ASCII digits and nothing else under `C`,
|
|
67
66
|
# `en_US.UTF-8`, `de_DE.UTF-8` and `tr_TR.UTF-8` alike, with superscript `²`,
|
|
68
67
|
# Arabic-Indic digits and `½` excluded in all four. So collation and
|
|
69
68
|
# case-folding — the two things `LC_ALL=C` otherwise changes — have nothing
|
|
70
|
-
# here to act on. locale-pin
|
|
69
|
+
# here to act on. The locale-pin prose test holds that inventory as a list and
|
|
71
70
|
# fails if the code drifts from this paragraph in either direction.
|
|
72
71
|
#
|
|
73
72
|
# This completes a pin this script already started: the five `LC_ALL=C` prefixes
|
|
@@ -77,7 +76,7 @@ set -eu
|
|
|
77
76
|
export LC_ALL=C
|
|
78
77
|
|
|
79
78
|
# Below the locale pin, not above it with `set -eu`: `unset` touches no
|
|
80
|
-
# byte-sensitive tool, but locale-pin
|
|
79
|
+
# byte-sensitive tool, but the locale-pin prose test treats ANY line here that
|
|
81
80
|
# is not a comment, a blank, or `set -[eux]+` as work the pin must sit above,
|
|
82
81
|
# and refuses on principle rather than on this line's own behaviour. Same
|
|
83
82
|
# placement, same reason, as release-ticket.sh's copy.
|
|
@@ -86,10 +85,10 @@ export LC_ALL=C
|
|
|
86
85
|
# `rev-parse --git-common-dir`, `for-each-ref`, `worktree list` — so an
|
|
87
86
|
# ambient one asks the WRONG repository whether this ticket is taken.
|
|
88
87
|
# Measured, standing in a checkout that holds both the branch and the
|
|
89
|
-
# worktree for
|
|
90
|
-
# `no local branch or worktree for
|
|
88
|
+
# worktree for ticket <N>, with `GIT_DIR` naming a second clone that holds neither:
|
|
89
|
+
# `no local branch or worktree for #<N>`, and with probes 1 and 2 silent the
|
|
91
90
|
# verdict is `taken: false` on a ticket already claimed. That is the
|
|
92
|
-
# double-claim phase 0 runs this script to prevent, and
|
|
91
|
+
# double-claim phase 0 runs this script to prevent, and the test suite's
|
|
93
92
|
# own fixture builder already deletes both variables for exactly this reason
|
|
94
93
|
# — a defence that protected the SUITE while leaving every real caller
|
|
95
94
|
# exposed.
|
|
@@ -101,16 +100,16 @@ export LC_ALL=C
|
|
|
101
100
|
# there is no behaviour for it to change and no behavioural fixture can pin
|
|
102
101
|
# it. It stays on the line because the pair is one hazard with one remedy,
|
|
103
102
|
# and because "inert today" is a measurement of the current call set, not a
|
|
104
|
-
# property of the script.
|
|
103
|
+
# property of the script. A prose test pins the line
|
|
105
104
|
# itself, which is what keeps that half from being quietly dropped.
|
|
106
105
|
unset GIT_DIR GIT_WORK_TREE
|
|
107
106
|
|
|
108
107
|
NAME=inflight
|
|
109
108
|
die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 2; }
|
|
110
109
|
|
|
111
|
-
# The escaping helpers
|
|
110
|
+
# The escaping helpers. json.sh's header holds the sourcing contract and
|
|
112
111
|
# the measurements behind it; only what is true of THIS script is repeated here.
|
|
113
|
-
# Below `export LC_ALL=C` deliberately: locale-pin
|
|
112
|
+
# Below `export LC_ALL=C` deliberately: the locale-pin prose test allows only
|
|
114
113
|
# comments, blanks, a shebang or a `set -` line above that pin, and `json_lib=`
|
|
115
114
|
# is none of them.
|
|
116
115
|
#
|
|
@@ -123,7 +122,7 @@ json_lib="$(dirname "$0")/json.sh"
|
|
|
123
122
|
# shellcheck source=json.sh
|
|
124
123
|
. "$json_lib" || die "$json_lib failed to load"
|
|
125
124
|
|
|
126
|
-
# The bounded, prompt-suppressed git transport
|
|
125
|
+
# The bounded, prompt-suppressed git transport. It landed here
|
|
127
126
|
# for probe 2 alone and now lives in net.sh, where every other unattended `git`
|
|
128
127
|
# network call in the fleet reaches it too; net.sh's header holds the reasoning
|
|
129
128
|
# and the measurements. Sourced BELOW json.sh, deliberately: exit 1 from this
|
|
@@ -197,8 +196,8 @@ trap 'rm -f ${errfile:+"$errfile"} ${wtfile:+"$wtfile"} ${wdfile:+"$wdfile"} ||
|
|
|
197
196
|
# merely contained the digits somewhere. Trusting it makes nearly every ticket
|
|
198
197
|
# read as taken, so the fleet skips free work silently and permanently.
|
|
199
198
|
#
|
|
200
|
-
# Nor a closing-keyword regex over the body. Also measured here: PR
|
|
201
|
-
# docs fix ABOUT issue references
|
|
199
|
+
# Nor a closing-keyword regex over the body. Also measured here: a PR that is a
|
|
200
|
+
# docs fix ABOUT issue references quotes `Closes #N.` inside a
|
|
202
201
|
# markdown table. A regex cannot tell quoted text from a real link.
|
|
203
202
|
#
|
|
204
203
|
# Ask GitHub instead. `closedByPullRequestsReferences` is its own resolution of
|
|
@@ -220,7 +219,7 @@ echo "\$ gh issue view $n --json closedByPullRequestsReferences,url" >&2
|
|
|
220
219
|
# a fixed /tmp/.inflight.$$ — guessable from the PID, and `>` follows a
|
|
221
220
|
# symlink, so anything on the host that pre-plants that path pointing at a
|
|
222
221
|
# file this user can write gets it truncated the instant stderr lands there
|
|
223
|
-
# (
|
|
222
|
+
# (measured: a 37-byte victim file left at 14 bytes). mktemp's
|
|
224
223
|
# unpredictable name closes the guess; the trap closes the other half — no
|
|
225
224
|
# cleanup ran for an interrupt landing between the redirect and the `rm -f`
|
|
226
225
|
# that only ever followed a call that finished.
|
|
@@ -350,11 +349,11 @@ print(", ".join(out))') || { add_unknown "pr" "could not filter PR search result
|
|
|
350
349
|
# Measured: the tally then prints the hole, `( full-text match(es) considered)`.
|
|
351
350
|
#
|
|
352
351
|
# `raw="?"` and NOT `add_unknown "pr"; return 1`, which is what stood here and
|
|
353
|
-
# was wrong
|
|
352
|
+
# was wrong. This count feeds nothing but the two diagnostics below: the
|
|
354
353
|
# PR answer is `$pr`, which the guarded filter above already established, so a
|
|
355
354
|
# tally that could not run leaves that answer entirely intact. Returning here
|
|
356
355
|
# discarded an already-sufficient hit over a cosmetic number — measured exit 2
|
|
357
|
-
# with `hits:[]` while `evidence.pr` read
|
|
356
|
+
# with `hits:[]` while `evidence.pr` read `#<pr> OPEN (linked)`. A stage that
|
|
358
357
|
# cannot change the answer must not be able to retract it.
|
|
359
358
|
raw=$(printf '%s' "$pr_json" | python3 -c 'import json,sys;print(len(json.load(sys.stdin)))') \
|
|
360
359
|
|| raw="?"
|
|
@@ -412,26 +411,26 @@ echo "\$ git ls-remote --heads origin" >&2
|
|
|
412
411
|
# can match. git's own wording is more use on the terminal anyway.
|
|
413
412
|
#
|
|
414
413
|
# This is the one network call in the script (probe 1 goes through `gh`, probe
|
|
415
|
-
# 3 never leaves disk), and unattended it must neither prompt nor hang
|
|
414
|
+
# 3 never leaves disk), and unattended it must neither prompt nor hang.
|
|
416
415
|
#
|
|
417
416
|
# The knobs that suppress the prompt and the watchdog that bounds the call both
|
|
418
|
-
# live in net.sh now, which every unattended `git` network call in the
|
|
419
|
-
# routes through
|
|
417
|
+
# live in net.sh now, which every unattended `git` network call in the
|
|
418
|
+
# fleet routes through; its header holds the reasoning and the measurements.
|
|
420
419
|
# What stays here is what is true of THIS call: its budget, and how a killed
|
|
421
420
|
# call is reported.
|
|
422
421
|
#
|
|
423
422
|
# The budget. Above what the ssh options can spend before they give up on their
|
|
424
423
|
# own — ConnectTimeout plus the ServerAlive pair's whole run — so this never
|
|
425
424
|
# preempts a bound that would have produced git's own diagnostic, and short
|
|
426
|
-
# enough that a stalled probe does not hold a fleet slot
|
|
425
|
+
# enough that a stalled probe does not hold a fleet slot.
|
|
427
426
|
# `ls-remote` moves refs and no objects, so this is generous for the work.
|
|
428
427
|
#
|
|
429
428
|
# `INFLIGHT_LS_REMOTE_TIMEOUT` is this call's own override. It can only ever
|
|
430
429
|
# SHORTEN, and the rule with its edge cases is net_budget's, in net.sh.
|
|
431
430
|
ls_budget=$(net_budget 30 "${INFLIGHT_LS_REMOTE_TIMEOUT:-}")
|
|
432
431
|
# A file this probe WANTS, not one it needs. Probe 2 is the one probe that
|
|
433
|
-
# answers when mktemp is broken —
|
|
434
|
-
#
|
|
432
|
+
# answers when mktemp is broken — deliberately so, and the test suite
|
|
433
|
+
# pins it — so a failed mktemp costs the sharper wording
|
|
435
434
|
# below, never the verdict. The old exit-status inference is what the wording
|
|
436
435
|
# falls back to there.
|
|
437
436
|
wdfile=$(mktemp) || wdfile=""
|
|
@@ -527,12 +526,12 @@ probe_remote || :
|
|
|
527
526
|
# could not run at all (git missing, a fork failure, an unreadable packed-refs,
|
|
528
527
|
# which exits 128). That is the floor, not the whole answer: git's own
|
|
529
528
|
# degraded reads exit 0 with output silently missing, which no exit-status
|
|
530
|
-
# guard can see. Measured
|
|
529
|
+
# guard can see. Measured: `chmod 000` on refs/heads or on the worktree
|
|
531
530
|
# admin dir, and both lookups below report nothing, at rc 0, for a ticket that
|
|
532
|
-
# has a live branch or worktree — the same wrong "free"
|
|
531
|
+
# has a live branch or worktree — the same wrong "free" this script exists to rule out,
|
|
533
532
|
# one probe down. Establish each storage was readable before trusting an empty
|
|
534
533
|
# result from it — the same rule release-ticket.sh's `-r`/`-x` guard on
|
|
535
|
-
# `$wtroot` already applies to its own worktree-registry read
|
|
534
|
+
# `$wtroot` already applies to its own worktree-registry read — absence
|
|
536
535
|
# must be established, never inferred.
|
|
537
536
|
#
|
|
538
537
|
# Ceiling, left open on purpose: a single loose ref git skips as corrupt
|
|
@@ -541,7 +540,7 @@ probe_remote || :
|
|
|
541
540
|
# it is not — so it stays undetected. Only counting refs against a source
|
|
542
541
|
# independent of git's own read would catch that, roughly doubling this
|
|
543
542
|
# probe's cost, for a fault that usually breaks much else first; out of scope
|
|
544
|
-
#
|
|
543
|
+
# here.
|
|
545
544
|
probe_local() {
|
|
546
545
|
common=$(git rev-parse --path-format=absolute --git-common-dir) ||
|
|
547
546
|
{ add_unknown "local" "cannot resolve the git common directory"; return 1; }
|
|
@@ -584,15 +583,16 @@ if [ -e "$refsdir" ]; then
|
|
|
584
583
|
# after `cmd | head -1` reports only `head`'s, and `head` exits 0 whether
|
|
585
584
|
# find printed a permission-denied hit or never ran at all (missing binary,
|
|
586
585
|
# a failed exec, any other swallowed crash) — both leave `$bad` empty, both
|
|
587
|
-
# used to read as a clean tree (
|
|
586
|
+
# used to read as a clean tree (reproduced by shimming `find` on
|
|
588
587
|
# PATH to `exit 127`). find's own status is read off the bare command
|
|
589
588
|
# substitution instead, with nothing piped after it, so nothing that runs
|
|
590
589
|
# after it can stand in for it again.
|
|
591
590
|
#
|
|
592
591
|
# `head`'s own status is kept too, not discarded — a `head` that cannot run
|
|
593
592
|
# (crashed, missing) is the same class of failure, and was the one failure
|
|
594
|
-
# this guard could already see before
|
|
595
|
-
# refs-subdirectory walk whose `head` cannot run is unknown,
|
|
593
|
+
# this guard could already see before find's own status was read (pinned
|
|
594
|
+
# below at "a refs-subdirectory walk whose `head` cannot run is unknown,
|
|
595
|
+
# never free").
|
|
596
596
|
# Reading both separately,
|
|
597
597
|
# rather than trusting whichever one the pipeline's single status happens to
|
|
598
598
|
# expose, is what closes the first gap without reopening the second.
|
|
@@ -615,7 +615,7 @@ fi
|
|
|
615
615
|
# found" — so the `local branches:` line and the localBranch evidence below
|
|
616
616
|
# both hand an operator a name they cannot paste into a git command.
|
|
617
617
|
# %(refname) is always refs/heads/<name>, so the strip yields the bare name for
|
|
618
|
-
# every branch, ambiguous or not.
|
|
618
|
+
# every branch, ambiguous or not. reap.sh enumerates the same way.
|
|
619
619
|
#
|
|
620
620
|
# Here the enumeration fix stands ALONE, and that is a finding about THIS
|
|
621
621
|
# script, not a conclusion carried over from that one. What made the fix unsafe
|
|
@@ -623,7 +623,7 @@ fi
|
|
|
623
623
|
# REV (`git cherry "$base" "$b"`), and git resolves an ambiguous rev by
|
|
624
624
|
# preferring refs/tags/ over refs/heads/ — so restoring the bare name made the
|
|
625
625
|
# merge probe answer about the TAG and authorized -D on an unmerged branch
|
|
626
|
-
# (measured
|
|
626
|
+
# (measured; reap.sh qualifies that one site `refs/heads/$b` for exactly
|
|
627
627
|
# this reason). Every site consuming this value here was enumerated and
|
|
628
628
|
# classified instead:
|
|
629
629
|
#
|
|
@@ -639,7 +639,7 @@ fi
|
|
|
639
639
|
# there a `refs/heads/$b` key to rebuild the way reap.sh's worktree lookup has:
|
|
640
640
|
# probe 3's worktree half matches the LISTING's own paths by basename, never a
|
|
641
641
|
# name from this enumeration. `$local_b` is a comma-joined list besides, so it
|
|
642
|
-
# could not be a rev even by accident. Nothing to qualify.
|
|
642
|
+
# could not be a rev even by accident. Nothing to qualify.
|
|
643
643
|
if ! refs=$(git for-each-ref --format='%(refname)' refs/heads); then
|
|
644
644
|
add_unknown "local" "git for-each-ref failed, so whether #$n has a local branch is unknown"
|
|
645
645
|
return 1
|
|
@@ -656,7 +656,7 @@ local_b=$(printf '%s\n' "$refs" | LC_ALL=C awk -v n="$n" '
|
|
|
656
656
|
{ add_unknown "local" "could not filter the local branches for #$n"; return 1; }
|
|
657
657
|
|
|
658
658
|
# Commit the branch half here, where it is established — NOT at the end of the
|
|
659
|
-
# probe with the worktree half
|
|
659
|
+
# probe with the worktree half. Every stage between here and there can
|
|
660
660
|
# fail and `return 1`: the registry read and count, `git worktree list`, the
|
|
661
661
|
# listed-versus-registered compare, the worktree filter. Recording the hit down
|
|
662
662
|
# there meant any one of them threw away a branch that already proves the
|
|
@@ -672,27 +672,27 @@ if [ -n "$local_b" ]; then
|
|
|
672
672
|
fi
|
|
673
673
|
|
|
674
674
|
# The worktree registry's check is a different shape from the one above, on
|
|
675
|
-
# purpose. It began as release-ticket.sh's own fix for this defect
|
|
675
|
+
# purpose. It began as release-ticket.sh's own fix for this defect rather
|
|
676
676
|
# than a second invented convention — but the two copies diverged from there
|
|
677
677
|
# and have converged on most of that ground, but not all of it — see the
|
|
678
678
|
# recount below for what still differs. Three of the four items that
|
|
679
679
|
# landed here first — the stray-directory skip, the awk counter and the
|
|
680
|
-
# direction split — were ported to that copy
|
|
681
|
-
# of the four
|
|
682
|
-
# not its exit STATUS, was a further divergence
|
|
680
|
+
# direction split — were ported to that copy; the recount was the last
|
|
681
|
+
# of the four to follow. That copy's skip reading only `ls`'s output,
|
|
682
|
+
# not its exit STATUS, was a further divergence, since closed: both
|
|
683
683
|
# copies' skip now reads the exit status.
|
|
684
684
|
#
|
|
685
685
|
# Porting the recount did not converge the two copies on it at once, though:
|
|
686
686
|
# this script's recount re-took `registered` alone (`count_registry`), while
|
|
687
687
|
# release-ticket.sh's copy of the SAME recount re-took `registered` AND
|
|
688
|
-
# `linked` together
|
|
688
|
+
# `linked` together, because re-taking `registered` by itself
|
|
689
689
|
# leaves `linked` pinned to the first listing and can misname a benign
|
|
690
|
-
# concurrent-worktree race as a fault.
|
|
690
|
+
# concurrent-worktree race as a fault. That divergence is closed here: both
|
|
691
691
|
# copies now re-take the pair, this one through the `count_linked` below. The
|
|
692
692
|
# mechanism under it is still each script's own — that copy reads the listing
|
|
693
693
|
# through worktree.sh's `wt_listing`, this one through the single EXIT trap's
|
|
694
694
|
# `$wtfile` — a difference in plumbing, same as before. What is no longer true
|
|
695
|
-
# is that the recount ITSELF is:
|
|
695
|
+
# is that the recount ITSELF is: release-ticket.sh's copy is bounded at up
|
|
696
696
|
# to two recount passes (`recount_tries`) to close a residual third-mutation
|
|
697
697
|
# race window that this script's own still-single-pass recount does not
|
|
698
698
|
# close.
|
|
@@ -700,8 +700,8 @@ fi
|
|
|
700
700
|
# A directory-level read+execute test alone is not enough
|
|
701
701
|
# here: naming a registry entry needs read+execute on the PARENT only, so a
|
|
702
702
|
# `gitdir` file chmod'd 000 INSIDE one entry passes every test on the entry
|
|
703
|
-
# itself while `worktree list --porcelain` still drops it, at rc 0
|
|
704
|
-
#
|
|
703
|
+
# itself while `worktree list --porcelain` still drops it, at rc 0
|
|
704
|
+
# (measured). Count registry entries on disk against what git reported instead —
|
|
705
705
|
# that catches a silent drop whichever file inside the entry was unreadable.
|
|
706
706
|
wtroot="$common/worktrees"
|
|
707
707
|
# A function because the count is taken twice — see the recount below. Absent
|
|
@@ -736,7 +736,7 @@ count_registry() {
|
|
|
736
736
|
# and an output-only skip counts 0 to match), no mismatch fires, and the
|
|
737
737
|
# probe answers `taken=false` for a ticket whose checkout is still on disk.
|
|
738
738
|
# Could not read it, so we cannot tell → count it and let the mismatch
|
|
739
|
-
# below fire.
|
|
739
|
+
# below fire.
|
|
740
740
|
if contents=$(ls -A "$entry" 2>/dev/null) && [ -z "$contents" ]; then continue; fi
|
|
741
741
|
registered=$((registered + 1))
|
|
742
742
|
done
|
|
@@ -752,10 +752,10 @@ count_registry || return 1
|
|
|
752
752
|
# `--porcelain -z`, into a temp file rather than a command substitution. The
|
|
753
753
|
# plain porcelain terminates every attribute with a newline, and a worktree
|
|
754
754
|
# path may legally contain one (APFS and ext4 both allow it), so one record
|
|
755
|
-
# splits into two. Measured on the plain form
|
|
755
|
+
# splits into two. Measured on the plain form: `…/wt/fix-66-a<LF>b`
|
|
756
756
|
# reported `worktree` truncated at `…/fix-66-a`, a path not on disk; and
|
|
757
757
|
# `…/wt/plain<LF>fix-33-slug` left the number on the orphaned second line,
|
|
758
|
-
# where the `^worktree ` filter never looked, so
|
|
758
|
+
# where the `^worktree ` filter never looked, so that ticket came back `taken=false` at
|
|
759
759
|
# exit 0 with its checkout live — the one answer this script must never invent.
|
|
760
760
|
# A temp file because `-z`'s separator is NUL and no shell variable can hold
|
|
761
761
|
# one, and because it keeps the lookup's status readable on its own, apart from
|
|
@@ -775,7 +775,7 @@ fi
|
|
|
775
775
|
# the `-ge 1` guard below checks, never read outside this function, matching
|
|
776
776
|
# release-ticket.sh's own `count_linked`, whose comment (line 383) likewise
|
|
777
777
|
# names only `linked` and `wt_list`/`wt_err`. Mirrors that same extraction over
|
|
778
|
-
# the same pair for the same recount
|
|
778
|
+
# the same pair for the same recount.
|
|
779
779
|
#
|
|
780
780
|
# The `mktemp` stays ABOVE this function rather than moving inside it, where
|
|
781
781
|
# release-ticket.sh's `wt_listing` creates and removes one of its own: the temp
|
|
@@ -852,7 +852,7 @@ count_linked() {
|
|
|
852
852
|
# with no linked worktree — a guard that refused that would make every probe in
|
|
853
853
|
# a clean repo unknown. Real `git worktree list --porcelain` always prints the
|
|
854
854
|
# main worktree, so reaching this needs a broken or shimmed git; the refusal
|
|
855
|
-
# direction was already right, only the number was nonsense.
|
|
855
|
+
# direction was already right, only the number was nonsense.
|
|
856
856
|
[ "$listed" -ge 1 ] ||
|
|
857
857
|
{ add_unknown "local" "git listed no worktrees at all for #$n — not even the main checkout, so the listing cannot be trusted"; return 1; }
|
|
858
858
|
linked=$((listed - 1))
|
|
@@ -870,12 +870,12 @@ count_linked || return 1
|
|
|
870
870
|
# FIRST count and git's listing is already reflected in that listing, so the
|
|
871
871
|
# second count agrees with it — the invariant the ORIGINAL pair above relies
|
|
872
872
|
# on. Escaping still needs a SECOND mutation inside the recount's own window.
|
|
873
|
-
# The two rates
|
|
873
|
+
# The two rates measured for recounting at all — 1.99% → 0.00% at
|
|
874
874
|
# λ = 2/s, 56.6% → 1.29% saturated — were taken on the registered-only
|
|
875
875
|
# recount this replaces, so that 1.29% residual bounds what narrowing the
|
|
876
876
|
# window below can still leave rather than describing it; it was not
|
|
877
877
|
# re-measured after that change. A real dropped entry is a standing state,
|
|
878
|
-
# not a moment, so it survives the recount and still refuses (verified:
|
|
878
|
+
# not a moment, so it survives the recount and still refuses (verified: an
|
|
879
879
|
# unreadable `gitdir` still aborts).
|
|
880
880
|
#
|
|
881
881
|
# BOTH counts, not `registered` alone, which is what that invariant costs.
|
|
@@ -895,8 +895,8 @@ count_linked || return 1
|
|
|
895
895
|
# above takes them, hands the RECOUNT pair the invariant too: the window an
|
|
896
896
|
# escape needs is the narrow gap these two calls open between themselves, not
|
|
897
897
|
# the whole span back to the first listing. Both directions pinned in
|
|
898
|
-
#
|
|
899
|
-
#
|
|
898
|
+
# the test suite. Mirrors release-ticket.sh's copy of this recount, which
|
|
899
|
+
# is fixed the same way.
|
|
900
900
|
#
|
|
901
901
|
# The retake pair above is still two reads, not one, and the gap it opens
|
|
902
902
|
# between ITSELF — after `count_registry` has already re-scanned but before
|
|
@@ -907,7 +907,7 @@ count_linked || return 1
|
|
|
907
907
|
# registered`, "the registry read missed entries git can see" — while a
|
|
908
908
|
# REMOVE the same way lands `linked -lt registered`, "the listing is
|
|
909
909
|
# incomplete", indistinguishable from the fault that message exists to name
|
|
910
|
-
# even though nothing here is actually wrong. Pinned in
|
|
910
|
+
# even though nothing here is actually wrong. Pinned in the test suite.
|
|
911
911
|
# Reordering to `count_linked && count_registry` does not remove this
|
|
912
912
|
# residual, it only moves the ADD case's false report onto the
|
|
913
913
|
# `linked -lt registered` branch instead — the direction the comment below
|
|
@@ -1026,12 +1026,12 @@ echo "$NAME: #$n taken=$taken" >&2
|
|
|
1026
1026
|
# remote — carries one in; a worktree path is a filename, so it carries in `\`
|
|
1027
1027
|
# as well, which git's ref rules reject. Raw, either emits a payload no JSON
|
|
1028
1028
|
# parser accepts. The rule list and its ordering live in json.sh, once, rather
|
|
1029
|
-
# than here and in release-ticket.sh and in no-undo-audit.sh
|
|
1029
|
+
# than here and in release-ticket.sh and in no-undo-audit.sh.
|
|
1030
1030
|
#
|
|
1031
1031
|
# The other three interpolations are not strings and are not wrapped: `$n` is
|
|
1032
1032
|
# refused unless it is all digits AND unpadded (the guard's `0?*` arm), which is
|
|
1033
1033
|
# what makes it a JSON number and not merely numeric — RFC 8259 forbids a
|
|
1034
|
-
# leading zero, so `007` never reaches this printf
|
|
1034
|
+
# leading zero, so `007` never reaches this printf; `$taken` is this
|
|
1035
1035
|
# script's own true/false, `$hits` only the fixed literals `add_hit` is given.
|
|
1036
1036
|
# `$pr` is wrapped with the rest — GitHub's own repo, number and state
|
|
1037
1037
|
# vocabulary cannot currently produce a quote, so it is uniformity against a
|
|
@@ -1043,7 +1043,7 @@ echo "$NAME: #$n taken=$taken" >&2
|
|
|
1043
1043
|
# malformed JSON at exit 0. Assigned first, each one is a simple command whose
|
|
1044
1044
|
# status this function can read.
|
|
1045
1045
|
#
|
|
1046
|
-
# `die` is NOT the answer here
|
|
1046
|
+
# `die` is NOT the answer here, unlike everywhere else in this script.
|
|
1047
1047
|
# The verdict — $taken, $hits, $rc — is already correct by this point; a
|
|
1048
1048
|
# formatter that broke AFTER a real answer was established must not convert
|
|
1049
1049
|
# that answer into "unanswerable". So a field jstr or jrewritten could not
|
|
@@ -1051,7 +1051,7 @@ echo "$NAME: #$n taken=$taken" >&2
|
|
|
1051
1051
|
# looked and found nothing" — and the run continues to the payload it earned,
|
|
1052
1052
|
# at the verdict's own exit code. A failed `sed` inside `jstr` used to escape
|
|
1053
1053
|
# this branch entirely and reach `""` unannounced; json.sh reads each stage's
|
|
1054
|
-
# own status, so it arrives here as a non-zero return like any other
|
|
1054
|
+
# own status, so it arrives here as a non-zero return like any other.
|
|
1055
1055
|
#
|
|
1056
1056
|
# The message names the escaper, not just the field, because the two fail
|
|
1057
1057
|
# independently: jstr can render a string perfectly while jrewritten cannot
|