Skip to content

LT-22930: HCLoader reports every item it skips - #1274

Draft
johnml1135 wants to merge 3 commits into
fw-skip-dup-boundaryfrom
lt-22930-hcloader-skip-warnings
Draft

johnml1135 wants to merge 3 commits into
fw-skip-dup-boundaryfrom
lt-22930-hcloader-skip-warnings

Conversation

@johnml1135

@johnml1135 johnml1135 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1273, which lands first; this PR's base is its branch.

Start here: HCLoader.cs, then the new IHCLoadErrorLogger.SkippedItem.

What it does. The Hermit Crab loader never fails on bad data. It skips the item and warns. Several skips were silent, so the parser gave different results with no explanation (LT-22930). Every skip now reports through one new method, SkippedItem(item, skipped, reason). skipped is the thing the item refers to that was skipped, or null. Which items load is unchanged, with one exception: a metathesis rule that lost a switch context is now dropped and reported. Kept, it throws when applied, because the rule looks up both switch groups by name.

New warnings, by what is dropped:

  • a segment natural class with a skipped phoneme (dropped whole, as before)
  • a rule context that refers to a skipped class, phoneme or boundary marker; the rule still loads without that context
  • a boundary marker with no grapheme
  • a rewrite rule with no input or output, a metathesis rule with no switches
  • a form with no morph type, an infix or reduplication form with no valid environment
  • a stem name with no regions
  • an affix slot whose affixes were skipped by a warned drop (once, even if templates share it), and a template whose slots were all skipped
  • an allomorph or morpheme co-occurrence rule that refers to a skipped allomorph or morpheme

Where to look.

  • Existing warnings are untouched. An entry or affix rule that lost every allomorph is already named by the per-allomorph InvalidShape and similar warnings, so it gets no second one.
  • LoadPatternNode takes the owning rule, so only rewrite and metathesis contexts report. Affix process contexts already throw InvalidAffixProcessException.
  • IsValidRuleForm gains an out reason; HasValidRuleForm still uses the plain overload, so nothing is reported twice.
  • FormatCommon.xsl and HCSynthByGlossFormatCommon.xsl show the reason; without a case they would print the raw element text.

Not here.

  • The reduplication environment paths that can dereference a null context after a skipped class (LoadPatternNodes, LoadReduplicationPatterns). IsValidEnvironment rejects those environments first, so they are covered by InvalidEnvironment.
  • Unsupported morph types, abstract and empty forms. Those are not loaded by design.
  • Duplicate boundary markers: that is HCLoader: skip a duplicate boundary marker and warn instead of failing the load #1273. The no-grapheme report lives in its LoadBoundaryMarker.

Other loggers. ConsoleLogger (GenerateHCConfig) and the test logger implement the method. PanGloss's DiagnosticLogger implements IHCLoadErrorLogger too and will need SkippedItem when it takes this change.

Verification. Not built locally: net48 needs Windows. New tests in HCLoaderTests pin each kind of report; CI is the first run.

Next: approve, or tell me which reports are too noisy to keep.

🤖 Generated with Claude Code


This change is Reviewable

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Comment hygiene (advisory)

8 comment-style violation(s) in the lines this branch adds since origin/fw-skip-dup-boundary.
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:74 comment-line-too-long 103 columns (max 98): the MSAs that lost an allomorph through a warning, and the slots alr...
Src/LexText/ParserCore/HCLoader.cs:332 comment-line-too-long 100 columns (max 98): A slot whose affixes were all skipped is left out of the template. I...
Src/LexText/ParserCore/HCLoader.cs:333 comment-line-too-long 99 columns (max 98): only when a warning already explains why its affixes were skipped, an...
Src/LexText/ParserCore/HCLoader.cs:2260 comment-line-too-long 105 columns (max 98): a lost switch drops the whole rule, which is then reported once inst...
Src/LexText/ParserCore/HCLoader.cs:2275 comment-line-too-long 100 columns (max 98): Applying the rule looks up both switch groups, so it cannot load wit...
Src/LexText/ParserCore/HCLoader.cs:2495 comment-line-too-long 100 columns (max 98): Loads one phonological context. When the context cannot be loaded an...
Src/LexText/ParserCore/ParserCoreTests/HCLoaderTests.cs:454 comment-line-too-long 118 columns (max 98): <summary>Asserts that item was reported once as skipped, because of...
Src/LexText/ParserCore/ParserCoreTests/HCLoaderTests.cs:1742 comment-line-too-long 99 columns (max 98): Without both switch groups the rule would fail when it is applied, so...

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.

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

NUnit Tests

    1 files  ± 0      1 suites  ±0   11m 24s ⏱️ - 2m 33s
7 451 tests +21  7 372 ✅ +21  79 💤 ±0  0 ❌ ±0 
7 460 runs  +21  7 381 ✅ +21  79 💤 ±0  0 ❌ ±0 

Results for commit fa13c4a. ± Comparison against base commit 96962d5.

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.45509% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.95%. Comparing base (38633c1) to head (fa13c4a).

Files with missing lines Patch % Lines
Src/LexText/ParserCore/HCLoader.cs 80.13% 20 Missing and 10 partials ⚠️
Src/LexText/ParserCore/HCParser.cs 0.00% 12 Missing and 1 partial ⚠️
Src/GenerateHCConfig/ConsoleLogger.cs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##           fw-skip-dup-boundary    #1274      +/-   ##
========================================================
+ Coverage                 40.93%   40.95%   +0.02%     
========================================================
  Files                      1603     1603              
  Lines                    360839   360981     +142     
  Branches                  42252    42270      +18     
========================================================
+ Hits                     147694   147846     +152     
+ Misses                   183648   183645       -3     
+ Partials                  29497    29490       -7     
Files with missing lines Coverage Δ
Src/GenerateHCConfig/ConsoleLogger.cs 13.84% <0.00%> (-0.67%) ⬇️
Src/LexText/ParserCore/HCParser.cs 5.51% <0.00%> (-0.14%) ⬇️
Src/LexText/ParserCore/HCLoader.cs 76.97% <80.13%> (+2.29%) ⬆️

... and 5 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
johnml1135 force-pushed the lt-22930-hcloader-skip-warnings branch from b73fd38 to fa13c4a Compare December 2, 2026 03:15
@johnml1135
johnml1135 changed the base branch from main to fw-skip-dup-boundary December 2, 2026 03:15
@johnml1135
johnml1135 force-pushed the fw-skip-dup-boundary branch from 38633c1 to 3256f14 Compare December 2, 2026 03:31
johnml1135 and others added 3 commits December 1, 2026 22:31
The loader skipped several items without telling the user: natural
classes with a skipped phoneme, rule contexts that refer to a skipped
class, phoneme or boundary marker, rules with nothing to apply, forms
with no usable environment or morph type, stem names without regions,
affix slots and templates whose affixes were skipped, and co-occurrence
rules that refer to a skipped allomorph or morpheme.

Each of these now goes through one new IHCLoadErrorLogger method,
SkippedItem(item, skipped, reason). Which items load is unchanged. The
XML logger writes a skipped-item LoadError, and both FormatCommon
transforms show its reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Applying a metathesis rule looks up both switch groups by name, so a
rule kept without one of them throws when it matches. The loader now
skips such a rule and reports it, as Machine's XML loader does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A slot or template is now reported only when a warning already named
why its affixes were skipped, and a slot shared by several templates is
reported once. A metathesis rule dropped for a lost switch gives one
report that names the skipped item, not two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johnml1135
johnml1135 force-pushed the lt-22930-hcloader-skip-warnings branch from fa13c4a to 93042b3 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