Skip to content

Regenerate Pact contract from consumer specs (full coverage + error paths)#25

Draft
BJClark wants to merge 1 commit into
mainfrom
will/pact-contract-coverage
Draft

Regenerate Pact contract from consumer specs (full coverage + error paths)#25
BJClark wants to merge 1 commit into
mainfrom
will/pact-contract-coverage

Conversation

@BJClark

@BJClark BJClark commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

Regenerates the committed Pact contract (spec/pacts/kickplansdk-kickplanapi.json) from passing consumer specs — not hand-edited JSON.

Why it was stuck

.rspec forces spec_helper, which requires VCR; VCR 6.2.0 calls CGI.parse at load time, and CGI.parse was removed in Ruby 4.0 — so every spec (including pact consumer specs) died at load. Fixed by bumping vcr 6.2 → 6.4 (within the existing ~> 6.0 constraint).

Changes

  • Bump VCR to 6.4 (Gemfile.lock).
  • Expand pact consumer specs: send all declared request fields, assert all declared response fields with type matchers, add 4xx error-path interactions, and cover PATCH /api/accounts/:key + the feature resolve routes.
  • Add patch delegation to the HTTP adapter (needed for the new route).
  • Regenerate the pact: 7 → 21 interactions.

Result (mise run spec:coverage)

  • Contract operation coverage: 100%
  • Error-path coverage: 100%
  • Depth: 72.1% → 92.6% (ceiling — two resolve-all endpoints return bare JSON arrays, which the coverage script scores 0% by construction; raising it would falsify the contract vs. the real provider).

Not yet done / QA

Draft: mise run pact:verify was not run against a live provider (needs the full stack + broker). Interactions are spec-generated but not provider-verified. See workspace/thoughts/shared/research/2026-06-14-spec-coverage-followups.md.

🤖 Generated with Claude Code

…aths)

- Fix VCR load failure on Ruby 4 (CGI.parse removed in 4.0) by bumping
  vcr 6.2 -> 6.4, which unblocks the pact consumer + adapter specs.
- Expand pact consumer specs to send all declared request fields, assert
  all declared response fields with type matchers, add 4xx error-path
  interactions, and cover PATCH /api/accounts/:key plus the feature
  resolve routes.
- Add PATCH delegation to the HTTP adapter (required for the new route).
- Regenerate the committed pact from the passing specs (7 -> 21 interactions).

Brings contract operation coverage to 100% and error-path coverage to
100%, depth 72.1% -> 92.6% per `mise run spec:coverage`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant