feat(signals): WIDE_WRITE attribution warning - #3035
Merged
Conversation
The written-fan-out detector from the solidjs#3018 follow-up discussion: a committed root invalidation (sync write, refresh(), async landing) reaching a node with >= 250 live subscribers (default) warns that every one re-runs this flush, and points at createSelector/ createProjection for the keyed-question inversion. Per review: no new core sites - reads the dev-maintained _subCount from the graph-size diagnostics, checked inside the engine's stampWrite, which is the single funnel for all committed root invalidations (so unchanged writes, which stamp nothing, can never warn). Specced together with HUGE_FAN_OUT so they don't double-fire: HUGE_FAN_OUT is always-on at link time from 2000 up (static structure warns even unwritten); WIDE_WRITE is attribution-only at write time from a lower bar, once per node, re-warning only on 2x subscriber growth. Documented in the dev-diagnostics RFC with the HUGE_FAN_OUT cross-reference mirroring the existing HUGE_FAN_IN <-> WIDE_SCOPE_DEPS pairing. Opt-out via enable({ wideWrites: false }); threshold configurable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: c4a2f2f The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Follow-up to #3018: the written-fan-out warning, implemented per the review guidance — via the dev-maintained
_subCountfrom the graph-size diagnostics, no core sites touched, specced together withHUGE_FAN_OUTso the two never double-fire.What it catches
A committed root invalidation — sync write,
refresh(), or async landing — reaching a node with ≥ 250 live subscribers (default). Where the per-scope warnings blame the reader, this one blames the write: the fan-out actually happening, priced at the moment it happens.Reconciliation with
HUGE_FAN_OUTHUGE_FAN_OUT: always-on, fires at link time fromGRAPH_SIZE_WARN_AT(2000) up — structure so large it warns even if never written.WIDE_WRITE: attribution-only, fires at write time from a much lower bar (250), because fan-out only costs anything when the node actually changes. Once per node, re-warning only after the subscriber count doubles — so a node that trips both gets at most oneWIDE_WRITEalongsideHUGE_FAN_OUT's own milestones.documentation/solid-2.0/08-dev-diagnostics.md, with aRelated:cross-reference underHUGE_FAN_OUTthat mirrors the existingHUGE_FAN_IN↔WIDE_SCOPE_DEPSpairing.Implementation
One placement decision worth a look: the check lives in the engine's
stampWriterather than directly in thewritehook.stampWriteis the single funnel for all committed root invalidations (writes,refresh(), async landings), so one call site covers all three — and inherits a correctness property for free:setSignalonly stamps after the equality gate, so unchanged writes (which notify nobody) can never warn. The message's verb (write to/refresh of/async landing on) anddata.writecarry the kind.Tests
5 new in
tests/attribution-wide-write.test.ts: warns once at threshold with muting on repeat writes; re-warns only after 2× subscriber growth (30 → 55 silent, → 65 warns); fires forrefresh()of a wide memo; quiet under threshold and for equality-gated unchanged writes; opt-out. solid-signals suite green (1323).🤖 Generated with Claude Code