pub enum RunError {
Discovery(DiscoveryError),
Query {
rule: String,
language: String,
detail: String,
},
MissingQuery {
rule: String,
language: String,
},
UnknownLanguage {
rule: String,
language: String,
known: String,
},
WasmRuntime {
detail: String,
},
Gates {
rule: String,
detail: String,
},
Component {
rule: String,
detail: String,
},
RunTimeout {
budget: Duration,
elapsed: Duration,
},
Rule {
rule: String,
file: String,
detail: String,
},
Worker {
detail: String,
},
}Expand description
Why a run could not complete.
Every variant aborts the run. A checker that could not finish must not be mistaken for one that found nothing — see architecture §6.8.
Variants§
Discovery(DiscoveryError)
Discovery could not run.
Query
A rule’s query does not compile.
Names the language as well as the rule: a rule holds one query per language it
declares, so a position like query:3:12 locates a point in one of several sources,
and only two of the compiler’s error kinds name the grammar themselves.
Fields
MissingQuery
A rule reached query compilation with no query for one of its languages.
Unreachable through config loading, which enforces the exact cover between a rule’s languages and its queries — so this is the engine’s own bookkeeping failing, named as such rather than dressed as a config error under an “invalid query” header.
Fields
UnknownLanguage
A rule names a language nothing provides.
Fields
WasmRuntime
The WebAssembly runtime could not be described, so a run cannot be keyed against it.
Not about any rule. A cached result is only valid for the compilation environment it
was produced under, and that environment is read off an engine built from
lanekeep_wasm’s one configuration — so a host where wasmtime cannot realize it is a
host where no result can be filed under a key that means anything. Guessing a value
instead would put entries under a key describing nothing, which is the one failure
docs/architecture.md §8.1 is arranged against.
What this costs, stated plainly: a host where wasmtime cannot build an engine can
now run no rules at all — including a ruleset that is entirely TypeScript and needs no
WebAssembly whatever. That is a real reduction in reach for no benefit until a
component actually executes, and it is the price of keying every run against the
environment rather than only the runs that use it. The alternative is a sentinel for
“no wasm here”, which is a second code path through the cache key whose correctness
nothing would exercise until the first component arrived. Worth revisiting if this ever
fires on a real host; nothing has seen it fire, because the configuration is three
tunables on a supported target.
Gates
A rule’s gates are malformed.
Component
A rule’s component could not be loaded, or could not be linked against the host world.
Separate from RunError::Rule, which is a rule that ran and failed. This one never
ran: its bytes are missing, its import list reaches for something the sandbox does not
grant, or its exports do not satisfy lanekeep:host’s rule world. All three are
properties of the artifact rather than of any file, which is why there is no file
field, and all three are found before a file is read.
RunTimeout
The run’s wall-clock budget was spent, noticed between one file and the next.
The only limit breach that names no rule and no file, because it is about neither.
Both engines already report a spent run budget from inside a handler — QuickJS from its
interrupt handler, wasmtime from an epoch check compiled into guest code — and those
arrive as RunError::Rule, carrying whichever rule happened to be executing. That is
the right shape for a breach a rule was at least present for. It is the wrong shape for
this one: nothing was executing, so there is no culprit to name and naming one would
send a reader to a rule that is not the problem.
The wording is deliberately the same as both engines’, because the user-facing fact is the same and which mechanism noticed is lanekeep’s business rather than theirs.
Fields
Rule
The sandbox failed, including on a breached budget.
Fields
Worker
A worker could not be set up.
Trait Implementations§
impl Eq for RunError
Source§impl Error for RunError
impl Error for RunError
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 From<DiscoveryError> for RunError
impl From<DiscoveryError> for RunError
Source§fn from(source: DiscoveryError) -> Self
fn from(source: DiscoveryError) -> Self
impl StructuralPartialEq for RunError
Auto Trait Implementations§
impl Freeze for RunError
impl RefUnwindSafe for RunError
impl Send for RunError
impl Sync for RunError
impl Unpin for RunError
impl UnsafeUnpin for RunError
impl UnwindSafe for RunError
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more