TT-7380 fix: accept valid sub-verse references in Mark Verses validation#370
Open
nabalone wants to merge 2 commits into
Open
TT-7380 fix: accept valid sub-verse references in Mark Verses validation#370nabalone wants to merge 2 commits into
nabalone wants to merge 2 commits into
Conversation
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>
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.
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-26raised 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.tsaround a sub-verse coverage model:a–e); whole verses cover all parts.1:1-4aexpects only partaof verse 4;1:2b-5starts part-way through verse 2).a(at leastaandb, no gaps). Repeated or overlapping parts remain invalid.Test plan
markVersesValidation.test.tscover: 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 typecheckclean.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