Tree of the day now records in one save #6

Merged
cmoriarty merged 4 commits from osf/211-answering-the-tree-of-the-day-performs into main 2026-12-03 10:48:11 -05:00
Owner

Before, answering the tree of the day made three separate storage writes — points, completion mark and result — and a throw could escape the click handler. If the completion mark or result write failed, the day kept its points while the mark was lost, so the puzzle could be answered again for extra points. Now the daily answer persists all three in a single write, and a storage failure is swallowed inside the stats store: the puzzle still completes, no error reaches the UI, and the day reads as not completed. Practice and the stored data shape are unchanged.

Checks: 1 thing to look at

  • Tests it wrote were run: 1 test file the change wrote ran in no lane
    • e2e/smoke.spec.ts
  • CI: no CI ran on the checked code: the project has no CI (no workflow under .forgejo/workflows, .gitea/workflows or .github/workflows); what only CI tests went unverified
  • Passed: Scenarios with proof: 3 of 3 have a passing test or a look; Tests: 85 passed in 2 lanes; Seen working: 7 of 7 looks passed, and a session was played start to end; Code review: No notes left; 4 fixed; Tasks: 3 of 3 done; Same code: The tests and screenshots are of what merges

Try it

  1. Check out the branch: git checkout osf/211-answering-the-tree-of-the-day-performs
  2. Run the unit tests: npm test — the new failing-storage cases assert the atomic write and the silent failure.
  3. Run the browser smoke test: npx playwright test — the failing-storage case shows the completion screen still appears and a fresh load reads the day as not completed.
  4. Read src/lib/stats.ts first, then src/lib/session.ts, to follow the atomic daily write and the session path.
Code review: No notes left; 4 fixed

Fixed before the commit

  • Major: Write paths now read via loadUnlessFailed and skip the write on a failed read; pure reads keep the swallow. (src/lib/stats.ts:149)
  • Double and test removed; replaced with seeded-blob clobber-safety tests (failed write leaves the existing blob byte-identical) and a throwing-getItem test that asserts the present blob is never overwritten. (src/lib/stats.test.ts)
  • Partial double and test removed; a same-session replay now asserts the no-op (same session object, the same one write attempted, nothing recorded). (src/lib/session.test.ts)
  • A pageerror listener is attached before the click with a hard assertion right after it; the dead setSeed pin removed. (e2e/smoke.spec.ts:509)
Tests: 85 passed in 2 lanes

All 3 scenarios of answering-the-tree-of-the-day-performs-t-s1b68w have a tagged test.

The test lint found, in the run's tests on the last check:

Recorded, not decided

  • src/lib/stats.test.ts:310 B3 in skips the practice write when the read fails, leaving the existing blob untouched: bare toThrow(): require toThrow(TypeName) or toThrow(/message/)
  • src/lib/stats.test.ts:311 B3 in skips the practice write when the read fails, leaving the existing blob untouched: bare toThrow(): require toThrow(TypeName) or toThrow(/message/)
  • src/lib/stats.test.ts:320 B3 in skips the practice write when the read fails, leaving the existing blob untouched: bare toThrow(): require toThrow(TypeName) or toThrow(/message/)
Braid run 211: 25 m on vLLM · inkling-2-mini
  • Workflow: Braid's OpenSpec flow, change answering-the-tree-of-the-day-performs-t-s1b68w (29 steps)
  • Model: vLLM · inkling-2-mini
  • Time: 25 m from start to this pull request, 25 m of it in the model
  • Tokens: 15.0M input, 59k output, 136k reasoning, over 295 model calls
  • Pre-flight estimate: fits, p50 117k / p80 189k tokens against a 224k-token step allowance

Opened by Braid from braid-testing/flash-leaf#4.

Before, answering the tree of the day made three separate storage writes — points, completion mark and result — and a throw could escape the click handler. If the completion mark or result write failed, the day kept its points while the mark was lost, so the puzzle could be answered again for extra points. Now the daily answer persists all three in a single write, and a storage failure is swallowed inside the stats store: the puzzle still completes, no error reaches the UI, and the day reads as not completed. Practice and the stored data shape are unchanged. **Checks: 1 thing to look at** - **Tests it wrote were run:** 1 test file the change wrote ran in no lane - e2e/smoke.spec.ts - **CI:** no CI ran on the checked code: the project has no CI (no workflow under `.forgejo/workflows`, `.gitea/workflows` or `.github/workflows`); what only CI tests went unverified - **Passed:** Scenarios with proof: 3 of 3 have a passing test or a look; Tests: 85 passed in 2 lanes; Seen working: 7 of 7 looks passed, and a session was played start to end; Code review: No notes left; 4 fixed; Tasks: 3 of 3 done; Same code: The tests and screenshots are of what merges **Try it** 1. Check out the branch: `git checkout osf/211-answering-the-tree-of-the-day-performs` 2. Run the unit tests: `npm test` — the new failing-storage cases assert the atomic write and the silent failure. 3. Run the browser smoke test: `npx playwright test` — the failing-storage case shows the completion screen still appears and a fresh load reads the day as not completed. 4. Read `src/lib/stats.ts` first, then `src/lib/session.ts`, to follow the atomic daily write and the session path. <details> <summary>Code review: No notes left; 4 fixed</summary> **Fixed before the commit** - **Major:** Write paths now read via loadUnlessFailed and skip the write on a failed read; pure reads keep the swallow. (`src/lib/stats.ts:149`) - Double and test removed; replaced with seeded-blob clobber-safety tests (failed write leaves the existing blob byte-identical) and a throwing-getItem test that asserts the present blob is never overwritten. (`src/lib/stats.test.ts`) - Partial double and test removed; a same-session replay now asserts the no-op (same session object, the same one write attempted, nothing recorded). (`src/lib/session.test.ts`) - A pageerror listener is attached before the click with a hard assertion right after it; the dead setSeed pin removed. (`e2e/smoke.spec.ts:509`) </details> <details> <summary>Tests: 85 passed in 2 lanes</summary> All 3 scenarios of `answering-the-tree-of-the-day-performs-t-s1b68w` have a tagged test. The test lint found, in the run's tests on the last check: **Recorded, not decided** - `src/lib/stats.test.ts:310` B3 in `skips the practice write when the read fails, leaving the existing blob untouched`: bare toThrow(): require toThrow(TypeName) or toThrow(/message/) - `src/lib/stats.test.ts:311` B3 in `skips the practice write when the read fails, leaving the existing blob untouched`: bare toThrow(): require toThrow(TypeName) or toThrow(/message/) - `src/lib/stats.test.ts:320` B3 in `skips the practice write when the read fails, leaving the existing blob untouched`: bare toThrow(): require toThrow(TypeName) or toThrow(/message/) </details> <details> <summary>Braid run 211: 25 m on vLLM · inkling-2-mini</summary> - **Workflow:** Braid's OpenSpec flow, change `answering-the-tree-of-the-day-performs-t-s1b68w` (29 steps) - **Model:** vLLM · inkling-2-mini - **Time:** 25 m from start to this pull request, 25 m of it in the model - **Tokens:** 15.0M input, 59k output, 136k reasoning, over 295 model calls - **Pre-flight estimate:** fits, p50 117k / p80 189k tokens against a 224k-token step allowance </details> --- Opened by Braid from braid-testing/flash-leaf#4.
cmoriarty deleted branch osf/211-answering-the-tree-of-the-day-performs 2026-12-03 10:48:11 -05:00
Sign in to join this conversation.
No reviewers
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!6
No description provided.