Skip to content

fix(convert): reject stale source caches#17

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-0572
Draft

fix(convert): reject stale source caches#17
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-0572

Conversation

@cursor

@cursor cursor Bot commented Jun 6, 2026

Copy link
Copy Markdown

Bug and impact

convert.py reused {book_name}_temp caches solely by source basename. Running conversion on two different files named the same, or replacing a source file in place, could silently reuse stale input.md/chunks/outputs and build the wrong book while regenerating a clean-looking manifest/config.

Root cause

Existing-cache skips for input.html, input.md, and chunk*.md had no source identity/content check.

Fix

  • Record source_fingerprint.json with source realpath, size, and SHA-256 on fresh conversion.
  • Reject cached conversion/translation artifacts when the fingerprint is missing or mismatched.
  • Add regression tests for valid reuse, legacy cache rejection, same-basename different source, and in-place source replacement.

Validation

  • python3 -m unittest tests.test_convert.SourceCacheFingerprintTests -v
  • python3 -m unittest discover -s tests -p 'test_*.py' -v (210 tests passed, 3 skipped)
  • python3 -m compileall scripts tests
  • Standard Alice smoke test: convert generated 38 chunks and merge/build produced HTML/DOCX/PDF; EPUB failed due the known Ubuntu Calibre 7.6.0 packaging issue documented in AGENTS.md.
  • Manual CLI repro: same-basename different source cache now exits 1 with different source before conversion.
Open in Web View Automation 

Co-authored-by: Rainman <deusyu@users.noreply.github.com>
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