Skip to content

Add Playwright auth setup project for Posit AI credentials - #17680

Merged
ronblum merged 29 commits into
mainfrom
test/ron/playwright-auth-setup
Jul 20, 2026
Merged

ronblum merged 29 commits into
mainfrom
test/ron/playwright-auth-setup

Conversation

@ronblum

@ronblum ronblum commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a Playwright setup project (tests/auth.setup.ts) that provisions Posit AI credentials into the per-run sandbox user-home before tests run. The desktop and server projects depend on setup, so Posit-AI-gated tests start signed in. The setup project runs unconditionally, even when no Posit AI test is selected.

The setup auto-detects the credential source rather than taking a mode flag:

  • POSIT_EMAIL/POSIT_PASSWORD set: runs the OAuth sign-in flow against login.posit.cloud and writes a fresh token store; nothing is copied from the local machine.
  • Neither set but signed in to Posit AI locally: copies only the local token store (~/.posit/ai/auth/data.json) into the sandbox--no skills, workspaces, or other state.
  • Neither applies: provisions nothing, and the Posit AI tests skip cleanly.

Setting exactly one of POSIT_EMAIL/POSIT_PASSWORD is an error that fails the run. Credentials are read from environment variables only and never committed. Trace, video, and screenshot are off for the setup project to avoid capturing the login screen.

Tests gate on the on-disk token store via requireAiCredentials(), not an environment flag, so an unsigned-in sandbox skips cleanly. PW_SANDBOX_NO_SEED_CREDENTIALS=1 is a kill-switch that suppresses the local-copy path (and the Copilot copy); the sign-in flow is unaffected because it copies nothing locally.

Additional behavior:

  • A worker-scoped aiAuth fixture option lets a test file declare signed-out state, e.g. test.use({ aiAuth: { positai: 'none', copilot: 'none' } }), by launching against a credential-stripped copy of the user home. Declaring it against an external server is an error.
  • Whenever the sandbox is left on disk (failure, PW_SANDBOX_SKIP_CLEANUP, or a failed delete), teardown scrubs the copied tokens first. A cancelled run (SIGTERM) scrubs them too; only a hard kill or crash can leave tokens behind.
  • Deterministic OAuth failures (4xx config faults, non-JSON bodies, missing token fields, a failed browser launch) fail the run instead of masquerading as a skip. The sign-in flow is bounded by a deadline under the harness test timeout, a status file records the outcome so a failed sign-in is diagnosable from the report, and the setup project doesn't retry so a fail-loud verdict isn't laundered into green-with-skips.

@posit-snyk-bot

posit-snyk-bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@ronblum

ronblum commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

Review

Medium

  1. e2e/rstudio/tests/auth.setup.ts (pollForToken + race timeout). pollForToken is an unbounded for(;;) loop. When the 90s race rejects, the polling continues issuing fetches. Any later resolution becomes an unhandled rejection.
  2. e2e/rstudio/tests/auth.setup.ts (automateLogin). Three getByRole('button', { name: /continue/i }) clicks. If a previous button is still in DOM during a transition, strict mode throws.
  3. e2e/rstudio/playwright.config.ts. dependencies: ['setup'] on both projects means setup runs on every invocation. Up to 90s on device-flow failure.
  4. e2e/rstudio/tests/auth.setup.ts (catch-all warn). Bad password, network errors, or 4xx look like "no creds"; @auth tests silently skip and CI loses signal.

Low

  1. Duplicated constants and read logic between auth.setup.ts and utils/auth.ts.
  2. userCode.replace('-', '') only removes the first hyphen.
  3. Hardcoded waitForTimeout(2000) after Authorize.
  4. verificationUriComplete.split('?')[0] assumes a ?.
  5. (await resp.json()).error assumes JSON body.
  6. No log when cache mode falls through to "no creds".

Assessment

  1. Take. Real issue (unbounded loop, unhandled rejection risk). Cheap fix with a deadline-based polling design.
  2. Skip (downgrade Medium to Suggestion). Flow verified across all four modes. Strict-mode multi-match is theoretically possible but not observed.
  3. Skip (downgrade Medium to Suggestion). The 90s cost only triggers when creds are set AND device flow fails. With no creds, setup early-returns in microseconds.
  4. Skip (downgrade Medium to Suggestion). Design is intentional. Setup shouldn't fail the whole suite for auth issues; @auth tests skip via their guard. CI still shows skipped tests in the report.
  5. Take. Real drift risk. Easy refactor.
  6. Take. One-character defensive fix.
  7. Take. Saves 2s per setup run and removes a flakiness vector.
  8. Skip. Auth0 URIs always have a query string. Switching to new URL() is over-engineering.
  9. Skip. Auth0's token endpoint returns JSON for errors per the OAuth spec.
  10. Skip. Existing warn covers the outcome.

Net plan: take 4 findings (1, 5, 6, 7); skip 6 others (2, 3, 4, 8, 9, 10).

Actions Taken

Commit 5c328b299d:

  1. Finding 1. Bake a deadline into pollForToken (new timeoutMs parameter; throws when Date.now() > deadline). Drop the outer Promise.race wrapper. One timer, no race condition.
  2. Finding 5. Move AUTH_STORAGE_KEY, POSITAI_STORE_RELATIVE, readAuthStore, and isStoreFileAuthenticated into utils/auth.ts as exports. auth.setup.ts now imports them; local duplicates removed.
  3. Finding 6. userCode.replace('-', '') -> userCode.replace(/-/g, '').
  4. Finding 7. Removed await page.waitForTimeout(2000) after the Authorize click; token polling is the real signal of completion.

@ronblum

ronblum commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

Review

Six review angles surfaced findings on this PR. Key items grouped by topic:

Correctness / behavior

  1. readAuthStore collapses all I/O errors to "not cached" (ENOENT, EACCES, malformed JSON look identical).
  2. isPositAiAuthenticated silently falls back to os.homedir() when PW_SANDBOX is unset.
  3. isStoreFileAuthenticated is too shallow: only checks authenticated === true; missing/expired tokens still pass.
  4. No post-write verification after writing or copying the store.
  5. mode=cache cache miss silently falls through to device flow with no signal; cache miss plus missing creds is fully silent.

