Repository navigation
feat(ui): AuthCoordinator refactor + full SSO Playwright matrix (9 scenarios × 8 providers) - #31675
Conversation
❌ 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 — workflow succeededValidated commit ✅ 4501 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking 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 41s ⏱️ Max setup 5m 45s · max shard execution 20m 4s · max shard-job elapsed before upload 23m 34s · reporting 16s 🌐 222.55 requests/attempt · 2.23 app boots/UI scenario · 41.45% common-shard skew Optimization targets still in progress:
🟡 2 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Review round 1 — addressedP1s (Greptile)
P4s (gitar-bot)
Checkstyle
Test coverage
Warnings intentionally left for a separate cleanup PR: barrel-import + |
…ures The first pass delegated through `setAppState`, which has three error-swallowing layers: an outer catch-all, an inner SW-catch that routes the payload to an in-memory fallback (does not survive reload), and a `swStorageBroken` branch doing the same. So the "strict" variant still resolved on broken IndexedDB, quota, or SW crash — leaving the CrossTabLock leader broadcasting `done` with a payload the next cold-load can't recover. Bypass `setAppState` for the strict path: talk to `swTokenStorage` directly, re-throw any rejection (after `markSwStorageBroken` so other callers still stop paying the controller-wait timeout), refuse to silently accept the in-memory fallback when the SW is already broken, and propagate `localStorage.setItem` quota throws on the no-service-worker path. Adds four tests pinning the propagation contract per failure mode. Greptile P1: r4037800527 (follow-up to r4035047159). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…validated-on-restart
| const state = await getAppState(); | ||
| state[OIDC_TOKEN_KEY] = token; | ||
| const stateStr = JSON.stringify(state); | ||
|
|
||
| if (isServiceWorkerAvailable() && !swStorageBroken) { | ||
| try { | ||
| await swTokenStorage.setItem(APP_STATE_KEY, stateStr); | ||
| } catch (error) { | ||
| // Mark broken so other callers stop paying the controller-wait | ||
| // timeout, then re-throw — the in-memory fallback doesn't survive | ||
| // reload, so a strict caller can't treat this as a success. | ||
| markSwStorageBroken(error); | ||
|
|
||
| throw error; | ||
| } | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| if (swStorageBroken) { | ||
| throw new Error( |
There was a problem hiding this comment.
Transient reads discard renewed tokens
When the service-worker or IndexedDB read in getAppState fails transiently, it marks storage as broken and returns in-memory state; setOidcTokenStrict then throws without persisting or retaining the successfully renewed token. The coordinator consequently emits refresh-failed and signs the user out even though provider renewal succeeded, while follower retries encounter the same sticky broken-storage state.
Knowledge Base Used: Metadata web application
- Prettier line-wrapping on the new setOidcTokenStrict tests to match what CI's `prettier --write` produces (was the sole failure surfaced by the ESLint + Prettier + Organise Imports check). - Bump the bootstrap Brotli budget 990 → 1150 KiB. Main's owner-link refactor pulled `renderOwnerPopover` (transitively antd Popover + the hover-card subtree) into the eager index.tsx graph, and our AuthCoordinator refactor's static import from AuthProvider drags the CrossTabLock + RefreshQueue + ProactiveTimer + VisibilityWatcher subgraph in alongside it. Together the current build lands at ~1118 KiB Brotli; 1150 KiB restores the ~32 KB headroom the docblock wants so an unrelated dep bump doesn't immediately re-trip the gate. Follows the file's documented ratchet-with-justification pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…validated-on-restart
The SSO scenario matrix (SsoScenarios.spec.ts) labels each provider row by its fixture slug — `@basic`, `@ldap`, `@keycloak-oidc-confidential`, etc. — so the sso-login nightly can filter one leg per matrix entry with `--grep @<slug>`. That intentional labelling collided with the main Playwright PR-pipeline's `Basic` project, whose `@basic` grep pulled in the Basic-provider row of the matrix and ran it in parallel with feature tests tagged `@basic` (`fullyParallel: true`). Because each SSO fixture's `beforeAll` calls `configureBackend`, which swaps `authenticationConfiguration` server-wide, a co-scheduled feature test's `beforeAll` calling `/api/v1/users/signup` (`CustomizeDetailPage.spec.ts:75`, via `UserClass.create`) hit a now-Self-Signup-off backend and failed with 501. The chromium-16 shard consistently included both, so the failure was deterministic on this PR. Ignore `**/Auth/**` in the `Basic` project. The `sso-auth` project (fullyParallel:false, workers:1) already owns those specs via testMatch, so the exclusion just prevents the double-enrolment — mirrors the same guard the primary `chromium` project already has. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…validated-on-restart
…validated-on-restart # Conflicts: # openmetadata-ui/src/main/resources/ui/scripts/check-bundle-chunks.mjs
…validated-on-restart # Conflicts: # openmetadata-ui/src/main/resources/ui/scripts/check-bundle-chunks.mjs
🚦 Removed from the merge queue —
|
…validated-on-restart # Conflicts: # openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/corpus.test.mjs
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
| private static final ConcurrentHashMap<String, EtagCacheEntry> SILENT_CALLBACK_ETAG_CACHE = | ||
| new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Silent callback cache is unbounded
SILENT_CALLBACK_ETAG_CACHE is a bare ConcurrentHashMap with no eviction or maximum size. The repository requires every cache to have an explicit size cap; assuming that only a few base paths will occur does not satisfy that requirement. This cache must be bounded before merging.
Context Used: CLAUDE.md (source)
|
| Count | Rule |
|---|---|
| 13 | openmetadata-imports/no-internal-barrel-imports |
| 13 | react-hooks/exhaustive-deps |
| 2 | openmetadata-imports/no-hook-ui-imports |
| 1 | openmetadata-imports/no-lower-layer-page-imports |
| 1 | sonarjs/cognitive-complexity |
| 1 | openmetadata-imports/no-cross-page-imports |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/Auth/AppAuthenticators/Auth0Authenticator.tsx:23:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AppAuthenticators/BasicAuthAuthenticator.tsx:29:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AppAuthenticators/BasicAuthAuthenticator.tsx:64:10 |
react-hooks/exhaustive-deps |
React Hook useCallback has unnecessary dependencies: 'setOidcToken' and 'setRefreshToken'. Either exclude them or remove the dependency array. Outer scope value |
| 🟡 | src/components/Auth/AppAuthenticators/GenericAuthenticator.tsx:24:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AppAuthenticators/MsalAuthenticator.tsx:28:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AppAuthenticators/MsalAuthenticator.tsx:244:8 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'handleRedirect'. Either include it or remove the dependency array. |
| 🟡 | src/components/Auth/AppAuthenticators/OidcAuthenticator.tsx:30:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/Auth/AppAuthenticators/OidcAuthenticator.tsx:31:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AppAuthenticators/OktaAuthenticator.tsx:23:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.test.tsx:17:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:76:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:87:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:300:9 |
react-hooks/exhaustive-deps |
The 'onLoginHandler' function makes the dependencies of useMemo Hook (at line 927) change on every render. Move it inside the useMemo callback. Alternatively, w |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:380:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'navigate', 'setApplicationLoading', 'setCurrentUser', and 'setIsAuthenticated'. Either include them or remove |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:431:9 |
react-hooks/exhaustive-deps |
The 'resetUserDetails' function makes the dependencies of useMemo Hook (at line 927) change on every render. To fix this, wrap the definition of 'resetUserDetai |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:548:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'handleStoreProtectedRedirectPath', 'resetUserDetails', and 'setIsAuthenticated'. Either include them or remove t |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:550:9 |
react-hooks/exhaustive-deps |
The 'handleFailedLogin' function makes the dependencies of useMemo Hook (at line 927) change on every render. Move it inside the useMemo callback. Alternatively |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:606:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'authConfig?.provider', 'handledVerifiedUser', 'navigate', and 'resetUserDetails'. Either include them or remov |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:656:9 |
react-hooks/exhaustive-deps |
The 'initializeAxiosInterceptors' function makes the dependencies of useMemo Hook (at line 927) change on every render. To fix this, wrap the definition of 'ini |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:695:36 |
sonarjs/cognitive-complexity |
Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed. |
| 🟡 | src/components/Auth/AuthProviders/AuthProvider.tsx:916:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchAuthConfig'. Either include it or remove the dependency array. |
| 🟡 | src/hooks/useApplicationStore.test.ts:15:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/hooks/useApplicationStore.ts:14:1 |
openmetadata-imports/no-hook-ui-imports |
Hooks must not import components or pages. Move shared logic/types below the UI layer. |
| 🟡 | src/hooks/useApplicationStore.ts:15:1 |
openmetadata-imports/no-hook-ui-imports |
Hooks must not import components or pages. Move shared logic/types below the UI layer. |
| 🟡 | src/hooks/useApplicationStore.ts:23:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/index.tsx:22:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
| 🟡 | src/pages/ForgotPassword/ForgotPassword.component.tsx:51:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/pages/LoginPage/SignInPage.tsx:149:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'authConfig?.providerName' and 't'. Either include them or remove the dependency array. |
| 🟡 | src/pages/LoginPage/SignInPage.tsx:157:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'navigate'. Either include it or remove the dependency array. |
| 🟡 | src/pages/SignUp/BasicSignup.component.tsx:26:1 |
openmetadata-imports/no-cross-page-imports |
Page features must not import another page feature. Move shared code to components, hooks, interfaces, or pure utilities. |
| 🟡 | src/utils/SseStreamUtils.ts:14:1 |
openmetadata-imports/no-internal-barrel-imports |
Import the internal module directly instead of its index barrel so unrelated siblings do not enter the bundle graph. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed
|
|



Summary
Two related bodies of work landed on this branch:
1. AuthCoordinator refactor (Bug 1 + Bug 2 permanent fix)
Refactors the SPA silent-refresh path behind a single AuthCoordinator and validates the fixes shipped in the two pre-release hotfixes (#31597, #31644).
Every SSO provider now shares one refresh engine:
visibilitychangehandlerRenewer = () => Promise<{ idToken, expiresAt }>and registers it from its own mount effect (no ref-race)Feature code added:
SilentCallback.tsx— minimal/silent-callbackroute mounted outsideAuthProvider, so the silent-refresh iframe no longer loads the whole app tree (was ~MBs of JS just to postMessage a token)validateAuthFieldsDetailed()— per-provider required-field validator; blocks the AuthProvider render tree into a ConfigErrorPage on missing/malformed fields, BEFORE any IdP redirect. Emits[AuthConfig] <field>console.warn per issue so misconfigs surface in server logs before a user hits them.2. SSO Playwright test refactor (12 new commits)
Consolidates 8 legacy per-provider auth specs into one parametrized
SsoScenarios.spec.tsrunning 9 scenarios × 8 provider fixtures.Providers (real IdPs unless noted):
page.addInitScriptpage.addInitScriptGoogle is manual-only —
playwright/e2e/Auth/manual/Google.mdrunbook. Code path is covered by keycloak-oidc-public with no code-path gap.The 9 scenarios (per provider):
oidcIdTokencleared)supportsCrossTab)/auth/refreshacross tabs)CI wiring — extends
playwright-sso-login-nightly.yml:paths:filter — runs 7-leg matrix (Okta dropped, needs live tenant secrets not on fork PRs)isAvailable()— legs without required secretstest.skip()cleanly with the reason surfaced in the reportCommits
51 commits total on this branch. Highlights:
AuthCoordinatormodule + per-provider renewers + interceptor swap + cold-load fix + Task 13 tests2d789cb,166bd27)394a649)30a541d)d278362)e068078)SsoScenarios.spec.tsscenarios 1-6 (3af5483)4bbb8e4)984982b)a57b511)b2d365a)538e60c)c31e5d7)Test coverage
SsoScenarios.spec.tsparametrized over 8 fixtures — first CI run will validate against real IdPsutils/Auth/AuthCoordinator/: 91% lines / 84% branchesTest plan
yarn test src/components/Auth src/utils/Auth src/hooks/useApplicationStore— 186/187 passyarn lint,npx tsc --noEmit— no new errorsplaywright/e2e/Auth/manual/Google.mdRefs: #31597 (hotfix v1), #31644 (hotfix v2), #31819 (visibility-handler guard on main)
🤖 Generated with Claude Code
The PR is not yet safe to merge because token renewal still signs users out after a successful provider renewal when browser token storage has entered its broken state, and the new ETag cache violates the repository’s bounded-cache requirement.
Findings
Summary
This PR centralizes browser-session renewal behind
AuthCoordinator, adds a lightweight silent-callback entry, validates provider configuration before redirecting, and consolidates SSO coverage into provider-parametrized Playwright scenarios.Diagram
sequenceDiagram participant Request as Protected request participant Coordinator as AuthCoordinator participant Lock as CrossTabLock participant Provider as Provider renewer participant Storage as Shared token storage participant Peers as Other tabs Request->>Coordinator: 401 / expired token Coordinator->>Coordinator: Coalesce queued refreshes Coordinator->>Lock: Acquire refresh leadership alt Leader Lock->>Provider: Renew session Provider-->>Lock: idToken and expiry Lock->>Storage: Persist token while lock is held Lock->>Peers: Broadcast completion payload Lock-->>Coordinator: Leader result else Follower Lock-->>Coordinator: Leader completion payload end Coordinator-->>Request: Retry with refreshed tokenReviews (70) · Last reviewed commit: "chore(playwright): auto-refresh impact-m..."