PC 1 measurement pass: the step budget keeps four minutes of the cap for the restore and sizes each step from the last rate read; a probe dev line answered in helper.log counts as the helper up when its heartbeat stays stale; the gate check pc1-step-budget-check.sh with the known-failed case (the third 5090 pass of 8 October, ended by its cap at the 300 MHz step with the card left locked)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-08 02:56:18 +00:00
parent bfd062d030
commit 639703e0d5
3 changed files with 51 additions and 0 deletions

View file

@ -23,6 +23,7 @@ no playbook quits, pauses or resumes the installed app
no script writes into another worktree or walks Projects
the signer is never piped into head
bash bodies in PowerShell job scripts pass bash -n
the PC 1 measurement pass keeps four minutes of its cap for the restore and sizes each step from the last rate (known-failed first)
run jobs test their fetched kit before use
every Windows spawn of the app runs with a hidden console
pinned guest programs match their manifest

View file

@ -0,0 +1,49 @@
#!/usr/bin/env bash
# The PC 1 measurement scripts' step budget (8 October 2026, 02:4x UTC, the Counter ASIC coordinator's order): the third 5090 pass sized
# every step's batch count from the unlocked rate, so the 500 MHz step ran 155 s instead of 60, the 45 min cap killed the script during
# the 300 MHz step, its finally block never ran and the card sat at a 400 MHz lock for four minutes until a restore job. Two rules on
# tools/ca3-v4-amend/pc1-v4-efficiency.ps1, checked here: (1) a step is started only when it ends before the cap less a four-minute reserve
# (`$deadline.AddMinutes(-4)` guards every step and every lock), so the clocks reset and the drift check run inside the cap; (2) the
# batch count per step follows the last rate read for the pack (`$lastMhs`), so a 60 s step stays 60 s as the rate falls. The self-test is
# the known-failed case: a grid whose steps lengthen past the cap under the old rule (the batch count fixed, the deadline alone) ends on
# the cap with no restore; under the new rule it ends with the restore run. Both halves run in the gate.
# bash tools/ci/pc1-step-budget-check.sh [--self-test]
set -euo pipefail
cd "$(dirname "$0")/../.."
# simulate(reserve_s, follow_rate): seconds at which the restore runs, or "cap" when the cap (2700 s) kills the script first. The grid is
# the third pass's: 2 packs x 9 locks;
# the unlocked rate 137 MH/s, each lock's rate following the clock below the knee (121 MH/s at 1,100 down to 32 at 300, as measured);
# a step's seconds = 60 x (the rate its batch count was sized from / the step's rate) + 15 s of build and settle, the restore 30 s.
simulate() {
local reserve="$1" follow="$2" cap=2700 t=120 rate=137000 sized=137000 lock
for lock in 1100 1000 900 800 700 600 500 400 300; do
rate=$(( 137000 * lock / 1300 )) # below the knee the rate follows the clock (the measured 121 MH/s at 1,100, 42.6 at 400)
[ "$follow" = 1 ] && sized=$rate
local step=$(( 2 * (60 * sized / rate + 15) )) # 60 s x (the sized rate's batch count) at the step's rate, 15 s of build and settle, two packs
# the guard is a clock check before the step (the script cannot know the step's length): the step starts when the clock is under
# the cap less the reserve, and the cap kills the script when the step overruns it
if [ $t -gt $(( cap - reserve )) ]; then break; fi
t=$(( t + step ))
[ $t -gt $cap ] && { echo cap; return; }
done
t=$(( t + 30 ))
if [ $t -gt $cap ]; then echo cap; else echo "$t"; fi
}
if [ "${1:-}" = "--self-test" ]; then
old=$(simulate 0 0); new=$(simulate 240 1)
[ "$old" = cap ] || { echo "self-test FAILED: the old rule (no reserve, the batch count fixed) should end on the cap, got $old"; exit 1; }
case "$new" in cap) echo "self-test FAILED: the new rule should end with the restore inside the cap"; exit 1 ;; esac
[ "$new" -le 2700 ] || { echo "self-test FAILED: the restore at $new s is past the cap"; exit 1; }
echo "self-test passed: the old rule ends on the cap with no restore; the new rule ends with the restore at $new s of 2700"
exit 0
fi
f=tools/ca3-v4-amend/pc1-v4-efficiency.ps1
[ -f "$f" ] || { echo "pc1-step-budget: $f is missing"; exit 1; }
bad=0
n=$(grep -c 'deadline.AddMinutes(-4)' "$f" || true)
[ "$n" -ge 2 ] || { echo "pc1-step-budget: $f guards fewer than two places with the four-minute reserve (\$deadline.AddMinutes(-4): the step loop and the lock loop)"; bad=1; }
grep -q 'lastMhs\[\$pk\] \* 1e6' "$f" || { echo "pc1-step-budget: $f does not size the batch count from the last rate read (\$lastMhs)"; bad=1; }
grep -q 'script:lastMhs\[\$pk\] = \$b.mhs' "$f" || { echo "pc1-step-budget: $f never records the last rate per pack"; bad=1; }
if grep -vE '^\s*#' "$f" | grep -qE 'if \(\(Get-Date\) -gt \$deadline\)'; then echo "pc1-step-budget: $f still guards a step with the bare deadline (no reserve for the restore)"; bad=1; fi
[ $bad = 0 ] && echo "pc1-step-budget: the efficiency pass keeps four minutes for its restore and sizes each step from the last rate"
exit $bad

View file

@ -108,6 +108,7 @@ tree_checks() {
run "no script writes into another worktree or walks Projects" bash -c 'bash tools/ci/no-foreign-tree-writes.sh --self-test && bash tools/ci/no-foreign-tree-writes.sh'
run "the signer is never piped into head" bash tools/ci/signer-pipe-check.sh
run "bash bodies in PowerShell job scripts pass bash -n" bash -c 'bash tools/ci/bash-body-check.sh --self-test && bash tools/ci/bash-body-check.sh'
run "the PC 1 measurement pass keeps four minutes of its cap for the restore and sizes each step from the last rate (known-failed first)" bash -c 'bash tools/ci/pc1-step-budget-check.sh --self-test && bash tools/ci/pc1-step-budget-check.sh'
run "run jobs test their fetched kit before use" bash -c 'bash tools/ci/kit-path-check.sh --self-test && bash tools/ci/kit-path-check.sh'
run "every Windows spawn of the app runs with a hidden console" bash -c 'node tools/ci/windows-spawn-check.mjs --self-test && node tools/ci/windows-spawn-check.mjs'
run "pinned guest programs match their manifest" bash tools/ci/pinned-guests-check.sh