carlos / platform Public

region HA W6: drain a fixed box out of the NLB before its edge stops

A fixed box that is an NLB target now fails its own health check, waits
until DescribeTargetHealth shows both target groups have withdrawn it
(plus a 10 s settle), closes its public listeners gracefully, and only
then lets systemd stop tenants and the edge. Triggers: carlos system
apply and rollback ask before the binary swap; a new
carlos-edge-drain.service (Upholds= from the edge, every tenant unit
Before= it) runs the drain in its ExecStop for manual restarts and
reboots. Group members are excluded (they use §25 Standby).

Also: target groups stop resetting connections on unhealthy targets
(180 s draining); fixed boxes get read-only DescribeTargetHealth and
DescribeTargetGroupAttributes; host-env key CARLOS_INGRESS_TARGET_GROUPS;
the gzip header sync keeps a drain's Connection: close (fixes §25 too);
wakes on a draining box get 503 Retry-After.

Spec docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md
(rev 4, approved). Root-runner witness on real systemd 257: drain ends
before the first tenant stop and the edge stop. Census approved (#280).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from w6-ingress-drain into main.
claude agent, operated by paul@keymail.dev a130aea432383e2d49bc3cb20e16ec800865895d parent a450449
84 files changed, +7,534 −93
  • commands.go +7 −0
  • commands_test.go +2 −2
  • docs/region-ha-runbook.md +113 −1
  • docs/superpowers/notes/census-claims-w6-ingress-drain.tsv +34 −0
  • docs/superpowers/notes/census-proposal-w6-ingress-drain.md +82 −0
  • docs/superpowers/plans/2026-11-10-fixed-edge-ingress-drain.md +81 −0
  • docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md +4 −3
  • docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md +223 −0
  • infra/modules/region-host/ingress/main.tf +10 −0
  • infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl +18 −0
  • infra/modules/region-host/main.tf +23 −0
  • infra/modules/region-host/outputs.tf +5 −0
  • infra/modules/region-host/tests/group_iam.tftest.hcl +13 −0
  • infra/modules/region-host/tests/ingress_drain_read.tftest.hcl +112 −0
  • infra/modules/region-host/variables.tf +32 −0
  • internal/activator/activator.go +3 −0
  • internal/activator/group_admission.go +3 −0
  • internal/activator/group_admission_test.go +23 −0
  • internal/edge/compress.go +10 −0
  • internal/edge/compress_test.go +70 −0
  • internal/edge/edge.go +7 −7
  • internal/edge/hadrainconns.go +59 −23
  • internal/edge/heldstream.go +8 −3
  • internal/edge/ingressdrain.go +192 −0
  • internal/edge/ingressdrain_test.go +676 −0
  • internal/host/agent.go +42 −10
  • internal/host/bootstrap.go +8 −1
  • internal/host/departure_queue_default.go +19 −0
  • internal/host/departure_queue_rootrunner.go +44 −0
  • internal/host/execsandboxfloor_test.go +1 −1
  • internal/host/group_admission.go +21 −2
  • internal/host/group_admission_test.go +41 −0
  • internal/host/group_maintenance_test.go +1 −1
  • internal/host/gvisor_fixture_rootrunner_linux_test.go +1 −1
  • internal/host/gvisor_hardening_rootrunner_linux_test.go +1 −1
  • internal/host/gvisor_units_test.go +1 −0
  • internal/host/hadrain_call.go +122 −11
  • internal/host/hadrain_call_linux.go +16 −1
  • internal/host/hadrain_call_other.go +12 −0
  • internal/host/hadrain_socket.go +60 −1
  • internal/host/hadrain_socket_linux.go +1 −1
  • internal/host/hadrain_socket_other.go +3 −2
  • internal/host/haplacement_root_linux_test.go +13 −4
  • internal/host/haterminate_rootrunner_linux_test.go +5 −0
  • internal/host/host_test.go +3 −2
  • internal/host/ingressdrain.go +676 −0
  • internal/host/ingressdrain_call_linux_test.go +203 −0
  • internal/host/ingressdrain_rootrunner_linux_test.go +1,237 −0
  • internal/host/ingressdrain_socket_linux_test.go +58 −0
  • internal/host/ingressdrain_test.go +1,170 −0
  • internal/host/rootmovesfloor_refresh_test.go +1 −1
  • internal/host/systemapply.go +96 −4
  • internal/host/systemapply_ingress_test.go +366 −0
  • internal/host/systemapply_test.go +6 −6
  • internal/host/units/carlos-edge-drain.service +60 −0
  • internal/host/units/carlos-edge.service +5 −0
  • internal/host/units/carlos-instance-cmd@.service +2 −0
  • internal/host/units/carlos-instance-gen@.service +2 −0
  • internal/host/units/carlos-instance-gvisor@.service +1 −0
  • internal/host/units/carlos-instance-rootfs-cmd@.service +2 −0
  • internal/host/units/carlos-instance-rootfs-gen@.service +2 −0
  • internal/host/units/carlos-instance-rootfs-tty@.service +2 −0
  • internal/host/units/carlos-instance-rootfs-worker@.service +2 −0
  • internal/host/units/carlos-instance-rootfs@.service +2 −0
  • internal/host/units/carlos-instance-seed@.service +2 −0
  • internal/host/units/carlos-instance-sidecar@.service +2 −0
  • internal/host/units/carlos-instance-tty@.service +2 −0
  • internal/host/units/carlos-instance@.service +2 −0
  • internal/host/units/carlos-system-recover.service +4 −1
  • internal/host/units/carlos-system-update.service +5 −2
  • internal/host/units_ingress_drain_test.go +207 −0
  • internal/hostenv/group.go +3 −0
  • internal/hostenv/hostenv.go +43 −0
  • internal/hostenv/hostenv_test.go +113 −0
  • internal/ingresshealth/awstg/awstg.go +148 −0
  • internal/ingresshealth/awstg/awstg_test.go +282 −0
  • internal/ingresshealth/ingresshealth.go +278 −0
  • internal/ingresshealth/ingresshealth_test.go +197 −0
  • internal/lbhealth/lbhealth.go +19 −1
  • internal/lbhealth/lbhealth_test.go +33 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-w6-ingress-drain.tsv +73 −0
  • parity/cli.tsv +1 −0
  • testdata/clireg-golden.jsonl +1 −0

CI failed — run details

commands.go

Loading diff…

commands_test.go

Loading diff…

docs/region-ha-runbook.md

Loading diff…

docs/superpowers/notes/census-claims-w6-ingress-drain.tsv

Loading diff…

docs/superpowers/notes/census-proposal-w6-ingress-drain.md

Loading diff…

docs/superpowers/plans/2026-11-10-fixed-edge-ingress-drain.md

Loading diff…

docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md

Loading diff…

docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md

Loading diff…

infra/modules/region-host/ingress/main.tf

Loading diff…

infra/modules/region-host/ingress/tests/group_ingress.tftest.hcl

Loading diff…

infra/modules/region-host/main.tf

Loading diff…

infra/modules/region-host/outputs.tf

Loading diff…

infra/modules/region-host/tests/group_iam.tftest.hcl

Loading diff…

infra/modules/region-host/tests/ingress_drain_read.tftest.hcl

Loading diff…

infra/modules/region-host/variables.tf

Loading diff…

internal/activator/activator.go

Loading diff…

internal/activator/group_admission.go

Loading diff…

internal/activator/group_admission_test.go

Loading diff…

internal/edge/compress.go

Loading diff…

internal/edge/compress_test.go

Loading diff…

internal/edge/edge.go

Loading diff…

internal/edge/hadrainconns.go

Loading diff…

internal/edge/heldstream.go

Loading diff…

internal/edge/ingressdrain.go

Loading diff…

internal/edge/ingressdrain_test.go

Loading diff…

internal/host/agent.go

Loading diff…

internal/host/bootstrap.go

Loading diff…

internal/host/departure_queue_default.go

Loading diff…

internal/host/departure_queue_rootrunner.go

Loading diff…

internal/host/execsandboxfloor_test.go

Loading diff…

internal/host/group_admission.go

Loading diff…

internal/host/group_admission_test.go

Loading diff…

internal/host/group_maintenance_test.go

Loading diff…

internal/host/gvisor_fixture_rootrunner_linux_test.go

Loading diff…

internal/host/gvisor_hardening_rootrunner_linux_test.go

Loading diff…

internal/host/gvisor_units_test.go

Loading diff…

internal/host/hadrain_call.go

Loading diff…

internal/host/hadrain_call_linux.go

Loading diff…

internal/host/hadrain_call_other.go

Loading diff…

internal/host/hadrain_socket.go

Loading diff…

internal/host/hadrain_socket_linux.go

Loading diff…

internal/host/hadrain_socket_other.go

Loading diff…

internal/host/haplacement_root_linux_test.go

Loading diff…

internal/host/haterminate_rootrunner_linux_test.go

Loading diff…

internal/host/host_test.go

Loading diff…

internal/host/ingressdrain.go

Loading diff…

internal/host/ingressdrain_call_linux_test.go

Loading diff…

internal/host/ingressdrain_rootrunner_linux_test.go

Loading diff…

internal/host/ingressdrain_socket_linux_test.go

Loading diff…

internal/host/ingressdrain_test.go

Loading diff…

internal/host/rootmovesfloor_refresh_test.go

Loading diff…

internal/host/systemapply.go

Loading diff…

internal/host/systemapply_ingress_test.go

Loading diff…

internal/host/systemapply_test.go

Loading diff…

internal/host/units/carlos-edge-drain.service

Loading diff…

internal/host/units/carlos-edge.service

Loading diff…

internal/host/units/carlos-instance-cmd@.service

Loading diff…

internal/host/units/carlos-instance-gen@.service

Loading diff…

internal/host/units/carlos-instance-gvisor@.service

Loading diff…

internal/host/units/carlos-instance-rootfs-cmd@.service

Loading diff…

internal/host/units/carlos-instance-rootfs-gen@.service

Loading diff…

internal/host/units/carlos-instance-rootfs-tty@.service

Loading diff…

internal/host/units/carlos-instance-rootfs-worker@.service

Loading diff…

internal/host/units/carlos-instance-rootfs@.service

Loading diff…

internal/host/units/carlos-instance-seed@.service

Loading diff…

internal/host/units/carlos-instance-sidecar@.service

Loading diff…

internal/host/units/carlos-instance-tty@.service

Loading diff…

internal/host/units/carlos-instance@.service

Loading diff…

internal/host/units/carlos-system-recover.service

Loading diff…

internal/host/units/carlos-system-update.service

Loading diff…

internal/host/units_ingress_drain_test.go

Loading diff…

internal/hostenv/group.go

Loading diff…

internal/hostenv/hostenv.go

Loading diff…

internal/hostenv/hostenv_test.go

Loading diff…

internal/ingresshealth/awstg/awstg.go

Loading diff…

internal/ingresshealth/awstg/awstg_test.go

Loading diff…

internal/ingresshealth/ingresshealth.go

Loading diff…

internal/ingresshealth/ingresshealth_test.go

Loading diff…

internal/lbhealth/lbhealth.go

Loading diff…

internal/lbhealth/lbhealth_test.go

Loading diff…

internal/provision/testdata/plan14-root-reads-chain.tsv

Loading diff…

internal/provision/testdata/plan14-root-reads-w6-ingress-drain.tsv

Loading diff…

parity/cli.tsv

Loading diff…

testdata/clireg-golden.jsonl

Loading diff…