Repository navigation
test(kind): prove a task pod survives a colour cutover (the half PR13 left out) - #610
Merged
Merged
Conversation
athvin
force-pushed
the
bm/bluegreen-p16-kind-cutover
branch
from
November 5, 2026 19:18
bfc030a to
e6bd541
Compare
athvin
force-pushed
the
bm/bluegreen-p16-kind-cutover
branch
from
November 5, 2026 20:06
e6bd541 to
fbe3721
Compare
This was referenced Nov 5, 2026
athvin
force-pushed
the
bm/bluegreen-p16-kind-cutover
branch
from
November 5, 2026 20:32
fbe3721 to
efc4c7f
Compare
Contributor
athvin
force-pushed
the
bm/bluegreen-p16-kind-cutover
branch
from
November 5, 2026 20:47
efc4c7f to
27fc5a7
Compare
athvin
force-pushed
the
bm/bluegreen-p16-kind-cutover
branch
from
November 5, 2026 22:02
27fc5a7 to
461f5e1
Compare
… left out) PR13 (#541) shipped the legibility half of "task pods survive a cutover" — the `er.dupezero.com/image-digest` annotation that makes a mid-deploy run legible — but not the proof half. This is the assertion the plan actually asked for. A task pod's ONLY route to the control plane is `svc/er-api` (`ER_SERVER_URL` in the task template is `http://er-api.<ns>.svc.cluster.local:8000`), so a cutover moves its heartbeats, claim renewals and finish call onto a different er-server process than the one that launched it. If that were visible to a running attempt, a deploy would fail paying work: a data-path failure caused by a serving-path deploy. Phase 6 flips `color.active` with a task in `running` and asserts the attempt did not notice: settles succeeded, `launches == 1`, and no termination_reason. `exec-task` has TWO unreachability windows, and getting the assertion right meant reading which one this phase can actually reach: step 1, work order 6 ticks x 10s = 60s, then control_plane_unreachable, exit 3, charged to the launch budget. A task already running is PAST this; a sibling that launches after the flip is not. heartbeat thread posts every 30s, fences after 3 consecutive transport misses (~90s). Step 6 then refuses to post a verdict and writes `fenced` — the work completed and the result is discarded, which is the expensive one. So the assertion is `termination_reason is None`, not a single named reason. Asserting only `!= "control_plane_unreachable"` would have been decoration: it is unreachable in the window this phase creates, so the guard could not have fired no matter what the cutover did. `is None` covers fenced, sigterm, stale_start, structural_mismatch and control_plane_unreachable together, and a succeeded task carries no reason — every writer of the field in er-server (`skipped`, `control_error`, `config`, `heartbeat_timeout`, `no_terminal_record`, `DeadlineExceeded`, `build_skew`) is a failure path. Distinct from phase 2 in what it exercises. The dispatcher is not coloured and does not restart here, so adoption is not involved; what is proved is that the attempt's callback path is stateless across the two pods. Three things done so the phase cannot pass having proved nothing: - **It refuses a pre-colour chart.** An empty `er.dupezero.com/color` selector on `svc/er-api` fails the phase outright, rather than flipping nothing and asserting a task succeeded. Observed firing against the stale local kind release, which is still on a pre-PR9 chart. - **It asserts the selector actually moved** after the flip, so a no-op upgrade is a failure rather than a pass. - **`termination_reason` is read by subscript, not `.get()`**, so a renamed or dropped field raises KeyError instead of passing on a `None` that only means "no such key". It restores the release afterwards (flip back, then retire — the reverse order would blackhole the Service for the length of the scale-down), so the probe stays re-runnable and a later `kind_env.sh up` does not inherit a surprising active colour. Note the probe's own port-forward is unaffected and that is not a gap: `kubectl port-forward svc/...` resolves to one pod when the stream opens and does not re-resolve, so its reads keep landing on the old colour — which still runs, because retiring it is the deploy's third phase. Both colours read the same Postgres. The flip is proved by the selector assertion, not by where curl lands. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ches them Phase 6 was nearly shipped with an assertion that could not fail, and the two-hour nightly run would have reported green. This makes that class of mistake catchable in about a second. The assertion was `termination_reason != "control_plane_unreachable"` on a task caught in `running`. Reading exec_task.rs afterwards: that reason is written at exactly ONE site, the step-1 work-order loop, which a running task has already passed. The reachable mid-run failure is `fenced`, from the heartbeat thread after three missed posts. So the guard's precondition could not hold. Why a per-PR test rather than trusting the nightly: **an assertion that can no longer fail makes the probe GREENER, not redder**, so the nightly cannot detect its own neutering. And the probe is the least-exercised correctness-critical code here — a cluster, an image build and two hours, once a day. `scripts/ci/kind-assertions-test.sh`, following the `tf-helpers-test.sh` / `merge-bus-test.sh` pattern: - Every embedded assertion block must compile. Cheap coverage for the phases this does not mutate, whose syntax errors would otherwise surface two hours in, after five phases of real work. - Ten mutants of the phase 6 ledger — `fenced`, `control_plane_unreachable`, `sigterm`, `stale_start`, a relaunch, a non-succeeded state, a missing field, an empty live set, and one bad row among good ones. Each must be REFUSED; a mutant that still exits 0 is an assertion that cannot discriminate. - The three bash guards must still be present (textual, deliberately: proving those work costs a cluster, but proving nobody deleted them is free). - Exits 2 if it finds fewer than two blocks to examine — rename detection, so a changed heredoc shape cannot read as a pass. The blocks are EXTRACTED from check_kind.sh, never transcribed; a copy would be a second source of truth, and the drift would show up as this test passing against code the probe no longer runs. **The test was mutation-tested itself**, which is what found the one real gap. Narrowing the assertion back to the unreachable reason, deleting a bash guard, and breaking the heredoc shape were all caught. Deleting the `"termination_reason" in t` guard was NOT: the subscript beside it raises KeyError anyway, so it is a behaviourally equivalent mutant and no exit code can distinguish it. What that guard actually buys is the diagnosis — a named AssertionError about the ledger shape instead of a bare KeyError traceback surfacing two hours into a nightly. So that case now asserts the message, not just the refusal, and the mutant is caught. Wiring: a `pull_request` trigger with a `paths:` filter, plus a new `assertions` job; `probe` gains `if: github.event_name != 'pull_request'` so the 2h run never fires on a PR. The `paths:` filter is safe ONLY because nothing in this workflow is a required status check — on rust.yml or frontend.yml the same filter would leave a required context permanently unreported, which is why those use a `detect` job instead. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#622 fixed the probe calling `POST /v1/orgs/{org}/jobs`, a route that stopped existing when the datasets work made every job route dataset-scoped on 2026-11-04. That PR noted the gate belonged here, in the file this PR introduces, rather than duplicated alongside the fix. This is it. The bug was as cheap to detect as bugs get — a path that is right there in the router, or is not — and it survived two days because every instrument that could have caught it was the wrong shape: kind.yml is nightly and not a required check, two of its three runs were `steps_sum=0` outage no-starts, and the one that did report surfaced a 404 as a bare JSONDecodeError naming neither the request nor the status. So: extract every `/v1` path the probe calls, normalise its shell interpolations to the router's placeholder form, and require each one to be a route `er-server` actually declares. No cluster, no network, ~instant. Three properties that keep it from passing on nothing: - **`SUBST` is explicit and unmapped variables FAIL.** A silent fallback would turn an interpolation nobody taught it about into a false pass, which is the failure mode this whole file exists to prevent. - **Fewer than 20 routes parsed exits 2** — if the router's declaration shape changes, that is a broken extraction, not a clean bill of health. - **Zero probe call sites found exits 2.** The probe cannot be calling nothing. Observed failing against the real bug rather than a contrived one: regressing that one path back to its pre-datasets form gives FAIL the probe calls /v1/orgs/${ORG}/jobs, which normalises to /v1/orgs/{org}/jobs — no such route in er-server. It will 404. and the clean tree reports `(checked 8 probe paths against 114 routes)`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#624 made a task pod schedulable by dropping the executor classes from a full CPU to 250m, against a steady state of 1.55 on a 2-vCPU runner. That is sufficient for phases 1 to 5, which add exactly one pod. It is not sufficient for phase 6, which is the only phase that adds three: the idle colour's web-api scaled to replicas: 1 for the cutover a task pod caught mid-attempt, by design er-schema-migrate a PRE-UPGRADE hook, so every `helm upgrade` re-fires it — including the `color.active` flip that happens while the task is in flight At the old numbers that peaks at 2.15 of ~2.0, and the pod that loses is whichever asks last. The symptom would have been a five-minute `helm --wait` timeout or a 420s wait on a job whose pod never started — the same misattribution that made #624 take three runs to find, since a Pending pod reports as a timeout about a job rather than as a scheduling refusal. Three changes, none of which raises the ceiling by guesswork: `values-kind.yaml` trims the api and dispatcher CPU REQUESTS to 100m. That is the lever rather than the executor classes because three pods carry it during phase 6 and only one carries a class. Requests only — the limits stay at the chart's `cpu: "1"`, so a 100m er-server still bursts to a full core and `ensure_schema` is untouched. Verified by rendering the profile: requests 100m, limits 1, memory limits intact. Steady state 1.25, phase 6 peak 1.70. `check_kind.sh` gains a `cpu_budget` helper and asserts the 450m phase 6 needs BEFORE the phase runs, so an over-committed node fails with both figures in one sentence instead of as a timeout several minutes later. It also logs the budget unconditionally rather than only on failure: #624 added that diagnostic under `if: failure()`, which means a green run never records allocatable CPU — and the budget is precisely the number that has to be re-derived every time this moves. Tested against a live kind cluster, where it reproduced the `cpu 1550m` that `kubectl describe node` reports. `kind-assertions-test.sh` adds the preflight to its list of textual guards. Deleting that assertion does not make phase 6 fail; it makes phase 6 fail later and about something else, so its removal is invisible to every other check here. Observed failing against a mutant, with the substitution count asserted so a regex that matched nothing could not pass. er-db-migrate is deliberately absent from the sums: it is guarded by `web.enabled`, off in this profile. Checked by rendering, not assumed.
athvin
force-pushed
the
bm/bluegreen-p16-kind-cutover
branch
from
November 6, 2026 02:04
461f5e1 to
256d421
Compare
This was referenced Nov 6, 2026
Closed
This was referenced Nov 6, 2026
athvin
pushed a commit
that referenced
this pull request
Nov 8, 2026
…tory The header's premise — never observed failing, so not trusted — went stale: the probe failed four times for four distinct causes (#614, #622, #624, #610) and has now passed twice on main (2026-11-07 nightly 42348330935, 2026-11-08 dispatch 42447724542, all six phases both times). The decision stands, restated on cost grounds: the in-job release-image build is the wrong price for a PR gate and the per-PR assertions job covers the cheap half. The timeout comment gains the measured end-to-end timings (28m42s, 33m51s of the 120 budget) that settle #655's step 2 without a raise.
athvin
added a commit
that referenced
this pull request
Nov 8, 2026
…tory (#655) * wip: claim #655 — first green kind probe run * docs(kind): restate the probe's not-required decision on observed history The header's premise — never observed failing, so not trusted — went stale: the probe failed four times for four distinct causes (#614, #622, #624, #610) and has now passed twice on main (2026-11-07 nightly 42348330935, 2026-11-08 dispatch 42447724542, all six phases both times). The decision stands, restated on cost grounds: the in-job release-image build is the wrong price for a PR gate and the per-PR assertions job covers the cheap half. The timeout comment gains the measured end-to-end timings (28m42s, 33m51s of the 120 budget) that settle #655's step 2 without a raise. --------- Co-authored-by: bmoore813 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR13 (#541) shipped the legibility half of "task pods survive a cutover" — the
er.dupezero.com/image-digestannotation that makes a mid-deploy run legible — but not the proof half. This adds the assertion the plan asked for.Why it matters
A task pod's only route to the control plane is
svc/er-api—ER_SERVER_URLin the task template ishttp://er-api.<ns>.svc.cluster.local:8000. So a cutover moves its heartbeats, claim renewals and finish call onto a different er-server process than the one that launched it. If that were visible to a running attempt, a deploy would fail paying work: a data-path failure caused by a serving-path deploy. That is the risk D-BLUEGREEN cites as a reason to do blue/green at all, and it was never asserted.Getting the assertion right mattered more than adding it
exec-taskhas two unreachability windows with different reasons, and only the second is reachable once a task isrunning:control_plane_unreachable, exit 3, charged to the launch budgetfenced— step 6 then refuses to post a verdict, so the work completed and the result is discardedMy first version asserted only
termination_reason != "control_plane_unreachable". That would have been decoration: it is unreachable in the window this phase creates, so the guard could not have fired no matter what the cutover did — a guard whose precondition cannot hold.The assertion is now
termination_reason is None, which coversfenced,sigterm,stale_start,structural_mismatchandcontrol_plane_unreachabletogether. A succeeded task carries no reason: every writer of the field in er-server —skipped,control_error,config,heartbeat_timeout,no_terminal_record,DeadlineExceeded,build_skew— is a failure path.What phase 6 asserts
Flips
color.activewith a task inrunning, then: settlessucceeded,launches == 1(a relaunch would mean two processes writing one lake), and notermination_reason.Distinct from phase 2: the dispatcher is not coloured and does not restart here, so adoption is not involved. What is proved is that the attempt's callback path is stateless across the two pods.
Three guards so it cannot pass having proved nothing
er.dupezero.com/colorselectorhelm upgradewould read as a passtermination_reasonby subscript, not.get()Nonethat only means "no such key"The first guard was observed firing. The local
er-kindrelease is still on a pre-colour chart (deployment/web-api, no colour selector), and it failed with exactly its intended message rather than passing:Cleanup
Restores the release afterwards — flip back first, then retire. The reverse order would blackhole the Service for the length of the scale-down. So the probe stays re-runnable and a later
kind_env.sh updoes not inherit a surprising active colour.One thing worth knowing about the probe's own transport
The port-forward is unaffected, and that is not a gap:
kubectl port-forward svc/...resolves to one pod when the stream opens and does not re-resolve, so its reads keep landing on the old colour — which still runs, because retiring it is the deploy's third phase. Both colours read the same Postgres. The flip is proved by the selector assertion, not by where curl lands.Verification
bash -nclean, the embedded Python block compiles,make skills-checkpasses, and the pre-colour guard was observed failing.kind.ymlis nightly + manual and deliberately not a required check, so the PR gates do not run this. Dispatched run42092738653on this commit to exercise the phase end to end; the earlier run was cancelled because it predated the assertion fix.🤖 Generated with Claude Code