Repository navigation
Home: bound the key table and share it with memory() (#395) - #413
Merged
Merged
Conversation
The Home key table never shrank, was deep-cloned by every memory() and written whole to canon. After each projection, sync_catalog now prunes it: a volatile key (a Slot item, an item of an Ephemeral hub) goes once it is in neither the shown nor the previous projection and is not the focus; past 2 x shown + 256 keys the oldest unshown, unfocused keys go too; Ephemeral groups of an older generation go. Both indexes are rebuilt after a drop. A Home with stable hubs and rating keys under the cap drops nothing. A remembered cursor older than the retained window recovers to the first row. HomeScreen::items and HomeMemory::items are Arc<Vec<HomeItemKey>>; memory() clones the Arc and last_row/last_col are written only when they change, so an unchanged republication stays shared. Part of #395 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
Home's key table (
HomeScreen::items/groups) never shrank, was deep-cloned whole by everymemory()and written whole to canon. This bounds it and shares it withmemory().Prune rule
At the end of every new projection in
sync_catalog(was= the previous projection's shown elems,now= the new one):Slotitem, or an item of anEphemeralhub; both carry their generation and can never match again) is dropped when it is in neithernownorwasand is not the focused elem.2 * now + 256keys, keys in neithernownorwasand not the focus are dropped, lowest elem first (elems are minted monotonically, so the newest survive).Ephemeralgroups of an older generation are dropped.item_index,group_index) are rebuilt from the tables after any drop.Stated consequence: a remembered cursor older than the retained window recovers to the first row (
reconcile's existing fallback).A Home whose hubs all carry stable identifiers and whose cards all have rating keys, and which stays under the cap, drops nothing:
itemsis bit-for-bit what it was (a_stable_home_under_the_cap_prunes_nothing).Sharing
HomeScreen::itemsandHomeMemory::itemsareArc<Vec<HomeItemKey>>.memory()clones theArc; every write goes throughArc::make_mut, andlast_row/last_colare written only when they differ, so an unchanged republication leaves the table shared. No serde is involved (canon walks the slice), soCargo.tomlis untouched.Pruned keys in the focus engine
Every use of a remembered elem goes through the owner's
reconcile(FocusEngine::enteron restore,reconcileafter each landing,Seat::ProjectedFrom). For Home, a pruned key makesreconcilefall through to the first row, the same fallback an unknown elem already gets. Elems are never reused (next_elemis monotonic, restored onrestore), so a pruned elem cannot alias another card.Tests
volatile_keys_do_not_accumulate_across_publications: red before (240 keys after 20 publications), green after.the_focused_vanished_key_survives_a_prune: red before on its "unfocused key was kept" half.stable_keys_are_bounded_oldest_first: red before (400 keys, cap 264).a_stable_home_under_the_cap_prunes_nothing,focus_recovers_to_the_same_row_after_its_card_rotates_out,memory_shares_the_key_table: guards, green before and after.Gates (committed tree,
git status --shortempty before and after)cargo +nightly test -p plxnative-modules --lib screens::home:test result: ok. 95 passed; 0 failedcargo +nightly check --lib --no-default-features: cleanmake check:test result: ok. 4956 passed; 0 failed; 8 ignoredandtest result: ok. 5034 passed; 0 failed; 8 ignored(plus the smaller suites, all ok), exit 0make(ARM cross-build): exit 0make check-replaynot run locally; CI's simulator job is the replay evidence.Part of #395
🤖 Generated with Claude Code