Skip to content

0.3.0: progress-keeping shared files, From AI authoring, durable saves, keyboard Study - #1

Merged
YuZh98 merged 170 commits into
mainfrom
claude/adoring-tesla-g8ddau
Oct 22, 2026
Merged

YuZh98 merged 170 commits into
mainfrom
claude/adoring-tesla-g8ddau

Conversation

@YuZh98

@YuZh98 YuZh98 commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

What changed

NoteBuilder 0.3.0 for the desktop app (v2/). Teachers can have any chat AI draft a lesson and review it. They share one offline .html that remembers each student's progress, and students can hand back a results summary. Saving is atomic and serialized. Also merges the author's local round: keyboard-first Study, zoom, themes, built-ins, examples, tests.

Shared Reader (.html)

  • Saves each reader's progress (answers, ticks, practice streaks, notes) in that browser's localStorage (lib/reader-store.ts). Ids are regenerated on every load, so cards are keyed by a hash of their content (slots, props, verbs). Changing a card's width, color or tags keeps students' progress on it; changing its content resets progress on that card only.
  • My results (lib/results.ts, ResultsModal.svelte): one graded line per question, plus practice attempts on their own line. Copy it or download it as JSON; nothing is sent over the network. Also Reset my progress and a "Made with NoteBuilder" link.
  • Phone layout: under 760 px the side panel starts collapsed and cards go full width.
  • No third-party requests: the build strips the remote web-font @import and fails on any external reference.
  • The embedded payload escapes every <, > and &.
  • A file that can't be opened shows a readable error page instead of a blank one.
  • A shared file's id is a hash of a per-install id plus the notebook id, so two authors' files never share students' progress.

Practice and pedagogy

  • New 12th slot type, problem: randomized numeric practice.
    • Each attempt draws its numbers from ranges on a step grid.
    • The typed answer is checked against an expression, with a tolerance.
    • Has "New numbers", a worked explanation, and counts as done after need correct answers.
    • Input parsing is strict (numeric-input.ts); typed answers never go through evalExpr.
    • Each browser gets its own number sequence (per-browser salt), stable across reloads.
    • A correct check on numbers whose answer was shown earns no credit.
  • New built-ins: Guided Explore (predict → explore → explain), Worked Example (self-explanation fading into a problem), Practice Set.
  • Factory: new Step-by-step slot effect (verbs.sequential).
  • Ungraded predictions are no longer painted as wrong.
  • New example: docs/examples/practice-lesson.json.

Bring-your-own-LLM authoring

  • Published JSON Schema 2020-12 (v2/src/lib/schema/notebook.schema.json) and the reference docs/FORMAT.md. A sync test checks the schema against the validator and the examples.
  • + → From AI… builds a complete prompt for any chat AI (ai-prompt.ts). It covers the format, the slot catalog, the expression grammar, the card-scope rule and study-design guidance.
  • Rejected imports and AI replies open ImportReport: where, what, how to fix, plus a copyable fix request for the AI. It tolerates code fences and surrounding chatter, and computes its own line/column positions.
  • Precedence traps (-x^2, **) produce a warning in compute, chart and problem formulas.
  • validateNotebookIssues returns structured {code, path, message} issues and now also runs each slot's validate().
  • Cards created From AI are marked as drafts (local-only, never exported). There's a Reviewed chip and a "N drafts to review" bar, and Share warns while drafts remain.
  • Share is refused while the notebook fails validation. Export still writes the file, then lists what would stop it re-importing.

Durability

  • One serialized queue for every DB access, and each save is a single atomic batch. Notebook rows use ON CONFLICT DO UPDATE instead of INSERT OR REPLACE, which would cascade-delete child rows.
  • Every string bound to SQL is made well-formed at the db.ts boundary.
  • If a save fails, the database handle is closed and the save retried once with the latest state.
  • Nothing is written before startup loading succeeds (autosave.ts). Unreadable reader-state and card-type rows are skipped rather than failing the load.
  • Saves flush on blur, on hide and on window close.
  • Fixed:
    • edits lost when switching notebooks;
    • the demo notebook overwriting a stored one at startup;
    • interleaved saves failing silently;
    • card widths not persisting;
    • section resets coming back after a restart;
    • a failed notebook delete wiping that notebook's progress.
  • Version history (SQLite migration v6):
    • automatic snapshots, at most every 10 minutes and only when content changed;
    • Save version now;
    • Restore, which can be undone.

Merged local round

  • Keyboard-first Study (j/k, space, 1–9, ? overlay), zoom, the Cyberpunk and Terminal themes, and syntax-highlighted code slots.
  • New built-ins: Cheatsheet, Iron Butterfly, Code Card.
  • Built-ins are seeded once through the seeded_builtins record, so a deleted built-in never comes back.
  • New examples grand-tour.json and quant-terminal.json, a styled DMG, simulation tests and design tokens.
  • Card.typeId is kept through export and import. It's now validated as a string and included in the schema.

Version bumped to 0.3.0 (npm, Tauri, Cargo).

Checklist

  • Edited src/ (not index.html directly) and ran npm run build. The v1 prototype is untouched; its bundle rebuilds identically.
  • npm run lint and npm run format:check pass (v1)
  • npm test passes: the v1 Playwright suite in CI (check job). v2: npm test 2718 passed / 204 files, npm run check clean, npm run build OK, cargo check OK.
  • Committed bundle index.html is rebuilt and in sync with src/. The v2 Reader template is also regenerated, and CI now fails on a stale one.
  • Updated CHANGELOG.md, as a dated [0.3.0] entry rather than [Unreleased], since this is the release.
  • Respected the invariants in docs/CODE-MAP.md (Part B7, plus the new ones):
    • escape before any HTML, no eval;
    • parameterized SQL, never INSERT OR REPLACE on a parent row;
    • three state layers;
    • one pointer drag engine;
    • the Reader bundle boundary, now checked across the whole Reader.

Notes

  • Review round: 15 findings. 13 are fixed, with commits named on each thread; all threads are resolved. Two design points are deferred to follow-up PRs: native zoom, and extracting the study-cursor code duplicated between App and Reader.
  • Verified in a real browser (headless Chromium):
    • shared file opened via file://: progress restored after reload, including inside the save delay; results download; reset;
    • phone layout at 390 px with no sideways scroll; zero external requests;
    • From AI → report → drafts → undo.
  • Verified on macOS by the author:
    • npm run tauri dev, saving on Cmd+Q and Dock Quit (beyond the ~600 ms debounce), version history;
    • From AI, the shared file in Chrome, Safari and Firefox;
    • built-ins listed once, keyboard Study, zoom.
  • Known limitation, accepted: quitting within ~600 ms of an edit, or while still typing in a text field, can lose that last edit. Text fields commit on blur, and macOS terminates the app without giving it a chance to flush.
  • Merge decisions:
    • lib/builtin-seed.ts is retired in favour of the seeded_builtins record. Boot also reads the record pre-release 0.3.0 builds wrote, and never re-seeds an id already present.
    • docs/interchange-format.md is folded into docs/FORMAT.md.
    • docs/spec/ and docs/research/ stay deleted.
    • The statement-matching db.test.ts is replaced by real-SQLite tests (db-sql.test.ts).
    • Card-type gallery order stays stable when a type is saved again.
  • CI changes: the v2 job runs on Node 22 (real-SQLite tests via node:sqlite) and checks the committed Reader template is fresh.
  • Follow-ups:
    • git-backed version history (a sync folder);
    • a study engine (spaced repetition with FSRS, a review queue);
    • optional "same numbers for everyone" setting per notebook;
    • native zoom;
    • a shared study-cursor module.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L

