[P2] Saved plan library loses plans across tabs and after one unreadable entry #28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Priority: P2
Type: bug
Source: project review requested 2026-10-26 (second pass)
Location:
src/PlanLibrary.tsx:34-55, 93-100, 171-172Problem and evidence
The library is read from localStorage once at mount and each save/delete writes the tab's in-memory list over the key. (1) Two open tabs: save Plan B in tab B, then Plan A in the older tab A; storage holds only Plan A. (2) Validation is all-or-nothing: one entry with an 81-character name (or other unreadable entry) shows "Invalid local library." with an empty list, and the next save overwrites every valid plan.
Suggested correction
Re-read and merge storage inside each save/delete, refresh on
storageevents, validate per entry (show valid plans, keep unreadable entries unchanged), and never overwrite a library that cannot be parsed.Acceptance criteria
Unit regressions for stale-tab merge, kept entries, unreadable libraries and the 20-plan limit; two-tab browser check; pnpm verify passes.
Scope: maintenance of the educational simulator. Preserve historical R1 acceptance and operational-validation limits.
Fixed on
maintenance/review-2026-10-27in50cc185— PR #40.Per-write re-read/merge,
storageevent refresh, per-entry validation keeping unreadable entries; unreadable libraries are never overwritten. Unit regressions plus two-tab Chromium check.Branch verification:
pnpm verify145 tests and release budgets; Chromium/Firefox/WebKit review, replay, compatibility and offline lifecycle checks; CI verify runs #111/#112 pass. Record:docs/MAINTENANCE-2026-10-27.md. Closes on merge of PR #40.