Skip to content

feat(deploy): run the pipeline kinds as pods in the CI namespace - #498

Merged
athvin merged 1 commit into
mainfrom
bm/enable-pipeline-kinds
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/enable-pipeline-kinds

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

run_all_full and run_all_incremental join the executor allowlist, so a pipeline run in the CI dev namespace becomes seven Kubernetes Jobs instead of one blocking thread inside the dispatcher pod.

This is the Phase 3 switch from batch-orchestration-design §11, and it is gated on evidence rather than on the code being written.

Why now

The pipeline has been observed end to end on a real cluster. check_kind.sh phase 5 (added in #477) runs run_all_full and gets:

What Result
Job objects 7 distinct — one per stage
pod uids 7 distinct, each from claims the control plane verified
launches 1 each — no stage relaunched, so never two lake writers
handoff standardize pinned the plan and the corpus ingest's own pod landed
the lake run ledgered full @ v0001, 18 auto-merged pairs out of base_10

That last row is the one that matters: a pipeline whose pods all exited zero without writing anything would satisfy every other check. The stages really did hand work across the pod boundary.

Both kinds share one DAG and one set of bodies — only init's mode decision differs — which is why they go on together.

What stays off, deliberately

correct, train, apply_corrections, apply_approved and provision remain disabled. Their bodies are real and the integration tier covers them, but none has run on a cluster, and an allowlist whose entries all arrive at once is not an allowlist. They go on as each is observed.

Verified

The --set comma escaping renders as one value rather than four keys:

ER_EXECUTOR_DAG_KINDS = "lake_maintain,lake_migrate,run_all_full,run_all_incremental"

Reverting is a one-line change, and unlisted kinds keep taking the in-process arm until Phase 4 deletes it.

Depends on #477 for the probe that justifies this. CI note: every workflow currently fails at job startup on Actions billing, so neither can go green until that is restored.

🤖 Generated with Claude Code

`run_all_full` and `run_all_incremental` join the executor allowlist, so a
pipeline run in the CI dev namespace becomes seven Kubernetes Jobs instead of
one blocking thread in the dispatcher pod.

This is gated on evidence rather than on the code being written. The pipeline
has now been observed end to end on a real cluster: `check_kind.sh` phase 5
runs `run_all_full` and gets seven distinct Job objects, seven distinct pod
uids, one launch each, every stage succeeded, `standardize` pinning both the
plan and the corpus `ingest`'s own pod landed, and the run ledgered
`full @ v0001` with 18 auto-merged pairs out of base_10 — so the stages really
did hand work across the pod boundary rather than exiting zero.

Both kinds share one DAG and one set of bodies; only `init`'s mode decision
differs, which is why they go on together.

The rest of Phase 3's kinds — `correct`, `train`, `apply_corrections`,
`apply_approved`, `provision` — stay OFF. Their bodies are real and the
integration tier covers them, but none has run on a cluster, and an allowlist
whose entries all arrive at once is not an allowlist. They go on as each is
observed.

Verified the escaping renders as one value and not four keys:

    ER_EXECUTOR_DAG_KINDS = "lake_maintain,lake_migrate,run_all_full,run_all_incremental"

Co-Authored-By: Claude Fable 5 <[email protected]>
@athvin athvin added the merge-bus eligible for the merge bus label Nov 5, 2026
@athvin athvin removed the merge-bus eligible for the merge bus label Nov 5, 2026
@athvin
athvin merged commit 2b6bace into main Nov 5, 2026
39 checks passed
@athvin
athvin deleted the bm/enable-pipeline-kinds branch November 5, 2026 12:08
athvin pushed a commit that referenced this pull request Nov 5, 2026
The deploy becomes five phases instead of one `helm upgrade`, and traffic only
moves after the new colour has answered through its own Services.

    Say what was deployed          (#479, unchanged)
    The namespace chart
    Read the live colour           from svc/er-web's selector — never guessed
    Deploy the inactive colour     new digests, color.active UNCHANGED
    Smoke-test the inactive colour through the PREVIEW Services
    Cut over                       one field on two Service objects
    Retire the old colour          only after the cutover is verified

**The live colour is READ, not stored.** `svc/er-web`'s selector is the same
field the cutover moves, so it cannot drift from reality the way a convention
or a recorded value would. `make dev-resume` reads it the same way. An absent
selector means first install: nothing to cut over from, so the cutover steps
skip.

**The live colour is pinned to the digests it is ALREADY serving** during the
deploy phase. Without that the live Deployment re-renders to the new digest and
restarts the pod taking traffic — the outage this exists to remove. Those
digests are read off the live Deployment's own containers BY CONTAINER NAME, so
the two halves cannot be transposed.

**The schema gate is the hook, not a step here.** `er-schema-migrate` (weight
-5) already runs `er-server migrate --expect-additive`, which plans first and
refuses — writing nothing — if the release is breaking; Helm runs hooks before
any release object is applied, so a breaking release fails with the live colour
untouched. A separate preflight Job would be the same check twice.

**The smoke test hits the PREVIEW Services, and that is the point.** Hitting the
live ones would test what is already in production and pass for the wrong
reason. `charts-check.py` now refuses a chart whose previews point at the live
colour, so the two halves of that property are enforced in different places.

**Retiring the old colour is deliberately decoupled from the cutover.** It runs
only after the cutover is verified, so a failure there leaves traffic correctly
on the new colour with one surplus pod — the harmless direction. Scaled to zero
rather than left warm (two serving pods doubles a namespace's cost); the
Deployment is kept, so the next deploy scales it up with its image cached. A
rollback after that point needs the replica count back as well as the selector,
which is why the step summary prints the command while the old pod is still
there.

**`executor.dagKinds` is now ONE value in `env:`, not two literals.** This step
pair introduces a second `helm upgrade`, and #498 had just extended the
allowlist to the `run_all_*` kinds — two hardcoded copies would have drifted
the first time someone added a third kind to one of them. #498's reasoning for
which kinds are on moves up with the value rather than being left behind in the
step that carried it.

Rebuilt on main's file rather than hand-resolving a conflict, after a
cherry-pick hit two hunks: #479 added a summary step immediately before the
step this replaces, and #498 expanded the allowlist inside it. Taking either
side alone would have silently dropped one of them. Verified both survive —
the summary step, and #498's expanded list in both invocations with its
rationale.

Verified on a real cluster, in throwaway namespaces, because the parts most
likely to be subtly wrong are the ones a render cannot check:

- every `run:` block syntax-checked with `bash -n` (0 errors)
- no inline `${{ }}` in any shell body this adds — values arrive through `env:`
- the colour read, against a live Service: `'blue'` -> target `green`
- digest extraction, against digest-pinned Deployments: both halves parsed to
  `sha256:…`, selected by container NAME
- the first-install branch: absent Service -> empty -> direct path
- **and that the smoke test can FAIL.** `kubectl run` propagates the
  container's exit code: unreachable target -> exit 7, with a positive control
  against a reachable one -> exit 0. A smoke test that cannot fail is worse
  than none, and the positive control is what makes the negative result mean
  "the target is down" rather than "DNS or the image was broken".

Verified: `make check` green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 5, 2026
`images.yml`'s path filter already treats a chart change as a release even when
no image moves — "a change to either IS a dev platform release (§14.2)". The
same argument covers `deploy.yml`, because that file carries the `helm upgrade`
flags, and the executor allowlist lives in one of them
(`--set executor.dagKinds=…`).

It was missing, and the miss had a consequence. #498 flipped the pipeline kinds
on, merged green, and changed NOTHING on the cluster: the commit touched only
`.github/workflows/deploy.yml`, no path matched, no images run started, so no
deploy fired. The live dispatcher still read `lake_maintain,lake_migrate`
afterwards — checked, not assumed.

It did land eventually, but by luck: an unrelated commit touching `rust/**`
started a run, and a `workflow_run` deploy executes the DEFAULT BRANCH's
workflow file, so it picked up the new flags on the way past. Absent that
coincidence the change would have sat unapplied indefinitely, with a green PR
and a merged commit saying otherwise.

That is the "'Merged' did not mean 'deployed'" failure this workflow's own
header documents at length, arriving through a different door — a path filter
rather than a cancelled run.

Adding the path costs nothing when no image moved: the image jobs skip and
`deploy-dev` reuses the digests already in the registry, which is exactly what
the `infra/k8s/**` entry above relies on.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
athvin added a commit that referenced this pull request Nov 5, 2026
…"red" (#502)

Cosmetic but misleading. `mergeStateStatus: UNSTABLE` covers a non-required
check that is red *or* one that has not finished, and the bus reported it as

    #484   skip   a non-required check is red (UNSTABLE)

while #484 was in fact only queued on `record pass marker`. It went CLEAN by
itself a few minutes later. Anyone reading that table would have gone hunting
for a failure that did not exist.

Behaviour is unchanged and was already correct: the bus takes only what GitHub
calls fully clean, so a merely-pending PR is skipped this round and rides the
next. Only the wording and the reasoning around it change, plus the reference
gains the two states that are refused despite being hand-mergeable — pending
and semgrep-only — so the conservatism is written down rather than rediscovered.

Noticed while dry-running the bus for a real landing. That same run verified the
#486 workflow-files exclusion in production: #498 (`deploy.yml`) was correctly
skipped with "merge it by hand".

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 5, 2026
…#472)

The deploy becomes five phases instead of one `helm upgrade`, and traffic only
moves after the new colour has answered through its own Services.

    Say what was deployed          (#479, unchanged)
    The namespace chart
    Read the live colour           from svc/er-web's selector — never guessed
    Deploy the inactive colour     new digests, color.active UNCHANGED
    Smoke-test the inactive colour through the PREVIEW Services
    Cut over                       one field on two Service objects
    Retire the old colour          only after the cutover is verified

**The live colour is READ, not stored.** `svc/er-web`'s selector is the same
field the cutover moves, so it cannot drift from reality the way a convention
or a recorded value would. `make dev-resume` reads it the same way. An absent
selector means first install: nothing to cut over from, so the cutover steps
skip.

**The live colour is pinned to the digests it is ALREADY serving** during the
deploy phase. Without that the live Deployment re-renders to the new digest and
restarts the pod taking traffic — the outage this exists to remove. Those
digests are read off the live Deployment's own containers BY CONTAINER NAME, so
the two halves cannot be transposed.

**The schema gate is the hook, not a step here.** `er-schema-migrate` (weight
-5) already runs `er-server migrate --expect-additive`, which plans first and
refuses — writing nothing — if the release is breaking; Helm runs hooks before
any release object is applied, so a breaking release fails with the live colour
untouched. A separate preflight Job would be the same check twice.

**The smoke test hits the PREVIEW Services, and that is the point.** Hitting the
live ones would test what is already in production and pass for the wrong
reason. `charts-check.py` now refuses a chart whose previews point at the live
colour, so the two halves of that property are enforced in different places.

**Retiring the old colour is deliberately decoupled from the cutover.** It runs
only after the cutover is verified, so a failure there leaves traffic correctly
on the new colour with one surplus pod — the harmless direction. Scaled to zero
rather than left warm (two serving pods doubles a namespace's cost); the
Deployment is kept, so the next deploy scales it up with its image cached. A
rollback after that point needs the replica count back as well as the selector,
which is why the step summary prints the command while the old pod is still
there.

**`executor.dagKinds` is now ONE value in `env:`, not two literals.** This step
pair introduces a second `helm upgrade`, and #498 had just extended the
allowlist to the `run_all_*` kinds — two hardcoded copies would have drifted
the first time someone added a third kind to one of them. #498's reasoning for
which kinds are on moves up with the value rather than being left behind in the
step that carried it.

Rebuilt on main's file rather than hand-resolving a conflict, after a
cherry-pick hit two hunks: #479 added a summary step immediately before the
step this replaces, and #498 expanded the allowlist inside it. Taking either
side alone would have silently dropped one of them. Verified both survive —
the summary step, and #498's expanded list in both invocations with its
rationale.

Verified on a real cluster, in throwaway namespaces, because the parts most
likely to be subtly wrong are the ones a render cannot check:

- every `run:` block syntax-checked with `bash -n` (0 errors)
- no inline `${{ }}` in any shell body this adds — values arrive through `env:`
- the colour read, against a live Service: `'blue'` -> target `green`
- digest extraction, against digest-pinned Deployments: both halves parsed to
  `sha256:…`, selected by container NAME
- the first-install branch: absent Service -> empty -> direct path
- **and that the smoke test can FAIL.** `kubectl run` propagates the
  container's exit code: unreachable target -> exit 7, with a positive control
  against a reachable one -> exit 0. A smoke test that cannot fail is worse
  than none, and the positive control is what makes the negative result mean
  "the target is down" rather than "DNS or the image was broken".

Verified: `make check` green.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 6, 2026
A regression I introduced in #498 and did not notice.

Putting `run_all_full` on the executor allowlist moved pipeline runs off the
legacy arm. The legacy arm's tail did two things once a run settled:

    dispatcher.rs  emit_entity_aggregates(client, &completed, &entity_counts)
    dispatcher.rs  run_report_messages(..., &entity_counts)

The DAG path's settle did one:

    executor.rs    webhook::emit_job_event(&self.client, &settled)

`emit_job_event` sends the `job.*` event for the outcome. It does NOT send the
`entity.*` aggregates, and `emit_entity_aggregates` had exactly one caller —
the arm the pipeline kinds had just stopped using. So since #498 deployed,
every pipeline run on the ci namespace has emitted no `entity.created`,
`entity.merged` or `entity.member_added` aggregate, and the emailed run report
has carried no entity counts. A subscriber keyed on `entity.*` simply stopped
hearing, with nothing reporting that.

## Why the counts have to ride in the task output

Counting is a lake query; emitting is a Postgres write. No single process does
both any more, and the legacy code's own comment says why:

    Read HERE because this is the half that holds the lake session; the half
    that can emit holds the Postgres client.

In `run_job` those were two halves of one function. Split across a pod
boundary they are a pod and the control plane — and the control plane cannot
open a lake, which `lib.rs`'s clear-closure probe already states outright
("THIS process cannot open a lake (§3.5 draws that line at the lake, and the
control plane is on the wrong side of it)").

So `finish` counts — it is the last task of the run and the last place a lake
session exists — and publishes into `FinishReport`. Settle reads the counts off
the row map the readiness pass already loaded, and emits. Best-effort at both
ends, as the legacy arm was: a count that cannot be read must not fail a
teardown whose run is already written.

Absent for every kind with no `finish` task, which is correct rather than a
gap: `lake_maintain`, `train` and `profile` reconcile no entities, so there is
nothing to announce. §10 says as much — "Entity aggregates fire at settle".

## Tests

The boundary is JSON and nothing type-checks `output["doc"]["entity_counts"]`
— it is `Value::get` on strings, so a rename on either side would compile and
then silently emit nothing, which is this exact bug a second time. Three tests
pin it: the round trip through `Plan(FinishReport)` using the settle path's
literal key chain, an empty count set reading as "nothing to announce" rather
than as a missing reading, and an output written BEFORE the field existed still
deserializing — `#[serde(default)]` is what keeps a `{"settled": "closed"}` row
already in the ledger readable, and `pg_task_instances.rs` writes exactly that
shape.

`make check` green.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants