Skip to content

Capture trace warnings from libpalaso verse and chapter parsing#867

Closed
pmachapman wants to merge 1 commit intomainfrom
trace_warnings
Closed

Capture trace warnings from libpalaso verse and chapter parsing#867
pmachapman wants to merge 1 commit intomainfrom
trace_warnings

Conversation

@pmachapman
Copy link
Collaborator

@pmachapman pmachapman commented Feb 4, 2026

Fixes sillsdev/machine#372

It seemed to make sense to implement this in Serval, rather than Machine as I couldn't see a clean way of maintaining the state of where the parser was to the TraceListener, without making the UsfmVersificationErrorDetector a bit more convoluted. The warnings (with the prefix in this PR) look like:

USFM Parsing error: Just failed to parse a chapter number: 1.
USFM Parsing error: Just failed to parse a verse number: v1

If you think this should be implemented in Machine not Serval, I will close this PR and reimplement there.


This change is Reviewable

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.60%. Comparing base (464b715) to head (6dd7402).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #867      +/-   ##
==========================================
+ Coverage   66.57%   66.60%   +0.02%     
==========================================
  Files         383      384       +1     
  Lines       20933    20948      +15     
  Branches     2720     2721       +1     
==========================================
+ Hits        13937    13952      +15     
  Misses       6027     6027              
  Partials      969      969              

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@Enkidu93 Enkidu93 left a comment

Choose a reason for hiding this comment

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

Thank you, Peter!

I think you meant to link sillsdev/machine#372, not Serval 372.

I have two concerns about these warnings:

  • If most of these are redundant (i.e., bad verse numbers), is it worth adding them at all? Is there a way we could filter them? If the only other category of error is bad chapter numbers, could we just extend the error detector to capture those?
  • These warnings do not provide sufficient context for the developer or EITL team member to be able to find the problem. Is there a way we could inject more context?

My preference would be to extend the UsfmVersificationErrorDetector to flag bad chapter numbers (if possible) unless these traces include other types of errors that we could not easily detect. Maybe we can discuss this as a team in the meeting today and agree to a solution.

@Enkidu93 reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @pmachapman).

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.

I took a quick look at the VerseRef code and it looks like the only trace warnings are for invalid chapter and verse numbers. An alternative to the trace listener is to check the ChapterNum or VerseNum values after creating the VerseRef. ChapterNum will be <= 0 if it is invalid and VerseNum will be < 0 if it is invalid. That seems like a less hacky way to capture these warnings.

@ddaspit made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @pmachapman).

@pmachapman pmachapman closed this Feb 4, 2026
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.

The USFM parser should trap the Trace warnings from VerseRef

4 participants