Skip to content

test(cache): authenticate remote cache e2e uploads with a GitHub Actions stand-in - #809

Merged
wan9chi merged 1 commit into
remote-cache-e2e-blobsfrom
remote-cache-e2e-oidc
Nov 7, 2026
Merged

wan9chi merged 1 commit into
remote-cache-e2e-blobsfrom
remote-cache-e2e-oidc

Conversation

@wan9chi

@wan9chi wan9chi commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Motivation

Vite+'s Cloudflare remote cache only accepts uploads with a GitHub Actions OIDC token. The token has to come from a push to the registered repository's main branch, and its audience has to be the endpoint. The file backend accepted any upload, so the e2e cases never sent a token and never exercised the client's OIDC support from #798.

Changes

  • GitHub Actions stand-in. The backend process stands in for GitHub's token service. remote-cache-server run --github-actions runs a command as if in a job with id-token: write: it sets ACTIONS_ID_TOKEN_REQUEST_URL, and ACTIONS_ID_TOKEN_REQUEST_TOKEN defaults to main-push. The request token picks the workflow run the token is for: main-push or pull-request.
  • Write policy. Like the Worker, the file backend checks each store's token: its RS256 signature against the stand-in's key, its time bounds, its audience, and its claims. It answers other stores as the Worker does, with 401 Invalid credentials or 403 Write not permitted.
  • Uploading steps run with --github-actions. The only snapshot changes are those command lines.

Stacked on #808.

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to test tooling (remote-cache-server) and e2e fixtures; production cache client code is only invoked more realistically in tests.

Overview
Aligns the remote-cache test backend with production by requiring a GitHub Actions OIDC token on POST /store (401/403 otherwise), while fetch/read stays unauthenticated.

A new --github-actions flag on remote-cache-server run simulates a job with id-token: write (ACTIONS_ID_TOKEN_REQUEST_URL / default main-push request token). The daemon’s control server exposes a /token endpoint that mints RS256 JWTs; backend.ts verifies signature, time bounds, audience (endpoint), and push-to-main claims before accepting stores. E2E upload steps and snapshot command lines now pass --github-actions so tests exercise the client OIDC path.

Reviewed by Cursor Bugbot for commit a31b6bf. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.77%  [ -3.36% ..  +4.80%]  overhead   +61.04%
dynamic/access             change  -0.04%  [ -3.71% ..  +2.82%]  overhead   +21.03%
dynamic/access-relative    change  +0.26%  [ -2.88% ..  +3.52%]  overhead   +70.93%
dynamic/access-contended   change  +5.70%  [ -1.27% .. +10.85%]  overhead   +51.74%
static/launch              change  +0.43%  [ -4.18% ..  +4.87%]  overhead  +192.37%
static/access              change  -0.06%  [ -2.20% ..  +0.98%]  overhead +1436.85%
static/access-relative     change  -0.56%  [ -3.40% ..  +1.78%]  overhead +1923.70%
static/access-contended    change  +0.23%  [ -1.30% ..  +5.63%]  overhead +1917.05%

macos

dynamic/launch             change  +0.78%  [ -4.11% ..  +5.66%]  overhead  +251.55%
dynamic/access             change  -0.35%  [ -8.00% ..  +9.27%]  overhead    +2.55%
dynamic/access-relative    change  -2.55%  [-51.15% ..  +4.71%]  overhead  +250.13%
dynamic/access-contended   change  -2.23%  [-77.96% ..  +5.80%]  overhead    +3.61%

windows

dynamic/launch             change  -0.34%  [ -4.31% ..  +2.64%]  overhead   +25.90%
dynamic/access             change  +0.18%  [ -1.27% ..  +1.66%]  overhead    +1.82%
dynamic/access-relative    change  +0.00%  [ -1.40% ..  +1.80%]  overhead    +1.24%
dynamic/access-contended   change  -0.53%  [ -7.31% ..  +1.92%]  overhead    +1.60%

@wan9chi
wan9chi added this pull request to stack #812 October 5, 2026 05:59
@wan9chi
wan9chi removed this pull request from stack #812 October 6, 2026 02:42
@wan9chi
wan9chi added this pull request to stack #813 October 6, 2026 02:42
@wan9chi
wan9chi force-pushed the remote-cache-e2e-oidc branch from 35c8f21 to d9c05a8 Compare October 6, 2026 02:48
@wan9chi wan9chi added the remote cache Remote caching label Nov 4, 2026
…ons stand-in

The public cache service only accepts uploads with a GitHub Actions
OIDC token for a push to the registered repository's main branch, whose
audience is the endpoint. The test backend accepted any upload, so the
e2e cases never sent a token and never exercised the client's OIDC
support.

The backend process now stands in for GitHub's token service, and
`remote-cache-server run --github-actions` runs a command as if in a
GitHub Actions job with `id-token: write`. The request token picks the
workflow run that the token is for, a push to `main` by default. Like
the service, the backend checks the token's signature, time bounds,
audience, and claims, and answers other stores with `401 Invalid
credentials` or `403 Write not permitted`.

Every step that uploads now runs with `--github-actions`. The only
snapshot changes are those command lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the remote-cache-e2e-oidc branch from d9c05a8 to a31b6bf Compare November 7, 2026 10:01
@wan9chi
wan9chi removed this pull request from stack #813 November 7, 2026 10:41
@wan9chi
wan9chi added this pull request to stack #958 November 7, 2026 10:42
@wan9chi
wan9chi marked this pull request as ready for review November 7, 2026 11:02
@wan9chi
wan9chi merged commit 2761cfc into main Nov 7, 2026
23 checks passed
@wan9chi
wan9chi deleted the remote-cache-e2e-oidc branch November 7, 2026 11:15
wan9chi added a commit that referenced this pull request Nov 7, 2026
## Motivation

With the write policy in place from #809, the e2e cases can cover the
uploads Vite+'s Cloudflare remote cache rejects. A developer running
`--remote-cache=read-write` outside GitHub Actions, or a job for a pull
request, should still see their task succeed and be told why nothing was
uploaded.

## Changes

- `pull_request_upload`: a pull request's token doesn't satisfy the
write policy. The upload gets `403`, and the details show `Write not
permitted`.
- `upload_without_token`: an upload from outside GitHub Actions has no
token. It gets `401`, and the details show `Invalid credentials`.

Both tasks succeed. The snapshots come from the file backend here. The
backend switch later in this stack must leave them unchanged, which
shows that the emulated policy matches the Worker's.

Stacked on #809.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Test and snapshot additions only; no runtime or policy logic changes.
> 
> **Overview**
> Adds two ignored remote-cache e2e scenarios and matching snapshot
fixtures so upload rejections under the write policy are covered
end-to-end.
> 
> **`pull_request_upload`** runs `vt run build` with read-write remote
cache and a pull-request GitHub Actions token; the store call gets
**403**, the build still succeeds, and `vt run --last-details` shows
**Write not permitted**.
> 
> **`upload_without_token`** runs the same flow outside the
`--github-actions` wrapper (no OIDC token); the backend returns **401**
with **Invalid credentials** in the details while the task completes
successfully.
> 
> Both cases follow the existing `remote-cache-server` start/run/stop
pattern and use `VP_RUN_INTERNAL_HIDE_PENDING_UPLOADS` for stable
output.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4a66284. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

remote cache Remote caching

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant