Skip to content

Split the HUD page into web/hud/ sources, joined at build time - #55

Merged
KoganTheDev merged 3 commits into
mainfrom
refactor/split-hud-page
Oct 31, 2026
Merged

KoganTheDev merged 3 commits into
mainfrom
refactor/split-hud-page

Conversation

@KoganTheDev

Copy link
Copy Markdown
Owner

Tech debt item #11.

Why

web/web_ui.html was one 2,238-line file (markup, ~800 lines of CSS and ~1,400 lines of JS in one IIFE), which made it hard to navigate and review. The board still has to serve one self-contained gzipped page: the setup hotspot is offline, there is one route, and the gzip is deterministic. So the split is source-only and joined at build time, in Python, with no new tools.

What

  • web/hud/:
    • index.html: the markup plus two placeholders.
    • css/: 7 files (base, statusbar, video, panel, controls, overlays, responsive).
    • js/: 13 fragments (state, feedback, link, controls, fire, stream, calibration, status, overlay, loop, ui_events, wifi_chip, boot).
  • web/hud_build.py: build_hud_page() joins them. Its CSS_FILES and JS_FRAGMENTS lists are the single source of truth for the order. The JS fragments share one scope: the build wraps them in the same 'use strict' IIFE, so scoping and behaviour are unchanged.
  • Readers switched to the built page: the PlatformIO generator (update_index_html.py, still write-if-changed with a deterministic gzip), the mock board (it rebuilds on every request, so edit-then-reload still works), the web tests and the reply-key contract test. web_ui.html is deleted. wifi_setup.html stays one file.
  • New HudBuildTests:
    • every listed file exists, and every css/js file on disk is listed;
    • no duplicates, no leftover placeholders or headers;
    • one IIFE, LF only, deterministic output;
    • a missing or doubled placeholder raises an error.
  • Docs: CLAUDE.md (Web UI pipeline), the README files.

Verification

  • Built page vs the old file: byte-identical (128,286 chars, compared as LF), and the rendered header is identical too. The build always emits LF, so the generated header now matches CI's on Windows as well; before, it hashed CRLF there.
  • web tests 43 OK, mock tests 54 OK.
  • End-to-end harness: 32/32 on 3 runs.
  • Firmware build: the pre-build script generated index_html.h from web/hud/, SUCCESS.

@github-actions github-actions Bot added documentation Improvements or additions to documentation Tools Web labels Oct 30, 2026
@KoganTheDev
KoganTheDev merged commit 2d85f53 into main Oct 31, 2026
10 checks passed
@KoganTheDev
KoganTheDev deleted the refactor/split-hud-page branch October 31, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Tools Web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant