Repository navigation
fix(e2e): write the ETag opt-out flag under the correct localStorage key - #30292
Conversation
#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>
❌ 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 |
🔴 Playwright Results — 1 test failure(s)✅ 4546 passed · ❌ 1 failed · 🟡 22 flaky · ⏭️ 100 skipped
Genuine Failures (failed on all attempts)❌
|
Code Review ✅ ApprovedInlines 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. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
* 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>
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.tsimported the key across theplaywright -> srcboundary:That import resolves to
undefinedat runtime, so setup executedlocalStorage.setItem(undefined, 'true')and the flag was persisted under the literal key"undefined". The app then read the real key, gotnull, 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
TestSuiteMultiPipelinerun (/tables/name/…GETs):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.jsonas JSON (not grep) and dumped key/value pairs:3. Confirmed the fix at the artifact level
Deleted
.auth/*.json, re-ran setup, re-parsed: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:5. Coverage / edge cases
browser.newPage()/createNewPage— 91 + 76 + 13 specs use these; verified they inherit storageState (MANUAL_newPage="true"), so they are covered.storageState:path referenced across OM and Collate specs maps to the 8 covered role files..auth, ran Collate's own config (testDir: './', its 130 specs + the generated OM specs). All 8 files regenerated with the correct key; roles reportatInit="true".SSOConfigurationForm.tsxcallslocalStorage.clear(), which would wipe the flag — confined to the SSO-config flow, and those specs aretestIgnored 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:
Then ran
CustomMetric.spec.tswith--trace=onand parsed the trace:If-None-Match0(transfer 240)CustomMetric.spec.tspasses 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/updatedAtonly, so it does not reflect the requestedfieldsor 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:
OM_DISABLE_ETAG_CONDITIONAL_READSbefore saving each role's storage state.Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/etag-flag-u..." | Re-trigger Greptile
Context used (3)