Skip to content

feat: embed reproducible WebUI bundle - #1857

Merged
inureyes merged 4 commits into
mainfrom
feature/issue-1836-webui-bundle
Sep 12, 2026
Merged

inureyes merged 4 commits into
mainfrom
feature/issue-1836-webui-bundle

Conversation

@inureyes

@inureyes inureyes commented Sep 12, 2026

Copy link
Copy Markdown
Member

Bundle the WebUI foundation without adding a runtime Node dependency. Cargo embeds the same committed assets in debug and release; production startup mounting remains assigned to #1838.

Implementation

  • Add the pinned React/strict TypeScript/Vite scaffold, ESLint, Vitest and Playwright runners, a deterministic two-build drift gate, source/file manifests and enforced size budgets.
  • Add the default webui feature and reusable static router with prefix-safe routing, HEAD, weak/list ETags, cache policy, security headers and malformed-path rejection.
  • Retain bundled React/runtime MIT notices and document the canonical rebuild workflow and technical report in English and Korean.

Validation

  • Frontend typecheck, lint, unit and Chromium browser tests pass; two clean builds match committed bytes; stale source, empty/blank bundle and missing-JS negatives fail as intended.
  • Twelve focused Rust static tests, 31 CLI/compatibility tests, feature-off/on checks and 30 shared contract fixtures pass on the rebased tree. CI passed, including actual CUDA+WebUI production-feature compilation and OpenXLA integration-test linking on GB10; no CUDA inference was run. The separate sm_70 compile steps were skipped and are not counted as evidence.
  • Relocated debug and shipping-profile release static harnesses pass with source asset reads and outbound network denied, including negative controls. The production server relocation gate remains explicitly downstream of feat(server): start the bundled WebUI without a model #1838.
  • Current budgets: 68,364 bytes initial/total JavaScript gzip and 227,718 embedded bytes.

Closes #1836

Refs #1834

@inureyes inureyes added status:review Under review type:enhancement New features, capabilities, or significant additions priority:high High priority area:architecture Architecture and code structure changes labels Sep 12, 2026
inureyes added a commit that referenced this pull request Sep 12, 2026
Record bundle decisions, review fixes, measured budgets, and development/release relocation evidence in English and Korean. Separate local static-harness validation from pending CI and downstream production startup, authentication, Safari, and real-model gates.

Validated both reports against the local manifest, relocation result artifacts, implementation commits, and current PR metadata.

Refs #1836, #1834
Add the pinned React, TypeScript, Vite, ESLint, Vitest, and Playwright WebUI scaffold with deterministic checked-in assets and a manifest that records toolchain versions, source digest, file hashes, and size budgets.

Expose the feature-gated Rust static router API and standalone relocation harness so the production startup work can mount `/webui` later while this PR verifies MIME, ETag, cache, HEAD, routing, and path-attack behavior independently.

Validation covered frontend typecheck, lint, unit, browser, bundle reproducibility, WebUI contract, feature graphs, and the focused Rust static-router tests.

Refs #1834; Closes #1836
Harden the WebUI bundle after security review so the shipped default feature cannot silently lose license notices, serve a blank shell, or emit unprotected method/path errors.

The bundle gate now enforces the exact Node/pnpm toolchain, hashes every generated file against the manifest, retains React runtime MIT notices in both NOTICE and embedded assets, separates initial and total JavaScript budgets, and rejects stale source digests, missing JS, debug artifacts, and active external-origin references. The static router now handles 405 responses itself, validates malformed encoded paths before extraction, preserves security headers, accepts weak/list ETags, and refuses an unbootable index.

Validation: make verify-webui-bundle; pnpm --dir webui install --frozen-lockfile; pnpm --dir webui run typecheck; pnpm --dir webui run lint; pnpm --dir webui run unit; pnpm --dir webui run browser; cargo test --profile test-fast assets_tests --features webui; cargo check --profile test-fast --no-default-features --lib; cargo fmt --check; git diff --check; blank-index and missing-JS verifier negatives against temp asset copies.
Distinguish the manifest-producing pipeline from raw Vite builds and the static harness from the later production startup integration. Document feature selection, router mounting, budgets, licensing, and honest relocated-artifact validation boundaries in English and Korean.