YuZh98 added 30 commits July 25, 2026 01:24
The :root block carried only color/surface tokens, so every dimension,
font size and duration in the components was a literal. Introduce a 2px
spacing scale, five type roles, three fixed inner-chrome radii and named
motion presets derived from the values the UI already renders, and route
the existing app.css transitions through the motion tokens.
…eal panels

CardNotes, CardPanel, TagsPanel and SealModal held literal px values for
every gap, pad, font size and corner. Point them at the app.css tokens
and mark the two off-scale survivors token-exempt.
…d Reader

The two largest component stylesheets carried most of v2's literal px
values. Route them through the app.css tokens and annotate the one-off
widths, gutters and grid floors that stay literal.
The inline style attributes in SectionView, SideFactory, CoverageMatrix,
ProductDetail, SideBar, SlotConfig and TopBar were the last cluster of
literal px values; the ones that stay literal now say why.
Contributors had no written statement of where dimensions come from.
State the rule next to the develop commands: use the app.css tokens,
extend the block before writing a literal, and justify any exemption.
Adds a mulberry32 PRNG with draw combinators and a fixed seed sweep, then
drives findGraphIssues, resolveGraph, and buildCardScope with generated
DAGs, injected rings, and unwritten reads.

Properties: acyclic graphs report nothing, every injected cycle is
reported (and throws in resolveGraph) under any declaration order, each
unwritten read is reported exactly once, and the resolved scope is
identical across shuffled node and slot orderings.
Adds a notebook generator that builds cards from the real slot registry —
props start at create() and are randomised inside each slot's own
validate() contract — plus a canonical form that ignores regenerated
identity and the two local-only fields.

Properties: export then import is identity on every generated notebook,
one round-trip reaches a fixed point, the identity spine is regenerated
consistently, exported JSON validates without errors, card-scope cycles
are rejected as errors, and reads with no writer stay warnings. A
coverage guard fails if the generator stops emitting dividers, flip
cards, empty tag arrays, or any registered slot type.
Drives computeProgress and progressScopeCards with generated notebooks
and reader-state sequences that only ever add completions.

Properties: the done count and percentage are monotone non-decreasing and
never exceed the total, the total never drifts, a fully completed run
reaches done == total, each scope counts exactly the cards in it, section
totals sum to the notebook total, chapters sum to their own scope, tag
tracking only ever narrows, and archived cards are ignored.
Generates random expression trees, prints them fully parenthesised, and
checks evalExpr against a direct evaluation of the same tree.

Properties: parsed evaluation agrees with tree evaluation, evalExpr is a
pure function of expression and scope and never mutates the scope, no
input string can make it throw, and `mod` behaves as the remainder
operator.
The graph properties were all vacuously true for edge-free graphs, and
every injected ghost read was attached to a single declaration, so
neither a generator that stopped emitting reads nor a regression in the
de-duplication of missing-dependency reports would have been caught.

Adds a coverage guard asserting mean in-degree, the share of nodes with a
dependency, a dependency chain of depth 2, a ring longer than 2, ghost
fan-out across declarations, and compute slots that read another slot's
key. Injected ghosts now attach to 1-3 distinct declarations, so the
"reported exactly once" property exercises the de-duplication.
The progress scope property sampled a single random snapshot despite
claiming to hold at every step; it now walks the whole reader run and
checks the done count against an independent per-card tally, not just
the structural total.

Adds an expression property over flat operator chains printed without
parentheses, checked against a mirror of the parser's precedence climb —
the existing properties printed fully parenthesised trees, so the
precedence table itself was untested.
Adopts Contributor Covenant v2.1 unmodified apart from the enforcement
contact, which points to the maintainer's GitHub handle since there is
no project email or advisory channel appropriate for conduct reports.
CONTRIBUTING now opens with what is and isn't in scope for this repo,
matching how the project actually splits between the frozen v1
prototype and the active v2 app.
Three outsider-facing references for the v2 app: the layer split and where
runtime data lives, the app.css token families with their governance and
current adoption gaps, and the version 2 JSON interchange with a worked
example. CODE-MAP.md remains the fine-grained map.
…em guides

