Skip to content

e2e: consolidate R package provisioning in the os-e2e-deps action - #18489

Closed
kevinushey wants to merge 5 commits into
mainfrom
test/e2e-rlibs-consolidation
Closed

kevinushey wants to merge 5 commits into
mainfrom
test/e2e-rlibs-consolidation

Conversation

@kevinushey

Copy link
Copy Markdown
Collaborator

Addresses #18488.

Stacked on #18487 (base branch); GitHub will retarget this to main when that merges. The diff shown here is just the consolidation.

What changes

The os-e2e-deps action now owns the whole provisioning contract. install-required-packages defaults to "true", and the action exports PW_RSTUDIO_R_LIBS_USER (pointing at its r-libs-user input) to GITHUB_ENV itself, the same way it already exports PLAYWRIGHT_BROWSERS_PATH. The export is skipped when the caller already defines the variable (a job-level override wins) or opts out of the install. It is no longer possible to configure the install without the lookup or vice versa -- the half-configured states behind #18390 and the pr-18449 Windows CRAN-outage hangs.

With the action owning both halves, the per-workflow wiring is deleted:

  • Windows main + Windows autocomplete-scheduled: the PW_RSTUDIO_R_LIBS_USER job env and the explicit flag are gone.
  • macOS x3: same (the cache-scope inputs stay -- they encode real ABI boundaries).
  • Linux desktop: the conditional PW_RSTUDIO_R_LIBS_USER expression on the test step is gone. The per-engine preinstall_r_packages pass-through stays as the escape hatch: an engine passing an empty value still opts out of both halves (a provided-but-empty input does not take the action default).

The Linux Server workflow provisions the test user's library instead of a root-owned system library. rserver rebuilds each rsession's environment from scratch (#18348), so no env var from the job can reach the sessions -- only R's own default user library path can. After os-e2e-deps populates the workspace R-libs tree, a new step expands the per-run test user's R_LIBS_USER template (~/R/%p-library/%v, resolved the same way r-libs-setup.ts does), copies the tree there, and chowns it. Sessions then resolve every required package with zero test-time installs, and because the user owns the copy, uninstall-flow tests (missing_packages_banner's remove.packages) work -- which the root-owned seed this replaces could never allow. A real copy rather than a hardlink clone: chown on hardlinks would flip the owner of the runner's cached tree too (shared inodes).

The retired seed's curated list is folded into the single manifest: readr is genuinely used (import_dataset.test.ts) and moves into required-packages.txt; tidyverse is referenced by no test and is dropped. Note the DBI uninstall test (s4_unloaded_package) is @desktop_only, so nothing on server uninstalls anything seeded.

Notes

  • Net -33 lines, despite the new server step.
  • Server's R-library cache key gains the -req<hash> suffix (it now carries the required set); restore-keys bridges from the old key, and the scheduled main runs save the new one.
  • The sudo -H -u expansion relies on sudo's env_reset keeping the job's R_LIBS_USER out of the child environment so R's own default template is what expands; a guard fails the step if the resolved path lands outside the user's home.
  • Verified: YAML parses; actionlint finding counts identical to main on every touched workflow (the new server step contributes none); the expansion one-liner tested locally with the template both set and unset.
  • Out of scope (per e2e: consolidate R package provisioning across runner workflows #18488): packageRepo() in r-libs-setup.ts and the per-test ensurePackageInstalled still point at cran.r-project.org; with the library pre-populated everywhere these reduce to presence checks.

The Windows and macOS e2e workflows never passed install-required-packages
to the os-e2e-deps action, so the harness's REQUIRED_PACKAGES set (DBI,
shinytest2, rmarkdown, ...) was installed from cran.r-project.org at test
time on every run: by globalSetup when it could, and by per-test
ensurePackages self-healing when it could not. During a CRAN outage those
installs hang mid-suite (s4_unloaded_package, shinytest2 in the pr-18449
all-platforms run) instead of failing fast.

Pass install-required-packages to the deps action on every desktop engine,
matching Linux (PR #18390), so the set is installed from PPM into the cached
R library before tests and a warm cache installs nothing at all. The macOS
workflows and the scheduled Windows autocomplete workflow also gain the
PW_RSTUDIO_R_LIBS_USER wiring that points globalSetup at that same library
(the main Windows workflow already had it).

The Linux Server workflow deliberately keeps its own system-library seed:
its sessions run as a per-run user, and tests that exercise uninstall flows
(fortunes, DBI) cannot remove packages from a root-owned library.
Getting the harness's required R packages installed where the session can
see them previously took a hand-wired pair in every workflow -- the
install-required-packages input plus a PW_RSTUDIO_R_LIBS_USER env var
pointing at the same path -- and configuring one without the other silently
degraded to test-time installs from cran.r-project.org (the failure class
behind #18390 and the pr-18449 Windows CRAN-outage hangs). The Linux Server
workflow had a third mechanism: a separately curated list seeded into a
root-owned system library, which uninstall-flow tests could never touch.

Make the os-e2e-deps action own the whole contract: default
install-required-packages to true and export PW_RSTUDIO_R_LIBS_USER from
the action itself (skipped when the caller defines it or opts out), then
delete the per-workflow wiring on Windows, macOS, and Linux desktop. The
Linux engines keep their per-engine escape hatch (an empty value still
opts out).

The server workflow now copies the action-populated library into the
per-run test user's default user library (~/R/%p-library/%v) and chowns
it: rserver rebuilds each session's environment from scratch (#18348), so
only R's own default path can reach the rsessions. Sessions get every
package read-write, so uninstall-flow tests (missing_packages_banner)
keep working, and the system-library seed is retired. Of its curated
list, readr is genuinely used (import_dataset.test.ts) and moves into
required-packages.txt; tidyverse is referenced by no test and is dropped.

Addresses #18488.
@kevinushey kevinushey added this to the 2026.09 (Autumn Hawkbit) milestone Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

11 test(s) failed

###################- 99% pass rate

Passed Failed Skipped Flaky
2029 11 365 6
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 8 0
✅ desktop-linux 502 0 90 1
✅ desktop-macos 506 0 86 2
❌ desktop-windows 507 11 79 2
✅ server-linux 490 0 94 1
✅ setup 22 0 8 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 849c42d884e44316b4e7cd651619c58f2bf0ec3e - Run #506

@kevinushey
kevinushey requested a review from gtritchie August 10, 2026 19:52
- scope the provision-step chown to the resolved USER_LIB rather than a
  hardcoded ~/R, so the guard and the ownership handover stay in lockstep
- fail the provision step with names when required packages are missing
  from the test user library, instead of echoing an unasserted count
- pin the action's install step to R_LIBS_USER = the r-libs-user input,
  so the install can't diverge from the cache path and exported lookup
- drop tidyverse from e2e/rstudio/DESCRIPTION (referenced by no test;
  the components tests use come via required-packages.txt)
Base automatically changed from test/e2e-preinstall-required-packages to main August 10, 2026 20:38
…idation

# Conflicts:
#	.github/actions/os-e2e-deps/action.yml
Restores tidyverse in the e2e DESCRIPTION (dropped in the previous
review commit) and adds it to required-packages.txt, so globalSetup's
presence check covers it and CI preinstalls it into the cached library.
@gtritchie

Copy link
Copy Markdown
Member

Code review findings

Actionable items from an automated review.

Suggestions

  1. .github/workflows/os-test-e2e-rstudio-desktop-os-macos-14-arm64.yml:377 (same in os-macos-15-x86_64.yml:354, os-macos-26-arm64.yml:343, os-autocomplete-scheduled-windows-server-2025.yml:90) — these four workflows still set a job-level PW_RSTUDIO_R_LIBS_USER, the exact duplicate config this PR removes from os-windows-server-2025.yml, and it now contradicts the comment added directly above it ("os-e2e-deps ... exports PW_RSTUDIO_R_LIBS_USER"). The action's guard ([ -z "${PW_RSTUDIO_R_LIBS_USER:-}" ]) skips its own export when the job env defines it, so the two copies must be kept in sync by hand: change r-libs-user in one of these callers and the stale job-level override wins, pointing globalSetup at an unpopulated library and reintroducing the test-time installs of e2e: consolidate R package provisioning across runner workflows #18488. Fix: drop the job-level PW_RSTUDIO_R_LIBS_USER from these four workflows and let the action own the export.

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One suggestion posted.

kevinushey added a commit that referenced this pull request Aug 10, 2026
…18489

commit 849c42d
Author: Kevin Ushey <[email protected]>
Date:   Mon Aug 10 13:43:21 2026 -0700

    keep tidyverse; add it to required-packages.txt

    Restores tidyverse in the e2e DESCRIPTION (dropped in the previous
    review commit) and adds it to required-packages.txt, so globalSetup's
    presence check covers it and CI preinstalls it into the cached library.

commit 5bd28d4
Merge: 0e36677 aebb191
Author: Kevin Ushey <[email protected]>
Date:   Mon Aug 10 13:42:52 2026 -0700

    Merge remote-tracking branch 'origin/main' into test/e2e-rlibs-consolidation

    # Conflicts:
    #	.github/actions/os-e2e-deps/action.yml

commit 0e36677
Author: Kevin Ushey <[email protected]>
Date:   Mon Aug 10 13:32:26 2026 -0700

    address review feedback

    - scope the provision-step chown to the resolved USER_LIB rather than a
      hardcoded ~/R, so the guard and the ownership handover stay in lockstep
    - fail the provision step with names when required packages are missing
      from the test user library, instead of echoing an unasserted count
    - pin the action's install step to R_LIBS_USER = the r-libs-user input,
      so the install can't diverge from the cache path and exported lookup
    - drop tidyverse from e2e/rstudio/DESCRIPTION (referenced by no test;
      the components tests use come via required-packages.txt)

commit 6d2dcf3
Author: Kevin Ushey <[email protected]>
Date:   Fri Aug 7 17:10:38 2026 -0700

    e2e: consolidate R package provisioning in the os-e2e-deps action

    Getting the harness's required R packages installed where the session can
    see them previously took a hand-wired pair in every workflow -- the
    install-required-packages input plus a PW_RSTUDIO_R_LIBS_USER env var
    pointing at the same path -- and configuring one without the other silently
    degraded to test-time installs from cran.r-project.org (the failure class
    behind #18390 and the pr-18449 Windows CRAN-outage hangs). The Linux Server
    workflow had a third mechanism: a separately curated list seeded into a
    root-owned system library, which uninstall-flow tests could never touch.

    Make the os-e2e-deps action own the whole contract: default
    install-required-packages to true and export PW_RSTUDIO_R_LIBS_USER from
    the action itself (skipped when the caller defines it or opts out), then
    delete the per-workflow wiring on Windows, macOS, and Linux desktop. The
    Linux engines keep their per-engine escape hatch (an empty value still
    opts out).

    The server workflow now copies the action-populated library into the
    per-run test user's default user library (~/R/%p-library/%v) and chowns
    it: rserver rebuilds each session's environment from scratch (#18348), so
    only R's own default path can reach the rsessions. Sessions get every
    package read-write, so uninstall-flow tests (missing_packages_banner)
    keep working, and the system-library seed is retired. Of its curated
    list, readr is genuinely used (import_dataset.test.ts) and moves into
    required-packages.txt; tidyverse is referenced by no test and is dropped.

    Addresses #18488.

commit 02d8c6e
Author: Kevin Ushey <[email protected]>
Date:   Fri Aug 7 16:41:44 2026 -0700

    e2e: pre-install required R packages on the windows and macos runners

    The Windows and macOS e2e workflows never passed install-required-packages
    to the os-e2e-deps action, so the harness's REQUIRED_PACKAGES set (DBI,
    shinytest2, rmarkdown, ...) was installed from cran.r-project.org at test
    time on every run: by globalSetup when it could, and by per-test
    ensurePackages self-healing when it could not. During a CRAN outage those
    installs hang mid-suite (s4_unloaded_package, shinytest2 in the pr-18449
    all-platforms run) instead of failing fast.

    Pass install-required-packages to the deps action on every desktop engine,
    matching Linux (PR #18390), so the set is installed from PPM into the cached
    R library before tests and a warm cache installs nothing at all. The macOS
    workflows and the scheduled Windows autocomplete workflow also gain the
    PW_RSTUDIO_R_LIBS_USER wiring that points globalSetup at that same library
    (the main Windows workflow already had it).

    The Linux Server workflow deliberately keeps its own system-library seed:
    its sessions run as a per-run user, and tests that exercise uninstall flows
    (fortunes, DBI) cannot remove packages from a root-owned library.
@kevinushey kevinushey closed this Aug 10, 2026
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.

2 participants