Expand description
The engine seam (ADR-0002): EngineFactory / EngineSession, step-kind routing,
and capability hooks (step_kinds, doctor).
Both traits are sync + dyn (ADR-0006) and used as Box<dyn …>. Adding an
engine is a new crate implementing both traits plus one registry line in
proef-cli — with zero changes to this crate (the structural acceptance
test for M6).
§Example: a minimal engine
use proef_core::cancel::CancellationToken;
use proef_core::engine::{
DoctorCheck, DoctorResult, EngineFactory, EngineSession, ScenarioCtx, StepKindSpec,
};
use proef_core::error::EngineError;
use proef_core::event::EventSink;
use proef_core::step::{BatchResult, StepBatch};
use proef_core::world::World;
struct NullEngine;
struct NullSession;
impl EngineFactory for NullEngine {
fn id(&self) -> &'static str {
"null"
}
fn step_kinds(&self) -> &'static [StepKindSpec] {
const KINDS: &[StepKindSpec] = &[StepKindSpec {
prefix: "null",
schema: "true",
validate: None,
}];
KINDS
}
fn doctor(&self) -> Vec<DoctorCheck> {
Vec::new()
}
fn open(&self, _ctx: &ScenarioCtx) -> Result<Box<dyn EngineSession>, EngineError> {
Ok(Box::new(NullSession))
}
}
impl EngineSession for NullSession {
fn run_batch(
&mut self,
batch: &StepBatch,
_world: &mut World,
_events: &EventSink,
_cancel: &CancellationToken,
) -> BatchResult {
BatchResult { steps: Vec::with_capacity(batch.steps.len()), error: None }
}
fn finish(&mut self) -> Result<(), EngineError> {
Ok(())
}
}
let factory: Box<dyn EngineFactory> = Box::new(NullEngine);
assert_eq!(factory.id(), "null");Structs§
- Artifact
Ref - A scenario’s emitted artifact, shared with the engine that executes it.
- Doctor
Check - One named environment check (native libraries, tool availability, …) surfaced
through
proef doctor(ADR-0002 capability hook). - Doctor
Result - Outcome of one environment check contributed by an engine.
- Engine
Id - Identifies an engine (
hurl, …). A macro step’s kind names the engine that executes it (ADR-0002 routing). - Http
Defaults - Batch-level HTTP defaults (per-entry
[Options]in artifacts override them — clone-then-override, verified TECH-SPEC §5). - Payload
Probe Error - A syntax problem found while probe-validating a step payload (1-based line/column within the payload text; the pack loader maps it onto the pack file).
- Scenario
Ctx - Per-scenario context handed to
EngineFactory::open. Fields grow additively as milestones land (artifact dirs, config, directives, …). - Step
Kind Spec - An engine’s claim on a pack step kind: the key prefix (
hurl,web, …) plus the JSON-Schema fragment describing that step’s payload, merged intoproef schemaoutput (TECH-SPEC §6), and an optional static payload validator used by pack validation pass 7 (probe-instantiation parse — TECH-SPEC §4.1).
Enums§
- Doctor
Status - Severity of a
DoctorResult.
Traits§
- Engine
Factory - Compiled-in engine entry point: identity, capability discovery, and session
opening (ADR-0002). Registered in
proef-cli’s registry, one line per engine. - Engine
Session - A live per-scenario engine session (ADR-0002). Only a session runs batches — lifecycle is enforced by this ownership shape, not typestate.
Type Aliases§
- Payload
Validator - An engine-contributed static payload validator (pack validation pass 7).