fix(keycloak): capture the interstitial that screen 07's evidence never showed - #316
Merged
Merged
Conversation
…er showed
`qa-shots/hifi/07-keycloak-login-{desktop,phone}.png` were byte-identical to the
`07-keycloak-loggedout` pair — two screens claiming to be different and both
showing the second. `Keycloak/Login` calls `window.location.assign` from a mount
effect, so the capture followed the redirect and screenshotted wherever it
landed.
The interstitial stays as it is. In a working install it is painted for the
length of one navigation and no longer, and adding a delay so the branded card
can be admired would tax every sign-in for a screen nobody asked to see. It is
not dead weight either: it is what a visitor is left looking at when the realm is
unreachable or JavaScript is off, and its manual link is the only way forward
from there.
So the evidence is fixed instead. `scripts/shoot_keycloak_interstitial.py` holds
the page by answering `/api/keycloak/auth/login` with a 204, which a browser
declines to navigate to — not `route.abort()`, which on a top-level navigation
lands on `chrome-error://chromewebdata/` and screenshots a blank error page, a
second way to produce evidence of the wrong screen. The script documents that
the screen only exists when Keycloak is the *active* provider: with `users`
active, `AuthMiddleware` 302s `/keycloak/login` to `/users/login`, which is why
this was never capturable with the default dev configuration.
Both shots are regenerated and now show the real card, realm URL included.
A screenshot is also poor evidence for something no test touched, so
`modules/keycloak/tests-js/Login.test.tsx` pins what survives without the
redirect: the realm named when it is configured, nothing claimed when it is not,
the manual link's target, and the progress bar staying indeterminate.
The spec records the decision under *Deliberate departures*, and its stale note
that the legacy session fail-open "is temporary" is corrected — that closed
in #292.
Closes #301
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
f89569b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://511ae38b.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-keycloak-interstitial-ev.simple-module-python.pages.dev |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #301 (the interstitial half — see "The deck half" below).
The problem
qa-shots/hifi/07-keycloak-login-{desktop,phone}.pngwere byte-identical to the07-keycloak-loggedoutpair — two screens claiming to be different and both showing the second:Keycloak/Logincallswindow.location.assign('/api/keycloak/auth/login')from a mount effect, so the capture followed the redirect and screenshotted wherever it landed.The decision: keep it invisible, fix the evidence
The interstitial stays exactly as it is. In a working install it is painted for the length of one navigation and no longer, and adding a pause so the branded card can be admired would tax every Keycloak sign-in for a screen nobody asked to see. It is not dead weight either — it is what a visitor is left looking at when the realm is unreachable or JavaScript is off, and its manual link is the only way forward from there.
Capturing it
scripts/shoot_keycloak_interstitial.pyholds the page by answering/api/keycloak/auth/loginwith a 204, which a browser declines to navigate to.Two things I got wrong first, both now in the script's docstring so nobody repeats them:
route.abort()does not work. This is a top-level navigation, so aborting lands the browser onchrome-error://chromewebdata/and screenshots a blank error page — a second way to produce evidence of the wrong screen. Verified:URL: chrome-error://chromewebdata/, empty body.usersas the active provider,AuthMiddleware302s/keycloak/login→/users/login. The server must be booted withSM_AUTH_PROVIDER=keycloakplus a realm. That is why this was never capturable by the general shots script.Both screenshots are regenerated and now show the real card — icon tile, "Redirecting to your identity provider",
https://sso.example.com/realms/acme, indeterminate bar, manual link — at 1440 and 390.And a test, because a screenshot is weak evidence
Nothing tested this component.
modules/keycloak/tests-js/Login.test.tsx(5 tests) pins what survives when the redirect does not happen: the realm named when configured, nothing claimed when it is not, the manual link's target, the progress bar staying indeterminate, and the mount-effect redirect itself.Spec
Screen 07 is recorded under Deliberate departures as a transient state and the no-JS fallback. I also corrected a stale line in the same table: it said the legacy-session fail-open "is temporary" — that closed in #292.
Verification
uv run pytest -q— 2914 passed, 60 deselectednpx vitest run— 417 passed in 49 files (5 new)npx biome check,npx tsc -p modules/keycloak --noEmit,check_untranslated_strings.mjs,ruff check scripts,check_file_size.py— all passThe deck half of #301 is NOT done
The other bullet — re-verifying all 28 screens against the current
Hi-Fi Pages.dc.html(project4ad8fe06-…) rather than the 2026-08-19 cached export — I could not do. The deck is not in this repo and I have no access to the live design file. The Figma connector in this session is unauthorised, and #313's author independently hit the same wall (their 46/48px figures came from the repo's own gap-analysis notes, not the deck).That bullet needs someone with access to the file. I'd suggest keeping #301 open for it, or splitting it into its own issue so this half can close.