Token families: --mono is declared once and no theme swaps it, and only five
of six themes swap --glow and --font. The opening line now states the token
rule rather than claiming app.css already meets it everywhere. Slot registry:
CardView keeps a hand maintained icon map with a default glyph. The
@tauri-apps import count is non-test files only, and only part of the
toolchain is pinned to exact versions.
Declare the DMG window layout in bundle.macOS.dmg: a 660 by 400 volume
window with the app icon on the left, the Applications shortcut on the
right, and a generated background image carrying a drag arrow between
them. The background is produced by a dependency free Node script so the
image can be regenerated whenever the icon coordinates change.
Cover both directions: installing from a release disk image, including
the Gatekeeper steps an unsigned build actually requires on current and
older macOS, and building the same disk image from a clean checkout.
State the arm64 only architecture decision and its rationale.
A single notebook that exercises all eleven slot types, for use as the first
thing a new user imports.
Put a single concrete claim above the hero so a cold visitor knows what
NoteBuilder does that a document or a flashcard app cannot. Pair the Edit and
Reader screenshots in a captioned table, add a section for the on-disk
database path, link the architecture, design system and interchange guides,
point the Quick start at the macOS install guide and the grand-tour example,
and correct the test counts and the slot list.
Import rejects a dependency cycle but only warns on a read with no writer, so
the grand-tour prose no longer claims a broken notebook refuses to load. The
headline now promises that reader answers never come back to the author rather
than implying the shared file saves them. The data tree notes SQLite's -wal and
-shm companion files.
Design tokens with governance, seeded simulation test tier, community
files, curated public docs, release-ready DMG install story, and a
README front door that leads with the differentiator.
Four Study-mode screenshots of the demo notebook (Tomoe, Sketch,
Aurora, Cyberpunk) in a captioned gallery under the comforts section,
captured through the in-app theme picker.
Pair the question and flashcard cards at half width and put the slider
and computed value on one row so the gallery shows less empty space and
both sections fit in frame.
The theme is a phosphor trading-terminal look: near-black green
surfaces, a fixed grid with scanlines, mono uppercase headers with a
neon glow, and pill chrome. The example notebook rebuilds the
quant-prep-terminal layout: numbered chapter dividers, cheatsheet
cards with rule tables, tagged flashcards, and a Lab payoff explorer
whose breakevens and max profit and loss derive from three sliders.
…keys, code highlighting, seeded card types

Rename the terminal theme to Cyberpunk (dark green) and give it card
hover lift and glow plus neon emphasis colors for bold, italic, code
and strikethrough in Study text. Add Cmd/Ctrl +/-/0 zoom to the app
keyboard map. Highlight code slots with a dependency-free tokenizer
for Python and JavaScript. Seed the store with Cheatsheet, Iron
Butterfly and Code Card types with accent varieties, and enable the
section service bars in the quant-terminal example.
Card types were seeded only into an empty database, so a library
created before a new builtin existed never received it. A
seeded-builtins ledger in preferences now records what has been
seeded; boot seeds only never-seen builtins, and databases that
predate the ledger fall back to the legacy id list so user deletions
of old builtins stay deleted.
Also correct the 0.2.0 entry: missing writers load with a warning at
import; only cycles are rejected.
A card stamped from a Factory type lost its product binding on any JSON
round trip, blanking the coverage matrix's product dimension. Add typeId
as an optional field on schema version 2: older builds ignore the unknown
key, and a recipient without that card type reads the card as untyped.

Unfence the simulation generator, which had been skipping typeId because
it could not survive a round trip, and compare it in canonicalNotebook so
the round-trip property covers the field.
isDone required every item checked via Array.isArray(state.checked),
which an empty items array can never satisfy: a zero-item check list
was completable (validate accepts it, hasCompletableSlot counts it)
but unfinishable, permanently blocking progress. Rejecting empty
check lists at validate would break previously-valid files, so treat
zero items as vacuously done instead, the standard reading of a
universally-quantified statement over an empty set.

