Skip to content

Collection: closing a menu over the page no longer blanks every poster - #856

Merged
GLinnik21 merged 3 commits into
mainfrom
crx-blink
Oct 19, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
crx-blink

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

The owner saw it on the TV: on a Collection screen, long-press a poster and dismiss the menu, and every poster in the row blanks to the empty skeleton while the menu closes, then the art comes back all at once.

Cause (traced in the simulator)

Every surface dismissal delivers Uncover, RestoreMemory, Enter(Restored) to the page underneath (ui/src/dispatch.rs push_lifecycle). The Collection page answers it with CollectionCmd::Restore, and PageCache::restore_kept_counts rebuilt every page with no rows, so each held member became Art::Poster(None), drawn as the skeleton until /children was read from the server again: one frame in the frame dump (which waits for replies), the PMS round trip on the TV. The art returned whole because an empty card keeps no art history. It came in with #605 (174f391); the builds before and after #854 show it identically. Only the Collection store has Restore, so the other pages' menus never did this. Back from Detail to a live Collection screen took the same path (and re-read the list).

Fix (data layer; no screen code)

  • CollectionCmd::Restore is a no-op when the store is still the listing the page's memory was saved from: the memory now carries the store's generation (Collection::generation(), bumped only by a supersede: Open of another id, Close, Reset, a client refresh) through CardPageMemory and CollectionCmd::Restore { total, counts, generation }. That is the live-page case; it no longer moves a long, partly read list's read position to its end or switches paging off, and a page that landed while the screen was covered keeps its newer count and rows. A store rebuilt or reopened since takes the full restore of the saved target page, as Every list pages to its real end: no caps on reach, bounded windows, stable focus #605 designed.
  • PageCache::restore_kept_counts keeps a loaded page whose kept count equals its saved count; only changed pages become holes.

Verification

  • Red first: dismissing_a_hold_menu_leaves_every_member_drawn_with_its_art (the real store and screen, the dispatcher's dismissal sequence, a draw census) failed with six empty poster keys; it passes now. New: a page-cache test (own counts keep every loaded page, a changed count drops that page and later pages keep theirs), a 5000-item partly read list whose restore changes nothing (read, more, shown, pages, revision), another listing's directory dropping only the changed pages, a store rebuilt while covered (a retoken while Detail is on top) taking the saved directory, and a short page landing while covered surviving the restore; each failed before its fix. The existing long-list return tests and Cards and captions: late art dissolves once per frame across glass walks; gliding captions fade at both edges #854's art-arrival test stay green.
  • On the committed head (fe43f76): make check exit 0 (cargo — ok, python — ok, rest — ok, 103 steps — all ok, harness — ok; 29 test result: lines, all 0 failed, 18245 passed); make test-hostsim ok. 926 passed; 0 failed; make check-nodef clean; make check-replay 3 fixtures / 6 replays, 0 failures (none of them visits a Collection page).
  • Simulator (mock): on the frame the menu starts closing all six posters keep their art (texture stddev 31-52, against 1-2 for the skeleton before), 62 of 62 frames art through the close; the children read log shows only the two boot reads, none at the dismissal; Back from Detail no longer re-reads the list.
  • One Opus review: no blockers; its two shoulds (equal counts do not prove the same listing after a rebuild while covered; a page landing while covered had older counts written over it) are fixed here by the generation, with the tests above, and its three stale comments corrected.

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits October 20, 2026 00:13
…menu closes

The owner saw it on the TV: BACK on a Collection page's card hold menu drew every member of the
row as the not-yet-loaded skeleton for the whole close, then all the art came back at once.

The page is live under the menu and the collection store still holds every member, but the
dismissal reaches the page as the dispatcher's Uncover, RestoreMemory (the memory the nav kept
when the menu was pushed) and Enter(Restored), and the page answers that with
CollectionCmd::Restore. PageCache::restore_kept_counts then replaces the directory with pages that
hold no rows, so every member is a hole (Art::Poster(None), drawn as placeholder::skeleton) until
the children page has been read from the server again. Since #605; card_motion is not involved.

The test drives that exact event sequence, runs the store commands the page emits on the real
store, and compares the page's draw census before the menu and after the dismissal. It fails:
six empty-key skeletons where the six posters were. No fix here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d member

Root cause: the dispatcher delivers Uncover, RestoreMemory and Enter(Restored) to a live
page on every surface dismissal, and since #605 the Collection page answered them with
CollectionCmd::Restore. The store rebuilt every page of its directory as Page { rows: None },
so closing a card's hold menu (or a sheet, or Back from Detail) turned all six members into
holes, which the shared card draws as the not-yet-loaded skeleton until /children was read
again. On a long, partly read list the same Restore also moved the read position to the end
of the list and switched paging off.

Fix, in the shared data layer only: the Restore arm does nothing when the store already holds
this exact directory (same total, same kept counts), and PageCache::restore_kept_counts keeps
the rows of a loaded page whose kept count equals its saved count, so only a page whose count
changed becomes a hole. A store opened again since still takes the saved directory whole.

Tests: the red screen test (dismissing_a_hold_menu_leaves_every_member_drawn_with_its_art) now
passes; new units cover the page cache keeping its own counts' pages, and the store ignoring a
restore of the directory it holds in a long, partly read list while a reopened store still takes
it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…he listing the page was saved from

Review of the previous fix found that equal counts do not prove the store is the listing a page's
memory was saved from. A retoken or server re-point while Detail is on top rebuilds the store;
the covered page's own pump reads the header and a stretch of the frontier, so on a long
unfiltered list the new store held the very total and counts the page had saved, and Back took the
no-op: the store then read forward eight pages at a time from page 8 to page 50 with focus held
on skeletons, where the restore with the saved counts reads only the target's pages. In the other
direction (older than the previous fix) a short page landing while covered changed the store's
counts, so the Back took the full path and wrote the older saved counts over the newer ones: the
landed page's count went back to 60, its rows were dropped and read again, and the read position
jumped to the end with paging off.

The store's generation, which only a superseded listing moves (another collection opened, a close
or reset, a rebuild for a changed client) and paging never does, now travels with the saved
counts: Collection::generation is read at the page's sync, CardPageMemory carries it, and
CollectionCmd::Restore hands it back. The Restore arm does nothing exactly when it matches, whatever
the counts are by then, and a different generation takes the saved directory whole, as before.

Also makes three sentences true: the Restore arm's comment no longer claims that only a reopened
store takes the saved directory, restore_kept_counts says a changed page drops its rows because
they no longer match its count (the later pages keep theirs), and the test doc that said the same
is rewritten.

Tests: a rebuilt store takes the full Restore of the target page with no read forward, and a short
page landing while covered survives the restore (each failed against the previous fix). The
existing restore tests model a reopened or rebuilt store on the same CollectionState, since two
fresh states would share a generation, and the screen test checks the generation reaches the store.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit dc08c36 into main Oct 19, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the crx-blink branch October 19, 2026 22:23
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