pub enum EngineConstructionError {
RewriteCycle {
axis: CategoryId,
members: Box<[RewriteId]>,
},
UnannotatedCustomAxes {
rewrite: RewriteId,
},
UnknownRuleOverride {
key: String,
did_you_mean: Option<String>,
},
ConflictingRuleOverride {
rule_id: String,
keys: Box<[String]>,
severities: Box<[String]>,
},
}Expand description
Errors that will be raised while constructing an Engine.
Every variant is intended to be a hard failure — the Phase 3
Engine::new implementation will return Err rather than
silently degrading. Runtime lint / fix never emits these; they are
build-time configuration errors the integrator is expected to
resolve before shipping.
Until that constructor path lands, this enum documents the planned engine-construction error surface for downstream tooling.
Variants§
RewriteCycle
A read/write cycle exists among the declared page rewrites.
axis is one category in the cycle (there may be several — the
engine reports the first one it hits during the topological
sort). members names every rewrite participating in the
cycle.
The variable-length slice form (not [RewriteId; 2]) is
deliberate: cycles of length ≥ 3 are a real failure mode —
foundational-plan line 1066 notes the JOINT/FGI/REL-TO
interaction as one that could plausibly trip this path if
authored incorrectly.
The list is owned (Box<[RewriteId]>, not &'static [...])
because cycle membership is computed at engine-construction
time from the declared rewrite graph, not borrowed from a
static table. Owning it here avoids the memory-leak /
lifetime-gymnastics tradeoff a 'static slice would force on
the Phase 3 scheduler. RewriteId is itself &'static str,
so the per-entry payload is still 'static; only the
container is heap-allocated.
Fired by the Phase 3 scheduler when Engine::new runs Kahn’s
algorithm over the rewrite graph (tasks T031–T032).
UnannotatedCustomAxes
A PageRewrite::custom was declared without explicit
reads / writes (or with empty slices).
The declarative constructor derives these from the variant
shapes; custom uses function pointers so the engine cannot
derive them. Failing closed forces the rewrite author to
annotate the dataflow explicitly — an un-annotated custom
rewrite could not be scheduled relative to other rewrites.
UnknownRuleOverride
A [rules] entry in the merged config references a key that is
neither a known rule ID (e.g., E001) nor a known rule name
(e.g., portion-mark-in-banner) across the registered rule sets.
key is the unknown string as the user wrote it. did_you_mean
is a best-effort suggestion based on edit distance against the
union of known IDs and names — None when no candidate is close
enough to be useful.
Fired by Engine::new / Engine::with_clock when canonicalizing
the config’s severity overrides against the registered rules.
This is a user-config error, not an internal invariant violation;
exit_code() maps it to EX_DATAERR (65).
ConflictingRuleOverride
The user specified the same rule two different ways in the merged
config (e.g., E001 = "warn" and portion-mark-in-banner = "error")
and the two entries resolved to different severity strings.
Duplicate forms with the same severity are silently accepted — only a genuine value conflict hard-fails.
rule_id is the canonical ID both keys resolved to. keys
contains the two source keys as the user wrote them; severities
contains the two conflicting severity strings, index-aligned with
keys.
Implementations§
Source§impl EngineConstructionError
impl EngineConstructionError
Sourcepub fn exit_code(&self) -> i32
pub fn exit_code(&self) -> i32
Exit code for this error per contracts/cli.md.
UnknownRuleOverride/ConflictingRuleOverride→EX_DATAERR(65). These are user-config defects — the.marque.tomlrefers to a rule that doesn’t exist, or contradicts itself — and the user fixes them by editing their config.RewriteCycle/UnannotatedCustomAxes→EX_UNAVAILABLE(69). These are defects in the declarative scheme the engine was built against (developer / rule-author errors, not user-config errors), so the tool can’t honor the request until the developer ships a corrected build.
Trait Implementations§
Source§impl Clone for EngineConstructionError
impl Clone for EngineConstructionError
Source§fn clone(&self) -> EngineConstructionError
fn clone(&self) -> EngineConstructionError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EngineConstructionError
impl Debug for EngineConstructionError
Source§impl Display for EngineConstructionError
impl Display for EngineConstructionError
Source§impl Error for EngineConstructionError
impl Error for EngineConstructionError
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()