Skip to content

feat(009): pin the Deployment to the stop-handler image (fifth pin) - #73

Merged
bartekus merged 1 commit into
mainfrom
009-fifth-pin-stop-handler
Jul 26, 2026
Merged

bartekus merged 1 commit into
mainfrom
009-fifth-pin-stop-handler

Conversation

@bartekus

Copy link
Copy Markdown
Contributor

What

Moves the Deployment from digest 43717a27 to 780eeefe (tag 7ff1347, the PR #72 merge), and records the pin as spec 009's fifth-pin amendment.

Why now

The 2026-07-25 fail-loud run closed section 5's oldest acceptance item, but it closed it by finding a defect: docker/entrypoint.sh is PID 1 and had no signal handler, so on every container stop rauthy was SIGKILLed and never released its hiqlite WAL and state-machine locks. Every boot after every restart began unclean, and intermittently the stale lock aborted rauthy into a crash loop, reachable from an ordinary kubectl delete pod.

The fix landed in PR #70 (and enrahitu #31), but the running image predates it. This pin is what makes that work real in production.

What rides it

Two changes, from two specs' territory:

  1. Spec 002 (docker/entrypoint.sh): TERM/INT traps forward the stop to rauthy and the app, then wait. Installed immediately after rauthy is backgrounded, so a stop during the rauthy health wait is handled too.
  2. Spec 006 (backend/fleet/*): fleet_app.name keeps its index and loses unique; uniqueness is scoped to non-removed rows, enforced fleet-wide, and deploy answers a typed 409 ahead of the action gate.

Risk

Lower than a pin normally carries. The DROP CONSTRAINT was applied to the live database on 2026-07-25 ahead of the #69 merge (precedent: the port BIGINT ALTER, third pin), so no ordering window exists, and since the deployed code has no name check at all that ALTER alone already fixed the production symptom. No schema delta, no secret delta, no env change. The digest change rolls the pod by itself under Recreate.

Acceptance

Three signals, verified after Flux reconciles:

  1. Rolled pod Ready on 780eeefe, edge serves 200.
  2. A deliberate kubectl delete pod logs [entrypoint] received SIGTERM; stopping supervised processes, and the replacement boots without the LockFile ... exists already - this is not a clean start! warnings every boot has carried until now. First time that absence is observable.
  3. fleet_app carries idx_fleet_app_name (ensureSchema emits it only when the column is not unique, so it appears on this image's first boot, not on the boot after the ALTER).

Local gate: compile, index, lint --fail-on-warn, index check, couple all green (couple: 2 paths, no drift).

The 2026-07-25 fail-loud run closed section 5's oldest acceptance item by
finding a defect, and the fix could not reach the cluster without a
rebuild. Digest 780eeefe (tag 7ff1347) is the first image whose
entrypoint forwards container stop to rauthy, so hiqlite releases its WAL
and state-machine locks and the next boot starts clean; until now every
boot after every restart began unclean and could escalate into a crash
loop from an ordinary kubectl delete pod.

The same image carries spec 006's name-reuse fix: uniqueness scoped to
non-removed rows, enforced fleet-wide, with a typed 409 ahead of the
action gate. Its DROP CONSTRAINT was applied live ahead of the merge, so
no ordering window exists and the production symptom is already fixed;
what arrives with the image is the typed 409 and the plain
idx_fleet_app_name that ensureSchema emits on first boot.

No schema, secret, or env delta rides this pin. The digest change rolls
the pod by itself under Recreate.
@github-actions

Copy link
Copy Markdown

AI Code Review

Spec Coupling

The amendment explicitly acknowledges that the entrypoint fix lives in "spec 002's territory" and the name-reuse fix in "spec 006's territory," but neither specs/002-*/spec.md nor specs/006-*/spec.md appears in this diff. If PR #72 (the code merge at 7ff1347) updated those owning specs, this PR is clean. If it did not, the behavioral changes — signal forwarding, typed 409, idx_fleet_app_name — are undocumented in their authoritative specs, and spec 009's amendment is the only paper trail for cross-spec changes. Worth verifying PR #72 touched both owning specs before merging this pin.

Acceptance Criteria Are Prospective

The three acceptance signals are written in future tense ("The rolled pod is Ready...", "A deliberate kubectl delete pod logs..."). That means this PR merges before acceptance is confirmed. If the project convention is to record acceptance before cutting the pin, the amendment should be updated post-deployment to reflect observed outcomes rather than expected ones. If post-merge recording is acceptable, no action needed — but it should be stated explicitly in the amendment.

No Other Issues

  • .derived/ shards are properly regenerated (both codebase-index and spec-registry updated, not hand-edited).
  • Image is pinned by digest; imagePullPolicy: IfNotPresent is correct for digest-pinned images.
  • The deploy ordering note (ALTER preceded the image, so the production symptom was already resolved before this pin) is correctly documented and reduces rollout risk.

Automated review by Claude. Diff size: 68 lines.

@bartekus
bartekus merged commit 5d29590 into main Jul 26, 2026
3 checks passed
@bartekus
bartekus deleted the 009-fifth-pin-stop-handler branch July 26, 2026 00:59
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.

1 participant