Skip to content

Server-mode Playwright fixture writes session state into the sandbox seed directory #18446

Closed

Description

@ronblum

System details

RStudio Edition : Server (in-tree rserver-dev spawned by the Playwright fixture)
RStudio Version : 2026.07.999-dev+999 (local dev build from 2026-07-27)
OS Version      : macOS 26.6
R Version       : 4.6.1

The fixture code is current main. The binary is an older local dev build, which
is incidental here: the problem is in the TypeScript fixture rather than in
anything the session does, and the reproduction does not depend on the binary's
version.

Steps to reproduce the problem

Running the Playwright e2e suite in Server mode against the spawned in-tree rserver-dev (that is, with PW_RSTUDIO_SERVER_URL unset), from e2e/rstudio/:

  1. Run the sandbox layout tests.

     npm run test:server-dev -- tests/sandbox.test.ts
    
    • The test "Server R workdir uses workdir_ prefix; no config trees written locally" fails on expect(dataHomeEntries.length).toBe(0), receiving 21.
  2. Open the preserved sandbox directory printed at the end of the run and list data-home.

    • It holds rsession state written during the run: sessions, client-state, history_database, log, monitored, notebooks, persistent-state, sources, and others.

Describe the problem in detail

The sandbox-level data-home is a seed source rather than a session data home. fixtures/sandbox-setup.ts creates it and copies the Posit Assistant build into data-home/pai when PW_SEED_PAI is set. The Desktop fixture says so directly at fixtures/desktop.fixture.ts:33-37 and never uses it as RSTUDIO_DATA_HOME: each Desktop launch gets its own data home under a config_* root, with data-home/pai symlinked in.

The Server fixture instead points RSTUDIO_DATA_HOME straight at that seed directory (fixtures/server.fixture.ts:30 and :185), so every spawned server session writes its state into it.

Two consequences beyond the failing assertion. The seed directory accumulates session state from every server run. And because the path is shared rather than per worker, parallel server workers write to one data home, so they lack the isolation the Desktop fixture provides.

This appears to date from the fixture change rather than the test. The assertion arrived 2026-05-17 in 0c10ad1 (#17631), when the Server fixture did not set RSTUDIO_DATA_HOME. Two days later 2877a98 (#17691) added it pointing at the sandbox data-home, and the test was not updated. Both are still on main, so the test has been failing in Server mode since then. Server mode is exercised less often than Desktop, which is likely why it went unnoticed.

One coupling worth knowing about before changing this. Server mode never calls seedPaiIntoDataHome -- that function is private to desktop.fixture.ts (declared at :315, referenced only at :268 and :423). Server sessions currently find the seeded Posit Assistant at RSTUDIO_DATA_HOME/pai only because they are pointed at the directory that contains it. Giving the Server fixture its own data home would drop that seeding unless the symlink step is added at the same time.

Describe the behavior you expected

The spawned server's RSTUDIO_DATA_HOME would ideally be a per-worker directory, leaving the sandbox-level data-home untouched as the seed source, the way the Desktop fixture already works. The serverRoot temporary directory the fixture creates for config-home looks like a natural place for it.

Activity

  1. self-assigned this
    on Aug 5, 2026
  2. added
    new
    on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

automationbugnew

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions