Fail the build when ui/dist is missing instead of warning - #1243
Merged
Conversation
generate_includes.py printed a warning and carried on when the UI dist was absent, leaving the previously generated headers in src/webserver/html/ in place. Those headers are gitignored, so they survive branch switches and cleans, and the asset URLs baked into index.html keep pointing at whichever version generated them while addversion.py stamps the current version into the route registered in AmsWebServer. The build then succeeds and the UI 404s on index-<version>.js and .css. A missing UI build cannot produce a working firmware, so stop rather than emit one that looks fine. The native test environments override extra_scripts and never run this script, so pio test is unaffected, and both firmware workflows run npm run build before pio run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🔧 PR Build ArtifactsVersion: All environments built successfully. Download the zip files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
scripts/generate_includes.pyprinted a warning and carried on when the UI dist was absent:It now exits non-zero instead. A missing UI build cannot produce working firmware, so the build should stop rather than emit a binary that looks fine.
Why the silent skip is dangerous
The generated headers in
src/webserver/html/are gitignored, so they are local artifacts that survive branch switches and PlatformIO cleans. Skipping regeneration leaves them in place, which splits the UI cache-busting scheme in half:index.htmlsrc/webserver/html/index_html.h(this script)AmsWebServersrc/generated_version.h(addversion.py, rewritten every build)The route answers
/index-<current>.jswhile the HTML asks for/index-<old>.js, so the UI 404s on both.jsand.csswhile the build reports success.Scope
This is defensive hardening, not a fix for a live bug. In a normal clone
ui/distis tracked, so the branch is effectively unreachable — it only triggers if someone deletes the directory. It costs one line and turns a silently broken binary into a build error, but close this if you would rather not have the extra failure mode.Verification
ui/distmoved aside: exits 1 withERROR: UI dist not found at 'ui/dist'. Run 'npm run build' in ui/ before building the firmware.ui/distpresent: exits 0, generated headers unchanged, no stray files.pio testunaffected:[env:native]overridesextra_scriptstopre:scripts/native_crypto.pyand[env:native_config]sets none, so neither runs this script.pull-request.ymlonly runs the native tests.build.ymlandpr-build-env.ymlboth runnpm ci && npm run buildbeforepio run.🤖 Generated with Claude Code