Skip to content

Fixes #34954: make the glossary hierarchy search IT independent of other tests - #35284

Merged
sonika-shah merged 2 commits into
mainfrom
fix/glossary-hierarchy-it-isolation
Oct 13, 2026
Merged

sonika-shah merged 2 commits into
mainfrom
fix/glossary-hierarchy-it-isolation

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #34954

Test-only fix for a flaky IT added in #35221. GlossaryTermResourceIT.test_hierarchySearchKeepsParentOfEveryMatchOnThePage fails in the merge queue's parallel lane:

Condition with alias 'all matching terms should be indexed' didn't complete within 1 minutes … expected: <30> but was: <33>

Why: it waited for search(word) to return exactly 30 hits across the whole shared index. Glossary search matches fuzzily and on name.ngram (3–20 grams), so other tests' terms counted too. Its page and child-count assertions had the same exposure, and it never cleaned up.

What changed (test only, no production code):

  • No wait, no global count. Entity create indexes synchronously with Refresh.True (SearchIndexHandler.isAsync() is false), so the terms are searchable when create returns.
  • Every search is scoped to the test's own glossary via post_filter on glossary.name.keyword.
  • The search word shares no letters with any generated name, so parents can never match it or take a page slot from a match.
  • Shared search settings: both tests hold @ResourceLock(SEARCH_SETTINGS, READ), so they never overlap a test that rewrites search settings under the READ_WRITE lock.
  • Cleanup: the glossary is hard-deleted recursively in finally, best-effort, so a cleanup hiccup cannot fail a passing test.
  • Adds the same check for matches nested 4 levels deep (test_hierarchySearchKeepsFullPathOfDeeplyNestedMatches).

Type of change:

  • Bug fix

Tests:

  • Both hierarchy tests pass, and the whole GlossaryTermResourceIT class run concurrently passes (308 run, 0 failures) on MySQL + Elasticsearch 9.3.
Why each assertion is now independent of other tests
Risk Handling
Other tests' terms in the shared index post_filter on the test's glossary; Elasticsearch applies it before the top-N cut
Search not caught up Create indexes inline post-commit with Refresh.True; nothing to wait for
Term not yet Approved initialEntityStatus is Approved when there are no reviewers; the test glossary has none
A parent taking a page slot The word's letters (jknoqstuvwxyz) never occur in the hex/hier_* names, so no n-gram can match, even fuzzily; parents score 0
Which 25 of the 30 matches return Irrelevant: all 30 sit under the same parent
Another test rewriting search settings mid-run @ResourceLock(SEARCH_SETTINGS, READ); writers hold READ_WRITE, and SystemResourceIT / @Isolated writers never run alongside
Leftover data / cleanup failure Recursive hard delete in finally, best-effort

…her tests

The hierarchy search IT waited for "search(word) total == 30" over the
whole shared index. Glossary search matches fuzzily and on name n-grams,
so other tests' terms counted too and it failed in the parallel lane with
33. Its page and child-count checks had the same exposure, and it never
cleaned up its terms.

- No wait or global count: entity create indexes synchronously with a
  refresh, so the terms are searchable when create returns.
- Every search is post-filtered to the test's own glossary.
- The search word uses letters absent from all generated names, so
  parents can never match it or take a page slot from a match.
- The glossary is hard-deleted recursively in finally.
- Adds the same check for matches nested four levels deep.
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 13, 2026
…erarchy ITs

The hierarchy search ITs depend on the shared glossary-term search
settings, so take SEARCH_SETTINGS in READ mode: they never overlap a test
that rewrites the settings under the READ_WRITE lock, and still run
alongside other readers. A failed cleanup delete no longer fails a test
whose assertions passed; the glossary is namespace-scoped.
@gitar-bot

gitar-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟢 Low risk · The changes are confined to integration tests, improving hierarchy-search isolation and cleanup without altering production behavior.

Test-only fix for the flaky GlossaryTermResourceIT hierarchy search tests, scoping every search to the test's own glossary, avoiding a global count wait, and hard-deleting the glossary in finally. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonika-shah
sonika-shah added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 2f36dfa Oct 13, 2026
86 checks passed
@sonika-shah
sonika-shah deleted the fix/glossary-hierarchy-it-isolation branch October 13, 2026 05:40
sonika-shah added a commit that referenced this pull request Oct 13, 2026
… the hierarchy (#35221, #35284) (#35287)

* Fixes #34954: keep the parent of every glossary search match in the hierarchy (#35221)

Hierarchy search (getHierarchy=true) ranks matches and their parent terms
in one page. With more matches than the page holds, the parents rank below
the cut and buildGlossaryTermSearchHierarchy drops every match whose parent
is missing, so the glossary comes back with no children.

- Fetch the missing parents of the page's matches in one exact-FQN lookup
  after the cut (Approved only, same as the search). On failure, log and
  fall back to the previous behaviour.
- Score the parent-term clauses 0 for glossary terms, so parents never take
  a page slot from a real match. Domain search is unchanged.

Same change in the Elasticsearch and OpenSearch managers, plus an IT that
fails without it.

(cherry picked from commit cda0297)

* Fixes #34954: make the glossary hierarchy search IT independent of other tests

The hierarchy search IT waited for "search(word) total == 30" over the
whole shared index. Glossary search matches fuzzily and on name n-grams,
so other tests' terms counted too and it failed in the parallel lane with
33. Its page and child-count checks had the same exposure, and it never
cleaned up its terms.

- No wait or global count: entity create indexes synchronously with a
  refresh, so the terms are searchable when create returns.
- Every search is post-filtered to the test's own glossary.
- The search word uses letters absent from all generated names, so
  parents can never match it or take a page slot from a match.
- The glossary is hard-deleted recursively in finally.
- Adds the same check for matches nested four levels deep.

(cherry picked from commit 72b7051)

* Hold the search-settings read lock and make cleanup best-effort in hierarchy ITs

The hierarchy search ITs depend on the shared glossary-term search
settings, so take SEARCH_SETTINGS in READ mode: they never overlap a test
that rewrites the settings under the READ_WRITE lock, and still run
alongside other readers. A failed cleanup delete no longer fails a test
whose assertions passed; the glossary is namespace-scoped.

(cherry picked from commit 9bcc2ce)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.0] Glossary term picker search hides nested matches and returns empty glossaries

2 participants