Repository navigation
Description
What's the problem
#3974's plumbing landed with #3978/PR #4424 — the key parses, validates, renders to DASHBOARD_MODE, reaches compose/quadlet, and create_app gates only the log API on it. But create_app still registers the UI unconditionally: in api mode GET /, /static/* and /ui-preview serve the full UI on the app's loopback port, failing #3974's criterion that they "return 404 in the app, not only in Caddy". And generate_caddyfile rewrites the boot probe /.pithead-boot-health to / (lib/pithead/35-caddyfile-and-auth-helpers.sh:319), so the moment / 404s in api mode, the boot-health gate going through Caddy breaks — the two changes must land together (rewrite target /api/state in api mode).
What it impacts
Headless operators who set dashboard.mode=api expecting no web UI; the boot-health gate, container healthcheck (HEAD /api/state) and the first-boot wizard, which must keep working in api mode; later external APIs (#3975, #3976) land on this gating.
How I found it
Read create_app in dashboard/mining_dashboard/web/server.py (UI routes added before/after the if config.DASHBOARD_MODE in ("api", "both") block that only carries log_views.routes()), generate_caddyfile in lib/pithead/35-caddyfile-and-auth-helpers.sh (@boot_health rewrite), and dashboard/healthcheck.sh. tests/stack/dashboard/test-onion-apply-password.sh already pins render/validation and the onion log 404; no per-mode UI route table test exists.
How important is it
Medium. Core deliverable of 2.1.0 issue #3974 — without it api mode is cosmetic. Get this wrong and the boot gate regresses or healthchecks fail on api-mode deploys.
Acceptance criteria
- Route-table test (RED without the change): DASHBOARD_MODE=api → GET /, /static/, /ui-preview all 404; /api/state, /metrics, /api/miner-connection, /api/xvb-standby, /api/access served as today. dashboard and both serve all of them. dashboard mode still 404s /api/logs/* (extend the existing per-mode test rather than duplicating).
- Control routes (/api/config, /api/control/*) stay gated on dashboard.control.enabled alone, in every mode.
- generate_caddyfile renders
rewrite @boot_health /api/statewhen DASHBOARD_MODE=api andrewrite @boot_health /otherwise; a tests/stack case captures the rendered Caddyfile and pins both shapes. - The boot-health proxy behaviour holds with mode=api (extend tests/integration/mini-stack/test-boot-health-proxy.sh or a sibling).
- The wizard is a separate app and still boots and serves its setup page with DASHBOARD_MODE=api (pin by starting the wizard app with the env set).
- Tiers 1–3 green and a tier4-e2e targeted job on the head: deploy with mode=api, dashboard healthy, boot gate green, / 404 through Caddy.
Possible solutions
- Skip UI route registration in create_app when DASHBOARD_MODE=api — same precedent as control (404, not 403) and log_views.
- Branch the @boot_health rewrite target in generate_caddyfile on DASHBOARD_MODE (it is rendered before the Caddyfile, like DASHBOARD_SECURE/DASHBOARD_ONION_ENABLED which the function already reads).
- Alternative rejected: serving a minimal 200 at / to feed the probe — keeps a UI-shaped response alive in headless mode.
Parent: #3974
Worker brief: Test tier: tier1 (dashboard pytest + tests/stack shell) + tier3 integration mini-stack; tier4-e2e targeted on the head for the api-mode deploy and boot gate.
Objective: make dashboard.mode=api remove the UI from the app and keep the boot gate alive. Do not re-do what #3978 landed (key parse/validate/render, config.py, log-API gate, config editor entry) — extend, don't duplicate.
Files expected: dashboard/mining_dashboard/web/server.py (register /, /static, /ui-preview only when DASHBOARD_MODE != api), lib/pithead/35-caddyfile-and-auth-helpers.sh (rewrite @boot_health to /api/state when DASHBOARD_MODE=api), plus tests: an aiohttp route-table test per mode (RED without the change; follow dashboard/tests/web/views/test_log_views.py's monkeypatch style), a Caddyfile shape pin in tests/stack (test-onion-apply-password.sh already renders — look there for the idiom), an extension of tests/integration/mini-stack/test-boot-health-proxy.sh for mode=api, and a wizard-still-boots-in-api-mode test.
Keep /api/state, /metrics, /api/miner-connection, /api/xvb-standby, /api/access served in all modes exactly as today. Keep /api/logs/* 404 outside api/both. Control routes stay gated by dashboard.control.enabled alone. No new config keys, no describe-change work (that is its own issue), no credential work (blocked on #3872/#3895, separate issue). Proof: tiers 1–3 green, then one tier4-e2e targeted job on the head quoting the evidence block unedited; name the row in the PR body.
Activity
pithead-architect commentedon Nov 27, 2026
Release regroom (owner request, 2026-11-27): moved from v2.1.0 to v2.1.3. Headless-dashboard and system-info UI chain depends on the login work in 2.1.0; second UI chunk.