Skip to content

fix(persistence): retry pending saves after read failures - #426

Merged
chhoumann merged 3 commits into
masterfrom
fix/retry-after-read-failure
Oct 13, 2026
Merged

chhoumann merged 3 commits into
masterfrom
fix/retry-after-read-failure

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

A temporary pre-write read failure could strand unsaved changes even after the disk recovered. Pending saves now retry on the existing 10-second schedule, so a successful read clears the refusal and saves them. Idle writes stay at zero.

Failed imports and API-key selections show only their caller-specific Notice, including through retry failures. The existing window-unload test now requires no Notice and no retry timer. Production changes are confined to writer.ts; F2 is excluded.

Detection and retention already existed in f7400ba. All 75 baseline persistence tests pass on master; this follow-up adds recovery from read failures and fixes duplicate Notices. Refs #425 and #385 (already closed).

Verification

  • npm run lint, npm run format:check, npm run typecheck, npm run build, npm run test: passed, 1,736 application tests; both Svelte checks have zero errors/warnings.
  • npm run test:tooling: 10 passed. npm run docs:build: 18 pages, valid links and 112 legacy fragments. npm run size: 285,447 raw / 90,856 gzip bytes, +109 / +40 versus master.
  • npm run test:e2e: 77 passed across 12 files. An earlier attempt was interrupted for a review correction; all final gates and live probes were rerun afterward.
  • Regression tests fail on master. Mutations removing the read retry, pending-work guard, or refusal rethrow, and moving the Notice check after settlement, are caught. A damaged-entry regression proves recovery still repairs raw disk data.
  • Obsidian 1.14.4 on Linux, isolated worktree vault: live Settings probes leave master at disk 15/15 versus memory 29/25; this branch automatically saves 29/25. One generic Notice spans the write/read/write failure streak, and the sticky unreadable Notice clears on recovery. Measured retry intervals: 10,000-10,007 ms. No podcast fixture needed.
  • npm run count:writes: master and branch match exactly, zero idle writes and two completed writes / 3,966 bytes in the same Settings flow. Failed-import live probe shows only the specific Notice on the branch.
  • Independent GPT and Claude reviews: no remaining blockers. Report and scripts, logs, hashes, and screenshots.
Live evidence Master Branch
After adapter recovery Sticky refusal Saved automatically
Failed import Duplicate Notices Specific Notice only

Release impact

No schema, settings shape, encoding boundary, public API, or migration changes.

Docs at release

Document automatic recovery from temporary read failures and the single caller-specific Notice for failed settings import or API-key selection saves.

Note

Retry pending persistence saves in DataFileWriter.persist after read failures

  • A read failure in DataFileWriter.persist now schedules a checkpoint retry when a failed write or unsaved edits exist, then rethrows the error. Pending edits are saved once the file becomes readable again (writer.ts).
  • Adds a warning-mode parameter: write-failure Notices now fire only for warning-enabled calls (external changes), and only at the start of a failed-write streak. Immediate saves report their own failure to the caller.
  • Extensive integration tests cover read/write outages, recovery through checkpoint retries, Notice streaks, window unload, and settings import rollback with retries (writer.test.ts, PodNotesSettingsTab.import.test.ts, persistence.test.ts).
  • Behavioral Change: immediate saves no longer emit the writer's write-failure notification; external-change saves now include checkpoint handling on read failures.

Macroscope summarized cb8d43e.

…rnings

Saves that failed to read data.json should retry once the file reads again,
and a failed import or API key save should show only its own Notice.
…ilures to their caller

A save that could not read data.json now retries at the checkpoint interval
while an edit or failed write is pending, so the next good read lifts the
refusal and writes. Strict saves leave reporting a failed write to their
caller, and a retry that finds the failed write already on disk writes nothing
more.
…eak quiet

A read can rebuild entries the file dropped from what PodNotes last wrote, so
matching a failed write does not prove the file holds it. Saves now write it
again instead of returning early, and whether a failed write warns is decided
before the read settles it, so the retry adds no generic Notice to a streak
already reported.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying podnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: cb8d43e
Status: ✅  Deploy successful!
Preview URL: https://afda0ab4.podnotes.pages.dev
Branch Preview URL: https://fix-retry-after-read-failure.podnotes.pages.dev

View logs

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.

1 participant