Sim generator now allows empty items for all list styles so the
progress sim suite exercises the vacuous case.
The pointer engine covers every notebook and study surface, but
SideFactory's inventory chips still drag via native HTML5 draggable
and ondragstart (three MIME types), consumed by Factory's drop
handlers. The blanket "no native HTML5 drag anywhere" claim in both
READMEs was stale; state the actual, narrower boundary instead.
New study-keys.ts owns the keyboard-first Study decisions as pure functions:
focus order, cursor stepping, and the reader-state write each card key
performs. handleAppKey gains the matching Study-only bindings (j/k, space/f,
1-9, Enter, x, ?) plus the context fields they read; Space returns no action
when the focused card cannot flip, so the page still scrolls.
Comment thread v2/src/lib/slots/problem.ts Resolved
Comment thread v2/src/lib/components/Reader.svelte Resolved
Comment thread v2/src/lib/db-map.ts Resolved
Comment thread v2/src/lib/snapshots.ts Resolved
Comment thread v2/src/App.svelte Resolved
Comment thread v2/src/lib/reader-boot.ts Resolved
Comment thread v2/src/App.svelte Resolved
claude added 20 commits October 21, 2026 21:26
snapshots.ts carried a verbatim copy of reader-store's cyrb53 so db.ts
would not pull reader-store's graph (json-io and the slot registry) in
just to hash a snapshot. Two copies of a hash whose outputs are
persisted (Reader progress keys, snapshot identity, shared docIds) can
drift apart silently.

The function now lives alone in hash.ts, which imports nothing, so
snapshots, reader-store and share all share it without crossing import
graphs. hash.test.ts pins the outputs as shipped so the move, and any
later edit, cannot change a stored key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
computeKeys exports the whole notebook and hashes every card. A Reader
opening a file with saved progress ran it twice: once in readBoot's
loadProgress to map the stored progress back onto the cards, and again
in createProgressStore for saving, on the same pristine notebook.

loadProgress now hands the keys it mapped through back on
LoadedProgress, and createProgressStore reuses initial.keys, computing
them itself only when the load did not need them (nothing stored). The
Reader already passes the load as `initial`, so the boot path needs no
new plumbing. A spy on the export behind computeKeys proves one run per
boot, with and without stored progress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The expression grammar binds a leading minus tighter than ^, so a
problem answer "-a^2 + b" expects (-a)^2 + b and grades a student's
correct -a^2 + b as wrong on every draw. The From AI lint already
caught this trap in compute.expr and chart.fn but never looked at a
problem's answer.

The detector moves to expr-pitfalls.ts (imports nothing, so the
Reader bundle may carry the slot editors that use it). The From AI
check now lints problem answers too, as a warning: the formula is
legal and an author may mean (-a)^2, so it must not hold back Share
the way a validation error would. ProblemEdit shows the same warning
inline, apart from the blocking issues. A ** in a problem answer
never parses, so it stays an error; it now says to write powers
with ^ instead of 'Unexpected "*"'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
ResultsModal carried its own Clipboard-API-then-execCommand fallback,
a second copy of clipboard.ts's copyText. The duplicate existed because
reader-boundary.test.ts listed clipboard among the modules the Reader
bundle must never reach, next to the schema and the AI kit. But
clipboard.ts imports nothing and is not part of the kit; banning it only
bred the copy.

clipboard is off the forbidden list (with a comment saying why), a new
case pins clipboard.ts as import-free so allowing it cannot drag the kit
in, and the boundary now also walks the whole Reader from reader-main.ts
rather than json-io.ts alone, since ResultsModal sits outside json-io's
graph. copyText takes over the one thing the duplicate did better: its
hidden textarea is removed even when execCommand throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
After "Show answer", "Try again" / "New numbers" reopened a problem
whose numbers cannot change (no params, or every range a single value),
so a student could type the answer just revealed and earn credit
toward need and the results.