Validated local documentation links, source header policy, cross-repository references, and whitespace. Runtime and browser acceptance remain owned by the issue implementation and root validation runs.

Refs #1836, #1834
Record bundle decisions, review fixes, measured budgets, and development/release relocation evidence in English and Korean. Separate local static-harness validation from pending CI and downstream production startup, authentication, Safari, and real-model gates.

Validated both reports against the local manifest, relocation result artifacts, implementation commits, and current PR metadata.

Refs #1836, #1834
@inureyes
inureyes force-pushed the feature/issue-1836-webui-bundle branch from c019fd3 to 2580cf1 Compare September 12, 2026 04:49
@inureyes inureyes added status:done Completed and removed status:review Under review labels Sep 12, 2026
@inureyes
inureyes merged commit acc8d97 into main Sep 12, 2026
16 checks passed
@inureyes
inureyes deleted the feature/issue-1836-webui-bundle branch September 12, 2026 08:48
inureyes added a commit that referenced this pull request Sep 14, 2026
…clean (#1889)

## Summary

Restores the `OpenXLA feature compile` CI job, which has failed on `main` since 2026-09-12 16:12 and therefore fails on every open PR. No behavior changes on any feature set.

## Cause

The job's second step is `cargo check --no-default-features --features xla-diagnostics --all-targets` under `RUSTFLAGS="-D warnings"`. Because `default = ["surgery", "webui"]`, that step builds with the WebUI off.

The last success on `main` was `9ead2b7d` (2026-09-12 04:43) and the first failure `70386ac6` (2026-09-12 16:12). The only commits between them are the WebUI series: #1857, #1860, #1865, #1868, #1864. They registered their routes behind `#[cfg(feature = "webui")]` but left the handlers, validators, constants, request types and imports those routes use outside the gate. With `webui` off all of it is dead code, and `-D warnings` makes each an error.

I checked before writing this that it was not already fixed elsewhere: current `origin/main` still carries the imports and its latest CI run still fails the job, `lablup/mlxcel-internal` was last pushed on 2026-09-10 and predates the breakage, and no merged or open PR fixes it.

## Change

Every orphaned item is gated on `webui`, matching the gate its only callers already carry.

- `src/server/router_server.rs`: 35 handlers, validators, constants and types, plus the `router_lifecycle`, `HeaderMap`, `Uri`, `AxumPath` and `RouterModelAction` imports only they use.
- `src/server/app.rs`: six axum imports.
- `src/models/mod.rs`: six detection re-exports used only by `server::webui`. `is_sequence_classification_architecture` stays ungated because `src/rerank/mod.rs` uses it.
- `src/server/auth.rs`: `with_extra_key`, called only from the WebUI security setup in `startup.rs`.
- `src/server/router_server_tests.rs`: `restore_env_var`, used only by a webui-gated test.

Gating the first layer exposed a second layer of imports that only the gated items used, so this was iterated until the compiler reported nothing. The only deleted lines are import lists being split; no logic is touched.

## Verification

Reproduced first on `main`: `cargo check --no-default-features --features cuda --lib --tests` reports 42 warnings in the `mlxcel` crate.

After the change, every `cargo check` below reports zero warnings and zero errors in workspace crates:

| features | targets |
|---|---|
| `--no-default-features --features cuda` | `--lib --tests` |
| `--features cuda` (defaults on) | `--lib --tests` |
| `--no-default-features --features cuda,webui` | `--lib --tests` |
| `--no-default-features --features cuda,surgery` | `--lib --tests` |
| `--no-default-features --features cuda` | `--all-targets` |
| `--features cuda` (defaults on) | `--all-targets` |

The `--all-targets` rows cover bins, benches and examples, where a gated item used by another target would have been a hard compile error rather than a warning. `cargo fmt --all -- --check` is clean.

Not built locally: the `xla-iree` feature itself. The `OpenXLA feature compile` job on this PR is the check for it, and it is the job this PR exists to turn green.

## Follow-up for open PRs

PR #1872 edits `src/server/router_server.rs` and carries the same imports, so it will need a rebase once this lands. A rebase request will be posted there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:architecture Architecture and code structure changes priority:high High priority status:done Completed type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(webui): embed a reproducible offline frontend bundle

1 participant