klinux / klinux/gocdnext

fix(deploy): truthful `unknown` revision state for canceled non-rollout Argo (don't lie about the cluster)

Open
#212 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Go
Stars
7
Forks
3
Avg merge
2h 12m
Merged PRs (30d)
30

Description

Problem

When a non-rollout Argo deploy is canceled or superseded, gocdnext does not force-abort the
external sync — so the apply may still converge on the cluster. Recording the deploy revision as
canceled (as if the change can't land) is a lie about the cluster state: history, "current
deployment", and DORA can diverge from reality, and under supersede an OLD deploy can even land AFTER
the new one.

deploy.Decide (server/internal/deploy/decide.go) handles cancel only for RolloutAware=true; a
non-rollout Argo deploy keeps converging and can finalize success today.

Proposed direction

Split the JOB status from the external RESULT into distinct revision states:

  • canceled — reserved for positive knowledge the change did NOT / CANNOT land (rollout aborted
    before any target shifted; the job canceled before the sync/apply was issued).
  • unknown (a.k.a. cancel_requested / superseded_unconfirmed) — the apply was already issued and
    may still converge (non-rollout Argo cancel/supersede): the JOB is canceled (we stopped waiting),
    the revision is unknown (cluster state unconfirmed).

Both canceled and unknown are excluded from DORA success/failure and never auto-become the
current deployment
.

deploy.Decide matrix to implement + test:

  • (i) non-rollout Argo cancel with the sync already issued ⇒ job canceled, revision unknown;
  • (ii) rollout cancel BEFORE target shift ⇒ revision canceled;
  • (iii) rollout "cancel requested, no known target, deadline elapsed" ⇒ canceled (no target shifted);
  • (iv) supersede of a non-rollout deploy that may still land ⇒ unknown.

Migration: extend the deployment_revisions.status CHECK to add unknown (alongside canceled from
the cancel→canceled work); store model + FinalizeDeploymentRevision; Down handles existing rows.

Follow-up (optional): keep reconciling unknown to an observed terminal after job-cancel (a watcher
outliving the job) — v1 is the distinct state, not continued reconciliation.

Depends on: the deployment_revisions.status CHECK change from the cancel→canceled work.

Baseline: origin/main. Verify line numbers against current origin/main.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in server/internal/deploy/decide.go and trace the cancel and supersede paths for rollout and non-rollout Argo deploys. Then inspect the deployment_revisions status CHECK, the revision model, FinalizeDeploymentRevision, and the migration Down path. Done means the four listed cases produce the specified job and revision states, with canceled and unknown excluded from current deployment and DORA handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgres
Domain
backend, ci-cd, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.