Error handling
6. Device-flow catch swallows terminal OAuth errors (access_denied, expired_token, invalid_grant) as warnings, indistinguishable from flake.
7. Login automation steps have no per-step error context; any HTML change yields a generic timeout.

Type / shape design
8. readAuthStore's as Record<string, unknown> cast lies for arrays/primitives.
9. isStoreFileAuthenticated's as { authenticated?: boolean } has no runtime backing.
10. TokenResponse over-narrows the OAuth contract; should be a discriminated union with RFC-optional fields.
11. The on-disk entry shape is built inline in the writer; reader and writer should share a type.

Style / comments
12. Duplicate password locator in automateLogin.
13. for (;;) with internal deadline reads cleaner as while (Date.now() < deadline).
14. copyToSandbox and saveToCache are near-duplicates.
15. playwright.config.ts reassigns projects to prepend the setup project.
16. Several comments either restate the code or narrate without giving the why (lines 117, 121, 126, 129, 134 of auth.setup.ts).
17. AUTH_STORAGE_KEY and POSITAI_STORE_RELATIVE lack a docstring tying them to the Posit AI client's on-disk layout.

Docs
18. New env vars (PW_SANDBOX_POSITAI_AUTH, POSIT_EMAIL, POSIT_PASSWORD) are not in the suite README.
19. Overlap with PW_SANDBOX_SEED_POSITAI: both can fire; precedence undocumented.

Assessment

Net: take 25, skip 6.

Taken with reasoning:

  • All five behavioral / correctness items above: real bugs around silent failure and shallow gating.
  • Both error-handling items: terminal OAuth errors are deterministic config problems, not flake, and per-step context dramatically improves debug when third-party HTML changes.
  • All four type / shape items including a discriminated TokenSuccess | TokenError union with RFC-optional fields (strict spec); types that don't lie are worth the small writer churn.
  • All style and comment items including the copyStoreFile helper, while loop, named-locator dedup, and config collapse.
  • Both docs items: README rows plus a header docstring documenting PW_SANDBOX_SEED_POSITAI precedence (complementary, not redundant; SEED_POSITAI lays down the full ~/.positai/ tree in globalSetup, POSITAI_AUTH refreshes store/data.json specifically).

Skipped with reasoning:

  • @auth tag log text: forward-looking; the queued @auth slice follows.
  • Tightening login selectors: compound selectors are intentionally defensive.
  • Branded Secret type for password: ceremony without payoff in a test helper.
  • parseAuthMode helper: current shape is fine.
  • PW_SANDBOX_SEED_POSITAI consolidation: separate PR; the precedence docstring covers the interim.
  • isPositAiAuthenticated removal and host/sandbox split: kept as scaffolding for the queued @auth slice with no host consumer planned.

Actions Taken

Single follow-up commit (aaa7fca883) touches four files.

utils/auth.ts:

  • Added PositAiOAuthEntry interface and isPlainObject / isAuthEntry runtime guards.
  • Dropped export on readAuthStore (now file-local).
  • Rewrote readAuthStore to keep ENOENT quiet but warn on other I/O errors (EACCES, EISDIR, EIO, malformed JSON).
  • Deepened isStoreFileAuthenticated to require non-empty accessToken and a future expiresAt.
  • isPositAiAuthenticated now throws when PW_SANDBOX is unset.
  • Comment on AUTH_STORAGE_KEY / POSITAI_STORE_RELATIVE noting the upstream owner.

tests/auth.setup.ts:

  • Replaced TokenResponse with a TokenSuccessResponse | TokenErrorResponse discriminated union; RFC-optional fields marked optional.
  • New DeviceFlowTerminalError class; pollForToken distinguishes terminal errors from transient.
  • Setup body rethrows DeviceFlowTerminalError; warn-and-skip stays for everything else.
  • New step(name, fn) wrapper applied to the four login phases for per-step error context.
  • writeTokensToSandbox omits absent refreshToken / scope and throws loud on missing expires_in.
  • New verifyStoreWritten called after every write path (seed, cache load, device flow).
  • Cache miss now logs [auth-setup] cache miss; falling back to device flow.
  • copyStoreFile(src, dest) replaces copyToSandbox / saveToCache.
  • Password locator named once, reused.
  • for (;;) becomes while (Date.now() < deadline) in pollForToken.
  • Header docstring covering the three modes and SEED_POSITAI precedence.
  • Comment cleanup at the five flagged lines.

playwright.config.ts:

  • Collapsed conditional reassignment to const projects = [setupProject, ...selectedProjects].

README.md:

  • Three new env-var rows: PW_SANDBOX_POSITAI_AUTH, POSIT_EMAIL, POSIT_PASSWORD.

@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
1867 0 333 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 467 0 82 0
✅ desktop-macos 470 0 79 1
✅ desktop-windows 470 0 84 1
✅ server-linux 452 0 88 0
✅ setup 8 0 0 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit 180f00bbd450d8975aaae23366c30662a8884acc - Run #269

@ronblum

ronblum commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Review

Five specialized agents reviewed the PR diff (code-reviewer, silent-failure-hunter, type-design-analyzer, comment-analyzer, code-simplifier), scoped to the changes this PR introduces. Highlights, most severe first.

Important (several corroborated across agents):

  1. Floating token-poll promise. If the browser login rejected first, the poll promise was never awaited and could surface as an unhandled rejection tens of seconds later, after the setup step had already reported success.
  2. Skip-vs-fail contract gaps. A wrong POSIT_PASSWORD, a post-sign-in protocol violation (missing expires_in, malformed JSON, or a failed verify), and OAuth config faults (invalid_client, invalid_scope, and similar) all silently downgraded to a skip, so a real failure looked identical to "no credentials." The code's own comment claimed the opposite.

Suggestions and hygiene:
3. interval was typed as required although RFC 8628 makes it optional; an omitted value would produce a NaN poll delay and a tight loop.
4. isAuthEntry did not validate tokenType although the interface marked it required (an unsound guard).
5. Duplicated PW_SANDBOX_NO_SEED_CREDENTIALS parsing across two files, and ".posit/assistant" spelled independently in two files.
6. Auth mode was a loose string with the valid set duplicated in the guard and its error message.
7. Comment and terminology issues: an undefined "Scope A" label, a "device-flow" leftover, a mis-wrapped comment, and a stale pre-existing comment.

Assessment

  1. Floating promise: real defect, taken. Calibrated Important (failure-path only) rather than Critical.
  2. Skip-vs-fail: taken. This was the finding that actually undercut the PR's stated "fail loud on bad credentials" goal.
  3. interval default, isAuthEntry, dedup, mode union, and the comment fixes: all cheap and worthwhile, taken.
  4. Skipped as low value: forcing mode 0600 on the seed copy (source permissions are already restrictive), runtime validation of fetched OAuth JSON (acceptable for a test utility against a known server), AIProvider exhaustiveness, and assorted type trivia.

Actions Taken

Committed in cc18975, on top of fc241d9.

Correctness and error handling:

  1. Poll and browser login now run under Promise.all, so a login failure can no longer orphan the poll promise.
  2. Inverted the OAuth error polarity: only authorization_pending and slow_down continue the poll; every other error, including config faults, is terminal and fails the run.
  3. Wrong-credential handling now fails loud: a new LoginAutomationError is thrown at the password and authorize steps and rethrown, so a bad POSIT_PASSWORD fails the run instead of skipping.
  4. Post-sign-in token write and verification moved out of the try block, so a malformed token response or a failed store write fails the run rather than masquerading as a skip.
  5. interval now defaults to 5s (RFC 8628) and is typed optional.

Types and deduplication:
6. POSITAI_STORE_RELATIVE is derived from a single POSITAI_DIR_RELATIVE; storeFile() and noSeedCredentials() were consolidated into utils/auth.ts and imported by both callers.
7. isAuthEntry now validates tokenType.
8. Auth mode is a typed union (PositAiAuthMode) backed by one array shared by the check and its error message.

Messages, comments, terminology:
9. Renamed the internal DeviceFlowTerminalError to OAuthTerminalError, reworded "Device auth request failed" to "OAuth sign-in request failed", and corrected the browser step name to "enter user code" (it enters the RFC 8628 user_code, not the device_code). Remaining "device" references are RFC protocol identifiers only.
10. Adopted a message-severity convention: console.warn messages carry a "WARNING:" prefix, console.log messages do not. The two credential-copied notices (Copilot and Posit AI seed) fire on the success path, so they were downgraded from warnings to informational logs while keeping the token-persistence caution.
11. Dropped the undefined "Scope A" label, fixed a "device-flow" log leftover, re-wrapped the authorization_pending comment, corrected a stale docstring, and fixed a pre-existing user-skill path comment.

By decision, not changed: success-path messages do not state "tests will run", and expired_token remains terminal, with a comment noting the slow-runner trade-off instead of a retry.

Verified: tsc --noEmit passes.

… response validation

- Auth setup now writes a status file recording what happened (off/seed/flow outcome and reason); requireAiCredentials builds the skip reason from it instead of a generic "set POSIT_EMAIL/POSIT_PASSWORD" message, so a failed sign-in flow is diagnosable from the test report
- Bound the sign-in flow to a deadline well under the harness test timeout, so a slow run fails through the existing skip path instead of aborting the whole suite (setup previously had no margin against its own 90s poll cap plus browser launch/login steps)
- pollForToken no longer misclassifies 5xx or non-JSON error bodies as a terminal OAuth error or an unretried skip
- Validate the device-code response shape so a server contract change fails loud instead of surfacing as a cryptic TypeError
- Tighten PositAiOAuthEntry/PositAiAuthMode types, drop the unused oauthError field, fix a couple of inaccurate comments, and finish the @ai-tag-vs-provider terminology cleanup left over from the previous commit
@ronblum

ronblum commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Review

Five review agents ran against the main...HEAD diff (test infrastructure only, under e2e/rstudio/).

