Skip to content

Frame dump: slow pages film their loading frames; fps:library-switch stops flipping on its own cycle's phase - #855

Merged
GLinnik21 merged 9 commits into
mainfrom
crx-tooling
Oct 19, 2026
Merged

GLinnik21 merged 9 commits into
mainfrom
crx-tooling

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Two test-tooling defects found while verifying #843 and #854; neither changes what the app does outside the frame dump.

Frame dump: a slow page no longer stalls the dump, and its loading frames can be filmed

In frame-dump mode (PLXNATIVE_DUMP) the landing wait (landgate::Gate::take_owed -> dump_wait) slept on the frame thread and bypassed plx_base::task::assert_may_block, so a page whose read took over ~1 s showed one 1.5 s frame instead of its loading frames, and the 2 s hang watchdog aborted the dump (the Watchlist and Collections dumps of the #843 review hit it). The blocking wait now passes the gate (a frame refuses it), and the dump driver arms a paced form (arm_dump_paced) that never sleeps: a take whose answer is out names its store and the driver holds the iteration on owed:<store>. PLXNATIVE_DUMP_LAND_LAG_MS (default 0) keeps a request out for that long in virtual frames, so a loading page's frames are written; while a lagged store's answer is deliberately out, that page's loading placeholders are not hold debt (with no lag armed, the no-placeholders rule is unchanged). #[track_caller] on the wrappers between a take and its caller (land_directory_owned_with_gate, land_directory_owned, take_store_landing) gives each mailbox its own site key.

Outside dump mode and under record/replay the effect is unchanged: the armed check comes first, and with no dump form the take falls through as before.

fps:library-switch: the draw-rate check no longer flips on the phase of its own cycle

The scene graded the MEDIAN of its 1 s drawn-fps windows against 8. Its 14-step switch cycle has idle steps with the two-library mock, so since #843 that median sat at 7-11 on every build and flipped on the phase of the steps against the windows (the TV read 7, then 9, on the same binary; drawn-frame totals 349-355 across four builds). It now opts into fps_floor_stat: "live": at least 6 graded windows at >= 4 fps. That passes all four TV series and fails a frozen animator, one that freezes partway and a frozen run with one burst window. Known limit: a freeze after the first 6 live seconds is not caught (in _fps_floor_note and tests/README.md).

Verification

  • Red first: the dump-mode landing wait sleeps on the frame thread past the blocking gate: Some(7); the dump never finished: 0 frames written, stuck at virtual frame 0 on ["placeholder"] (lagged loading page); two mailboxes through the wrapper shared a site key; median=7 fps ... vs fps_floor 8 for the H7 series, and the mean-based grade passing a partway freeze and a frozen-plus-burst run. All green now.
  • A real dump: the Collection screen with its items reply delayed 1.5 s and PLXNATIVE_DUMP_LAND_LAG_MS=1500: 207 loading frames written (spinner, then the header while the grid was out), then 93 landed frames with the 6-film grid; exit 0, 27 s.
  • On the committed head (047d1e5): make check exit 0 (cargo — ok, python — ok, rest — ok, 103 steps — all ok, harness — ok; 29 test result: lines, all 0 failed, 18251 passed; Python harness Ran 468 tests ... OK); make test-hostsim ok. 931 passed; 0 failed; make check-nodef clean; make check-replay 3 fixtures / 6 replays, 0 failures.
  • One Opus review of the first round (four findings: the lag knob deadlocked a loading page, the wrapper's shared site key, the mean passing a partway freeze, stale docs); all four fixed here with tests.
  • No Makefile, Cargo, build.rs or workflow changes, so no build-bench table.

🤖 Generated with Claude Code

GLinnik21 and others added 9 commits October 19, 2026 23:18
…hread past the blocking gate

The Collections page over a slow type=18 listing held the simulator's main thread
3950 ms inside navcommit (dpre drain -> StoreWork::Browse -> BrowseStore::pump_with_gate
-> take_landing_owed -> Gate::take_owed -> dump_wait thread::sleep). The wait exists only
while the frame dump has armed the gate; it bypasses plx_base::task::assert_may_block, so
it is unlabeled and the watchdog aborts the dump at 2 s. No fix yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…witch cycle

The scene grades the median of its post-warmup 1 s fps windows against fps_floor 8. Since the
Library redesign the 14-step switch cycle has idle steps with the two-library mock, so the graded
windows are the back half of the cycle plus the spent-cycle tail, and the median reads 7-11 for the
same animation. Fed the television's own heartbeats, build H7 fails: "median=7 fps (min=0, max=35,
n=14) vs fps_floor 8", while H3, H5, H9 and two earlier healthy runs pass; a frozen animator and a
quarter-rate one fail as they must. No fix yet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…t the median

A scene may now say which statistic its fps_floor is graded on ("fps_floor_stat": "median", the
default, or "mean"); the grading moved out of run_fps_scene into fps_floor_verdict so the harness
tests exercise it directly. library-switch opts into the mean with floor 4. Its graded windows are
the back half of a 14-step cycle with idle steps plus the spent-cycle tail, so the median read 7 to
12 for one animation and failed the old floor 8 on build H7; the mean is the frames drawn and read
8.8 to 13.3 over eleven television runs, against ~0.5 for a frozen animator. The H7 series and the
other recorded runs pass, and a frozen and a quarter-rate animator still fail.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
In a dump, landgate's take_owed / take_all_owed slept in dump_wait on the frame thread until the owed
answer arrived. That wait bypassed plx_base::task::assert_may_block, so it showed up as "unlabeled",
the 2 s hang watchdog aborted the dump, and a page whose read took longer than a frame could not be
filmed: the one frame that asked sat inside the sleep, so its loading frames never existed.

The wait now passes the blocking gate (label "landgate dump wait"), so a frame refuses it. That is
the blocking form, kept for callers off the frame thread (the stores' own unit tests). The frame dump
arms a new paced form instead (Gate::arm_dump_paced): a take whose answer is out returns nothing and
names its store (Gate::take_starved), the driver holds the iteration on "owed:<store>" like any other
debt (same virtual time, a 500 us sleep between repeats so the worker can run), and the next repeat
takes again. The landing frame is still a function of the request and not of the worker, because the
picture is never written while a take is starved. A queue take hands out its whole batch or nothing.

PLXNATIVE_DUMP_LAND_LAG_MS chooses how long a request is out in VIRTUAL time (default 0: the next
execution of the site, so every storyboard is unchanged). With a lag the gate holds an answer back
until that many virtual frames after its claim was first seen open, keyed per landing site and driven
by Gate::dump_frame, and the stores it holds back are reported by Gate::take_lagged and are not debt,
so a slow page is filmed with its loading frames for the time the dump chose and not the network.

The two frame-driven hubs tests move to the paced form (a repeat loop instead of a sleep) and gain a
lag test at the Bridge; the landgate tests cover the paced take, the lag, per-site sightings and the
queue batch.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
With PLXNATIVE_DUMP_LAND_LAG_MS > 0 a dump of a loading page never finished: the page draws its
loading state (a counted Working read-out, a spinner), hold_reasons held the frame on "placeholder",
and virtual time advances only when a frame is written, so it never reached the frame the lag waits
for; the run exited 3 after max_hold. While a store's answer is deliberately held out, the
placeholders that are a loading state (Reason::is_loading_state) are no longer debt; art placeholders
and draws past the entry cap still are, and with no lag nothing is excused. The written frame still
records its count, so a lagged render still fails the deliverable gates.

The driver's sample is now combined in one place (Sample::with_draw), and the new tests run it with a
real paced gate, a real Working read-out and the driver's decide: they fail against the old rule
('the dump never finished: 0 frames written, stuck at virtual frame 0 on ["placeholder"]').

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…he paced gate

The paced dump keys a landing's claim by call site, and land_directory_owned_with_gate serves two
mailboxes (genre and letters) without being #[track_caller], so both shared one site key and the
genre landing frame depended on the order and timing of the letters take. The wrapper (and its test
twin, and stores::tape::take_store_landing, the other wrapper between a gated take and its callers)
is now #[track_caller]. Every other gated take is called directly by its own pump, one mailbox each.

The new test lands genre first seen on frame 0 and letters first seen on frame 2 under a lag of 3 and
expects frames 3 and 5; it read (5, 8) before.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The doc comments on take_landing_owed, the hub adapter's owed count and owed(), gfx::dump's header
and the landgate module doc still described the frame dump's landing takes as a bounded blocking
wait on Gate::arm_dump. The driver arms arm_dump_paced (framedump.rs), whose takes return nothing
and name the store while an answer is out; the blocking form is for a caller off the frame thread.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The mean passed an animator that froze after two graded seconds (H3 4.07, H7 4.43, H9 4.21) and a
frozen run plus one 50-60 fps window (3.8-4.7), because the graded windows end in the spent-cycle
keepalive tail either way. fps_floor_stat is now 'median' (default) or 'live': at least
fps_floor_windows of the graded windows must each draw fps_floor frames. library-switch needs 6
windows of 4 fps; the four phase-H series and the two older ones hold 8 or 9, a freeze after N
seconds holds N, a frozen run 0, a frozen run with a burst 1. The notes in the manifest and
tests/README.md say what is not caught (a freeze after the first six live seconds).

The new tests fail against the mean (H3 frozen after 2 graded seconds: mean=4.1 ... PASSED; one
burst: mean=4.0 ... PASSED) and pass against the count.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… the lag tests live in their own file

The real slow-page dump (a Collection whose items reply is delayed, lag 1500 ms) wrote 26 loading
frames and then held on the Collection header's thumb: a CardGround with an EMPTY key, which no
poster fetch can answer and which the collection's answer replaces. While a store is lagged such a
tile is now the store's loading state (Entry::is_loading_state); with a key, or with no lag, it is
debt as before, so a card that never resolves still fails the run once the lag is over.

The lag tests move to framedump_lag_tests.rs: the dump driver's worker thread is test code, and
ci/check-deps.sh's threads gate skips test modules by brace depth, which the module's pre-existing
string literals miscount.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 366dfe9 into main Oct 19, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the crx-tooling branch October 19, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant