Skip to content

fix: gate job.rs's Error::Http arms behind the remote feature - #4100

Closed
hellower wants to merge 2 commits into
lancedb:mainfrom
hellower:fix/job-error-http-remote-gate
Closed

hellower wants to merge 2 commits into
lancedb:mainfrom
hellower:fix/job-error-http-remote-gate

Conversation

@hellower

@hellower hellower commented Aug 31, 2026 •

Copy link
Copy Markdown

What is the bug?

Fixes #4096.

Building lancedb with default-features = false and without the remote feature fails
to compile:

error[E0599]: no variant named `Http` found for enum `error::Error`
  --> rust/lancedb/src/job.rs:56:40
error[E0599]: no variant named `Http` found for enum `error::Error`
  --> rust/lancedb/src/job.rs:66:40

TerminalResult::decode (added by the recent job-handle work, e.g. #3742, #3755, #3939,
#4013) matches on Error::Http { .. } unconditionally in two places. Error::Http (and
Error::Retry) are #[cfg(feature = "remote")]-gated in error.rs, but lib.rs's
pub mod job; is not itself feature-gated, so job.rs is compiled for every feature
combination — including any downstream consumer that doesn't enable remote (our own
case pins default-features = false, features = ["metrics-otel"]).

How does this PR fix the problem?

request_id: Option<String> on TerminalResult is only ever Some via
TerminalResult::remote(..), which is itself only constructed from remote-gated code
(crate::remote::job). So the two Some(request_id) => Error::Http { .. } arms are gated
behind #[cfg(feature = "remote")], with a #[cfg(not(feature = "remote"))] fallback arm
producing Error::Runtime for the (unreachable without remote) case — matching the
existing None => Error::Runtime { .. } arm's message.

Why did CI not catch this?

Worth flagging separately: the "Run clippy (without remote feature)" step in
.github/workflows/rust.yml runs cargo clippy --workspace --tests (no --all-features),
but python/Cargo.toml and nodejs/Cargo.toml both declare
default = ["remote", ...] on their lancedb dependency. Workspace-wide feature
unification means that default re-enables remote on the shared lancedb build unit even
in this step, so it never actually builds lancedb without remote. Scoping that step to
-p lancedb does catch this class of bug (confirmed locally), but it also currently trips
on ~10 pre-existing, unrelated dead_code warnings elsewhere in the crate (job.rs's own
TerminalResult::remote/value, query.rs, table/computed_columns.rs,
table/lsm_stats.rs, utils/mod.rs) once it gets far enough to run clippy's lints — so
I've left that CI change out of this PR to keep it scoped to the actual bug. Happy to open
a follow-up for that if it's useful.

Validation

All run against this branch, from rust/:

$ cargo check -p lancedb --tests
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 21.69s
# (only the pre-existing, unrelated dead_code warnings noted above; no errors)

$ cargo test -p lancedb --lib job::
running 2 tests
test job::tests::mapped_spawned_job_preserves_cancellation ... ok
test job::tests::mapped_spawned_job_reuses_outcome ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 737 filtered out

$ cargo check -p lancedb --tests --features remote
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 2m 08s
# clean, confirming the remote-gated arms still compile and are exercised correctly

$ cargo fmt --all -- --check
# clean

No existing tests needed changes; job.rs's own unit tests don't exercise the remote
path (nothing in that file constructs TerminalResult::remote), so this is purely a
compile-time fix.

TerminalResult::decode matched on Error::Http unconditionally, but that
variant is #[cfg(feature = "remote")]-gated in error.rs while job.rs's
`pub mod job;` declaration in lib.rs is not. Building the crate with
default-features = false and without `remote` fails to compile with two
E0599s.

request_id is only ever Some via TerminalResult::remote, which is itself
only constructed from remote-gated code, so the Some arms are gated the
same way, with an Error::Runtime fallback for the (unreachable without
remote) case.

Fixes #4096

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added bug Something isn't working Rust Rust related issues labels Aug 31, 2026
lancedb-gatekeeper[bot]

This comment was marked as outdated.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Aug 31, 2026
@hellower

hellower commented Aug 31, 2026 •

Copy link
Copy Markdown
Author

@lancedb-gatekeeper addressed the request: added a package-scoped cargo check --profile ci -p lancedb --tests --no-default-features step to .github/workflows/rust.yml (right after the existing "Run clippy (without remote feature)" step).

This closes the gap you flagged — the workspace-wide "without remote" lint still built lancedb with remote enabled because python/Cargo.toml and nodejs/Cargo.toml both default that feature on, so feature unification masked the regression. The new step scopes to just the lancedb package, so remote-gated code (rust/lancedb/src/job.rs) is actually compiled without the feature going forward.

Verified locally:

$ cargo check --profile ci -p lancedb --tests --no-default-features
    Finished `ci` profile [optimized + debuginfo] target(s) in 3m 42s

(only the pre-existing, unrelated dead_code warnings you noted; no errors)

Pushed as d91a3f8.

@lancedb-gatekeeper lancedb-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Aug 31, 2026
The workspace-wide "without remote feature" clippy step still builds
`lancedb` with `remote` enabled, since `python/Cargo.toml` and
`nodejs/Cargo.toml` both default that feature on and workspace feature
unification re-enables it for the shared `lancedb` build unit. That
let the `Error::Http`/`Error::Retry` regression this PR fixes slip
through CI undetected.

Add a package-scoped `cargo check -p lancedb --tests --no-default-features`
step so remote-gated code (rust/lancedb/src/job.rs) is actually
compiled without the feature.
@hellower
hellower force-pushed the fix/job-error-http-remote-gate branch from 2deb212 to d91a3f8 Compare August 31, 2026 21:09

@lancedb-gatekeeper lancedb-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The author’s update adds the package-scoped no-default-features check, and the exact workflow command succeeds on this head. That closes the only prior finding. The cfg guards restore non-remote compilation while preserving remote HTTP error classification and request IDs.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance. Rust Rust related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

job.rs references Error::Http unconditionally though the variant is remote-gated — fails to compile without the "remote" feature

2 participants