Expand description
Scenario document model, parsing, and validation (ADR-0069 sections 1-2).
A scenario document is a .test.yaml (or .test.yml) sidecar that
declares one integration-tier test: exactly one route source
(routeFiles, routeFilesFromRoot, or inline routes), an ordered
scenario: action list, an optional env: map with fixed fixture
values, an optional envPassthrough: allowlist, an optional
endpoint-keyed partners: scripting map, an optional pinned
profile, an optional document-level sendDeadline bounding
every send, an optional document-level inbound: listener
declaration (feature http), and an optional document-level
logs: assertion block (rc-tdgh5) whose grammar is clause-checked
here and evaluated against the harness capture window at run time.
Unknown fields are rejected.
The scenario vocabulary and the unit-tier vocabulary (inputs,
expects, intercepts) never mix in one document. A document with
scenario: that also declares a unit-tier section is rejected at
load time.
Durations (sendDeadline, deadline, duration,
elapsedAtLeast) are humantime strings, for example "5s" or
"250ms", parsed during validation so errors can name the action
index.
Re-exports§
pub use error::DocError;pub use logs::LogLevel;pub use logs::LogsAssertion;pub use validate::ScenarioTarget;pub use validate::SqlTarget;pub use validate::ValidateExpectation;
Modules§
- error
- Load-time errors for scenario documents, and the endpoint-reference conversion that fails with them (rc-0ahfl, split out of the parent module).
- logs
- The document-level
logs:assertion grammar (rc-p1x2a, split out of the parent module; mirrors thedocument/error.rspattern). - validate
- The
validategrammar: what avalidateaction asserts against (target), the paired expectation shapes, and the expectation parsers (bd rc-m6xr, split out of the parent module; mirrors thedocument/error.rsandpartner_script.rspatterns).
Structs§
- Endpoint
Ref - An endpoint reference: a bare endpoint string or a map with
endpoint,provisioning, andbindVarkeys. - Inbound
Listener - The document’s
inbound:declaration (rc-5yon): v1 grammar is a single mapinbound: {bindVar: NAME}. The harness provisions one listener per document, binds127.0.0.1:0, stages it on the HTTP component’s global registry (ADR-0070 staged consumption), and fills the bind variable withhttp://<bound-address>so route consumer URIs interpolate the staged socket. - Partner
Expectation - A recorded-request expectation: a count bound plus optional
method,path, andquerysubset filters. - Partner
Script - One partner script of a
partners:entry: the response a partner serves when the system under test reaches its endpoint, or the fault it applies instead. Exactly one ofresponse/faultmust be declared. Grammar only; the runner consumes the map. - Partner
Script Response - The response a partner script serves.
- Rows
Expectation - The sql-target row-shape expectation: exactly one row shape is
populated at parse time — concrete row patterns or a row-count
bound (
rowsXORbound). - Scenario
Document - A parsed scenario document. Route file paths stay as declared; resolving them against the document directory or the project root is the runner’s job, the same split the unit-tier parser keeps.
Enums§
- Count
Bound - The recorded-request count bound of a
RequestExpectation: exactly one bound form per expectation. Poll semantics per bound (arrivals only add, so the filtered count is monotone non-decreasing): - Expectation
- A validation expectation. The grammar keys mirror the mock-testkit
matcher rules:
equals,regex,contains,startsWith,endsWith,exists,jsonSubset. - Partner
Fault - The fault a partner script applies instead of serving a response.
- Path
Filter - The path filter of a
RequestExpectationover the recorded path-and-query; at most one filter per expectation. - Provisioning
- Partner provisioning source (ADR-0069 section 9). The axis is who
owns the lifecycle.
testcontaineranduser-providedare reserved grammar values; the parser rejects them. - Route
Source - The route source of a scenario document. Exactly one form is declared; the parser rejects zero or multiple declarations.
- Scenario
Action - One ordered scenario action (ADR-0069 section 11, adopted from
Citrus:
send,receivewith a mandatory deadline,sleep,validate,sql).
Functions§
- parse_
scenario_ document - Parses and validates a scenario document. Validation order:
(a) the path carries a reserved test-document suffix; (b) the text
deserializes; (c) a non-empty
scenario:section exists; (d) no unit-tier section coexists with it; (e) exactly one route source is declared, and it is not inline (routescannot boot in v1, so the defect fails at load instead of at boot); (f) each action converts (single-key dispatch, deadlines, durations, endpoint provisioning, expectation grammar, thedirect:-onlyexpectReplygate) with action-index errors; (g) eachpartnersentry converts (script grammar, response status range) with entry-key errors; (h) noenvkey collides with a declaredbindVar; (i) eachpartnervalidate target URI equals a harness endpoint reference declared by the scenario’s ownsend/receiveactions, or self-declares the reference: an object-formprovisioning: harnesstarget whosehttpURI apartners:entry names. The optionalinbound:section converts between (g) and (h): grammar in every build, activation demand-gated behindhttp(ADR-0069 §8). (j) The optionallogs:block converts (clause grammar: contains markers, load-compiled regex, the noLevelAbove level set) with clause-naming load errors.