Skip to content

Fix flaky glossary hierarchy test and websocket cross-talk in ChangeParentHierarchy - #33440

Merged
anuj-kumary merged 7 commits into
mainfrom
fix-glossary-hierarchy-drag-drop
Sep 17, 2026
Merged

anuj-kumary merged 7 commits into
mainfrom
fix-glossary-hierarchy-drag-drop

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes the quarantined should move term to root of different glossary E2E test (2/11 pass rate in merge queue) by addressing three root causes:

1. Missing async move poll (test-side)
changeTermHierarchyFromModal calls the moveAsync API which returns 200 immediately — the actual glossary-term move is processed asynchronously on the backend. The test navigated to glossary2 and asserted the moved term without waiting for the backend to complete the move. Added an expect.poll that waits up to 60s for the term's glossary.fullyQualifiedName to reflect the target glossary (same pattern already used by the passing H-M05 test).

2. Unfiltered websocket events (component-side bug)
ChangeParentHierarchy's websocket handler listened to all events on MOVE_GLOSSARY_TERM_CHANNEL without filtering by job ID. When multiple glossary moves happen concurrently (parallel tests, or multiple users), a COMPLETED event from a different operation would trigger handleMoveSuccess, which calls navigate() — closing the modal prematurely. Fixed by tracking the submitted job ID in a ref and only processing matching events.

3. Early terminal websocket event race (component-side bug)
If the backend processes the move and broadcasts the COMPLETED websocket event before the HTTP response assigns submittedJobId, the job-ID guard would discard the only terminal notification — leaving the modal stuck in the saving state indefinitely. Fixed by buffering websocket events that arrive while the HTTP response is in flight (awaitingResponse ref), keyed by jobId in a bounded Map (capped at 100 entries). When the HTTP response resolves, any buffered event matching the job ID is replayed.

Also added test.slow() since the cross-glossary move with async polling needs more than the 60s default timeout under load.

Verification:

  • Before fix: 2/11 pass rate (quarantined)
  • After fix: 20/20 at --repeat-each=20 --workers=1
  • All 7 tests in GlossaryHierarchy.spec.ts pass with no regressions

Test run evidence (10 reps, 6 workers):

Running 13 tests using 6 workers

  ✓  [chromium] should move term to root of different glossary (18.7s)
  ✓  [chromium] should move term to root of different glossary (18.8s)
  ✓  [chromium] should move term to root of different glossary (18.8s)
  ✓  [chromium] should move term to root of different glossary (19.0s)
  ✓  [chromium] should move term to root of different glossary (19.1s)
  ✓  [chromium] should move term to root of different glossary (21.7s)
  ✓  [chromium] should move term to root of different glossary (11.9s)
  ✓  [chromium] should move term to root of different glossary (12.1s)
  ✓  [chromium] should move term to root of different glossary (12.2s)
  ✓  [chromium] should move term to root of different glossary (12.2s)

  13 passed (2.0m)

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

…s-talk

Two root causes behind the 2/11 failure rate:

1. The test navigated to verify the moved term without waiting for the async
   move to complete — moveAsync returns 200 immediately while the backend
   processes the hierarchy change asynchronously. Added expect.poll (matching
   the pattern from the passing H-M05 test) to wait for the term's glossary
   FQN to update before asserting the UI.

2. ChangeParentHierarchy's websocket handler processed ALL move events on the
   MOVE_GLOSSARY_TERM_CHANNEL regardless of job ID. Under parallel execution,
   a COMPLETED event from another move operation caused the modal to navigate
   away prematurely. Added job ID filtering via a ref so only the submitted
   job's events are processed.

Also added test.slow() since the cross-glossary move with async poll needs
more than the default 60s budget under load.

Verified: 40/40 green at --repeat-each=20 --workers=6 (previously 2/11).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@anuj-kumary anuj-kumary self-assigned this Sep 16, 2026
@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Sep 16, 2026
@github-actions github-actions Bot added the UI UI specific issues label Sep 16, 2026
@anuj-kumary anuj-kumary added the skip-pr-checks Bypass PR metadata validation check label Sep 16, 2026
anuj-kumary and others added 2 commits September 17, 2026 08:10
…oves

Use a Map<jobId, event> instead of a single ref so concurrent move events
from different operations cannot overwrite each other during the brief
HTTP-response window. The map is cleared after replay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 react-hooks/exhaustive-deps
All findings
Location Rule Message
🟡 src/components/Modals/ChangeParentHierarchy/ChangeParentHierarchy.component.tsx:118:5 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

Fixes the flaky glossary hierarchy test by addressing two root causes: adding async move polling in the test to wait for backend completion, and filtering websocket events by job ID in ChangeParentHierarchy to prevent cross-talk from concurrent moves triggering premature modal closure. Test now passes reliably (40/40 at 20 repetitions, 6 workers) with no regressions.

✅ 1 closed
✅ Bug: Single-slot event buffer drops early terminal event under cross-talk

📄 openmetadata-ui/src/main/resources/ui/src/components/Modals/ChangeParentHierarchy/ChangeParentHierarchy.component.tsx:137-143 📄 openmetadata-ui/src/main/resources/ui/src/components/Modals/ChangeParentHierarchy/ChangeParentHierarchy.component.tsx:171-173
bufferedEvent is a single ref that holds only the last event received while awaitingResponse.current is true. During the await window the handler buffers every event on MOVE_GLOSSARY_TERM_CHANNEL, including cross-talk from other concurrent glossary moves (the exact scenario this PR targets: parallel tests / multiple users). If our job's terminal event arrives early and is then overwritten by a cross-talk event before the HTTP response resolves, the early?.jobId === response.jobId check fails, the legitimate event is discarded, and no further event arrives for our one-shot job — leaving the modal stuck in the saving state. Buffer events keyed by jobId (e.g. a Map/array) and, after the response, look up the entry matching response.jobId so a concurrent event cannot evict ours.

Review coverage

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

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants