Skip to content

TT-7380 fix: accept valid sub-verse references in Mark Verses validation#370

Open
nabalone wants to merge 2 commits into
developfrom
TT-7380_mark-verses-subverse-reference-validation
Open

TT-7380 fix: accept valid sub-verse references in Mark Verses validation#370
nabalone wants to merge 2 commits into
developfrom
TT-7380_mark-verses-subverse-reference-validation

Conversation

@nabalone

Copy link
Copy Markdown
Collaborator

Summary

Addresses the reopened issue in the TT-7380 comment: Mark Verses treated valid sub-verse references as invalid, so adding boundaries for references like 35:16-22a / 35:22b-26 raised the "autosave skipped" toast, blocked auto-save, and produced the Unsaved Content dialog on navigation.

The Mark Verses validation compared expanded references against the passage's verse list by exact string match, so any sub-verse part (1:2a, 3:4b-c) never matched its whole-verse passage entry (1:2, 3:4) and was flagged as "outside the passage".

What changed

Rewrote markVersesValidation.ts around a sub-verse coverage model:

  • Each reference resolves to a verse key plus its part span (ae); whole verses cover all parts.
  • The passage's expected coverage honors part boundaries at the range ends (e.g. 1:1-4a expects only part a of verse 4; 1:2b-5 starts part-way through verse 2).
  • References are checked for three conditions: outside/overshoot the passage (hard error), missing coverage (warning), and repeated/overlapping parts (hard error).
  • A verse split into parts counts as covered once its parts form a contiguous run from a (at least a and b, no gaps). Repeated or overlapping parts remain invalid.

Test plan

  • 25 new/updated unit tests in markVersesValidation.test.ts cover: accepting valid sub-verse refs, the consecutive-parts completeness rule, passage ranges with sub-verse boundaries, and still rejecting repeated/overlapping/outside refs.
  • npm test — all 106 mark-verses/refMatch tests pass; npm run typecheck clean.
  • Manual: in a project with references like 35:16-22a / 35:22b-26, add boundaries in Mark Verses → no false "autosave skipped" toast, changes auto-save, and navigating to a nearby step no longer shows the Unsaved Content dialog.

🤖 Generated with Claude Code

nabalone and others added 2 commits June 23, 2026 14:06
Mark Verses validation compared expanded references against the passage
verse list by exact string match, so valid sub-verse references such as
35:16-22a or 35:22b-26 were flagged as invalid. This blocked auto-save
(showing the "autosave skipped" toast) and triggered the Unsaved Content
dialog when navigating away.

Rewrote the validation around a sub-verse coverage model: each reference
resolves to a verse plus its part span (a-e), the passage's expected
coverage honors part boundaries at the range ends, and refs are checked
for being outside/overshooting the passage, missing coverage, or
repeated/overlapping parts. A verse split into parts is now covered once
its parts form a contiguous run from a (at least a and b); repeated or
overlapping parts remain invalid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…erse mangling

Extracted the desktop PassageDetailMarkVerses `getRefs` logic verbatim into a
pure, testable util (markVersesExpandRefs.ts) and had the component delegate to
it. This is a behavior-preserving refactor (typecheck and the existing
PassageDetailMarkVerses tests still pass) that removes the now-unused parseRef
and Passage imports from the component.

Added markVersesExpandRefs.test.ts to document expansion bugs that remain after
the validation fix. `getRefs` builds the per-row expandedRefs the validation
consumes, so a mangled expansion makes the validation reject references the user
typed correctly:

  - a single sub-verse (1:2a) is emitted twice -> tripping the repeated/
    overlapping-part check
  - a same-verse letter range (1:22a-b, 3:4b-c) drops the verse number on the
    range end (e.g. 3:4b-c -> ['3:4b', '3:c']), which fails refMatch

Four of the eight tests fail on purpose to demonstrate these bugs; the QA repro
forms (35:16-22a, 35:22b-26) expand correctly and are covered by passing guard
tests. The expansion itself is not yet fixed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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