Skip to content

fix(ui): stop treating the first row of the deployment list as the newest deployment - #616

Draft
PiquelChips wants to merge 2 commits into
mainfrom
fix/newest-deployment-not-first-row
Draft

PiquelChips wants to merge 2 commits into
mainfrom
fix/newest-deployment-not-first-row

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

What and why

Fixes PQD-149

The deployment list is paged by ID. Since PQD-130 (#557), the store picks an environment's latest and current deployment by creation time, because after a restart with the clock behind, an older deployment can have the higher ID and list first. Some callers still took the first row as the newest deployment, so they could pick an older deployment. Taking the newest row of the first page wouldn't fix it either: the newest deployment can be past that page.

These callers now use the latest operation from the environment's detail, which the store picks by created_at_ms DESC, id DESC, unless that operation is a deletion:

  • CLI, stop wait and wait (env wait / app wait without --deployment): both use a new latest_deployment(client, environment). Before, a failed deployment that stop left as is could fail the wait, and wait could follow an older deployment.
  • Dashboard, deployment page: Restore is still offered on the current target when a newer deployment failed before replacing it. "Newer" now means the environment's latest operation is another deployment of this environment (DeploymentFacts::superseded_by). Before, it meant this deployment wasn't the first row.
  • Dashboard, deployment history: the poll follows the row that is still running, if any, instead of the first row. Starting an operation supersedes the one in progress, so at most one row is running. A running deployment past the polled page is still picked up from the environment's detail, which RunningDeployment already follows.

Proof: in the CLI env stop and env wait tests, the deployment list returns only an older, higher-ID deployment and the environment's detail names the newer one. I also added a stop case for a failed deployment left as is. Four tests fail on main and pass here. A dashboard unit test covers superseded_by.

Checklist

  • The feature reaches each surface in AGENTS.md it applies to,
    documentation included, with its reverse states.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 21, 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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…west deployment

The deployment list pages by ID, but since PQD-130 the store picks an
environment's latest and current deployment by creation time: after a
restart with the clock behind, an older deployment can have the higher
ID and list first. The deployment page, the history poll, and the CLI's
`stop` and `wait` now pick the newest listed deployment by creation time,
then ID, through `DeploymentSummary::newest`.

Fixes PQD-149
…ration

The newest of the deployment list's first page still misses a newer
deployment listed past it, since the list pages by ID. Use the latest
operation the environment's detail reports instead, which the store
picks by creation time, unless it is a deletion: `latest_deployment` in
the CLI for `stop` and `wait`, and `DeploymentFacts::superseded_by` for
the deployment page's Restore. The history poll follows the row it lists
running, as at most one operation runs at a time.

Part of PQD-149
@PiquelChips
PiquelChips force-pushed the fix/newest-deployment-not-first-row branch from 04e6103 to 49387a0 Compare November 22, 2026 22:12
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