Skip to content

fix(workbench): exercise the real SSO login path in test_workbench_login - #634

Merged
ian-flores merged 5 commits into
mainfrom
workbench-login-verify-sso
Sep 8, 2026
Merged

fix(workbench): exercise the real SSO login path in test_workbench_login#634
ian-flores merged 5 commits into
mainfrom
workbench-login-verify-sso

Conversation

@ian-flores

@ian-flores ian-flores commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

test_workbench_login skipped whenever auth_provider != "password", so the mock-idp-e2e lane's only Workbench test never actually ran under SSO/OIDC — the job reported green on a skip.

workbench_login() in conftest.py already implements a real SSO path: a silent SSO round-trip against the pre-loaded IdP session under --headless-auth/--interactive-auth, correctly reporting unproven (not a false pass) if that round-trip fails. The sign-out scenario in this same file already uses this path successfully.

This reuses that same path for the login scenario instead of adding new machinery:

  • Drop the unconditional skip in workbench_accessible.
  • Thread auth_provider, interactive_auth, auth_mode, workbench_auth_error through navigate_and_login into workbench_login(...), matching how wb_login already calls it.
  • Only strip the pre-loaded storage_state for password auth, so SSO deployments keep the IdP session the silent round-trip needs.

Verified: ruff check/format --check pass, mypy clean (informational — src/vip_tests/ isn't in CI's mypy scope), and pytest --collect-only confirms pytest-bdd resolves the new step/fixture signatures with no missing-fixture errors. Live SSO verification happens in CI's mock-idp-e2e lane.

Closes #602.

Two other real bugs turned up along the way, fixed here too since they blocked verifying the fix above:

  • workbench_login's "already logged in" fast path only recognized the homepage's own chrome (#posit-logo); a valid session cookie that lands directly in a running session's IDE view was invisible to it and fell through to a doomed password-form retry. Now falls back to /home (same pattern test_sessions.py already uses).
  • mock-idp-e2e's release leg pinned Workbench to rstudio/rstudio-workbench:latest, a Docker Hub tag stale since 2022-08-19 (pre-Posit-rebrand, no #posit-logo at all). Switched to jammy, which rolls forward with every release.

test_workbench_login skipped whenever auth_provider != "password", so
no lane ever verified a Workbench login under SSO/OIDC. Reuse the
silent-SSO round-trip workbench_login already implements (and the
sign-out scenario already relies on): thread auth_provider,
interactive_auth, auth_mode, and workbench_auth_error through the
login step, and only strip the pre-loaded IdP session for password
auth so SSO deployments keep what the round-trip needs.

Closes #602.
Copilot AI lite review requested due to automatic review settings September 8, 2026 15:58

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.

🟢 Approval recommended

The changes reuse the existing, already-shared workbench_login(...) SSO flow and only adjust fixture/step wiring to prevent false-green skips in the SSO CI lane.

Pull request overview

This PR fixes a gap in VIP’s Workbench auth coverage by ensuring test_workbench_login actually executes under SSO/OIDC (instead of skipping), so the mock-idp-e2e lane meaningfully verifies a Workbench login.

Changes:

  • Removed the unconditional SSO skip in the “Workbench is accessible…” step so the scenario runs under non-password providers.
  • Threaded auth_provider, interactive_auth, auth_mode, and workbench_auth_error into the login step and delegated to workbench_login(...) (which already implements the silent SSO round-trip + unproven behavior when it can’t establish a session).
  • Updated the module’s page fixture to strip storage_state only for password auth (keeping IdP storage state intact for SSO/OIDC runs).
File summaries
File Description
src/vip_tests/workbench/test_auth.py Stops skipping under SSO and routes the login scenario through the shared workbench_login SSO-capable path while preserving storage state for IdP-backed auth.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

workbench_login's fast path only checked for the homepage's own
chrome, so a valid session cookie that redirects straight into a
running session's IDE view (as CI's mock-idp-e2e lane just proved
happens under --headless-auth) was invisible to it. It fell through
to the password-form retry loop and failed with "Login failed after
3 attempts" despite the user being authenticated the whole time.

Handle it the same way test_sessions.py already does when navigating
back from a session: detect "/s/" in the URL and go to /home.
Temporary instrumentation to see why the /s/-detection fix for #602
didn't resolve the mock-idp-e2e failure. Not for merge.
print() doesn't survive VIP's custom terminal reporter (no "Captured
stdout" section appears even on failure). Accumulate the debug trail
and put it directly in the AssertionError text instead, since that
renders in full every time.
rstudio/rstudio-workbench:latest hasn't updated since 2022-08-19 (a
pre-Posit-rebrand build with no #posit-logo element), while jammy
rolls forward with every release and was current as of yesterday.
Use jammy for the release leg instead, so it actually tracks newest
without a manual bump.

Also drops the DEBUG_602 diagnostic instrumentation added while
investigating this -- its job is done.
@ian-flores
ian-flores marked this pull request as ready for review September 8, 2026 18:00
@ian-flores
ian-flores merged commit 6c82f69 into main Sep 8, 2026
41 checks passed
@ian-flores
ian-flores deleted the workbench-login-verify-sso branch September 8, 2026 18:00
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-08 18:00 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(workbench): test_workbench_login skips under SSO, so no lane verifies a Workbench login

2 participants