Skip to content

feat: implement Pact verification for notifications and update CI wor… - #787

Open
Hunterly01 wants to merge 1 commit into
RevoraOrg:masterfrom
Hunterly01:tests/pact-notifications
Open

feat: implement Pact verification for notifications and update CI wor…#787
Hunterly01 wants to merge 1 commit into
RevoraOrg:masterfrom
Hunterly01:tests/pact-notifications

Conversation

@Hunterly01

Copy link
Copy Markdown

Closes #724

Summary

This PR adds a consumer-provider contract for the /notifications API and verifies the live backend handler against it, preventing frontend regressions caused by silent API shape drift.

What changed

  • Added/updated the notifications consumer Pact contract in:
    • notifications.consumer.test.ts
  • Added provider verification coverage against the live handler in:
    • notifications.pact.test.ts
  • Kept the route contract aligned with the live notifications handler in:
    • notifications.ts
  • Added the verification script in:
    • package.json
  • Wired CI to publish and verify the notifications contract using broker secrets in:
    • ci.yml
  • Documented the security and drift-detection behavior in:
    • notifications-pact-contract.md

Why

Frontend regressions repeatedly land when API payloads change without consumer approval. This contract makes response shape changes visible and fails CI when a field is removed or a contract is unexpectedly altered.

Security notes

  • Broker credentials are expected via GitHub Actions secrets:
    • PACT_BROKER_URL
    • PACT_BROKER_TOKEN
  • Local verification remains available when those secrets are not configured.
  • Unauthorized and malformed notification requests remain explicitly covered in the contract.

Validation

I validated the notifications-specific verification path with:

  • npx jest --runInBand notifications.test.ts notifications.consumer.test.ts src/routes/notifications.pact.test.ts

Result:

  • 3 test suites passed
  • 30 tests passed
  • 0 failed

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Hunterly01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Hunterly01

Copy link
Copy Markdown
Author

Please merge the issue no error

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.

Pact contract tests: consumer-provider verification for the notifications API

1 participant