Repository navigation
Add per-invocation sandbox for Playwright test isolation - #17631
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
ReviewAutomated review (claude-code, job 80) against c024ed5 surfaced six findings:
Assessment
Actions Taken
All in commit 8a8b22e. |
|
Addresses #17584. |
|
New commit 2797858. Adds a |
2797858 to
3eaf158
Compare
…rootExpr, tighten sandbox test asserts, sweep README for wonky terms
ReviewBundled four findings (1 Medium, 3 Low): Finding 1 (Medium) -- Finding 2 (Low) -- Finding 3 (Low) -- Finding 4 (Low) -- AssessmentInitial calibration skipped Findings 3 and 4 as "premature future-proofing" because I read the README's documented limitation as scoping cross-filesystem Server to a future slice. Discussion clarified that remote-host Server is an actively-used configuration (via Verified Finding 1 by running a deliberately-failing test: confirmed Playwright's Settled on: take all four. Findings 3 and 4 conceptually couple -- both surface the runner-vs-rsession filesystem-mismatch case -- so the fix path for both was an adaptive Actions Taken
Verified the failure-detection mechanism end-to-end with a deliberately-failing test: sandbox is preserved with the Commit: |
…comment polish, tightened sandbox.test assertions
ReviewFour review agents in parallel (code quality, test coverage, silent failures, comment accuracy). Zero Critical findings, 7 Important, 25 Suggestions across the four reports. Highlights:
AssessmentCalibrated each finding in code context before recommending. Two general patterns: (1) The four pr-test-analyzer "Important" findings all want unit tests for fixture code -- but (2) The error-handling polish across silent-failure-hunter and code-reviewer is mostly cheap and high-value -- mostly TAKE. One finding was wrong: comment-analyzer flagged Final tally: 12 taken, 5 deferred, ~15 skipped (low-value polish, or already-accurate code). Actions TakenApplied in commit c1198ed across 7 files:
Deferred for a follow-up slice: add unit-test infrastructure to Skipped: misleading "worker-scoped" comment finding (original is accurate per |
ReviewThree Low-severity findings against commit aa02273 (the Copilot seed addition): Finding 1 (Low) -- Finding 2 (Low) -- Finding 3 (Low) -- AssessmentFinding 1: TAKE. One-line fix that matches the documented contract. Verified with Finding 2: DEFER. The reviewer themselves notes "defer if the next seed isn't imminent; otherwise extract." The Pro license seed slice (tracked separately) is the right moment to extract a Finding 3: SKIP. The "retry inherits half-copied creds" framing doesn't reflect how the sandbox works in practice: every Aside: the reviewer noted "This was raised in the prior review attempt and is unchanged" for Finding 1. None of the six prior PR comments reference Actions TakenApplied in commit f28e0f3:
Deferred to the Pro license seed slice: extract a Skipped: partial-copy cleanup on |
ReviewTwo Low findings against commit Finding 1 (Low) -- Finding 2 (Low) -- AssessmentBoth findings were tagged "raised in the prior review attempt and was not addressed." Verified against the PR's prior review history -- the framing is inaccurate for both:
The substance of both findings stands independent of the framing. Finding 1: TAKE. One-line consistency gap with the same pattern adopted in Finding 2: TAKE with the reviewer's second option (iterate over every Also flagged: the demo snippet shown in the README and the create-tests skill used Actions TakenApplied in commit
Verified with two scoped re-runs: |
Summary
Consolidates Playwright test artifacts under a single per-invocation sandbox directory. Previously the per-spec config trees, R workdir, Posit Assistant install, and PA auth lived in scattered tmp/user locations and cleanup was partial. Now a
globalSetuphook (fixtures/sandbox-setup.ts) creates onepw_sandbox_<runid>/pernpx playwright testinvocation, and everything routes under it: per-spec config trees, R workdir, Electron--user-data-dir,RSTUDIO_DATA_HOME, andHOME/USERPROFILE. The matchingglobalTeardownremoves the entire subtree at end of run; the sandbox is preserved on failure or withPW_SANDBOX_SKIP_CLEANUP=1.Directory tree
User-controlled env vars
All
PW_*vars are optional; defaults apply when unset.PW_SANDBOX_ROOTos.tmpdir().PW_SANDBOX_ROOT_CREATE"1"/"true"to mkdirPW_SANDBOX_ROOTif missing. Default fails loud on a missing parent so typos surface.PW_SANDBOX_SKIP_CLEANUP"1"/"true"to preserve the umbrella at end of run regardless of pass/fail (otherwise removed unless a test failed).PW_SANDBOX_SEED_POSITAI"1"/"true"to copy real~/.positai/intouser-home/.positai/so Posit Assistant tests start signed in.PW_SANDBOX_SEED_COPILOT"1"/"true"to copy real Copilot creds (%LOCALAPPDATA%\github-copilot\on Windows,~/.config/github-copilot/on POSIX) intouser-home/so Copilot tests start authenticated.PW_RSTUDIO_PREFS_OVERRIDEbase-prefs.jsoncintoconfig-home/rstudio-prefs.jsonper spawn.PW_SANDBOXis internal -- set by the globalSetup hook to the absolute umbrella path. Workers, the R workdir helper, and the globalTeardown all read it. Don't set it manually.Auto-set on rstudio spawn
Set by
desktop.fixture.tson each Desktop spawn. The user does not need to set these.RSTUDIO_CONFIG_ROOT$PW_SANDBOX/config_<rand>/RSTUDIO_CONFIG_HOME$PW_SANDBOX/config_<rand>/config-homeRSTUDIO_CONFIG_DIR$PW_SANDBOX/config_<rand>/config-dirRSTUDIO_DATA_HOME$PW_SANDBOX/data-home(shared)HOME(POSIX)$PW_SANDBOX/user-home(shared)USERPROFILE(Windows)$PW_SANDBOX/user-home(shared)--user-data-dir=...CLI arg$PW_SANDBOX/config_<rand>/electron-userdataNotable
globalSetuppre-createsuser-home/AppData/Roaming/anduser-home/AppData/Local/so Electron'sapp.getPath('appData')succeeds under the redirectedUSERPROFILE.useSuiteSandbox()no longer registers anafterAll-- workdirs survive until end-of-run.restore_source_documents: falsetobase-prefs.jsoncto prevent source-tab leakage between specs.tests/sandbox.test.tspasses Desktop unseeded and seeded; PA install behavior confirmed (unseeded = signed out, seeded = signed in); real~/.positai/unchanged in both runs. Server-mode verification deferred; the@server_onlygroup insandbox.test.tsis ready to run against a dev server.