Repository navigation
Session cache: peek is a pure read; the session owner refills it - #973
Merged
Merged
Conversation
…efills it (WIP stage A)
…(stage B) The ledgers: delete the `schedule_refresh` worker line and the `peek_settled::peek` global line, re-key the two surviving `refresh_if_current_locked` forks to `read_into_cache_locked` and drop the third (the clock read is gone). The pins follow: workers 27->26, globals 105->104, forks 62->61. The `wall` gate now also scans plex/src/plex/session.rs and the session owner files (session/src/auth/owner*.rs). The canonical-write timing moves into `persistence::write_session_timed`, an IO body outside the scan, so its log line is unchanged, and the slow-refresh test's 200 ms bound becomes a clockless witness (the parked read has not returned when the peeks finish). Prose that said `peek` schedules or queues a refresh now says the session owner's `RefreshCache` effect refills the cache: plex CLAUDE.md, agent-reference.md, distribution.md, the test headers and four doc comments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (stage B) `peek` no longer schedules a read, so the two plx_data restart tests that reopened the session file through `peek` + `drain_for_test` now fill the cache explicitly with `refresh_blocking_for_test`. Search's `scope::read_key*` called `peek` only to start that fill; the call is a no-op now, so it goes, with its two `globals` ledger lines (data-search 6->4, pin 104->102). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y a begun refresh; prose The session-cache backoff stored a deadline and compared it as a signed wrapping difference, so a Backoff that nothing observed again flipped to "not over" once the tick ran 2^31 ms past it and held a later need for another ~24.8 days. It now stores the tick it was ARMED at and holds while `now.wrapping_sub(armed_ms) < LOCKED_RETRY_MS`. The generation semantics are unchanged. `land_session_cache` answered Refused for a RefreshCache effect the drain budget had carried to the next frame, before the adapter had begun it; the job then ran and its real answer was dropped as stale. The Bridge now records the req of the last refresh it handed its adapter (`cache_refresh_begun`) and the reconcile refuses only that req, so a replaced adapter still reads as a refresh begun and lost. Prose: "exactly one CacheRefreshed" is now "at most one", the Refused doc names the bridge as the reporter of the dropped-adapter case, three comments no longer say peek() queues or forces a read, and the off_tape doc claims only what the filter does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
One conflict, in tests/test_harness.py: both sides lowered PINNED_LEDGER_TOTALS. The merged totals are the sums of the `# count:` headers under ci/allow/<rule>/ on the merged tree: workers 25, globals 101, forks 60, fxlanes 11. rust-modules/src/app/bridge.rs auto-merged: Bridge has one struct literal (with_publications_and_stores), which initialises P1's cache_refresh_begun and this branch's store_runner and late_store_jobs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 24, 2026
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
… worker job (#979) Since #973, every app frame can run the session owner's cache refill. While the process-global cache was Unloaded, SessionAdapter::begin_cache_refresh submitted a real storage-worker job even under Resources::Fixture. Its CacheRefreshed answer landed on whichever frame the worker beat, so fixture Bridge tests depended on timing: home_worker_results_cross_the_addressed_dispatcher_ingest_once failed with "wrong result type" in three of four CI jobs on #977. A fixture-Bridge test with no TempSession could also install a developer's real auth.json into the cache for later tests. A fixture adapter now parks refresh_cache_job in FixtureResources, as StoreRunner::Held parks store jobs, and runs it only when a test asks (run_held_cache_refresh). cache_refresh_req covers a parked refresh, so the reconcile reads it as held. Live adapters are unchanged. Tests: a_fixture_adapter_submits_no_storage_worker_job_for_a_cache_refresh; the Home test starts from an Unloaded cache (premise asserted) and drains the worker between frames with its tap strict; a_live_adapter_begins_a_cache_refresh_without_taking_the_session_io_lock keeps the live IO-lock coverage that a fixture can no longer give; a debug_assert catches an overwritten parked refresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
danzig666
pushed a commit
to danzig666/plx-native
that referenced
this pull request
Oct 24, 2026
home_worker_results_cross_the_addressed_dispatcher_ingest_once panicked on any result that was not a HubsResult. Since upstream's plxnative#973 the session owner refills its cache by a result of its own, which Home's first frame delivers, so the test failed on upstream main as well (run alone, every time; in a full run only by test order). It asks only that the Hubs store's results cross once, so it now passes over other owners' results. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KBgjCe8KH6Nnp3K51Fybrv
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.
Summary
Pilot P1 of the Sans-IO series (docs/sans-io.md).
session::peek()is now a pure read of the session cache: no clock, no storage read, no worker. Refilling the cache becomes the session owner's job, carried as an effect and answered as an event.peek()(plex/src/plex/session.rs) used to readInstant::now()on every call, and to submit a background read (schedule_refresh→storage_worker::submit) when the cache was cold or a locked read's retry was due. It now returns what the cache holds. Thepeek_at/drain_refresh_for_test/CACHE_NOW_FOR_TESTtest hooks go with it.The refill lane:
Bridge::land_session_cache(d)tells the owner what the cache lacks (SessionEvent::CacheObserved(RefreshNeed)).SessionFx::RefreshCache { req, generation }.Refused.SessionEvent::CacheRefreshed { req, outcome }.The owner's bookkeeping (
CacheRefresh { Idle, InFlight, Backoff }insession/src/auth/owner.rs) is private: it sits outsideSessionInit, the snapshot and the replay subhash. A locked file backs off forLOCKED_RETRY_MSon the frame tick (cx.tick.ms), measured from when the backoff was armed, so the u32 tick wrapping cannot hold it.A refresh can't be stranded. If the owner is in flight but the adapter lost the job (replaced or dropped), the Bridge answers
Refused. It does that only for a request it actually began, so an effect still queued for the next frame is left alone.Controlled runs: controlled Home refuses
RefreshCacheloudly, like the other session IO effects. The recorder keeps the two cache events off the tape (off_tape).Ledgers:
workersschedule_refresh::storage_worker::submitglobalspeek_settled::peek; the no-oplet _ = peek();indata/src/search/scope.rs(two lines)forksrefresh_if_current_lockedclock line; the other two are re-keyed toread_into_cache_lockedClock gate:
wallnow also scansplex/src/plex/session.rsandsession/src/auth/owner*.rs. The write timing moves intopersistence::write_session_timed, an IO body outside the scan, and logs the same line.Docs:
plex/src/plex/CLAUDE.md(thepeek()bullets,LOCKED_RETRY),docs/agent-reference.md,docs/distribution.md, two test-file headers and five stale comments.No Makefile, Cargo, workflow or module-layout change, so there is no build-bench table.
Verification
peek_never_reads_storagewas written first, and failed on ae611ee (left: 1 right: 0). It passes now.owner::tests::cache_refresh(each need, Transient per generation, Refused, Settled/Superseded, tick wrap, the backoff after 2^31 ms, a stale answer, sign-out in flight);an_unloaded_cache_is_refilled_by_the_owner_within_a_few_frames,a_replaced_adapter_cannot_strand_an_in_flight_refresh,a_refresh_effect_still_queued_is_not_reconciled_as_lost,a_controlled_run_refuses_a_cache_refresh_loudly;a_cache_refresh_job_that_panics_is_answered_refused.make checkon the committed head ff14ceb: green.test result: ok. 295 passed; 0 failed.1043 passed; 0 failed.Ran 539 tests/OK.check-deps: all gates green.Instant::now()inpeek(), and one inowner.rs, each failwall.make check-nodef: clean.make check-replay:3 fixtures, 6 replays, 0 failures. All six replays readverdict=SAME, and no fixture was re-recorded.Known, not in this PR
peek_settled()staysNonefor a whole replay, and the account menu would not build in one. No fixture reaches that path. Installinginitial.session.persistedat replay boot is a separate change.tests/controlled_bootstrap.pyfails at its first case:normal boot still mints/persists its own identityexpectsauth.json, which the app replaced withstate/session.jsonin 0.7: forward-port 0.6.x persistence, sign-in and consent with in-place upgrade #105.make checkdoesn't run the script, and it was not run on the base.Closes #972
🤖 Generated with Claude Code