Skip to content

fix(server): gate webui-only helpers so --no-default-features builds clean - #1889

Merged
inureyes merged 1 commit into
mainfrom
fix/xla-no-default-features-unused-imports
Sep 14, 2026
Merged

inureyes merged 1 commit into
mainfrom
fix/xla-no-default-features-unused-imports

Conversation

@inureyes

Copy link
Copy Markdown
Member

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.

…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.
@inureyes inureyes added type:bug Bug fixes, error corrections, or issue resolutions priority:high High priority area:core mlxcel-core: MLX FFI, primitives, KV cache, layers status:review Under review status:done Completed and removed status:review Under review labels Sep 14, 2026
@inureyes
inureyes merged commit b395a9e into main Sep 14, 2026
16 checks passed
@inureyes
inureyes deleted the fix/xla-no-default-features-unused-imports branch September 14, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core mlxcel-core: MLX FFI, primitives, KV cache, layers priority:high High priority status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant