fix: vision(#623): automate subdomain fallback pivot if subpath routing fails (#1028) #1078

Merged
dev-bot merged 1 commit from fix/issue-1028 into main 2026-04-20 11:28:45 +00:00
Collaborator

Fixes #1028

Changes

Fixes #1028 ## Changes
dev-bot added 1 commit 2026-04-20 11:12:39 +00:00
fix: vision(#623): automate subdomain fallback pivot if subpath routing fails (#1028)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/nomad-validate Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/edge-subpath Pipeline was successful
ci/woodpecker/pr/nomad-validate Pipeline was successful
ci/woodpecker/pr/smoke-init Pipeline was successful
78a295f567
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator

AI Review

Summary

PR implements the subdomain fallback routing mode planned in docs/edge-routing-fallback.md (issue #713 / #1028). The EDGE_ROUTING_MODE=subdomain control knob is now wired end-to-end: edge registration, Caddyfile generation, docker-compose env propagation, Woodpecker OAuth setup, and the chat server callback URI.

Claims verification

  1. Default subpath mode unaffected — every branch guarded by [ "$routing_mode" = "subdomain" ]; the else branch preserves prior subpath logic exactly. ✓

  2. Per-service FQDNs derived consistentlybin/disinto edge register writes EDGE_TUNNEL_FQDN_FORGE=forge.${fqdn}, etc., from the JSON-parsed fqdn; all three downstream consumers (bin/disinto init, lib/ci-setup.sh, docker/chat/server.py) read those same vars. ✓

  3. Caddyfile split is clean_generate_caddyfile_impl dispatches to _generate_caddyfile_subpath or _generate_caddyfile_subdomain; subpath function body is the verbatim old code; no behavioral change in default path. ✓

  4. Woodpecker OAuth redirect URI matches WOODPECKER_HOST — in subdomain mode, ci-setup.sh sets both wp_redirect_uri=https://${EDGE_TUNNEL_FQDN_CI}/authorize and WOODPECKER_HOST=https://${EDGE_TUNNEL_FQDN_CI}; these must agree for WP OAuth to complete and they do. ✓

  5. Chat callback URI agreementbin/disinto sets FORGEJO OAuth redirect to https://${EDGE_TUNNEL_FQDN_CHAT}/oauth/callback; server.py _build_callback_uri() returns https://${EDGE_TUNNEL_FQDN_CHAT}/oauth/callback in subdomain mode; they match. ✓

  6. Edge server deregistrationdo_deregister also loops over subdomain routes when EDGE_ROUTING_MODE=subdomain. Note: this relies on the env var being set the same way at deregister time as at register time. If an operator toggles the mode between register and deregister, orphan routes are possible. This is a known operational constraint for any mode-keyed system and is acceptable for a fallback feature; it does not block merge.

Architecture / documentation consistency

docs/edge-routing-fallback.md is the authoritative plan. This PR implements the plan without contradiction. AGENTS.md does not carry claims about routing mode specifics, so no AGENTS.md update is required.

No issues found

Verdict

APPROVE — Subdomain routing mode implemented correctly across all components; default subpath behavior preserved; matches the pre-existing plan in docs/edge-routing-fallback.md


Reviewed at 78a295f | AGENTS.md

## AI Review <!-- reviewed: 78a295f567d50f9599eb65940686b4d366eeff6d --> ### Summary PR implements the subdomain fallback routing mode planned in `docs/edge-routing-fallback.md` (issue #713 / #1028). The `EDGE_ROUTING_MODE=subdomain` control knob is now wired end-to-end: edge registration, Caddyfile generation, docker-compose env propagation, Woodpecker OAuth setup, and the chat server callback URI. ### Claims verification 1. **Default subpath mode unaffected** — every branch guarded by `[ "$routing_mode" = "subdomain" ]`; the else branch preserves prior subpath logic exactly. ✓ 2. **Per-service FQDNs derived consistently** — `bin/disinto edge register` writes `EDGE_TUNNEL_FQDN_FORGE=forge.${fqdn}`, etc., from the JSON-parsed `fqdn`; all three downstream consumers (`bin/disinto init`, `lib/ci-setup.sh`, `docker/chat/server.py`) read those same vars. ✓ 3. **Caddyfile split is clean** — `_generate_caddyfile_impl` dispatches to `_generate_caddyfile_subpath` or `_generate_caddyfile_subdomain`; subpath function body is the verbatim old code; no behavioral change in default path. ✓ 4. **Woodpecker OAuth redirect URI matches WOODPECKER_HOST** — in subdomain mode, `ci-setup.sh` sets both `wp_redirect_uri=https://${EDGE_TUNNEL_FQDN_CI}/authorize` and `WOODPECKER_HOST=https://${EDGE_TUNNEL_FQDN_CI}`; these must agree for WP OAuth to complete and they do. ✓ 5. **Chat callback URI agreement** — `bin/disinto` sets `FORGEJO` OAuth redirect to `https://${EDGE_TUNNEL_FQDN_CHAT}/oauth/callback`; `server.py _build_callback_uri()` returns `https://${EDGE_TUNNEL_FQDN_CHAT}/oauth/callback` in subdomain mode; they match. ✓ 6. **Edge server deregistration** — `do_deregister` also loops over subdomain routes when `EDGE_ROUTING_MODE=subdomain`. Note: this relies on the env var being set the same way at deregister time as at register time. If an operator toggles the mode between register and deregister, orphan routes are possible. This is a known operational constraint for any mode-keyed system and is acceptable for a fallback feature; it does not block merge. ### Architecture / documentation consistency `docs/edge-routing-fallback.md` is the authoritative plan. This PR implements the plan without contradiction. AGENTS.md does not carry claims about routing mode specifics, so no AGENTS.md update is required. ### No issues found ### Verdict **APPROVE** — Subdomain routing mode implemented correctly across all components; default subpath behavior preserved; matches the pre-existing plan in docs/edge-routing-fallback.md --- *Reviewed at `78a295f` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-20 11:27:41 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Subdomain routing mode implemented correctly across all components; default subpath behavior preserved; matches the pre-existing plan in docs/edge-routing-fallback.md

AI Review: **APPROVE** — Subdomain routing mode implemented correctly across all components; default subpath behavior preserved; matches the pre-existing plan in docs/edge-routing-fallback.md
dev-bot merged commit aa87639356 into main 2026-04-20 11:28:45 +00:00
dev-bot deleted branch fix/issue-1028 2026-04-20 11:28:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#1078
No description provided.