Repository navigation
refactor: on-demand cache sync, message validation, tests - #263
Merged
Merged
Conversation
…, add tests - Page streams only between START_SYNC/STOP_SYNC; changes are coalesced per entity and flushed in batches - Validate every bridge and port message with runtime guards; drop oversized or unencodable payloads in the relay - Background caches per-tab entries only while a viewer is connected and ignores stale relay ports - Virtualized query/mutation lists, shared EntityList/DetailHeader/Toolbar, ErrorBoundary, chunked TreeView with Map entries addressed by index - Add vitest suite for serialization, set-at-path, sorting, apply-changes - CI runs tests; pin action versions; dependabot groups react and tracks github-actions - Drop <all_urls> host permission; bump version to 1.0.3
Shared references are still duplicated, but each user-data field now has an 8 MiB UTF-8 budget and a nesting cap; past them values become a truncated sentinel shown as [Truncated] in the viewer. Snapshot entries are encoded and isolated one by one, and the encoder reports exact UTF-8 JSON size.
…ures - Drop the 10k list cap; size messages in UTF-8 bytes (32 MiB backstop) - Page and background split snapshots into ~8 MiB chunks, reassembled with supersession; oversized entities re-encoded with smaller field budgets - Relay wraps port posts, resyncs on a lost update with backoff, never on a lost snapshot or forged junk - Viewers show loading progress and an explicit failure state instead of the setup screen
- Snapshots and flushes share one EncodePass: containers met again in user data are charged to a 16 MiB repeat allowance and truncated once it is spent; retries and failures roll back - Typed arrays are walked lazily instead of via Object.keys - Decoding stops a Map/Set at the first colliding key or member and counts the rest as omitted, so positional edit paths stay aligned
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
START_SYNCandSTOP_SYNC, which the background sends when the first viewer of a tab connects and when the last one leaves. Cache events are coalesced per query hash / mutation id and flushed in batches. Pages without TanStack Query never open a port to the background.utils/guards.ts) instead of a type cast.CONNECT_ACK, ignores stale relay ports, and tracks client presence (CLIENT_READY) separately from streaming for the toolbar icon.utils/serialization.ts,utils/wire-entities.ts):data,error,meta,variables, …) gets an 8 MiB UTF-8 budget plus a nesting cap. Entry structure is always sent whole.EncodePass).truncatedsentinel, shown as[Truncated]. Positions are kept, so path edits still target the right page value.utils/chunking.ts):snapshotId/chunkIndex/chunkCount), from the page and from the background cache for late viewers. Large update batches are split the same way.utils/resync.ts). A lost snapshot shows an explicit failure state instead of the setup screen, and viewers show loading progress for multi-chunk snapshots.@tanstack/react-virtual).EntityList,DetailHeaderandToolbarcomponents, plus anErrorBoundary.TreeViewreworked to show large nodes in collapsed ranges.MapEntrySegment).pnpm test, and action versions are pinned.@tanstack/query-coremoved to devDependencies (it is only imported for types).<all_urls>host permission, updated the description, version 1.0.3.Testing
pnpm compile,pnpm test(258 passed),biome ci,pnpm buildandpnpm build:firefoxall pass._ownergraphs, large typed arrays) stay within roughly 50–450 ms per snapshot. Ordinary data encodes byte-identically to before.