Skip to content

test(playwright): stabilise the top-5 merge-group flakes at their cause - #32576

Merged
chirag-madlani merged 3 commits into
mainfrom
analyze-merge-group-playwright-failure
Sep 3, 2026
Merged

chirag-madlani merged 3 commits into
mainfrom
analyze-merge-group-playwright-failure

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Describe your changes

Fixes five Playwright specs that accounted for every hard failure across the last 20 merge-queue runs — the same failures kept ejecting green PRs and blocking the queue. Each fix removes the specific race at its cause; no test.slow, no waitForTimeout, no papering over with an inflated retry.

Failure counts across a 20-run sample of merge_group Playwright runs:

Spec Hard-failure hits Root cause
Pages/UserDetails.spec.ts:126 inherited-domain after team removal 9 positional .nth(1) on [title=…] — the team title exists twice (chip + tree option); the second match races with the tree-select re-render
Features/MetricBulkImportExportEdit.spec.ts:1285 bulk-edit renders complex fields 9 hard-coded scroll positions [0, 400, …, 2400] skip past the nested-glossary column between samples — RDG virtualises columns so it's never in the DOM at any checkpoint
Features/Table.spec.ts:252 should persist page size 3 NextPrevious wraps its button in an Ant Dropdown with the default hover trigger, so a bare .click() only fires preventDefault — the menu never opens
Features/AdvancedSearchSuggestions.spec.ts:51 Database field recurring ComboBox popover re-mounts under load and the isMounting gate drops the aggregate; the listbox opens empty. [role="listbox"]:visible [role="option"] polls 18× against 0 elements
Pages/DataContractInheritance.spec.ts "Remove Asset" test 8 in one shard contract inheritance propagates async after /assets/add; first assertion times out at 300 s, cascading the other 7 tests in the file with "Target page/context/browser has been closed"

1. Features/Table.spec.ts:252 — Ant Dropdown hover-open

Same pattern as the second half of #32506. Hover-first, click-fallback wrapped in toPass, and locate the menu by role="menu" instead of .ant-dropdown (better through the antd → core-components migration).

2. Pages/UserDetails.spec.ts:238

Scoped the title lookup to .ant-tree-select-dropdown so the dropdown option is unambiguous — Playwright's auto-retry handles the tree re-render once the locator matches exactly one element. Pruned one now-stale om-playwright/no-positional-locator suppression (6 → 5) via yarn lint:playwright:suppressions.

3. Features/AdvancedSearchSuggestions.spec.ts:92

Switched from an endpoint-URL waitForResponse to waitForAggregation({ field, value }) — the helper matches the typed-value aggregate specifically, so it can't resolve early on the dropdown-open request. Wrapped the fill + assert in toPass: each attempt re-arms the wait, so a dropped aggregate no longer wastes 15 s on an empty listbox.

4. Features/MetricBulkImportExportEdit.spec.ts — expectVisibleAfterHorizontalScroll

Replaced the hard-coded step list with scrollWidth - clientWidth computed from the grid and iterate in 250 px steps. No column can be skipped between samples.

5. Pages/DataContractInheritance.spec.ts:1153 — "Verify asset shows inherited contract"

Wrapped the first assertion in toPass with a full revisit + reopen. Contract inheritance flows through separate event-bus consumers (search index + entity dataProducts), so the first paint sometimes lands before propagation. Fixing the first failure drains the whole cascade — the other seven tests in the file were dying with "context closed" because the 300 s hang exhausted the shard budget, not because of their own bugs.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Tests

Test-only change; no product code touched.

  • yarn lint:playwright — 0 errors on touched files (7 pre-existing warnings on untouched lines).
  • yarn tsc:playwright — 0 errors on touched files.
  • yarn lint:playwright:suppressions — re-baselined; one stale entry pruned.
  • select_playwright_tests.py --event-name pull_request picks up all 5 specs as directChangedSpecs — PR CI runs them under targeted mode alongside the smoke suite; merge_group re-runs them in the full plan.

Stress-testing note: retries: 1 catches transient failures as flaky rather than failed, so a green PR run + green merge-queue run is the natural non-flakiness signal. If any of the five fixed tests reappears in the failed/flaky lists after this lands, the fix isn't sufficient and needs a follow-up.

Not addressed in this PR

  • MetricBulkImportExportEdit may still have a product-side hydration bug — the finer-grained scroll should surface the cell if it's rendered at all. If a green scroll sweep still hits element(s) not found, that points at the bulk-edit grid, not the test.
  • DataContractInheritance propagation latency is masked, not fixed. Worth a follow-up look at the event-bus consumer that updates the asset's dataProducts field.

