[P2] Saved plan library loses plans across tabs and after one unreadable entry #28

Closed
opened 2026-10-27 02:59:42 +00:00 by pedro · 1 comment
Owner

Priority: P2
Type: bug
Source: project review requested 2026-10-26 (second pass)

Location: src/PlanLibrary.tsx:34-55, 93-100, 171-172

Problem 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 storage events, 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.

Priority: P2 Type: bug Source: project review requested 2026-10-26 (second pass) Location: `src/PlanLibrary.tsx:34-55, 93-100, 171-172` Problem 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 `storage` events, 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.
Author
Owner

Fixed on maintenance/review-2026-10-27 in 50cc185 — PR #40.

Per-write re-read/merge, storage event refresh, per-entry validation keeping unreadable entries; unreadable libraries are never overwritten. Unit regressions plus two-tab Chromium check.

Branch verification: pnpm verify 145 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.

Fixed on `maintenance/review-2026-10-27` in `50cc185` — [PR #40](https://git.guresky.com/pedro/DiveSim/pulls/40). Per-write re-read/merge, `storage` event refresh, per-entry validation keeping unreadable entries; unreadable libraries are never overwritten. Unit regressions plus two-tab Chromium check. Branch verification: `pnpm verify` 145 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.
pedro closed this issue 2026-10-27 05:39:05 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: pedro/DiveSim#28
No description provided.