Repository navigation
CI: adopt ci-kit; timing tests assert events, not speed - #143
Conversation
…ile (#123) The host runs in its own process and binds its socket path before it listens, so a client that connects as soon as the file appears can be refused (ECONNREFUSED, seen in three tests of this file under load). start() now waits for an accepted connection, and every wait's ceiling is a 20 s liveness bound rather than 5 s.
Teardown sends SIGKILL at 0.7 of its budget and must observe the group empty in the rest, so a 3 s budget left a
loaded machine 0.9 s to deliver the signal and run pgrep: 'owned descendants ... are reaped' read unconfirmed at
3.26 s on a hosted macOS runner under 2x CPU load, and the same family ('group enumeration failed or timed out') on the
MacBook. Confirming teardowns now get 10 s, and the waits for a reply or a pid file end on their condition within a
20 s liveness bound instead of a fixed number of polls.
Three tests judged a budget against the wall clock and failed when the machine was slow between two of the controller's steps: 'timeoutMs 368 with 365 ms left' (and 288 with 285), the joined caller that did not re-attach because the host double's timer fired before the starter's deadline read as spent, and the dispatch-time check of a deadline that runs out during attachment. Time now passes only as the test moves it (node:test mock timers), so each setup command's allowance is asserted exactly (380, 360, 340, 320) and the starter's deadline is spent exactly when the host times out.
Which sentence ends a polling click depends on where its budget runs out, and on a loaded machine it can run out
mid-attempt, giving a third ending the tests did not accept ('... CDP operation exceeded its deadline before command
dispatch', seen for the element without a box). On a controlled clock the budget runs out at the same point everywhere,
so the element-without-box and never-enabled tests assert the exact sentence, that a missing element is polled every
100 ms until its budget ends, and that nothing was clicked.
… not a delay 'during the drain a new elicitation is not asked of the departed client' ended input 100 ms after submitting a cell whose service asked 300 ms later; on a loaded machine the host read the EOF after that, so the 'late' request reached the client (6 failures in the MacBook's logs). The service now asks it only after its first request was withdrawn, which the host does when the drain begins. 'Answered at once' is now a liveness bound of half the cell's 30 s budget (one run took 5.3 s against 2.5 s), the wait for the first request ends on its condition, and the per-test ceiling is 60 s.
…iveness bound Their waits for a socket, an event or a closed client gave up after 3 s, a speed claim a loaded machine can miss (the in-process host tests named in tech-debt (b)). The condition still ends each wait; the ceiling is now 20 s.
The connector writes its result file in one write, and the test parsed it as soon as the file existed: under 2x CPU
load on a hosted macOS runner that read caught it empty ('Unexpected end of JSON input', 1 of 4 runs). The wait now
ends when the file parses.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
'a fill's paste has the caller's budget' failed once in the 20-run ci-gate series on a hosted macOS runner (1 paste for 0): the wait in the clipboard queue rejected on its timer, the test released the queue at once, and the queued paste's own deadline check still read the budget as unspent, because a loaded event loop can fire a timer before Date.now() reaches its end. On a controlled clock the timeout and the spent budget are the same instant. The next test (a shortcut queued behind another) has the same shape and a 500 ms speed claim; it moves too, and now asserts that the rejection came at its 300 ms budget.
ac852d9 to
9ab5439
Compare
|
A10 proof scripts (ci-kit M2). Each A10 round was a
#!/bin/bash
# Temporary (ci-kit M2, A10): a fixed test file before and after its fix, 20 runs each, under an induced CPU load of 2x
# the cores (`yes` loops; stress-ng is absent on the macOS runner). Runs go 4 at a time, as the full suite runs files
# side by side. The before set runs in batches of 4 until a run fails or <before runs> (default 20) were made.
# A run still going after 240 s is killed and counts as failed. A10_LOAD_FACTOR (default 2) sets the loops per core.
# Usage: a10.sh <test file> [name pattern] [before runs]. Exits 1 if any after-run failed.
file=$1 pattern=${2:-} before_max=${3:-20}
before="${file%.mjs}.a10before.mjs"
n=$(sysctl -n hw.ncpu 2>/dev/null || nproc)
factor=${A10_LOAD_FACTOR:-2}
for i in $(seq $((factor * n))); do (yes > /dev/null &); done
trap 'pkill -x yes' EXIT
echo "cores=$n load=$((factor * n)) yes loops; $(uptime)"
mkdir -p a10-out
after_failed=0
run_set() {
label=$1 path=$2 max=$3 pass=0 fail=0 batch=0
while [ $((batch * 4)) -lt "$max" ]; do
batch=$((batch + 1))
if [ "$label" = before ] && [ "$fail" -gt 0 ]; then break; fi
pids=""
for i in 1 2 3 4; do
if [ -n "$pattern" ]; then
( HOME=$(mktemp -d) perl -e 'alarm 240; exec @ARGV' node --test --test-reporter=tap --test-name-pattern="$pattern" "$path" > "a10-out/$label-$batch-$i.tap" 2>&1 ) &
else
( HOME=$(mktemp -d) perl -e 'alarm 240; exec @ARGV' node --test --test-reporter=tap "$path" > "a10-out/$label-$batch-$i.tap" 2>&1 ) &
fi
pids="$pids $!"
done
for p in $pids; do if wait "$p"; then pass=$((pass + 1)); else fail=$((fail + 1)); fi; done
done
tests=$(cat a10-out/$label-*.tap | grep -E '^# pass ' | awk '{print $3}' | sort -u | tr '\n' ' ')
echo "A10 $label $file${pattern:+ [$pattern]}: pass $pass/$((pass + fail)), fail $fail/$((pass + fail)); passing tests per run: $tests; $(uptime | sed 's/.*averages*: //')"
grep -h '^not ok' a10-out/$label-*.tap | sed 's/^not ok [0-9]* - / failed: /' | sort | uniq -c
grep -h -A8 '^not ok' a10-out/$label-*.tap | grep -E "^ error:" | cut -c1-200 | sort | uniq -c
[ "$label" = after ] && after_failed=$fail
}
run_set before "$before" "$before_max"
run_set after "$file" 20
[ "$after_failed" = 0 ]
#!/bin/bash
# Temporary (ci-kit M2, A10): like a10.sh, one run at a time, each cut at 150 s, and every process a run left under
# src/repl-host/ killed before the next (a hung own-host run otherwise piles up kernels and wedges the runner).
# Usage: a10-seq.sh <test file> <name pattern> [runs per side]
file=$1 pattern=$2 runs=${3:-20}
shift 3 2>/dev/null || shift $#
before="${file%.mjs}.a10before.mjs"
n=$(sysctl -n hw.ncpu 2>/dev/null || nproc)
for i in $(seq $((2 * n))); do (yes > /dev/null &); done
trap 'pkill -x yes' EXIT
echo "cores=$n load=$((2 * n)) yes loops; $(uptime)"
mkdir -p a10-out
after_failed=0
for label in before after; do
path=$file; [ $label = before ] && path=$before
pass=0 fail=0
for i in $(seq "$runs"); do
start=$(date +%s)
if [ -n "$pattern" ]; then set -- --test-name-pattern="$pattern"; else set --; fi
if HOME=$(mktemp -d) perl -e 'alarm 150; exec @ARGV' node --test --test-reporter=tap "$@" "$path" > "a10-out/$label-$i.tap" 2>&1; then
pass=$((pass + 1)); r=pass
else
fail=$((fail + 1)); r=FAIL
fi
pkill -9 -f "src/repl-host/" 2>/dev/null
echo " $label run $i: $r in $(( $(date +%s) - start ))s; $(grep -h '^not ok' a10-out/$label-$i.tap | tr '\n' ' ')"
[ $label = before ] && [ $fail -gt 0 ] && break
done
echo "A10 $label $file [$pattern]: pass $pass/$((pass + fail)), fail $fail/$((pass + fail)); $(uptime | sed 's/.*averages*: //')"
grep -h -A8 '^not ok' a10-out/$label-*.tap | grep -E "^ error:" | cut -c1-200 | sort | uniq -c
[ $label = after ] && after_failed=$fail
done
[ "$after_failed" = 0 ] |
…mp has a liveness bound Review of #143: 'a first attachment gives each setup command what the command has left' mocked only Date, so the controller's Deadline.race kept a real 400 ms timer; a 450 ms stall in one backend answer failed it with 'CDP operation exceeded its deadline before command dispatch' (reproduced, and passing with the fix). And onControlledClock pumped without bound, so work that never settles kept the test running; it now fails after 60 s of controlled time and still restores the real clock.
Two files, as ci-kit's docs/adopting.md gives them: the caller workflow, and the gates. test runs npm test; plugin installs the claude CLI (each attempt cut at 3 minutes, 3 attempts) and runs claude plugin validate and test:mods. Node 24, npm ci, full history for the parity tests' committed evidence. Live checks stay local.
9ab5439 to
b45df7d
Compare
What
cua adopts ci-kit (its M2). Pull requests get
ci / test,ci / pluginandci / verdictchecks on GitHub's free hosted macOS runner, and any worktree can verify a commit off the MacBook withci-gate. The timing-sensitive tests that made local gates nondeterministic under load now assert events, or check their budget arithmetic on a controlled clock. Test code and the two CI files only; nothing undersrc/, no manifest, no merge setting.docs/adopting.mdgives them)..github/workflows/ci.ymlcallsSSFSKIM/ci-kit/.github/workflows/gates.yml@v1..github/ci-kit.ymldefines two gates onhosted-macos, with Node 24,npm ciand full history (fetch_depth: 0, which the parity tests' committed evidence revisions need):test:npm test.plugin: installs theclaudeCLI (each attempt cut at 3 min, up to 3 attempts; one hosted install hung for 6 min), then runsclaude plugin validate .andnpm run test:mods.verify.mjs, accept-native, accept-chrome) stay local. Nothing is made required.test/browser-service/support/controlled-clock.mjsis new: it gives a test node:test's mockedDateandsetTimeoutand moves time 1 ms per event-loop turn, so code that decides from the clock decides the same way on any machine.A10: each fix before and after, under induced CPU load
Every count below comes from a
ci-gaterun on a throwaway commit (its ref deleted afterwards) on GitHub's hosted macOS runner. The runner had 3 cores, or 5 where noted, withyesloops at 2x the cores beside the test loop (8x where noted). Runs go 4 at a time, as the full suite runs files side by side. "Before" is the file atmain, run until its first failure or the stated cap. The scripts are in the PR comment.connect ECONNREFUSED …sockin 6 different teststimeoutMs 357 with 328 ms leftUnexpected end of JSON input(0/200 in a later round)The "fails before" evidence is thin for two fixes:
Also, cdp's failure class appeared only at 8x (0/200 at 2x).
The review fix 06c6594 was re-run: the cdp and actions files each passed 20/20 under 2x load (results below).
A1 and A2
ci / plan,ci / test(2,316 pass, 0 fail, 86 skip),ci / plugin(validate plus 32/32 mods) andci / verdict, all green.ci-gateon head 9ab5439 returned GREEN 20 times in a row (stabb1…stabb20). The first series, on the previous head, went RED at run 11 on the clipboard-queue test, which commit 3d3ebe3 fixes. The review fix touches only the cdp test and the controlled-clock helper. One finalci-gaterun of the new head b45df7d was GREEN (run 38846002116). Under 2x load, the whole cdp file (45 tests) and the whole actions file (24 tests) each passed 20/20 after the fix (run 38845997387).Deferred
serve/repl-hostteardown flakes intest/repl-host/*stay with the own-REPL-host M4 branch, which has those files in flight.cua serve's own 5 s teardown budget. They appeared on one MacBook run at load 107–154, with the own host. The tests can only raise that budget through a product seam:serve()does not forwardteardownBudgetMs, and serve-cli spawns the CLI. That seam is not made here. None of these failed in 10 full-suite runs at 2x on the gate lane.