Skip to content

Fix #1056: reset Greek/Hebrew book titles when overwriting Macula with another Bible#1067

Merged
LeviXIII merged 2 commits into
mainfrom
1056-greek-hebrew-corpus-marker-overwrite
Jun 30, 2026
Merged

Fix #1056: reset Greek/Hebrew book titles when overwriting Macula with another Bible#1067
LeviXIII merged 2 commits into
mainfrom
1056-greek-hebrew-corpus-marker-overwrite

Conversation

@sampjvv

@sampjvv sampjvv commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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 title Greek Matthew instead of resetting to Matthew. The "corpus marker title" in the issue is the file's fileDisplayName.

Root cause

All NewSourceUploader imports funnel through convertToNotebookPreview() (src/providers/NewSourceUploader/NewSourceUploaderProvider.ts). For a Bible book with no incoming fileDisplayName (eBible/USFM/Paratext don't set one), it derived the title from the USFM code via getBookDisplayName(usfmCode).

getBookDisplayName (src/utils/bookNameUtils.ts) reads the existing <CODE>.codex from disk first and returns its saved fileDisplayName. At overwrite time that file is still the old Macula one → it returns Greek Matthew, and since the new importer isn't Macula no prefix-stripping happens, so the stale title is written into the new file. (The corpusMarker metadata itself was already corrected to NT/OT on overwrite, so only the title carried over.)

Fix

  • Add a disk-free getDefaultBookName(usfmCode) to bookNameUtils.ts that 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.
  • In convertToNotebookPreview(), the import-time NT/OT title derivation now uses getDefaultBookName instead of getBookDisplayName, 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

  • eBible / USFM / Paratext overwriting Macula → titles reset to Matthew / Genesis. ✅
  • Fresh Macula download → Greek/Hebrew <Book>. ✅ (unchanged)
  • Overwrite Macula with Macula → stays Greek/Hebrew <Book>. ✅ (unchanged)
  • Editing a corpus marker still syncs/saves (untouched path). ✅

Testing

  • Added 3 unit tests in src/test/suite/bookNameUtils.test.ts, including a Bug: Greek/Hebrew Corpus Marker titles remain after overwritting #1056 regression: a MAT.codex saved as Greek Matthew on disk, asserting getDefaultBookName("MAT") still returns Matthew.
  • Full extension test suite: 1178 passing, 7 pending (pre-existing/unrelated), 0 failing. All 9 bookNameUtils tests pass (existing getBookDisplayName disk-read tests unchanged).
  • tsc --noEmit and eslint clean.

🤖 Generated with Claude Code

sampjvv and others added 2 commits June 23, 2026 12:09
…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 LeviXIII merged commit c4d29fe into main Jun 30, 2026
3 checks passed
@LeviXIII LeviXIII deleted the 1056-greek-hebrew-corpus-marker-overwrite branch June 30, 2026 19:51
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: Greek/Hebrew Corpus Marker titles remain after overwritting

2 participants