🤖 Generated with Claude Code

Across the last 20 merge-queue Playwright runs the same five specs
accounted for every hard failure. Each fix removes the specific race —
no test.slow, no waitForTimeout — so the offending signature does not
reappear on subsequent shard re-orderings.

- Features/Table.spec.ts:252 "should persist page size" — NextPrevious
  wraps the button in an Ant Dropdown with the default hover trigger,
  so a bare `.click()` only fires preventDefault. Hover-first with a
  click fallback, wrapped in `toPass`, and locate the menu by role
  instead of the `.ant-dropdown` class chain that PR #32506 already
  moved off of for the DataQuality pagination.

- Pages/UserDetails.spec.ts:126 "inherited domain after team removal" —
  the team title existed twice on the page (chip + tree option) and
  `.locator('[title=…]').nth(1)` raced with the tree-select rebuilding
  after the hierarchy fetch. Scope the lookup to `.ant-tree-select-dropdown`
  so the option is unambiguous and Playwright's auto-retry takes over.
  Also prunes one now-stale `om-playwright/no-positional-locator`
  suppression (UserDetails: 6 → 5).

- Features/AdvancedSearchSuggestions.spec.ts:51 "Verify suggestions for
  Database field" — the ComboBox popover re-mounts under load and the
  isMounting gate can drop the aggregate request, so the listbox opens
  empty. Switch to `waitForAggregation({ field, value })` (matches the
  typed-value request specifically — an endpoint-only wait resolves
  early on the dropdown-open request) and wrap the fill + assertion in
  `toPass` so a dropped request is retried instead of burning 15 s on
  an empty listbox.

- Features/MetricBulkImportExportEdit.spec.ts:1285 "Admin bulk edit
  renders complex fields from listing hydration" — React Data Grid
  virtualises columns, and the hard-coded scroll positions
  `[0, 400, 800, …, 2400]` could skip past the nested-glossary column
  between samples so it was never in the DOM at any checkpoint.
  Compute `scrollWidth - clientWidth` and step across in 250 px
  increments so no column can be missed.

- Pages/DataContractInheritance.spec.ts "Remove Asset — Inherited
  contract no longer shown when asset is removed from Data Product" —
  contract inheritance propagates asynchronously after /assets/add
  returns (search index + entity dataProducts update on separate
  consumers), and the first paint of the asset's Contract tab could
  land before propagation. That first assertion was timing out at
  300 s, exhausting the shard budget and cascading the other seven
  tests in the same file with "Target page/context/browser has been
  closed". Wrap the assertion in `toPass` with a full revisit +
  reopen — fixing the first failure drains the whole cascade.

Verification: yarn lint:playwright and yarn tsc:playwright report zero
new errors on the touched files. `select_playwright_tests.py
--event-name pull_request` picks up all five specs as
directChangedSpecs so PR CI runs them under targeted mode; merge_group
runs them again in the full plan.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Sep 3, 2026

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.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Sep 3, 2026
Auto-revert Test and others added 2 commits September 3, 2026 22:49
`yarn lint:playwright:suppressions` dropped one entry from UserDetails.spec.ts
in the previous commit (positional-locator: 6 → 5) but the hard-coded expected
count in the corpus test was not lowered along with it. CI's `corpus.test.mjs`
does exact equality, not a ceiling, so the change tripped:

    om-playwright/no-positional-locator: 1324 → 1323

Lower it. This is the mechanical follow-up the rule's own message asks for
("If you fixed violations, run yarn lint:playwright:suppressions and lower
the matching numbers here").

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Review catch on the Advanced Search fix: `waitForAggregation` returns a
`page.waitForResponse` promise armed inside `toPass`. When the 5 s
fallback timer wins the race — exactly the dropped-aggregate case this
fix targets — the underlying wait keeps running and rejects with a
Playwright timeout ~30 s later. Every `toPass` iteration would orphan a
fresh promise; Playwright surfaces those as unhandled rejections and
can fail the very test the retry loop is meant to stabilise.

Attach a no-op `.catch(() => undefined)` at construction so the fallback
branch cannot leave a dangling rejection on the microtask queue.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@gitar-bot

gitar-bot Bot commented Sep 3, 2026

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

Fixes five Playwright specs responsible for every hard failure across the last 20 merge-queue runs by addressing the specific race condition at each cause: positional locator collision in UserDetails, virtualised column skip in MetricBulkImportExportEdit, Ant Dropdown hover trigger in Table, ComboBox re-mount gate in AdvancedSearchSuggestions, and async contract inheritance propagation in DataContractInheritance. Orphaned waitForAggregation promise rejection swallowed. No issues found.

✅ 1 resolved
✅ Bug: Orphaned waitForAggregation promise can reject unhandled

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/AdvancedSearchSuggestions.spec.ts:84-96
In the retried block, waitForAggregation(page, …) (a page.waitForResponse) is armed but only raced against a 5s timeout, never awaited to completion or cancelled. On the exact dropped-aggregate scenario this fix targets, the request never arrives, so the promise stays pending and eventually rejects with a waitForResponse: Timeout (default 30s) after the setTimeout branch wins the race — and a fresh one is orphaned on every toPass iteration. Playwright's runner surfaces unhandled rejections and can fail/flake the test, undermining the stabilisation goal. Attach a no-op catch so the orphaned wait can't reject unhandled, e.g. const aggregateResponse = waitForAggregation(...).catch(() => undefined);.

Options

Display: compact → Showing less information.

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

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 2596a70edab053811a486eaa976a859e55a4f8df in Playwright run 33784281945, attempt 1.

✅ 622 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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) 52m 57s

⏱️ Max setup 4m 22s · max shard execution 18m 14s · max shard-job elapsed before upload 21m 42s · reporting 4s

🌐 243.42 requests/attempt · 2.74 app boots/UI scenario · 20.75% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 20.75% (convergence target: at most 15%).
  • Browser traffic was 243.42 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.74 per UI scenario (1768 boots / 646 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 150 0 0 0 0 0
✅ Shard chromium-02 157 0 0 0 0 0
✅ Shard chromium-03 133 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 24 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@chirag-madlani
chirag-madlani merged commit 4db5ca0 into main Sep 3, 2026
93 of 94 checks passed
@chirag-madlani
chirag-madlani deleted the analyze-merge-group-playwright-failure branch September 3, 2026 18:23
pmbrull pushed a commit that referenced this pull request Sep 4, 2026
…32585)

#32078 and #32576 each pruned one no-positional-locator suppression, in
different entries of eslint-suppressions.json. Git applied both reductions
to that file (1324 - 1 - 1 = 1322) but the identical 1324 -> 1323 edit both
made to this test merged to a single 1323, so the recorded baseline counted
one burn-down and the data file counted two.

Records the burn-down that already landed; the ratchet still only moves down.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
mohityadav766 added a commit that referenced this pull request Sep 4, 2026
#32576 pruned one om-playwright/no-positional-locator entry out of
eslint-suppressions.json (1323 -> 1322) without lowering the number recorded in
corpus.test.mjs, so `the suppressions baseline matches its recorded state
exactly` fails on main and therefore on every branch merged with it:

  + actual   'om-playwright/no-positional-locator': 1322
  - expected 'om-playwright/no-positional-locator': 1323

Both files here are byte-identical to main, so this is not a violation this
branch introduced or fixed — only the bookkeeping the pruning PR left behind.
Lowering it is what the assertion message asks for; `yarn lint:playwright` is
already clean at 0 errors, so there is nothing to prune.
ConnorHruby-TEAM pushed a commit to ConnorHruby-TEAM/OpenMetadata that referenced this pull request Sep 9, 2026
…ex registry (open-metadata#32375)

* Fixes open-metadata#32374: serve the reindex entity list from the index registry

The Search Indexing app's entity picker read a hardcoded `items.enum` in the
UI-local schema JSON, so it was a per-build snapshot of a runtime fact and had
drifted 15 entity types behind the index mapping registry. Selecting everything
in the dropdown was therefore not the same as selecting `all`, which the app
already expands from the registry.

It also could never be right for a distribution that registers extra indexes:
IndexMappingLoader merges elasticsearch/indexMapping.json plus
elasticsearch/collate/indexMapping.json from the classpath at startup, so no
enum baked into the UI bundle can express the reindexable set.

Add SearchRepository.getIndexedEntityTypes() as the one definition and have both
ReindexingOrchestrator.getAll() and a new GET /v1/search/entityTypes read it, so
the picker and `all` cannot drift. The UI drops the enum and fills it in
ApplicationsClassBase.importSchema, the single funnel AppDetails and AppInstall
share; a failed fetch leaves only "All" selectable plus an error toast rather
than breaking the whole form.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Address review: align authz with the page, fix the IT and the picker spec

manerow, on open-metadata#32375:

- The endpoint was admin-or-bot while the page that calls it is not. SettingsRouter
  renders AppDetails for `isAdminUser || hasViewPermissions(APPLICATION)` and
  AppDetails fetches the schema on every mount, so a viewer holding ViewBasic or
  ViewAll got a red 403 toast for a request they never triggered. Authorize on
  APPLICATION/VIEW_BASIC instead, which is exactly the page's gate.

- The 403 assertion in SearchResourceIT would have been a 404: authorizeAdminOrBot
  resolves the subject first, and SubjectCache.getUserContext falls back to
  Entity.getEntityByName, which throws EntityNotFoundException for a user this
  suite never creates. It could only pass on suite ordering. Pin the user in
  @BeforeAll, as AppOperationPermissionsIT already does, and flip the assertion to
  the case that now matters: an Application viewer gets 200.

- SearchIndexApplication.spec.ts would have broken. rc-tree-select filters on the
  node value (treeNodeFilterProp defaults to 'value'), so typing "Table" leaves
  `tableColumn` visible too, and rc-tree sets title="Table Column" on it;
  getByTitle is substring by default, so the locator resolved to 2 nodes and
  waitFor threw in strict mode. Made it exact.

  The Playwright run on the first commit was green because the impact map never
  selected this spec — the Settings/** entry picks no spec that opens an app config
  form. Added a mapping for the application config forms so a change to the
  schemas, the loader, or the endpoint that fills them selects it. That also puts
  this PR in a full run, so the locator fix gets exercised.

Copilot:

- 'all' is now in the injected enum. The backend sentinel is not an index, so the
  endpoint does not return it, but `default: ["all"]` has to validate against the
  enum; TreeSelectWidget already filters it out of the child nodes. Pre-existing
  inconsistency — the old hardcoded enum omitted it too — fixed while here. It
  also makes the fetch-failure fallback `['all']` rather than empty.

- Reused SEARCH_INDEXING_APPLICATION from constants/explore.constants.ts instead of
  a second copy. Its own `SortingField` import is type-only, so this pulls nothing
  new into the bundle graph.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Fix the payLoadSize description, which was a copy of batchSize's

payLoadSize is a byte size — ReindexingConfiguration.DEFAULT_PAYLOAD_SIZE is
SearchClusterMetrics.DEFAULT_BULK_PAYLOAD_SIZE_BYTES — but its description was a
verbatim copy of batchSize's "Maximum number of events entities in a batch
(Default 100)", so the rendered app docs showed the wrong units and the wrong
default for it.

Collate's forked schema happened to carry the correct string; resyncing that doc
against this one in openmetadata-collate#6326 would have propagated the error
downstream instead. Fixing it here keeps both sides on one description.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Stub getIndexedEntityTypes in ReindexingOrchestratorTest

setupEntitiesExpandsAllAndCountTotalEntitiesSkipsUnsupportedTypes stubbed
searchRepository.getEntityIndexMap(), which setupEntities() no longer calls after
getAll() moved to getIndexedEntityTypes(). searchRepository is a Mockito mock, so
the new call returned Mockito's default empty Set, setupEntities() expanded "all"
to nothing, and the entities assertion failed.

Stub the method the code now calls. The IndexMapping mocks the old stub built were
only there to shape the map, so the import goes with them.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Lower the recorded no-positional-locator count to match the baseline

open-metadata#32576 pruned one om-playwright/no-positional-locator entry out of
eslint-suppressions.json (1323 -> 1322) without lowering the number recorded in
corpus.test.mjs, so `the suppressions baseline matches its recorded state
exactly` fails on main and therefore on every branch merged with it:

  + actual   'om-playwright/no-positional-locator': 1322
  - expected 'om-playwright/no-positional-locator': 1323

Both files here are byte-identical to main, so this is not a violation this
branch introduced or fixed — only the bookkeeping the pruning PR left behind.
Lowering it is what the assertion message asks for; `yarn lint:playwright` is
already clean at 0 errors, so there is nothing to prune.

* Do not constrain the entity enum when the list cannot be fetched

ApplicationConfiguration validates with @rjsf/validator-ajv8 against the stored
appConfiguration, so injecting `enum: ["all"]` on a failed fetch made a saved
`entities: ["table", ...]` fail validation — during a transient outage an admin
could not save the form at all, including edits to unrelated fields. Return the
schema untouched instead: the picker degrades to a plain list, but the stored
selection stays visible and editable. The toast still fires.

Also add the endpoint's own files to the impact-map entry. It listed
resources/apps/** and the searchIndex bundle but not the two files that actually
produce the list, so editing /v1/search/entityTypes or getIndexedEntityTypes()
would not have selected the picker spec — the exact gap the entry exists to close.

Both found by Copilot on a111a47.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

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 UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants