Repository navigation
Conversation
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.
8213b5e to
f646c2c
Compare
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.
|
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 After this PR: "Anouk Vermeer's Drive". The default is 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:
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.
|
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 |
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 Drivethe other two paths write. An account with no name set still gets the library default.openPrivateHomereads 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 —
ensurePrivateDrivereturns 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:ensurePrivateDrivehas 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 reasonInvitePageleaves 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.adoptLegacyDriveListwas doing the same thing while already holding the name for itsagentNameoption, 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 lintinbrowser/fails on develop today: oxfmt rejects two expressions inlib/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 touchingbrowser/is blocked until it is settled. The fix ispnpm --filter @tomic/lib formatand touches nothing else. Cherry-pickf646c2con its own if this PR is going to sit.Related Issues
None.
Checklist
browser/CHANGELOG.md, front-end change so it does not belong in the root changelogopenPrivateHome.test.ts