Skip to content

Title the private home after whoever it belongs to - #1682

Closed
joepio wants to merge 8 commits into
developfrom
claude/project-thread-8tdupo
Closed

joepio wants to merge 8 commits into
developfrom
claude/project-thread-8tdupo

Conversation

@joepio

@joepio joepio commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Requested by Joep · project thread

Before: a returning account signing in on a second device, or on any device whose cloud restore did not finish inside its budget, lands in a workspace called "My drive". Onboarding titles the workspace it creates <name>'s Drive, and so does accepting an invitation, so the generic label showed up only in the one moment the user has just proved who they are, where a workspace carrying somebody else's default name reads like the wrong account.

After: that workspace carries their name too, the same <name>'s Drive the other two paths write. An account with no name set still gets the library default.

openPrivateHome reads the name off the Agent resource before it creates the home.

How

The read is bounded at 2s and falls back silently. A title only lands while the drive is being created — ensurePrivateDrive returns an existing home untouched — so a name arriving later would never reach it, and a nameless workspace is better than holding the user out of theirs. There is no literal for that case: ensurePrivateDrive has the default, inside the library, where the i18n extractor cannot turn a plain string into an injected hook in a non-component function, which is the same reason InvitePage leaves the name out. The identity guard still runs after the read, so a sign-out during it cannot mint the previous account's home.

Store.adoptLegacyDriveList was doing the same thing while already holding the name for its agentName option, and now titles it the same way.

Two new unit tests: the named case, and a failing Agent read falling back to the default.

Also here: develop's browser lint is red

Unrelated to the above and separated into its own commit, because it blocks everybody. pnpm run -r lint in browser/ fails on develop today: oxfmt rejects two expressions in lib/src/presence.test.ts, added by #1680, whose own CI run was cancelled by the next merge. That is the repo's pre-commit hook as well as CI's lint step, so any commit touching browser/ is blocked until it is settled. The fix is pnpm --filter @tomic/lib format and touches nothing else. Cherry-pick f646c2c on its own if this PR is going to sit.

Related Issues

None.

Checklist

  • Add changelog entry linking to issue, describe API changes — browser/CHANGELOG.md, front-end change so it does not belong in the root changelog
  • Add or update tests if needed — openPrivateHome.test.ts
  • Update docs if needed — no doc describes the title

A home the app materializes was called "My drive". Onboarding already titles
the one it creates `<name>'s Drive` (NewIdentitySection), and so does accepting
an invite (InvitePage), so the only workspaces carrying the generic label were
the ones openPrivateHome builds: a returning account on a second device, and a
sign-in whose vault restore did not land inside its budget. Those are exactly
the moments the user has just proved who they are, which is when a drive with
somebody else's default name on it reads as the wrong account.

Read the name off the Agent resource and pass `<name>'s Drive`. The read is
bounded at 2s and falls back silently, because a title only lands while the
drive is being created -- ensurePrivateDrive returns an existing home untouched
-- so a name arriving later would never reach it, and a nameless account is
better than a user held out of their workspace. No literal for that case:
ensurePrivateDrive has the default, inside the library, where the i18n
extractor cannot turn a plain string into an injected hook in a non-component
function. The identity guard still runs after the read, so a sign-out during it
still cannot mint the previous account's home.

The legacy drive-list migration in Store did the same thing while already
holding the name for its agentName option, and now titles it the same way.
`pnpm run -r lint` in browser/ fails on develop: oxfmt rejects two expressions
in lib/src/presence.test.ts, added by #1680. That is the repo's own pre-commit
hook as well as CI's lint step, so every commit touching browser/ is blocked
until it is settled. #1680's own CI run was cancelled by the next merge, which
is how it reached develop unchecked.

`pnpm --filter @tomic/lib format`, no other file changed.
@joepio
joepio force-pushed the claude/project-thread-8tdupo branch from 8213b5e to f646c2c Compare September 24, 2026 06:44
Running the app settles these, and two entries are this change's:
`{0}'s Drive` gains a reference from `helpers/openPrivateHome.ts` with `name`
as its argument, and `My drive` loses the one it had there. Plain `.ts` helpers
already carry translatable strings this way (`draftsFolder.ts`,
`forksFolder.ts`), so the string is extracted the same as the two existing
`{0}'s Drive` call sites.

The rest is the extractor settling catalogs that were already behind the
source: a `GettingStartedFlow.tsx` reference for "Create account and accept",
and four blank lines between entries. Settled by running the dev server, which
is the fixed point the committed catalogs have to match, rather than by
`clean-translations`, which extracts from test files too and lands somewhere
else.
The discarded-document test added in #1681 stubbed `window` with a bare
EventTarget and only then built its Store. `new Store()` reads
`localStorage` behind a `typeof window !== 'undefined'` guard, so the stub
made that read reachable with no `localStorage` beside it: the test threw
`ReferenceError: localStorage is not defined` before its own
`vi.unstubAllGlobals()`, leaving the half-made window standing for the rest
of the file. Twelve tests in `watchForVaultBackups` then failed the same
way, which is every develop and branch run since #1681 merged, none of
which had a verdict of its own to show it.

