contract-fidelity-lens

Conditional review lens: audits provider-side contract tests for the five fidelity gates — spawned only when the diff touches a contract, a VerifyAsync call, or a provider-side contract test scaffold.

When active

Spawned by software-engineer-reviewer only when the reviewed diff touches:

Not one of the CORE review lenses. Joins the adversarial panel conditionally, as a capability lens.

Inputs

Output

{
  "lens": "contract-fidelity",
  "verdict": "pass | fail",
  "defects": [{ "id": "D<N>", "gate": "K<N>", "severity": "blocker | high", "location": "file:line", "description": "...", "suggestion": "..." }]
}

Gates

Gate Verification Severity
K1 Baseline WebApplicationFactory + HttpClient present blocker
K2 Microcks layer matches the opt-in high
K3 TestResult.Success not suppressed when opt-in blocker
K4 Response contract asserted (status code, content type, ProblemDetails shape) high
K5 No real downstream call leaks blocker

K3 note: VerifyAsync is a consumer-side assertion (mock was hit) and is NOT a substitute for TestEndpointAsync result assertion.

Invariants

Why this shape

A provider contract test that does not assert its result gives false confidence. Each gate closes one common failure mode silently introduced under time pressure.

« Replace a component that the SUT depends on with a test-specific equivalent. » — Meszaros, G., xUnit Test Patterns, 2007.

See also