Skip to content

refactor(conformance): re-home misplaced logic across tooling seams - #51

Merged
Teakowa merged 2 commits into
mainfrom
refactor/conformance-tooling-seams
Oct 6, 2026
Merged

Teakowa merged 2 commits into
mainfrom
refactor/conformance-tooling-seams

Conversation

@e54-bot

@e54-bot e54-bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

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 by session. scenario.rs is 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: Step deserializes via a private StepWire + TryFrom into StepRequest::{Request, RawLine}. Both/neither request/rawLine now fails at deserialization — with the same error message, plus line/column — so the validator's "exactly one" clause and session.rs's unreachable! are deleted. step_request_line is infallible.
  • accepted_artifact_formats moves to methods.rs beside select_artifact_format: ADR-0004's semantics get a single edit site, and Server's surface is back to session state + generic gates (since, capability).

Behavior-preserving: no wire, spec, or fixture changes.

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --workspace (14 tests)
  • lpp-conformance-runner --validate-only --fixtures conformance/fixtures/v1 — 61 passed
  • lpp-conformance-runner --provider ./target/release/lpp-mock-provider --fixtures conformance/fixtures/v1 — 61 passed
  • git diff --check
  • Manually verified: fixtures with both or neither of request/rawLine still fail validation with step must have exactly one of 'request' or 'rawLine'

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@e54-bot

e54-bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Review finding addressed in 171d41d.

Step request-shape invariant now has focused coverage — scenario.rs gained a test module that deserializes Step directly (smallest owning surface): both request+rawLine present and neither present are asserted to fail with the rule's own message (exactly one of 'request' or 'rawLine'), plus a positive case that each valid form parses. Assertions target the rejection behavior, not serde's line/column formatting.

Verification: cargo test --workspace (17 tests, +3), clippy -D warnings, fmt, both conformance runs 61/61, git diff --check.

Ready for follow-up review.

@e54-bot
e54-bot requested a review from Teakowa October 6, 2026 17:29
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.
@e54-bot
e54-bot force-pushed the refactor/conformance-tooling-seams branch from 171d41d to 75aabe7 Compare October 6, 2026 17:43

@Teakowa Teakowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teakowa
Teakowa merged commit e78b532 into main Oct 6, 2026
2 checks passed
@Teakowa
Teakowa deleted the refactor/conformance-tooling-seams branch October 6, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-home misplaced logic across conformance tooling seams

2 participants