feat: adopt the record observer and remove the social graph - #185
Merged
Conversation
Adopts the Enbox release set that introduces `records.observe()` (api 0.6.72 /
browser 0.3.64) and deletes the app-owned data-sync machinery it replaces.
Record observer
- Add `useRecordsView`, a reusable bridge from the async `records.observe()`
view to `useSyncExternalStore`.
- `WalletsTab` now observes `connect.records.observe('wallet', ...)` instead of
`useQuery(fetchWallets)`, so wallet records stay current on their own. Drops
`fetchWallets`/`fetchWalletsEffect` and the wallet entry from the manual
`agent.sync.on -> invalidateQueries` bridge.
Social graph removed
- Deletes the social graph feature: pages, tab, hooks, queries, routes, nav
entries, query keys and tests. The social-graph protocol stays installed
because `ProfileDefinition` composes it (`role: 'social:friend'` gates
`privateNote`).
Breaking-release migration (0.6.72 removed these APIs)
- `repository(...)` facade -> typed `records.query/create/read/delete`. Singleton
upsert (`profile.set`, `profile.<image>.set`) is now explicit
query-then-update-or-create.
- `records.queryAll(...)` drain -> explicit cursor loop.
- `MessagesLiveQuery` / `reply.liveQuery` -> `subscriptionHandler` supplied at
dispatch, with `reply.subscription.close()` for teardown.
Note: `$recordLimit` is now a read-time visibility projection, so writes past
the limit succeed instead of being rejected; `profile` is read as
query-then-first rather than relying on a write-time singleton guarantee.
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
Adopts the Enbox release set that introduces
records.observe()(api 0.6.72 / browser 0.3.64) and deletes the app-owned data-sync machinery it replaces. Net −2,135 lines.Record observer
useRecordsView— a reusable bridge from the asyncrecords.observe()view touseSyncExternalStore(startsloading, opens the view, forwards snapshots, closes on teardown).WalletsTabobservesconnect.records.observe('wallet', …)instead ofuseQuery(fetchWallets). Wallet records now stay current on their own, sofetchWallets/fetchWalletsEffectand the wallet entry in the manualagent.sync.on → invalidateQueriesbridge are both deleted.Social graph removed
Feature deleted end to end: pages, tab, hooks, queries, routes, nav entries, query keys, tests.
Breaking-release migration
0.6.72 removed these APIs; the code that used them is gone rather than ported laterally:
repository(...)facade → typedrecords.query/create/read/delete. Singleton upsert (profile.set,profile.<image>.set) is now explicit query-then-update-or-create.records.queryAll(...)drain → explicit cursor loop.MessagesLiveQuery/reply.liveQuery→subscriptionHandlersupplied at dispatch +reply.subscription.close().Test plan
npx tsc --noEmit— cleanbun run lint— 0 errorsbun run test— 86 files, 761 passed, 10 skipped, 0 failedtsc -b && vite build— succeedsReviewer notes — behaviour changes static checks can't catch
$recordLimitis now a read-time visibility projection, not a write-time gate. Writes past the limit succeed (stored, projected out of reads) instead of being rejected.profileis therefore read as query-then-first rather than relying on a write-time singleton guarantee. Any flow that expected a rejection to enforce a singleton changes behaviour.MessagesLiveQuerybuffered dispatches until a listener attached; that buffering is gone, so a late handler would drop catch-up events. Handlers also receive raw DWN messages, not hydrated records, and there are nocreate/update/deletesemantic events — onlydescriptor.method.verifyInstalled()reportowner-can-update(owner sessions) orwallet-reapproval-required(delegate sessions).I could not exercise the live app, so the wallet-observer reactivity and the sync-invalidation subscription path are worth a manual pass.