Skip to content

HCLoader: skip a duplicate boundary marker and warn instead of failing the load - #1273

Draft
johnml1135 wants to merge 4 commits into
mainfrom
fw-skip-dup-boundary
Draft

johnml1135 wants to merge 4 commits into
mainfrom
fw-skip-dup-boundary

Conversation

@johnml1135

@johnml1135 johnml1135 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Start here: Src/LexText/ParserCore/HCLoader.cs, LoadCharacterDefinitionTable (the boundary loop).

A project with two boundary markers both coded + fails to load in FLEx: HCLoader adds both to Machine's CharacterDefinitionTable and the second add throws (sillsdev/PanGloss#640). HCLoader now pre-checks m_table.Contains for boundary markers, the way it already does for phonemes. A colliding marker is skipped, never added to m_charDefs, and reported through a new IHCLoadErrorLogger.DuplicateBoundaryMarker. Phonemes already warned via DuplicateGrapheme; that path is unchanged.

A reference to a skipped marker finds no m_charDefs entry, so TryLoadSimpleContext returns false and the caller reports the context as invalid, the same as for an unknown boundary today. No null dereference. This matches PanGloss, which rejects the colliding boundary and errors "unknown boundary marker" on each use (sillsdev/machine#665 review). It works on today's Machine and stays correct once #665 makes a skipped Add return null.

Where to look

  • The boundary loop in HCLoader.cs: skip is whole-marker (any rep colliding skips all of its reps), same as phonemes.
  • The new logger method, implemented in HCParser.cs (XML duplicate-boundary-marker load error), GenerateHCConfig/ConsoleLogger.cs and the test logger.
  • Tests DuplicateBoundaryMarkers and BoundaryMarkerSharingPhonemeGrapheme in HCLoaderTests.cs.

Not here: the synthetic m_null, . and + boundaries added after the loop are unchanged; no new parser-trace UI for the load error.

Verification: not built or run locally (the project targets net48 and FieldWorks does not build on Linux); relies on PR CI.

Next: review, then let CI run the HCLoader tests.

🤖 Generated with Claude Code


This change is Reviewable

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Comment hygiene (advisory)

4 comment-style violation(s) in the lines this branch adds since origin/main.
Advisory only -- no check fails on these, and the same violations appear as inline warnings on the Files changed tab.

File Category Comment
Src/LexText/ParserCore/HCLoader.cs:2729 comment-line-too-long 102 columns (max 98): another phoneme or boundary marker has defined the same representati...
Src/LexText/ParserCore/HCLoader.cs:2730 comment-line-too-long 100 columns (max 98): leave it out of m_charDefs so each reference to it fails like an unk...
Src/LexText/ParserCore/HCLoader.cs:2741 comment-line-too-long 104 columns (max 98): the system definitions go into the table before the phonemes and cus...
Src/LexText/ParserCore/ParserCoreTests/HCLoaderTests.cs:1528 comment-line-too-long 114 columns (max 98): recreate the system morpheme boundary after a custom "+" marker so t...

Fix them per .claude/skills/fieldworks-code-commenting/SKILL.md.
Running .\build.ps1 -CommentHygiene (or .\test.ps1 -CommentHygiene) enforces them locally, and
re-wraps over-wide lines and repairs non-ASCII punctuation as it goes.

@johnml1135
johnml1135 force-pushed the fw-skip-dup-boundary branch from 07cb31d to d72aa7d Compare December 1, 2026 20:06
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

NUnit Tests

    1 files  ±0      1 suites  ±0   16m 19s ⏱️ + 2m 22s
7 435 tests +5  7 356 ✅ +5  79 💤 ±0  0 ❌ ±0 
7 444 runs  +5  7 365 ✅ +5  79 💤 ±0  0 ❌ ±0 

Results for commit 3256f14. ± Comparison against base commit 96962d5.

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.05405% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.92%. Comparing base (96962d5) to head (3256f14).

Files with missing lines Patch % Lines
Src/LexText/ParserCore/HCLoader.cs 74.07% 4 Missing and 3 partials ⚠️
Src/LexText/ParserCore/HCParser.cs 0.00% 7 Missing ⚠️
Src/GenerateHCConfig/ConsoleLogger.cs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1273   +/-   ##
=======================================
  Coverage   40.92%   40.92%           
=======================================
  Files        1603     1603           
  Lines      360816   360839   +23     
  Branches    42246    42252    +6     
=======================================
+ Hits       147678   147688   +10     
- Misses     183645   183653    +8     
- Partials    29493    29498    +5     
Files with missing lines Coverage Δ
Src/GenerateHCConfig/ConsoleLogger.cs 14.51% <0.00%> (-0.74%) ⬇️
Src/LexText/ParserCore/HCLoader.cs 74.67% <74.07%> (-0.18%) ⬇️
Src/LexText/ParserCore/HCParser.cs 5.65% <0.00%> (-0.08%) ⬇️

... and 4 files with indirect coverage changes

🚀 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.

johnml1135 and others added 4 commits December 1, 2026 22:30
A boundary marker whose representation duplicates a phoneme or another
marker is skipped with no definition entry, so references to it fail like an
unknown boundary. The system morpheme boundary is loaded first so it always
wins over a custom marker coded the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The null and morpheme boundaries go into the character table first, so a
custom marker coded the same (+ or the null representations) is the one
skipped and warned about. m_morphBdry comes from the system marker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A phoneme coded + or with a null representation now takes the duplicate
grapheme path instead of displacing the system boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phoneme n carries features, so exact equality with a bare segment failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johnml1135
johnml1135 force-pushed the fw-skip-dup-boundary branch from 38633c1 to 3256f14 Compare December 2, 2026 03:31
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.

2 participants