Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

trunk-merge/pr-3651/68492232-e428-4200-b96e-6822152cf8b4 - #3701

Closed
trunk-io[bot] wants to merge 3 commits into
mainfrom
trunk-merge/pr-3651/68492232-e428-4200-b96e-6822152cf8b4
Closed

trunk-io[bot] wants to merge 3 commits into
mainfrom
trunk-merge/pr-3651/68492232-e428-4200-b96e-6822152cf8b4

Conversation

@trunk-io

@trunk-io trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown
Trunk Merge Pull Request Banner

This pull request was created and is being managed by Trunk Merge.

This pull request is based on the main branch at SHA 7b426cd5e7208de199561e2e8adafb376995a7c0.

See more details here.

When CI completes, this pull request will be closed automatically.

Pull Requests Being Tested

This pull request is testing the changes from pull request 3651.

gantoine and others added 3 commits July 21, 2026 13:45
localStorage is the web host's single persistence layer, but the
getItem -> parse -> guard -> stringify -> setItem boilerplate was hand-rolled
across five per-device stores. Consolidate all access into web-local-store.ts:

- createRecordStore(key, entrySchema) for the Record<string, Entry> registries
  (workspaces, archive, task-metadata); readValidated(key, schema, fallback) for
  the browser-tabs snapshot; raw readJson/writeJson/removeKey for the auth
  session/preferences; rawLocalStorage for the zustand backend.
- Every persisted store is now validated against a Zod schema on read and drops
  what no longer fits (per-entry for registries), so evolving a shape is a schema
  edit rather than a hand-written localStorage migration. Reuse the canonical
  workspaceSchema / tabsSnapshotSchema from @posthog/shared; derive the two
  web-local types (WebArchivedTask, TaskMetadata) from their schemas via z.infer.

IndexedDB is left untouched: it holds only the non-extractable auth cipher key
(web-auth-adapters.ts), which localStorage cannot store without exposing its raw
bytes. Documented the web-host build story and this storage policy in AGENTS.md,
and fixed a stale web-container.ts comment referencing a nonexistent test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ackend

Review flagged that the seam's best-effort swallow was applied where the
original direct writes let errors propagate, turning failures into silent
successes:

- Auth session/preferences writes and the logout clear now use strict variants
  (writeJsonStrict / removeKeyStrict) that propagate. A swallowed clearCurrent()
  would report logout complete while the session stayed in localStorage,
  recoverable on reload.
- rawLocalStorage (zustand persist backend) lets setItem/removeItem throw again;
  the renderer persistence layer already awaits and logs failed writes, so
  swallowing reported dropped drafts/settings/layout writes as success.

Best-effort writeJson/removeKey stay for the rebuildable per-device caches, where
a dropped write only costs cross-reload persistence.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 3064f09.

@trunk-io trunk-io Bot closed this Jul 22, 2026
@trunk-io
trunk-io Bot deleted the trunk-merge/pr-3651/68492232-e428-4200-b96e-6822152cf8b4 branch July 22, 2026 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant