Repository navigation
Conversation
A Cloud Vault restore writes the agent profile to the local database behind the page's back. When the encryption-key publisher had already set a key on the empty agent resource, reloading it skipped the stored copy because of the unsaved edit, so the restored device never showed the person's name. Adds integration tests for profile restore and a wasm export/import test.
A full snapshot from a node replaced a local resource that had history of its own. For an agent the node made itself that wiped the name and picture and left two documents that could no longer merge. Replace only placeholders and docs rebuilt without history. Also publish the agent profile that onboarding kept local-only once the personal drive is hosted on a node: merge the node's copy, then push the whole document. Runs on connect, so accounts already in that state heal. Reverts the speculative hydrate merge for unsaved edits.
joepio
marked this pull request as ready for review
November 17, 2026 22:06
publishAgentProfile lifted the agent's local-only registration before it knew the push would happen. When the profile was not loaded yet, or the identity changed meanwhile, it returned with the registration gone, so nothing ever tried again. Register it again unless the push succeeded.
Member
Author
|
Self-review, read critically. Do not merge on the green checks alone: the checks that ran on this PR are the Flutter package jobs only. The browser suite does not run on PRs, so I dispatched Fixed in a follow-up commit (a79503e)
Open risk a reviewer should weigh
Smaller notes
|
This branch has not been deployed
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.
Requested by Joep · project thread
What was wrong
Found while walking real flows on a local stack (portal, managed node, Cloud Vault, mock billing).
What the devices held: the node had an agent document with
encryptionKey,publicKey,read, and noname(written by device 2'sEncryptionKeyPublisher). Device 1 still hadisLocalOnlySubject(agent) === trueafter its drive was hosted, so it never pushed its profile. Its local row ended up as a bare stub (isA,publicKey,read).Causes and fixes (
browser/lib/src/store.ts)Store.applyIncomingswapped the local Loro document for any full snapshot (WS GET, or UPDATE with the snapshot flag) whenever there were no unsaved changes. That includes the bare agent a node creates by itself, so a node holding a stub could replace a real profile and its history. Now a document with real history is merged into; only a placeholder or a history-less rebuild is replaced, the rulereplayOnLocalBasealready uses.Store.publishAgentProfile(): when the agent is still registered local-only while its personal drive is hosted, it unregisters the agent, fetches the node's copy so the histories merge, and saves the whole document. It runs on connect and fromsyncDriveToServerAndVerify, so accounts already in this state heal on their next session; on failure the agent is registered local-only again and it retries later.Test coverage
No test connected a profile made on one device to a node-hosted drive and a second device, which is why this was invisible. Added integration tests (real
Store, wasm database, realatomic-server):agent-profile-publish.integration.test.ts: the profile is published when the drive is hosted on the node; a node that holds a name-less agent from another device is healed (both documents merge, key and name survive); a profile with history is kept when a full snapshot of a bare agent arrives. The first and third failed before the change.vault-profile-restore.integration.test.tsand one test inwasm/tests/vault.rs: guard tests showing the Cloud Vault path does carry the profile (it did already; these pin it).Results:
browser/libvitest 188 files / 1788 tests passed; the three integration files 13 passed;pnpm typecheckclean.Verified by hand (Chromium, local stack with a managed node)
New account "Flow Five", Cloud Server turned on with mock billing: the node's agent resource has
name: Flow Five. A fresh second device restoring with the recovery code shows "Flow Five" in the account row, and the first device still has the name in its local database.Not covered
wasm/tests/vault.rs(a_current_state_checkpoint_is_smaller_and_restores) was seen before these changes and not looked into.helpers/managed/cloudSync.tssaying managed nodes refuse a standalone agent profile looks out of date (the live managed node accepted it) and is left as is.No UI changed, so no screenshots. The first commit on the branch is superseded by the second; please squash.
Checklist
browser/CHANGELOG.md)