Repository navigation
Audit the implicit state machines; fix eleven traced defects - #1417
Merged
Merged
Conversation
docs/implicit-machines-audit-2026-11-16.md inventories the lifecycles the code tracks without one enum and one transition function: 164 of them outside the ten machines in ci/machines.ini, found by a mechanical pass over flag-heavy structs and phase-like enums and then judged by reading. It records 19 traced defects, the lifecycles written more than once, the types that are already explicit but unregistered, and what was not read. Its decision is not to convert in bulk. Every traced defect is one shape: a transition wrote one field of a cluster and not its sibling, or a reader tested a stand-in for the state. Three of them are provable on the host and are fixed here, each by a test that failed first: - Player HUD settings: an address-fetched offer landing on a later tick replaced an open drop-file install question under the same title, so the viewer's answer installed or declined a package they had not been asked about and the file they picked was never installed. Every question opens in HudPage::ask, which now refuses to replace the viewer's own; the offer is not latched as asked until its prompt has opened, so it is asked on the first tick after the answer. - Library grid: a library-change notice during the first page read owes a re-list, and the failure arm skipped SecFetch::Failed for every section with a re-list owed. That exemption is for a grid holding rows. A first read holds none, so the grid spun through every failed retry instead of showing the failure. - Watchlist: "no list has landed" was spelled rows.is_empty(), so an account whose Watchlist is empty went back to Loading at every mount and to Failed on a failed background reread, which drops the Watchlist row from item menus. WatchlistState::unread names the state. docs/sans-io-guide.md's checklist gains the rule and points at the audit. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…view found The doc-claim audit of the previous commit found its HUD fix was half a fix. HudPage::ask no longer lets an offer take over the viewer's own install question, but the answer it then sends is InstallDrop, and HudStore takes that only when idle: with the offer held, the confirmed install was still dropped as Handled::No, with no notice. The way into that state was the row. A drop file's row opened its question while a fetch was in flight, although the store would refuse the install either way. It is now inert while the store is busy (fetching or package_busy), as the removal rows and the address row already are, so a question is not opened across a fetch. The guard in ask stays for a listing that is a tick behind the store; the audit records what is still open there (the store's refusal is silent). Prose: the review found WatchlistState::unread's doc claimed more than the code (a later-page failure of a reread of an empty list still differs from a populated one), and docs/watchlist.md and three comments still drew the line at "a populated list" where it is now "a list that has landed". Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
Src.deferred was not cleared with its siblings page/quiet. request_page kicks ungated over a source holding a gate-deferred quiet read, taking quiet and leaving deferred; the next tick's source_waiting then launched a prompted whole-source read (HubState::Loading) after the page landed. cancel_page left it on a source with no page for the same reason. begin_request and cancel_page now clear it. Tests: a_page_ask_that_took_a_deferred_quiet_read_leaves_nothing_deferred_behind and cancelling_a_page_clears_the_deferral_with_it, both red before. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
take_unchecked sets checking=true and only finish cleared it; run_encoder_cleanup_check had no drop guard, so a panic in the observation left the record claimed for the process, is_clear(sid) stayed false and encoder_cleanup_ready deferred every ABR trial on that server. An EncoderCleanupClaim guard now releases the claim (finish with no verdict) on drop. The observation is split out as an argument so the test can panic it. Test a_panicking_encoder_cleanup_check_releases_its_claim: red before (retry.len() 0 != 1), green after. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…after its snapshot flush_soon's loser (thread B) relies on AGAIN, but the winner (thread A) clears AGAIN after B raised it and spawns with the stale revision; process_records then sends nothing and the tail saw AGAIN false, so the new decision was never flushed. The tail now asks the pure rerun_after_flush(again, ran_revision, installed_revision). The test drives that interleaving as plain data (red before: rerun_after_flush(false, 1, 2) was false). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
retire_pad synced the published ProfilesState before clearing pin_denied, so after BACK on a denied pad the state carried pad_open=false, pin_denied=true until the next Tick. Clear the field first. The new test asserts the PUBLISHED s.state fields after BACK on a denied pad. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…rap tick A key-up at tick 0 was dropped, so a card press latched long and delivered a hold instead of the tap. Store now.max(1), as commit_at and HeldKey::release do. The test presses at u32::MAX-15, releases at 0 and asserts the tap commits and is not long. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
key_play wrote dpad_mode/cur_hidden but not back_cursor, mot_accum or edge, so after PLAY mot_accum held all earlier travel and the first small motion passed DPAD_MOTION_GATE. The arrow entry and key_play now both call Pointer::enter_dpad, each keeping its own hide_cursor condition. The hostsim test drives key_play with mot_accum=500 (red: left 500.0, right 0.0) and the arrow path for parity. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
execute(Command::Start) returned Unavailable/Failed without storing it in STATE.status, after stop() had moved Recording to Saved and set_len(0) had truncated the file, so Settings re-read a stale Saved/Exported for an empty trace. Start's body is now start() with the availability and trace path as arguments; start_stored stores every non-Recording result. The test reaches both failing exits and asserts the stored status. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…eal_pending
reopen_until reset off/size/poisoned but not failure/heal_pending, so an HLS source reused across
segments kept naming the old mid-body cut from body_failure() after a later successful reopen.
The new test cuts mid-body, reopens via reopen_until and asserts body_failure() is None and no
heal is pending (red before: Some(BodyFailure{rc:18,..})). The seek-based retention tests are
unchanged.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…t the worker calls The test pinned only the pure predicate; the tail could revert to AGAIN.load alone and stay green. The worker now calls worker_tail_reruns(&AGAIN, ran, installed), and the test drives it with a real AtomicBool and a revision closure (newer decision reruns, request reruns, nothing new stops). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…uiet read cancel_page and pump_reloads cleared `deferred` unconditionally, losing a gate-deferred quiet read that shared the flag and stranding quiet = true. Both now set deferred = quiet. The new test (red before: 'the quiet read the gate deferred is still owed') proves the quiet read is still launched. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
The guard only runs on a panic unwinding out of observe; the parenthetical about worker teardown overclaimed. Doc-only change, no test applicable. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
…eight fixes The swarm's review left one change without a test: pump_reloads drops a reload page whose row left the ring and now keeps the deferral only for a quiet read the gate refused (deferred = quiet). a_reload_page_dropped_off_the_ring_keeps_a_ deferred_quiet_read fills the fan-out gate (five sources, four out), and fails with the old 'deferred = false' at 'the quiet read the gate deferred is still owed'. The audit's defect table records the eight fixes and what each test does not show. The telemetry test moves below its module's use line. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
Comments and prose only. The audit's inventory rows for the fixed defects now say so; the curl comment and the audit row no longer claim a successful seek clears `failure` (it clears only `heal_pending`); the evidence note names all three tests that were red against the fix's own seam; the trace row names the two exits the test drives; `Src::deferred`'s doc lists who clears it. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01P6ZnFcrmAsJorfw1Hnt2DC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An audit of the app's implicit state machines, and fixes for the eleven defects it traced that a host test can prove.
The audit
docs/implicit-machines-audit-2026-11-16.mdlists 164 lifecycles that are held in loose flags, scattered phase writes, statics orpending_*fields, by area, with the defects traced while reading them. Its recommendation is to convert a lifecycle only when it has a traced defect or is being changed anyway, never in bulk: every traced defect has one shape (a transition wrote one field and not its sibling, or a reader tested a stand-in for the state).docs/sans-io-guide.mdgains checklist item 9, which sends a reader to the row of the type they are about to touch.The fixes
Each has a regression test that failed first.
screens/src/hud_settings.rsasknever replaces the viewer's own question; drop rows are inert while the store is busydata/src/browse/mod.rsLoadingthrough every retryFaileddata/src/stores/watchlist.rsrows.is_empty(): an empty Watchlist reloaded at every mount and a failed reread replaced it withFailedWatchlistState::unreaddata/src/pms.rsSrc.deferredoutlived the page or quiet read it stood for, so the next tick launched a prompted whole-source readbegin_requestclears it;cancel_pageandpump_reloadskeep it only for a quiet read the gate refusedmedia/src/route/decision.rscheckingset for the processEncoderCleanupClaimdrop guardtelemetry/src/telemetry/mod.rsscreens/src/profiles.rspad_open = false, pin_denied = truefor one tickui/src/dispatch/press.rstick.ms == 0stored the "still held" sentinelnow.max(1), ascommit_atandHeldKey::releasedosrc/app/input.rs,playback.rsmot_accum,back_cursoror the edge glidePointer::enter_dpad()for both entriesplatform/src/playback_trace.rsstart_stored; availability and path are arguments ofstartnet/src/curlio.rsreopen_untilleft the old body failure pinned on every later stopfailureandheal_pendingafter the request succeeds. No curl option or FFI declaration changedVerified
7f3640cb8(every code change; what followed is a comment/doc commit and a clean merge ofmain's CI and docs files):make check-cargo-lint, the default unit suite (13576 passed, 14 failed), thehostsimsuite (8653 passed, 13 failed),make check-pythonandmake check-nodef. The failures are environmental and the same on untouchedmain: the container runs as root, so 13 "unwritable directory" tests cannot fail to write (re-run as an ordinary user:26 passed; 0 failed), and oneplx_netconnect-abort test needs a route the sandbox refuses.fw-compat-revieweron the curl change (no findings; source only),doc-claim-auditor(five wording findings, corrected),pr-revieweron the combined diff (no findings).Makefile,Cargo.toml,Cargo.lock, workflow or module-layout change, so no build-bench table. No ledger underci/allow/changed.Still open
Eight rows of the audit's defect table are left open on purpose: they need the device (two feed seek stalls, the ACB bind retry, the preview deferred start, the refused-foreground retry, the background pointer reset) or an owner's decision (the Browse retry backoff,
HttpStream's end of stream at a chunk boundary).Generated by Claude Code