Skip to content

docs: initialize task tracking checklist for issue #76#109

Open
OTimileyin wants to merge 1 commit into
emrekayat:mainfrom
OTimileyin:feat/pricing-consistency-check
Open

docs: initialize task tracking checklist for issue #76#109
OTimileyin wants to merge 1 commit into
emrekayat:mainfrom
OTimileyin:feat/pricing-consistency-check

Conversation

@OTimileyin

@OTimileyin OTimileyin commented Jun 30, 2026

Copy link
Copy Markdown

Closes #76

This PR introduces a deterministic test matrix that guards against pricing drift between the provider catalog and x402 middleware payment parameters.

  • Per-provider round-trip parity — for all 7 catalog providers, asserts that formatUsdPrice(provider.priceUsd) survives the middleware's price formatter without integer precision loss. Comparisons use integer micro-USD units (Math.round(value * 1_000_000)) to eliminate IEEE 754 float rounding risk entirely.
  • Cross-layer base price parity — for each x402 route mode (search, news, scrape), asserts that protectedRouteBasePrices["GET /x402/{mode}"] exactly matches the minimum enabled provider price in that category. Any catalog edit that isn't mirrored in the route base price map will fail loudly, naming the offending route key and deviating provider IDs.
  • Unknown provider fallback coverage — two tests named to document fallback expectations: one asserts getProviderById returns undefined for unrecognised IDs (including empty string and partial matches); the other asserts every route mode has a well-formed fallback price string so agents with unknown providers always receive a valid payment requirement.
  • Category mismatch guard — asserts no provider ID exists in more than one category, validating the structural invariant that the middleware's category !== mode guard depends on.
  • Drift-detection validator — uses a locally cloned, mutated provider list (simulating a search.basic price raise with no route base update) to confirm the consistency check is sensitive enough to surface the offending provider ID and detect the drift condition.

Zero reliance on live facilitator nodes or wallet credentials. All 137 tests pass including the 14 new consistency checks and all 123 pre-existing workspace tests.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@OTimileyin is attempting to deploy a commit to the emrekayat's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@OTimileyin 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

@emrekayat

Copy link
Copy Markdown
Owner

Thanks for the PR. I rechecked the merge ref from the maintainer account. The focused checks pass:

git diff --check main...pr-109-merge
npm run test --workspace @query402/api -- src/lib/pricing.test.ts
npm run typecheck --workspace @query402/api

Result: pricing.test.ts passes (22 tests) and API typecheck passes.

I cannot merge this exact PR yet because it commits a root TASKS.md with unfinished checklist items (- [ ] Phase ...). The issue asks for the pricing consistency check/test, not a repo-level task tracker. Please remove TASKS.md from the branch and keep the PR focused on the API pricing test. After that this should be ready if the same checks stay green.

@OTimileyin

OTimileyin commented Jul 1, 2026

Copy link
Copy Markdown
Author

Thanks so much for the feedback. I have removed TASKS.md from the branch.

@OTimileyin OTimileyin force-pushed the feat/pricing-consistency-check branch from 12a7f53 to 4d164f2 Compare July 1, 2026 07:56
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.

Add provider price consistency check across API and x402 middleware

2 participants