Skip to content

Scope pull request uploads to the pull request #16

Open

Description

@wan9chi

Motivation

A pull request can't reuse cache entries from its own earlier runs. Only push jobs on the namespace's default branch can upload (src/auth.ts), so pull_request runs get 403 write_policy and can only restore what the default branch published. After each new push to a PR, tasks whose inputs differ from the default branch rebuild, even if the PR's previous run already built them.

Uploading PR results into the namespace itself would let unreviewed PR code publish entries that default-branch builds restore, so PR entries need their own scope.

Proposal

  • A pull_request run uploads to a scope for its PR, derived from the token's ref claim (refs/pull/<n>/merge).
  • PR runs read their PR scope first, falling back to the default branch. Default-branch builds never read PR scopes.
  • Default-branch publishing is unchanged.

This covers same-repository PRs only; fork PR runs in public repositories don't get id-token: write.

Open questions

  • Endpoint: how a client addresses a PR scope (e.g. /projects/<namespace>/pulls/<n>), with the write policy checking that the token's ref matches it.
  • Fallback: the server could serve default-branch entries on a PR-scope miss, or vp run (vite-task) could read both endpoints.
  • Retention: PR scopes should expire soon after the PR closes or goes idle, within the namespace's limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions