Skip to content

feat(runs): submit and manage runs as a team - #2929

Draft
camielvs wants to merge 1 commit into
cvs/team-scoped-secretsfrom
cvs/team-run-methods
Draft

camielvs wants to merge 1 commit into
cvs/team-scoped-secretsfrom
cvs/team-run-methods

Conversation

@camielvs

@camielvs camielvs commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

A run looks up its secrets in the account of whoever created it, so a run that uses a team's secrets has to be created as that team. Once it is, the backend only lets the run's creator change it. These methods now take an optional team id and send the impersonation header when given one. Every caller still passes none, so nothing changes yet.

  • submitPipelineRun takes teamId and passes it to createPipelineRun.
  • saveRunAnnotations and updateRunAnnotation take it too. The notes and tags written right after submit are separate requests. Without the header they would be refused for a run the team created.
  • cancelPipelineRun takes it, so a run the team created can be cancelled.
  • useTeamForRunAnnotations resolves the team of the projects a run is filed under. The same rule covers a run about to be submitted (the annotations it will carry) and a run already stored. So a rerun or cancel from a run page outside any project still finds the team.
  • referencedSecretNames and missingSecretNames find the secrets a run needs and which of them an account lacks, for a check before submit. A secret reference holds only a name. Without this check, a run submitted from the wrong context would fail at launch, or quietly use a same-named secret from another account.

Related Issue and Pull requests

Type of Change

  • New feature

Line Breakdown

Category Added Removed
Production code 60 2
Tests 277 1
Total 337 3

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

None. There's no UI change.

Test Instructions

pnpm vitest run src/utils/submitPipeline.test.ts src/services/pipelineRunService.test.ts src/components/shared/Submitters/Tangle/saveRunAnnotations.test.ts src/components/shared/SecretsManagement/secretReferences.test.ts src/services/teams/useTeamForRunAnnotations.test.ts

To check by hand that nothing regressed:

  1. Submit a run.
  2. Add a note to it.
  3. Cancel it.

All three should behave as on master.

Additional Comments

  • The existing submitPipeline assertions gained a trailing undefined for the new teamId argument. None of their expectations changed.
  • Known follow-up for the cancel UI PR: cancelPipelineRun and updateRunAnnotation go through fetchWithErrorHandling, which drops the response's detail. A refused impersonation there surfaces as a generic error until that's handled.

🤖 Generated with Claude Code

@camielvs
camielvs added this pull request to stack #2930 October 22, 2026 19:23
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: cvs/team-run-methods/96d0264

A run looks up its secrets in the account of whoever created it, so a run
that uses a team's secrets has to be created as that team. Once it is,
the backend only lets the run's creator change it. These methods now take
an optional team id and send the impersonation header when given one.
Every caller still passes none, so nothing changes yet.

- `submitPipelineRun` takes `teamId` and passes it to `createPipelineRun`.
- `saveRunAnnotations` and `updateRunAnnotation` take it too. The notes
  and tags written right after submit are separate requests, and without
  the header they would be refused for a run the team created.
- `cancelPipelineRun` takes it, for cancelling a run the team created.
- `useTeamForRunAnnotations` resolves the team of the projects a run is
  filed under. That one rule serves both a run about to be submitted
  (the annotations it will carry) and a run already stored, so a rerun or
  cancel from a run page outside any project still finds the team.
- `referencedSecretNames` and `missingSecretNames` find the secrets a run
  needs and which of them an account lacks, for a check before submit.
  A secret reference holds only a name, so a run submitted from the wrong
  context would otherwise fail at launch or quietly use a same-named
  secret from another account.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant