Repository navigation
Preserve WebP batches when export fails - #250
Merged
Merged
Conversation
The exporter validates every PNG first but replaces each WebP immediately after staging that one file. A later write or replace failure leaves the published directory mixed. Stage all changed images and prior-file backups before replacement, then restore consumed entries on failure. Preserve existing bytes and timestamps, remove new outputs, and retain recovery data with actionable diagnostics if rollback is blocked. Six original-code regression variants reproduced partial publication. Additional cases cover interruption after replacement, blocked restoration or metadata inspection, and a non-file target. Original tests remain; all 39 harness files, strict pyright with optional pinned Pillow, fast check, ten final-gate steps, strict docs build, and npm pack dry run pass. Real codec validation produces the same six committed WebPs and preserves timestamps on repeat. No Unity, image pixels, dependencies, or CI workflow changes. Refs #114.
Use the supported rmtree callback for each interpreter, matching existing harness cleanup, while retaining read-only backup handling. Mock both public metadata entry points so the failure-injection contract does not depend on pathlib method delegation. Strict typing passes for Python 3.10 and 3.12 targets; fast check, all twelve exporter cases and ten applicable gate steps pass. No CI workflow or dependency changes. Refs #114.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4e7503a. Configure here.
A second KeyboardInterrupt in the undo loop bypassed the restoration error collector and ran staging cleanup, deleting the only remaining old images. The regression reproduces missing recovery data at 4e7503a. Make staging cleanup conditional before the first public mutation. One owner enables cleanup only while staging or after a complete publication/restoration. Capture rollback interruption details and retain recovery data by default; verify interruption both before and after an undo replacement. This addresses the configured review finding on PR #250. All 39 harness files, twelve exporter methods, Python 3.10/3.12 strict typing, fast check, ten gate steps, and strict docs build pass. Real codec publication remains byte-identical to the six committed WebPs and repeated export preserves timestamps. Three content files, 203 changed lines against main; no new dependencies or CI workflow changes. Refs #114.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

DISCLOSURE: LLM-GENERATED TEXT
Why: A late export write failure leaves documentation images from different batches.
What:
Refs #114.
Note
Low Risk
Local docs export tooling and tests only; no runtime, auth, or CI image pipeline behavior beyond safer atomic writes.
Overview
The docs WebP exporter now publishes the entire pending batch atomically instead of replacing files one at a time, so a mid-run failure cannot leave
docs/images/with a mix of old and new captures._publish_batchstages encoded files under.docs-webp-*, backs up existing outputs, thenos.replaces them. On failure it rolls back using filesystem state (restoring prior bytes/timestamps or removing new files) and rejects non-regular output paths before any write. If rollback cannot complete, it keeps the recovery directory and surfaces paths in the error.Troubleshooting documents the staging, restore, and manual recovery steps. Tests cover staging/publication/interruption failures, incomplete rollback, and directory outputs.
Reviewed by Cursor Bugbot for commit 5bc42c3. Bugbot is set up for automated code reviews on this repo. Configure here.