Skip to content

fix: write catalog cache atomically#19

Open
itzptk wants to merge 1 commit into
mainfrom
fix/issue-18-catalog-cache-atomic-write
Open

fix: write catalog cache atomically#19
itzptk wants to merge 1 commit into
mainfrom
fix/issue-18-catalog-cache-atomic-write

Conversation

@itzptk

@itzptk itzptk commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Write catalog-cache.json through a sibling temporary file before renaming it into place.
  • Remove the temporary file if writing or renaming fails so interrupted refreshes do not corrupt the previous cache.
  • Add a Vitest regression test that simulates an interrupted replacement write and verifies the previous cache still reads.

Closes #18

Verification

  • RED: npm run test:node -- catalog-cache failed before the fix with expected null to deeply equal previous.
  • GREEN: npm run test:node -- catalog-cache → 1 test passed.
  • npm run test:node → 16 files passed, 117 tests passed.
  • npm run build → Angular production build and Electron tsup build succeeded.

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.

Write catalog cache updates through a temp file

1 participant