@feigi/fleet-ctl 3.18.1 → 3.18.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
CHANGED
|
@@ -201,7 +201,8 @@ const COVERED_MJS = {
|
|
|
201
201
|
// children (`node candidates.mjs`, `node ledger.mjs`, `sh inflight.sh`)
|
|
202
202
|
// name no git.
|
|
203
203
|
"shortlist.mjs": 2,
|
|
204
|
-
//
|
|
204
|
+
// THREE. The first two are the pair shortlist.mjs carries (#1803), the
|
|
205
|
+
// third is below (#2485). `shortlistPath()`'s
|
|
205
206
|
// `--git-common-dir` probe names the `.fleet/shortlist.json` the tick PULLs
|
|
206
207
|
// from; an ambient GIT_DIR would read another repository's shortlist and
|
|
207
208
|
// name its tickets. Measured in fleet-tick.test.mjs, "an ambient GIT_DIR
|
|
@@ -211,7 +212,11 @@ const COVERED_MJS = {
|
|
|
211
212
|
// measured in fleet-tick.test.mjs, "an inherited GIT_DIR cannot retarget
|
|
212
213
|
// the behind-issue premise probe". Its other children (`gh pr list`,
|
|
213
214
|
// `node ledger.mjs`, `node shortlist.mjs`) are not git-invoking primitives.
|
|
214
|
-
|
|
215
|
+
// `closedTickets()`'s `gh issue view` asks whether a tier-mismatched
|
|
216
|
+
// implementer's ticket is already closed, and resolves the repository the
|
|
217
|
+
// same way; measured in fleet-tick.test.mjs, "an inherited GIT_DIR cannot
|
|
218
|
+
// retarget the tier-mismatch closed-ticket probe".
|
|
219
|
+
"fleet-tick.mjs": 3,
|
|
215
220
|
// ONE spawn primitive, `git(args, cwd)`, behind both of the file's git calls
|
|
216
221
|
// — `resolveMainRoot()`'s `rev-parse --git-common-dir` and `checkIgnored()`'s
|
|
217
222
|
// `check-ignore` (#1411). An ambient GIT_DIR would answer the first for
|
package/scripts/claim-ticket.sh
CHANGED
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
#
|
|
15
15
|
# The Install step and the Test entrypoint are READ from the repository's
|
|
16
16
|
# proven Recipe cache through derive-testcmd.sh — never inferred, never
|
|
17
|
-
# defaulted
|
|
17
|
+
# defaulted: this script keeps no table of technologies. An Install
|
|
18
18
|
# step that modifies the tree in a throwaway worktree corrupts it for everyone
|
|
19
19
|
# (npm@11 pruning cross-platform @esbuild optional deps out of a lockfile broke
|
|
20
20
|
# CI and the Docker build), so a dirty tree after it is a refusal.
|
|
21
21
|
set -eu
|
|
22
22
|
|
|
23
23
|
# Directly below `set -eu`, not below a locale pin: this script has none, and
|
|
24
|
-
# locale-pin
|
|
25
|
-
# its generated runner needs one is
|
|
24
|
+
# the locale-pin test deliberately leaves it off its PINNED list (whether
|
|
25
|
+
# its generated runner needs one is not settled here). The siblings that DO
|
|
26
26
|
# carry a pin put this line under it instead, because that file's PROLOGUE
|
|
27
27
|
# regex admits only comments, blanks and `set -[eux]+` above the pin. Here
|
|
28
28
|
# there is no pin to sit under, so the only constraint left is the real one:
|
|
29
|
-
# above the first git call.
|
|
29
|
+
# above the first git call.
|
|
30
30
|
#
|
|
31
31
|
# Both halves are measured on this script, and each defeats a different guard.
|
|
32
32
|
#
|
|
@@ -43,7 +43,7 @@ set -eu
|
|
|
43
43
|
# "$wt" status --porcelain -uall`, the one thing standing between a wrong
|
|
44
44
|
# Install step and a worktree corrupted for everyone — reads the AMBIENT tree
|
|
45
45
|
# against $wt's index. Measured (against the lockfile-only form this check
|
|
46
|
-
# had before
|
|
46
|
+
# had before the Recipe cache) with an install that really does rewrite a tracked file
|
|
47
47
|
# in the fresh worktree: reported clean, rc 0, claim handed out, where the
|
|
48
48
|
# unpoisoned run refuses at exit 2.
|
|
49
49
|
unset GIT_DIR GIT_WORK_TREE
|
|
@@ -51,7 +51,7 @@ unset GIT_DIR GIT_WORK_TREE
|
|
|
51
51
|
NAME=claim-ticket
|
|
52
52
|
die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 2; }
|
|
53
53
|
|
|
54
|
-
# The escaping helpers
|
|
54
|
+
# The escaping helpers. json.sh's header holds the sourcing contract and
|
|
55
55
|
# the measurements behind it. This script uses exit 2 for every refusal and has
|
|
56
56
|
# no exit 1, so a bare 1 out of it is a code its caller has no reading for. The
|
|
57
57
|
# guard sits ahead of every mutation, so a missing library refuses before a
|
|
@@ -62,7 +62,7 @@ json_lib="$(dirname "$0")/json.sh"
|
|
|
62
62
|
# shellcheck source=json.sh
|
|
63
63
|
. "$json_lib" || die "$json_lib failed to load"
|
|
64
64
|
|
|
65
|
-
# The worktree readers
|
|
65
|
+
# The worktree readers. worktree.sh's header holds the sourcing
|
|
66
66
|
# contract; the `[ -r ]` ahead of the `.` is load-bearing there, not decoration.
|
|
67
67
|
# Sourced for `gone()` alone — this script reads no listing.
|
|
68
68
|
wt_lib="$(dirname "$0")/worktree.sh"
|
|
@@ -75,8 +75,8 @@ wt_lib="$(dirname "$0")/worktree.sh"
|
|
|
75
75
|
issue=$1
|
|
76
76
|
slug=$2
|
|
77
77
|
type=$3
|
|
78
|
-
# Exact match, and nothing else tolerated in the slot
|
|
79
|
-
#
|
|
78
|
+
# Exact match, and nothing else tolerated in the slot: an unknown flag is refused
|
|
79
|
+
# rather than demoted to a dry run. Measured on the unguarded script: `5 slug fix`
|
|
80
80
|
# and `5 slug fix --aply` were byte-identical on stdout AND stderr at exit 0,
|
|
81
81
|
# so nothing anywhere said the flag was not understood; and the arity check
|
|
82
82
|
# above was a lower bound alone, so `5 slug fix --apply extra --whatever`
|
|
@@ -97,7 +97,7 @@ runner="$wt/agent-test"
|
|
|
97
97
|
|
|
98
98
|
# A repository probe, and deliberately no more. The git-dir identity invariant
|
|
99
99
|
# release-ticket.sh and no-undo-audit.sh check (the git dir answering for $wt
|
|
100
|
-
# must belong to $wt) is not owed here
|
|
100
|
+
# must belong to $wt) is not owed here: this script never asks git
|
|
101
101
|
# anything through a $wt it did not just create. The pair below establishes the
|
|
102
102
|
# path is absent, `git worktree add` then writes the .git and its admin dir
|
|
103
103
|
# itself, and the one later `git -C "$wt"` call (the tree-mutation check) runs
|
|
@@ -124,8 +124,8 @@ git rev-parse --git-dir >/dev/null 2>&1 || die "not inside a git repository"
|
|
|
124
124
|
# stderr — in the DEFAULT dry run, where `git worktree add` never runs to refuse
|
|
125
125
|
# it downstream, that is exit 0 and a receipt byte-identical to a free path's.
|
|
126
126
|
# `gone()` is the predicate that keeps established-absent and could-not-measure
|
|
127
|
-
# apart (worktree.sh
|
|
128
|
-
# refusal below is the existing helper, not a new EACCES-aware stat.
|
|
127
|
+
# apart (worktree.sh holds the one definition), so the
|
|
128
|
+
# refusal below is the existing helper, not a new EACCES-aware stat.
|
|
129
129
|
#
|
|
130
130
|
# ABSOLUTE, and this is the term to leave alone. `gone()` walks up to the
|
|
131
131
|
# nearest existing ancestor and asks whether IT is searchable; git hands every
|
|
@@ -144,7 +144,7 @@ git rev-parse --git-dir >/dev/null 2>&1 || die "not inside a git repository"
|
|
|
144
144
|
# to. And the wording of the first stays hedged — a dangling link here has two
|
|
145
145
|
# provenances with opposite claim states (rc-0 residue, and a release halted
|
|
146
146
|
# mid-flight with the branch and the label still live), and only the hedge is
|
|
147
|
-
# true of both.
|
|
147
|
+
# true of both.
|
|
148
148
|
if [ -e "$wt" ] || [ -L "$wt" ]; then
|
|
149
149
|
die "$wt already exists — ticket may already be claimed"
|
|
150
150
|
elif ! gone "$PWD/$wt"; then
|
|
@@ -153,37 +153,37 @@ fi
|
|
|
153
153
|
git rev-parse --verify --quiet "refs/heads/$branch" >/dev/null && die "branch $branch already exists"
|
|
154
154
|
|
|
155
155
|
# The worktree is built FROM origin/main, so it must resolve before anything is
|
|
156
|
-
# claimed. The lockfile probe
|
|
156
|
+
# claimed. The lockfile probe the Recipe cache replaced read origin/main
|
|
157
157
|
# and refused on its absence as a side effect; reading the Recipe cache reads
|
|
158
158
|
# no ref at all, so the precondition is asked for directly — unasked, the
|
|
159
159
|
# DEFAULT dry run would report a ticket claimable that `git worktree add` then
|
|
160
160
|
# refuses under --apply, after the in-progress label is already on the issue.
|
|
161
161
|
# No `--quiet`: git's own reason for not resolving it reaches the terminal
|
|
162
|
-
# beside this refusal
|
|
162
|
+
# beside this refusal.
|
|
163
163
|
git rev-parse --verify "origin/main^{commit}" >/dev/null \
|
|
164
164
|
|| die "origin/main does not resolve to a commit — nothing to build the worktree from"
|
|
165
165
|
|
|
166
166
|
# The Recipe: its Install step and Test entrypoint, READ from the repository's
|
|
167
167
|
# Recipe cache by derive-testcmd.sh — the one reader, reused rather than
|
|
168
168
|
# reimplemented, so the claim and the review snapshot cannot disagree about
|
|
169
|
-
# the cache's shape or what makes it usable
|
|
169
|
+
# the cache's shape or what makes it usable. Nothing here infers either
|
|
170
170
|
# command: an absent, unproven or unrunnable cache is derive-testcmd.sh's own
|
|
171
171
|
# refusal, passed through in its own words, which name the step that derives
|
|
172
|
-
# the Recipe
|
|
172
|
+
# the Recipe.
|
|
173
173
|
#
|
|
174
174
|
# `2>&1` so the reason travels: the child refuses on its STDERR and `$(...)`
|
|
175
175
|
# captures stdout only, so without the merge `die` fires with an empty
|
|
176
176
|
# argument and prints the bare line `claim-ticket: `. It is safe on the success
|
|
177
177
|
# path only because derive-testcmd.sh writes nothing to stderr when it
|
|
178
|
-
# succeeds, even under an interpreter made deliberately chatty
|
|
179
|
-
# cross-file invariant, so derive-testcmd.
|
|
178
|
+
# succeeds, even under an interpreter made deliberately chatty — a
|
|
179
|
+
# cross-file invariant, so derive-testcmd.sh's own tests pin it where the behaviour
|
|
180
180
|
# lives. The sibling is found beside this script (`dirname -- "$0"`), never on
|
|
181
181
|
# PATH, for the reason json.sh and worktree.sh are.
|
|
182
182
|
script_dir=$(dirname -- "$0")
|
|
183
183
|
# Held in one variable, not repeated as a literal at each die below — the two
|
|
184
184
|
# copies could drift apart, and derive-testcmd.sh already keeps its own
|
|
185
185
|
# version the same way (`$derive`).
|
|
186
|
-
rederive="the Recipe cache is invalid; run the Recipe derivation step (run-team phase 0, before the first claim
|
|
186
|
+
rederive="the Recipe cache is invalid; run the Recipe derivation step (run-team phase 0, before the first claim) to re-derive it"
|
|
187
187
|
install=$("$script_dir/derive-testcmd.sh" . install 2>&1) || die "$install"
|
|
188
188
|
echo " Install step → $install" >&2
|
|
189
189
|
testcmd=$("$script_dir/derive-testcmd.sh" . test 2>&1) || die "$testcmd"
|
|
@@ -193,8 +193,8 @@ echo " test entrypoint → $testcmd" >&2
|
|
|
193
193
|
# `sh -c`, so a compound one (`cd sub && make test`) keeps its meaning, with the
|
|
194
194
|
# runner's own arguments appended as "$@". It reaches the runner's source
|
|
195
195
|
# single-quoted — each embedded `'` closed, escaped and reopened — so nothing
|
|
196
|
-
# in it expands at write time. `LC_ALL=C` so sed reads the command as bytes
|
|
197
|
-
#
|
|
196
|
+
# in it expands at write time. `LC_ALL=C` so sed reads the command as bytes.
|
|
197
|
+
# Derived here, ahead of every mutation, so a failure refuses before
|
|
198
198
|
# the label.
|
|
199
199
|
quoted=$(printf '%s\n' "$testcmd" | LC_ALL=C sed "s/'/'\\\\''/g") \
|
|
200
200
|
|| die "could not quote the Test entrypoint for the runner"
|
|
@@ -204,14 +204,14 @@ ollama=$((22000 + issue))
|
|
|
204
204
|
echo " ports derive from the issue number: postgres=$pg ollama=$ollama" >&2
|
|
205
205
|
|
|
206
206
|
# Ports above are only ever exported into a FRESH runner this script writes
|
|
207
|
-
# (below): a tracked repo-local agent-test is left byte-identical
|
|
207
|
+
# (below): a tracked repo-local agent-test is left byte-identical, so
|
|
208
208
|
# it never carries them. Starts true and flips to false in that branch, so
|
|
209
209
|
# the receipt can report which happened instead of asserting exports that
|
|
210
210
|
# never reached the runner.
|
|
211
211
|
runner_ports_applied=true
|
|
212
212
|
|
|
213
213
|
# The stamp the runner carries. The runner is written once at claim time and
|
|
214
|
-
# never rewritten
|
|
214
|
+
# never rewritten, so an old worktree can be sitting on a runner a later
|
|
215
215
|
# template fix never reached. This stamp does not detect or fix that — nothing
|
|
216
216
|
# reads it, nothing refuses on a mismatch — it only makes staleness legible:
|
|
217
217
|
# diff the stamp against a fresh `cksum` of this script to see if they match.
|
|
@@ -266,7 +266,7 @@ else
|
|
|
266
266
|
# origin/main, so `@{u}` RESOLVES — to main. Every "did my push land?" check a
|
|
267
267
|
# member might reach for (`git rev-parse HEAD @{u}`, `git status -sb`) then
|
|
268
268
|
# answers a question about main and reads healthy no matter what the push did.
|
|
269
|
-
# That is
|
|
269
|
+
# That is the sharp half, measured on two live worktrees. Under
|
|
270
270
|
# push.default=upstream the same config is a live hazard rather than a
|
|
271
271
|
# misleading guard: a bare `git push` would push $branch's commits onto
|
|
272
272
|
# origin/main. (Under the default push.default=simple it refuses loudly, exit
|
|
@@ -282,7 +282,7 @@ else
|
|
|
282
282
|
# push, `git push --force-with-lease -u origin HEAD` (skills/next-ticket/SKILL.md
|
|
283
283
|
# step 7; its no-lease fallback carries `-u` too), and only then can be `[gone]`.
|
|
284
284
|
#
|
|
285
|
-
# `--no-track` is also why no branch delete uses `-d
|
|
285
|
+
# `--no-track` is also why no branch delete uses `-d`: `-d` measures an
|
|
286
286
|
# upstream-less branch against local HEAD, refusing a pristine claim behind
|
|
287
287
|
# origin/main. release-ticket.sh's is `git update-ref -d` on a tip read once.
|
|
288
288
|
printf '$ git worktree add --no-track %s -b %s origin/main\n' "$wt" "$branch" >&2
|
|
@@ -292,7 +292,7 @@ else
|
|
|
292
292
|
# Through `sh -c`, as the runner runs the Test entrypoint: the Install step
|
|
293
293
|
# is a shell command out of the cache, not an argv to split. 126 and 127 are
|
|
294
294
|
# the shell's own "cannot execute" and "not found" — the Recipe failed to
|
|
295
|
-
# RUN, which is what invalidates a cache
|
|
295
|
+
# RUN, which is what invalidates a cache — so they are named as
|
|
296
296
|
# that; any other non-zero is the install itself failing, reported as such.
|
|
297
297
|
irc=0
|
|
298
298
|
(cd "$wt" && sh -c "$install" >/dev/null 2>&1) || irc=$?
|
|
@@ -305,7 +305,7 @@ else
|
|
|
305
305
|
# The Install step must leave the tree exactly as `worktree add` checked it
|
|
306
306
|
# out: the `installClean` proof the cache records, re-asserted on every
|
|
307
307
|
# claim, over the WHOLE tree rather than a list of lockfile names — fleet-ctl
|
|
308
|
-
# keeps no table of which files an install may touch
|
|
308
|
+
# keeps no table of which files an install may touch. Non-empty
|
|
309
309
|
# means the Recipe no longer holds, and the worktree is now corrupt for
|
|
310
310
|
# everyone. Check git's exit status too: a failed status prints nothing,
|
|
311
311
|
# which is byte-identical to "clean" and would let this guard pass without
|
|
@@ -318,14 +318,14 @@ else
|
|
|
318
318
|
# which this check would read as an untouched tree it never actually
|
|
319
319
|
# looked at. `-f`: `git worktree add` writes $wt's `.git` as a regular file,
|
|
320
320
|
# so no healthy run trips this; reference shape and same reason as
|
|
321
|
-
# release-ticket.sh's own linkage guard
|
|
321
|
+
# release-ticket.sh's own linkage guard. `-x "$wt"` for the reason
|
|
322
322
|
# reap.sh and worktree-audit.sh give their own copy: `-f` is equally false
|
|
323
323
|
# for a `.git` that is absent and for one this process may not stat, and an
|
|
324
324
|
# unsearchable $wt must not be reported as an absence nothing established.
|
|
325
325
|
# Left ungated it ate the case before the `git -C` below could reach it —
|
|
326
326
|
# measured: `.git` still sitting there while the run blamed its deletion.
|
|
327
327
|
# Gated, git answers with its own denial through the elif, which is what
|
|
328
|
-
# release-ticket.
|
|
328
|
+
# release-ticket.sh's tests already pin as the wording to prefer over one this
|
|
329
329
|
# script invents.
|
|
330
330
|
if [ -x "$wt" ] && [ ! -f "$wt/.git" ]; then
|
|
331
331
|
die "$wt has no .git file — cannot verify the Install step left the tree clean"
|
|
@@ -340,7 +340,7 @@ else
|
|
|
340
340
|
# reaches this terminal on its own, which is the "its own denial" the
|
|
341
341
|
# paragraph above means; the die names the failure, not the reason.
|
|
342
342
|
#
|
|
343
|
-
# `-uall`:
|
|
343
|
+
# `-uall`: see reap.sh's branch sweep for the full explanation —
|
|
344
344
|
# the untracked mode is CONFIG: an install that CREATES a file the tree does
|
|
345
345
|
# not track or ignore (a lockfile it was never given) dirties the tree as
|
|
346
346
|
# surely as one that rewrites a tracked file, and under
|
|
@@ -358,13 +358,13 @@ else
|
|
|
358
358
|
|
|
359
359
|
# A runner is already there: the repo tracks its own `agent-test`, and `git
|
|
360
360
|
# worktree add` checked it out with everything else — a repo-local runner,
|
|
361
|
-
# the home
|
|
361
|
+
# the home for any convenience beyond "exec the Test entrypoint"
|
|
362
362
|
# (this repository's own test-argument shim lives in one). Writing
|
|
363
363
|
# over it is what must not happen: the file is TRACKED, so the write leaves a
|
|
364
364
|
# modified tracked path, and `reap.sh` calls `git worktree remove` without
|
|
365
365
|
# `--force` (its own comment: "refuses on modified and untracked files").
|
|
366
366
|
# Every release of every claim would then strand on a file this script wrote
|
|
367
|
-
# itself
|
|
367
|
+
# itself. On this path $runner is always the fresh worktree's own
|
|
368
368
|
# `agent-test`, so existence IS trackedness: nothing else could have put a
|
|
369
369
|
# file there between `worktree add` and here.
|
|
370
370
|
if [ -e "$runner" ]; then
|
|
@@ -394,7 +394,7 @@ fi
|
|
|
394
394
|
# `$type/$issue-$slug`, `$wt` is `.worktrees/$issue-$slug`, `$runner` is
|
|
395
395
|
# `$wt/agent-test`. A quote in either argument emitted a payload no parser
|
|
396
396
|
# accepts, at exit 0 and — under `--apply` — after the worktree and the label
|
|
397
|
-
# already existed
|
|
397
|
+
# already existed. `$install` is the Recipe cache's own string and can
|
|
398
398
|
# carry any byte a shell command can, a quote included; jstr is what keeps it a
|
|
399
399
|
# JSON string. The numeric fields stay unwrapped: `$issue` is a JSON
|
|
400
400
|
# number by the guard above, and the ports are arithmetic on it.
|
package/scripts/fleet-tick.mjs
CHANGED
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
// refresh, never a refusal: the depth only ever bounds PULLs
|
|
37
37
|
// downward.
|
|
38
38
|
// gh The open PRs, by label and by whether they close an issue — the
|
|
39
|
-
// merge queue, and which PRs are owed a review.
|
|
39
|
+
// merge queue, and which PRs are owed a review. Also, for each ticket
|
|
40
|
+
// holding the implementer row on a tier mismatch, whether its issue
|
|
41
|
+
// is CLOSED (`gh issue view`, #2485): a closed ticket's mismatch
|
|
42
|
+
// holds nothing.
|
|
40
43
|
// main The main checkout against the run-start baseline
|
|
41
44
|
// `.fleet/main-checkout.sha`, through main-checkout.mjs (#2210).
|
|
42
45
|
// Anything but `clean` — dirty, unknown, no baseline — prints one
|
|
@@ -434,7 +437,7 @@ export function unlabelledFinishers(ledger, unqueued) {
|
|
|
434
437
|
.map((u) => ({ pr: u.pr, labelled: u.attempts.filter((a) => a.outcome === "labelled").map((a) => a.name) }));
|
|
435
438
|
}
|
|
436
439
|
|
|
437
|
-
export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
440
|
+
export function deriveRun({ rows, dispatched, drain }, prs, closed = new Set()) {
|
|
438
441
|
// One entry per member name across `## Dispatched` and every row. A member
|
|
439
442
|
// settled ANYWHERE is settled: `settle` is the only writer of an outcome, and
|
|
440
443
|
// a bare copy beside it is what a whole-line `row` rewrite leaves behind.
|
|
@@ -656,8 +659,13 @@ export function deriveRun({ rows, dispatched, drain }, prs) {
|
|
|
656
659
|
// say whether one exists; a settled member whose transcript was never
|
|
657
660
|
// written gets `tier-unverifiable=` from it, which clears the hold here.
|
|
658
661
|
const newest = impls.filter((m, i) => !impls.some((o, j) => j > i && o.number === m.number));
|
|
662
|
+
// A mismatch on a ticket whose issue is CLOSED holds nothing (#2485): there
|
|
663
|
+
// is nothing left for `impl-<N>-b` to replace, and a retired definition can
|
|
664
|
+
// never re-check. `closed` is the ticket numbers the caller has probed; the
|
|
665
|
+
// pure fold cannot probe, so none is the default and every mismatch holds.
|
|
666
|
+
// A still-open ticket keeps its hold.
|
|
659
667
|
const mismatched = (m) => m.outcome === "tier-mismatch" || verdicts.mismatch.has(m.name);
|
|
660
|
-
const tierMismatch = newest.filter(mismatched).map((m) => m.name);
|
|
668
|
+
const tierMismatch = newest.filter((m) => mismatched(m) && !closed.has(m.number)).map((m) => m.name);
|
|
661
669
|
const cleared = (m) => verdicts.ok.has(m.name) || verdicts.unverifiable.has(m.name);
|
|
662
670
|
const tierUnchecked = newest.filter((m) => !mismatched(m) && !cleared(m)).map((m) => m.name);
|
|
663
671
|
const isQueued = (p) => p.labels.some((l) => l && l.name === "ready-to-merge");
|
|
@@ -1013,6 +1021,32 @@ function liftedPremise(excluded, entries, prs) {
|
|
|
1013
1021
|
return null;
|
|
1014
1022
|
}
|
|
1015
1023
|
|
|
1024
|
+
// The tickets, of those holding the implementer row on a tier mismatch, whose
|
|
1025
|
+
// issue is CLOSED (#2485): the one live read deriveRun needs to lift a hold
|
|
1026
|
+
// whose replacement has nothing left to replace. One `gh issue view` per
|
|
1027
|
+
// mismatched ticket, and none when nothing is mismatched. A probe that cannot
|
|
1028
|
+
// answer — a nonzero exit, or a reply carrying no issue state — is disclosed
|
|
1029
|
+
// and the hold stands.
|
|
1030
|
+
function closedTickets(mismatched) {
|
|
1031
|
+
const closed = new Set();
|
|
1032
|
+
for (const { number } of mismatched.map(parseMember)) {
|
|
1033
|
+
const r = spawnSync("gh", ["issue", "view", String(number), "--json", "state"], { encoding: "utf8", env: gitEnv({ GH_REPO: "" }) });
|
|
1034
|
+
if (r.error || r.status !== 0) {
|
|
1035
|
+
console.error(`${NAME}: ${failure(r, `gh issue view ${number}`)} — tier mismatch on #${number} unconfirmed closed, hold stands`);
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
let st = null;
|
|
1039
|
+
try { st = JSON.parse(r.stdout).state; } catch { /* no state: disclosed below */ }
|
|
1040
|
+
if (st === "CLOSED") closed.add(number);
|
|
1041
|
+
else if (typeof st !== "string") {
|
|
1042
|
+
// Exit 0 with a body that is not an issue (an HTML error page, a proxy's
|
|
1043
|
+
// text, JSON with no state) is as unanswered as a nonzero exit.
|
|
1044
|
+
console.error(`${NAME}: gh issue view ${number} printed no state — tier mismatch on #${number} unconfirmed closed, hold stands`);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return closed;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1016
1050
|
// shortlist.mjs, run by the tick itself (§ 6 §3). Its per-ticket stderr is
|
|
1017
1051
|
// captured and dropped rather than billed to the controller's context; only a
|
|
1018
1052
|
// failure's last line rides along.
|
|
@@ -1067,7 +1101,10 @@ function main() {
|
|
|
1067
1101
|
const prs = openPrs();
|
|
1068
1102
|
let run;
|
|
1069
1103
|
try {
|
|
1070
|
-
|
|
1104
|
+
const ledger = readLedger();
|
|
1105
|
+
run = deriveRun(ledger, prs);
|
|
1106
|
+
const closed = closedTickets(run.tierMismatch);
|
|
1107
|
+
if (closed.size) run = deriveRun(ledger, prs, closed);
|
|
1071
1108
|
} catch (e) {
|
|
1072
1109
|
if (e instanceof LedgerError) die(e.message);
|
|
1073
1110
|
throw e;
|
|
@@ -365,7 +365,7 @@ const pr = (number, labels = [], closes = [number + 1000], headRefOid = HEAD_B)
|
|
|
365
365
|
closingIssuesReferences: closes.map((n) => ({ number: n })),
|
|
366
366
|
headRefOid,
|
|
367
367
|
});
|
|
368
|
-
const run = (ledger, prs = []) => deriveRun({ rows: [], dispatched: [], drain: null, ...ledger }, prs);
|
|
368
|
+
const run = (ledger, prs = [], closed) => deriveRun({ rows: [], dispatched: [], drain: null, ...ledger }, prs, closed);
|
|
369
369
|
|
|
370
370
|
test("deriveRun: live implementers are the unsettled impl- tokens — the #1692 shape, read rather than recited", () => {
|
|
371
371
|
// #1692 was two sources disagreeing about the same fleet. There is one
|
|
@@ -951,6 +951,21 @@ test("deriveRun: drain and tier mismatches come off the file", () => {
|
|
|
951
951
|
assert.deepEqual(r.tierMismatch, ["impl-7"], "#8's replacement is the fix");
|
|
952
952
|
});
|
|
953
953
|
|
|
954
|
+
// #2485: a mismatch on a ticket whose issue is CLOSED holds nothing.
|
|
955
|
+
test("deriveRun: a tier mismatch on a closed ticket stops holding; one on an open ticket still does", () => {
|
|
956
|
+
const ledger = { rows: ["#7 impl-7=tier-mismatch", "#8 impl-8 · tier-mismatch=impl-8:fleet-implementer"], dispatched: ["impl-7=tier-mismatch", "impl-8"] };
|
|
957
|
+
assert.deepEqual(run(ledger).tierMismatch, ["impl-7", "impl-8"], "no probe answer: every mismatch holds");
|
|
958
|
+
const r = run(ledger, [], new Set([7]));
|
|
959
|
+
assert.deepEqual(r.tierMismatch, ["impl-8"], "#7 is closed, #8 is not");
|
|
960
|
+
assert.deepEqual(r.tierUnchecked, [], "a lifted mismatch does not fall through to unchecked");
|
|
961
|
+
assert.deepEqual(run(ledger, [], new Set([7, 8])).tierMismatch, []);
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
test("deriveRun: a closed ticket lifts only its own mismatch, not a replacement's on another ticket", () => {
|
|
965
|
+
const r = run({ rows: ["#7 impl-7=tier-mismatch · impl-7-b=tier-mismatch", "#9 impl-9=tier-mismatch"] }, [], new Set([9]));
|
|
966
|
+
assert.deepEqual(r.tierMismatch, ["impl-7-b"]);
|
|
967
|
+
});
|
|
968
|
+
|
|
954
969
|
test("deriveRun: tier mismatch holds while the LATEST replacement is also tier-mismatch", () => {
|
|
955
970
|
const r = run({
|
|
956
971
|
rows: ["#8 impl-8=tier-mismatch · impl-8-b=tier-mismatch"],
|
|
@@ -1172,6 +1187,7 @@ case "$1 $2" in
|
|
|
1172
1187
|
"issue view")
|
|
1173
1188
|
echo "$3" >> "$ISSUE_VIEW_LOG"
|
|
1174
1189
|
[ -n "$ISSUE_VIEW_FAIL" ] && { echo "gh: issue view failed" >&2; exit 1; }
|
|
1190
|
+
[ -n "$ISSUE_VIEW_BODY" ] && { printf '%s\n' "$ISSUE_VIEW_BODY"; exit 0; }
|
|
1175
1191
|
# Real gh answers for the repository an inherited GIT_DIR or GH_REPO names;
|
|
1176
1192
|
# this one answers CLOSED for every issue there, so a probe that forgot to
|
|
1177
1193
|
# scrub them lifts an exclusion the case's own repository still holds.
|
|
@@ -1519,6 +1535,78 @@ test("CLI: a behind-issue exclusion already reflected in the current file names
|
|
|
1519
1535
|
assert.match(r.stdout, /^implementers 0\/3 → PULL #1 #2 #50 /m);
|
|
1520
1536
|
});
|
|
1521
1537
|
|
|
1538
|
+
// #2485: the mismatch hold is lifted by the mismatched ticket's own issue
|
|
1539
|
+
// being CLOSED, probed live; an open one, or a probe that cannot answer, holds.
|
|
1540
|
+
test("CLI: a tier mismatch on a CLOSED ticket no longer holds the implementer row", () => {
|
|
1541
|
+
const mismatch = { rows: ["#7 impl-7=tier-mismatch"], dispatched: ["impl-7=tier-mismatch"] };
|
|
1542
|
+
const base = { shortlist: shortlistText([1, 2, 3]) };
|
|
1543
|
+
const closed = runCli([], { ...base, ledger: mismatch, issueStates: { 7: "CLOSED" } });
|
|
1544
|
+
assert.equal(closed.status, 0, closed.stderr);
|
|
1545
|
+
assert.match(closed.stdout, /^implementers 0\/2 → PULL #1 #2 /m);
|
|
1546
|
+
assert.doesNotMatch(closed.stdout, /tier mismatch/);
|
|
1547
|
+
assert.deepEqual(closed.issueViews, ["7"]);
|
|
1548
|
+
const open = runCli([], { ...base, ledger: mismatch, issueStates: { 7: "OPEN" } });
|
|
1549
|
+
assert.match(open.stdout, /^implementers 0\/2 → HOLD \(tier mismatch impl-7\)/m);
|
|
1550
|
+
const none = runCli([], { ...base, ledger: { rows: ["#7 impl-7 · tier-ok=impl-7:fleet-implementer"], dispatched: ["impl-7"] } });
|
|
1551
|
+
assert.deepEqual(none.issueViews, [], "nothing mismatched: no probe");
|
|
1552
|
+
});
|
|
1553
|
+
|
|
1554
|
+
test("CLI: a failed probe of a mismatched ticket is disclosed and the hold stands", () => {
|
|
1555
|
+
const r = runCli([], {
|
|
1556
|
+
shortlist: shortlistText([1, 2, 3]), ledger: { rows: ["#7 impl-7=tier-mismatch"], dispatched: ["impl-7=tier-mismatch"] },
|
|
1557
|
+
issueStates: { 7: "CLOSED" }, env: { ISSUE_VIEW_FAIL: "1" },
|
|
1558
|
+
});
|
|
1559
|
+
assert.equal(r.status, 0, r.stderr);
|
|
1560
|
+
assert.match(r.stdout, /^implementers 0\/2 → HOLD \(tier mismatch impl-7\)/m);
|
|
1561
|
+
assert.match(r.stderr, /fleet-tick: gh issue view 7 exited 1: gh: issue view failed — tier mismatch on #7 unconfirmed closed, hold stands/);
|
|
1562
|
+
});
|
|
1563
|
+
|
|
1564
|
+
test("CLI: a probe answering exit 0 with no issue state is disclosed and the hold stands", () => {
|
|
1565
|
+
for (const body of ["<html>rate limited</html>", "{}", "null"]) {
|
|
1566
|
+
const r = runCli([], {
|
|
1567
|
+
shortlist: shortlistText([1, 2, 3]), ledger: { rows: ["#7 impl-7=tier-mismatch"], dispatched: ["impl-7=tier-mismatch"] },
|
|
1568
|
+
issueStates: { 7: "CLOSED" }, env: { ISSUE_VIEW_BODY: body },
|
|
1569
|
+
});
|
|
1570
|
+
assert.equal(r.status, 0, r.stderr);
|
|
1571
|
+
assert.match(r.stdout, /^implementers 0\/2 → HOLD \(tier mismatch impl-7\)/m, body);
|
|
1572
|
+
assert.match(r.stderr, /fleet-tick: gh issue view 7 printed no state — tier mismatch on #7 unconfirmed closed, hold stands/, body);
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
|
|
1576
|
+
// Only the exact string CLOSED lifts the hold: another casing, a prefix, or a
|
|
1577
|
+
// state an issue never has (MERGED) is a state, but not a closed one.
|
|
1578
|
+
test("CLI: a state other than exactly CLOSED leaves the mismatch hold standing", () => {
|
|
1579
|
+
for (const state of ["closed", "REOPENED", "MERGED", "CLOSED_AS_DUPLICATE"]) {
|
|
1580
|
+
const r = runCli([], {
|
|
1581
|
+
shortlist: shortlistText([1, 2, 3]), ledger: { rows: ["#7 impl-7=tier-mismatch"], dispatched: ["impl-7=tier-mismatch"] },
|
|
1582
|
+
issueStates: { 7: "CLOSED" }, env: { ISSUE_VIEW_BODY: JSON.stringify({ state }) },
|
|
1583
|
+
});
|
|
1584
|
+
assert.equal(r.status, 0, r.stderr);
|
|
1585
|
+
assert.match(r.stdout, /^implementers 0\/2 → HOLD \(tier mismatch impl-7\)/m, state);
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
|
|
1589
|
+
// Every mismatched ticket is probed on its own: one CLOSED does not lift, and
|
|
1590
|
+
// one failed or OPEN does not hold back, another.
|
|
1591
|
+
test("CLI: each mismatched ticket is probed and released or held on its own issue", () => {
|
|
1592
|
+
const two = { rows: ["#7 impl-7=tier-mismatch", "#8 impl-8=tier-mismatch"], dispatched: ["impl-7=tier-mismatch", "impl-8=tier-mismatch"] };
|
|
1593
|
+
const base = { shortlist: shortlistText([1, 2, 3]), ledger: two };
|
|
1594
|
+
const mixed = runCli([], { ...base, issueStates: { 7: "CLOSED", 8: "OPEN" } });
|
|
1595
|
+
assert.equal(mixed.status, 0, mixed.stderr);
|
|
1596
|
+
assert.deepEqual(mixed.issueViews, ["7", "8"]);
|
|
1597
|
+
assert.match(mixed.stdout, /HOLD \(tier mismatch impl-8\)/);
|
|
1598
|
+
assert.doesNotMatch(mixed.stdout, /impl-7/);
|
|
1599
|
+
const reversed = runCli([], { ...base, issueStates: { 7: "OPEN", 8: "CLOSED" } });
|
|
1600
|
+
assert.deepEqual(reversed.issueViews, ["7", "8"]);
|
|
1601
|
+
assert.match(reversed.stdout, /HOLD \(tier mismatch impl-7\)/);
|
|
1602
|
+
assert.doesNotMatch(reversed.stdout, /impl-8/);
|
|
1603
|
+
const both = runCli([], { ...base, issueStates: { 7: "CLOSED", 8: "CLOSED" } });
|
|
1604
|
+
assert.deepEqual(both.issueViews, ["7", "8"]);
|
|
1605
|
+
assert.doesNotMatch(both.stdout, /tier mismatch/);
|
|
1606
|
+
const failed = runCli([], { ...base, issueStates: { 7: "CLOSED" }, env: { ISSUE_VIEW_FAIL: "1" } });
|
|
1607
|
+
assert.deepEqual(failed.issueViews, ["7", "8"], "a failed probe of #7 does not stop the probe of #8");
|
|
1608
|
+
});
|
|
1609
|
+
|
|
1522
1610
|
test("CLI: a failed gh issue view probe is disclosed, not silently swallowed", () => {
|
|
1523
1611
|
const full = { shortlist: shortlistText([1, 2, 3]), refresh: shortlistText([1, 2, 3, 50]) };
|
|
1524
1612
|
const r = runCli([], {
|
|
@@ -1599,6 +1687,19 @@ test("CLI: an ambient GIT_DIR naming another repository cannot move the shortlis
|
|
|
1599
1687
|
assert.match(r.stdout, /^implementers 0\/2 → PULL #7 #8 /m);
|
|
1600
1688
|
});
|
|
1601
1689
|
|
|
1690
|
+
test("CLI: an inherited GIT_DIR cannot retarget the tier-mismatch closed-ticket probe", () => {
|
|
1691
|
+
const decoy = realpathSync(mkdtempSync(join(tmpdir(), "fleet-tick-decoy-tier-")));
|
|
1692
|
+
spawnBounded("git", ["init", "-q", decoy]);
|
|
1693
|
+
const r = runCli([], {
|
|
1694
|
+
shortlist: shortlistText([1, 2, 3]), ledger: { rows: ["#7 impl-7=tier-mismatch"], dispatched: ["impl-7=tier-mismatch"] },
|
|
1695
|
+
issueStates: { 7: "OPEN" }, env: { GIT_DIR: join(decoy, ".git"), GH_REPO: "someone/else" },
|
|
1696
|
+
});
|
|
1697
|
+
rmSync(decoy, { recursive: true, force: true });
|
|
1698
|
+
assert.equal(r.status, 0, r.stderr);
|
|
1699
|
+
assert.deepEqual(r.issueViews, ["7"], "the probe must still run");
|
|
1700
|
+
assert.match(r.stdout, /^implementers 0\/2 → HOLD \(tier mismatch impl-7\)/m, "#7 is OPEN in the case's own repository - the hold stands");
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1602
1703
|
test("CLI: an inherited GIT_DIR cannot retarget the behind-issue premise probe", () => {
|
|
1603
1704
|
const decoy = realpathSync(mkdtempSync(join(tmpdir(), "fleet-tick-decoy-gh-")));
|
|
1604
1705
|
spawnBounded("git", ["init", "-q", decoy]);
|
|
@@ -41,29 +41,29 @@ set -eu
|
|
|
41
41
|
# nothing at all, measured — and `grep` silently drops the line holding it.
|
|
42
42
|
# Such a byte reaches us from a fetched tree even where the local filesystem
|
|
43
43
|
# refuses to hold the name, and inside `$(...)` a `tr` failure empties the cause
|
|
44
|
-
# out of the diagnostic without a trace.
|
|
45
|
-
#
|
|
46
|
-
# answer.
|
|
44
|
+
# out of the diagnostic without a trace. The cost of leaving this ambient in
|
|
45
|
+
# no-undo-audit.sh was measured: a truncated list reported as a clean,
|
|
46
|
+
# confident answer.
|
|
47
47
|
#
|
|
48
48
|
# Safe as a global: nothing in this script sorts, folds case, or holds a POSIX
|
|
49
49
|
# class. It does use ONE collation range — `*[!0-9]*`, the issue-number guard
|
|
50
50
|
# below — and a range IS locale-sensitive by spec, its members drawn from the
|
|
51
|
-
# collation sequence rather than the codepoint order. Measured inert here
|
|
52
|
-
#
|
|
51
|
+
# collation sequence rather than the codepoint order. Measured inert here:
|
|
52
|
+
# `0-9` matches the ASCII digits and nothing else under `C`,
|
|
53
53
|
# `en_US.UTF-8`, `de_DE.UTF-8` and `tr_TR.UTF-8` alike, with superscript `²`,
|
|
54
54
|
# Arabic-Indic digits and `½` excluded in all four. So collation and
|
|
55
55
|
# case-folding — the two things `LC_ALL=C` otherwise changes — have nothing
|
|
56
|
-
# here to act on. locale-pin
|
|
56
|
+
# here to act on. The locale-pin test holds that inventory as a list and
|
|
57
57
|
# fails if the code drifts from this paragraph in either direction.
|
|
58
58
|
export LC_ALL=C
|
|
59
59
|
|
|
60
60
|
# Below the locale pin, not above it with `set -eu`: `unset` touches no
|
|
61
|
-
# byte-sensitive tool, but locale-pin
|
|
61
|
+
# byte-sensitive tool, but the locale-pin test treats ANY line here that
|
|
62
62
|
# is not a comment, a blank, or `set -[eux]+` as work the pin must sit above,
|
|
63
63
|
# and refuses on principle rather than on this line's own behaviour.
|
|
64
64
|
#
|
|
65
|
-
# An ambient GIT_WORK_TREE outranks `-C`, not just plain discovery (measured
|
|
66
|
-
#
|
|
65
|
+
# An ambient GIT_WORK_TREE outranks `-C`, not just plain discovery (measured):
|
|
66
|
+
# with GIT_WORK_TREE alone pointing at an unrelated tree, `git -C "$wt"
|
|
67
67
|
# rev-parse --show-toplevel` answers about THAT tree, not `$wt` — the linkage
|
|
68
68
|
# guard below then blames a healthy `.git`, reporting it resolves to whatever
|
|
69
69
|
# the ambient var named. `git -C "$wt" status --porcelain` reads the same
|
|
@@ -72,7 +72,7 @@ export LC_ALL=C
|
|
|
72
72
|
# script (no `-C` at all) is equally hostage to an ambient GIT_DIR retargeting
|
|
73
73
|
# it away from the repository the caller actually invoked this in. Unsetting
|
|
74
74
|
# both here, before any of them runs, is the one fix that reaches all of them
|
|
75
|
-
# at once — the same pattern `ledger.mjs` and
|
|
75
|
+
# at once — the same pattern `ledger.mjs` and inflight.sh's tests apply by hand
|
|
76
76
|
# per child process, under a comment making the same point: inherited git vars
|
|
77
77
|
# outrank cwd (and, here, outrank `-C` too).
|
|
78
78
|
#
|
|
@@ -83,8 +83,8 @@ export LC_ALL=C
|
|
|
83
83
|
# script, the ones with no `-C` to even attempt insulating them.
|
|
84
84
|
#
|
|
85
85
|
# Both halves are pinned, one fixture each: GIT_WORK_TREE by the linkage-guard
|
|
86
|
-
# case, GIT_DIR by
|
|
87
|
-
# repository
|
|
86
|
+
# case, GIT_DIR by the case showing an ambient GIT_DIR does not aim the release
|
|
87
|
+
# at another repository. That second fixture measures the damage end-to-end
|
|
88
88
|
# through one of the `-C`-less calls: with only `unset GIT_WORK_TREE` here, the
|
|
89
89
|
# run reports `released: true` after deleting the claim's branch name in a
|
|
90
90
|
# DIFFERENT repository and leaving this repository's three artefacts intact.
|
|
@@ -118,9 +118,9 @@ blockers=""
|
|
|
118
118
|
# below, before anything is accumulated — byte-identical to today: no
|
|
119
119
|
# `$blockers` reference is even reached.
|
|
120
120
|
#
|
|
121
|
-
#
|
|
121
|
+
# Chosen design: print the same receipt shape the blocked checkpoint and
|
|
122
122
|
# `halt` already use, with `$1` appended to `$blockers` exactly as `block`
|
|
123
|
-
# would have recorded it — not a new schema, and not a second write.
|
|
123
|
+
# would have recorded it — not a new schema, and not a second write. The alternative
|
|
124
124
|
# (emit the receipt as soon as blockers goes non-empty, before whatever can
|
|
125
125
|
# die) was ruled out: it lets a run print a receipt and then keep going and
|
|
126
126
|
# fail anyway, which is a run with two writes or a receipt describing a state
|
|
@@ -132,10 +132,10 @@ blockers=""
|
|
|
132
132
|
# string stays byte-identical to the blocked checkpoint's rather than growing a
|
|
133
133
|
# second blockers slot only this one caller uses.
|
|
134
134
|
#
|
|
135
|
-
#
|
|
136
|
-
# parses as JSON, blockers in order
|
|
135
|
+
# The test "block() then die() compose a receipt that still
|
|
136
|
+
# parses as JSON, blockers in order" pins this by name: two `block()`
|
|
137
137
|
# calls, then a `die()` splice, composed for real rather than reasoned about
|
|
138
|
-
# by hand
|
|
138
|
+
# by hand. Mutation-verified both directions — `block`
|
|
139
139
|
# dropping its comma, or appending two instead of one — reds that test.
|
|
140
140
|
#
|
|
141
141
|
# The `||` arm is the receipt's only voice. `|| die` is what `block` and `halt`
|
|
@@ -162,9 +162,9 @@ die() {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
# The escaping helpers
|
|
165
|
+
# The escaping helpers. json.sh's header holds the sourcing contract and
|
|
166
166
|
# the measurements behind it; only what is true of THIS script is repeated here.
|
|
167
|
-
# Below `export LC_ALL=C` deliberately: locale-pin
|
|
167
|
+
# Below `export LC_ALL=C` deliberately: the locale-pin test allows only
|
|
168
168
|
# comments, blanks, a shebang or a `set -` line above that pin, and `json_lib=`
|
|
169
169
|
# is none of them.
|
|
170
170
|
#
|
|
@@ -179,7 +179,7 @@ json_lib="$(dirname "$0")/json.sh"
|
|
|
179
179
|
# shellcheck source=json.sh
|
|
180
180
|
. "$json_lib" || die "$json_lib failed to load"
|
|
181
181
|
|
|
182
|
-
# The worktree readers
|
|
182
|
+
# The worktree readers. worktree.sh's header holds the sourcing
|
|
183
183
|
# contract and the measurements behind it, and json.sh's holds the `[ -r ]`
|
|
184
184
|
# reasoning both guards share. This script reads exit 1 as its own blocked
|
|
185
185
|
# verdict, which is the whole reason that guard is not `|| die` alone.
|
|
@@ -189,7 +189,7 @@ wt_lib="$(dirname "$0")/worktree.sh"
|
|
|
189
189
|
# shellcheck source=worktree.sh
|
|
190
190
|
. "$wt_lib" || die "$wt_lib failed to load"
|
|
191
191
|
|
|
192
|
-
# The bounded, prompt-suppressed git transport
|
|
192
|
+
# The bounded, prompt-suppressed git transport. The
|
|
193
193
|
# pushed-branch lookup below is unattended: with no bound it can prompt for a
|
|
194
194
|
# credential or a host key, or stall on a transport that connects and then goes
|
|
195
195
|
# quiet, and either holds a fleet slot until something outside kills it.
|
|
@@ -294,7 +294,7 @@ git rev-parse --verify "$base_rev" >/dev/null || die "$base does not resolve"
|
|
|
294
294
|
# one level too shallow, because naming an entry needs read+execute on the
|
|
295
295
|
# PARENT only. `chmod 000` on the `gitdir` FILE inside an entry passes every
|
|
296
296
|
# permission test this script could make on the entry itself and still drops
|
|
297
|
-
# the worktree from the listing — measured
|
|
297
|
+
# the worktree from the listing — measured. Count
|
|
298
298
|
# instead: one registry entry on disk per linked worktree, against what git
|
|
299
299
|
# reported. A mismatch is a silent drop, whichever file inside was unreadable.
|
|
300
300
|
#
|
|
@@ -306,14 +306,12 @@ common=$(git rev-parse --path-format=absolute --git-common-dir) ||
|
|
|
306
306
|
die "cannot resolve the git common directory"
|
|
307
307
|
wtroot="$common/worktrees"
|
|
308
308
|
|
|
309
|
-
# A function, not inline, because the count is taken
|
|
310
|
-
#
|
|
311
|
-
#
|
|
312
|
-
#
|
|
313
|
-
#
|
|
314
|
-
#
|
|
315
|
-
# into an accumulate-and-continue probe, this one dies, so the loop itself
|
|
316
|
-
# still just dies on an unreadable registry rather than returning past it.
|
|
309
|
+
# A function, not inline, because the count is taken more than once: here, and
|
|
310
|
+
# again by the recount loop below, up to `recount_tries` times, while the
|
|
311
|
+
# cross-check disagrees with git's own listing. It mirrors inflight.sh's own
|
|
312
|
+
# count_registry, adapted for the difference that matters: that copy returns a
|
|
313
|
+
# status into an accumulate-and-continue probe; this one dies, so an unreadable
|
|
314
|
+
# registry still just dies here rather than returning past it.
|
|
317
315
|
count_registry() {
|
|
318
316
|
registered=0
|
|
319
317
|
[ -e "$wtroot" ] || return 0
|
|
@@ -340,9 +338,7 @@ count_registry() {
|
|
|
340
338
|
# on disk (measured: listed 1 → linked 0, and a gitdir-keyed count returns 0
|
|
341
339
|
# to match). A corrupt entry still holds git's own files — commondir, HEAD,
|
|
342
340
|
# index, logs, refs — so emptiness separates it from a stray where the
|
|
343
|
-
# missing `gitdir` does not.
|
|
344
|
-
# exists partly to keep this copy from inheriting the discriminator it
|
|
345
|
-
# replaced.
|
|
341
|
+
# missing `gitdir` does not.
|
|
346
342
|
#
|
|
347
343
|
# `ls`'s STATUS, not just its output, and that is the whole point: an entry
|
|
348
344
|
# we could not LIST is not an empty one, and `2>/dev/null` hides the
|
|
@@ -369,14 +365,14 @@ count_registry
|
|
|
369
365
|
# A newline in that path was the same truncation one byte further out: the plain
|
|
370
366
|
# porcelain ends every attribute with one, so the record split and every
|
|
371
367
|
# `substr($0,10)` below stopped at the newline. `wt_listing` reads `-z` and
|
|
372
|
-
# swaps the separators, so a record ends where git says it ends.
|
|
368
|
+
# swaps the separators, so a record ends where git says it ends.
|
|
373
369
|
#
|
|
374
370
|
# `|| die`, where this was a bare assignment: left bare the read died on `set -e`
|
|
375
371
|
# under git's own diagnostic, with no line carrying the `release-ticket:` prefix
|
|
376
372
|
# a caller greps stderr for — the very reason every lookup OVER this listing is
|
|
377
373
|
# already guarded that way.
|
|
378
374
|
#
|
|
379
|
-
# A function, not inline, because the recount below
|
|
375
|
+
# A function, not inline, because the recount below needs this whole
|
|
380
376
|
# pair — git's own read and the count derived from it — re-taken TOGETHER, not
|
|
381
377
|
# just re-assigned in isolation. `linked` and `wt_list`/`wt_err` are this
|
|
382
378
|
# function's OUTPUT, exactly as `registered` is `count_registry`'s.
|
|
@@ -412,7 +408,7 @@ count_linked() {
|
|
|
412
408
|
# count over this listing can see the truncation. It is a count of records against
|
|
413
409
|
# registry entries and catches an entry git DROPPED; the path inside a record it
|
|
414
410
|
# does keep is `nl_path`'s to refuse, below. Under `-z` the count is now right by
|
|
415
|
-
# construction — one `worktree ` line per record, whatever the path holds.
|
|
411
|
+
# construction — one `worktree ` line per record, whatever the path holds.
|
|
416
412
|
listed=$(printf '%s\n' "$wt_list" | LC_ALL=C awk '/^worktree /{c++} END{print c+0}') ||
|
|
417
413
|
die "could not count the worktrees git listed for #$issue"
|
|
418
414
|
# The `|| die` above closes only the route where awk could not RUN. An empty but
|
|
@@ -424,7 +420,7 @@ count_linked() {
|
|
|
424
420
|
# linked worktree at all — a guard that refused that would refuse most releases
|
|
425
421
|
# in this repo. Real `git worktree list --porcelain` always prints the main
|
|
426
422
|
# worktree, so reaching this needs a broken or shimmed git; the refusal
|
|
427
|
-
# direction was already right, only the number was nonsense.
|
|
423
|
+
# direction was already right, only the number was nonsense.
|
|
428
424
|
[ "$listed" -ge 1 ] ||
|
|
429
425
|
die "git listed no worktrees at all for #$issue — not even the main checkout, so the listing cannot be trusted"
|
|
430
426
|
linked=$((listed - 1))
|
|
@@ -438,18 +434,18 @@ count_linked
|
|
|
438
434
|
# sibling agent's `git worktree add` having landed between the two, which in a
|
|
439
435
|
# parallel fleet is routine rather than exotic. Calling that "the listing is
|
|
440
436
|
# incomplete" sends an operator hunting a permissions fault that is not there.
|
|
441
|
-
# Recount before refusing
|
|
437
|
+
# Recount before refusing. The registry scan above and git's listing
|
|
442
438
|
# just taken are two reads at two different instants, not one atomic read, and
|
|
443
439
|
# a sibling agent's `git worktree add` or `remove` landing in the gap makes the
|
|
444
440
|
# two counts disagree with nothing actually wrong — measured against this
|
|
445
441
|
# script directly: 3/100 dry-run releases aborted on this cross-check under a
|
|
446
442
|
# throttled churner, 48-66/80 unthrottled, all with zero real faults among them.
|
|
447
443
|
#
|
|
448
|
-
# inflight.sh already recounts here
|
|
444
|
+
# inflight.sh already recounts here into its own accumulate-and-continue
|
|
449
445
|
# probe; this script's whole contract is `die` on any unmet precondition
|
|
450
446
|
# instead, so the port keeps that shape rather than inheriting the accumulator.
|
|
451
|
-
# Both copies recount BOTH `registered` and `linked
|
|
452
|
-
#
|
|
447
|
+
# Both copies recount BOTH `registered` and `linked`, which closes the same
|
|
448
|
+
# window in each.
|
|
453
449
|
# Re-taking `registered` alone leaves `linked` pinned to the FIRST `wt_listing`
|
|
454
450
|
# call: a second sibling mutation landing after that call returns but before
|
|
455
451
|
# the lone recount re-scans the registry inflates `registered` without touching
|
|
@@ -474,9 +470,9 @@ count_linked
|
|
|
474
470
|
# The order is kept the same as the original pair for THIS argument's sake —
|
|
475
471
|
# it lets the invariant above carry over instead of being re-derived for a
|
|
476
472
|
# different order — not because a different order would be wrong. Verified
|
|
477
|
-
# directly
|
|
473
|
+
# directly: swapping the recount to `count_linked` first then
|
|
478
474
|
# `count_registry` still passes all four tests below (the two single-mutation
|
|
479
|
-
# absorptions and the two
|
|
475
|
+
# absorptions and the two regression cases) unchanged. Both functions
|
|
480
476
|
# only read — neither writes anything the other observes — so whichever runs
|
|
481
477
|
# first merely trades which of the two symmetric windows (before the first
|
|
482
478
|
# call, between the two, after the second) a same-shaped mutation would need
|
|
@@ -497,8 +493,8 @@ count_linked
|
|
|
497
493
|
# one atomic read: a THIRD sibling mutation landing between the recount's own
|
|
498
494
|
# `count_registry` and `count_linked` calls escapes the single-recount
|
|
499
495
|
# invariant the same way a second mutation once escaped the original pair,
|
|
500
|
-
# and mislabels the same benign race under one of the two `die`s below
|
|
501
|
-
#
|
|
496
|
+
# and mislabels the same benign race under one of the two `die`s below.
|
|
497
|
+
# Verified directly with a shim landing a
|
|
502
498
|
# first mutation ahead of the initial listing and a second squarely inside the
|
|
503
499
|
# recount's own gap: the wrong-direction message reproduced against this
|
|
504
500
|
# script before the loop below existed.
|
|
@@ -519,8 +515,8 @@ count_linked
|
|
|
519
515
|
# within this one invocation — while a genuine corruption is a standing
|
|
520
516
|
# state, not a moment, and still survives every pass and still refuses once
|
|
521
517
|
# the loop below runs out. `recount_tries` bounds it at one more attempt than
|
|
522
|
-
#
|
|
523
|
-
# this into
|
|
518
|
+
# the single recount already took (closing the specific residual without turning
|
|
519
|
+
# this into an open-ended chase) rather than a
|
|
524
520
|
# measured constant — sustained real churn settling in two extra reads is not
|
|
525
521
|
# something this fixture can measure a percentage for, unlike the numbers
|
|
526
522
|
# above.
|
|
@@ -543,16 +539,16 @@ fi
|
|
|
543
539
|
# `locked` and `unresolved_head` below read the same `$wt_list` through awk and
|
|
544
540
|
# answer THROUGH its exit status, where telling "could not run" from "no match"
|
|
545
541
|
# needs more than a `|| die`. Each captures that status itself and refuses above
|
|
546
|
-
# the range its answer occupies; `locked` carries why
|
|
542
|
+
# the range its answer occupies; `locked` carries why.
|
|
547
543
|
#
|
|
548
|
-
# Neither
|
|
544
|
+
# Neither of the two triggers described next is what makes these guards worth having, and both are
|
|
549
545
|
# narrower than they look. A newline in <slug> reaches the branch lookup as a
|
|
550
546
|
# `-v` value, where BSD awk refuses it outright but mawk and gawk accept it
|
|
551
547
|
# (measured), so on those the run simply walks past. An undecodable byte would
|
|
552
548
|
# arrive as record data instead — the trigger no policy on <slug> could also
|
|
553
549
|
# cover — but it is held shut here by one line, `export LC_ALL=C` above: under
|
|
554
550
|
# a UTF-8 locale these very programs exit 2 on such a byte, under `C` they read
|
|
555
|
-
# it as data (both measured
|
|
551
|
+
# it as data (both measured). What the guards actually answer for is an
|
|
556
552
|
# awk that could not run AT ALL, which no locale or implementation rules out.
|
|
557
553
|
#
|
|
558
554
|
# Guarding these ASSIGNMENTS cannot turn an empty answer into a refusal: none of
|
|
@@ -605,7 +601,7 @@ main_wt=$(printf '%s\n' "$wt_list" | awk '/^worktree /{print substr($0,10); exit
|
|
|
605
601
|
# Unlike `locked`'s path, this needle is built from argv rather than read off
|
|
606
602
|
# disk — but argv is not exempt from a backslash either, and awk itself still
|
|
607
603
|
# exits 0 having simply matched nothing: the permissive answer, in a probe whose
|
|
608
|
-
# whole job is to catch a claim whose branch moved
|
|
604
|
+
# whole job is to catch a claim whose branch moved. ENVIRON does no such
|
|
609
605
|
# processing.
|
|
610
606
|
stray=$(printf '%s\n' "$wt_list" |
|
|
611
607
|
D="/$issue-$slug" awk '/^worktree /{n++; p=substr($0,10); d=ENVIRON["D"]
|
|
@@ -620,7 +616,7 @@ git rev-parse --verify --quiet "refs/heads/$branch" >/dev/null && has_branch=tru
|
|
|
620
616
|
# so without it a single `"` or backslash anywhere emits a payload the caller
|
|
621
617
|
# cannot parse — while the delete has already happened and the exit code still
|
|
622
618
|
# says success. The rule list and its ordering live in json.sh, once, rather
|
|
623
|
-
# than here and in inflight.sh and in no-undo-audit.sh
|
|
619
|
+
# than here and in inflight.sh and in no-undo-audit.sh.
|
|
624
620
|
# A `$(...)` in printf's ARGUMENT list sits outside the `|| die` on the printf
|
|
625
621
|
# itself: a substitution that fails contributes an EMPTY argument and printf
|
|
626
622
|
# still exits 0 — and an unquoted `%s` slot then emits `"...Rewritten":,`,
|
|
@@ -665,7 +661,7 @@ wt_outcome=Unreleased
|
|
|
665
661
|
# Why the measurement could not be taken, empty whenever it could. Only
|
|
666
662
|
# `Indeterminate` ever carries one, and `halt` appends it to that state's report:
|
|
667
663
|
# "could not be measured" names the failure without naming its cause, which is
|
|
668
|
-
# the one line an operator mid-release has nothing else to go on.
|
|
664
|
+
# the one line an operator mid-release has nothing else to go on.
|
|
669
665
|
wt_why=
|
|
670
666
|
done_branch=false
|
|
671
667
|
halt() {
|
|
@@ -739,7 +735,7 @@ block() {
|
|
|
739
735
|
# whose whole job is to refuse to answer permissively. ENVIRON does no such
|
|
740
736
|
# processing.
|
|
741
737
|
# And the status is CAPTURED rather than answered with, for the same reason one
|
|
742
|
-
# rung down
|
|
738
|
+
# rung down. This predicate's answer IS awk's exit status — 0 locked, 1
|
|
743
739
|
# not locked — so an awk that could not run lands above both and, called in a
|
|
744
740
|
# condition as both callers must call it, is read as the FALSE answer: "not
|
|
745
741
|
# locked" again, the permissive one. Measured through this script with awk
|
|
@@ -771,8 +767,8 @@ locked() {
|
|
|
771
767
|
# on some other branch? Four ways an admin HEAD file breaks all produce the
|
|
772
768
|
# same porcelain shape — the null object id with no `branch` line: `chmod 000`
|
|
773
769
|
# on it, garbage content in it, a dangling symlink in its place, or a
|
|
774
|
-
# directory in its place (measured, git 2.50.1). release-ticket
|
|
775
|
-
#
|
|
770
|
+
# directory in its place (measured, git 2.50.1). The release-ticket tests
|
|
771
|
+
# build all four. `chmod 000` is the only one needing a permission bit, so it
|
|
776
772
|
# alone carries the `EUID0` skip the file's other permission fixtures do and
|
|
777
773
|
# measures nothing on a root runner; the other three reproduce as any user.
|
|
778
774
|
#
|
|
@@ -830,17 +826,17 @@ unresolved_head() {
|
|
|
830
826
|
occupied() { [ -e "$1" ] || [ -L "$1" ]; }
|
|
831
827
|
|
|
832
828
|
# The registration PROBE at the heart of the arm below: is $1 still listed in
|
|
833
|
-
# $now, the fresh post-removal listing?
|
|
829
|
+
# $now, the fresh post-removal listing? `locked` and `unresolved_head`
|
|
834
830
|
# read their own awk's exit status STRAIGHT as the answer — 0 true, 1 false —
|
|
835
831
|
# so an awk that could not run (rc >= 2: killed, OOM, a broken interpreter) and
|
|
836
832
|
# an awk that ran fine and found no match (rc 1, the genuine "not registered")
|
|
837
|
-
# both land on the false side of the same elif, and
|
|
833
|
+
# both land on the false side of the same elif, and it was measured what that
|
|
838
834
|
# fold did here: with nothing left to distinguish them, the run fell through to
|
|
839
835
|
# `elif occupied "$1"; then wt_outcome=Deregistered` and wrote a false
|
|
840
836
|
# Deregistered into the JSON receipt for a registration nothing established was
|
|
841
837
|
# actually cleared.
|
|
842
838
|
#
|
|
843
|
-
# `locked` and `unresolved_head`'s own fix
|
|
839
|
+
# `locked` and `unresolved_head`'s own fix is not enough copied
|
|
844
840
|
# verbatim: both `die` on an awk that could not run, which is right for a
|
|
845
841
|
# precondition gate — abort before any mutation is attempted — and wrong here.
|
|
846
842
|
# `release_outcome` runs AFTER `git worktree remove` has already run, is called
|
|
@@ -867,7 +863,7 @@ ro_registered() {
|
|
|
867
863
|
}
|
|
868
864
|
|
|
869
865
|
# Which release outcome does $1 hold after a `git worktree remove` that refused?
|
|
870
|
-
# Measured, never inferred from the rc —
|
|
866
|
+
# Measured, never inferred from the rc — recording the rc instead of what landed is the defect this exists to remove.
|
|
871
867
|
# git drops the registration BEFORE the directory and does not restore it when
|
|
872
868
|
# the directory delete fails, so one call has three landing shapes and the exit
|
|
873
869
|
# code separates none of them. All measured on git 2.50.1:
|
|
@@ -887,8 +883,8 @@ ro_registered() {
|
|
|
887
883
|
# cannot-stat apart. No second predicate and no third value inside `gone`: it is
|
|
888
884
|
# now a single definition in worktree.sh that every caller in the fleet shares,
|
|
889
885
|
# so a third value added for this one caller lands in all of them — and this file
|
|
890
|
-
# already carries two answers on unreadable worktrees
|
|
891
|
-
# got duplicated.
|
|
886
|
+
# already carries two answers on unreadable worktrees from a concept that
|
|
887
|
+
# got duplicated.
|
|
892
888
|
#
|
|
893
889
|
# Only the four named states, so the two cells CONTEXT.md has no name for are
|
|
894
890
|
# not asserted: a registration that survived a directory that did not is
|
|
@@ -900,7 +896,7 @@ ro_registered() {
|
|
|
900
896
|
# `$wt_err` — would die with it. That is not hypothetical, it is what this
|
|
901
897
|
# function did: the one case where the headline degrades to "what landed could
|
|
902
898
|
# not be measured" was the one case whose cause never reached the operator, on
|
|
903
|
-
# stderr or in the receipt. Assigning globals is what carries it out.
|
|
899
|
+
# stderr or in the receipt. Assigning globals is what carries it out.
|
|
904
900
|
release_outcome() {
|
|
905
901
|
# `wt_listing` writes the shared `$wt_list`, and this function must not disturb
|
|
906
902
|
# the pre-mutation capture the guards above read off it. Saved and put back in
|
|
@@ -924,7 +920,7 @@ release_outcome() {
|
|
|
924
920
|
elif [ -n "$wt_why" ]; then
|
|
925
921
|
# awk could not run at all (rc >= 2), which is a different fact from
|
|
926
922
|
# "ran fine and found nothing" — the latter alone means Deregistered is on
|
|
927
|
-
# the table below.
|
|
923
|
+
# the table below.
|
|
928
924
|
wt_outcome=Indeterminate
|
|
929
925
|
elif occupied "$1"; then
|
|
930
926
|
wt_outcome=Deregistered
|
|
@@ -939,7 +935,7 @@ release_outcome() {
|
|
|
939
935
|
# it whole with the newline substituted, and the substituted byte is one no
|
|
940
936
|
# `git worktree remove`, no `[ -d ]` and no `git -C` below can name — so every
|
|
941
937
|
# check over it would answer about a different path, which is exactly the silent
|
|
942
|
-
# truncation this
|
|
938
|
+
# truncation this check exists to end.
|
|
943
939
|
#
|
|
944
940
|
# `block`, not `die`: this is a refused precondition like every other one here,
|
|
945
941
|
# and the caller gets the receipt that verdict carries. `nl_path ""` is false, so
|
|
@@ -1000,7 +996,7 @@ fi
|
|
|
1000
996
|
# a repo under a directory with a backslash in its name would arrive mangled and
|
|
1001
997
|
# the comparison would fall to the permissive answer — no match, and back to the
|
|
1002
998
|
# silent release this exists to stop. The suffix key above went through ENVIRON
|
|
1003
|
-
# too, for the same reason
|
|
999
|
+
# too, for the same reason: its needle is built from argv rather than
|
|
1004
1000
|
# read off disk, but argv is not exempt from a backslash either.
|
|
1005
1001
|
#
|
|
1006
1002
|
# Absent entry, unreadable entry, or one pointing somewhere git is not listing:
|
|
@@ -1017,7 +1013,7 @@ stray_own="matches this claim's directory name $issue-$slug"
|
|
|
1017
1013
|
# and the operator is handed a command the shell refuses to parse at all
|
|
1018
1014
|
# (`unexpected EOF`, rc 2, measured) — loud rather than wrong, but an
|
|
1019
1015
|
# instruction that cannot run, over a path git accepts in both a refname and a
|
|
1020
|
-
# worktree directory name.
|
|
1016
|
+
# worktree directory name.
|
|
1021
1017
|
#
|
|
1022
1018
|
# A parameter-expansion loop, not the `sed` one-liner it wants to be. Two
|
|
1023
1019
|
# measurements say why, both on /bin/sh (bash 3.2) and /bin/dash:
|
|
@@ -1061,8 +1057,8 @@ shquote() {
|
|
|
1061
1057
|
#
|
|
1062
1058
|
# A search, not a name built from the directory. The entry name is git's own,
|
|
1063
1059
|
# on the two measurements the block above already turns on. So `${stray##*/}`
|
|
1064
|
-
# would assert a path this script never read,
|
|
1065
|
-
#
|
|
1060
|
+
# would assert a path this script never read, a claim nothing observed, and
|
|
1061
|
+
# after a move or behind an entry thief it resolves to
|
|
1066
1062
|
# somebody else's entry outright.
|
|
1067
1063
|
#
|
|
1068
1064
|
# `-x`, not a substring: `gitdir` holds exactly one line whose whole content is
|
|
@@ -1148,8 +1144,8 @@ if [ -z "$wt" ] && [ -n "$stray" ]; then
|
|
|
1148
1144
|
# prints the FIRST in porcelain order, so a stranger registered under that
|
|
1149
1145
|
# basename and sorting ahead of the claim is what it answers with — measured
|
|
1150
1146
|
# on a healthy decoy at `.worktrees/0-decoy/<issue>-<slug>`, which took this
|
|
1151
|
-
# blocker while the claim's own detached directory sat behind it (
|
|
1152
|
-
#
|
|
1147
|
+
# blocker while the claim's own detached directory sat behind it (the fixture
|
|
1148
|
+
# is pinned below). `is this claim's` then sent an operator to
|
|
1153
1149
|
# hand-release somebody else's live tree, over a worktree the script had just
|
|
1154
1150
|
# read a DIFFERENT branch off — the one case where it can say the assertion is
|
|
1155
1151
|
# false. Name the collision instead: same directory name, wrong branch, which
|
|
@@ -1167,10 +1163,10 @@ if [ -z "$wt" ] && [ -n "$stray" ]; then
|
|
|
1167
1163
|
# The unlock command below is the one other pasted remedy in this chain that
|
|
1168
1164
|
# takes `$stray` as an argument — `git worktree prune` and `release it by
|
|
1169
1165
|
# hand` name no path — so it is the one other arm `shquote` must cover for
|
|
1170
|
-
# the same reason
|
|
1166
|
+
# the same reason it covers the entry search: an embedded `'` closes the
|
|
1171
1167
|
# quote this hint has no quote of its own to reopen, and the operator is
|
|
1172
1168
|
# handed a command that runs against a truncated, different path instead of
|
|
1173
|
-
# being refused outright.
|
|
1169
|
+
# being refused outright.
|
|
1174
1170
|
shquote "$stray"
|
|
1175
1171
|
stray_shq=$shq
|
|
1176
1172
|
if locked "$stray"; then
|
|
@@ -1200,8 +1196,7 @@ fi
|
|
|
1200
1196
|
#
|
|
1201
1197
|
# In the PRECONDITION block deliberately, not in the mutation path: here the dry
|
|
1202
1198
|
# run predicts the refusal for free, where placed below it would report only
|
|
1203
|
-
# under --apply and rebuild the dry/apply asymmetry
|
|
1204
|
-
# filed against.
|
|
1199
|
+
# under --apply and rebuild the dry/apply asymmetry.
|
|
1205
1200
|
#
|
|
1206
1201
|
# Gated on this claim having no registration of ours. With `wt` or `stray` set
|
|
1207
1202
|
# the directory IS registered and a guard above owns it — which is what keeps a
|
|
@@ -1230,10 +1225,10 @@ if [ -z "$wt" ] && [ -z "$stray" ]; then
|
|
|
1230
1225
|
# untouched — invisible to candidates.mjs and still in-flight. Refuse
|
|
1231
1226
|
# instead of guessing.
|
|
1232
1227
|
#
|
|
1233
|
-
# Deferred past the orphan probe above
|
|
1228
|
+
# Deferred past the orphan probe above rather than fired the moment
|
|
1234
1229
|
# `has_branch` reads false: this exact input — no branch, no worktree, no
|
|
1235
|
-
# stray — is also what
|
|
1236
|
-
#
|
|
1230
|
+
# stray — is also what a prior half-release leaves behind: a claim whose branch
|
|
1231
|
+
# was already deleted, with its directory still on disk.
|
|
1237
1232
|
# Fired unconditionally, that state got the same "check the <slug> and
|
|
1238
1233
|
# <type> arguments" prose as a genuine typo, naming the wrong cause over a
|
|
1239
1234
|
# directory sitting right there with a real remedy. The orphan probe above
|
|
@@ -1339,17 +1334,17 @@ fi
|
|
|
1339
1334
|
# stat, and only the second is unknown — so the existence test has to be the one
|
|
1340
1335
|
# that agrees with `gone` about what "exists" means. It did not. Every `test`
|
|
1341
1336
|
# primary except `-L` STATS, so a DANGLING symlink is `-e` false, and once `gone`
|
|
1342
|
-
# stopped calling that established-absent
|
|
1337
|
+
# stopped calling that established-absent this guard read it as "cannot
|
|
1343
1338
|
# tell" and died at exit 2 with no receipt — for a path whose state is known
|
|
1344
1339
|
# exactly, and which the stand-in blocker below already answers. Measured on
|
|
1345
|
-
# release-ticket
|
|
1340
|
+
# the release-ticket tests' own dangling-link fixture, which is what caught it.
|
|
1346
1341
|
#
|
|
1347
1342
|
# `! occupied && ! gone` is the tri-valued pairing `gone`'s contract prescribes,
|
|
1348
1343
|
# and the same one `release_outcome` composes: present or link-present is not
|
|
1349
1344
|
# unknown, established-absent is not unknown, and what is left over is.
|
|
1350
1345
|
#
|
|
1351
1346
|
# `! nl_path` for the same reason the dangling link needed `occupied`, and it is
|
|
1352
|
-
# the same trap a second time: `gone` now refuses a substituted path too
|
|
1347
|
+
# the same trap a second time: `gone` now refuses a substituted path too,
|
|
1353
1348
|
# so without this exemption the pairing reads it as "cannot tell" and dies — for
|
|
1354
1349
|
# a path the newline blocker above has already answered in the operator's own
|
|
1355
1350
|
# terms, downgrading a receipt-carrying `NOT released` verdict to an exit-2 die
|
|
@@ -1403,7 +1398,7 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1403
1398
|
#
|
|
1404
1399
|
# Existence is not enough on its own: a .git naming a gitdir whose
|
|
1405
1400
|
# core.worktree is some OTHER directory is a well-formed regular file too, and
|
|
1406
|
-
# git then answers happily about that other tree at rc 0 (measured
|
|
1401
|
+
# git then answers happily about that other tree at rc 0 (measured). The
|
|
1407
1402
|
# block below closes that — this one only establishes the file is there to
|
|
1408
1403
|
# examine.
|
|
1409
1404
|
#
|
|
@@ -1432,9 +1427,9 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1432
1427
|
# `git -C "$wt" rev-parse --show-toplevel` answers with the linkage's own
|
|
1433
1428
|
# idea of $wt's working tree. Comparing it against $wt itself refuses every
|
|
1434
1429
|
# shape that moves git's WORKING TREE away from $wt while $wt/.git still
|
|
1435
|
-
# passes the `-f` gate above —
|
|
1430
|
+
# passes the `-f` gate above — the walk-up shape (an absent, empty-directory,
|
|
1436
1431
|
# or dangling-symlink .git) fails that gate and is refused there instead,
|
|
1437
|
-
# never reaching this compare
|
|
1432
|
+
# never reaching this compare. What it does refuse: a hand-written .git naming
|
|
1438
1433
|
# a gitdir whose core.worktree is elsewhere, whether or not that gitdir is
|
|
1439
1434
|
# named `.git`; and core.worktree set in the worktree's own config.worktree
|
|
1440
1435
|
# under extensions.worktreeConfig, the .git file untouched (all measured, git
|
|
@@ -1447,9 +1442,9 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1447
1442
|
# is no substitute either: `--show-prefix` is empty at rc 0 for both
|
|
1448
1443
|
# core.worktree shapes above.
|
|
1449
1444
|
#
|
|
1450
|
-
# What this does NOT cover
|
|
1445
|
+
# What this does NOT cover: shapes that swap which git dir answers
|
|
1451
1446
|
# while the working tree stays $wt. A .git naming a SIBLING worktree's admin
|
|
1452
|
-
# dir (
|
|
1447
|
+
# dir (copying one worktree's contents, .git included, over another
|
|
1453
1448
|
# produces it), or a foreign git dir whose core.worktree points back at $wt.
|
|
1454
1449
|
# `--show-toplevel` answers $wt for both, so the compare passes them. They
|
|
1455
1450
|
# are stopped downstream, before anything changes: the status below reads
|
|
@@ -1459,8 +1454,8 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1459
1454
|
# point back to .git/worktrees/<name>", measured). The cost is a dry run that
|
|
1460
1455
|
# can call such a claim releasable and an --apply that then halts. Left
|
|
1461
1456
|
# there on purpose: these shapes need a hand-copied .git or deliberate
|
|
1462
|
-
# tampering, `git worktree` never writes one, and
|
|
1463
|
-
#
|
|
1457
|
+
# tampering, `git worktree` never writes one, and a stricter check here was
|
|
1458
|
+
# ruled not worth its code.
|
|
1464
1459
|
#
|
|
1465
1460
|
# Compared as a DIRECTORY (`-ef`, same device and inode), never as a string,
|
|
1466
1461
|
# or this false-refuses a HEALTHY worktree: `$wt` is the path `worktree list
|
|
@@ -1472,7 +1467,7 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1472
1467
|
# PRECOMPOSED by the `core.precomposeunicode` git writes into every new repo
|
|
1473
1468
|
# on macOS, while `--show-toplevel` answers the on-disk NFD bytes — visually
|
|
1474
1469
|
# identical, byte-different, one directory (measured, git 2.50.1, Apple
|
|
1475
|
-
# Git-155
|
|
1470
|
+
# Git-155; reap.sh's copy of this compare compares as a directory too). Under bash —
|
|
1476
1471
|
# macOS's own `/bin/sh` — `cd "$wt" && pwd -P` canonicalised only the
|
|
1477
1472
|
# first: it echoes the spelling it was given, so a byte compare against it
|
|
1478
1473
|
# refused every healthy NFD worktree at exit 2 there; dash's own `pwd -P`
|
|
@@ -1489,9 +1484,9 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1489
1484
|
# trailing newline, so a `core.worktree` naming a sibling directory called
|
|
1490
1485
|
# `$wt` plus a newline byte — git accepts one as an ordinary path character —
|
|
1491
1486
|
# would otherwise name `$wt` itself and pass the redirect, the dirty check
|
|
1492
|
-
# then reading that sibling's clean copy over $wt's work (measured
|
|
1493
|
-
# the shape no-undo-audit.sh closed the same way,
|
|
1494
|
-
# of this compare
|
|
1487
|
+
# then reading that sibling's clean copy over $wt's work (measured;
|
|
1488
|
+
# the shape no-undo-audit.sh closed the same way, and reap.sh's copy
|
|
1489
|
+
# of this compare). The sentinel leaves `$(...)` only git's own
|
|
1495
1490
|
# terminating newline to strip.
|
|
1496
1491
|
#
|
|
1497
1492
|
# A $wt whose own leaf was replaced by a symlink — never `git worktree add`'s
|
|
@@ -1500,7 +1495,7 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1500
1495
|
# `-ef` follows the link, and `--show-toplevel` resolves through it to the
|
|
1501
1496
|
# same real, possibly newline-suffixed, directory, so the two compare equal
|
|
1502
1497
|
# and that case stays exactly as blocked — "not a directory" at exit 1 — never
|
|
1503
|
-
# a fabricated "does not point at itself" mismatch at exit 2
|
|
1498
|
+
# a fabricated "does not point at itself" mismatch at exit 2.
|
|
1504
1499
|
if [ -f "$wt/.git" ]; then
|
|
1505
1500
|
toplevel=$(git -C "$wt" rev-parse --show-toplevel && echo x) ||
|
|
1506
1501
|
die "cannot read the git repository at $wt (its .git file or the gitdir it names), so whether it holds uncommitted work is unknown"
|
|
@@ -1512,7 +1507,7 @@ if [ -n "$wt" ] && [ -d "$wt" ]; then
|
|
|
1512
1507
|
|
|
1513
1508
|
# Same reason: folded-in stderr would be counted as uncommitted changes.
|
|
1514
1509
|
#
|
|
1515
|
-
# `-uall`:
|
|
1510
|
+
# `-uall`: see reap.sh's branch sweep for the full explanation — a
|
|
1516
1511
|
# bare `--porcelain` reads clean over a dirty tree under
|
|
1517
1512
|
# `status.showUntrackedFiles = no`, releasing a claim whose only copy of
|
|
1518
1513
|
# that work is the directory about to be deleted. The `git worktree remove`
|
|
@@ -1561,7 +1556,7 @@ if ! labels=$(gh issue view "$issue" --json labels --jq '.labels[].name'); then
|
|
|
1561
1556
|
die "gh issue view $issue failed, so the in-progress label cannot be released"
|
|
1562
1557
|
fi
|
|
1563
1558
|
# grep's OWN scan failing (rc 2+) must not read as "no in-progress label":
|
|
1564
|
-
# the same defect
|
|
1559
|
+
# the same defect reap.sh's grep_probe guards against. A bare
|
|
1565
1560
|
# `if … grep -qx …; then has_label=true; else has_label=false; fi` has room
|
|
1566
1561
|
# for only two of grep's three `-q` outcomes — rc 0 matched, rc 1 none did,
|
|
1567
1562
|
# rc 2+ the scan itself broke — so a scan that could not look would read
|
|
@@ -1597,7 +1592,7 @@ else
|
|
|
1597
1592
|
printf '$ git worktree remove %s\n' "$wt" >&2
|
|
1598
1593
|
# Measure on the REFUSAL only. git's two deletes are ordered, not atomic, so
|
|
1599
1594
|
# a non-zero rc tells us a step failed and nothing about which — that is the
|
|
1600
|
-
# whole of
|
|
1595
|
+
# whole of it. A zero rc is different in kind: both deletes completed, and
|
|
1601
1596
|
# `Released` restates git's own success rather than inferring past a
|
|
1602
1597
|
# failure. Re-measuring here would also make the happy path answerable by a
|
|
1603
1598
|
# probe that can return Indeterminate, refusing releases that plainly worked.
|
|
@@ -1625,7 +1620,7 @@ else
|
|
|
1625
1620
|
# including the delete, turns "recount, then hope nothing moved before
|
|
1626
1621
|
# the call" into "delete only if nothing moved". Measured against $base,
|
|
1627
1622
|
# not local HEAD, so it answers the safety question without
|
|
1628
|
-
# reintroducing the staleness `-d` fails on
|
|
1623
|
+
# reintroducing the staleness `-d` fails on. The `git cherry` half
|
|
1629
1624
|
# is deliberately not recounted: a commit that landed in the window is
|
|
1630
1625
|
# ahead of $base by construction, and one cherry would mark `-` is
|
|
1631
1626
|
# patch-equivalent to something already upstream.
|
|
@@ -1651,7 +1646,7 @@ else
|
|
|
1651
1646
|
# separate git invocation, and nothing here can ask `update-ref` to verify
|
|
1652
1647
|
# it atomically with the delete the way `-D` verified its own.
|
|
1653
1648
|
#
|
|
1654
|
-
# What that window can cost, per the ruling
|
|
1649
|
+
# What that window can cost, per the maintainer's ruling: a checkout
|
|
1655
1650
|
# landing in it leaves that worktree holding a deleted branch, which
|
|
1656
1651
|
# breaks the worktree. It cannot lose a commit. A commit made there before
|
|
1657
1652
|
# the delete moves the ref off $tip, and the compare-and-swap below then
|
|
@@ -1673,7 +1668,7 @@ else
|
|
|
1673
1668
|
# in this repo's own registry for it (a worktree `rm -rf`'d out from
|
|
1674
1669
|
# under git), a listed path it cannot hand back to git byte for byte, or
|
|
1675
1670
|
# a porcelain record naming neither `branch` nor `detached` at all — a
|
|
1676
|
-
# worktree whose admin `HEAD` holds garbage, not a ref.
|
|
1671
|
+
# worktree whose admin `HEAD` holds garbage, not a ref.
|
|
1677
1672
|
wt_listing || halt "cannot re-read the worktree list to check $branch before the delete: $wt_err"
|
|
1678
1673
|
if wt_holding "refs/heads/$branch"; then cas_rc=0; else cas_rc=$?; fi
|
|
1679
1674
|
case $cas_rc in
|
|
@@ -1688,7 +1683,7 @@ else
|
|
|
1688
1683
|
# authorizes its own [gone] deletes with `git cherry` ALONE — not this
|
|
1689
1684
|
# pairing. `-d` measures against HEAD and the branch's upstream, and a
|
|
1690
1685
|
# claim has no upstream until its first push (claim-ticket.sh passes
|
|
1691
|
-
# --no-track
|
|
1686
|
+
# --no-track), so `-d` falls back to local HEAD alone and refuses a
|
|
1692
1687
|
# pristine claim whenever local main is behind origin/main —
|
|
1693
1688
|
# half-releasing it: worktree deleted, branch stranded, in-progress still
|
|
1694
1689
|
# on the issue. Measured.
|
package/skills/run-team/SKILL.md
CHANGED
|
@@ -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.
|
|
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`
|