This contract defines the core equivalence harness between parser event-stream semantics and materialized AST semantics, plus deterministic replay requirements for failure classes consumed by downstream parser quality lanes.
This lane is implemented by:
docs/PARSER_EVENT_AST_EQUIVALENCE_REPLAY_CONTRACT.mdcrates/franken-engine/tests/fixtures/parser_event_ast_equivalence_v1.jsoncrates/franken-engine/tests/parser_event_ast_equivalence.rsscripts/run_parser_event_ast_equivalence.shscripts/e2e/parser_event_ast_equivalence_replay.sh
schema_version:franken-engine.parser-event-ast-equivalence.v1contract_version:1.0.0
For every success case:
- Parse with
parse_with_event_irto produce canonical parse result and Event IR. - Materialize AST from the Event IR via
materialize_from_source. - Require deterministic parity:
- materialized AST canonical hash equals parser AST canonical hash
- materialized statement-node count equals expected statement count
- Require witness stability across reruns:
- Event IR canonical hash is stable for identical input/goal
- materialized root node id and statement-node witnesses are stable
Required deterministic failure classes in this core phase:
- parse failure with empty source:
empty_source - materialization failure from failed event stream:
parse_failed_event_stream - tamper-detection failure for statement payload hash:
statement_hash_mismatch
Every failure path must produce a replayable command contract and stable error classification.
Required event keys:
trace_iddecision_idpolicy_idcomponenteventoutcomeerror_code
One-command replay wrapper:
./scripts/e2e/parser_event_ast_equivalence_replay.sh
./scripts/e2e/parser_event_ast_equivalence_replay.sh full
./scripts/e2e/parser_event_ast_equivalence_replay.sh matrixScenario-specific replay commands (all deterministic):
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=parity ./scripts/run_parser_event_ast_equivalence.sh test
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=malformed ./scripts/run_parser_event_ast_equivalence.sh test
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=tamper ./scripts/run_parser_event_ast_equivalence.sh test
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=replay ./scripts/run_parser_event_ast_equivalence.sh test
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=full ./scripts/run_parser_event_ast_equivalence.sh test
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=matrix ./scripts/run_parser_event_ast_equivalence.sh testMatrix scenario (bd-2mds.1.4.4.2) enforces deterministic coverage metadata:
- corpus tiers:
core,edge,adversarial - seed sweep:
17,43,101 - cross-architecture targets:
x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu
All heavy Rust checks/tests for this lane run via rch.
Fail-closed wrapper requirements:
- reject any
rchlocal-fallback path (running locally,RCH-E326, or equivalent fallback markers) - reject missing remote exit markers and explicit non-zero remote exit markers
- reject artifact-retrieval failures (
Artifact retrieval failed, rsync artifact errors) - allow recovery only when the remote command explicitly finished with
exit=0and the only follow-on problem is a recoverable artifact timeout
Canonical gate command:
./scripts/run_parser_event_ast_equivalence.sh ciExpanded matrix sweep for bd-2mds.1.4.4.2:
PARSER_EVENT_AST_EQUIVALENCE_BEAD_ID=bd-2mds.1.4.4.2 \
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=matrix \
./scripts/run_parser_event_ast_equivalence.sh ciModes:
check: compile focused event->AST equivalence test targettest: execute scenario-focused deterministic testsclippy: lint focused target with-D warningsci: check + scenario test + clippy
Each run emits:
artifacts/parser_event_ast_equivalence/<timestamp>/run_manifest.jsonartifacts/parser_event_ast_equivalence/<timestamp>/events.jsonlartifacts/parser_event_ast_equivalence/<timestamp>/commands.txtartifacts/parser_event_ast_equivalence/<timestamp>/matrix_summary.json
The manifest includes deterministic environment fingerprints, replay command, scenario, and pass/fail outcome.
Default manifest bead tracking uses bd-2mds.1.4.4. Override per run when
needed:
PARSER_EVENT_AST_EQUIVALENCE_BEAD_ID=bd-2mds.1.4.4.2 \
PARSER_EVENT_AST_EQUIVALENCE_SCENARIO=parity \
./scripts/run_parser_event_ast_equivalence.sh test./scripts/run_parser_event_ast_equivalence.sh ci
cat artifacts/parser_event_ast_equivalence/<timestamp>/run_manifest.json
cat artifacts/parser_event_ast_equivalence/<timestamp>/events.jsonl
cat artifacts/parser_event_ast_equivalence/<timestamp>/commands.txt
cat artifacts/parser_event_ast_equivalence/<timestamp>/matrix_summary.json
./scripts/e2e/parser_event_ast_equivalence_replay.sh
./scripts/e2e/parser_event_ast_equivalence_replay.sh full
./scripts/e2e/parser_event_ast_equivalence_replay.sh matrix