Repository navigation
fix(data): isolate trusted owner grants and dispose replicas locally - #2997
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit ad707f5. Configure here.
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 111 measured values. Public-import reachability bundles (bytes)No changes across 141 measured values. |

Summary
Why
A replica could previously reclaim the account fence after another account became active, and retiring a window cleared persistence used by peers. An old owner's delayed commit could also reach a newly activated account's cache. Separately, a fixed numeric budget unnecessarily blocked a first read on quota estimation (fixes #2992).
Changes
fence: 'explicit'makesDataOwner.activate(account | null)the trusted control path. Replica joins cannot activate accounts or request global erasure. Explicit mode uses its own fence namespace and a generation-specific persisted partition.dispose()releases local store or replica resources without signing out other replicas or clearing their cache.retire()retains its existing global account-lifecycle meaning where supported.Validation
pnpm format:check(repo-wide; scoped formatting passed)pnpm typecheck(repo-wide; scoped TypeScript check passed)pnpm test(repo-wide; owning suites run locally)pnpm run synccompleted with dependency-state warnings for unrelated prepared workspace modules; generated tracked files remained clean.perf-review:node scripts/perf-review-scan.mjs --base upstream/main --jsonreturned[]. Admission runs per replica, activation per trusted account transition, budget selection once per persistence instance, and disposal on a cold lifecycle path. No new render, DOM, per-item allocation, recurring task path, or ordinary store initialization transaction. Same browser esbuild comparison against 0.19.2: direct store +377 minified bytes (+161 gzip); owner exports +2,962 minified bytes (+871 gzip). No remaining must-fix or needs-evidence findings.concise-code: runtime source +287/-70 lines. Explicit activation and local disposal are required by the reproductions; generation-specific partitions prevent delayed writes from contaminating a new grant. Automatic fencing for independent stores was rejected because it cannot establish trusted admission. No new module or generic checkpoint API.git diff --checkpassed.Risk / follow-ups
Provenance
agent-authored)Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
High Risk
Changes account fencing, trusted activation, and persistence lifecycle; incorrect host sequencing could leave stale grants or cross-generation cache contamination.
Overview
Adds
dispose()so a tab or replica can shut down locally—flushing queued saves when persistence is up—withoutretire()’s account-wide sign-out or cache wipe. Replicas senddisconnectinstead of retiring peers; owner protocol bumps to v5.Introduces
fence: 'explicit'with trustedDataOwner.activate(account | null): separate IndexedDB/BroadcastChannel namespace, generation-scoped persistence partitions, and admission only for activated grants. Replicaretire/persist clearno longer revoke other tabs in this mode.Fixed numeric persistence budgets skip
deviceHints()so first reads are not blocked on quota estimation.Reviewed by Cursor Bugbot for commit 304540d. Bugbot is set up for automated code reviews on this repo. Configure here.