Answering the tree of the day performs three separate load/save round-trips on the one stats blob: the day's points #4

Closed
opened 2026-12-02 14:26:35 -05:00 by cmoriarty · 1 comment
Owner

What happens: Answering the tree of the day performs three separate load/save round-trips on the one stats blob: the day's points, the completion mark, and the daily result. save() has no try/catch, so if setItem throws partway (storage quota, private mode) the day keeps its points while the completion mark or the result is lost — the same day's puzzle could then be answered again for further points — and the throw escapes the click handler in main.ts:312. The pattern predates this change; the change added the third write to the sequence.

Where: src/lib/stats.ts:103-105 (save), reached from src/lib/session.ts:161-175

How it was seen:

  • Read while reviewing the daily-result recording; the in-memory StorageLike double in the tests never throws, so no test exercises a failing storage.

Found by Braid's run run_01M8VWVBDV6PB8SKYB2ABCPV7J, outside the work it was doing.

**What happens:** Answering the tree of the day performs three separate load/save round-trips on the one stats blob: the day's points, the completion mark, and the daily result. save() has no try/catch, so if setItem throws partway (storage quota, private mode) the day keeps its points while the completion mark or the result is lost — the same day's puzzle could then be answered again for further points — and the throw escapes the click handler in main.ts:312. The pattern predates this change; the change added the third write to the sequence. **Where:** src/lib/stats.ts:103-105 (save), reached from src/lib/session.ts:161-175 **How it was seen:** - Read while reviewing the daily-result recording; the in-memory StorageLike double in the tests never throws, so no test exercises a failing storage. Found by Braid's run `run_01M8VWVBDV6PB8SKYB2ABCPV7J`, outside the work it was doing.
Author
Owner

Shipped in braid-testing/flash-leaf#6, merged into main as b46fe5c2ac.

The OpenSpec change is archived as 2026-12-03-answering-the-tree-of-the-day-performs-t-s1b68w.

Braid run: http://openspecflow.internal.underthere.xyz/run/run_01M8X62E3VQ5QRRDDX86S1B68W

Shipped in [braid-testing/flash-leaf#6](https://forgejo.underthere.xyz/braid-testing/flash-leaf/pulls/6), merged into `main` as `b46fe5c2ac`. The OpenSpec change is archived as `2026-12-03-answering-the-tree-of-the-day-performs-t-s1b68w`. Braid run: http://openspecflow.internal.underthere.xyz/run/run_01M8X62E3VQ5QRRDDX86S1B68W
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
braid-testing/flash-leaf#4
No description provided.