refactor(query): delete the dead valuesEqual seam#157
Merged
Conversation
A type-erased Value-equality witness was allocated per query per render and threaded through the whole stack — built in observe(), carried on QueryObservation, stored on QueryEntry — and never called; the comment at commitFetch said it was "reserved" for select change-detection. Tracing the notify path shows the witness is UNUSABLE in its threaded shape, not merely unused: every commitFetch flips inFlight non-nil → nil, QueryState exposes that as isFetching, and the client can't know which subscribers render it — so no settle notify can be gated on value equality without freezing SWR spinners. Real gating needs select-style subscriptions (components declare the projection they read), and THAT witness compares selected projections, not raw Values — today's witness is mis-shaped for its own intended future. So: delete it end-to-end (observe / QueryObservation / QueryEntry + 27 ceremonial test-fixture sites), record the analysis at commitFetch's notify so the select feature inherits it, and KEEP Query.Value's Equatable constraint — the zero-cost reserved door for select (re-adding it later would be source-breaking). Pure dead-code deletion; no behavior change possible (nothing read it). Also drops a closure allocation per query per render. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📦 Bundle size
✅ Within budget (≤5% growth allowed). Baseline: Swift 6.3, WASM SDK 6.3-RELEASE, measured 2026-06-18. |
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.
Part II Wave 1 · #4 — a threaded-but-unused witness
A type-erased
Value-equality witness was allocated per query per render and threaded through the whole stack — built inobserve(), carried onQueryObservation, stored onQueryEntry— and never called. The comment atcommitFetchsaid it was "reserved" forselectchange-detection.Why delete, not wire
Tracing the notify path shows the witness is unusable in its threaded shape, not merely unused. The audit's caveat ("must not suppress the
isFetching → falsetransition") isn't an edge case — it's every commit:commitFetchalways flipsinFlightnon-nil → nilQueryStateexposes that asisFetching→ under the whole-snapshot model there is no settle notify that can be safely value-gated — gating would freeze SWR spinners. Real gating needs
select-style subscriptions (components declare the projection they read; notify gates on projection inequality, withisFetchingobserved separately) — and that witness compares selected projections, not rawValues. Today's witness was mis-shaped for its own intended future.Change
observe()'s closure,QueryObservation.valuesEqual,QueryEntry.valuesEqual+ its init (now implicit), and 27 ceremonial test-fixture sites.commitFetch's notify — notify-per-settle is documented as deliberate, with the select design inheriting the reasoning.Query.Value: Equatable— the zero-cost reserved door for futureselect(re-adding the constraint later would be source-breaking; the dead runtime plumbing was the waste, not the one-word declaration).Verification
Pure dead-code deletion — no behavior change possible (nothing read it); the existing suites are the pin:
🤖 Generated with Claude Code