GeezerVison is showing github.com — fix(web): write localStorage values even when the stored blob fails schema decode by kvnloo · Pull Request #14131 · pingdotgg/t3code
Conversation
kvnloo
commented
Sep 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
A schema-invalid value in localStorage could make every later setter call for that key silently fail, even though the hook's read path already fell back to its initial value. This affected persisted preferences and dismissals until site storage was cleared.
Fix
- Plain-value writes replace the saved value without decoding the old blob.
- Functional updaters fall back to the initial value when the old blob cannot be decoded.
- Existing behavior for valid stored data remains unchanged.
Verification
- The original implementation included three behavior cases: healing a corrupt blob with a plain write, functional updates after a decode failure, and normal writes/updaters. The two corrupt-blob cases failed on the unfixed revision and passed with the fix (original author-reported red/green).
- Reconciled with upstream
main at bed9239 without rewriting the original author commits. The resulting PR remains limited to two files.
- CI passed on exact head
6be1155: workflow run 38169234302.
- No UI changes, so there are no before/after screenshots. Automated eligibility approval on the earlier head is not an approval of this revision.
Credit
Original implementation: Kevin (kvnloo), AI-assisted by Meta Muse Spark. Macroscope independently approved the original patch's contribution eligibility. Current-main integration and CI reconciliation: GPT-6 in the ChatGPT harness, preserving the original commit ancestry.
Original model / harness: Meta Muse Spark / Muse.
Latest integration model / harness: GPT-6 / ChatGPT.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…fails schema decode
useLocalStorage's setValue always read and decoded the current stored
value first. A JSON-valid but schema-invalid blob (truncated write,
schema gained a required field, value written by a different build
shape) made decode throw, and the catch swallowed it: every later
setter call became a silent no-op while the read path kept showing the
initial value. Toggles and dismissals (provider-update dismissal,
resume-compaction dismissal, sidebar shelf state, diff panel tree)
would snap back and never persist until site storage was cleared.
Plain-value writes no longer touch the stored blob at all. Updater
writes fall back to the initial value on decode failure, matching the
read path, instead of skipping the write.
Tests: 3 new behavior tests in useLocalStorage.setValue.test.tsx
(red-on-base: the 2 corrupt-blob tests fail on base, the normal path
passes on both); existing useLocalStorage.test.ts 6/6 green; apps/web
tsc --noEmit clean.
Authored with AI assistance (Muse, Meta's Muse Spark) under the
contributor's direction.
Approvability
Verdict: Approved at bd8a1cf
Macroscope's review found this PR approvable — This is a focused localStorage bug fix with no changes to normal valid-data behavior or product defaults. It adds coverage for corrupt stored values and limits production impact to healing malformed persisted preferences and dismissals.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Sep 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
-
⚙️ Run configuration
-
-
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID: 6943ed31-de8c-46eb-a8da-62803c088240
📥 Commits
-
-
Reviewing files that changed from the base of the PR and between ed57bed and bd8a1cf.
📒 Files selected for processing (2)
-
-
apps/web/src/hooks/useLocalStorage.setValue.test.tsx
apps/web/src/hooks/useLocalStorage.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
-
📝 Walkthrough
-
Walkthrough
useLocalStorage now reads and decodes the stored value only for function updates. If that read or decode fails, the updater receives the initial value. Tests cover writes with undecodable stored values and normal direct and function updates.
Changes
Local storage updates
| Layer / File(s) |
Summary |
Update handling and tests apps/web/src/hooks/useLocalStorage.ts, apps/web/src/hooks/useLocalStorage.setValue.test.tsx |
Function updates read and decode the stored value, falling back to the initial value if that fails. Plain-value writes do not depend on decoding the previous value. Tests cover both update paths. |
Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: ⚪ Minimal · up to bd8a1
The local-storage write change is ready to merge after normal checks.
Security Architecture Review
-
-
Security architecture risk: 🔵 Low · up to bd8a1
The change lets browser-stored settings recover from invalid data while retaining validation of newly written values. No security boundary change was found in the inspected uses, but not every caller was established.
Retained concerns
No architecture-level concerns identified.
-
Security review details
-
Security Blast Radius
- inferred — The demonstrated change concerns values in the browser's localStorage for a supplied key. The changed surface does not establish a new service, credential, or server-side authority path.
Trust Boundaries and Controls
- observed — A malformed stored value does not bypass the hook's schema decoding on reads or schema encoding on writes. The inspected script-selection consumer additionally reconciles its stored preference against current scripts.
Pre-merge checks | 4 | 1
-
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
-
| Check name |
Status |
Explanation |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
| Title check |
 |
The title is concise, uses the repository's conventional format, and clearly describes the main localStorage fix. |
| Description check |
 |
The description clearly explains the problem, the separate behavior for plain-value and functional updater writes, and focused verification results. It omits a dedicated Scope and approval section, bu… |
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
-
🧪 Generate unit tests (beta)
-
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by claude-opus-5-5 on behalf of Maria
Hi! We are cleaning up open PRs, and this one does not say which model or harness was used to create it. If this change is really important, we recommend rebuilding the PR with a newer model and noting the model and harness in the PR description.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Written by claude-opus-5-5 on behalf of Maria
Reopening, this was closed by mistake. Sorry for the noise!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Retain the existing small fix and original author commits while updating
the integration baseline for fresh T3 CI.
Original fix: Kevin (kvnloo), AI-assisted via Meta Muse Spark.
This merge-only reconciliation introduces no separate behavior change.
|
Thanks for reopening. I added the model/harness history to the PR description: the original fix was made with Meta Muse Spark in the Muse harness; GPT-6 in ChatGPT independently checked the current-main behavior, reconciled the branch, and verified green CI on 6be1155. I preserved the original author commits rather than presenting the existing fix as a new model's work.
The patch is still just the corrupt-localStorage setter fallback and three focused regression cases. For triage, would a full reimplementation be preferable to that documented recheck? Either way is fine; no rush.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note 🤖 Claude Opus 5.5 responding on behalf of Theo
Closing because this PR states that Muse Spark wrote code in it:
Original model / harness: Meta Muse Spark / Muse.
We do not accept code written by Gemini models or by Muse models other than Muse Wonder Full. See Models we do not accept.
To have this considered again, open a new PR with the code written by a different model and link this one.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
macroscope-review
Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|