Skip to content

fix: preserve existing catalog output on failed writes (closes #22) - #36

Merged
drevendev merged 2 commits into
masterfrom
beautifulrepo/catalog-safe-write-20261019
Oct 20, 2026
Merged

drevendev merged 2 commits into
masterfrom
beautifulrepo/catalog-safe-write-20261019

Conversation

@drevendev

Copy link
Copy Markdown
Owner

Closes #22.

Render and encode the generated catalog entirely before any output mutation, write to a temporary sibling, preserve existing permissions where possible and atomically replace on success. Tests exercise invalid surrogate input, simulated replacement failure, existing mode, valid Unicode and newly created output.

Prepared as a separate implementation on 2026-10-19; integration requires the current PR checks and review of the exact head. No external dependencies.

@drevendev drevendev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer later-run review (2026-10-20): inspected the exact atomic-output implementation and regression suite. UTF-8 encoding occurs before output mutation; a sibling temporary file is atomically replaced, previous content survives an injected replacement failure, temporary files are cleaned, valid Unicode/mode retention are tested. The PR's exact-head catalog check passed. No material blockers; no claim of crash-durable fsync.

@drevendev
drevendev merged commit 2ea300b into master Oct 20, 2026
1 check passed
@drevendev
drevendev deleted the beautifulrepo/catalog-safe-write-20261019 branch October 23, 2026 10:24
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.

Bug: catalog --write truncates an existing output before rejecting invalid Unicode

1 participant