"New numbers" now carries the revealed answer along (state.shown) for
as long as it would itself pass on the new numbers. While it does, a
check shows the usual feedback but counts neither a correct answer nor
an attempt, and the problem says why: fixed numbers, or "try new
numbers" when another draw would change the answer. The decision is
on the expected answer, not on seeds or drawn values: seeds always
differ, and new values with the same answer give it away just the
same, while a card variable that moved the answer frees it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The results tally summed every slot's score() into one count, but the
units differed: choice scored a question (0 or 1) while the problem slot
returned its raw counters, correct answers over attempts. Two right
choices plus one problem solved 3 times in 7 tries printed "5 of 9
answered correct · 3 questions" instead of "3 of 3".

score() now has a documented unit (SlotScore): one question, answered
and correct each 0 or 1. A problem is answered once tried and correct
once its `need` is met; its raw counters travel as an optional
`practice` field that results.ts sums separately (results.practice) and
prints on its own line ("Practice: 3 correct in 7 tries"), also shown
as a row in the results dialog. results.ts drops any score() outside
the unit rather than sum it, so a future slot type cannot reintroduce
the mix. The problem.ts change is confined to score().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
App's and the Reader's window keydown handlers ran studySurfaces on the
focused card before dispatch, for every key, typing in a field
included. studySurfaces builds the card's variable scope (every formula
on it), so each keystroke into a text box, the section search or a
name field re-evaluated the focused card for nothing.

KeyCtx now carries focusedSurfaces as a thunk instead of four
precomputed fields. handleAppKey calls it at most once, and only when a
bare card key (Space/f, Enter, x, 1-9) reaches a focused card in house
Study; fields, chords, cursor moves, the overlay and Edit mode never
do. Both handlers pass the same lazy getter, so behaviour is unchanged.
A pass-through spy on buildCardScope proves that typing in a field no
longer builds a scope in either App or the Reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
Every problem started at DEFAULT_SEED = 1 and "New numbers" walked
seed+1, +2, so a whole class saw the same numbers in the same order
and one shared answer list let everyone reach need.

A problem with no stored seed now starts from baseSeed: a 32-bit
FNV-1a hash of a per-browser random salt and the prompt, params and
answer. One reader sees the same numbers on every reload, readers see
different ones, and mounting still writes no reader state; "New
numbers" walks on from the current seed as before. The salt lives in
the new practice-salt.ts (localStorage key notebuilder:practice-salt,
read synchronously, created once, imports nothing so the Reader
bundle stays clean). Where it cannot be read or kept the salt is null
and problems start at DEFAULT_SEED as before, rather than changing a
student's numbers on every reload.

The editor preview keeps its fixed seed, so the sample holds still
while the author types, and is now labelled "Sample draw".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The Reader's window keydown handler never checked whether the results
dialog was open. The dialog focuses itself on open, so a digit, Enter,
x, Space or f pressed there bubbled to the window and answered, graded
or flipped the card the study cursor was on behind it, and the progress
store saved that answer. App already gates its modals the same way
(`if (fromAiOpen || importProblems) return`).

handleKey now returns while resultsOpen (the dialog closes itself on
Escape), and the shell behind it goes inert like it does for the
shortcut overlay, so Tab cannot reach the chrome either. Tests press the
study keys in the open dialog and on the window and check the card, the
cursor, the overlay and storage are all untouched, then that the same
key works once the dialog closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
listCardTypes JSON.parsed every card_types row inside the startup load,
outside the seeding try/catch, so a single malformed data blob made
hydration throw and switched persistence off on every launch. A row
whose data is not a JSON object is now skipped with a console warning,
the same way loadReaderState skips an unreadable progress row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
removeNotebook pruned the notebook's cards from in-memory reader state
before deleting and ignored deleteNotebook's false. A failed delete then
let the full-replace reader save wipe that notebook's progress, dropped
it from the menu, and its db.ts tombstone suppressed every later save,
so it came back next launch with all progress gone.

