Skip to content

fix(e2e): write the ETag opt-out flag under the correct localStorage key - #30292

Merged
chirag-madlani merged 4 commits into
mainfrom
fix/etag-flag-undefined-key-in-auth-setup
Jul 22, 2026
Merged

chirag-madlani merged 4 commits into
mainfrom
fix/etag-flag-undefined-key-in-auth-setup

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#30239 added a localStorage flag so E2E sessions skip client-side conditional (If-None-Match) reads. It never worked — it was a silent no-op in every run, which is why AUT still shows the stale-read failures it was meant to fix.

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, and attached the interceptor anyway.

Change

Inline the key literal in auth.setup.ts, with a comment tying it to the app-side constant. One file, test-only, no product change.


How this was verified

1. Reproduced the failure from the AUT trace

Parsed the trace of a failing TestSuiteMultiPipeline run (/tables/name/… GETs):

09:55:27–31  (5 GETs)  If-None-Match: no    real bodies
09:55:38.031           If-None-Match: YES   bodySize 0, transfer 240
09:55:38.766           If-None-Match: YES   bodySize 0, transfer 240

Conditional requests returning empty bodies — the stale-read path, still active despite #30239 being in the build (verified by content at the built OSS commit).

2. Root-caused it in the artifact

Parsed playwright/.auth/admin.json as JSON (not grep) and dumped key/value pairs:

key='undefined'  value='true'

Note: a substring grep for the constant name passes on this file, which is how the original PR appeared verified. Parsing the JSON is what caught it.

3. Confirmed the fix at the artifact level

Deleted .auth/*.json, re-ran setup, re-parsed:

admin.json … owner.json →  flag=['true']   undefKey=False   (all 8 roles)

4. Tested the timing that actually failed

The guard reads localStorage at module init. Used context.addInitScript() to read it before any page script runs — same timing class:

ROLE=admin/dataConsumer/dataSteward/editDescription/
     editTags/editGlossaryTerm/viewOnly/owner   → atInit="true"  (8/8)

5. Coverage / edge cases

  • browser.newPage() / createNewPage — 91 + 76 + 13 specs use these; verified they inherit storageState (MANUAL_newPage="true"), so they are covered.
  • Every storageState: path referenced across OM and Collate specs maps to the 8 covered role files.
  • Collate side — deleted Collate's .auth, ran Collate's own config (testDir: './', its 130 specs + the generated OM specs). All 8 files regenerated with the correct key; roles report atInit="true".
  • Known edge: SSOConfigurationForm.tsx calls localStorage.clear(), which would wipe the flag — confined to the SSO-config flow, and those specs are testIgnored from the chromium project.

6. End-to-end on the wire (the decisive check)

Rebuilt the UI so the served bundle actually contains the guard, and confirmed it first:

/assets/index-BB3jdJzH.js   guard=1   ifNoneMatch=1

Then ran CustomMetric.spec.ts with --trace=on and parsed the trace:

before after
table GETs with If-None-Match 2 of 7 0 of 10
empty-body (304-style) responses 2 0
repeat GET body size 0 (transfer 240) 1100–1245 (real bodies)

CustomMetric.spec.ts passes relying solely on the global flag — its per-test helper was removed in #30239.


Scope note

This restores the intended ETag opt-out and should clear the stale-read class of AUT failures (UpVote/DownVote, Follow/Un-follow, FollowingWidget, Tags, CustomMetric, TestSuiteMultiPipeline, …).

It will not fix the unrelated failures in the same list — HybridRunner*, QueryRunner, DataContracts* (#30179), SearchRBAC, PersonaFlow. Expect a partial reduction, not zero.

The underlying product defect — the ETag being derived from version/updatedAt only, so it does not reflect the requested fields or child state (customMetrics, testSuite, followers, votes) — is still open and tracked separately.

🤖 Generated with Claude Code

Greptile Summary

This PR restores the ETag opt-out used by end-to-end sessions. The main changes are:

  • Removes the cross-boundary import that produced an undefined storage key.
  • Writes the flag under OM_DISABLE_ETAG_CONDITIONAL_READS before saving each role's storage state.

Confidence Score: 5/5

This looks safe to merge.

  • The producer and consumer now use the same localStorage key.
  • The flag is written before each role's storage state is saved.
  • No blocking issue was found in the updated code.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/auth.setup.ts Replaces the broken imported key with the matching app-side literal while preserving storage-state setup for all configured roles.

Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/etag-flag-u..." | Re-trigger Greptile

Context used (3)

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

#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>
Copilot AI review requested due to automatic review settings July 21, 2026 14:39
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner July 21, 2026 14:39

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 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — 1 test failure(s)

✅ 4546 passed · ❌ 1 failed · 🟡 22 flaky · ⏭️ 100 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 435 0 5 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 825 0 7 9
✅ Shard 4 823 0 0 18
🔴 Shard 5 836 1 2 9
🟡 Shard 6 786 0 2 46
🟡 Shard 7 830 0 6 2

Genuine Failures (failed on all attempts)

❌ Pages/CustomProperties.spec.ts › Set & Update all CP types on chart (shard 5)
Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoBe�[2m(�[22m�[32mexpected�[39m�[2m) // Object.is equality�[22m

Expected: �[32mtrue�[39m
Received: �[31mfalse�[39m

Call Log:
- Timeout 90000ms exceeded while waiting on the predicate
🟡 22 flaky test(s) (passed on retry)
  • Flow/TestConnectionModal.spec.ts › failure state shows remediation card with error content (shard 1, 1 retry)
  • Flow/TestConnectionModal.spec.ts › Edit Connection click dismisses the modal (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: chart (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 › User with permission (shard 1, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clearing search restores the unfiltered list (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › adding a linked asset in edit mode shows entity badge on the row (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › Private memory shows "visible only to you" description (shard 3, 1 retry)
  • Features/DataQuality/DataQuality.spec.ts › TestCase filters (shard 3, 2 retries)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should move term with children to different glossary (shard 3, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should not show online status for inactive users (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Should display custom properties for metric in right panel (shard 5, 1 retry)
  • Pages/DomainAdvanced.spec.ts › Remove multiple assets from domain at once (shard 6, 1 retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard 6, 1 retry)
  • Pages/Glossary.spec.ts › Approve and reject glossary term from Glossary Listing (shard 7, 2 retries)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/ServiceEntity.spec.ts › Domain Add, Update and Remove (shard 7, 2 retries)
  • Pages/TestSuite.spec.ts › Logical TestSuite (shard 7, 1 retry)

📦 Download artifacts

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

Copilot AI review requested due to automatic review settings July 21, 2026 18:08

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.

@chirag-madlani
chirag-madlani enabled auto-merge July 22, 2026 04:55
Copilot AI review requested due to automatic review settings July 22, 2026 05:04

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.

@chirag-madlani
chirag-madlani added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 20470e1 Jul 22, 2026
44 of 46 checks passed
@chirag-madlani
chirag-madlani deleted the fix/etag-flag-undefined-key-in-auth-setup branch July 22, 2026 11:55
@gitar-bot

gitar-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Inlines the ETag opt-out key literal in the E2E auth setup to fix the storage key resolution error, ensuring the interceptor guard now correctly disables conditional reads.

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

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