provision: the co-host files route is attached ONLY on the private path — own-VPS front door never learns files.<apex>, probes 0-byte forever (deploy.go:580, the #529 stale-flag class) #557

Closed
opened 2026-08-15 02:16:00 +00:00 by ben · 3 comments
Owner

What breaks — the last standing cause of every public-path files-healthy red

Drive 20260815T014915Z (#556's per-probe logs live): all 36 warm-up probes across the full 360s budget returned got 0 B — not a warm-up race. The droplet harvest shows why, conclusively:

  • nginx LISTENING on 127.0.0.1:8084 (droplet-units.txt) — the Nextcloud module deployed fine,
  • Caddy started ONCE at 01:57:26 (after the #554 gate — which worked beautifully, 2.5-min hold then release) and was never reloaded/restarted by the co-host switch,
  • Caddy's log has ZERO proxy/dial/502 lines for files — it never proxied anything because it has no route,
  • the app-side rendered front-door.nix carries no files route (only kanidm var-path mentions).

https://files.<apex>/status.php falls through the wildcard vhost to an empty response: HTTP-with-0-byte-body, forever, no error logged anywhere. Exactly what #536 named "layer-3 silence" on drive 171114Z.

Cause — one stale flag, the same class #529 already ruled on

internal/provision/deploy.go:580 (co-host tail):

// On the PRIVATE path the deploy ALSO adds the files route to the front door
if o.privateFrontDoor {
    AttachFrontDoor(… Services: [{files → NextcloudLoopbackTarget}] …)
}

The route attach is keyed on privateFrontDoor. The own-VPS (public) gateway co-hosts Caddy just the same, so the route never lands there. This is IDENTICAL in shape to #529's nginx-loopback bug one function below, whose landed comment says verbatim: "keying the override off the private-path flag left nginx on :80… coHosted IS the true co-host detection." The route kept the stale key.

Fix directed

  • Attach the files route whenever coHosted, on BOTH paths: public live set = Gateway/Apex/IDPHost + Services: [{FilesSlug, NextcloudLoopbackTarget}], Private only when the private flag stands (the public render's route loop + forward_auth/exempt-path machinery already exists — renderRoute is shared; ADR 0150's ungated-files posture applies per path as today).
  • Placement mirrors the private branch: attach BEFORE ComposeGatewayCohost, so the switch carries the changed front-door config and restarts Caddy.
  • Seam test: an own-VPS co-host deploy's front-door render MUST carry the files.<apex> handler proxying 127.0.0.1:8084 (assert on the rendered nix, both paths); plus pin that a co-host switch changes the caddy unit's config (the restart is what delivers the route).

Why confidence is high

This explains the ENTIRE public files-healthy history in one stroke: #527 (exempt paths) and #529 (port) were real neighbors; #536's "silence" and tonight's 0-byte probes are the missing route itself. The private path never saw it because its deploy takes the privateFrontDoor branch. Every upstream tooth (finish/cert race, warm-up budget) is now proven fixed — this is the last gate before the door/branded-login/oidc-admin/branded-chrome legs.

Frontier tooth of #492 (blocks it). Evidence: test-results/drive-droplet/20260815T014915Z/ (droplet-units.txt LISTEN table, droplet-caddy.txt absence-of-proxy, per-probe journal lines 02:0x, front-door.nix).

## What breaks — the last standing cause of every public-path files-healthy red Drive `20260815T014915Z` (#556's per-probe logs live): all 36 warm-up probes across the full 360s budget returned **`got 0 B`** — not a warm-up race. The droplet harvest shows why, conclusively: - nginx LISTENING on `127.0.0.1:8084` (droplet-units.txt) — the Nextcloud module deployed fine, - Caddy started ONCE at 01:57:26 (after the #554 gate — which worked beautifully, 2.5-min hold then release) and was **never reloaded/restarted by the co-host switch**, - Caddy's log has ZERO proxy/dial/502 lines for files — it never proxied anything because it has no route, - the app-side rendered `front-door.nix` carries **no files route** (only kanidm var-path mentions). `https://files.<apex>/status.php` falls through the wildcard vhost to an empty response: HTTP-with-0-byte-body, forever, no error logged anywhere. Exactly what #536 named "layer-3 silence" on drive 171114Z. ## Cause — one stale flag, the same class #529 already ruled on `internal/provision/deploy.go:580` (co-host tail): // On the PRIVATE path the deploy ALSO adds the files route to the front door if o.privateFrontDoor { AttachFrontDoor(… Services: [{files → NextcloudLoopbackTarget}] …) } The route attach is keyed on `privateFrontDoor`. The own-VPS (public) gateway co-hosts Caddy just the same, so the route never lands there. This is IDENTICAL in shape to #529's nginx-loopback bug one function below, whose landed comment says verbatim: "keying the override off the private-path flag left nginx on :80… `coHosted` IS the true co-host detection." The route kept the stale key. ## Fix directed - Attach the files route whenever `coHosted`, on BOTH paths: public live set = Gateway/Apex/IDPHost + `Services: [{FilesSlug, NextcloudLoopbackTarget}]`, `Private` only when the private flag stands (the public render's route loop + forward_auth/exempt-path machinery already exists — renderRoute is shared; ADR 0150's ungated-files posture applies per path as today). - Placement mirrors the private branch: attach BEFORE `ComposeGatewayCohost`, so the switch carries the changed front-door config and restarts Caddy. - Seam test: an own-VPS co-host deploy's front-door render MUST carry the `files.<apex>` handler proxying `127.0.0.1:8084` (assert on the rendered nix, both paths); plus pin that a co-host switch changes the caddy unit's config (the restart is what delivers the route). ## Why confidence is high This explains the ENTIRE public files-healthy history in one stroke: #527 (exempt paths) and #529 (port) were real neighbors; #536's "silence" and tonight's 0-byte probes are the missing route itself. The private path never saw it because its deploy takes the `privateFrontDoor` branch. Every upstream tooth (finish/cert race, warm-up budget) is now proven fixed — this is the last gate before the door/branded-login/oidc-admin/branded-chrome legs. Frontier tooth of #492 (blocks it). Evidence: `test-results/drive-droplet/20260815T014915Z/` (droplet-units.txt LISTEN table, droplet-caddy.txt absence-of-proxy, per-probe journal lines 02:0x, front-door.nix).
Author
Owner

swarm-claim host=elitebook-distributed-server-03 run=6565
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=6565 (automated multi-host claim — lowest live claim id works this ticket)
Author
Owner

close-report for #557 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 557,
  "status": "success",
  "commits": [
    "a1b6f1c1f5c3bd804c0c2cfbba663defdeb9c0c2"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/files_frontdoor_test.go",
    "internal/clan/frontdoor.go",
    "internal/founding/ownvpspath.go",
    "internal/provision/deploy.go",
    "internal/provision/deploy_test.go"
  ],
  "tests": [
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/provision/ ./internal/clan/ ./internal/founding/ ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/provision/ ./internal/clan/ ./internal/founding/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Attach the files route whenever coHosted, on BOTH paths (public + private)": "internal/provision/deploy.go attachFilesCohost now attaches the front-door route unconditionally inside the coHosted block; the private branch sets Private, the public branch sets GateURL+Kanidm; the route lands on both paths.",
    "Public live set carries the files route + reproduces the gate/kanidm facts (whole-rewrite must not drop the IdP)": "Public branch builds FrontDoorLiveSet with Gateway/Apex/IDPHost + GateURL=clan.PublicGateURL + Kanidm={clan.PublicKanidmLoopbackPort,CertPath,KeyPath} + Services:[{FilesSlug, NextcloudLoopbackTarget, FilesExemptPaths}]; asserted by TestDeploy_PublicGatewayFilesAddsTheFrontDoorRoute and TestAttachFrontDoor_PublicCoHostKeepsIdPBesideTheFilesRoute (kanidm survives on the rendered nix).",
    "Placement mirrors the private branch: attach BEFORE ComposeGatewayCohost so the switch carries the changed config and restarts Caddy": "AttachFrontDoor is called before ComposeGatewayCohost in attachFilesCohost; TestDeploy_PublicGatewayFilesAddsTheFrontDoorRoute asserts the recorded call order front-door < compose.",
    "Seam test: an own-VPS co-host deploy's front-door render carries the files.<apex> handler proxying 127.0.0.1:8084 (rendered nix, both paths)": "TestAttachFrontDoor_PublicCoHostKeepsIdPBesideTheFilesRoute renders the exact public live set and asserts reverse_proxy 127.0.0.1:8084 under @files host files.<apex>, plus /status.php exempt and the kanidm loopback block present; the private path's rendered route is already covered by frontdoor_private_test + TestDeploy_PrivateGatewayFilesAddsTheFrontDoorRoute.",
    "Seam test: a co-host switch changes the caddy unit's config (the restart delivers the route)": "TestDeploy_PublicGatewayFilesAddsTheFrontDoorRoute pins AttachFrontDoor (which rewrites front-door.nix) is recorded before ComposeGatewayCohost (whose gateway switch applies the changed config and restarts Caddy)."
  },
  "summary": "The co-hosted files front-door route now attaches on true co-host detection (coHosted), not the private-path flag, so the own-VPS public gateway learns files.<apex>; the public re-render reproduces the gate+kanidm facts from a single clan authority so the whole-rewrite keeps the IdP.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #557 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 557, "status": "success", "commits": [ "a1b6f1c1f5c3bd804c0c2cfbba663defdeb9c0c2" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/files_frontdoor_test.go", "internal/clan/frontdoor.go", "internal/founding/ownvpspath.go", "internal/provision/deploy.go", "internal/provision/deploy_test.go" ], "tests": [ { "command": "go build ./...", "exit_code": 0 }, { "command": "go test ./internal/provision/ ./internal/clan/ ./internal/founding/ ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "go vet ./internal/provision/ ./internal/clan/ ./internal/founding/", "exit_code": 0 } ], "criteria": { "Attach the files route whenever coHosted, on BOTH paths (public + private)": "internal/provision/deploy.go attachFilesCohost now attaches the front-door route unconditionally inside the coHosted block; the private branch sets Private, the public branch sets GateURL+Kanidm; the route lands on both paths.", "Public live set carries the files route + reproduces the gate/kanidm facts (whole-rewrite must not drop the IdP)": "Public branch builds FrontDoorLiveSet with Gateway/Apex/IDPHost + GateURL=clan.PublicGateURL + Kanidm={clan.PublicKanidmLoopbackPort,CertPath,KeyPath} + Services:[{FilesSlug, NextcloudLoopbackTarget, FilesExemptPaths}]; asserted by TestDeploy_PublicGatewayFilesAddsTheFrontDoorRoute and TestAttachFrontDoor_PublicCoHostKeepsIdPBesideTheFilesRoute (kanidm survives on the rendered nix).", "Placement mirrors the private branch: attach BEFORE ComposeGatewayCohost so the switch carries the changed config and restarts Caddy": "AttachFrontDoor is called before ComposeGatewayCohost in attachFilesCohost; TestDeploy_PublicGatewayFilesAddsTheFrontDoorRoute asserts the recorded call order front-door < compose.", "Seam test: an own-VPS co-host deploy's front-door render carries the files.<apex> handler proxying 127.0.0.1:8084 (rendered nix, both paths)": "TestAttachFrontDoor_PublicCoHostKeepsIdPBesideTheFilesRoute renders the exact public live set and asserts reverse_proxy 127.0.0.1:8084 under @files host files.<apex>, plus /status.php exempt and the kanidm loopback block present; the private path's rendered route is already covered by frontdoor_private_test + TestDeploy_PrivateGatewayFilesAddsTheFrontDoorRoute.", "Seam test: a co-host switch changes the caddy unit's config (the restart delivers the route)": "TestDeploy_PublicGatewayFilesAddsTheFrontDoorRoute pins AttachFrontDoor (which rewrites front-door.nix) is recorded before ComposeGatewayCohost (whose gateway switch applies the changed config and restarts Caddy)." }, "summary": "The co-hosted files front-door route now attaches on true co-host detection (coHosted), not the private-path flag, so the own-VPS public gateway learns files.<apex>; the public re-render reproduces the gate+kanidm facts from a single clan authority so the whole-rewrite keeps the IdP.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
ben closed this issue 2026-08-15 02:34:04 +00:00
Author
Owner

Blocked: needs a human ruling — the directed public-path fix would regress the founding front door

I picked this up (run 6564) and did the forensics. The directed fix — attach the files route on BOTH paths with the public live set Gateway/Apex/IDPHost + Services: [{FilesSlug, NextcloudLoopbackTarget}] — cannot be implemented as written without regressing the public front door. A human ruling is needed on how the route should land.

Why the literal fix regresses

AttachFrontDoor rewrites front-door.nix whole from the passed live set (its own doc: "rewrites the module WHOLE from the live set every run").

  • Private path works with the partial set because renderPrivateFrontDoor reconstructs the entire door from apex/IDPHost + routes alone — it declares no services.kanidm (the guest baseline owns it) and no forward_auth/gateURL (ungated, ADR 0150). So {Gateway, Apex, IDPHost, Private, Services} is complete.
  • Public path breaks: RenderFrontDoor (public branch) emits renderKanidmLoopback (needs Kanidm.Port/CertPath/KeyPath), the forward_auth gate (needs GateURL), and mail streams (needs MailProxy). The orchestrator holds none of these — provision.go carries only apex/webPort/privateFrontDoor; the facts live as constants in internal/founding (publicKanidmLoopbackPort/publicKanidmCertPath/publicKanidmKeyPath/publicGateURL, ownvpspath.go:225-228), used at founding, never threaded to the runtime deploy (confirmed: GatewayFacts/AttachGateway are not referenced anywhere in the control-plane runtime or internal/provision).

So a partial public live set would rewrite front-door.nix with bindaddress = "127.0.0.1:0", empty tls_chain/tls_key, and forward_auth http://"" — killing the IdP and every gated route, and dropping the mail TCP proxy if mail is co-hosted. That is a worse red than the missing-route it fixes.

The existing seam test TestDeploy_PublicGatewayFilesBindsLoopbackButAddsNoPrivateRoute (deploy_test.go:610) currently asserts the public path adds no front-door route — it was written deliberately, "route-on-deploy for the public front door is out of this arc's scope."

The decision needed — how should the public route land?

  • (A) Promote the 4 public front-door constants to exported clan constants (single source; internal/founding references them), and have the deploy build the full public live set from apex + those + the files route. Smallest change, matches the whole-rewrite/idempotent philosophy, unblocks the public files route now. Caveat: a public gateway that also co-hosts mail would lose its mail proxy on re-render (the deploy doesn't know mail is placed) — I'd file that as an out-of-scope follow-up + GOTCHA.
  • (B) Change AttachFrontDoor to merge — read the existing front-door.nix / a persisted live set, add-or-replace only this service's route, preserve the rest. A clan-seam contract change, but robust to mail/other services.
  • (C) Persist the front-door live set (the union of all placed services + gateway facts) in the config repo/state; founding and every deploy read+update it, so any deploy re-renders the COMPLETE door. Biggest change, cleanest single-source.

My recommendation: (A) for this ticket, with the mail-co-host gap filed as a follow-up — unless (B)/(C) is preferred.

I asked on Mattermost (thread xkkuwjkbftbr3mnkxxm3u3djfo) but got no reply in 20 min, so I'm handing this back rather than guessing a judgement call. A late reply in that thread is not lost. Re-arm with ready-for-agent once a path is chosen.

## Blocked: needs a human ruling — the directed public-path fix would regress the founding front door I picked this up (run 6564) and did the forensics. The directed fix — attach the files route on BOTH paths with the public live set `Gateway/Apex/IDPHost + Services: [{FilesSlug, NextcloudLoopbackTarget}]` — **cannot be implemented as written without regressing the public front door.** A human ruling is needed on how the route should land. ### Why the literal fix regresses `AttachFrontDoor` rewrites `front-door.nix` **whole** from the passed live set (its own doc: "rewrites the module WHOLE from the live set every run"). - **Private path works** with the partial set because `renderPrivateFrontDoor` reconstructs the *entire* door from `apex`/`IDPHost` + routes alone — it declares no `services.kanidm` (the guest baseline owns it) and no `forward_auth`/gateURL (ungated, ADR 0150). So `{Gateway, Apex, IDPHost, Private, Services}` is complete. - **Public path breaks**: `RenderFrontDoor` (public branch) emits `renderKanidmLoopback` (needs `Kanidm.Port`/`CertPath`/`KeyPath`), the `forward_auth` gate (needs `GateURL`), and mail streams (needs `MailProxy`). The orchestrator holds **none** of these — `provision.go` carries only `apex`/`webPort`/`privateFrontDoor`; the facts live as constants in `internal/founding` (`publicKanidmLoopbackPort`/`publicKanidmCertPath`/`publicKanidmKeyPath`/`publicGateURL`, `ownvpspath.go:225-228`), used at **founding**, never threaded to the runtime deploy (confirmed: `GatewayFacts`/`AttachGateway` are not referenced anywhere in the control-plane runtime or `internal/provision`). So a partial public live set would rewrite `front-door.nix` with `bindaddress = "127.0.0.1:0"`, empty `tls_chain`/`tls_key`, and `forward_auth http://""` — **killing the IdP and every gated route**, and dropping the mail TCP proxy if mail is co-hosted. That is a worse red than the missing-route it fixes. The existing seam test `TestDeploy_PublicGatewayFilesBindsLoopbackButAddsNoPrivateRoute` (deploy_test.go:610) currently *asserts* the public path adds no front-door route — it was written deliberately, "route-on-deploy for the public front door is out of this arc's scope." ### The decision needed — how should the public route land? - **(A)** Promote the 4 public front-door constants to **exported clan constants** (single source; `internal/founding` references them), and have the deploy build the **full** public live set from `apex` + those + the files route. Smallest change, matches the whole-rewrite/idempotent philosophy, unblocks the public files route now. **Caveat:** a public gateway that *also* co-hosts mail would lose its mail proxy on re-render (the deploy doesn't know mail is placed) — I'd file that as an out-of-scope follow-up + GOTCHA. - **(B)** Change `AttachFrontDoor` to **merge** — read the existing `front-door.nix` / a persisted live set, add-or-replace only this service's route, preserve the rest. A clan-seam contract change, but robust to mail/other services. - **(C)** Persist the front-door live set (the union of all placed services + gateway facts) in the config repo/state; founding and every deploy read+update it, so any deploy re-renders the COMPLETE door. Biggest change, cleanest single-source. **My recommendation:** (A) for this ticket, with the mail-co-host gap filed as a follow-up — unless (B)/(C) is preferred. I asked on Mattermost (thread `xkkuwjkbftbr3mnkxxm3u3djfo`) but got no reply in 20 min, so I'm handing this back rather than guessing a judgement call. A late reply in that thread is not lost. Re-arm with `ready-for-agent` once a path is chosen.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#557
No description provided.