Repository navigation
Stop self-opaquing analysis when the shape stops changing - #624
Conversation
|
Verdict: approve. What matters most: the new guard at Counts: 0 Critical, 0 Important, 0 Low. What I ran: Not verified: I did not rerun the three new cases against the old implementation; that is the author's claim that they hung. I did not confirm that an existing test drives a self-opaquing rule through two or more passes that each change the shape, which is the branch that keeps looping. The fix also does not guard against a rule that cycles between two shapes. I have no example of one, and the old code had the same exposure. I did not run Public API, target framework, package, Findings: none this round. Reviewed at eebb57d |
Repeated unapplication can match without changing the shape, leaving analysis in an infinite loop. Stop reapplying once the shape is unchanged. Co-Authored-By: GPT-6.1 Terra <noreply@openai.com>
eebb57d to
7335c69
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #624 +/- ##
==========================================
+ Coverage 75.76% 75.80% +0.03%
==========================================
Files 457 457
Lines 39103 39108 +5
Branches 5459 5461 +2
==========================================
+ Hits 29626 29644 +18
+ Misses 8339 8335 -4
+ Partials 1138 1129 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Start here:
AnalysisRewriteRule.cs. HermitCrab analysis could spin forever when a rewrite rule's output conflicts with its environment and the rule therefore reapplies its inverse in self-opaquing mode. With this change, self-opaquing reapplication stops once a pass leaves the shape unchanged, and keeps reapplying while the shape still changes.The loop runs in
IterativePhonologicalPatternRule, which reports success whenever it invokes the right-hand side, even when nothing changes. For the reduced rules in #623, the inverse stays eligible after an unchanged pass, so the old loop never ended. The new guard compares a fullShapesnapshot usingValueEquals, not spelling, so it covers node features, optionality,Modified, boundaries and morph annotations. If a pass leaves the shape unchanged, the next pass would see the same state, so stopping cannot hide a later productive pass.New regression tests cover the three reduced grammars from #623: segment
t → d / _ a(parsingda), alpha-input nasal (parsingmp) and glottal (parsing-a). Each asserts the lexical analysis and has a timeout; all three hung before the fix. The tests also check generation. In these reduced feature systems,t/dandʔ/-have identical feature structures, so generation prints the first spelling (ta,ʔa), while parse validation accepts either spelling. This is how these fixtures render, not a synthesis bug.Fixes #623
Next: none planned. A separate fixture with a real feature contrast could strengthen generation coverage later.
Validation
git diff --checkis clean.local_check.shfails locally for reasons unrelated to this change:cmakeis missing for the SentencePiece native build, and the Thot testWordAlignCorpus_DefaultIsTransductive(Eflomal)hit the inactivity timeout. Machine (910 passed, 3 skipped) and HermitCrab (179 passed) were green in the same run.🤖 Generated with Claude Code
This change is