feat(ads-client): add contract tests to validate types against MARS#7263
Draft
Almaju wants to merge 5 commits intomozilla:mainfrom
Draft
feat(ads-client): add contract tests to validate types against MARS#7263Almaju wants to merge 5 commits intomozilla:mainfrom
Almaju wants to merge 5 commits intomozilla:mainfrom
Conversation
…penAPI spec
Add two layers of contract validation:
1. Unit contract tests (run on every cargo test, zero cost):
- ad_response.rs: spec-accurate JSON fixtures for Image, Spoc, and Tile
deserialization, including tests that document intentional deviations
(click/impression required by us but optional in spec; attributions field
not modelled but silently ignored)
- ad_request.rs: serialization shape tests and taxonomy string validation
2. Integration contract tests against staging (ignored by default):
- Three new #[ignore] tests in integration_test.rs that hit ads.allizom.org
and assert all required spec fields are present and non-empty for each
ad type (Image, Spoc, Tile)
- Run with: cargo test -p ads-client --test integration_test -- --ignored
…napi.json Load schemas from the checked-in openapi.json with recursive $ref resolution instead of hardcoding them. Add skip_serializing_if for optional content field. Add GitHub Actions workflow for integration tests on ads-client changes.
Versions 0.44+ have a CompactFormatter: Default compile error with the current serde_json version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add two layers of contract validation:
Unit contract tests (run on every cargo test, zero cost):
Integration contract tests against staging (ignored by default):
Pull Request checklist
[ci full]to the PR title.