Skip to content

Fix flaky lexicon owned-menu pin test - #1260

Closed
thejambi wants to merge 2 commits into
mainfrom
fix-flaky-lexicon-menu-pin
Closed

thejambi wants to merge 2 commits into
mainfrom
fix-flaky-lexicon-menu-pin

Conversation

@thejambi

@thejambi thejambi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

LexiconMenuAuthorityTests.OwnedMenu_RendersItsPinnedItems_OnEveryLexiconRowThatBindsOne has been failing intermittently on main: the nightly run on fae5de023 and the push run for #1255 both failed only this test, with the same mismatch. The test's two Lexical Relations rows, *** and Antonym, came out swapped against the pinned outline. This change makes the test put those rows in a fixed order. It is test-only, with no product change.

Reviewer notes

Root cause. DetailComposer.GetLexicalRelations lists an entry's relations in the order liblcm's LexEntryReferences yields them. liblcm reads that from the entry's m_incomingRefs, a SimpleBag backed by a ConcurrentDictionary, so the order is hash order. Each entry's hash is built from the relation object's hash, which follows its GUID. The fixture creates its relations with fresh GUIDs on every run, so their order is effectively random. In a real project the GUIDs persist, so the order is stable, if arbitrary.

Deliberate rules.

  • The order is fixed in the test (OwnedMenuRows), not in DetailComposer. The WinForms LexReferenceMultiSlice does not sort these rows either, and sorting them in the product would be a behaviour change outside this fix.
  • Only the LexEntryReferences rows are reordered, and they stay in the positions they already hold; every other row keeps its composed order. They are ordered by label with an ordinal comparison, and *** sorts before Antonym, so PinnedLexiconMenus is unchanged.

Tests. All 27 tests in LexiconMenuAuthorityTests pass, with comment and token hygiene clean. The fixed test passed 5 further runs against the same build.

Manual tests. None; there is no user-visible change.

Out of scope. Other tests that read LexEntryReferences order from fixture-created relations could flake the same way. I found none in this fixture; the other relation tests look rows up by hvo.

🤖 Generated with Claude Code


This change is Reviewable

Zachary Burnham and others added 2 commits November 23, 2026 15:54
OwnedMenu_RendersItsPinnedItems_OnEveryLexiconRowThatBindsOne failed
intermittently on main (nightly and push runs): the two
LexEntryReferences rows, "***" and "Antonym", came out swapped.

DetailComposer lists an entry's relations in the order liblcm's
LexEntryReferences yields them. That comes from a hash-keyed bag of
incoming references whose hashes follow each relation's GUID, and the
fixture creates its relations with fresh GUIDs on every run.

Order the entry-relation rows by label before rendering, so the
pinned outline no longer depends on GUIDs. The pin itself is
unchanged, since "***" sorts before "Antonym".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment on WithEntryRelationsByLabel explained liblcm's hash
ordering. Per the commenting standard it now gives only the reason:
the relations' order varies between runs and the pin needs a fixed one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

NUnit Tests

    1 files  ±0      1 suites  ±0   14m 2s ⏱️ - 1m 22s
7 310 tests ±0  7 231 ✅ ±0  79 💤 ±0  0 ❌ ±0 
7 319 runs  ±0  7 240 ✅ ±0  79 💤 ±0  0 ❌ ±0 

Results for commit 3066d36. ± Comparison against base commit d6b31fd.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.41%. Comparing base (d6b31fd) to head (3066d36).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1260      +/-   ##
==========================================
- Coverage   40.41%   40.41%   -0.01%     
==========================================
  Files        1597     1597              
  Lines      360490   360490              
  Branches    42176    42176              
==========================================
- Hits       145696   145695       -1     
  Misses     185105   185105              
- Partials    29689    29690       +1     

see 1 file 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.

@mark-sil mark-sil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this flaky test that I added!

@thejambi thejambi left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thejambi reviewed 1 file and all commit messages.
Reviewable status: 0 of 1 files reviewed, all discussions resolved.

@thejambi thejambi closed this Nov 24, 2026
@thejambi

Copy link
Copy Markdown
Contributor Author

Already fixed in #1196

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.

3 participants