The store is built before the stub now, and the unstub moved into the
file's `afterEach`, where a throwing test cannot skip it.
`ownerName` guarded the Agent read with `withDeadline`, which swallows a
rejection but cannot swallow a throw that happens before there is a promise:
a `getResource` that raises synchronously took the whole of `prepare` down
with it, and the home was never created at all. The guard covers the call
now, not just the promise.

The getting-started flow's own test found this: its store mock has no
`getResource`, so the call threw `TypeError` and `ensurePrivateDrive` was
never reached. The mock carries an Agent with a name now, so that test
covers the titled home end to end rather than only that a home was made.
…me that is there

Running the app to screenshot this change showed the recreated workspace
titled `[i18n-404:1664]`, and it showed it on develop too, without any of this
change: the literal `'My drive'` sits in a plain module, the extractor turns it
into a catalog lookup, and this runs during boot, when the catalog is not
always loaded. The title is written into the resource as it is created, so it
stays that way. Passing `undefined` takes the lookup out and lets the library's
own plain default stand; the composed `<name>'s Drive` carries `@wc-ignore` so
it cannot go the same way. Nothing is lost in translation: the `{0}'s Drive`
entry is empty in es, fr and de, and `My drive` is the English string in all
four.

The name also has to be read twice. Signing in on a new device caches the
Agent as a stranger sees it, `read`, `isA` and `publicKey` and no name: a ready
resource with no error, which every later reader then gets. Asked again, now
signed in, the server answers with the profile. Without that second ask the
home took the default title on three runs out of three, with the name sitting
readable in the store a second later.

Verified against a local server: onboard as "Anouk Vermeer", destroy the
workspace, sign in again on a fresh browser profile. Before: `[i18n-404:1664]`.
After: "Anouk Vermeer's Drive", three runs out of three.

joepio commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

Ran this against a local server to screenshot it, per the new screenshots rule in AGENTS.md, and the screenshot found something this PR did not introduce.

Before, on develop with none of this change: a private workspace the app recreates at sign-in is titled [i18n-404:1664]. openPrivateHome passes the literal 'My drive' from a plain module, the extractor turns that into a translation-catalog lookup, and this code runs during boot, when the catalog is not always loaded yet. The title is written into the resource as the workspace is created, so it stays that way for good.

After this PR: "Anouk Vermeer's Drive". The default is undefined now, so the library's own plain string stands and there is no lookup to fail, and the composed <name>'s Drive carries /* @wc-ignore */ so it cannot go the same way. Nothing is lost in translation: {0}'s Drive is empty in es, fr and de, and My drive is the English string in all four.

Reproduction, three runs out of three each way: onboard as "Anouk Vermeer", destroy the workspace, sign in again with the secret in a fresh browser profile.

Two other things the run turned up, both now fixed here:

  • The owner's name has to be asked for twice. Signing in on a new device caches the Agent as a stranger sees it (read, isA, publicKey, no name) — a ready resource with no error, so every later reader gets that copy. Without a second, signed-in read the home took the default title on three runs out of three, with the name sitting readable in the store a second later.
  • vaultAutoBackup.test.ts has been failing twelve tests on develop since Stop reporting a restore the page walked away from as a failure #1681 merged (its own run was cancelled, so nothing reported it). A test there stubs window before building its Store, new Store() reads localStorage behind a typeof window !== 'undefined' guard, and the throw skips that test's own vi.unstubAllGlobals(), leaving the stub standing for the rest of the file. Fixed in 963ece85, which is develop's problem as much as this branch's.

Generated by Claude Code

develop landed the same vault-backup test fix as `e7cae17`, found
independently from the same run. Kept develop's wording; the code either side
is the same.
@claude
claude Bot marked this pull request as ready for review September 24, 2026 14:01
joepio added a commit that referenced this pull request Sep 24, 2026
Combines #1549, #1654, #1682, #1684, #1689, #1690, #1691, #1692, #1693, #1694, #1695, #1696, #1697 and #1698, with the conflict resolutions and e2e fixes described in #1699. Tested green on Mancave in run 4576 at 25b124a.

joepio commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

Landed on develop in c589fc6 via the combined batch #1699, which was tested green on Mancave at this PR's head. Closing, since the squash merge does not mark it merged.


Generated by Claude Code

@joepio joepio closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant