fix(tests): eliminate flacky race in OntologyExplorerCardinality setup - #31247
Conversation
The glossaryTermRelationSettings endpoint only supports a full-document PUT. Parallel Playwright workers each called addRelationTypeWithCardinality five times sequentially, producing five read-modify-write windows where a concurrent worker with a stale snapshot could silently erase freshly written types. addTermRelation then failed with HTTP 400 "Invalid relation type". Fix: - Add addRelationTypesWithCardinality (batch) to ontologyExplorer.ts: reads once, appends all missing types in one PUT, verifies all are present, retries on conflict. Reduces five concurrent-write windows to one. - OntologyExplorerCardinality.spec.ts: replace five sequential addRelationTypeWithCardinality calls with a single batch call, then call it again immediately before addTermRelation as an idempotent TOCTOU guard (no-op when all types are present, repairs if a concurrent write erased any). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ ApprovedEliminates TOCTOU race conditions in the OntologyExplorerCardinality test setup by introducing a batch-write method and idempotent guard. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
25106b2
|
Changes have been cherry-picked to the 1.13 branch. |
#31247) The glossaryTermRelationSettings endpoint only supports a full-document PUT. Parallel Playwright workers each called addRelationTypeWithCardinality five times sequentially, producing five read-modify-write windows where a concurrent worker with a stale snapshot could silently erase freshly written types. addTermRelation then failed with HTTP 400 "Invalid relation type". Fix: - Add addRelationTypesWithCardinality (batch) to ontologyExplorer.ts: reads once, appends all missing types in one PUT, verifies all are present, retries on conflict. Reduces five concurrent-write windows to one. - OntologyExplorerCardinality.spec.ts: replace five sequential addRelationTypeWithCardinality calls with a single batch call, then call it again immediately before addTermRelation as an idempotent TOCTOU guard (no-op when all types are present, repairs if a concurrent write erased any). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 25106b2)
|
Changes have been cherry-picked to the 2.0 branch. |
#31247) The glossaryTermRelationSettings endpoint only supports a full-document PUT. Parallel Playwright workers each called addRelationTypeWithCardinality five times sequentially, producing five read-modify-write windows where a concurrent worker with a stale snapshot could silently erase freshly written types. addTermRelation then failed with HTTP 400 "Invalid relation type". Fix: - Add addRelationTypesWithCardinality (batch) to ontologyExplorer.ts: reads once, appends all missing types in one PUT, verifies all are present, retries on conflict. Reduces five concurrent-write windows to one. - OntologyExplorerCardinality.spec.ts: replace five sequential addRelationTypeWithCardinality calls with a single batch call, then call it again immediately before addTermRelation as an idempotent TOCTOU guard (no-op when all types are present, repairs if a concurrent write erased any). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 25106b2)
Summary
glossaryTermRelationSettingsonly supports a full-document PUT. Parallel Playwright workers calledaddRelationTypeWithCardinality5 times sequentially, creating 5 read-modify-write windows where a concurrent worker with a stale snapshot could silently erase freshly written types, causingaddTermRelationto fail with HTTP 400Invalid relation type.addRelationTypesWithCardinality(batch) toontologyExplorer.ts: reads once, appends all missing types in a single PUT, verifies all N are present, retries on conflict. Reduces 5 concurrent-write windows to 1.OntologyExplorerCardinality.spec.ts: replace 5 sequential calls with one batch call, then call it again immediately beforeaddTermRelationas an idempotent TOCTOU guard — no-op if all types are still present, repairs if a concurrent worker's stale PUT erased any.Test plan
OntologyExplorerCardinality.spec.tswith multiple parallel workers to confirm no more 400 "Invalid relation type" failuresaddRelationTypesWithCardinalityearly-returns (one GET) when all types are already present🤖 Generated with Claude Code