code-reviewer -- no critical or important defects confirmed (verified the storage key, on-disk store shape, and testMatch isolation against the assistant repo). Suggestions:

  1. Store-path forward-coupling: the assistant repo is mid-migration from ~/.posit/assistant/store/data.json to ~/.posit/ai/auth/data.json; currently fine (old path kept as fallback), but a future drop of that fallback would break the gate silently.
  2. flow mode runs a live OAuth login on every invocation when creds are configured, since dependencies: ['setup'] is unconditional.
  3. Login selectors are inherently fragile (driving a third-party login page).
  4. Minor pollForToken gaps (interval ?? 5 doesn't guard interval: 0; non-JSON error body throws).

silent-failure-hunter -- HIGH: 1. deterministic login-page breakage (e.g. a selector rename) is classified as transient, producing a permanently green setup with dark-skipped positai-gated tests forever, with only a stdout warn line as evidence. MEDIUM: 2. the static skip reason gives wrong guidance when the flow was attempted and failed; 3. pollForToken misclassifies transient server errors in both directions (5xx/non-JSON as terminal, or vice versa); 4. the harness test timeout can bypass the transient-to-skip design entirely, turning a slow run into a whole-suite failure; 5. diagnostics (trace/video/screenshot) are forced off with no rationale written down; 6. the device-code response is asserted, not validated, so a server contract change surfaces as a cryptic TypeError. LOW: 7. verifyStoreWritten's message names only 2 of 4 possible causes; 8. seed mode's "not signed in" message ignores a merely-expired-but-refreshable token; 9. the Copilot privacy warning was downgraded from console.warn to console.log.

comment-analyzer -- no factually wrong comments, no rot from the prior rework rounds. Misleading rationale: 1. "waitForLoadState would hang" is inverted -- it would return immediately, not hang; 2. "only genuinely transient failures... fall through to a skip" overstates the guarantee (deterministic selector drift lands there too). Minor: 3. "earlier steps stay transient" is wrong ordering; 4. seed-mode's illustrative file list names a nonexistent settings entry; 5. verification_uri_complete typed required with no note that it's RFC-optional; 6. the artifacts-off block has no comment explaining the credential-exposure rationale. Pre-existing: 7. the README's user-home-relative-path example still cites the legacy .positai/skills/ path for a test that no longer uses it there.

type-design-analyzer -- strong overall for test infrastructure; ratings 6-9 across the board. Findings: 1. authenticated: boolean should be a literal true; 2. the auth-entry guard doesn't validate the outer oauthAuth.expiresAt it narrows to; 3. PositAiAuthMode and its valid-values array are declared separately and can drift; 4. a non-JSON token-endpoint error body throws and is misclassified as transient (overlaps silent-failure finding 3).

code-simplifier -- report-only, no edits made. 1. OAuthTerminalError's oauthError field is stored but never read anywhere -- clear vestigial from the rework. 2. Optional: the two marker error classes (OAuthTerminalError, LoginAutomationError) could merge, since they're handled identically at the one catch site -- the agent itself leaned toward keeping them separate, since the names document failure origin.

Assessment

Verified every finding against the checked-out files before taking a position.

  • Transient/deterministic boundary (silent-failure 1, comment-analyzer 2, code-reviewer 3): the underlying step-kind classification is a reasonable trade-off, not a bug -- distinguishing "selector broke" from "page loaded slowly" isn't reliably possible from the error alone. The fixable part is that the failure was invisible. Took the recommended fix: a status file written by the setup project, read by the credential gate, so every skipped test's report shows the real cause instead of a generic message.
  • pollForToken misclassification (silent-failure 3, type-design 4, code-reviewer 4): confirmed both directions in the code -- took, hardened to retry on 5xx/non-JSON until the deadline and only construct a terminal error for a genuine RFC error code.
  • Harness timeout bypass (silent-failure 4): confirmed the raw chromium context's steps use Playwright's 30s default (the config's actionTimeout doesn't apply there), and the 90s poll plus browser launch can plausibly exceed the 120s global test timeout, in which case the catch never runs and every dependent test is marked "did not run." Took -- added an explicit setup.setTimeout plus a self-managed deadline race well under it.
  • Device-code response validation (silent-failure 6, comment-analyzer 5): confirmed an unvalidated cast at auth.setup.ts that would produce a bare TypeError outside any step wrapper on a contract change. Took -- validates required fields and interval, throws a terminal error naming the bad field.
  • Artifacts-off rationale (silent-failure 5, comment-analyzer 6): took both the comment and appending page.url() to step failures for diagnosability without artifacts.
  • Store-path migration (code-reviewer 1): confirmed upstream in the assistant repo. Took as a comment only, since guessing the future path in code would be premature.
  • Comment fixes (comment-analyzer 1, 3, 4; code-reviewer 3): all verified accurate as flagged -- took all of them, plus a full sweep for a related terminology issue found separately (see below).
  • Type tightening (type-design 1, 2, 3): took the literal-true and derived-mode-array fixes outright; took the outer-expiresAt guard check in its cheap form (nothing currently reads that field post-guard, so this closes a latent, not live, gap).
  • oauthError field (code-simplifier 1): confirmed unused -- took, dropped it.
  • Merging the two error classes (code-simplifier 2): skipped, per the agent's own recommendation -- the class names carry real documentary value (origin of the fatal failure) at zero runtime cost.
  • Copilot warn-to-log downgrade (silent-failure 9): skipped -- this was an intentional messaging change from the prior commit in this PR, not an oversight, and the README's kill-switch documentation already covers the opt-out.
  • Live-sign-in-every-run trade-off (code-reviewer 2): took as a README dev-iteration note rather than a code change, since restructuring the dependency graph isn't warranted for a documented trade-off.

Separately, while discussing the review, we noticed the prior commit's terminology cleanup (renaming raw "@ai tests" language to name the actual gating provider) was incomplete -- several comments in auth.setup.ts and sandbox-setup.ts, plus a few README passages, still said "@ai tests" in places where the @ai tag has nothing to do with which tests actually run (that's gated by requireAiCredentials, per-provider). Verified the remaining occurrences and swept them to name the provider (Posit AI / Copilot) instead, leaving the tag itself referenced only where the text is genuinely about the tag (the run-selection docs, the tag glossary, and the test.describe call sites).

Actions Taken

  • Added a PositAiAuthStatus file (utils/auth.ts: writeAuthStatus/readAuthStatus) that auth.setup.ts writes on every exit path (off, seed suppressed, host not signed in, credentials unset, flow failed, success) and that ai-credentials.ts reads to build an accurate skip reason.
  • Hardened pollForToken to retry through 5xx responses and non-JSON/malformed error bodies until the deadline, only raising a terminal error for a genuine non-empty RFC error code; the timeout message now includes the last anomalous response seen.
  • Added setup.setTimeout(240_000) and a withDeadline race (180s) around the sign-in flow so a pile-up of slow steps fails through the existing transient path instead of hitting the harness timeout and failing the whole run.
  • Validated the device-code response shape in fetchDeviceCode (required string fields, positive interval), raising a terminal, field-naming error on a malformed response.
  • step() now takes the Page and appends page.url() to wrapped failure messages, since this project intentionally runs with no trace/video/screenshot.
  • Added a comment on the setup project's use block explaining why artifacts are off (the flow types real credentials into the page).
  • Extended the on-disk-format drift warning in utils/auth.ts to name the assistant repo's in-progress store migration.
  • Fixed the inverted waitForLoadState rationale, the "earlier steps" ordering claim, the overstated transient-only guarantee, and the nonexistent settings entry in the seed-mode file list (both in code and the README).
  • Added a comment noting the login selectors track login.posit.cloud markup and will need updating if that page changes.
  • Made authenticated a literal true, had the auth-entry guard also validate the outer oauthAuth.expiresAt, and derived PositAiAuthMode from the AUTH_MODES array via as const so they can't drift apart.
  • Dropped the unused oauthError field from OAuthTerminalError.
  • Reworded verifyStoreWritten's error message and the seed-mode "not signed in" log line to cover the cases they previously omitted.
  • Added a README note that the sign-in flow runs on every invocation when credentials are configured, with the seed/off escape hatches for fast local iteration.
  • Fixed the stale ~/.positai/skills/ example in the README to match the current chat-user-skills.test.ts path.
  • Swept the remaining "@ai tests" phrasing in auth.setup.ts, sandbox-setup.ts, and the README to name the actual gating provider (Posit AI / Copilot), finishing the terminology cleanup from the previous commit.
  • Not changed: merging the two fatal error classes (kept separate for their documentary value), and the Copilot warn-to-log message (an intentional change from an earlier commit in this PR, not a regression).

@ronblum

ronblum commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Verified States
Note: the modes have been changed since this comment was published: flow -> login, seed -> copy, and login-copy mode added.

