Skip to content

fix(cli): don't assume newest deployment is live in promote resolution#124

Merged
kristof-siket merged 2 commits into
mainfrom
fix/promote-live-resolution-no-newest-fallback
Jul 21, 2026
Merged

fix(cli): don't assume newest deployment is live in promote resolution#124
kristof-siket merged 2 commits into
mainfrom
fix/promote-live-resolution-no-newest-fallback

Conversation

@kristof-siket

Copy link
Copy Markdown
Contributor

Why

resolveCurrentLiveDeploymentId fell back to deployments[0] (the newest deployment) when no authoritative live signal was available (app.liveDeploymentId, the provider live flag, or local known-live state):

return deployments[0]?.id ?? null;

During app promote, this made a freshly created candidate look like it was already live, so promote emitted "The selected deployment is already live for this app." and skipped the endpoint rebind. An app whose live pointer had been cleared (e.g. its live deployment was stopped) therefore never got re-bound — every subsequent deploy hit the same false "already live" and left the app unreachable.

This was the second half of a production incident on 2026-07-20: after the live deployments of build-runner/github-webhook were stopped (clearing latestDeploymentId), each CI redeploy's promote step read the null pointer, hit this fallback, and skipped the rebind — turning a transient stop into a ~1h outage.

What

Return null instead of guessing the newest. "Unknown live deployment" now means not already-live, so promote proceeds and rebinds the endpoint.

Tests

  • New: promote rebinds instead of assuming the newest deployment is live when there is no authoritative live signal.
  • Full app-controller suite green.

🤖 Generated with Claude Code

resolveCurrentLiveDeploymentId fell back to deployments[0] (the newest)
when no authoritative live signal was available (app.liveDeploymentId,
provider live flag, or local known-live state). During promote this made
a freshly created candidate look "already live", so the endpoint rebind
was skipped and an app whose live pointer had been cleared never got
re-bound — leaving it unreachable across repeated deploys.

Return null instead: unknown live deployment means "not already live", so
the promote proceeds and rebinds the endpoint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7cc458ae-18bd-45ab-9fb5-8301d556bac8

📥 Commits

Reviewing files that changed from the base of the PR and between c8b2562 and 6df1982.

📒 Files selected for processing (1)
  • packages/cli/src/controllers/app.ts

Walkthrough

The app controller no longer assumes the newest deployment is live when no authoritative live signal exists; it returns null instead. A new test verifies that runAppPromote promotes the requested deployment in this situation and returns no warnings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: avoiding the newest-deployment fallback in promote resolution.
Description check ✅ Passed The description accurately explains the bug, the fix, and the regression test.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/promote-live-resolution-no-newest-fallback
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/promote-live-resolution-no-newest-fallback

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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 20, 2026
Comply with the house rule that a comment needing more than one line
belongs in the API doc. The null-means-unknown contract now documents
resolveCurrentLiveDeploymentId itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kristof-siket

Copy link
Copy Markdown
Contributor Author

@CodeRabbit approve

@kristof-siket

Copy link
Copy Markdown
Contributor Author

@coderabbitai approve

@kristof-siket

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@kristof-siket
kristof-siket merged commit a72f34a into main Jul 21, 2026
10 checks passed
@kristof-siket
kristof-siket deleted the fix/promote-live-resolution-no-newest-fallback branch July 21, 2026 07:18
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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