Skip to content

test(e2e): disable ETag conditional reads for Playwright runs - #30239

Merged
chirag-madlani merged 1 commit into
open-metadata:mainfrom
ShaileshParmar11:fix/disable-etag-conditional-reads-in-e2e
Jul 20, 2026
Merged

chirag-madlani merged 1 commit into
open-metadata:mainfrom
ShaileshParmar11:fix/disable-etag-conditional-reads-in-e2e

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A large share of AUT failures share one root cause: the ETag doesn't move when the response body does.

EntityETag.generateETag() is hash(version + "-" + updatedAt). Relationship-only and child mutations — addFollower, removeFollower, updateVote, customMetric, the executable testSuite — do not bump the parent's version/updatedAt. So after such a write the ETag is unchanged, the client's conditional refetch (If-None-Match, etagInterceptor.ts) is answered "not modified", and the UI renders a stale body.

Confirmed from a failing trace:

  • PUT /tables/{id}/customMetric returned the table with customMetrics: 1 at version 0.1 / updatedAt 1784239349138. The very next table GET carried If-None-Match, came back with no body, and the UI rendered the cached copy with customMetrics: 0 — same version/updatedAt, therefore identical ETag.
  • The ETag also ignores fields: a fields=testSuite request and a fields=customMetrics,columns request produce the same ETag, so one can be served the other's body.

ETagResponseFilter's own Javadoc names this hazard for addFollower/removeFollower/updateVote — matching the UpVote & DownVote (1→0) and Follow & Un-follow (Unfollow→Follow) failures seen in AUT.

It's load-dependent: the interceptor clears its cache on every mutation, so normally the refetch is unconditional. Under load a refetch dispatched around the mutation still carries a stale If-None-Match, so it fires often on slow AUT runs and almost never locally.

Change

Opt E2E sessions out of client-side conditional reads:

  • Export DISABLE_ETAG_CONDITIONAL_READS_KEY and skip attachEtagInterceptor when it is set (guarded with typeof localStorage === 'undefined' for non-browser contexts).
  • Set the flag in auth.setup.ts before each storageState() write, so it persists via storageState and is inherited by every spec — no per-test helper, and it covers both OpenMetadata and Collate (both run off the same setup project).
  • Drop the now-redundant forceFreshTableReads helper and its call sites.

Why storageState rather than a fixture or a shared helper: 99/341 OM specs (and 71/130 Collate specs) never call redirectToHomePage, and 69 specs import test straight from @playwright/test, so neither a helper nor a fixture reaches full coverage without touching dozens of files.

Validation

  • Flag is present in the regenerated playwright/.auth/admin.json, confirming it persists via storageState.
  • CustomMetric.spec.ts passes with the per-test helper removed — the global flag does the work.
  • TestSuiteMultiPipeline.spec.ts fails locally at an unrelated step (the test-case drawer's Enter a Count field). Verified against a clean baseline with these changes stashed — it fails identically, so it is pre-existing in this environment (@ingestion-tagged, needs Airflow) and not caused by this change.
  • Checkstyle clean: eslint exit 0, prettier clean, tsc --noEmit reports nothing on the touched files.

Follow-up

This is containment for the test suite. The ETag itself should still be fixed so it reflects the requested fields and child state — e.g. fold fields into the ETag, skip ETag/304 for GETs carrying child-resolved fields, or stamp child changes onto the parent. Happy to split that into a separate PR.

🤖 Generated with Claude Code

Greptile Summary

This PR disables conditional ETag reads for Playwright sessions. The main changes are:

  • Persists an ETag opt-out flag in every generated user storage state.
  • Skips ETag interceptor registration when the flag is present.
  • Removes the table-specific request workaround from two E2E specs.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/auth.setup.ts Stores the ETag opt-out flag in each role-specific Playwright storage state.
openmetadata-ui/src/main/resources/ui/src/rest/index.ts Skips ETag interceptor registration when the restored session contains the opt-out flag.
openmetadata-ui/src/main/resources/ui/src/rest/etagInterceptor.ts Exports the shared localStorage key used by the application and Playwright setup.
openmetadata-ui/src/main/resources/ui/playwright/utils/entity.ts Removes the superseded table-only request interception helper.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/CustomMetric.spec.ts Removes the per-test fresh-table-read setup.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TestSuiteMultiPipeline.spec.ts Removes the per-test fresh-table-read setup.

Reviews (1): Last reviewed commit: "test(e2e): disable ETag conditional read..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

The server ETag is hash(version + "-" + updatedAt), so it does not change for
relationship-only or child mutations (followers, votes, customMetrics,
testSuite). A refetch that races such a mutation is answered "not modified" and
the UI renders a stale body, which surfaces as flaky assertions across the AUT
suite (UpVote/DownVote, Follow/Un-follow, FollowingWidget, Tags, CustomMetric,
TestSuiteMultiPipeline, ...).

Opt E2E sessions out of client-side conditional reads:

- Export DISABLE_ETAG_CONDITIONAL_READS_KEY and skip attachEtagInterceptor when
  the flag is set, guarded for non-browser contexts.
- Set the flag in auth.setup.ts before each storageState write, so it persists
  via storageState and is inherited by every spec in both OpenMetadata and
  Collate without a per-test helper.
- Drop the now-redundant forceFreshTableReads helper and its call sites.

This is a containment for the test suite; the ETag itself should still be fixed
to reflect the requested fields and child state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 13:02
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner July 20, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jul 20, 2026
@gitar-bot

gitar-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Disables ETag conditional reads for E2E tests by persisting a global flag in storageState, effectively resolving intermittent stale UI state in Playwright runs. No issues found.

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 👍 / 👎 | Gitar

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 65%
65.17% (75802/116300) 48.95% (45162/92255) 49.78% (13673/27466)

@sonarqubecloud

Copy link
Copy Markdown

@ShaileshParmar11
ShaileshParmar11 enabled auto-merge (squash) July 20, 2026 14:30
@github-actions

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — 2 failure(s), 37 flaky

✅ 4528 passed · ❌ 2 failed · 🟡 37 flaky · ⏭️ 99 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 436 0 4 16
✅ Shard 2 11 0 0 0
🔴 Shard 3 820 1 11 8
🟡 Shard 4 821 0 2 18
🔴 Shard 5 828 1 8 9
🟡 Shard 6 786 0 2 46
🟡 Shard 7 826 0 10 2

Genuine Failures (failed on all attempts)

❌ Features/BulkEditEntity.spec.ts › Glossary Term (Nested) (shard 3)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator:  getByTestId('processed-row')
Expected: �[32m"1"�[39m
Received: �[31m"2"�[39m
Timeout:  90000ms

Call log:
�[2m  - Expect "toHaveText" with timeout 90000ms�[22m
�[2m  - waiting for getByTestId('processed-row')�[22m
�[2m    93 × locator resolved to <span class="font-semibold" data-testid="processed-row">2</span>�[22m
�[2m       - unexpected value "2"�[22m

❌ Pages/CustomProperties.spec.ts › Set & Update all CP types on chart (shard 5)
�[31mTest timeout of 60000ms exceeded while running "beforeEach" hook.�[39m
🟡 37 flaky test(s) (passed on retry)
  • Flow/Tour.spec.ts › Tour should work from help section (shard 1, 2 retries)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Pages/SearchSettings.spec.ts › Latest preview config wins when a superseded request resolves late (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › the browse tree only shows the asset-type categories a user can access (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Table (shard 3, 1 retry)
  • Features/ContextCenterArchive.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › description: switching articles does not bleed unsaved content into next article (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clearing search restores the unfiltered list (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › Shared memory shows the shared-with-specific-people description (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with deleteAll permission can see delete action but not restore action on an archived document, and can delete it (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › created-by-me filter on the archive page shows only the current user's archived documents (shard 3, 1 retry)
  • Features/DataQuality/BundleSuiteBulkOperations.spec.ts › Add test case to existing Bundle Suite (shard 3, 1 retry)
  • Features/DataQuality/DataQualityDashboard.spec.ts › Test Cases list filter — Data Product (shard 3, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should drag nested term to root level of same glossary (shard 3, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Features/Table.spec.ts › Tags term should be consistent for search (shard 4, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Hyperlink (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Entity Reference List (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Should display custom properties for metric in right panel (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Should display custom properties for apiCollection in right panel (shard 5, 1 retry)
  • Pages/DataContracts.spec.ts › Contract Status badge should be visible on condition if Contract Tab is present/hidden by Persona (shard 5, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Description Rule Is_Set (shard 5, 1 retry)
  • Pages/DataProductAndSubdomains.spec.ts › Add assets to data product and verify count (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to edit owners for databaseSchema (shard 7, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to view all tabs for searchIndex (shard 7, 1 retry)
  • Pages/Glossary.spec.ts › Verify Glossary Term Deny Permission (shard 7, 1 retry)
  • ... and 7 more

📦 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 disabled auto-merge July 20, 2026 16:27
@chirag-madlani
chirag-madlani merged commit d09ebec into open-metadata:main Jul 20, 2026
51 of 61 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the fix/disable-etag-conditional-reads-in-e2e branch July 20, 2026 16:28
timothybrush pushed a commit to timothybrush/OpenMetadata that referenced this pull request Jul 22, 2026
…key (open-metadata#30292)

open-metadata#30239 added a localStorage flag so E2E sessions skip client-side conditional
(If-None-Match) reads, but auth.setup.ts imported the key across the
playwright -> src boundary:

  import { DISABLE_ETAG_CONDITIONAL_READS_KEY } from '../../src/rest/etagInterceptor';

That import resolves to undefined at runtime, so setup executed
localStorage.setItem(undefined, 'true') and the flag was persisted under the
literal key "undefined". The app then read the real key, got null, attached the
interceptor anyway, and the opt-out was a silent no-op in every run — AUT still
showed the stale-read failures it was meant to fix.

Inline the key literal instead, with a comment tying it to the app-side
constant.

Verified locally against a build containing the guard: repeat table GETs now
return full bodies with zero If-None-Match headers (previously 2 of 7 GETs came
back with If-None-Match and bodySize 0). Flag confirmed readable at module-init
timing for all 8 roles, on both the OpenMetadata and Collate playwright setups.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
chirag-madlani pushed a commit that referenced this pull request Jul 23, 2026
* test(e2e): strip ETag If-None-Match at the network layer

The localStorage opt-out from #30239/#30292 only works when the running UI
bundle contains the interceptor guard. In the upgrade AUT (1.11.13 -> main) the
served bundle does not evaluate the guard, so the client still sends
If-None-Match, the server answers 304, and the UI renders a stale body — the
flaky-assertion source persists.

Strip the If-None-Match header on /api/v1/** at the Playwright network layer
instead. This sits below the app, so it works regardless of which bundle runs
or whether its guard fires: the server always receives an unconditional GET and
returns the current body. Installed once per page (WeakSet-guarded) from
redirectToHomePage, which every affected spec routes through (createNewPage
calls it too).

Kept alongside the existing localStorage opt-out as defense in depth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(e2e): also install the ETag strip in the page fixtures

redirectToHomePage covers specs that call it, but ~79 specs get their page from
the fixtures/pages and support/fixtures/userPages fixtures without going through
it. Install stripEtagConditionalReads on those role pages too, so fixture-based
specs get fresh entity reads regardless of the deployed bundle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(e2e): strip If-None-Match on specs using raw page fixtures

The network-layer ETag strip was reached via redirectToHomePage and the
role fixtures. These specs bypass both — the 3 Glossary status-filter specs
use the built-in `page` fixture (navigating in their own beforeEach) and
SearchRBAC creates raw `browser.newPage()` contexts. Install
stripEtagConditionalReads directly at those page-acquisition points so every
failing spec is reachable by the fix regardless of how it obtains its page.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

This branch had an error being deployed

1 failed deployment
test — 5b5437b8 Deployed Jul 20, 2026 by ShaileshParmar11 via playwright-ci-postgresql (5, 7) #57351
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.

3 participants