Fields used: mode = PW_SANDBOX_POSITAI_AUTH (flow / seed / off); username = POSIT_EMAIL; password = POSIT_PASSWORD; kill-switch = PW_SANDBOX_NO_SEED_CREDENTIALS; env-file override = PW_ENV_FILE.

A. Auth mode (PW_SANDBOX_POSITAI_AUTH) x condition

Mode Condition Outcome (status file) Tests
flow valid creds (POSIT_EMAIL/POSIT_PASSWORD) success 2 passed
flow invalid creds fatal -- fails loud, no status file run fails
flow no creds (POSIT_EMAIL/POSIT_PASSWORD unset) credentials-unset 2 skipped
off -- off 2 skipped
seed host signed in success (copies ~/.posit/assistant) 2 passed
seed host logged out host-not-signed-in 2 skipped
seed kill-switch on seed-suppressed 2 skipped

Footnote: the code also has a transient-authorize-failure -> flow-failed -> skip path. It's a genuine intermittent condition; it was observed skipping (5 tests, in a combined 2-file run) but I couldn't reproduce it post-fix in the 2-test harness, since the authorize-retry fix makes that path rare. Included here for completeness.

B. Kill-switch (PW_SANDBOX_NO_SEED_CREDENTIALS=1) x mode

Mode + kill-switch Outcome Result
off off (unaffected) 2 skipped
seed seed-suppressed (copy blocked) 2 skipped
flow success (unaffected) 2 passed

C. Credentials (POSIT_EMAIL / POSIT_PASSWORD) via environment file

Source Mechanism Result
.env.local dotenv default, shell creds stripped success -- "injected env (2) from .env.local"
.env.op PW_ENV_FILE=.env.op, shell creds stripped success -- "injected env (2) from .env.op"

D. Authorize-retry fix (live flow sign-in)

8 passing flow sign-ins -- 2 headed, 6 headless -- all completing the full chain (sign-in -> tokens written -> tests run authenticated), ~2.3s each. The authorize retry held in every run.


Key point on skips: a skip here is a pass condition. When credentials aren't provisioned (off, no creds, host logged out, seed suppressed), the tests are designed to skip with a clear reason rather than run and fail -- so "skipped" above is the correct, expected outcome.

Bottom line: every mode, both kill-switch states, all credential/host conditions, and both env-file paths are verified -- each landing on its expected result (run, skip-as-designed, or fail-loud for invalid creds), plus 8/8 clean flow sign-ins confirming the authorize fix.

@ronblum ronblum self-assigned this Jul 14, 2026
…matrix

- Classify deterministic OAuth failures (4xx config faults, non-JSON 2xx
  bodies, missing token fields, a failed browser launch) as fatal so they
  fail the run instead of masquerading as a skip; bound the device-code
  fetch with its own timeout.
- Make the authorize-click loop robust to the button detaching mid-click so
  a successful sign-in can't be misread as a fatal failure.
- Validate the status file's mode and outcome against their unions on read,
  type PositAiAuthStatus fully, and warn on a corrupt or unreadable file.
- Add exhaustiveness checks to the mode and provider dispatch.
- Stop retrying the setup project so a fail-loud verdict isn't laundered
  into green-with-skips by a flaky retry.
- Correct stale comments, and add a mode x kill-switch reference table to
  the README.
@ronblum

ronblum commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Review

A five-agent review (code-reviewer, silent-failure-hunter, comment-analyzer, type-design-analyzer, code-simplifier) ran against the full PR diff. No critical or important-severity defects; the findings clustered on holes in the transient-vs-deterministic failure policy, boundary validation, and comment accuracy. Highlights:

Silent-failure hunter (3 medium, 6 low)

  1. Deterministic OAuth failures were misclassified as transient skips: a 4xx config fault from the device-authorize endpoint, and a non-JSON 200 from either the device-authorize or the token endpoint, all threw a plain error and landed in the skip bucket.
  2. A missing Playwright chromium (an environment gap, deterministic) was treated as transient, so Posit AI tests would skip on every run forever.
  3. The authorize re-click loop could turn a successful authorization into a fatal run failure if the button detached mid-click.
  4. Lower-severity: browser.close() in a finally could mask a fatal error; late flow rejections after the deadline were swallowed unlogged; an unreadable host store was reported as "not signed in"; readAuthStatus swallowed read errors silently; CI's retry applied to the setup project; the token success response was accepted unvalidated.

Code reviewer (3 suggestions)

  1. The .env.example header listed PW_SANDBOX_ROOT among "pre-filled" keys when it is actually left commented.
  2. A fatal auth failure blocks the entire dependent suite, not just AI tests (blast-radius note).
  3. CI retries: 1 also retries the setup project.

Type-design analyzer (7 findings)

  1. readAuthStatus laundered any string into the outcome union via a double cast (validation weaker than the return type claimed).
  2. The mode union lived in the test file though mode is serialized into the shared status file, so the field degraded to string.
  3. Mode and provider dispatch relied on comments rather than exhaustiveness checks.
  4. The token success response was returned unvalidated; isAuthEntry did not type-check its optional fields; expires_in was declared required but unused.

Comment analyzer (3 factual errors, 5 improvements)

  1. The "every exit path writes the status file" claim did not hold for the throwing paths.
  2. A stale "5-minute" timeout figure survived in a rewritten comment (the timeout is 2 minutes).
  3. The store-migration NOTE said the assistant "moves" the store; it copies it (verified against the assistant repo).
  4. Several kill-switch docs omitted login-copy's content-copy suppression; the deadline-coverage comment overlooked the unbounded device-code fetch.

Code simplifier (1 actionable)

  1. Fold the login-copy branch's hand-rolled recursive copy into copyTree via an optional filter. Three other candidate consolidations were evaluated and deliberately left as-is (the duplication encodes intended per-exit-path diagnostics).

Assessment

Each finding was verified against the code in context. Taken: all of the silent-failure findings, the code-reviewer's .env.example and setup-retry suggestions, every type-design finding, all comment fixes, and the simplifier's copyTree fold. Skipped: the code-reviewer's whole-suite blast-radius point (confirmed intended -- a deterministic auth fault should stop the run conspicuously rather than let AI tests silently skip; a login-page change is repaired in one function), and the three simplifier candidates whose apparent duplication is intended explicitness. One item was deferred as pre-existing (a project-level skill path unrelated to this PR).

Actions Taken

  1. Deterministic OAuth failures now fail loud: the device-code and token responses are parsed and field-validated as terminal, the device-code fetch carries its own timeout, and a browser-launch failure is fatal with a remedy in the message.
  2. The authorize-click loop tolerates the button detaching mid-click, so a successful sign-in is no longer misread as a fatal failure; loop exhaustion is logged.
  3. The status file's mode and outcome are validated against their unions on read, PositAiAuthStatus is fully typed (the mode union moved into utils/auth.ts alongside a new AUTH_OUTCOMES), and a corrupt or unreadable file now warns.
  4. Mode and provider dispatch gained exhaustiveness checks; isAuthEntry validates optional fields; expires_in is marked optional.
  5. The setup project no longer retries, so a fail-loud verdict is not laundered into green-with-skips.
  6. Stale and inaccurate comments were corrected, copyTree absorbed the login-copy copy, and a mode-by-kill-switch reference table was added to the README.

Verified by a full local matrix on installed Desktop: all four modes (off, copy, login, login-copy) and both kill-switch combinations produced their expected skip/success outcomes; a deliberate wrong-password run confirmed the fatal path fails loud with a single sign-in attempt and no retry under CI. TypeScript type-checks clean.

@ronblum

ronblum commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Review

Reviewed commit 8c66b8fcb9 ("Simplify Posit AI auth: copy only the token store and drop login-copy mode") with five specialized agents (code-reviewer, silent-failure-hunter, comment-analyzer, type-design-analyzer, pr-test-analyzer), each also asked to check README.md and .env.example.

No critical or important functional issues. All five agents confirmed: the new single-file copyFile path is correctly guarded before (host isStoreFileAuthenticated) and after (verifyStoreWritten); the mode satisfies 'login' exhaustiveness guard is real and would fail to compile if a future mode were added without a dispatch branch; a worktree-wide grep found zero leftover login-copy references in code; and README/.env.example were updated consistently with the new behavior.

Findings:

  1. Stale "whole-tree host copy" comment in fixtures/sandbox-setup.ts -- the commit updated the docstring and log message in this file but missed a body comment that still described copy mode as copying the entire ~/.posit/assistant directory (found independently by two agents).
  2. Plural "sign-in modes" in tests/auth.setup.ts -- only one sign-in mode remains after login-copy was removed.
  3. Vestigial export on POSITAI_DIR_RELATIVE in utils/auth.ts -- its only external importer was removed along with the login-copy block.
  4. A manual verification recommendation (not a code defect): run once locally with PW_SANDBOX_POSITAI_AUTH=copy (host signed in) to confirm a token-store-only sandbox is sufficient for an @ai test to pass, since no default/CI run exercises copy mode.
  5. Two low-severity notes on a TOCTOU error message and a status-file rejection warning -- both already fail loud with diagnosable messages.

Assessment

Took findings 1-3 as one-line fixes, verified with tsc --noEmit after each. Skipped the two low-severity notes in 5 -- both describe already-loud failures whose messages are self-explaining; the suggested rewording wasn't worth the added code.

Discussion surfaced two more stale spots in the same family, in actions/chat_pane.actions.ts:

  • A comment claiming "seeded credentials are the only auth path the test harness supports" -- stale since this same PR added the login (OAuth sign-in) mode.
  • The thrown error when Sign-In is still required after the polling window advised "sign in on the host and re-run" unconditionally -- wrong advice under the default login mode, where the host doesn't need to be signed in at all. Made the message mode-aware, and tightened its ~/.posit/assistant reference to the actual token store path (~/.posit/assistant/store/data.json) for consistency with the rest of this PR's narrowing.

Recommendation 4 (manual copy-mode verification run) is still open -- noting it here as a pre-merge step rather than resolving it as a code change.

Actions Taken

  • Fixed the stale whole-tree-copy comment in fixtures/sandbox-setup.ts.
  • Fixed the plural "sign-in modes" wording in tests/auth.setup.ts.
  • Dropped the vestigial export on POSITAI_DIR_RELATIVE in utils/auth.ts.
  • Generalized the stale "only auth path" comment and made the Sign-In-required error message mode-aware (and file-precise) in actions/chat_pane.actions.ts.
  • Skipped: TOCTOU error-message polish and status-file rejection-warning field-naming (both low severity, already loud/diagnosable).
  • Open: one recommended manual verification run with PW_SANDBOX_POSITAI_AUTH=copy before merge (not yet performed).

All fixes verified with tsc --noEmit (no ESLint config in e2e/rstudio).

@ronblum

ronblum commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up review for commit f2f83fcdff ("Make copy the default Posit AI auth mode instead of login"), which flips the PW_SANDBOX_POSITAI_AUTH default from login to copy.

Review

Reviewed with three agents (code-reviewer, comment-analyzer, silent-failure-hunter), each scoped strictly to the default-flip commit and asked to sweep the whole e2e/rstudio/ tree for stale "login is the default" claims.

All three agreed: the five files the commit touched are internally consistent and correct (the ?? 'copy' default, the reordered mode docstring, the reworded skip reasons, the README prose/table/env-var rows, and .env.example). No CI/workflow depends on the old default. No true silent failure was introduced -- every newly-default-reachable path still records a status and logs, and nothing runs against a half-provisioned sandbox.

The findings were all fallout the commit didn't sweep up -- messages and comments written when login was the default that the flip turned stale:

  1. actions/chat_pane.actions.ts sign-in error: routed the user by "If PW_SANDBOX_POSITAI_AUTH=copy, ... otherwise check POSIT_EMAIL/POSIT_PASSWORD". A first-time user in the new default (variable unset) textually matches the "otherwise" branch and gets sent to the wrong fix (credentials that copy mode ignores). Flagged by all three agents; the highest-impact finding since it's a runtime message users act on.
  2. actions/chat_pane.actions.ts docstring and fixtures/sandbox-setup.ts comment: both still said "sign-in flow by default", the exact inverse of the new behavior.
  3. tests/auth.setup.ts skip reasons (host-not-signed-in and copy-suppressed): both asserted "PW_SANDBOX_POSITAI_AUTH=copy" as if explicitly set, when it is now the default a first-time user never chose, and neither named the login escape hatch. These are now the default first-run outcomes on an unsigned-in or kill-switch-set host.
  4. Copy branch: POSIT_EMAIL/POSIT_PASSWORD set but silently ignored under the new default (pre-flip, those alone drove sign-in). The file already logs the mirror case (kill-switch under login), so a symmetric log line was warranted.
  5. Two documentation-clarity notes: the kill-switch docstring in sandbox-setup.ts and the kill-switch row in the README env-var table now suppress the default path, worth stating.

