Skip to content

Conversation

@Enkidu93
Copy link
Collaborator

@Enkidu93 Enkidu93 commented Dec 5, 2025

  • Make ActualVerseRef & ExpectedVerseRef more robust and helpful
  • Fix test typo

This comes out of a problem John Nystrom experienced with a project. While I was in the code, I also made some other small tweaks.

This will need to be ported to machine.py.


This change is Reviewable

@Enkidu93 Enkidu93 requested a review from ddaspit December 5, 2025 19:12
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.51%. Comparing base (278cd39) to head (09249c8).

Files with missing lines Patch % Lines
....Machine/Corpora/UsfmVersificationErrorDetector.cs 75.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #362      +/-   ##
==========================================
- Coverage   72.51%   72.51%   -0.01%     
==========================================
  Files         423      423              
  Lines       35933    35945      +12     
  Branches     4960     4962       +2     
==========================================
+ Hits        26058    26066       +8     
- Misses       8779     8781       +2     
- Partials     1096     1098       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Enkidu93
Copy link
Collaborator Author

Enkidu93 commented Dec 5, 2025

@ddaspit If we can, I'd like to get this in before the QA release. (I'm thinking Monday instead of today?). This error could cause entire builds to fail and the error message that you get from SIL.Scripture is not very helpful (unlike other exceptions thrown when parsing the USFM).

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@ddaspit reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Enkidu93)


src/SIL.Machine/Corpora/UsfmVersificationErrorDetector.cs line 169 at r1 (raw file):

        {
            string verseString = _actualVerse == -1 ? "" : verse.ToString();
            return $"{Canon.BookNumberToId(_bookNum)} {chapter}:{verseString}";

One thing we should watch out for whenever converting a number to a string is that the current culture is used to do the conversion, so in some cases, you can get an unexpected string representation of a number. I think it is probably okay here, since these numbers should only be positive integers, which I believe are consistent across cultures. Whenever converting a number to a string, I try to remember to use the invariant culture.

@Enkidu93 Enkidu93 merged commit 7651a39 into master Dec 5, 2025
4 checks passed
@Enkidu93 Enkidu93 deleted the improve_versification_error_detection branch December 5, 2025 20:30
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.

4 participants