pub fn resolve_scheduler(
spec: &SchedulerSpec,
) -> Result<(Option<PathBuf>, ResolveSource)>Expand description
Resolve a scheduler binary from a SchedulerSpec.
Returns the resolved path (if any) paired with the
ResolveSource naming the discovery branch that produced it.
The source is load-bearing for downstream provenance: only
ResolveSource::AutoBuilt guarantees the binary matches the
current workspace tree; every other variant locates a
pre-existing file whose git hash is UNKNOWN to this process.
Variant mapping:
Eevdf/KernelBuiltin { .. }→(None, NotFound)(no user-space binary).Path(p)→(Some(p), Path)(explicit caller-named path; validated for existence).Discover(name)→ cascade throughKTSTR_SCHEDULERenv (EnvVar),$PATHlookup whenKTSTR_CARGO_TEST_MODEis active (PathLookup), sibling ofcurrent_exe(SiblingDir),target/debug/(TargetDebug),target/release/(TargetRelease), on-demand build (AutoBuilt). In the orchestrated (non-cargo-test) flow the on-demand build runs FIRST and a build FAILURE REFUSES (returns the error) rather than serving a stale pre-built binary, unlessKTSTR_SCHEDULER_ALLOW_STALE_FALLBACKis set. Exhausting every branch is a hard error. The PATH lookup is only enabled in cargo-test mode so the existing nextest /cargo ktstr testdiscovery cascade remains canonical (sibling-of-test-binary first) — pulling a system-widescx_layeredahead of a workspace-built one would corrupt gauntlet runs whose results must reflect the in-tree scheduler revision.