Skip to content

Web UI: data/ as the single source of truth (2/7) - #43

Merged
bring42 merged 4 commits into
mainfrom
claude/pr2-web-ui-source-of-truth
Sep 12, 2026
Merged

bring42 merged 4 commits into
mainfrom
claude/pr2-web-ui-source-of-truth

Conversation

@bring42

@bring42 bring42 commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Stacked PR — part 2 of 7. Merge in order (1 → 7) using a merge commit, not squash: the per-commit messages are the documentation, and squashing would also break the PRs stacked on top. Split from claude/next-goal-notes-merge-prep-6bb680; the top of the stack is byte-identical to that branch.

What

data/ becomes the single source of truth for the web UI.

  • Removes the /euclid/ skin and dissolves ui-concepts/ + scripts/sync_web.py. With one skin left, the copy step was pure overhead. Frees ~110 KB of filesystem content (the files plus their gzipped copies).
  • The ?v=<hash> cache-busting stamps move into scripts/gzip_web_files.py, the build pre-action. The release workflow's manual sync step is removed.
  • Build fix: that pre-action was registered on the buildfs alias, which fires after the filesystem image is packed. Reproduced by deleting data/*.gz (a fresh CI checkout) and running pio run -t buildfs: the image was built before the gzip ran. It is now hooked on the image target itself. The stamp regex also now catches newly added, unstamped asset references.
  • Review follow-up: the stamp regex is now anchored on both quotes and requires a file extension. It previously also matched an external URL containing /assets/ and a directory path. The hook's reliance on PlatformIO deferring pre: actions is now documented where it's registered.
  • Residue sweep of the last euclid/ui-concepts mentions in comments and docs; new docs/WEB_UI.md; ENGINE_API.md moved to docs/.

Review notes

  • Mostly deletions (~9.8k lines are the removed skin and source tree).
  • Removing the CI sync step is only safe with the build fix, and both are in this PR.

Verification

Built and tested on this branch alone. This stacked state is new, so it was verified independently rather than assumed: 80/80 native tests pass, the firmware builds for seeed_xiao_esp32c3 (90.9% of the app partition), and the web UI JS passes node --check.

🤖 Generated with Claude Code


The stack (merge top to bottom):

  1. Premium render substrate + 13 premium modes (1/7) #42 — Premium render substrate + 13 premium modes (1/7)
  2. Web UI: data/ as the single source of truth (2/7) #43 — Web UI: data/ as the single source of truth (2/7)
  3. Live viz: the channel visualizer mirrors the real strip (3/7) #44 — Live viz: the channel visualizer mirrors the real strip (3/7)
  4. WiFi observability: stop failing silently (4/7) #45 — WiFi observability: stop failing silently (4/7)
  5. 4 MB partition table: 1.75 MB A/B app slots (5/7) #46 — 4 MB partition table: 1.75 MB A/B app slots (5/7)
  6. AI prompt pipeline: key save, live model, honest outcomes (6/7) #47 — AI prompt pipeline: key save, live model, honest outcomes (6/7)
  7. Core hardening from the external review (7/7) #48 — Core hardening from the external review (7/7)

benno6 and others added 4 commits September 12, 2026 18:08
…I source of truth

The /euclid/ plate skin is dropped to reclaim tight LittleFS flash (~20 KB
gzipped). With one skin left, the ui-concepts/ source tree + sync_web.py
copy step were pure overhead and are dissolved entirely:

- delete ui-concepts/ (euclid-live, console-euclid-live, _engine) and the
  deployed data/euclid/; data/ is now the single committed source you edit
- delete scripts/sync_web.py; its one real remaining job — stamping
  ?v=<content-hash> cache-busters on asset URLs — moves into
  scripts/gzip_web_files.py (the buildfs/uploadfs pre-action), which also
  runs standalone: python3 scripts/gzip_web_files.py
- .github/workflows/release.yml: drop the manual sync step (the buildfs
  hook now guarantees a consistent image)
- scripts/dev_server.js: serve data/ only, engine loaded from data/assets/
- docs: ENGINE_API.md moves to docs/; new docs/WEB_UI.md replaces the
  stale ui-concepts README (it advertised two skins + mockup dirs that no
  longer exist); HARDENING_LOG/ROADMAP/TECH_DEBT updated; de-euclid the
  comments in server.cpp/storage.cpp

Verified: node --check on app.js/engine.js; dev_server serves / and 404s
/euclid/; stamp+gzip hook is idempotent on a clean tree.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow-up to the euclid-removal commit earlier in this PR, guided by an exhaustive residue audit (which found zero
functional leftovers — no dead routes, endpoints, files, or build steps; only
comment/doc text):

- data/assets/app.css: three comments cited the deleted console/ and euclid/
  mockup dirs as design references — rewritten as self-contained design notes
- src/api/status.cpp, docs/TECH_DEBT.md: "both skins" / "the skins" → the
  one web UI
- docs/DEVELOPMENT.md: data/ tree now lists engine.js (it was missing) and
  the Web UI section defers to docs/WEB_UI.md instead of keeping a second,
  drifting account of the workflow
- .github/copilot-instructions.md: same fix, plus the load-bearing rule an
  agent must not rediscover the hard way — the view never calls fetch; all
  device-API logic belongs in engine.js

Intentionally kept: historical euclid mentions in HARDENING_LOG/ROADMAP (they
record real events), the "Byrne (Euclid) material language" design-language
description, and ENGINE_API.md's skin-agnostic framing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two defects in the asset pipeline, both of which could ship a broken
filesystem image to users.

1. Hook ordering (release-integrity bug). The pre-action was registered on
   the "buildfs"/"uploadfs" ALIASES, but an alias's pre-actions run after
   the alias's dependency — the image — is already built. Reproduced by
   deleting data/*.gz (the state of a fresh CI checkout, since .gz are
   gitignored) and running `pio run -t buildfs`: the log printed
   "Building FS image" BEFORE the stamp+gzip output, so the published
   littlefs.bin contained uncompressed, unstamped assets. It only looked
   correct locally because stale .gz files from earlier runs were present.

   Fixed by registering on the real image target,
   $BUILD_DIR/${ESP32_FS_IMAGE_NAME}.bin, which uploadfs/uploadfsota also
   depend on — so one registration now covers every path. Re-verified with
   no .gz present: gzip output now precedes "Building FS image", for both
   buildfs and uploadfs.

   This is what the ui-concepts dissolution commit assumed when it deleted the release
   workflow's explicit sync step; that assumption is only true now.

2. The stamp regex required an EXISTING ?v=<hex>, so a newly added
   reference like <script src="/assets/new.js"> was silently never
   stamped — and /assets/ is served with a week-long max-age, pinning
   users to a stale copy. The stamp is now optional in the pattern and
   anchored on the closing quote so only whole attribute values match.
   Verified against stamped, unstamped, and single-quoted refs, and the
   emitted stamps re-checked against the files' real sha1[:8].
…k deferral

Two follow-ups from review of the build-hook ordering fix.

- The stamp regex was anchored only on the closing quote, so it also
  matched an external URL that merely contains /assets/
  ("https://cdn.example.com/assets/app.js": stamped with a local file's
  hash, or aborting the build) and a directory ("/assets/icons/":
  aborting the build). It now requires an opening quote directly before
  /assets/ and a file extension. Tested against stamped, unstamped,
  single-quoted, dotted-name, external-URL and directory references; the
  real data/index.html restamps idempotently. A reference inside an HTML
  comment still matches; if its file is gone the build fails loudly
  instead of shipping it (documented).
- The image-target registration works only because PlatformIO defers
  pre: script actions: at pre-time ESP32_FS_IMAGE_NAME is undefined and
  the target string is re-expanded later. Documented in place, including
  what to do if that ever changes (move it to a post: script) — a
  regression there would silently bring back the unstamped-image bug.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants