Skip to content

fix(cli): make bundle upload channel linking CI-visible - #3261

Draft
riderx wants to merge 1 commit into
mainfrom
cursor/cli-upload-rollout-ci-28aa
Draft

fix(cli): make bundle upload channel linking CI-visible#3261
riderx wants to merge 1 commit into
mainfrom
cursor/cli-upload-rollout-ci-28aa

Conversation

@riderx

@riderx riderx commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary (AI generated)

  • Stop implying final success at zip upload time (Bundle zip uploaded… instead of Bundle uploaded 💪).
  • Print explicit success lines when a bundle is linked to a channel (stable, rollout, or rollout-advance), including when an active progressive rollout is cleared.
  • Add opt-in --fail-on-active-rollout for CI pipelines that must not reset an active rollout without --rollout / --rollout-advance.
  • Update CLI README, bundle webdocs, and release-management skill docs.

Motivation (AI generated)

Users reported bundle upload --channel … exiting 0 after “Bundle uploaded” even when they believed the bundle was not linked. The zip upload message printed before channel assignment finished, which made CI logs ambiguous. Capgo’s own deploy still needs stable linking to clear leftover rollouts (#3115 behavior); this change makes that outcome visible without changing the default.

Business Impact (AI generated)

  • Reduces false confidence in CI/CD logs when channel linking is the real success criterion.
  • Gives teams an explicit guard (--fail-on-active-rollout) to catch accidental rollout resets in automation.
  • Preserves default Capgo-style --channel uploads (link stable + clear leftover rollout, exit 0).

Test Plan (AI generated)

  • bun run test:fail-on-active-rollout (helpers + checkValidOptions guard)
  • bun run test:fail-on-incompatible (unchanged)
  • bun run build + bun run lint in cli/
  • bun test:unit tests/upload-channel-link.unit.test.ts
  • CI green on PR

Generated with AI

Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Clarify that zip upload is only the first step, print explicit stable/rollout
link success lines (including cleared progressive rollout), and add the
opt-in --fail-on-active-rollout flag for CI pipelines that must not reset an
active rollout without --rollout or --rollout-advance.

Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@riderx
riderx deployed to deepsec-pr September 4, 2026 13:33 — with GitHub Actions Active
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@codspeed-hq

codspeed-hq Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing cursor/cli-upload-rollout-ci-28aa (e26e32a) with main (62dd028)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Nei1eveN Nei1eveN left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI-assisted review: Codex reviewed the public change and ran a local reproduction with mocked I/O on behalf of Neil Potot. One new correctness finding is attached. No customer data or production systems were used.

Comment thread cli/src/bundle/upload.ts

if (targetChannel) {
uploadTargetChannels.set(channel, targetChannel)
if (shouldFailOnActiveRollout(options, targetChannel))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Enforce the rollout guard when the stable promotion is committed

AI disclosure: Codex performed this review and local mocked-I/O reproduction for Neil Potot.

At e26e32a3bd1a18c1ce6f88ee4d8d05dda20f3c75, --fail-on-active-rollout is checked only before upload. uploadTargetChannels retains that snapshot and the assignment loop reuses it after upload. Neither setVersionInChannel nor promoteExistingChannel checks the flag again, and the PUT body does not convey it to the server.

Reproduction with a normal, authorized concurrent rollout:

  1. Start a stable upload with --channel production --fail-on-active-rollout while the channel has no active rollout.
  2. Let preflight finish, then start a rollout from another deployment or the dashboard while the bundle is uploading.
  3. Resume the first upload. It uses the earlier inactive snapshot, sends PUT /bundle and reports stable-link success, despite the now-active rollout.

I ran the exact current preflight, assignment, promotion and setChannelInTransaction functions locally with mocked I/O. The control case (rollout active before preflight) rejected without a write. Changing state after preflight instead reached the server helper's unconditional channel-version UPDATE, returned true, and printed success with no rollout warning. This bypasses the new flag precisely while it is intended to prevent a stable promotion from replacing an active rollout.

Please carry the opt-in guard to the stable-promotion endpoint and check the current rollout fields while holding its existing channel row lock, before the UPDATE; preserve existing behavior when the flag is absent. Cover the same guarantee for the self-assign path. A fresh CLI read alone would still leave a smaller race.

Validation: Node 22, source-extracted functions, synthetic channel and mocked permissions/API/DB. No production requests or live database test; database trigger effects were not executed.

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.

3 participants