Assessment

Took all findings. Rationale: the flip is a semantics change these files narrate, and every finding was either a factual inversion, a message that now misleads on a default path, or a small clarity add -- all message-level, zero dispatch-logic changes. Skipped nothing. The shared fix pattern for the runtime messages: distinguish "copy because you set it" from "copy because it's the default", and always name the login alternative.

Actions Taken

  • Rerouted the chat_pane.actions.ts sign-in error to key on the effective mode ("In copy mode (the default; PW_SANDBOX_POSITAI_AUTH unset or =copy), sign in on the host ...; if PW_SANDBOX_POSITAI_AUTH=login, check POSIT_EMAIL/POSIT_PASSWORD ...").
  • Inverted the stale "sign-in flow by default" docstring in chat_pane.actions.ts and comment in sandbox-setup.ts to describe the host-copy default with login as the alternative.
  • Reworded the host-not-signed-in and copy-suppressed skip reasons in auth.setup.ts to say "copy (the default)" and to name the login remedy; matching tweak to the host-not-signed-in console log.
  • Added a log line in the copy branch noting when POSIT_EMAIL/POSIT_PASSWORD are set but ignored, mirroring the existing kill-switch-under-login log.
  • Noted the default-path consequence in the sandbox-setup.ts kill-switch docstring and the README PW_SANDBOX_NO_SEED_CREDENTIALS row.

Committed as fa08c636d9. Verified with tsc --noEmit (no ESLint config in e2e/rstudio). The earlier recommendation still open from the prior review cycle -- one manual run with PW_SANDBOX_POSITAI_AUTH=copy (host signed in) to confirm a token-store-only sandbox authenticates -- remains a pre-merge step.

@ronblum

ronblum commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Review

Four review agents (code-reviewer, silent-failure-hunter, comment-analyzer, type-design-analyzer) covered the full PR diff against main. No critical or important correctness bugs surfaced in the shipping logic -- the credential-source auto-detection, the scrub, the SIGTERM handler, and the OAuth device-flow login all held up under scrutiny (including cross-checking the SIGINT/SIGTERM claims against the installed Playwright runner source). Findings below.

code-reviewer (no critical/important; 2 suggestions)

  1. Stale "mode=off" wording in ai-credentials.ts comments, left over from the removed environment-variable mode selector.
  2. Server-mode aiAuth signed-out home creation can race under --workers=N (safe under the default of one worker).

silent-failure-hunter (nothing critical)

  1. Setting only one of POSIT_EMAIL/POSIT_PASSWORD silently falls back to copy/skip mode, and the skip message wrongly claims both are unset.
  2. The aiAuth signed-out declaration is silently ignored when tests run against an external server URL -- no error, warning, or skip.
  3. An expired local token store is reported as "not signed in locally," which points the user at the wrong fix.
  4. readAuthStore returns null silently for valid JSON that isn't an object, unlike its sibling checks which warn.
  5. In the sign-in flow, if both sub-steps fail, Promise.all can drop the second failure's diagnostics.
  6. The SIGTERM scrub runs only in the main process, so a worker mid-copy can still write credentials after the scrub pass.

comment-analyzer

  1. The fixture docstring and README both claimed aiAuth could be set at describe level; it's worker-scoped, so Playwright rejects that with a load error.
  2. Same "mode=off" stale wording as code-reviewer's finding 1.
  3. A claim that direct launchRStudio() calls "never see" the auth state was not literally true inside a worker that had declared aiAuth.
  4. The README drifts between "the setup project" and "the auth.setup project" naming.

type-design-analyzer (rated the overall design strong)

  1. PositAiAuthStatus is a flat type that permits nonsense source/outcome pairs; a discriminated union would forbid them.
  2. oauthAuth.expiresAt is checked as a non-empty string but never validated as a parseable date (minor -- that field is passthrough).
  3. The same server-mode variant-creation race as code-reviewer's finding 2 -- two parallel server workers can collide on the same temp path.
  4. The "home dir name must start with user-home" rule is enforced only by a comment, not a shared constant.

Assessment

Five findings were taken, all small and independently verified against the code before fixing:

  1. Describe-level aiAuth doc error (comment-analyzer finding 1) -- confirmed: the fixture docstring and README described an API usage that fails at load time.
  2. "mode=off" stale wording (code-reviewer finding 1 / comment-analyzer finding 2) -- confirmed leftover from the removed mode-selector design.
  3. Partial POSIT credentials silently fall back (silent-failure-hunter finding 1) -- confirmed; fails loud now instead of silently mis-skipping.
  4. External-server aiAuth silently ignored (silent-failure-hunter finding 2) -- confirmed; now throws instead of running a signed-out test against a server whose credentials the harness doesn't control.
  5. Server-mode variant-creation race (code-reviewer finding 2 / type-design-analyzer finding 3) -- confirmed; fixed with a pid-tagged temp path and treating a lost rename as another worker's win, rather than an error.

While in auth.ts for finding 5, I also fixed silent-failure-hunter's finding 4 (readAuthStore now warns on valid-JSON-but-not-an-object, matching its sibling checks) since it was a one-line, no-risk consistency fix in code already being touched.

The remaining findings were skipped as genuinely low-value for this harness: the discriminated-union status type and the expiresAt date check guard against states only in-repo code can produce; the dropped second-rejection diagnostics and the SIGTERM-vs-mid-copy race are both narrow, best-effort edges without cheap tight fixes; the "never see the auth state" wording and the setup/auth.setup naming drift are minor polish; and the expired-token message, while imprecise, isn't clearly wrong.

Actions Taken

  1. Fixed the aiAuth describe-level documentation error in the fixture docstring and the README to say file-level only.
  2. Replaced the stale "mode=off" wording in both ai-credentials.ts comments with the real source/outcome vocabulary.
  3. Added a fail-loud check in auth.setup.ts for exactly one of POSIT_EMAIL/POSIT_PASSWORD being set.
  4. Added a guard in server.fixture.ts that throws when aiAuth requests a signed-out provider against an external server URL.
  5. Fixed the server-mode variant-creation race in auth.ts with a pid-tagged temp path and lost-race handling.
  6. Fixed readAuthStore in auth.ts to warn (rather than silently return null) when a token store parses to non-object JSON.

