Repository navigation
Trace HermitCrab failure reasons and template slot outcomes - #534
johnml1135 wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #534 +/- ##
==========================================
+ Coverage 74.36% 74.98% +0.62%
==========================================
Files 456 458 +2
Lines 38325 38539 +214
Branches 5263 5297 +34
==========================================
+ Hits 28499 28900 +401
+ Misses 8669 8511 -158
+ Partials 1157 1128 -29 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@johnml1135 Did you ask Beth about this? I'm worried that this will make it harder to find a needle in a haystack because the haystack will be so much bigger. It may also slow Try A Word down. |
|
@jtmaxwell3 I measured both concerns, on a real Indonesian grammar exported from FLEx (70 wordforms, two compounding rules), comparing the merge-base with this branch. Speed with tracing off (normal parsing): no measurable change. All 70 words give identical parses, and total time is 4.4 s on both, within 2%. Every new callback sits behind Trace size in Try A Word: you were right, and it was worse than the branch description said. Fixed in 371ba39. I haven't timed parsing with tracing on beyond those 40 words. |
| if (_morpher.TraceManager.IsTracing && !unapplied) | ||
| _morpher.TraceManager.MorphologicalRuleNotUnapplied(_rule, i, input); | ||
| if (!matched) | ||
| TraceFailure(i, input, FailureReason.Pattern, null); |
There was a problem hiding this comment.
Minor: F1. Plain ITraceManager implementations no longer receive MorphologicalRuleNotUnapplied(rule, i, input) for a compounding subrule that fails. Base called it whenever srOutput produced nothing; now every subrule failure goes through CompoundingRuleRejected, which passes only NonHeadProdRestrictMprFeatures to plain managers. This contradicts "receive exactly the callback they did before", and LegacyTraceManager_ReceivesOnlyTheExistingCompoundingRejection checks only for an absence. Send the old call to non-detailed managers at the subrule loop exit.
| input.GetUnapplicationCount(_rule) >= _rule.MaxApplicationCount | ||
| || !_outputFS.IsUnifiable(input.SyntacticFeatureStruct) | ||
| ) | ||
| if (input.GetUnapplicationCount(_rule) >= _rule.MaxApplicationCount) |
There was a problem hiding this comment.
Minor: F2. Plain managers now get calls they never got before: MorphologicalRuleNotUnapplied(rule, -1, input) from the MaxApplicationCount and output-FS gates here, and from the realizational gate at AnalysisRealizationalAffixProcessRule.cs:53. Base returned silently, and -1 was never a subrule index on this callback, so a consumer that indexes Subrules[subruleIndex] throws. Unverified against FieldWorks, whose handler the description says is empty. Gate these the way CompoundingRuleRejected does.
| _rule, | ||
| i, | ||
| outWord, | ||
| FailureReason.RequiredSyntacticFeatureStruct, |
There was a problem hiding this comment.
FYI: F3. The legacy callback changes shape here. When every match fails Required, base made one call with input; now a plain manager gets one call per rejected outWord, each carrying the output with Out stripped, and none with input.
| word, | ||
| FailureReason.PartialParse, | ||
| null, | ||
| new PartialParseFailure( |
There was a problem hiding this comment.
FYI: F4. Failed(..., PartialParse, null, failureObj) now passes a PartialParseFailure to plain managers, where base passed null; SynthesisStratumRule.cs:74 does the same. A legacy manager that serializes failureObj gets an unknown type. Unverified: I did not read FwXmlTraceManager.Failed.
| TraceFailure( | ||
| i, | ||
| tempInput, | ||
| FailureReason.NonHeadProdRestrictMprFeatures, |
There was a problem hiding this comment.
FYI: F5. The public TraceManager now builds a different tree for compounding failures: CompoundingRuleAnalysis nodes with the subrule index replace MorphologicalRuleAnalysis nodes, and the productivity rejection carries i instead of -1. A consumer that filters on MorphologicalRuleAnalysis loses compounding rules. If this is intended, the description should say so.
| case TraceType.StratumAnalysisOutput: | ||
| case TraceType.TemplateAnalysisInput: | ||
| case TraceType.TemplateAnalysisOutput: | ||
| case TraceType.TemplateSlotAnalysis: |
There was a problem hiding this comment.
FYI: F6. The HC tool now prints slot traces without SlotIndex or SlotOutcome: PrintTrace writes only source, input, output, and reason. Applied, skipped, and unfilled lines for the same template look alike, so the tool trace gets longer without telling the reader more.
| } | ||
|
|
||
| /// <summary> | ||
| /// ITraceManager implementations previously received only the productivity-restriction rejection, |
There was a problem hiding this comment.
FYI: F7. This comment narrates history ("previously received"), which .claude/skills/code-comments/SKILL.md:24 forbids; the strict scan has no pattern for it. State the current contract: plain managers receive only the productivity-restriction rejection, with subrule index -1.
This comment has been minimized.
This comment has been minimized.
The suite added Trace.FailureAllomorph so FailureRuleAttributor could credit an affix rule whose allomorph failed an environment or co-occurrence check. That is an engine API change riding in a test-suite PR, and #534 adds the same fact as Trace.Allomorph. Drop it here; the attribution returns with #534. No generated ledger changes: coverage.csv and rules.csv regenerate byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
371ba39 to
9124922
Compare
| NonPartialRuleProhibitedAfterFinalTemplate, | ||
| NonPartialRuleRequiredAfterNonFinalTemplate, | ||
| MaxApplicationCount, | ||
| OutputSyntacticFeatureStruct, |
There was a problem hiding this comment.
FYI: F9. The four new FailureReason values have no row in conformance/engine-gate-inventory.tsv, which still lists 23 gates. EngineGateInventoryLedger.Compute emits one row per member. The [Explicit] CheckedInEngineGateInventoryLedgerIsUpToDate fails at this head (expected length 16331, got 28388). Some of that drift is older, from a stale line number in the untouched SynthesisAffixProcessRule.cs. gate-obligations.tsv and the "23" counts in both ledger doc comments are stale in the same way.
There was a problem hiding this comment.
F9 still applies at 54393fd: the ledger now comes from master, and this PR still makes it stale on merge. At merge commit 9fd7e57, the [Explicit] CheckedInEngineGateInventoryLedgerIsUpToDate fails: expected length 16780, got 27164. The first difference is this PR's new AnalysisCompoundingRule.cs raise site. Regenerate with hc-conformance --write-engine-gate-inventory --repository-root . after rebasing.
This comment has been minimized.
This comment has been minimized.
9124922 to
928d7fa
Compare
This comment has been minimized.
This comment has been minimized.
The suite added Trace.FailureAllomorph so FailureRuleAttributor could credit an affix rule whose allomorph failed an environment or co-occurrence check. That is an engine API change riding in a test-suite PR, and #534 adds the same fact as Trace.Allomorph. Drop it here; the attribution returns with #534. No generated ledger changes: coverage.csv and rules.csv regenerate byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3a63132 to
df2cf21
Compare
Add optional detailed trace callbacks for analysis rejections, slot branches, and completed lexical lookup counts. Retain failure operands, blocking entries, and partial-parse causes in TraceManager without replaying linguistic checks. Preserve the ITraceManager member contract and verify legacy callbacks, parallel slot outcomes, interrupted lookups, and morphological analyses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ITraceManager implementations previously received CompoundingRuleNotUnapplied only for the productivity-restriction rejection, with subrule index -1. This branch had sent them every new compounding gate as well. FieldWorks writes a trace node for each call, so Try A Word would have gained a reasonless failure node per rejected compound analysis. They now receive exactly the original call. Detailed consumers still get every gate with its subrule index. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
928d7fa to
54393fd
Compare
|
|
||
| internal int MorphologicalRuleApplicationCount => _mruleAppCount; | ||
|
|
||
| internal IMorphologicalRule NextMorphologicalRule => _mruleAppIndex < 0 ? null : _mruleApps[_mruleAppIndex]; |
There was a problem hiding this comment.
FYI: F10. NextMorphologicalRule can be null while a rule remains: GenerateWords pushes (null, allo) for a compound non-head (Morpher.cs:340), and MorphologicalRuleUnapplied stores it in _mruleApps. Then PartialParseFailure(UnappliedMorphologicalRules, null) cannot be told apart from "no rule known". Unverified by a test; read from the code.
|
Verdict: approve with fixes. This push rewrote the branch onto a2f80e2 (#529) and dropped the conformance commits, so only the two engine commits are left. The engine code behind F1-F7 is the same as last round. Three files have new blob SHAs (
Public API: unchanged since last round. The PR adds Findings: F1 open, F2 open (unverified), F3 open, F4 open (unverified), F5 open, F6 open, F7 open, F8 addressed, F9 open, F10 new (unverified). Reviewed at 54393fd |
HermitCrab computes several facts that Try A Word cannot display because they do not reach the trace or are discarded by the trace manager. This change passes the available facts through an optional
IDetailedTraceManagercapability and retains them in Machine'sTraceManager, without rerunning linguistic checks.IDetailedTraceManager, with the subrule index and available operand.ITraceManager-only consumers receive exactly the callback they did before: the productivity-restriction rejection, with subrule index -1. FieldWorks writes a trace node for everyCompoundingRuleNotUnappliedcall, so sending them the new gates would add reasonless failures to Try A Word.ITraceManagerhas no new members. Existing implementations keep the original callbacks; detailed consumers opt intoIDetailedTraceManager. Enum additions preserve existing values, and morphological analyses remain unchanged in tracing-on/off and sequential/parallel tests.Validation:
./local_check.sh --agent-strictpassed on Windows (full solution build and every test project). In WSL, all 151 tests inSIL.Machine.Morphology.HermitCrab.Testspassed in a fresh WSL Release run, including 45 syntheticTraceReasonTestscovering the facts above, legacy callbacks, interrupted/interleaved lookups, and analysis equivalence. Strict comment hygiene passed and CSharpier checked 724 files. Both./local_check.shand./local_check.sh --agent-strictexited at the solution build because WSL lackscmakefor SentencePiece; the standard rerun also reported MSBuild child-node shutdown errors. The full solution test suite has not passed on this tree. These local checks do not collect CI-equivalent coverage. After 371ba39, on Windows: Release build clean;dotnet testpassed in every test project that ran (880 passed and 3 skipped, 4, 155, 93); strict comment hygiene clean; CSharpier 1.2.6 check clean, run from a scratch install because the manifest's tool would not resolve in this environment, solocal_check.shitself stopped at that step.FieldWorks follow-up (outside this PR):
IDetailedTraceManagerinFwXmlTraceManager: add the reason-bearingMorphologicalRuleNotUnappliedoverload,TemplateSlotProcessed, andLexicalLookupCompleted. Serialize the new operands, branch outcomes, and completed counts. Keep lookup/synthesis associations correct inLexicalLookupandSynthesizeWordwhen other trace nodes are inserted.Blockedto serialize the replacement Word's root entry. ExtendCompoundingRuleNotUnappliedto handle each reason rather than only productivity restrictions.Failed, serializePartialParseFailure.Causeand its pending rule; forEnvironments, serialize each failed alternative alongside the supplied allomorph instead of passing the collection directly toXElement. ExistingNonFinalTemplateAppliedLastandApplicableTemplatesNotAppliedcallbacks already distinguish those two template completion failures.MorphologicalRuleNotApplied, fix theprefixEnv/suffixEnvbranches atFwXmlTraceManager.cs:299-302: they currently writeenvinstead of their respective values.FormatHCTrace.xsl'sShowAnyFailure(environment branch around line 597 and partial-parse branch around line 661) andShowCompoundingRuleFailure(around line 1149) to display the detailed facts. ExtendShowTracePath(around line 1237), which selects synthesis children ofLexLookupTracebut excludes the lookup node itself, to include empty lookup, slot, and blocking events; adjustDetermineIfMoreToShowfor the added nodes. Display unknown phonological causes as unknown.🤖 Generated with Claude Code
This change is