fix(scanner): preserve review when correcting the sheet week - #15
Conversation
|
Review-fix scope: preserve recognized entries and edits while correcting the printed week, recheck saved homework for the applied week without another model call, and prevent saving before application succeeds. Dates remain visible and editable; recognition currently has no absolute/relative deadline provenance, so changing the week preserves dates and asks for review instead of guessing a shift. Threat model: authenticated daily scan review, partial native week-input edits, duplicate status when moving between weeks, failed requests and retry, and stale responses. No schema migration, new OCR contract, or model-prompt redesign is included. Astra high will run separate read-only lenses: (1) behavior and invariants, owning browser state, preservation of edits, stale responses, failure/retry, and save gating; (2) premise and integration, owning the authenticated action, input validation, database reconciliation/no early writes, accessibility and architecture, excluding browser race analysis. Baseline: |
Both required lenses completed. Behavior covered preservation, partial typing, save gating, failure/retry, and stale responses. Premise/integration covered authentication, runtime input validation, SELECT-only reconciliation, IDs and edited wording, notes, accessibility, and dependency boundaries. Lens yield: 0 blockers from 2 lenses. Discarded concerns: the rendered controls prevent changing the week during application, and clear/upload reset busy state; duplicate actions are reset before reclassification; due dates deliberately remain editable and unchanged because recognition lacks relative/absolute provenance, with persistent copy explaining the review requirement. No automatic date shift is claimed. Extended the existing browser and database tests without new test machinery. Focused database review passed 1 test and 6 assertions; an initial reviewer command omitted |
Before. Correcting an unreadable printed week hid all recognized homework and forced another AI analysis. This discarded review edits and made it unnecessarily difficult to save a scan.
Now. Enter the week and choose “Use this week” while keeping recognized entries and edits visible. PaperSync rechecks saved homework for that week without another AI call; failed requests leave the review available for retry.
Implementation
The authenticated action validates the week and entries and only reads saved homework. Saving stays disabled until the selected week has been applied. Duplicate status is recalculated for the new week while preserving entry IDs, text, completion state, and due dates. Dates remain editable and are deliberately preserved because recognition does not record whether each deadline was an absolute date or relative wording; the UI asks the reviewer to check them against the paper.
Screenshots
Same demo scan and text correction after entering 2026-W37, at 1280×800. Before renders main
757da41; after renders this change. The former review disappears; the updated review stays visible beside “Use this week.”Verification
Completed checks
bun run check:fixat standalone head1fda556: all 25 tasks passed in 22.011 seconds.Check it yourself
Run
gh pr checkout fix/preserve-review-on-week-correction, start the app withbun run dev:web, and analyze a sheet whose week is unreadable. Edit an entry, enter its week, and choose “Use this week.” The edit stays visible and saving becomes available without reanalysis.