Repository navigation
Conversation
The hashed Vite output in src/webui/assets/ conflicted on every rebase, and concurrent WebUI PRs left main with a stale source digest. The bundle is now gitignored and generated by `make webui`; a frontend change produces no tracked diff outside webui/. build.rs (build_support/webui_bundle.rs) embeds src/webui/assets/ when it holds index.html, the manifest and the license file, and otherwise the committed placeholder in src/webui/placeholder/, with a cargo warning. It passes the choice to assets.rs through cargo:rustc-env, read by include_str! and rust-embed's interpolated folder (new interpolate-folder-path feature). MLXCEL_REQUIRE_WEBUI_BUNDLE=1 turns a missing bundle into a build error. The placeholder page explains how to build the WebUI; its manifest keeps the bundle schema with "placeholder": true, and the server logs a warning when it mounts it. build_bundle.py --verify now requires two clean builds to be byte-identical and within budget, checks the placeholder manifest, and installs the verified tree. --check validates an existing bundle without Node; `make serve-webui` uses it to rebuild a missing or stale bundle. CI's webui-installed-artifact job builds the bundle before compiling. release.yml builds it once in a hosted job with Node 26.5.1 and pnpm 12.23.0, every platform job downloads it and builds with the require flag, and the manifest is attached to the release. Asset tests run in both modes; the hashed-asset cache test returns early on the placeholder. Verified on Linux: placeholder build and tests, require flag failure, real bundle built with the pinned toolchain and embedded, and the fallback after deleting it. Closes #3683
Pulling the untracking change deletes the formerly committed bundle, so a developer's next cargo build silently drops to the placeholder page. The bundling guide (English and Korean) now says to run make webui and rebuild, how to clear local bundle edits that block git pull, and that checking out a pre-#3683 commit replaces the ignored bundle and removes it on return. The fallback table also lists every value build_support/webui_bundle.rs treats as unset (empty, 0, false), not just 0. Refs #3683
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
|
The build-webui job ran pnpm install and the Vite build (third-party npm code) while holding contents: write to attach the manifest. A compromised dependency could start a process that outlives its step and read the token handed to the later release-upload step. build-webui now holds contents: read, and a new attach-webui-manifest job, which runs no third-party code, downloads the artifact and uploads the manifest. build-webui also detects a source tree from before #3683 (no src/webui/placeholder/). Such trees commit their bundle and v0.8.x pins pnpm 12.16.1, so building them with pnpm 12.23.0 failed and blocked every platform job of a self-healing dispatch that rebuilds an old tag. For those trees the build is skipped and the platform jobs skip the download and embed the committed bundle; a post-#3683 tree without the artifact still fails under MLXCEL_REQUIRE_WEBUI_BUNDLE. Checked with actionlint (no new findings) and the release.yml parsing checks in scripts/ci. Refs #3683
Security and performance reviewFixed in 7cf467f:
Checked and fine: the artifact comes from the same run by name (no Open (not fixed, MEDIUM/LOW):
|
build_bundle.py wrote into src/webui/assets/ directly and install() did rmtree then copytree. A validation failure after the manifest was written, or an interrupted copy, could leave index.html, the manifest and third-party-licenses.txt in place, so build.rs took a broken or partial bundle as complete. Both the default build and --verify now build or copy into a sibling .assets-stage-* directory, validate it, and only then rename it into place. An existing assets directory is renamed aside first, restored if the second rename fails, and deleted after success. A killed run leaves at most a staging or .assets-old-* directory, which is gitignored, never read by build.rs, and swept by the next run. The placeholder manifest's embedded_asset_bytes now includes the manifest's own size, as the real bundle's does. Adds build_bundle_tests.py (wired into the WebUI helper tests in the Makefile) covering replace, failed validation, failed rename, interrupted copy and the sweep. The bundling guide is updated in English and Korean. Validation: build_bundle.py --verify and --check pass on Node 26.5.1 / pnpm 12.23.0, build_bundle_tests.py passes, cargo test --lib server::webui::assets passes (14), cargo fmt --check and cargo clippy -D warnings are clean. Refs #3683
Summary
src/webui/assets/) is gitignored and generated bymake webui, so frontend PRs stop conflicting on hashed files and stale manifests. The 27 tracked generated files are removed from the index.build.rs(build_support/webui_bundle.rs) embeds the real bundle whenindex.html, the manifest and the license file are present, and otherwise the committed placeholder insrc/webui/placeholder/with a cargo warning.MLXCEL_REQUIRE_WEBUI_BUNDLE=1makes a missing bundle a build error. The path reachesassets.rsthroughcargo:rustc-env, used byinclude_str!and rust-embed's interpolated#[folder](adds theinterpolate-folder-pathfeature, which pulls inshellexpand)."placeholder": true. The server logs a warning when it mounts the placeholder.build_bundle.py --verifyrequires two clean builds to be byte-identical and within budget, checks the placeholder manifest, and installs the verified tree; it no longer compares with committed files.--checkvalidates an existing bundle without Node, andmake serve-webuiuses it to rebuild a missing or stale bundle first..assets-stage-*directory and renamed intosrc/webui/assetsonly after validation, with the previous bundle moved aside and restored if the swap fails. A failed or interrupted build therefore never leaves a partial bundle thatbuild.rswould accept.scripts/webui/build_bundle_tests.pycovers this and runs with the Makefile WebUI helper tests.webui-installed-artifactbuilds the bundle before compiling and sets the require flag.build-webuijob builds the bundle once (Node 26.5.1, pnpm 12.23.0) with a read-only token; a separateattach-webui-manifestjob, which runs no npm code, holds the write token and attaches the manifest to the release. All six platform jobs download the bundle and build withMLXCEL_REQUIRE_WEBUI_BUNDLE=1(workflow-level env). When a dispatch rebuilds a tag older than this change (nosrc/webui/placeholder/), the bundle build and downloads are skipped and the tag's committed bundle is embedded.webui/AGENTS.md, NOTICE and the env-var page describe the new flow, including how an existing checkout recovers after pulling this change (make webui, then rebuild).Test plan
cargo test --profile test-fast --lib server::webui::assets14/14 and the secured-router/webui/mount test pass; build prints the fallback warning.MLXCEL_REQUIRE_WEBUI_BUNDLE=1without the bundle fails in the build script.build_bundle.py --verifywith Node 26.5.1 / pnpm 12.23.0: two builds identical. With that bundle installed, asset tests pass 14/14 under the require flag; deleting it again falls back on the next build.build_bundle.py --checkandscripts/webui/build_bundle_tests.py(10 tests) pass.make webui-ensurebuilds from a clean state, then is a no-op.cargo clippy --profile test-fast -p mlxcel --lib --tests -- -D warnings,cargo fmt --check, env-var-docs, license-headers, binary-assets, actionlint (no new findings).server::webuilib tests with the real bundle: all asset tests pass; fiveserver::webui::catalogtests fail identically on main on this host (pre-existing, unrelated).webui-installed-artifactjob, andmake serve-webuiend to end (needs a cold release build).Closes #3683