Train BF: shutdown on a full disk + startup test race (#664) #677

Closed
kayg wants to merge 0 commits from train/2026-10-23bf into dev
Owner

Train BF ran the full suite (run bf1, dev dadc7a2 + issue/664-shutdown-settle 0ca023c + issue/664-startup-race 8ab862f): fmt, clippy, workspace tests, build, svelte-check, every Playwright project. Rust all green. Browser: admin 43, cr1440 330, cr390 266+214, wk1440 139+190, wk390 157+194+128, small 19; failures re-run 3x: review4-signout:242 (webkit-390) 12/12 passed, editor:59 (chromium-1440) 3/3, swipe-rows:126 (webkit-1440) 3/3. tooltips:12 at 320 px (webkit-390) fails 3/3 - the bottom tab layer intercepts the hover; this train changes only server code and one Rust test, so it is a dev UI issue from the phone chrome, tracked on #660.

Contents (#664 follow-ups):

  • Shutdown with persistent history failures (full disk) now always finishes within the settle allowance: each room settles at most once, rooms close concurrently (bounded), one state owns 'shutdown after a settle failure' so a completed receipt can never be polled again (fixes an actor panic during an active save). No false Saved; unsaved typing replays exactly once after restart. 12 failing rooms close in ~2 ms (was 17 s), 100 rooms < 7 ms.
  • storage_startup test race fixed (child fd inheritance before exec): 0/200 failures vs 12/200 on dev.

Independent review: 3 rounds (slow multi-room close + crash-test timeout -> cd856d2; actor panic -> 0ca023c); final verdict merge. Gates: crash tests 30/30, state-machine property 10,000 cases x20.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk

Train BF ran the full suite (run bf1, dev dadc7a2 + issue/664-shutdown-settle 0ca023c + issue/664-startup-race 8ab862f): fmt, clippy, workspace tests, build, svelte-check, every Playwright project. Rust all green. Browser: admin 43, cr1440 330, cr390 266+214, wk1440 139+190, wk390 157+194+128, small 19; failures re-run 3x: review4-signout:242 (webkit-390) 12/12 passed, editor:59 (chromium-1440) 3/3, swipe-rows:126 (webkit-1440) 3/3. tooltips:12 at 320 px (webkit-390) fails 3/3 - the bottom tab layer intercepts the hover; this train changes only server code and one Rust test, so it is a dev UI issue from the phone chrome, tracked on #660. Contents (#664 follow-ups): - Shutdown with persistent history failures (full disk) now always finishes within the settle allowance: each room settles at most once, rooms close concurrently (bounded), one state owns 'shutdown after a settle failure' so a completed receipt can never be polled again (fixes an actor panic during an active save). No false Saved; unsaved typing replays exactly once after restart. 12 failing rooms close in ~2 ms (was 17 s), 100 rooms < 7 ms. - storage_startup test race fixed (child fd inheritance before exec): 0/200 failures vs 12/200 on dev. Independent review: 3 rounds (slow multi-room close + crash-test timeout -> cd856d2; actor panic -> 0ca023c); final verdict merge. Gates: crash tests 30/30, state-machine property 10,000 cases x20. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
kayg added 11 commits 2026-10-23 03:36:46 +00:00
Root cause of the storage_startup WouldBlock flake: another test thread
started a server while this test held a root's .lock. The child holds a
copy of the lock's open file (close-on-exec only closes it at exec), so
for a moment after the test releases the lock, the next immediate lock
attempt fails. Starting a process now holds SPAWNING until it has
exec'd, and every in-test lock attempt first waits for starts under way.

WIP: the 200x whole-binary proof under load is not finished yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Let Shutdown reach the actor's closing path without the read-command
settle check. A history error must not refuse the stop request and leave
RoomHandle::shutdown waiting forever. Closing still attempts to settle
and save, and Saved still waits for durable history so clients can replay
unacknowledged changes after restart, as required by ADR 0020.

Cover persistent SQLite page-quota failures, shutdown within the settle
budget, lock reacquisition, writer closure, no false Saved and recovery
of pending client state after restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Close at most sixteen rooms together and let each closing actor settle
history once before saving. Skip file placement after settlement fails,
and stop history retry backoff and requeueing when shutdown begins.
Keep actor and writer joins ahead of releasing storage.

Cover 12 and 100 full-history rooms within the five-second allowance,
unchanged durable state, no false Saved, and repeated replay after restart.
Also cover healthy shutdown saving pending typing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Join active file saves after shutdown settlement fails (#664)
Some checks failed
CI / web (pull_request) Failing after 55s
CI / server (pull_request) Successful in 1m22s
CI / rust (pull_request) Failing after 3m48s
0ca023cd1e
Consume history receipts once and share one shutdown failure state between
both actor loops. Stop history submission and receipt consumption after
closing settlement fails while still awaiting frozen file work and writers.

Keep a placed file's exact base and unfinished completion when history
promotion fails. Finish that promotion before another save or outside merge
can replace its pending row, so recovery never merges our own file twice.
Healthy saves reuse frozen text; retries retain only completion metadata.

Add the live-save shutdown reproduction, promotion failure with and without
outside edits, and a real-room state-machine property with 500 generated
cases, observing actor panics independently of discarded join errors.
Isolate test quota configuration from the writes it makes fail. The delayed
disk-recovery probe now expects "history writer stopped" after failed
shutdown; unacknowledged typing is recovered by client replay on restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Merge commit '8ab862fde5' into train/2026-10-23bf
Some checks failed
CI / web (pull_request) Failing after 1m4s
CI / server (pull_request) Successful in 1m52s
CI / rust (pull_request) Failing after 5m3s
b569be5041
Author
Owner

Closing: this PR's head commit is already in dev (checked 26 Oct, against dev a779a46). The train landed it by merging directly into dev.

Closing: this PR's head commit is already in `dev` (checked 26 Oct, against dev `a779a46`). The train landed it by merging directly into dev.
kayg closed this pull request 2026-10-26 11:18:02 +00:00
Some checks failed
CI / web (pull_request) Failing after 1m4s
CI / server (pull_request) Successful in 1m52s
CI / rust (pull_request) Failing after 5m3s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!677
No description provided.