pub enum KernelError {
CategoricalAxis(InputAxis),
AxisAbsent(InputAxis),
TypeMismatch(InputAxis),
AxisUnsupportedForRequest {
axis: InputAxis,
reason: &'static str,
},
Solve {
code: SolveErrorCodeV1,
message: String,
},
Observation(TrajectoryObservationError),
NonFinite(InputAxis),
StepOutOfDomain {
axis: InputAxis,
attempted: f64,
},
DuplicateAxis(InputAxis),
InvalidDomain {
axis: InputAxis,
reason: &'static str,
},
}Variants§
CategoricalAxis(InputAxis)
Reserved for a later (differentiation) task: an axis whose axis_meta(axis).kind is
AxisKind::Categorical was asked to be treated as continuous. Not constructed by
read_axis/with_axis themselves, which accept categorical axes just like any other.
AxisAbsent(InputAxis)
The axis is structurally unavailable on THIS request’s resolved shape – currently only
the three wind axes when the resolved wind is ResolvedWindV1::Segmented, mirroring
read_axis returning None for the identical condition (see the module doc).
TypeMismatch(InputAxis)
The AxisValue variant supplied to with_axis does not match what axis expects
(e.g. a Scalar for DragModel, or a Flag for any continuous axis).
AxisUnsupportedForRequest
The axis is well-formed and present, but this particular request’s OTHER inputs make
perturbing it physically wrong rather than merely unrepresentable – see the guards
documented on with_axis.
Solve
The rebuilt request failed to resolve or solve. Not constructed here – with_axis only
builds the request, it does not solve it; crate::perturbation::evaluate (0.33.0
decision-support Task 6) is the constructor, uniformly for every stage that can fail
(solve_v1::prepare_request, solve_v1::build_zeroed_solver, and
TrajectorySolver::solve).
code is carried alongside message (review fix I4(a), derive.rs) specifically so a
caller – most notably central_difference’s one-sided fallback – can tell a domain
rejection (SolveErrorCodeV1::InvalidValue, produced by require_range/
require_non_negative/require_positive in solve_v1.rs) apart from a genuine solver
failure (SolveFailed, ResourceLimit, InternalError) or a malformed-request bug
(ConflictingFields, MissingField, UnknownField, …) that merely happened to be
triggered by one particular perturbed value. Collapsing this to a String (the previous
shape) made that distinction unrecoverable except by parsing the message.
Observation(TrajectoryObservationError)
Post-solve observation extraction failed – most notably a requested range outside the
computed trajectory. Not constructed here for the same reason as Solve;
crate::perturbation::evaluate constructs it directly from a
crate::trajectory_observation::TrajectoryObservationError, preserved WHOLE (not
collapsed to its Display string) for the same reason as Solve’s code above: only
TrajectoryObservationError::OutOfRange is a domain rejection eligible for
central_difference’s one-sided fallback – NonMonotonicTrajectory, NonFiniteState,
SampleLimitExceeded, AllocationFailed, and the rest are genuine bugs that must
propagate, not be silently reinterpreted as “this side left the domain.”
NonFinite(InputAxis)
A Scalar value supplied to with_axis was not finite (NaN or infinite).
StepOutOfDomain
Both perturbed sides of a central difference failed to produce a usable observation –
neither x + attempted nor x - attempted evaluates – so not even a one-sided
difference can be built (central_difference’s domain fallback,
src/perturbation/derive.rs). Distinct from a derivative of zero: this means
“undifferentiable with this step,” never “no effect.”
DuplicateAxis(InputAxis)
The same axis was declared more than once in a caller-supplied source list. Not
constructed by read_axis/with_axis/central_difference (none of which see more than
one axis at a time) – crate::error_budget::error_budget (0.33.0 decision-support Task
10, MBA-1347 review) constructs this from its own up-front validation, because two
entries for the same axis would double-count that axis’s variance and corrupt its
leave-one-out counterfactual (removing “the” declaration for that axis is ambiguous when
there are two). KernelError had not shipped on any released version when this variant
was added, so there is no compatibility concern in extending it.
InvalidDomain
The domain supplied to crate::tolerance::tolerance_envelope for one axis is missing, or
does not have the shape a one-variable bisection needs: both bounds finite, the lower
bound strictly less than the upper, and the axis’s own current value strictly between
them. A domain where the current value sits AT (not strictly inside) one edge would make
that search direction a zero-width probe – bisect_axis would report Ok(None) for it
(the two identical endpoints trivially agree), and that None would be indistinguishable
from a genuine “stays inside throughout” result even though nothing beyond the current
value was ever actually searched. 0.33.0 decision-support Task 12 (MBA-1350): never
constructed by with_axis/evaluate/bisect_axis themselves – tolerance_envelope
validates its own domain argument up front, before any solve, the same way
crate::error_budget::error_budget validates its ranges_m/sources arguments.
Implementations§
Source§impl KernelError
impl KernelError
Sourcepub fn is_domain_rejection(&self) -> bool
pub fn is_domain_rejection(&self) -> bool
True when this error means the specific perturbed VALUE fell outside the axis’s physical
domain – an InvalidValue solve rejection (from require_range/require_non_negative/
require_positive in solve_v1.rs), or an OutOfRange observation query (a requested
range that fell outside a trajectory shrunk by the perturbation) – as opposed to a
genuine solver or trajectory failure that merely happened to be triggered by one
particular perturbed value.
This is the ONLY thing crate::perturbation::central_difference’s one-sided fallback
(derive.rs) may gate on. Review fix I4(a): an earlier revision gated on Err(_)
(any failure at all on one side), which silently reinterpreted genuine bugs – a
non-convergent zero search, a non-finite trajectory state, a sample-limit overrun – as
if they were domain boundaries, answering with a fabricated derivative instead of
reporting the real failure.
Trait Implementations§
Source§impl Clone for KernelError
impl Clone for KernelError
Source§fn clone(&self) -> KernelError
fn clone(&self) -> KernelError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KernelError
impl Debug for KernelError
Source§impl Display for KernelError
impl Display for KernelError
Source§impl Error for KernelError
impl Error for KernelError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for KernelError
impl PartialEq for KernelError
impl StructuralPartialEq for KernelError
Auto Trait Implementations§
impl Freeze for KernelError
impl RefUnwindSafe for KernelError
impl Send for KernelError
impl Sync for KernelError
impl Unpin for KernelError
impl UnsafeUnpin for KernelError
impl UnwindSafe for KernelError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.