fix(router): replace bloom filter inventory with index-based bitfield#220
Merged
mohamedmansour merged 1 commit intomainfrom Apr 11, 2026
Merged
fix(router): replace bloom filter inventory with index-based bitfield#220mohamedmansour merged 1 commit intomainfrom
mohamedmansour merged 1 commit intomainfrom
Conversation
The FNV-1a bloom filter (256-bit, hash mod 256) caused false-positive collisions when many components mapped to the same bit position. This broke client-side navigation in apps with 20+ components -- the server would skip sending templates it thought the client already had. Replace with sequential index-based bitfield: - Server assigns each custom element a sequential index (0, 1, 2...) based on alphabetically sorted component names from both protocol.fragments and protocol.components - Inventory is a hex-encoded bitfield where bit N = component N loaded - Zero hash collisions guaranteed - Bitfield size = ceil(N/8) bytes (e.g. 3 bytes for 19 components vs 32 bytes for the old bloom filter) Client changes: - Inventory is now an opaque hex string -- client stores it from SSR meta tag, sends it back via X-WebUI-Inventory, receives updated hex from partial responses - Renamed releaseTemplates() to gc() -- clears all cached templates and resets inventory to empty - Removed all client-side hash functions and bit manipulation - inventory.ts simplified to just a module doc comment Server changes (route_handler.rs): - build_component_index() assigns sequential indices from the union of protocol.fragments and protocol.components (hyphenated names only) - filter_needed_components() uses bitwise has_component/set_component with the index map instead of FNV-1a hash - SSR emits compact inventory meta tag Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6f971fb to
45ae03f
Compare
toddreifsteck
approved these changes
Apr 11, 2026
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.
The FNV-1a bloom filter (256-bit, hash mod 256) caused false-positive collisions when many components mapped to the same bit position. This broke client-side navigation in apps with 30+ components -- the server would skip sending templates it thought the client already had.
Replace with sequential index-based bitfield:
Client changes:
Server changes (route_handler.rs):