fix(server): gate webui-only helpers so --no-default-features builds clean - #1889
Merged
Merged
Conversation
…clean The `OpenXLA feature compile` CI job has failed on main since 2026-09-12 16:12 (first failure `70386ac6`, last success `9ead2b7d`). Its second step runs `cargo check --no-default-features --features xla-diagnostics --all-targets` under `RUSTFLAGS="-D warnings"`, and `default = ["surgery", "webui"]`, so that step builds with the WebUI turned off. The WebUI series between those commits (#1857, #1860, #1865, #1868, #1864) registered its routes behind `#[cfg(feature = "webui")]` but left the handlers, validators, constants, request types and imports those routes use outside the gate. With `webui` off they are all dead, and `-D warnings` turns each into an error. Reproduced locally with `cargo check --no-default-features --features cuda --lib --tests`: 42 warnings in the `mlxcel` crate. This gates every one of them on `webui`, matching the gate their only callers already carry. No code path changes on any feature set. The items are in `src/server/router_server.rs` (35 handlers, validators, constants and types, plus the `router_lifecycle`, `HeaderMap`, `Uri`, `AxumPath` and `RouterModelAction` imports that only they used), `src/server/app.rs` (six axum imports), `src/models/mod.rs` (six detection re-exports used only by `server::webui`), `src/server/auth.rs` (`with_extra_key`, called only from the WebUI security setup in `startup.rs`), and `src/server/router_server_tests.rs` (`restore_env_var`, used only by a webui-gated test). `is_sequence_classification_architecture` stays ungated because `src/rerank/mod.rs` uses it. Gating the first layer exposed a second layer of imports that only the gated items used, so the fix was iterated until the compiler reported nothing. Verified with `cargo check`, all reporting zero warnings in workspace crates: `--no-default-features --features cuda --lib --tests`, `--features cuda --lib --tests`, `--no-default-features --features cuda,webui --lib --tests`, `--no-default-features --features cuda,surgery --lib --tests`, and `--all-targets` for both the no-default and default cuda sets, so bins, benches and examples are covered. `cargo fmt --all -- --check` is clean. The `xla-iree` feature itself was not built locally; the CI job on this PR is the check for that.
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.
Summary
Restores the
OpenXLA feature compileCI job, which has failed onmainsince 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-targetsunderRUSTFLAGS="-D warnings". Becausedefault = ["surgery", "webui"], that step builds with the WebUI off.The last success on
mainwas9ead2b7d(2026-09-12 04:43) and the first failure70386ac6(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. Withwebuioff all of it is dead code, and-D warningsmakes each an error.I checked before writing this that it was not already fixed elsewhere: current
origin/mainstill carries the imports and its latest CI run still fails the job,lablup/mlxcel-internalwas 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 therouter_lifecycle,HeaderMap,Uri,AxumPathandRouterModelActionimports only they use.src/server/app.rs: six axum imports.src/models/mod.rs: six detection re-exports used only byserver::webui.is_sequence_classification_architecturestays ungated becausesrc/rerank/mod.rsuses it.src/server/auth.rs:with_extra_key, called only from the WebUI security setup instartup.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 --testsreports 42 warnings in themlxcelcrate.After the change, every
cargo checkbelow reports zero warnings and zero errors in workspace crates:--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-targetsThe
--all-targetsrows 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 -- --checkis clean.Not built locally: the
xla-ireefeature itself. TheOpenXLA feature compilejob 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.rsand carries the same imports, so it will need a rebase once this lands. A rebase request will be posted there.