Add broadcast subscription contract to fs-adapter-store#35
Merged
Conversation
Exposes setById/deleteById as intent-revealing public methods so that server-initiated events (e.g. WebSocket broadcasts from another client) can update the store without an HTTP refetch. The naming is deliberate: these are not general-purpose mutation hooks — they signal that the source of truth is an external system emitting authoritative state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploying fs-packages with
|
| Latest commit: |
1148707
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cc1cb8ce.fs-packages.pages.dev |
| Branch Preview URL: | https://feat-adapter-store-apply-ext.fs-packages.pages.dev |
Addresses review feedback: exposing applyServerUpdate/applyServerDelete
as public store methods leaked a mutation surface that invited misuse
as an HTTP-bypass shortcut.
Drops both public methods. Adds an optional `broadcast` config slot
accepting an AdapterStoreBroadcast<T> contract. The store calls
`broadcast.subscribe({ onUpdate, onDelete })` exactly once at
construction, routing incoming events directly into the internal
setById/deleteById. Consumers never see the mutation handlers — they
can only bind a broadcast source at store creation time.
Channel lifecycle (join/leave per component) stays in the consuming
app; the broadcast contract is the narrow bridge between that layer
and the store.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Syncing External Updates" section covering the AdapterStoreBroadcast contract — what it's for, the subscribe/unsubscribe shape, the rationale for not exposing raw mutation methods, and the lifecycle split between store (one-shot subscribe) and transport layer (connection join/leave). Also backfills the retrieveById row in the Store Module Methods table, which was missed when that method was added. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Goosterhof
approved these changes
Apr 19, 2026
This was referenced Apr 22, 2026
Goosterhof
added a commit
that referenced
this pull request
Apr 23, 2026
…fix-sweep fs-packages: re-normalize 10 publint git+ prefix regressions (PR #35 aftermath)
This was referenced May 12, 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.
Summary
broadcastslot onAdapterStoreConfigaccepting anAdapterStoreBroadcast<T>contract.broadcast.subscribe({ onUpdate, onDelete })once; incoming events flow straight into the internalsetById/deleteById.Why not expose
applyServerUpdate/applyServerDeletedirectlyEarlier iterations of this branch exposed those as public methods. Gerard flagged that this would inevitably get misused as a general HTTP-bypass shortcut — intent-revealing naming is a soft guardrail, not a hard one.
This design keeps the mutation path fully encapsulated: the only way in is via a
broadcastsource wired at construction. The handlers are never exposed on the returned store object.How consuming apps use it
Channel join/leave lifecycle stays in the component. The store just listens on whatever source the broadcast contract wraps.
Version bump
0.1.2 → 0.1.3— additive, non-breaking config option.Test plan
npm run buildnpm run typechecknpm test— 90/90 passnpm run test:coverage— 100%npx stryker run(adapter-store) — 100% mutation scorenpx oxfmt --check .npm run lintnpm run lint:pkg🤖 Generated with Claude Code