Skip to content

1075 patani malay project formatting issues#1080

Open
LeviXIII wants to merge 4 commits into
mainfrom
1075-patani-malay-project-formatting-issues
Open

1075 patani malay project formatting issues#1080
LeviXIII wants to merge 4 commits into
mainfrom
1075-patani-malay-project-formatting-issues

Conversation

@LeviXIII

@LeviXIII LeviXIII commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1075

The Pattani Malay project showed verses merged contrary to source versification, recent translations appearing "missing," and cells stranded out of order. Root cause (traced to #848): a book can end up stored in two versifications at once — verse-range cells (e.g. MAT 8:14-15) coexisting with single-verse cells (MAT 8:14, MAT 8:15). The codex merge resolver dedupes cells by ID, and the two forms have different IDs, so both survive a merge and translated content gets stranded across them (and the empty duplicates pile up at the end of the file).

This PR adds a manual, opt-in repair command"Codex: Repair Duplicated Verse Cells" — that collapses this duplication and repositions stranded cells without losing content and without changing sync behavior. The merge/sync path is intentionally left unchanged.

Changes

  • Verses display in separate cells matching source versification — the repair keeps whichever form actually holds the translation and repositions stranded verse cells into canonical (book, chapter, verse) order under their chapter milestone, via an opt-in repairMode reorder that can pull cells back across intervening milestones.
  • No silent data loss; deletions/changes tracked in edit history — only empty duplicate cells are removed, via soft-delete with a MIGRATION edit entry (row + history preserved, fully recoverable). Content cells are never deleted. Overlapping-content conflicts (both forms translated, e.g. MAT 12:46-47) are left untouched and reported for manual review.
  • Identify root cause; restore affected passages — root cause identified (range/single merge-union, Project: spanishreference - verses in Genesis have disappeared/ missing #848); the command restores affected passages in already-damaged projects. Validated on Pattani Malay MAT: 35 empty duplicates removed, every translation preserved, chapters 8/13/14/15 re-ordered correctly.
  • Safe across project types — the repair is book-aware (multi-book study bibles don't cross-collide GEN 1:1 with EXO 1:1), range-restricted (study-bible note structures / repeated single refs are ignored), and a no-op for non-Bible importer types.

Not covered by this PR (tracked separately):

  • Removed headings/paratext reappearing — needs separate git-history tracing; not included here.
  • Automatic recurrence prevention — deliberately not added to sync. A resolver-level dedup
    was prototyped and then removed so the merge/sync path stays byte-identical to today; recurrence
    is addressed by running the manual command (and existing delete-wins propagation keeps a repaired
    project fixed across peers once synced).
  • "pmsue" cannot update / binary-version check — a separate client/version issue, out of scope.

Test Checklist

Repair correctness

  • Running "Codex: Repair Duplicated Verse Cells" on a damaged project collapses each verse to a single cell.
  • Stranded verse cells are repositioned into canonical order (Pattani MAT 14 renders 14:5 → 14:6 → 14:7 → 14:8).
  • Content in either form (range or singles) is preserved; no translated text is deleted.
  • Overlapping-content conflicts are left untouched and reported, not auto-merged.
  • Re-running the command is a no-op (idempotent).

Safety / no sync regression

  • A sync/merge produces the same result as before this change (the repair never runs on sync).
  • Healthy single-verse projects are untouched by the command.
  • Multi-book files (study bibles) do not cross-collide verses from different books.
  • Study-bible note structures (many cells sharing one verse ref) are left untouched.
  • Non-Bible importer projects (docx/subtitles/spreadsheets) are a no-op.

LeviXIII added 2 commits June 30, 2026 10:17
…plication` for repairing duplicated verse cells, addressing issue #848.

- Implemented migration logic in `migrationUtils.ts` to handle verse duplication repairs, including a dry-run option.
- Updated `merge/resolvers.ts` to apply duplication repair during merges.
- Enhanced `verseRangeReorder` utility to support a repair mode for reordering cells post-duplication repair.
- Added tests to validate the new repair functionality and ensure stranded cells are correctly repositioned.
…chapter, ensuring accurate handling of multi-book notebooks.

- Added tests to verify that duplicates across different books are not incorrectly flagged and that pure single overlaps remain untouched.
@LeviXIII LeviXIII linked an issue Jun 30, 2026 that may be closed by this pull request
14 tasks
@LeviXIII

Copy link
Copy Markdown
Contributor Author

/build

@github-actions

Copy link
Copy Markdown

LeviXIII added 2 commits July 1, 2026 10:24
… repair's

  dedup logic, so a duplicate cell holding recorded audio (but empty text) is
  never soft-deleted. Previously the "empty" check only looked at the text value,
  so audio recorded into a duplicate cell was silently orphaned when the
  range/single duplicate was collapsed.
- Audio-bearing duplicates now become conflicts (both forms carry data) and are
  left untouched for manual review, exactly like text-vs-text conflicts. A
  deleted audio attachment (isDeleted: true) does not protect an empty duplicate.
- Add `hasAudio` and a concise passage `label` (e.g. "MAT 8:14-15") to each
  conflict in the repair plan.
- After the confirm modal, surface the conflicts as a persistent, non-modal
  toast that survives past the modal: it lists the specific passages needing
  manual review, calls out which contain audio, and logs the full list to the
  console. Shown whether the user applies or cancels.
- Add tests for audio preservation, deleted-audio (not protected), and the
  conflict label/audio flags.
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.

Patani malay project: Formatting Issues

1 participant