Skip to content

refactor: remove dead subdomain routing path#205

Merged
mairas merged 3 commits into
mainfrom
fix/remove-stale-hcc-subtree
May 24, 2026
Merged

refactor: remove dead subdomain routing path#205
mairas merged 3 commits into
mainfrom
fix/remove-stale-hcc-subtree

Conversation

@mairas
Copy link
Copy Markdown
Contributor

@mairas mairas commented May 24, 2026

Summary

Pure dead-code removal. The multi-level mDNS subdomain approach is gone — halos-mdns-publisher is archived, no live system discovers subdomain hostnames, and the deployed reverse proxy in halos-core-containers routes by path under ${HALOS_DOMAIN} (expanded across configured hostnames by halos_expand_oidc_redirect_uri in lib-hostnames.sh).

No behavior change for any live deployment. The OIDC redirect URI list shape (http:// + https:// entries) is preserved; only the dead {subdomain}. prefix is dropped.

Changes

src/generate_container_packages/traefik.py — delete generate_traefik_labels (only called by its own tests; builder.py only calls inject_traefik_network, whose docstring already says "Traefik labels are NOT injected here — they're generated at runtime by the Traefik container based on routing.yml declarations"). Also delete _build_host_rule (only called by deleted function) and _extract_container_port (live copy lives in routing.py). Keep inject_traefik_network / inject_proxy_network / _detect_host_networking.

src/generate_container_packages/oidc_snippet.py — stop prepending {subdomain}. to the redirect URIs. Keep both http:// and https:// entries unchanged so the Authelia client allow-list shape is identical to before.

src/schemas/metadata.py — drop the subdomain field from TraefikConfig and RoutingConfig. Both default to extra="ignore", so any leftover subdomain: in a metadata.yaml is silently dropped instead of raising. Audited the workspace — zero live apps set the field.

Teststests/test_traefik_labels.py renamed to tests/test_traefik_network.py and collapsed to the proxy-network suite. TestExtractContainerPort coverage already lives in tests/test_routing.py::TestContainerPortExtraction (with a new test_container_port_integer_format pinning the isinstance(int) branch that was previously only covered in the deleted file). New test_legacy_subdomain_field_silently_ignored in test_routing_schema.py pins the backward-compat contract for RoutingConfig. Subdomain assertions / dead fixtures dropped elsewhere; regression-guard test renamed in test_routing.py.

Note on the "subtree cleanup" half of the issue

There is no container-packaging-tools/halos-core-containers/ subtree in this repo's git history (git log --all -- halos-core-containers/ is empty). What exists at that path in some checkouts is a separately cloned hatlabs/halos-core-containers working tree with its own .git and origin. Nothing in this repo to delete for that half of the scope — it's a personal working-tree artifact, not a c-p-t concern. Recommend closing that sub-scope as not-applicable.

Verification

  • uv run pytest tests/ -m "not install and not docker and not slow"878 passed, 2 skipped, 16 deselected
  • uv run ruff check src/ tests/ → All checks passed
  • grep -rn "subdomain" src/ tests/ → only the intentional regression-guard test in tests/test_routing.py
  • grep -rn "halos\.subdomain" workspace-wide → only the archived halos-mdns-publisher and the stale personal clone
  • OIDC redirect_uris shape: still [http://${HALOS_DOMAIN}{path}, https://${HALOS_DOMAIN}{path}] — identical to before, minus the (always-dead) subdomain prefix

Net change

11 files changed, 128 insertions, 721 deletions (refactor) + bump to 0.6.1 + uv.lock sync. Three commits total.

Refs #204
Parent issue: halos-org/halos#111

mairas added 3 commits May 24, 2026 22:32
The multi-level mDNS subdomain approach is gone — halos-mdns-publisher
is archived, no live system discovers subdomain hostnames, and the
deployed reverse proxy in halos-core-containers routes by path under
${HALOS_DOMAIN} (expanded across configured hostnames by prestart).

Deletes the parts of c-p-t that were still generating that extinct
routing surface. Pure dead-code removal — no behavior change for any
live deployment.

  src/generate_container_packages/traefik.py
    - delete generate_traefik_labels (only called by its own tests)
    - delete _build_host_rule and _extract_container_port helpers
      (the latter is duplicated in routing.py for the live path)
    - keep inject_traefik_network / inject_proxy_network — still
      called by builder.py and unrelated to the dead label path

  src/generate_container_packages/oidc_snippet.py
    - stop prepending {subdomain}. to the redirect URIs
    - keep both http:// and https:// entries unchanged so the
      Authelia client allow-list shape stays identical

  src/schemas/metadata.py
    - drop the subdomain field from TraefikConfig and RoutingConfig.
      Both models default to extra='ignore', so any leftover
      'subdomain:' in a metadata.yaml is silently dropped instead of
      raising — verified zero apps in the workspace actually set it.

Tests:
  - tests/test_traefik_labels.py → renamed to test_traefik_network.py,
    collapsed to the proxy-network suite (TestExtractContainerPort
    coverage already lives in tests/test_routing.py, plus a new
    test_container_port_integer_format pins the integer-port branch)
  - test_oidc_snippet, test_traefik_schema, test_routing_schema:
    drop subdomain assertions and fixtures
  - test_middleware, test_templates_oidc: strip dead subdomain keys
    from fixtures (Pydantic was ignoring them)
  - test_routing: rename test_routing_without_subdomain to
    test_generated_routing_omits_subdomain_key as a regression guard
  - test_routing_schema: add test_legacy_subdomain_field_silently_ignored
    pinning the backward-compat contract for RoutingConfig

878 tests pass; ruff clean.

Refs #204
@mairas mairas force-pushed the fix/remove-stale-hcc-subtree branch from be288ee to 624de36 Compare May 24, 2026 19:32
@mairas mairas changed the title refactor: drop orphan halos.subdomain label emission refactor: remove dead subdomain routing path May 24, 2026
@mairas mairas merged commit bdbcb15 into main May 24, 2026
4 checks passed
@mairas mairas deleted the fix/remove-stale-hcc-subtree branch May 24, 2026 19:53
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