gateway: the address heartbeat — keep a residential gateway's DNS record current #330
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Depends on
Reference
Matou/idss#330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A gateway on a residential connection usually has a dynamic public IP. Nothing in the fleet observes or re-derives it, so when the ISP rotates the address the community goes dark until a human notices.
Standup.GatewayIPis set exactly once (internal/founding/standup.go:481) andPointSubdomainis called exactly once, during founding, from the operator's laptop (standup.go:632). ADR 0014 already names the future problem: "The revisit trigger is gateway-IP churn becoming a support burden."Why this is small
Zone.PutRecordsis documented as "creates or repoints" (broker/internal/broker/broker.go:69-74), implemented as a real upsert (zone.go:283-299), and returns only once the record answers from the authoritative NS (zone.go:377-400). Calling it twice for a slug is already safe.internal/dns/resolver.go:24-42reflects the connection's public address offmyip.opendns.com— written for the CGNAT pre-check, reusable as-is (a gateway behind NAT cannot read its own public address from an interface).control-planealready runsgo c.mon.Run(context.Background(), aggregationInterval)(control-plane/cmd/control-plane/main.go:481), gated onc.whole. A second goroutine beside it needs no new binary, no systemd unit, no supply step and no Nix change — which also sidesteps the Attach-layer blocker.What is missing
/pointon a timer over an unauthenticated endpoint with a volatile ledger makes that exposure materially worse. Nothing here starts before that lands.internal/brokerclienthas one production consumer, the operator app helper (app/helper/cmd/helper/wiring_prod.go:237);control-plane/does not import it, and holds no broker credential.internal/clan/acmedns.go:135-137embeds the gateway IP in the delegated zone's NS and glue A records, so an address change invalidates certificate issuance, not just service routing. Either the heartbeat rewrites glue too, or acme-dns learns its address at runtime instead of render time. Cheaper to design in now, sinceRenderAcmeDNShas no attach step yet.Scope boundary that needs ruling
This can only ever work on the
<slug>.idss.nzpath. TheZoneport is bound to that apex by construction (Issuer.slugOf,broker.go:233-244; the Cloudflare token is zone-scoped,zone.go:81-86) and ADR 0049 §2 refuses registrar API integration outright: "No API integration with arbitrary registrars — an unbounded surface, refused." Own-domain communities are architecturally excluded, not merely unbuilt.Accepting that split honestly is probably right, but it is Ben's call — and it means own-domain + residential stays a manual-fix posture.
Alternative considered
A heartbeat channel already exists end-to-end on the ingest side (
enroll.FleetReporting.Report->monitor.HeartbeatStream,internal/monitor/stream.go:31-63, arrival-stamped,StaleAfter5 min, ADR 0071 silence classification). ButStatusReportcarries no address field, the agent has no periodic emit loop yet, and the agent never runs on the gateway by design (agent/cmd/agent/main.go:1-5). Riding it is possible but not cheaper.Background:
docs/research/2026-08-07-home-gateway-reachability-scope.md§4.Ruled by Ben 2026-08-08 (decision sweep) → ADR 0136 (
1716193, on main): the heartbeat is<slug>.idss.nz-only (own-domain + residential is accepted as a stated manual-fix posture — honest copy, not implication), lives as acontrol-planegoroutine beside the monitor loop, and rewrites every address-bearing record including the acme-dns NS/glue — a healed A record with broken cert issuance is not healed. A heartbeat that cannot write raises a standing named state (ADR 0071/0100). Auth is the claim secret (ADR 0135) reaching the gateway via the vars machinery (sops). Blocked on #322 landing →agent-blocked; flip toready-for-agentwhen #322 closes.Implemented in
da024fa(onorigin/main).Per Ben's ruling (ADR 0136), the address heartbeat now keeps a residential gateway's
<slug>.idss.nzrecord current against dynamic-IP churn.What shipped:
internal/heartbeat— the engine (seam): aDiscovererport (the gateway's public address) + aRepointerport (the broker/pointupsert), and aTickthat re-points only when the observed address changed or a prior write is still owed. Red-first seam tests cover: unchanged→silent, changed→point, no-seed self-heal, failed-write raises a standingrepoint-failedstate (keeps last-known-good, records pending IP, holds raised-at) then clears on recovery, discovery gap is never green, a discovery gap does not mask a known-stale record, andRunticks-then-cancels.internal/dns.PublicIP— exports the CGNAT pre-check's OpenDNS reflection lookup, reused as-is (honest from behind NAT).internal/brokerclient.IssuanceApex— the idss scope boundary constant.control-plane/cmd/control-plane/main.go— firstbrokerclientimport; the goroutine starts beside the monitor loop, gated on its own wiring (community apex underidss.nzandOURCLOUD_CLAIM_SECRETpresent), else rests loud (ADR 0100). The re-point rewrites the whole broker-owned record family (slug A +*.<slug>wildcard +_acme-challengeCNAME) in one call and threads the gateway's published acme-dns fulldomain so cert issuance re-points with routing. Wiring tests cover rest (no apex / own-domain / no-secret) and wire (idss+secret).STATUS.md— header lead + milestone log.Failure posture (ADR 0071/0100): success is silent; a write that cannot land raises a standing named state that stays live until a later write succeeds — never a silently-stale record.
Scope honoured: idss-only (own-domain + residential is a stated manual posture, ADR 0049/0136).
Follow-up (noted in STATUS header): the gateway-side acme-dns daemon glue (
internal/clan/acmedns.go) has no production attach caller yet, so its rewrite rides the future deploy path; folding the heartbeat's standing state into the monitor's alert set is the next slice (the engine holds it queryably + logs it loud today).Verified:
go build/go test/go vet/golangci-lint/gofmtgreen; the pre-push gate (whole-tree Go stages) passed.