# 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: ```bash KUBECONFIG= 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: ```bash KUBECONFIG= 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: ` | stop with "not yet reconciled at ``" | | `suspended`, `unverifiable: `, `unknown: ` | stop: "Kustomization `/`: " | 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 ``" 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 / 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 ``. A hashed generator is a spec change only when the live `valuesFrom` name carries the hash (`-` 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.