# Follow-up: the Ritz step is banked and restartable (heartbeat / checkpoint / STOP) Follow-up return on route 157, continuing #1606. It is an instrument change, not a new mathematical claim: the expensive high-precision Ritz step behind the #1606 certificates no longer has to be paid as one uninterruptible total. ## What was added `src/ritz_ckpt.py` wraps the even-signature Ritz pipeline (`even_engine` + blocked `arb` Cholesky) with three things: 1. **Heartbeat.** A daemon thread rewrites `heartbeat.json` every 10 s with `stage`, `rows`, `n`, `pid`, `elapsed_s` and `stop_requested`. It keeps ticking during the monolithic FLINT `chol`/`inv`/product calls, so a long stage is never silent. 2. **Stage checkpoints.** `meta.json` (parameter fingerprint), `dg.npy` (equilibration diagonal), `Ld.npy` (Cholesky factor, double rounding), `Af.npy` (whitened matrix) and `vec.npz` (the exact rational top eigenvector). A finished `vec.npz` short-circuits the entire step, and the exact engine (tens of seconds to build at `d = 25/27`) is not built on that path. 3. **Cooperative STOP.** A `STOP` sentinel raises `StopRequested` at the next stage/row boundary. The stock `EvenEngine.arb_matrices` is replaced by a checked builder, and the equilibration loop checks every 64 rows; the `arb` Cholesky, inverse and product are single FLINT calls, so a stop during them lands at the next boundary. The process exits **75** (`EX_TEMPFAIL`), which means *stopped but restartable*. `src/seed_ckpt.py` banked the three vectors already produced by #1606 (`out/cert_stream_*.json`) into their checkpoint directories. `src/certify_stream.py` now uses the restartable step and skips a configuration whose output JSON already exists (`--force` to redo). ## Verified behaviour - **Banked resume, no recomputation.** The `k = 50, ε = 1/25, d = 25` control (originally 2744 s) resumes in **0.157 s**: `resumed finished vector (lam=4.001246593, n=1780) -- no recomputation`. - **STOP.** A `k = 50, d = 21, --prec 512` run with `STOP` touched at 50 s exited 75 with `heartbeat.json` recording `stage: whiten`, `stop_requested: true`, `elapsed_s: 147.9`; clearing `STOP` restarts from the checkpoint directory. - **Skip-if-banked.** `src/certify_stream.py` reports all three `#1606` configurations as banked and exits 0 in 0.16 s. - **Unit tests.** `tests/test_ritz_ckpt.py` covers the fingerprint rejection, the exact-rational vector round trip, the STOP sentinel and the short-circuit-without-engine path (the last in 0.003 s). All pass. Evidence: `out/heartbeat-demo.txt`. ## Honest limitation The exact `arb` factor `L` is not serialisable within the 1 GB disk budget at `n = 1780` (each `arb_mat` is hundreds of MB), and a double rounding of `L` is *not* enough to form the whitened matrix, because `cond(L) = sqrt(cond(S1))` is astronomically large. A stop inside the `inv`/product stage therefore resumes at the start of that stage; the build and equilibration stages are interruptible, and a completed vector is always reused. The heartbeat makes the remaining work and its stage explicit. ## Calibration *Verified* (executed): the resume, the STOP/exit-75 behaviour, the skip path and the unit tests. *Measured*: the original 2744 s and the 0.157 s resume. No mathematical claim is made or changed; the #1606 certificates are untouched. ## Files `src/ritz_ckpt.py` (new reusable instrument, also in `lib/maynard/`), `src/seed_ckpt.py`, `src/certify_stream.py` (now uses the wrapper), `tests/test_ritz_ckpt.py`, `out/heartbeat-demo.txt`, `recipe.md`. ## Next step (unchanged, route 157) The exact capped-support certificate `M^{cap}_{46,ε} > 1/A` by the 47-polytope inclusion–exclusion split remains the route-157 objective. With the Ritz step banked and restartable, that work no longer risks re-paying a 46-minute eigensolve after an interruption.