Files
Holocron/plugins/delivery/.apm/skills/delivery-verify/references/apply-wait.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

5.9 KiB

Waiting for a pulled apply

A pulled path applies when Flux pulls the merge commit, not when CI runs. flux-diagnose's Applied check owns the wait: its reads, its pauses and its cap. This file only picks the Kustomizations to ask about and maps the answers.

Preconditions

Each of these is a stop with the quoted reason:

  • The caller passed kubeconfig none → "no cluster access for pulled paths".
  • flux-diagnose is not loaded (no loaded tool skill covers Flux) → "no tool skill loaded for pulled paths: flux-diagnose".
  • A tool skill reports no cluster access → "no cluster access: ". Never look for another kubeconfig or credential.

Find the Kustomizations

  1. rtk git fetch origin: the Applied check's ancestry test needs the merge commit and every commit after it in the local history.

  2. List the GitRepository sources with their URLs; flux get sources git does not print URLs:

    KUBECONFIG=<path> kubectl get gitrepositories -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"|"}{.spec.url}{"\n"}{end}'
    

    Keep those whose URL names this repo: same host, owner and name, ignoring case, scheme, user and a trailing .git (ssh://git@host/owner/name.git and git@host:owner/name both match).

  3. List the Kustomizations with their sources and paths:

    KUBECONFIG=<path> kubectl get kustomizations -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"|"}{.spec.sourceRef.kind}{"|"}{.spec.sourceRef.namespace}{"|"}{.spec.sourceRef.name}{"|"}{.spec.path}{"\n"}{end}'
    

    Keep those whose source is a GitRepository kept in step 2. An empty source namespace means the Kustomization's own namespace. None kept → stop with "no Flux Kustomization sources this repo".

  4. Wait on the kept Kustomizations whose spec.path contains a changed path: the changed path lies at or under it, after dropping a leading ./ and a trailing / (an empty path or ./ is the repo root and contains every path). None matches → wait on every kept one: a Kustomization can render files outside its own path through its kustomization.yaml.

HelmRelease scope

Pass the Applied check no HelmRelease list, so it checks every HelmRelease in each waited Kustomization's own inventory; the Kustomizations are already narrowed by changed path. A list narrowed to releases whose manifest changed passed failures in releases whose values changed; an unrelated release mid-upgrade now only causes a pending stop, which is safe. The check still cannot see a change that reaches a release without a spec change: §No spec change catches some. Which failing release is this change's is references/attribution.md §HelmRelease's job.

Run the Applied check

For each Kustomization, one after another, invoke flux-diagnose's Applied check with its name and namespace, the full 40-character merge commit SHA, the kubeconfig path and a cap, and no HelmRelease list. The cap is 15 minutes for the whole wait, shared: each call gets 15 minus the pauses the earlier calls reported. A call reached with none left gets no cap, so it reads once.

Applied check verdict Result for that Kustomization
applied applied at its applied revision; keep any "superseded by" note
failed failed: its applied and attempted revisions, failing HelmReleases, diagnosis and any note, in one line
pending: <why> stop with "not yet reconciled at <merge commit>"
suspended, unverifiable: <why>, unknown: <why> stop: "Kustomization <ns>/<name>: "

A pending at the cap is never a failure: the change may still apply, so it is a stop, and the caller's relaunch asks again from the start.

After the last call, run references/already-reverted.md again, then test each "superseded by <SHA>" against its §At or after a revert. A revert, or a superseding SHA at or after one → stop with "already reverted by ": the cluster runs the undo, not this change.

No spec change

The apply wait proves only the bounded Flux guarantee in SKILL.md Step 3. The Applied check judges a HelmRelease by its generation, which moves only when its spec does, so a route that changes what a release deploys without touching its spec leaves it Ready at its old generation. This check is a best-effort catch for the routes it can link, not an exhaustive one: an overlay or base outside spec.path, an object applied by another Kustomization and similar routes go undetected, and the PR's post-merge assertions cover them. For each applied Kustomization, test each release on its HelmReleases line with references/attribution.md §HelmRelease condition 1. One linked only through these routes → stop with unverifiable: HelmRelease <ns>/<name> takes this change without a spec change; confirm its upgrade by hand:

  • its spec.chart.spec.chart path (an in-repo chart edit);
  • an object its spec.chartRef names;
  • a spec.valuesFrom object whose name does not change with its content: one defined in a changed file, a generator with the name suffix disabled, or a hashed generator the release names by its unhashed <base>.

A hashed generator is a spec change only when the live valuesFrom name carries the hash (<base>- plus a 10-character suffix, matched by prefix). Kustomize writes that name into the HelmRelease only when a configurations: nameReference for kind: HelmRelease, path: spec/valuesFrom/name exists; then the generation moves and the Applied check already waits on the upgrade.

Result

First match wins:

  1. Any stop above → stop with the first one's reason; name any failed Kustomizations after it.
  2. Any failed → failed, with the failing Kustomizations, their attempted revisions, failing HelmReleases and diagnoses. references/attribution.md decides which are this change's.
  3. Every one applied → applied. Each applied revision is an applied commit for references/report.md's Applied commit rule.