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
Closed
trunk-io[bot] wants to merge 3 commits into
trunk-io[bot] wants to merge 3 commits into
Conversation
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>
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
trunk-io
Bot
deleted the
trunk-merge/pr-3651/68492232-e428-4200-b96e-6822152cf8b4
branch
July 22, 2026 13:16
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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.