Repository navigation
refactor(conformance): re-home misplaced logic across tooling seams - #51
Conversation
Teakowa
left a comment
There was a problem hiding this comment.
conformance/runner/src/scenario.rs — StepWire/TryFrom<StepWire> introduces the key behavioral invariant of this refactor, but no automated test exercises either invalid case. The existing conformance fixtures are valid inputs, so both request+rawLine and neither can regress while the full fixture suite stays green. Add focused tests that deserialize a step/scenario and assert both invalid shapes are rejected. Assert the behavior, not incidental serde line/column formatting.
|
Review finding addressed in 171d41d. Step request-shape invariant now has focused coverage — Verification: Ready for follow-up review. |
scenario.rs served two callers: schema/validation for main.rs and session-runtime machinery (project materialization, ${PROJECT_URI} substitution) for session.rs. The runtime half moves to a new project_fixture module consumed only by session. Step's either/or request shape is now an enum built by try_from, so both/neither request/rawLine is unrepresentable and the downstream unreachable! is gone. In the mock provider, accepted_artifact_formats moves from Server to methods.rs beside select_artifact_format, keeping Server's surface to session state and generic gates and giving ADR-0004's semantics a single edit site. Behavior-preserving: the full fixture suite passes unchanged.
Closes #50
The StepWire/TryFrom invariant (exactly one of request/rawLine) had no automated coverage: all shipped fixtures are valid inputs, so a regression would stay green. Add unit tests asserting both invalid shapes are rejected and each valid form parses, asserting the rule's message rather than serde's formatting.
171d41d to
75aabe7
Compare
Summary
Closes #50 — gives each conformance-tooling module a single caller-shaped concern:
scenario.rs→project_fixture.rs: the session-runtime machinery (ProjectFixture,materialize_project,substitute_project_uri) moves to a new sibling module consumed only bysession.scenario.rsis back to being exactly what its doc says: fixture schema + structural validation (+ envelope defaults and session-template splicing). 297 → 249 LOC.Step's either/or is unrepresentable:Stepdeserializes via a privateStepWire+TryFromintoStepRequest::{Request, RawLine}. Both/neitherrequest/rawLinenow fails at deserialization — with the same error message, plus line/column — so the validator's "exactly one" clause andsession.rs'sunreachable!are deleted.step_request_lineis infallible.accepted_artifact_formatsmoves tomethods.rsbesideselect_artifact_format: ADR-0004's semantics get a single edit site, andServer's surface is back to session state + generic gates (since,capability).Behavior-preserving: no wire, spec, or fixture changes.
Test plan
cargo fmt --all --checkcargo clippy --all-targets -- -D warningscargo test --workspace(14 tests)lpp-conformance-runner --validate-only --fixtures conformance/fixtures/v1— 61 passedlpp-conformance-runner --provider ./target/release/lpp-mock-provider --fixtures conformance/fixtures/v1— 61 passedgit diff --checkrequest/rawLinestill fail validation withstep must have exactly one of 'request' or 'rawLine'