Now the delete is awaited first. Only on success does the app prune
reader state, unlist the notebook and open the next one; on failure it
keeps everything, re-saves the edit whose pending save it cancelled,
and says "Couldn't delete the notebook - nothing was changed".

In db.ts the tombstone now holds the delete's outcome: a failed delete
lifts it, and a notebook save or version made while the delete is in
flight waits for that outcome (written if it failed, dropped if not)
instead of being reported saved and silently lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The F4 fix carried the shown answer only to the very next draw and
dropped it at the first draw with another answer. In a small range
the revealed numbers come back a click or two later: with a in 1..2,
Show answer, New numbers, New numbers, and typing the shown answer
earned credit again. The spec's rule is that redrawn values equal to
revealed ones never count.

Show answer now records a fingerprint of the numbers and answer on
screen in progress state `seen` (32-bit hash, at most 32, newest
last). New numbers also records the numbers on screen while the
answer shows, so a slider moved during the reveal is covered too.
`seen` survives New numbers. A check on numbers in `seen` shows the
tick but counts nothing.

shownStatus looks ahead along the draws New numbers can reach. It
says 'all-shown' when every answer there was shown, and keeps
'fixed' for problems whose answer never changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
Lone-surrogate cleanup was applied field by field (notebook and section
names, import), so any other string bound to SQL - a note body, a card
type name, a preference value, a reader-state key - could still carry
one. The Tauri IPC refuses such an argument, so that write failed on
every retry, and one inside a JSON argument becomes invalid UTF-8 where
json_extract decodes it.

db.ts now hands every query a handle that passes each string argument
through wellFormed, and every JSON text it or db-map writes is built
with the new wellFormedJson, which cleans the data before stringifying
(a lone surrogate would otherwise survive as a \udXXX escape). That
copy is only made when such an escape appears, so ordinary saves cost
one regex scan. The per-name calls in db-map are now redundant and go.

The SQLite test adapter now rejects ill-formed arguments the way the
IPC does; node:sqlite would otherwise quietly store U+FFFD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The results dialog took the whole keyboard while open, but only its own
keydown handler closed it on Escape. Once focus left the dialog (the
copy fallback selects and then removes a hidden textarea, dropping
focus to <body>), Escape reached only the Reader's window handler,
which now ignores every key while the dialog is open: the dialog could
not be dismissed from the keyboard. The window handler closes it on
Escape too, and still lets nothing through to the card behind it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The From AI dialog closed on any Escape reaching the window, including
one pressed inside the reply textarea, one that only ended an IME
composition, and one meant for the inline report, throwing away a
pasted AI reply without a word.

Escape now ignores IME composition (isComposing / keyCode 229) and key
auto-repeat. With nothing typed it still closes at once; otherwise it
shows an inline "Discard what you typed?" bar with Keep editing and
Discard, and a second Escape discards. Typing on, or Keep editing,
dismisses the bar and returns focus to where it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The dialog box scrolls (max-height 88vh) once the prompt preview or an
inline report is open, and the "Discard what you typed?" bar sits near
its bottom. Asked from the topic field at the top, the question could
appear below the fold: nothing visibly happened, and the reflexive
second Escape then discarded the pasted reply unseen - the very loss
the confirmation exists to prevent.

The bar now scrolls itself into view (block: nearest) when it appears,
without taking focus from the field being edited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
The Reader bundle changed (modal key gate, lazy study surfaces, results
units, shared hash, keys computed once, clipboard helper, per-reader
practice numbers, problem answer lint, no credit after a reveal). Also
refresh the test counts in the README and CHANGELOG (2718 tests in 204
files).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiAG1TsmfKTNbCg7hXur2L
@YuZh98
YuZh98 merged commit f084756 into main Oct 22, 2026
2 checks passed
@YuZh98
YuZh98 deleted the claude/adoring-tesla-g8ddau branch October 22, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants