[ZEPPELIN-6711] Wait for the login modal to close before driving the navbar #5497
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5497"
general
weight: 0.35
jongyoul
What is this PR for?
AuthenticationIT.testSimpleAuthenticationis the only test left that drives the login modal, and it fails intermittently intest-selenium-with-spark-module-for-spark-3-5. The click on the navbar user menu is intercepted by#loginModal, which is still displayed:authenticationUserdid not wait for the modal at all. Once the navbar dropdown appeared it removed the backdrop, forcedmodal('hide')and slept 500 ms. The classic UI closes the modal itself —login.controller.jscallsmodal('toggle')when the login request succeeds — so that cleanup raced the application instead of waiting for it, and it left no trace when the modal was in fact still up.This PR:
Waits for
#loginModalto become invisible inauthenticationUser, and keeps the forced cleanup, unchanged, as the fallback for when that wait times out. The fallback, and a modal still displayed after it, are now logged, so a future failure says which case it hit instead of only surfacing as an intercepted click.Waits for the modal in
logoutUserimmediately before opening the user menu, and retries that one click if it is still intercepted.Fixes the error message in
testSimpleAuthentication, which namedtestCreateNewButton.Test-only. No production code changes.
Why
logoutUserneeds its own waitWaiting once in
authenticationUseris not sufficient, because the modal can be legitimately re-opened after it was closed:NotebookServer.onMessageanswers a WebSocket message whose ticket does not match the one on file by sendingOP.SESSION_LOGOUT(NotebookServer.java:362).login.controller.js:64reacts tosession_logoutby callingmodal('show')inside a$timeout(..., 1000), guarded by$rootScope.userName !== ''— true exactly after a successful login.The failing run's log is consistent with this. The WebSocket opened before the login stays open across it and no new ticket is requested:
The next test in the same run is the contrast: after
finance1logs in throughauthenticationUserViaRest, the log showsWebSocket ticket request completed: principal=finance1followed by a new connection. Only the modal login path keeps a connection established under the previous ticket.To be clear about the limit of that evidence:
NotebookServerlogs the mismatch at DEBUG and the job runs at INFO, so the log does not show whether aSESSION_LOGOUTwas actually emitted. The mechanism is established from the code and the timing fits, but the emission itself is unverified. I have left the same note on the Jira issue.Questions a reviewer may have
Why two new timeout constants instead of
MAX_BROWSER_TIMEOUT_SEC?MAX_BROWSER_TIMEOUT_SECis 30 s.logoutUserhas around 40 callers, so a 30 s wait on a path that is only reached when something is already wrong makes a bad run much slower.MODAL_CLOSE_TIMEOUT_SECis 10 s, generous for a modal the application closes on an HTTP response, andMODAL_CLEANUP_TIMEOUT_SECis 2 s, enough for a 300 ms Bootstrap fade — there is no reason to wait 10 s more just to log a warning. Happy to fold them into the existing constant if you would rather have fewer knobs.Does this slow down the other tests?
No.
logoutUserhas around 40 callers and all but one log in throughauthenticationUserViaRest, which refreshes the page and never touches the modal.invisibilityOfElementLocatedreturns immediately when the element is hidden or absent, which is the normal case. The wait only costs time when the modal is genuinely up — where the old code failed outright.Why is the retry only around the first click?
An intercepted click never reached the user menu, so the dropdown is still closed and opening it again is safe. Retrying the whole open-menu-then-logout sequence would not be: if the second click were intercepted, the dropdown would already be open, and clicking the user menu again would close it and leave the logout link unclickable. The sleeps and the logout click are therefore left exactly as they were, and only the first click is wrapped.
Why keep the forced
modal('hide')at all?It is the existing behaviour and it is the only lever left if the application does not close the modal. It is now a fallback rather than the first move, and it is byte-identical to what is on master — the only behavioural change in that path is that we wait first.
Should the WebSocket reconnect be fixed instead?
Arguably the classic UI should re-request the WebSocket ticket after a modal login, the way the REST path effectively does. That is a production change and the issue puts it out of scope, so I have not touched it; it seems worth a separate issue if you agree.
What type of PR is it?
Bug Fix
Todos
None.
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6711
How should this be tested?
Done:
./mvnw install -DskipTests -am -pl zeppelin-integration -Pweb-classic -Pintegration—BUILD SUCCESS, andtestCompilerecompiled the module's sources.Checked that the changed lines add no Checkstyle violations. The module is not wired into
checkstyle-fail-buildand carries pre-existing violations, so I compared the reported lines against the lines this PR touches rather than the module total: zero on changed lines.Read the failing job's log and the code paths quoted above rather than assuming the cause.
Not done:
I have not run the Selenium suite. This machine has no Chrome, Firefox or Edge — only Safari, which would need
safaridriver --enableplus a manual Develop-menu step, and the suite runs headed. The flake is also specific to the CI browser, so a Safari run would not be evidence. CI is the real check here.The issue's verification step is to re-run
test-selenium-with-spark-module-for-spark-3-5several times and confirmtestSimpleAuthenticationno longer fails this way. Being a flake, one green run does not prove much; it is worth watching the job over the next few runs. For reference, between 2026-09-13 and 2026-09-17 the issue reports 13 runs failing this way, and I hit it again on 2026-09-22.Screenshots (if appropriate)
N/A
Questions:
Does the license files need to update? No. No files added or removed; both touched files keep their ASF headers.
Is there breaking changes for older versions? No. Test-only.
Does this needs documentation? No.
🤖 Generated with Claude Code