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,
fragments: 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). - Fragment
Scan Error - A fragment file the claiming engine’s parser could not read (1-based line/column within that file).
- Fragment
Support - What a step kind needs to own a fragment file format: the extension that identifies one and the parser that reads it. Source discovery asks the registry for the extension rather than naming a file type itself, so adding an engine never teaches the CLI a new one (ADR-0002).
- 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).
- Scanned
Fragment - One entry of a fragment file, as the claiming engine’s own parser sees it.
- Scenario
Ctx - Per-scenario context handed to
EngineFactory::open. Fields grow additively as milestones land (artifact dirs, config, …). - Step
Kind Spec - An engine’s claim on a pack step kind: the key prefix (
hurl; other prefixes reserved — ADR-0002 errata) 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.
Constants§
- OPTION_
FAMILIES - The option families a pack step and a fragment can both declare, spelled as the pack spells them.
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.
Functions§
- secret_
variables - Every engine variable a scenario must inject as a secret, paired with its
value —
ScenarioCtx::secret_bindingsjoined againstScenarioCtx::secrets. The one place that join is written.
Type Aliases§
- Fragment
Scanner - An engine-contributed reader for one fragment file’s whole text (ADR-0018).
- Payload
Validator - An engine-contributed static payload validator (pack validation pass 7).