Fix #1056: reset Greek/Hebrew book titles when overwriting Macula with another Bible#1067
Merged
Merged
Conversation
…h another Bible Bible imports derived the per-book title via getBookDisplayName, which reads the existing <CODE>.codex's saved fileDisplayName from disk. So overwriting a Macula book (e.g. "Greek Matthew") with a non-Macula eBible kept the stale language prefix instead of resetting to "Matthew". Add a disk-free getDefaultBookName(usfmCode) that resolves a book code to its canonical English name from the lookup table only, and use it for the import-time NT/OT title derivation in convertToNotebookPreview so titles regenerate fresh from the book code. getBookDisplayName's display-render behavior (reading saved fileDisplayName) is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
LeviXIII
approved these changes
Jun 30, 2026
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.
Closes #1056.
Problem
After downloading the Macula Bible (book titles become
Greek Matthew/Hebrew Genesis), importing a non-Macula Bible (eBible download, USFM, Paratext) that overwrites those books correctly replaces the verses but leaves the stale titleGreek Matthewinstead of resetting toMatthew. The "corpus marker title" in the issue is the file'sfileDisplayName.Root cause
All NewSourceUploader imports funnel through
convertToNotebookPreview()(src/providers/NewSourceUploader/NewSourceUploaderProvider.ts). For a Bible book with no incomingfileDisplayName(eBible/USFM/Paratext don't set one), it derived the title from the USFM code viagetBookDisplayName(usfmCode).getBookDisplayName(src/utils/bookNameUtils.ts) reads the existing<CODE>.codexfrom disk first and returns its savedfileDisplayName. At overwrite time that file is still the old Macula one → it returnsGreek Matthew, and since the new importer isn't Macula no prefix-stripping happens, so the stale title is written into the new file. (ThecorpusMarkermetadata itself was already corrected toNT/OTon overwrite, so only the title carried over.)Fix
getDefaultBookName(usfmCode)tobookNameUtils.tsthat resolves a book code → canonical English name from the lookup table only (no file reads).getBookDisplayName's fallback now delegates to it, so its display/render behavior (reading the saved name) is unchanged.convertToNotebookPreview(), the import-time NT/OT title derivation now usesgetDefaultBookNameinstead ofgetBookDisplayName, so titles regenerate fresh from the book code on every import/overwrite rather than inheriting whatever is currently on disk.The Greek/Hebrew prefix is still only ever applied when the importer is Macula, so a non-Macula overwrite can never reacquire it; fresh Macula and Macula-over-Macula still show
Greek/Hebrew <Book>(the Macula importer supplies that name itself).Behaviour after fix
Matthew/Genesis. ✅Greek/Hebrew <Book>. ✅ (unchanged)Greek/Hebrew <Book>. ✅ (unchanged)Testing
src/test/suite/bookNameUtils.test.ts, including a Bug: Greek/Hebrew Corpus Marker titles remain after overwritting #1056 regression: aMAT.codexsaved asGreek Matthewon disk, assertinggetDefaultBookName("MAT")still returnsMatthew.bookNameUtilstests pass (existinggetBookDisplayNamedisk-read tests unchanged).tsc --noEmitandeslintclean.🤖 Generated with Claude Code