Repository navigation
Fix flaky glossary hierarchy test and websocket cross-talk in ChangeParentHierarchy (#33440) (2.0 backport) - #33472
Conversation
…arentHierarchy (#33440) * Fix flaky glossary hierarchy test: async move race and websocket cross-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> * Buffer early websocket events to prevent dropped terminal notifications 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. Track an awaitingResponse flag around the moveGlossaryTerm call and buffer any websocket events that arrive during that window. When the HTTP response resolves and provides the job ID, replay the buffered event if it matches. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Buffer websocket events by jobId to prevent overwrite by concurrent moves 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> * Fix formatting from ui-checkstyle Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Cap websocket event buffer at 100 entries Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 1bf046f)
Code Review ✅ ApprovedBackport of flaky glossary hierarchy test fix addressing three root causes: missing async move poll in the test, unfiltered websocket events in OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
✅ Playwright Results — workflow succeededValidated commit ✅ 53 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 38m 55s ⏱️ Max setup 1m 41s · max shard execution 5m 54s · max shard-job elapsed before upload 9m 29s · reporting 3s 🌐 142.89 requests/attempt · 1.35 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |



Backport of #33440 to
2.0.Fixes the flaky
should move term to root of different glossaryE2E test (2/11 pass rate in main's merge queue) by addressing three root causes:1. Missing async move poll (test-side)
changeTermHierarchyFromModalcalls themoveAsyncAPI 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 finish. Added anexpect.pollthat waits up to 60s for the term'sglossary.fullyQualifiedNameto 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 onMOVE_GLOSSARY_TERM_CHANNELwithout filtering by job ID. When multiple glossary moves happen concurrently (parallel tests, or multiple users), aCOMPLETEDevent from a different operation would triggerhandleMoveSuccess, which callsnavigate()— 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
COMPLETEDevent before the HTTP response assignssubmittedJobId, 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 (awaitingResponseref), keyed byjobIdin a boundedMap(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.Backport notes
playwright/QUARANTINE.mdchange from the original PR is not included —2.0has no quarantine file or@quarantinetag mechanism, so there is nothing to un-quarantine here.{ tag: '@quarantine' }wrapper. On2.0the change is justtest.slow(true)+ theexpect.poll, plus removal of two stale// Skipped due to known issue: #24794comments that sat above tests which were not actually skipped on this branch.ChangeParentHierarchy.component.tsxapplies byte-identically to main's diff (verified by diff-of-diffs); only hunk line offsets differ.prettier --checkpasses on both changed files.Test plan
GlossaryHierarchy.spec.tspasses in CI (all 7 tests, especially H-M04)🤖 Generated with Claude Code
The PR appears safe to merge, with no outstanding findings after the manually resolved review threads.
Summary
This backport stabilizes glossary hierarchy moves by waiting for asynchronous backend completion and isolating websocket updates by job ID.
Diagram
sequenceDiagram participant U as User participant C as ChangeParentHierarchy participant API as Move API participant WS as WebSocket U->>C: Submit hierarchy move C->>C: Mark response pending C->>API: moveGlossaryTerm(...) API-->>WS: Early job event WS-->>C: Event with job ID C->>C: Buffer event while response is pending API-->>C: Return submitted job ID C->>C: Replay matching buffered event C->>U: Show completion and navigateReviews (2) · Last reviewed commit: "Merge branch '2.0' into claude/backport-..."