@feigi/fleet-ctl 3.30.18 → 3.30.20
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.
|
@@ -65,14 +65,20 @@ and revise.
|
|
|
65
65
|
**Then prove it, with ONE of:**
|
|
66
66
|
|
|
67
67
|
- **The count proof** — when the runner prints how many tests it ran. Copy
|
|
68
|
-
that summary line
|
|
69
|
-
|
|
68
|
+
text off that summary line, as printed, into `--count-line`, and the number
|
|
69
|
+
of tests that ran into `--test-count`:
|
|
70
70
|
|
|
71
71
|
~/.fleet/bin/fleet-run recipe-prove.mjs <repo> --install '<install>' --test '<test>' \
|
|
72
72
|
--count-line '<literal text of the count line>' --test-count <n>
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
The number is the tests that ran — never the skipped, the failed, or a
|
|
75
|
+
total that includes skips. A runner whose count includes its skipped tests
|
|
76
|
+
(Maven Surefire's `Tests run:`, node's `# tests`) prints no number that is
|
|
77
|
+
the tests that ran: prove it with the mutation proof instead. Trim the
|
|
78
|
+
literal to the text around that one number, so it carries no other:
|
|
79
|
+
`5 passed` off pytest's `5 passed, 2 skipped in 0.31s`. A literal carrying
|
|
80
|
+
any other number is refused. Copy only text that is the same on every run —
|
|
81
|
+
the count, not a duration. A count of 0 is a failed proof, never a pass.
|
|
76
82
|
- **The mutation proof** — when the runner prints no count, or prints one
|
|
77
83
|
you cannot pin. It needs the unmutated run green. Choose one test and write
|
|
78
84
|
a shell command that breaks it deliberately: change an expected value in
|
package/package.json
CHANGED
package/scripts/recipe-prove.mjs
CHANGED
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
// execute"/"not found". A red suite is not a failed proof by itself.
|
|
23
23
|
// 3. Real tests must be shown to have executed, by at least one of:
|
|
24
24
|
// - the count proof: `--count-line` is a literal the run's own output
|
|
25
|
-
// must contain (the runner's summary line, read off a
|
|
26
|
-
// carrying `--test-count`, a positive integer
|
|
27
|
-
// proof however honestly the runner
|
|
25
|
+
// must contain (text off the runner's summary line, read off a
|
|
26
|
+
// previous run), carrying `--test-count`, a positive integer, as its
|
|
27
|
+
// one number. `tests 0` is a failed proof however honestly the runner
|
|
28
|
+
// reports it.
|
|
28
29
|
// - the mutation proof: the unmutated run must be green; `--mutate` is a
|
|
29
30
|
// shell command that must change a tracked file (the deliberate
|
|
30
31
|
// failing mutation of one test, or of the code one test covers) — run
|
|
@@ -259,8 +260,13 @@ function prove(o, wt, logs) {
|
|
|
259
260
|
if (o.countLine !== undefined) {
|
|
260
261
|
const n = Number(o.testCount);
|
|
261
262
|
if (n === 0) throw notProven(`vacuous: a test count of 0 is a run that executed no tests; ${where}`);
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
// The claim must be the line's ONE number, never merely one of its numbers:
|
|
264
|
+
// a summary line carrying several can carry the claim as its skipped count
|
|
265
|
+
// while the run itself executed none. Its first number is no rule either —
|
|
266
|
+
// a runner may print its skips before its count.
|
|
267
|
+
const numbers = o.countLine.match(/[0-9]+/g) ?? [];
|
|
268
|
+
if (numbers.length !== 1 || BigInt(numbers[0]) !== BigInt(o.testCount)) {
|
|
269
|
+
throw notProven(`the count line '${o.countLine}' does not carry the test count ${o.testCount} as its one number (it carries ${numbers.length ? numbers.join(", ") : "none"}) — trim it to the number of tests that ran; ${where}`);
|
|
264
270
|
}
|
|
265
271
|
if (!readFileSync(testLog, "utf8").includes(o.countLine)) {
|
|
266
272
|
throw notProven(`vacuous: the Test entrypoint's output does not contain the count line '${o.countLine}' — no evidence any test ran; ${where}`);
|
package/skills/run-team/SKILL.md
CHANGED
|
@@ -1847,11 +1847,7 @@ while :; do # one tick
|
|
|
1847
1847
|
echo "WATCHER DEGRADED: core REST budget=$rl — CI polling paused, silence is NOT green"
|
|
1848
1848
|
budget_out=1
|
|
1849
1849
|
fi
|
|
1850
|
-
else
|
|
1851
|
-
if [ -n "$budget_out" ]; then
|
|
1852
|
-
echo "WATCHER RECOVERED: core budget=$rl — CI polling resumed"
|
|
1853
|
-
budget_out=
|
|
1854
|
-
fi
|
|
1850
|
+
else # budget RECOVERED waits for the per-pass gate below
|
|
1855
1851
|
prs=$(gh pr list --state open --limit "$pr_cap" --json number --jq '.[].number' 2>/dev/null) || prs=ERR
|
|
1856
1852
|
if [ "$prs" = ERR ]; then
|
|
1857
1853
|
if [ -z "$list_out" ]; then # global latch: this cause is account-level too
|
|
@@ -1863,7 +1859,8 @@ while :; do # one tick
|
|
|
1863
1859
|
echo "WATCHER RECOVERED: open-PR list readable again — CI polling resumed"
|
|
1864
1860
|
list_out=
|
|
1865
1861
|
fi
|
|
1866
|
-
|
|
1862
|
+
count=$(printf '%s\n' "$prs" | grep -c .) || : # grep -c exits 1 on zero matches; set -e must not take it
|
|
1863
|
+
if [ "$count" -ge "$pr_cap" ]; then
|
|
1867
1864
|
if [ -z "$cap_out" ]; then # global latch: a full page may have been cut there
|
|
1868
1865
|
echo "WATCHER DEGRADED: open-PR list hit its --limit $pr_cap — PRs past it are NOT watched, silence on them is NOT green"
|
|
1869
1866
|
cap_out=1
|
|
@@ -1872,21 +1869,36 @@ while :; do # one tick
|
|
|
1872
1869
|
echo "WATCHER RECOVERED: open-PR list under its --limit $pr_cap — every open PR watched again"
|
|
1873
1870
|
cap_out=
|
|
1874
1871
|
fi
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1872
|
+
# gh pr list is GraphQL, so $rl still holds. The pass is budgeted at 4 core
|
|
1873
|
+
# REST units per listed PR on top of the 200 floor — an allowance, not a
|
|
1874
|
+
# count: one ci-state.mjs call makes several REST reads (more for a PR whose
|
|
1875
|
+
# head dropped required jobs). A shortfall pauses this tick's pass.
|
|
1876
|
+
if [ "$rl" -lt $((200 + 4 * count)) ]; then
|
|
1877
|
+
if [ -z "$budget_out" ]; then
|
|
1878
|
+
echo "WATCHER DEGRADED: core REST budget=$rl < $((200 + 4 * count)) needed for $count PRs — CI polling paused, silence is NOT green"
|
|
1879
|
+
budget_out=1
|
|
1880
|
+
fi
|
|
1881
|
+
else
|
|
1882
|
+
if [ -n "$budget_out" ]; then
|
|
1883
|
+
echo "WATCHER RECOVERED: core budget=$rl — CI polling resumed"
|
|
1884
|
+
budget_out=
|
|
1883
1885
|
fi
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1886
|
+
for pr in $(printf '%s\n' "$prs"); do # inline $(...): `for pr in $prs` is ONE iteration under zsh
|
|
1887
|
+
st=$(~/.fleet/bin/fleet-run ci-state.mjs --pr "$pr" 2>/dev/null) || : # not-green exits non-zero; the payload is the verdict
|
|
1888
|
+
if ! printf '%s' "$st" | jq -e '.verdict and .verdict != "rate-limited"' >/dev/null 2>&1; then
|
|
1889
|
+
case " $blind " in *" $pr "*) ;; *) # latch keyed BY PR: this cause is per-PR
|
|
1890
|
+
echo "WATCHER DEGRADED: no usable ci-state reading for #$pr — silence is NOT green"
|
|
1891
|
+
blind="$blind $pr" ;;
|
|
1892
|
+
esac
|
|
1893
|
+
continue # inner continue — still reaches the tick sleep
|
|
1894
|
+
fi
|
|
1895
|
+
case " $blind " in *" $pr "*)
|
|
1896
|
+
echo "WATCHER RECOVERED: ci-state reading #$pr again — CI polling resumed"
|
|
1897
|
+
keep=; for b in $(printf '%s\n' "$blind"); do [ "$b" = "$pr" ] || keep="$keep $b"; done; blind=$keep ;;
|
|
1898
|
+
esac
|
|
1899
|
+
: # your normal handling of $st for this PR
|
|
1900
|
+
done
|
|
1901
|
+
fi
|
|
1890
1902
|
fi
|
|
1891
1903
|
fi
|
|
1892
1904
|
sleep 120 # the block's only pacing, once per tick
|
|
@@ -1954,6 +1966,23 @@ enforce. It latches globally like the list failure but does not pause polling:
|
|
|
1954
1966
|
the PRs it did return are real, so the pass still watches them, and the
|
|
1955
1967
|
DEGRADED line names the rest as unwatched until a pass comes back under the cap.
|
|
1956
1968
|
|
|
1969
|
+
**The budget is gated twice, and only the second gate announces recovery.** The
|
|
1970
|
+
tick-top floor (`200`) covers the probes themselves. Once the open-PR list is
|
|
1971
|
+
read, the pass gate reserves `200 + 4 × count` core REST units — an allowance of
|
|
1972
|
+
4 per listed PR on top of the floor, so the reserve grows with the list instead
|
|
1973
|
+
of staying a flat 200 that a long list drains mid-pass. It is an allowance, not
|
|
1974
|
+
a count: one `ci-state.mjs` call makes several REST reads, more for a PR whose
|
|
1975
|
+
head dropped required jobs. A shortfall at either gate pauses the **whole** pass
|
|
1976
|
+
through the one budget latch and never polls a prefix of the list: a prefix runs
|
|
1977
|
+
in list order, so the same tail PRs would go unread every tick with no line at
|
|
1978
|
+
all (never polled, so nothing marks them blind), while the PRs that were polled
|
|
1979
|
+
would run dry mid-pass and each emit a blind line. The DEGRADED line from the
|
|
1980
|
+
pass gate names the amount it needed and the count it needed it for, so a
|
|
1981
|
+
healthy-looking `budget=999` is not read as an outage with no cause. Only the
|
|
1982
|
+
pass gate emits the budget RECOVERED line: announcing recovery at the floor
|
|
1983
|
+
would report resumption on a tick whose pass gate then pauses it again — a
|
|
1984
|
+
DEGRADED/RECOVERED pair every tick.
|
|
1985
|
+
|
|
1957
1986
|
**Judge `ci-state` on its payload, never its exit code** — the same rule as
|
|
1958
1987
|
`merge-gate.mjs` applies on the merge path, applied to the watcher. `not-green` is an
|
|
1959
1988
|
ordinary, frequent state that exits non-zero, so a watcher treating any non-zero
|