Files
Holocron/plugins/delivery/.apm/skills/delivery-verify/references/revert.md
T
Defame1297andClaude Opus 5.5 5081206c45 feat(delivery): add the verify stage: delivery-operator and delivery-verify
delivery-operator (opus; no Edit, Write, NotebookEdit or Agent) is the
verify-stage lead. After a human approves and merges, it reads the
delivery doc at the merge commit's first parent, proves its kubeconfig
cannot write (four auth can-i probes), loads the routed tool skills and
runs delivery-verify. It posts the operator report as its own comment,
then the final Handoff (Next command none on pass).

delivery-verify:
- stops first if the change was already reverted;
- waits for Flux through flux-diagnose's Applied check (15-minute cap)
  and reads post-merge CI per workflow through delivery-ci-checks
  (45-minute cap), accepting a later cumulative run as cover;
- checks the PR's post-merge assertions with Read-tier commands only;
- ties a failure to the change only when that is established, and
  otherwise stops. A tied failure opens a revert PR (Ready for Human,
  built in a temporary worktree); it never reverts on its own.
For Flux the guarantee is bounded: the merge commit applied and the
inventory HelmReleases are Ready. The assertions prove a values or chart
change took effect.

The delivery doc format gains a seventh parsed section, Post-merge
checks (glob -> push-event status names, or none when Flux pulls the
change), so delivery-repo-doc goes to 0.2.0. delivery-ci-checks takes a
caller check list and wait cap; delivery-handoff carries the verify
stops.

delivery 0.6.0.

Refs: #194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-24 20:35:04 +00:00

3.7 KiB

Opening the revert PR

For the caller, only on action: revert. Step 2 is Read tier, every other step Propose. The revert PR is a proposal: a human decides whether to merge it or fix forward, so never merge or approve it, and never commit to the default branch directly. <n> is the merged PR's number; <base> is the default branch, the merged PR's base.

The rtk git commands below are the ones git-worktrees, git-commits and git-remotes run: load those skills for their rules and run these commands as written. The PR steps go through gitea-prs. Any step failing → stop with the step and its error; leave a half-made branch for the human, but always remove the worktree (step 8).

Start with rtk git fetch origin: every step below reads origin/<base> and the merge commit from the local history.

  1. Earlier revert PR. List PRs in every state whose head branch is revert/pr-<n>:

    • open → a relaunch already opened it: skip to step 7;
    • merged → stop with "already reverted by ": the delivery chain ends there;
    • closed unmerged, and the revert/pr-<n> branch still exists on the remote → stop with "closed revert PR left branch revert/pr-<n>";
    • none, and revert/pr-<n> exists on the remote → stop with "branch revert/pr-<n> exists with no revert PR";
    • otherwise → go on.

    "Exists on the remote" is rtk git ls-remote --heads origin revert/pr-<n> printing a line; never a local tracking ref, which a plain fetch does not prune.

  2. Shape. rtk git rev-list --parents -n 1 <merge commit>: two parents → a merge commit, revert with -m 1; one parent → a squash, revert without -m. delivery-verify already stopped on a several-commit squash or rebase merge.

  3. Worktree. Add a temporary worktree outside the operator's checkout on branch revert/pr-<n> from origin/<base>. A local revert/pr-<n> with no remote branch is a stopped earlier run's leftover, never pushed: recreate it with -B, not -b. Never switch the operator's own checkout. Every git command below runs in the worktree (rtk git -C <worktree> …).

  4. Revert. rtk git -C <worktree> revert [-m 1] --no-commit <merge commit>. A conflict → rtk git -C <worktree> revert --abort, stop with "revert of <merge commit> conflicts with the default branch".

  5. Commit, the message through a quoted heredoc so no backtick or $ in the title is expanded; never -m:

    rtk git -C <worktree> commit -F - <<'EOF'
    revert: <merged PR title> (#<n>)
    
    Reverts merge commit <merge commit>: delivery verify failed.
    
    Refs: #<n>
    EOF
    

    No Delivery-Stage trailer: the test-path check then has nothing to judge. Hooks run; a hook failure is a stop, never --no-verify or SKIP=.

  6. Push revert/pr-<n> with upstream tracking, then open the PR: title Revert "<merged PR title>", base <base>, body naming PR #, the merge commit and the tied failures in one line each, then:

    • "Merging this re-runs only the workflows whose path filters its diff matches. A workflow that applies the whole tree (an Ansible Provision run, for example) may not re-run, so check the live state after merging."
    • "The verify report is on #. Merge this only after deciding against a fix forward."

    No Closes: the issue stays closed.

  7. Label the revert PR Status/Ready for Human. Post no Handoff comment on it: it leaves the delivery chain, and its own CI (the dry run included) runs as on any PR.

  8. Clean up. Remove the worktree, whether the steps above finished or stopped. The branch stays.

Return the revert PR's URL; it goes in the report's Output links.