@feigi/fleet-ctl 3.24.2 → 3.24.4
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/board.html +22 -22
- package/scripts/board.mjs +143 -145
- package/scripts/compute-board.mjs +39 -38
- package/scripts/derive-testcmd.sh +1 -1
- package/scripts/drop-merged-label.sh +10 -11
- package/scripts/fleet-bootstrap +8 -8
- package/scripts/fleet-provenance +8 -8
- package/scripts/fleet-run +3 -3
- package/scripts/frontmatter-allowlist.json +6 -6
- package/scripts/instruments.sh +30 -31
- package/scripts/json.sh +12 -13
- package/scripts/net.sh +23 -21
- package/scripts/prove-merge.sh +7 -7
- package/scripts/review-core.mjs +57 -58
- package/scripts/review-eval.mjs +14 -15
- package/scripts/verify-sha.sh +4 -4
package/scripts/instruments.sh
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
# Did the controller's instrument set change under it?
|
|
2
|
+
# Did the controller's instrument set change under it?
|
|
3
3
|
#
|
|
4
4
|
# The controller reads the world through scripts and runbooks that live in the
|
|
5
5
|
# MAIN checkout, and every member can write to that checkout — except through a
|
|
6
|
-
# `write`/`edit`/`ast_edit` that member-write-guard.mjs refuses
|
|
7
|
-
# `bash` or `eval` write still lands
|
|
6
|
+
# `write`/`edit`/`ast_edit` that member-write-guard.mjs refuses; a
|
|
7
|
+
# `bash` or `eval` write still lands. Worktree isolation
|
|
8
8
|
# and `./agent-test` port derivation protect members from each other; neither
|
|
9
9
|
# protects the tree the controller measures from. Measured: a member edited two
|
|
10
10
|
# files in the main checkout instead of its worktree while the CI monitor was
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
# already knows can be stale). A list rots on the next commit that adds a
|
|
43
43
|
# script; a directory does not.
|
|
44
44
|
#
|
|
45
|
-
# NOT THE WHOLE REPO, deliberately:
|
|
45
|
+
# NOT THE WHOLE REPO, deliberately: the plugin's payload is
|
|
46
46
|
# nested under `plugin/`, and the repo root also carries `docs/`, `.github/`
|
|
47
47
|
# and `.out-of-scope/`. `docs/metrics/` is APPENDED BY THE CONTROLLER
|
|
48
48
|
# MID-RUN, so a whole-repo set would fire the gate on the run's own
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
# blob untouched; both exit 0 here. A mode change that costs the hash its READ
|
|
66
66
|
# is caught instead: `chmod 000` on a tracked instrument refuses at exit 2
|
|
67
67
|
# through `could not hash every tracked file` — as root that never fires,
|
|
68
|
-
# since root reads a mode-000 file regardless (
|
|
68
|
+
# since root reads a mode-000 file regardless (the suite skips
|
|
69
69
|
# this case there for the same reason). So the exposure is the bits that
|
|
70
70
|
# still permit reading, the exec bit above all — and that bit is not how a
|
|
71
71
|
# fleet probe runs: fleet-run hands `.sh` to `sh` and `.mjs` to `node`, so a
|
|
@@ -74,20 +74,19 @@
|
|
|
74
74
|
# modes in — digesting `git ls-files -s` alongside the contents, or a per-file
|
|
75
75
|
# `[ -x "$f" ]` — is a behaviour change to the gate on a channel with no
|
|
76
76
|
# silently wrong reading to its name, and whether a mode-only edit is worth
|
|
77
|
-
# refusing on is a decision rather than a fix, so
|
|
78
|
-
# leaves the behaviour alone.
|
|
77
|
+
# refusing on is a decision rather than a fix, so this paragraph names the gap and
|
|
78
|
+
# leaves the behaviour alone. The suite pins the accepted pair,
|
|
79
79
|
# so closing the gap later goes red there rather than leaving this
|
|
80
80
|
# paragraph stale.
|
|
81
81
|
#
|
|
82
82
|
# REFS ARE DELIBERATELY NOT IN THE DIGEST, and the reason is not that they do
|
|
83
|
-
# not matter. The corroborating evidence
|
|
83
|
+
# not matter. The corroborating evidence is a stray `fix/42-slug` branch
|
|
84
84
|
# left in the main checkout by something running this repo's own fixtures — a
|
|
85
85
|
# ref write, which no hash of files can see. But `claim-ticket.sh` creates a
|
|
86
86
|
# branch per ticket and `reap.sh` deletes them, in the ref store every worktree
|
|
87
87
|
# shares, so a ref digest changes several times per pass as ORDINARY WORK. Per
|
|
88
88
|
# gate that is noise, and noise is the one failure this check cannot afford.
|
|
89
|
-
# Sweeping for unexpected refs is a drain-cadence question, not a gate one
|
|
90
|
-
# it is not what #436's acceptance criteria ask for.
|
|
89
|
+
# Sweeping for unexpected refs is a drain-cadence question, not a gate one.
|
|
91
90
|
#
|
|
92
91
|
# COST: two `git ls-files` (the state home's own set, which decides whether a
|
|
93
92
|
# recorded root may be followed at all, and the audited tree's set) and one
|
|
@@ -98,19 +97,19 @@
|
|
|
98
97
|
set -eu
|
|
99
98
|
|
|
100
99
|
# Directly below `set -eu`, not below a locale pin: this script has none and is
|
|
101
|
-
# deliberately off
|
|
102
|
-
# that DO carry a pin put this line under it instead, because
|
|
103
|
-
#
|
|
100
|
+
# deliberately off the suite's list of locale-pinned scripts. The siblings
|
|
101
|
+
# that DO carry a pin put this line under it instead, because the suite admits
|
|
102
|
+
# only comments, blanks and `set -[eux]+` above the pin in those scripts.
|
|
104
103
|
# Here the only constraint left is the real one: above the first git call.
|
|
105
104
|
#
|
|
106
|
-
# GIT_WORK_TREE is
|
|
107
|
-
# contract
|
|
105
|
+
# GIT_WORK_TREE is the wrong-tree defect reached through the environment. The
|
|
106
|
+
# contract here is that the audited tree is the WORKING
|
|
108
107
|
# DIRECTORY's checkout — and `git rev-parse --show-toplevel` answers with the
|
|
109
|
-
# ambient work tree instead the moment one is set, `--repo` or not. Measured
|
|
110
|
-
#
|
|
108
|
+
# ambient work tree instead the moment one is set, `--repo` or not. Measured:
|
|
109
|
+
# standing in a checkout whose instruments have been TAMPERED, with
|
|
111
110
|
# `GIT_WORK_TREE` naming a clean twin that carries its own pinned baseline,
|
|
112
111
|
# this script exits 0 and prints the twin's digest. The gate passes. That is
|
|
113
|
-
# the same wrong-tree write `--repo ""` produced before
|
|
112
|
+
# the same wrong-tree write `--repo ""` produced before this script refused it, one
|
|
114
113
|
# door further out, and a gate that certifies a tree nobody looked at is
|
|
115
114
|
# worse than no gate.
|
|
116
115
|
#
|
|
@@ -122,12 +121,12 @@ set -eu
|
|
|
122
121
|
# pair is one hazard with one remedy, and because "inert today" is a
|
|
123
122
|
# measurement of the current call set: a digest taken from `git show` or
|
|
124
123
|
# `cat-file` rather than from disk would reintroduce the half nothing here
|
|
125
|
-
# can see.
|
|
124
|
+
# can see. The suite pins the line itself, which is
|
|
126
125
|
# what keeps that half from being quietly dropped.
|
|
127
126
|
unset GIT_DIR GIT_WORK_TREE
|
|
128
127
|
|
|
129
128
|
NAME=instruments
|
|
130
|
-
# `printf '%s'`, never `echo
|
|
129
|
+
# `printf '%s'`, never `echo`: `echo` expands backslash escapes in its
|
|
131
130
|
# operand, and the messages below carry paths that git will happily hand us with
|
|
132
131
|
# a backslash in them.
|
|
133
132
|
die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 2; }
|
|
@@ -154,9 +153,9 @@ while [ $# -gt 0 ]; do
|
|
|
154
153
|
[ $# -ge 2 ] || die "usage: instruments.sh [--pin] [--repo <path>] [--audit <path>]"
|
|
155
154
|
repo=$2
|
|
156
155
|
# An empty value falls through the `[ -n "$repo" ]` branch below and
|
|
157
|
-
# silently re-derives from cwd — measured
|
|
156
|
+
# silently re-derives from cwd — measured: `--repo ""`
|
|
158
157
|
# pinned the CALLER's cwd repo instead of refusing, exactly the
|
|
159
|
-
# wrong-tree-write class this
|
|
158
|
+
# wrong-tree-write class this script exists to close. Refuse here,
|
|
160
159
|
# before that check ever runs.
|
|
161
160
|
[ -n "$repo" ] || die "--repo requires a non-empty path"
|
|
162
161
|
shift 2
|
|
@@ -171,10 +170,10 @@ done
|
|
|
171
170
|
#
|
|
172
171
|
# `root` — the STATE HOME — is the WORKING DIRECTORY's checkout, never the
|
|
173
172
|
# checkout this script happens to ship from. Under the install-only dev loop
|
|
174
|
-
#
|
|
173
|
+
# this file runs out of a plugin cache — on a real install, under
|
|
175
174
|
# `~/.omp/plugins/cache/...` — and the OLD own-location contract (`git -C
|
|
176
175
|
# "$(dirname "$0")" …`) resolved it to whatever git checkout happens to
|
|
177
|
-
# CONTAIN that cache path. Measured
|
|
176
|
+
# CONTAIN that cache path. Measured, pre-cutover: on a real box that
|
|
178
177
|
# was the operator's unrelated personal dotfiles checkout, and `--pin` run
|
|
179
178
|
# that way writes `.fleet/instruments.sha` into it. `--repo <path>` is the
|
|
180
179
|
# explicit override for the one legitimate case that needs a home other than
|
|
@@ -209,7 +208,7 @@ base="$root/.fleet/instruments.sha"
|
|
|
209
208
|
# Whether the state home tracks an instrument set OF ITS OWN decides if a
|
|
210
209
|
# second tree may be named at all — and it is what closes the door a recorded
|
|
211
210
|
# root would otherwise open: measured, a member who can write `.fleet/`
|
|
212
|
-
# (member-write-guard does not stop `bash
|
|
211
|
+
# (member-write-guard does not stop `bash`) can keep the honest
|
|
213
212
|
# run-start digest on line 1 and move `root=` to a pristine clone of the
|
|
214
213
|
# workspace whose bytes match it — the old script hashed the tampered tree and
|
|
215
214
|
# refused; a check that trusted the pointer would certify the clone and pass.
|
|
@@ -228,7 +227,8 @@ if [ -n "$audit" ]; then
|
|
|
228
227
|
target=$(git -C "$audit" rev-parse --show-toplevel) \
|
|
229
228
|
|| die "$audit is not inside a git checkout — cannot identify the instrument set to pin"
|
|
230
229
|
elif [ "$pin" = true ] && [ -z "$home" ]; then
|
|
231
|
-
#
|
|
230
|
+
# The check path's unreadable-baseline refusals, mirrored here: a baseline
|
|
231
|
+
# that EXISTS but cannot
|
|
232
232
|
# be read names the tree this re-pin is supposed to keep certifying, and
|
|
233
233
|
# overwriting it blind would discard the pointer with no record that it was
|
|
234
234
|
# ever there.
|
|
@@ -260,21 +260,20 @@ if [ "$pin" != true ]; then
|
|
|
260
260
|
# case "no baseline" and prescribing `--pin` would walk a controller from
|
|
261
261
|
# "the check could not look" to "certified clean" in one step, discarding
|
|
262
262
|
# evidence it never read — the exact anti-pattern run-team/SKILL.md forbids.
|
|
263
|
-
# (#1058)
|
|
264
263
|
basedir="$(dirname "$base")"
|
|
265
264
|
|
|
266
265
|
# A directory that exists but cannot be searched (missing +x) hides
|
|
267
266
|
# everything under it from stat(2) — `[ -e "$base" ]` below reads FALSE for
|
|
268
267
|
# every file underneath, so without this check the run falls through to the
|
|
269
268
|
# "no baseline" message one level up: the exact mislabel this refusal exists
|
|
270
|
-
# to prevent, just moved from the file to its containing directory.
|
|
269
|
+
# to prevent, just moved from the file to its containing directory.
|
|
271
270
|
[ -d "$basedir" ] && [ ! -x "$basedir" ] \
|
|
272
271
|
&& die "$basedir exists but is unreadable — fix its permissions; do NOT --pin over it, --pin overwrites rather than compares"
|
|
273
272
|
|
|
274
273
|
# `-L` catches a dangling symlink: the link entry is present but its target
|
|
275
274
|
# is gone, so `-e` (which dereferences) reads FALSE and the run would
|
|
276
275
|
# otherwise fall through to the same "no baseline" message for a baseline
|
|
277
|
-
# that is very much present, just broken.
|
|
276
|
+
# that is very much present, just broken.
|
|
278
277
|
{ [ -e "$base" ] || [ -L "$base" ]; } && [ ! -r "$base" ] \
|
|
279
278
|
&& die "$base exists but is unreadable — fix its permissions; do NOT --pin over it, --pin overwrites rather than compares"
|
|
280
279
|
[ -r "$base" ] || die "no baseline at $base — run instruments.sh --pin once at run start"
|
|
@@ -345,7 +344,7 @@ git -C "$target" ls-files -z -- $set > "$files" \
|
|
|
345
344
|
# run at all leaves the second one hashing empty input and exiting 0, and the
|
|
346
345
|
# empty-input digest then compares unequal and reads as CHANGED. That is exit 1
|
|
347
346
|
# — a verdict about the tree — off a failure to look. reap.sh shipped this exact
|
|
348
|
-
# bug against `git cherry`
|
|
347
|
+
# bug against `git cherry` and it deleted branches.
|
|
349
348
|
#
|
|
350
349
|
# `xargs` exits 123 when `shasum` failed on any file, which is how a tracked
|
|
351
350
|
# file deleted from the worktree arrives: as exit 2 naming it, not as a digest
|
|
@@ -382,7 +381,7 @@ fi
|
|
|
382
381
|
|
|
383
382
|
# Cold path only, so it costs the ordinary run nothing. The controller has to
|
|
384
383
|
# report WHAT changed, and neither digest says. `git status` names the
|
|
385
|
-
# uncommitted half, which is the shape
|
|
384
|
+
# uncommitted half, which is the shape this header's measured near-miss took; a
|
|
386
385
|
# checked-out branch that moved shows as nothing here and the HEAD line is what
|
|
387
386
|
# names it. Both are read from the AUDITED tree, which is the one the verdict
|
|
388
387
|
# is about — not the state home the baseline was found in.
|
package/scripts/json.sh
CHANGED
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
# reads and has a SYNTAX error aborts before either guard on /bin/sh, bash 3.2
|
|
31
31
|
# and `bash --posix`, while bash 5.3 reaches the `|| die` with status 2. The
|
|
32
32
|
# suite does NOT cover that case: measured, a syntax error appended at EOF
|
|
33
|
-
# leaves bash 3.2 with every function it had already parsed and
|
|
33
|
+
# leaves bash 3.2 with every function it had already parsed and the suite
|
|
34
34
|
# stays green. CI's `shellcheck -x -S warning` over `git ls-files '*.sh'` is
|
|
35
35
|
# what catches it (SC1072/SC1073).
|
|
36
36
|
#
|
|
37
37
|
# `LC_ALL=C` is a per-command prefix on every tool below, never an export. Three
|
|
38
38
|
# of the callers (verify-sha.sh, prove-merge.sh, claim-ticket.sh) do not pin the
|
|
39
39
|
# locale, and exporting from a sourced lib would silently re-locale every OTHER
|
|
40
|
-
# tool in them. The prefix is a no-op in the five that do pin it
|
|
40
|
+
# tool in them. The prefix is a no-op in the five that do pin it, and
|
|
41
41
|
# closes the same hazard in the three that do not. It matters here because BSD
|
|
42
42
|
# `tr` exits 1 on a byte that is not valid UTF-8 under a UTF-8 locale, and
|
|
43
43
|
# `sed` emits nothing at all.
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
# zero-width word BOUNDARY to GNU sed and a literal `b` to BSD sed, so the rule
|
|
53
53
|
# would insert `\b` at every word edge on one and mangle every letter `b` on the
|
|
54
54
|
# other (measured, GNU sed 4.9 and macOS sed). \177 (DEL) is not a C0 byte and
|
|
55
|
-
# JSON permits it unescaped, so it is left alone
|
|
55
|
+
# JSON permits it unescaped, so it is left alone. Every remaining byte
|
|
56
56
|
# below \040 has no short form, \013 (VT) included — RFC 8259 lists exactly the
|
|
57
57
|
# five above and `\v` is not among them; `tr` turns it into a space, and
|
|
58
58
|
# `jrewritten` is how a caller finds out that happened, since a replaced value
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
# POSIX leaves this undefined and GNU sed's answer differs — so plain `N;$!ba`
|
|
71
71
|
# prints nothing at all for a single-line value.
|
|
72
72
|
#
|
|
73
|
-
# EVERY FALLIBLE STAGE'S STATUS IS READ HERE, and that is
|
|
73
|
+
# EVERY FALLIBLE STAGE'S STATUS IS READ HERE, and that is a fix rather
|
|
74
74
|
# than a style choice. A pipeline's status is its LAST stage's, so the
|
|
75
75
|
# original `printf | sed | tr` reported only `tr` — forcing `sed` to fail left
|
|
76
76
|
# jstr exiting 0 with an empty value and every caller's `|| die` unfired, while
|
|
77
|
-
# forcing `tr` worked (measured
|
|
77
|
+
# forcing `tr` worked (measured). POSIX sh has no `pipefail` and no
|
|
78
78
|
# `PIPESTATUS`, so each stage that can fail is captured and its status read.
|
|
79
79
|
# The consequence, and the rule a later edit is checked against: a pipeline may
|
|
80
80
|
# still END a function, but only where its LAST stage is the fallible one — `tr`
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
# indistinguishable one and `$( )` takes it off — `jstr` of `a<LF>` and of `a`
|
|
90
90
|
# are byte-identical (measured). No live caller can reach it: every argument
|
|
91
91
|
# reaching jstr today is a script literal or a `$( )`/`awk`/`read` capture that
|
|
92
|
-
# has already lost its own trailing newline.
|
|
92
|
+
# has already lost its own trailing newline. This file leaves it there rather than
|
|
93
93
|
# adding a sentinel no caller would exercise. jarr is the exception and is
|
|
94
94
|
# handled in its own note.
|
|
95
95
|
#
|
|
@@ -104,13 +104,13 @@
|
|
|
104
104
|
# sequence starts or continues with — sailed through untouched and landed raw
|
|
105
105
|
# in the payload: `jq` then silently substitutes U+FFFD on decode (changing
|
|
106
106
|
# what the caller reads back) and a strict parser (`python3 json.load`)
|
|
107
|
-
# refuses the payload outright
|
|
107
|
+
# refuses the payload outright. `jstr` and `jarr` now run the value
|
|
108
108
|
# through Python's own UTF-8 decoder with `errors="replace"` first — the same
|
|
109
109
|
# U+FFFD a lenient consumer already substitutes, made explicit and JSON-legal
|
|
110
110
|
# at the source instead of implicit and consumer-dependent — and `jrewritten`
|
|
111
111
|
# reports it as a rewrite like any other replaced byte.
|
|
112
112
|
|
|
113
|
-
# Python's own UTF-8 decoder with errors="replace"
|
|
113
|
+
# Python's own UTF-8 decoder with errors="replace", shared script text
|
|
114
114
|
# rather than a function: a function called on the right side of a pipe runs
|
|
115
115
|
# in its own subshell, and a `json_u8=` assigned inside it would not survive
|
|
116
116
|
# back to the caller — every call site below runs this as
|
|
@@ -123,7 +123,7 @@ sys.stdout.buffer.write(sys.stdin.buffer.read().decode("utf-8", "replace").encod
|
|
|
123
123
|
# Escape $1 into a JSON string BODY — no surrounding quotes, the caller adds
|
|
124
124
|
# those. Exit 0 with the escaped value, non-zero if any stage failed.
|
|
125
125
|
jstr() {
|
|
126
|
-
# Empty in, empty out, no fork at all
|
|
126
|
+
# Empty in, empty out, no fork at all. This is what lets a PATH-wide
|
|
127
127
|
# sed/tr outage — the failure inflight.sh measures at its own top — leave a
|
|
128
128
|
# field that legitimately found nothing untouched: that field never calls the
|
|
129
129
|
# broken tool, so it cannot observe its failure.
|
|
@@ -179,7 +179,7 @@ jrewritten() {
|
|
|
179
179
|
# short-circuit above existed).
|
|
180
180
|
json_ascii=$(printf '%s' "$1" | LC_ALL=C tr -d '\200-\377') || return 1
|
|
181
181
|
[ "$json_ascii" = "$json_orig" ] && { printf false; return 0; }
|
|
182
|
-
# jstr also repairs a byte that is not valid UTF-8
|
|
182
|
+
# jstr also repairs a byte that is not valid UTF-8 — a second,
|
|
183
183
|
# independent replacement alongside the C0 scrub above, so a second,
|
|
184
184
|
# independent check: this value must decode as strict UTF-8 unchanged, or
|
|
185
185
|
# jstr rewrote it too.
|
|
@@ -194,15 +194,14 @@ jrewritten() {
|
|
|
194
194
|
# boundary between two elements by the time a value reaches per-line stdin,
|
|
195
195
|
# which is why no-undo-audit.sh refuses a conflicting path holding one before it
|
|
196
196
|
# ever calls this. Escaping a byte this function structurally never receives
|
|
197
|
-
# would be dead code standing in for a restructure nobody has needed
|
|
198
|
-
# that class.
|
|
197
|
+
# would be dead code standing in for a restructure nobody has needed.
|
|
199
198
|
#
|
|
200
199
|
# Empty stdin gives empty stdout at exit 0 — measured as the original
|
|
201
200
|
# pipeline's behaviour, and the `[ -n ]` guard is what preserves it: without it
|
|
202
201
|
# the `printf '%s\n'` re-emit below would turn "no elements" into one empty
|
|
203
202
|
# line and `paste` would answer `""`, inventing an element out of nothing.
|
|
204
203
|
jarr() {
|
|
205
|
-
# Same repair as jstr, same reason
|
|
204
|
+
# Same repair as jstr, same reason, run once over the whole
|
|
206
205
|
# (possibly multi-line) input rather than per line: \n is ASCII and never a
|
|
207
206
|
# byte of a multi-byte UTF-8 sequence, so decoding the joined blob in one
|
|
208
207
|
# pass cannot manufacture or hide a line boundary.
|
package/scripts/net.sh
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# shellcheck shell=sh
|
|
2
|
-
# The fleet's bounded, prompt-suppressed git transport
|
|
2
|
+
# The fleet's bounded, prompt-suppressed git transport.
|
|
3
3
|
# Sourced, never executed — no shebang, and the `shell=sh` directive above is
|
|
4
4
|
# what tells shellcheck what to check it as.
|
|
5
5
|
#
|
|
@@ -16,19 +16,19 @@
|
|
|
16
16
|
# builtin, so failing to open its operand aborts a non-interactive shell before
|
|
17
17
|
# any `||` on the line can run.
|
|
18
18
|
#
|
|
19
|
-
# WHY A LIB.
|
|
19
|
+
# WHY A LIB. This mechanism first landed inside inflight.sh's probe 2, for the
|
|
20
20
|
# one call that probe makes. Every other unattended `git` network call in the
|
|
21
21
|
# fleet — release-ticket.sh's pushed-branch lookup, and the fetches in
|
|
22
22
|
# prove-merge.sh, reap.sh and verify-sha.sh — still ran raw, so each of them
|
|
23
23
|
# could prompt on a credential or a host key, or stall on a transport that
|
|
24
|
-
# connects and then goes quiet, holding a fleet slot indefinitely
|
|
24
|
+
# connects and then goes quiet, holding a fleet slot indefinitely. The
|
|
25
25
|
# alternative considered was copying the transport flags to each call site; it
|
|
26
26
|
# is what this file exists to avoid, and it would not have bounded the connect
|
|
27
27
|
# phase in any case, since git exposes no knob for it. So the mechanism moved
|
|
28
28
|
# here whole and probe 2 became its first caller rather than its owner.
|
|
29
29
|
#
|
|
30
|
-
# `gh` calls are deliberately NOT routed through this. Measured
|
|
31
|
-
#
|
|
30
|
+
# `gh` calls are deliberately NOT routed through this. Measured: `gh issue
|
|
31
|
+
# view` against a silent listener failed on its own at
|
|
32
32
|
# 10.0s with `net/http: TLS handshake timeout` — `gh` is already bounded, and
|
|
33
33
|
# wrapping it would buy a second bound over the first.
|
|
34
34
|
#
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
# The override exists so the tests can buy a short budget instead of paying the
|
|
42
42
|
# default one per case. It can only ever SHORTEN: a knob that could lengthen it
|
|
43
43
|
# would be one more way for configuration to remove the bound, which is the
|
|
44
|
-
# defect
|
|
44
|
+
# defect this lib exists to close, and reproducing it here to be convenient
|
|
45
45
|
# would be its own bug. A value that is not a positive integer is not an error
|
|
46
46
|
# and not a bound either — the default stands.
|
|
47
47
|
#
|
|
@@ -100,11 +100,12 @@ net_fetch_budget() {
|
|
|
100
100
|
# reparents its children and the links this walk follows are gone by then.
|
|
101
101
|
#
|
|
102
102
|
# Ceiling: with no `ps` to read, this falls back to the named process alone and
|
|
103
|
-
# a helper can survive it. That is the
|
|
104
|
-
# a new failure, and it is preferred over signalling a set
|
|
103
|
+
# a helper can survive it. That is the old named-process-only kill for that
|
|
104
|
+
# one case, not a new failure, and it is preferred over signalling a set
|
|
105
|
+
# derived from nothing.
|
|
105
106
|
# But it is not silent: the fallback records itself in $net_wdfile so the reason
|
|
106
107
|
# printed downstream can say the bound may not have held. A degraded kill that
|
|
107
|
-
# reads exactly like a clean one is
|
|
108
|
+
# reads exactly like a clean one is a defect this script must not
|
|
108
109
|
# have — measured, `ps` shimmed to exit 127 produced byte-identical stderr to
|
|
109
110
|
# the healthy run while a `git remote-https` survived and held the caller for
|
|
110
111
|
# its whole cap. `${net_wdfile:-/dev/null}` because net_kill_tree also runs
|
|
@@ -126,7 +127,7 @@ net_fetch_budget() {
|
|
|
126
127
|
# parents first, which is exactly why every end-to-end case here stays green on
|
|
127
128
|
# that mutant.
|
|
128
129
|
#
|
|
129
|
-
# What holds it is the descending-pid chain in
|
|
130
|
+
# What holds it is the descending-pid chain in the suite's net_kill_tree
|
|
130
131
|
# case — each child's pid BELOW its parent's, the shape pid wraparound produces.
|
|
131
132
|
# Feeding the rows in a different order does not hold it: the hash order is not
|
|
132
133
|
# the input order, and measured, the same key set fed parents-first and
|
|
@@ -234,7 +235,7 @@ net_stalled() {
|
|
|
234
235
|
# above: it gates the banner exchange, not only the TCP handshake, so a peer
|
|
235
236
|
# that accepts the connection and then never speaks is cut off at
|
|
236
237
|
# ConnectTimeout. Measured against that exact case (OpenSSH_10.2p1, the
|
|
237
|
-
# accept-then-silent listener
|
|
238
|
+
# suite's accept-then-silent listener) — both
|
|
238
239
|
# options set: "Connection timed out during banner exchange" at 10.0s;
|
|
239
240
|
# ConnectTimeout alone, ServerAlive dropped: 10.0s, identical; ServerAlive
|
|
240
241
|
# alone, ConnectTimeout dropped: still running at 30s, killed from outside.
|
|
@@ -269,9 +270,9 @@ net_stalled() {
|
|
|
269
270
|
# asked for, and terminates only where that value does. Measured on the same
|
|
270
271
|
# listener: a user ConnectTimeout of 0 is accepted, wins by the same rule and
|
|
271
272
|
# left the call still connecting at 40s, where the 10s set here cut at 10.2s —
|
|
272
|
-
# unbounded, through the user's own config, which is the
|
|
273
|
+
# unbounded, through the user's own config, which is the unattended hang again. The
|
|
273
274
|
# watchdog below is what now bounds that case, since it bounds the call rather
|
|
274
|
-
# than the transport and so does not depend on any value ssh resolved
|
|
275
|
+
# than the transport and so does not depend on any value ssh resolved.
|
|
275
276
|
# Ordering these first would bound the call at its own value instead,
|
|
276
277
|
# at the cost of silently overriding a deliberate proxy or timeout config: a
|
|
277
278
|
# real regression traded for a hypothetical one, so it is not done.
|
|
@@ -283,7 +284,7 @@ net_stalled() {
|
|
|
283
284
|
# the BatchMode=yes set here alone, an unknown host key fails at once ("Host key
|
|
284
285
|
# verification failed"); with a user's BatchMode=no ahead of it and a terminal
|
|
285
286
|
# reachable, ssh sat on "Are you sure you want to continue connecting" until
|
|
286
|
-
# killed — the unattended hang
|
|
287
|
+
# killed — the unattended hang this lib exists to stop. Reachable is the operative
|
|
287
288
|
# word: with no terminal available it aborts rather than waiting. Honoured
|
|
288
289
|
# anyway, because it is the user's explicit setting; this records what that
|
|
289
290
|
# costs rather than warning about a choice they made on purpose. The watchdog
|
|
@@ -291,7 +292,7 @@ net_stalled() {
|
|
|
291
292
|
# the prompt is ssh's, so no git-side variable reaches it, and the setting that
|
|
292
293
|
# opens it is the user's own, so overriding it is not on offer either. No test
|
|
293
294
|
# covers this one — the exposure needs a reachable terminal, and the harness
|
|
294
|
-
# runs without one, where ssh aborts at once instead of asking
|
|
295
|
+
# runs without one, where ssh aborts at once instead of asking.
|
|
295
296
|
#
|
|
296
297
|
# http: lowSpeedLimit/lowSpeedTime is git's (curl's) own bound for a transfer
|
|
297
298
|
# that goes quiet — abort if it sits under 1000 bytes/s for 10s.
|
|
@@ -308,7 +309,7 @@ net_stalled() {
|
|
|
308
309
|
# script does not set and cannot shorten.
|
|
309
310
|
#
|
|
310
311
|
# Hence the watchdog below, and hence these knobs are no longer the bound. They
|
|
311
|
-
# stay anyway, and that is a decision rather than an oversight
|
|
312
|
+
# stay anyway, and that is a decision rather than an oversight: each one
|
|
312
313
|
# fails earlier than the watchdog and in git's own words, which is the more
|
|
313
314
|
# useful thing to read on a terminal, and dropping them would make every ssh
|
|
314
315
|
# stall wait out the full budget where ConnectTimeout ends it in a fraction of
|
|
@@ -320,9 +321,10 @@ net_stalled() {
|
|
|
320
321
|
# call — its own `sleep` is a child, and an orphaned sleeper does not sit
|
|
321
322
|
# harmlessly: it wakes at the end of its budget and fires net_kill_tree at a pid
|
|
322
323
|
# this shell no longer owns, which after a budget's worth of pid churn can be an
|
|
323
|
-
# unrelated process — and,
|
|
324
|
-
#
|
|
325
|
-
# is on the sleeper itself and both
|
|
324
|
+
# unrelated process — and, because the kill walks every descendant, that
|
|
325
|
+
# process's whole SUBTREE. It cannot leak onto the caller's stderr whatever else
|
|
326
|
+
# it does, because the `>/dev/null 2>&1` below is on the sleeper itself and both
|
|
327
|
+
# its descriptors are already closed.
|
|
326
328
|
#
|
|
327
329
|
# `wait` is captured through an explicit `|| net_status=$?`, and `set -e` is
|
|
328
330
|
# why: a bare `wait` on a killed child aborts at that line, which is after the
|
|
@@ -352,7 +354,7 @@ net_git() {
|
|
|
352
354
|
# sends TERM then KILL with no pause, so whichever one reaps the job first is
|
|
353
355
|
# a race, not a property either shell owns. What the shell DOES fix is the
|
|
354
356
|
# FORM — bash-as-sh names the job (the long form); dash's notice is bare, just
|
|
355
|
-
# `<signal>: <n>`. Measured
|
|
357
|
+
# `<signal>: <n>`. Measured by replaying net_git's own mechanism
|
|
356
358
|
# against a plain `sleep`: on this machine, `/bin/sh` (bash 3.2.57) and
|
|
357
359
|
# `/bin/dash` both gave TERM, every run — a quiet-system sample, not a signal
|
|
358
360
|
# either shell is owed, which is why a caller has to accept either.
|
|
@@ -379,7 +381,7 @@ net_git() {
|
|
|
379
381
|
# worktree directory, HEAD, or anything else in the entry — is pruned on
|
|
380
382
|
# sight: the 3-month floor bounds staleness git can measure from the
|
|
381
383
|
# entry's own files, and a missing pointer gives it nothing to measure,
|
|
382
|
-
# so the floor does not apply. Measured
|
|
384
|
+
# so the floor does not apply. Measured: a fixture with exactly
|
|
383
385
|
# that fault, fetched through this function unmodified, loses the
|
|
384
386
|
# registry entry between the fetch returning and the caller's own next
|
|
385
387
|
# read of it — a worktree whose fault is seconds old, not months.
|
package/scripts/prove-merge.sh
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
# parent that looks right.
|
|
34
34
|
#
|
|
35
35
|
# The payload splits the checks into three kinds, because a flat object could not
|
|
36
|
-
# say which of its fields were load-bearing for the verdict it sits next to
|
|
36
|
+
# say which of its fields were load-bearing for the verdict it sits next to:
|
|
37
37
|
#
|
|
38
38
|
# preconditions — every `die` above the verdict. They exit 2 with NO payload, so
|
|
39
39
|
# they never appear as a false field beside `proved`. `merge ∈
|
|
@@ -55,7 +55,7 @@ set -eu
|
|
|
55
55
|
NAME=prove-merge
|
|
56
56
|
die() { printf '%s: %s\n' "$NAME" "$1" >&2; exit 2; }
|
|
57
57
|
|
|
58
|
-
# The escaping helpers
|
|
58
|
+
# The escaping helpers. json.sh's header holds the sourcing contract and
|
|
59
59
|
# the measurements behind it. Exit 1 out of THIS script means "the proof is a
|
|
60
60
|
# no", which the merge bot reads as a reason to refuse a merge, so a missing
|
|
61
61
|
# library must not be able to say it — which is why `[ -r ]` has to fire before
|
|
@@ -66,7 +66,7 @@ json_lib="$(dirname "$0")/json.sh"
|
|
|
66
66
|
# shellcheck source=json.sh
|
|
67
67
|
. "$json_lib" || die "$json_lib failed to load"
|
|
68
68
|
|
|
69
|
-
# The bounded, prompt-suppressed git transport
|
|
69
|
+
# The bounded, prompt-suppressed git transport. The fetch
|
|
70
70
|
# below is unattended: with no bound it can prompt for a credential or a host
|
|
71
71
|
# key, or stall on a transport that connects and then goes quiet, and either
|
|
72
72
|
# holds a fleet slot until something outside kills it. net.sh's header holds the
|
|
@@ -116,7 +116,7 @@ for obj in "$pre" "$post" "$merge"; do
|
|
|
116
116
|
git cat-file -e "${obj}^{commit}" || die "cannot resolve $obj to a commit in this repository"
|
|
117
117
|
# -e above peels through a tag to reach the commit underneath, so an
|
|
118
118
|
# annotated tag clears that line even though $obj itself is not a commit —
|
|
119
|
-
# only the object at the far end of the peel is
|
|
119
|
+
# only the object at the far end of the peel is. $pre and $post are
|
|
120
120
|
# then resolved UNPEELED by plain `git rev-parse` below, so a tag there hands
|
|
121
121
|
# back the tag object's own sha rather than the commit's, and the identity
|
|
122
122
|
# test later in this script compares that against a commit sha and can never
|
|
@@ -139,7 +139,7 @@ echo "\$ git merge-base --is-ancestor $merge $base" >&2
|
|
|
139
139
|
# Assigned first, not tested inline: `die` inside `$(...)` exits the subshell,
|
|
140
140
|
# and `[ ]` discards that status, so `set -e` never fires and a probe that could
|
|
141
141
|
# not answer falls through to the disproof below — a verdict never established.
|
|
142
|
-
# An assignment is a simple command, so its status is the substitution's
|
|
142
|
+
# An assignment is a simple command, so its status is the substitution's.
|
|
143
143
|
merge_anc=$(is_ancestor "$merge" "$base")
|
|
144
144
|
[ "$merge_anc" = true ] || die "$merge is not reachable from $base — that merge did not land"
|
|
145
145
|
|
|
@@ -213,8 +213,8 @@ echo "$NAME: proved=$proved (path=$proof_path)" >&2
|
|
|
213
213
|
# come from `git rev-parse`, 40 hex characters and nothing else, and
|
|
214
214
|
# `$proof_path` is this script's own `rebase`/`no-rebase` literal. They go
|
|
215
215
|
# through `jstr` for uniformity against a later edit that changes where a field
|
|
216
|
-
# comes from, the same reason inflight.sh wraps `$pr`, and it costs nothing
|
|
217
|
-
#
|
|
216
|
+
# comes from, the same reason inflight.sh wraps `$pr`, and it costs nothing.
|
|
217
|
+
# Assigned before the printf, never inline in its argument list — a
|
|
218
218
|
# `$()` there sits outside this `|| die`, contributes an empty argument on
|
|
219
219
|
# failure, and printf still exits 0 with a malformed payload.
|
|
220
220
|
second_j=$(jstr "$second") && first_j=$(jstr "$first") && path_j=$(jstr "$proof_path") \
|