Repository navigation
LT-22899: Show the required slot when Try A Word reports a pruned template - #1247
Draft
johnml1135 wants to merge 1 commit into
Draft
johnml1135 wants to merge 1 commit into
johnml1135 wants to merge 1 commit into
Conversation
HermitCrab (sillsdev/machine#575) traces each affix template partial it prunes as FailureReason.UnreachableRequiredSlot, with the slot, and ITraceManager.EndUnapplyTemplate takes that slot as a new failureObj. FwXmlTraceManager and HcXmlTraceManager take the new parameter and write the slot name in an unreachableRequiredSlot FailureReason. FormatHCTrace.xsl and HCSynthByGlossFormatHCTrace.xsl show it as a reason that names the required slot. This needs a SIL.Machine release that contains machine#575; it does not compile against 3.9.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Start here:
Src/LexText/ParserCore/FwXmlTraceManager.cs,EndUnapplyTemplate. It is the Try A Word half;HcXmlTraceManagermirrors it for HCSynthByGloss.Status: Draft until a SIL.Machine release contains sillsdev/machine#575. CI is red until then (see below).
Fixes LT-22899. Follows sillsdev/machine#575. Related: LT-22868.
What it does. machine#575 traces each pruned affix-template partial as
FailureReason.UnreachableRequiredSlot, with theAffixTemplateSlotit could not fill, and adds anobject failureObjparameter toITraceManager.EndUnapplyTemplate. Both FieldWorks trace managers take the parameter and write<FailureReason type="unreachableRequiredSlot"><Slot>slot name</Slot></FailureReason>. Both trace stylesheets show it as a reason that names the required slot and says its affixes cannot be found in what remains of the word.Why can't this merge now? The interface change breaks the build in both directions. On 3.9.6 the five-parameter method does not implement
ITraceManager, andUnreachableRequiredSlotdoes not exist. On the release with #575,mainstops compiling. The last commit before merge bumpsSilMachineVersion.Where to look
MorphologicalRuleAnalysisTrace, so the "Template ... failed" row appears beneath the affix.HCTraceTransformTests.TemplateFailure_NamesUnreachableRequiredSlotpins it..resxor Crowdin.Deliberately not here
SilMachineVersionbump.ParseWord, so it cannot reach a template analysis prune. Its stylesheet is updated so the two stay in step.Verification. Built and tested against a local package packed from #575 head d3c5c06f (
3.9.6-detached.gd3c5c06). The pin is not committed.build.ps1 -BuildTests -CommentHygiene -TokenHygiene: 0 warnings, 0 errors; both hygiene checks clean.Next: review the wording of the trace message now. Once a machine release contains #575, bump
SilMachineVersionand mark this ready.Reading this a year from now
FieldWorks implements HermitCrab's
ITraceManagerinFwXmlTraceManager(Try A Word) and inHcXmlTraceManager(HCSynthByGloss). Each turns HermitCrab trace callbacks into XML, whichFormatHCTrace.xslorHCSynthByGlossFormatHCTrace.xslrenders as HTML. machine#575 added a template-analysis prune for required slots. An earlier revision of #575 turned the prune off while tracing. On review it was changed to run while tracing and to be traced, and that trace is what this branch displays.Decisions
<Slot>holds the slot'sName. That is the slot name from the FieldWorks project, set byHCLoader. The value comes from(failureObj as AffixTemplateSlot)?.Name, so a slot without a name, or an unexpected object, writes an empty<Slot/>. It does not throw and never writes the CLR type name.Evidence
obj/project.assets.jsonfor ParserCore, ParserCoreTests, HCSynthByGlossLib and HCSynthByGlossTests resolvesSIL.Machine.Morphology.HermitCrab/3.9.6-detached.gd3c5c06. The builtSIL.Machine.Morphology.HermitCrab.dllreports product version3.9.6-detached.gd3c5c06+d3c5c06f..., so the tests ran against Fix for LT-22315 #575 and not against the released package.FwXmlTraceManagerTests.TemplateFailure_RecordsUnreachableRequiredSlot,HCTraceTransformTests.TemplateFailure_NamesUnreachableRequiredSlot,HCSynthByGlossTests.TraceNamesUnreachableRequiredSlot. All of them use synthetic names.HCSynthByGlossFormatHCTrace.xsl. A one-off transform of synthetic XML through it rendered: "Template failed. (Reason: The required slot 'subject slot' cannot be filled: no affix in this slot can be found in what remains of the word, in the order and position the template requires.)"To reproduce:
git -C <machine> checkout d3c5c06f$env:SILMACHINE_PATH = "<machine>"; .\build.ps1 -LocalLibraries machine -BuildTests.\test.ps1 -NoBuild -TestProject Src/LexText/ParserCore/ParserCoreTestsgit checkout Build/SilVersions.propsto drop the local pin.🤖 Generated with Claude Code
This change is