Typechecked clean (tsc --noEmit) after all six changes.

@ronblum
ronblum marked this pull request as ready for review July 20, 2026 16:44
@ronblum

ronblum commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Review

Four specialized agents reviewed the diff (code quality, silent failures, comments/docs, test coverage), each scoped strictly to the PR diff. All four verdicts were approve, with no critical findings. Findings that survived verification:

Green-with-skips cluster (flagged independently by two agents). The deterministic/transient boundary is drawn by response shape and login step, not by root cause, and nothing consumes the auth status file as a failure. So a deterministic auth breakage (a moved endpoint, a dead authorize button, a malformed configured email) surfaces as a skip and the run stays green. Today CI has no credentials, so green-with-skips is the intended state; the risk goes live only once credentials are wired into CI.

Hardening.

  1. scrubCredentials() in utils/auth.ts is a security control whose failure mode is silent by construction; its ENOENT-on-a-deleted-sandbox path produced a false "credentials left behind" alarm.
  2. The SIGTERM handler registered after the Copilot credential copy, leaving a brief window where copied tokens sat unprotected.
  3. The authorize-step diagnosis lived only in a console warning; the eventual skip reason named only the symptom (a generic poll timeout).
  4. Two read-error warnings omitted the file path that sibling warnings include.

Comment and doc accuracy.

  1. A comment claimed launches outside the fixture "never see" the stripped auth state, but a direct launch in a stripped worker does inherit it.
  2. A README table cell reported the wrong skip reason when the seed kill-switch is set.
  3. Stale "either side of the store migration" wording implied a second store location that no longer exists.
  4. Minor: a flat scrub guarantee the code hedges, a soft --retries promise, a missing-file case absent from a verification message, a duplicated sentence, a stranded comment wrap.

Deferred (not addressed here). Unit specs for the credential scrub, the OAuth classifier, the status-file round-trip, and the aiAuth signed-out plumbing (which has no consumer yet). These are new test authorship rather than review fixes.

Assessment

Every finding was verified in context before deciding. Nothing blocked merge.

Taken:

  1. The green-with-skips cluster is the one risk worth neutralizing now, before credentials reach CI. Rather than re-drawing the classification boundary (a deliberate, documented design choice), the fix is an opt-in strict switch that fails the run whenever the setup ends without credentials. Cheap now, and it covers the whole cluster at once.
  2. The four hardening items and the comment/doc corrections are all small, verified, and real.

Skipped, as documented design judgments:

  1. A 4xx with a non-JSON body staying transient (a WAF page is not reliably deterministic; strict mode covers CI).
  2. A malformed configured email skipping rather than failing (making that step fatal would fail the run on genuinely flaky page loads).
  3. The fatal password step coupling the suite to a third-party page (the reviewer's own recommendation was no change).

Deferred: the test-authorship items above, as follow-up.

Actions Taken

Commit 180f00b (8 files, all under e2e/rstudio/):

  1. Added PW_AI_AUTH_STRICT (off by default, parsed like the existing seed kill-switch). When set, the setup project fails the run instead of returning when it ends without Posit AI credentials. Governs Posit AI only for now. Documented in README.md and .env.example.
  2. scrubCredentials() treats an absent sandbox as nothing to scrub (no false alarm).
  3. Moved the SIGTERM handler registration ahead of the Copilot copy, closing the unprotected window.
  4. Threaded the authorize-step diagnosis into the login-failed skip reason.
  5. Added the file path to the two read-error warnings.
  6. Corrected the fixture auth-state comment, the README skip-reason cell, the store-migration wording, and the smaller comment/doc items above; added a note on the "leave credentials set means a live sign-in every run" cost and a doc note on the template-vs-launch-home gate.

Verification: tsc --noEmit passes clean. No behavior change on the default (credential-less) CI run, since the strict switch defaults to off.

@ronblum ronblum changed the title Add Playwright auth setup project for Posit AI device flow Add Playwright auth setup project for Posit AI credentials Jul 20, 2026
@ronblum

ronblum commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Local verification

Exercised the auth setup end to end in installed-desktop mode on macOS against RStudio 2026.07.1+147.pro6, covering all three credential sources, both default and strict (PW_AI_AUTH_STRICT) modes, single- and multi-file. "G" = chat-guardrails.test.ts (11 tests, 1 self-skip); "AC" = autocomplete.test.ts (20 tests, not AI-gated).

Single-file (G)

Run Creds Local login Kill-switch Strict Source Setup Result
1 set n/a off off Sign-in signed in 11 passed, 1 skipped
2a unset expired off off Copy then skip skip 11 skipped, 1 passed
2b unset valid off off Copy copied 11 passed, 1 skipped
3 unset valid on off Skip skip 11 skipped, 1 passed
4 set n/a off on Sign-in signed in 11 passed, 1 skipped
5 unset valid off on Copy copied 11 passed, 1 skipped
6 unset valid on on none failed 1 failed, 11 did not run

Multi-file (G + AC)

Run Creds Local login Kill-switch Strict Source Setup Result
7 unset valid on on none failed 1 failed, 31 did not run
8 set n/a off on Sign-in signed in 31 passed, 1 skipped
9 unset valid off off Copy copied 31 passed, 1 skipped

What each run established

  • Runs 1, 2b, 3: the three credential sources auto-detect correctly (sign-in, copy, skip).
  • Run 2a: the expiry check works live. An expired local token is refused and falls through to skip rather than being copied as a dead token.
  • Runs 4, 5: strict mode is inert when any source succeeds (both sign-in and copy).
  • Run 6: strict mode fires on an unprovisioned run. The setup fails and the dependent tests are blocked instead of skipping green.
  • Runs 7 vs 8/9: blast radius. Under strict, a failed setup blocks the entire selection (31 tests across two files, AI-gated or not); when a source provisions, all 31 run.

No behavior change on the default (credential-less) path, which is CI's current state: strict defaults to off, so the tests still skip cleanly. Strict only turns an unprovisioned run red once it is explicitly enabled (the intended use once credentials are wired into CI).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants