Skip to content

Scrub license files from sandbox and add an optional globalSetup extension - #18856

Merged
ronblum merged 2 commits into
mainfrom
test/ron/e2e-scrub-license-files
Sep 16, 2026
Merged

ronblum merged 2 commits into
mainfrom
test/ron/e2e-scrub-license-files

Conversation

@ronblum

@ronblum ronblum commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

scrubCredentials() removes every provider's credential material from each sandbox user-home* before a sandbox is left on disk, so a preserved sandbox never carries real tokens. This adds .lic files under each home's license directory to the same sweep, using the existing remove closure so a file that can't be deleted surfaces in the same warning as a credential that can't.

Also adds an optional extension point to globalSetup. If utils/license resolves, it's called to prepare sandbox state ahead of the warmup launch; it isn't present here, so nothing happens. This lets a downstream copy of this directory add its own setup step without modifying a file that merges from here.

@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:11 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:11 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:12 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:12 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:17 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:17 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:20 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:20 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:20 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:20 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 16, 2026 23:20 — with GitHub Actions Active
@ronblum ronblum changed the title Scrub license files from the sandbox alongside credentials Scrub license files from sandbox and add an optional globalSetup extension Sep 16, 2026
@ronblum

ronblum commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Review

Two review cycles, each with two agents scoped to that cycle's diff.

Cycle 1, the scrub change in utils/auth.ts.

  1. Both agents: the bare catch { return; } around readdirSync swallows every error class, not just a missing directory. An unreadable directory returns normally, failures stays empty, and teardown then prints "credentials scrubbed" over a file still on disk.
  2. Both agents: the .lic match is case-sensitive, while the product's own check lowercases the extension first.
  3. Both agents: the one-line comment restates the function name and records none of the decisions behind it.
  4. Code reviewer: the scrubCredentials doc comment no longer describes everything the function removes.
  5. Silent-failure reviewer: queried whether the license really lives in that directory, which it could not verify from this repository.
  6. Code reviewer, noted as not a defect: the Windows branch is inert here, because the settings path resolves from a known folder and ignores the redirected home.
  7. Pre-existing: no unit test covers scrubCredentials.

Cycle 2, the globalSetup extension.

  1. Both agents: the existence probe and the load used different resolvers. fs.existsSync tested a .ts path while require resolves .js, .json, and .node ahead of the hook-registered .ts, so the two can disagree in both directions. Verified by running the pinned Playwright version against a scratch reproduction.
  2. Both agents: the call was not awaited. If the module is ever async, globalSetup returns while its work is in flight, and a rejection kills the runner outright since the only unhandledRejection handler lives in the worker process.
  3. Both agents: userHome already exists in scope and the new code recomputed the same literal.
  4. Silent-failure reviewer: nothing was logged either way, making this the only step in globalSetup that can do nothing without leaving a trace.
  5. Silent-failure reviewer: proposed a strictness variable so a downstream run can require the extension, following the precedents set by PW_ENV_FILE, PW_SANDBOX_ROOT_CREATE, and PW_AI_AUTH_STRICT.
  6. Silent-failure reviewer: require() returns any, so the call site has no type checking.
  7. Code reviewer confirmed __dirname is reliable here, the relative specifier is correct where a path alias would typecheck and fail at runtime, and placement ahead of the warmup launch is right.

Both agents independently checked that an unguarded require which throws aborts the run cleanly, with teardown still executing, so no try/catch is needed around the call itself.

Assessment

Taken:

  1. The error discrimination. Genuine, and inconsistent with the same function's own handling a few lines below, which already separates a missing directory from everything else.
  2. Case-insensitive matching. Low likelihood, since the installer always writes lowercase, but it is one call on a safety net.
  3. The doc comment, reworded.
  4. require.resolve. The likelihood of a resolver disagreement is low here, since compiled output goes to dist. It is worth taking anyway because it is strictly better at the same size: one question instead of two that can diverge, no duplicated path literal, and it enables the error discrimination in the same expression.
  5. await. Free today, and closes a failure mode that would present as the runner vanishing with no reporter output.
  6. userHome reused rather than recomputed.
  7. A log line, but only when the extension fires. Logging both branches would print a line on every run here about something that is never expected to be present.

Skipped:

  1. The comment rewrite. Deliberately terse.
  2. The strictness variable. The argument is sound, but all three precedents guard user-supplied configuration, whereas this would guard a file move. The same protection can sit downstream, where it costs nothing here.
  3. The signature comment. The contract belongs with the module, not in a file that cannot enforce it.
  4. The unit test. Pre-existing, and this suite does not unit-test its utilities.

Resolved without action: the directory question in cycle 1, item 5. The other agent verified it against the product source, and a direct check confirmed the path resolves under the redirected home.

Actions Taken

  1. removeLicenseFiles now returns string | null. A missing directory returns null; any other error returns a message that the caller pushes into failures, so it reaches the existing loud-warning path.
  2. The extension match lowercases before comparing.
  3. The scrubCredentials doc comment mentions license files.
  4. The extension point now resolves with require.resolve, rethrows anything that is not MODULE_NOT_FOUND, logs the resolved path when it fires, awaits the call, and passes the existing userHome.

@ronblum ronblum self-assigned this Sep 16, 2026
@ronblum
ronblum merged commit 73b06ee into main Sep 16, 2026
6 of 11 checks passed
@ronblum
ronblum deleted the test/ron/e2e-scrub-license-files branch September 16, 2026 23:47
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:30 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:30 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:34 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:34 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:39 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:39 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:41 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:41 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:41 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:41 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:41 — with GitHub Actions Active
@ronblum
ronblum deployed to e2e-playwright September 17, 2026 00:41 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
3014 0 187 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 757 0 38 1
✅ desktop-macos 764 0 33 0
✅ desktop-windows 759 0 42 1
✅ server-linux 704 0 44 0
✅ setup 28 0 20 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 7a18dcfb27b2086aeaacab90eab612c99ee26dbb - Run #1058

This branch was successfully deployed

1 active deployment
e2e-playwright — 7a18dcfb Deployed Sep 17, 2026 by ronblum via windows / e2e-desktop-windows (3) #1058
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.

1 participant