Skip to content

Fix stale glossary adoption in selective retranslation#36

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

Fix stale glossary adoption in selective retranslation#36
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-931c

Conversation

@cursor

@cursor cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

Bug and impact

run_state.py plan adopted every existing output_chunk*.md without a run_state.json record as record_only by default. If a user had stale translated outputs and then introduced or edited a glossary before the first run-state record, glossary-sensitive chunks could be recorded as current and become permanently unchanged, silently preserving stale terminology in final book outputs. Alias-only glossary edits for already-selected terms were also ignored because term_hash did not include aliases.

Root cause

The untracked-output path in scripts/run_state.py did not check whether the source chunk currently receives glossary terms before choosing record. scripts/glossary.py::term_hash only hashed source/target/category, omitting prompt-affecting aliases.

Fix

  • Re-translate untracked existing outputs when their source chunk currently selects glossary terms.
  • Continue record-only adoption for untracked outputs with no selected glossary terms, preserving resumability.
  • Include sorted aliases in per-term hashes only when aliases exist, avoiding no-alias run-state churn.
  • Updated SKILL/README docs and regression tests.

Validation

  • Pre-fix CLI repro showed stale chunk0001 planned as record_only, then unchanged after recording.
  • Post-fix CLI repro: chunk0001 is in translation_chunk_ids, glossary-free chunk0002 remains record_only.
  • Alias-only edit CLI repro triggers glossary_term_hash_changed for chunk0001.
  • python3 -m unittest tests.test_run_state tests.test_glossary -v — 69 tests OK.
  • python3 -m unittest discover -s tests -p 'test_*.py' -v — OK, 3 skipped.
  • python3 -m compileall scripts tests — OK.
  • Standard Alice mock full pipeline: 38 chunks converted/merged; HTML/DOCX/PDF generated successfully. EPUB failed only for the documented Ubuntu Calibre 7.6.0 bytes/str issue.
Open in Web View Automation 

Co-authored-by: Rainman <deusyu@users.noreply.github.com>
@cursor
cursor Bot deleted the cursor/critical-bug-investigation-931c branch July 2, 2026 08:22
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