feat: add paid-route error taxonomy for analytics and CLI output (#83)#95
feat: add paid-route error taxonomy for analytics and CLI output (#83)#95Micheal-Blessed wants to merge 11 commits into
Conversation
|
@Micheal-Blessed is attempting to deploy a commit to the emrekayat's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for the PR. I checked this from the emrekayat account. I cannot run a proper merge-ref review or merge it yet because GitHub reports the branch as Once it is mergeable, I will recheck the paid-route error taxonomy, analytics persistence, CLI output, and the API/agent-client test coverage. |
|
@Micheal-Blessed 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! 🚀 |
1ea9a59 to
25d5510
Compare
|
@emrekayat resolved, please review and merge. |
|
Rechecked this one from emrekayat. The implementation passes the functional checks on the PR merge ref:
However, the PR is currently not mergeable against latest
Please rebase/merge latest |
…queries (emrekayat#112) When a paid query price exceeds the configured provider price by more than 10%, mark it as a priceOutlier in the usage event with a safe reason string explaining the discrepancy. Changes: - Add priceOutlier and priceOutlierReason fields to UsageEvent type - Implement computePriceOutlier detection in buildUsageEvent - Add SQLite migration v4 for the new columns - Update serialization layer (usageEventToRow / rowToUsageEvent) - Update INSERT_USAGE query in SQLite repository - Show compact warning icon on outlier rows in the dashboard - Add tests for normal and outlier price scenarios Closes emrekayat#78
…rs (emrekayat#48) * docs: add demo-mode payment evidence documentation and fix build errors - Add comprehensive documentation explaining demo vs real payment evidence - Document demo request flow with 402 challenge and retry semantics - Include minimal curl example using x-query402-demo-paid header - Link documentation from README - Fix TypeScript build errors: - Add PaymentPayload type import and assertion in x402.ts - Replace Node.js Buffer with browser-compatible base64 encoding in web/sponsorship.ts - Exclude test files from web app typecheck to avoid node:test import errors - Fix Windows path separator issue in memory.test.ts All CI checks pass: typecheck, build, test, lint, format, source-artifacts * fix: correct API port to 3001 and /api/usage response structure in demo payment docs --------- Co-authored-by: Emoji-dot <[email protected]>
…ers (emrekayat#86) (emrekayat#97) Co-authored-by: Micheal-Blessed <[email protected]>
…emrekayat#99) * test(api): add x402 payment requirement snapshot for protected routes Add a deterministic snapshot-style test that pins the 402 payment requirement shape (scheme, network, price, payTo, facilitator) and provider-aware price behavior for /x402/search, /x402/news, and /x402/scrape. Failure messages name the route and provider that drifted so SCF reviewers and agents can spot pricing regressions before demos. - Export resolveRoutePrice from lib/x402.ts for direct testing. - Add apps/api/src/routes/protected.test.ts covering HTTP 402 shape, protectedRouteBasePrices, resolveRoutePrice across all providers and fallback cases, plus a provider-catalog price snapshot. - No live Stellar wallet or facilitator credentials required. * style: apply prettier formatting Resolve prettier --check CI failure introduced by the snapshot test commit (apps/api/src/routes/protected.test.ts had multi-line expect().toBe() chains that did not fit printWidth 100, and a couple of pre-existing files in the repo were already out of compliance with the repo prettier config and are now normalized). * style: fix prettier formatting on upstream main files After rebasing onto upstream/main, the base branch files had pre-existing prettier drift that caused the CI format:check to fail on the merge commit. Apply prettier --write to normalize them so the CI gate is green.
…yat#98) * Add API response trace correlation to dashboard evidence view Paid route responses now include a top-level traceId alongside the existing result.traceId, making it easier to correlate dashboard results, CLI output, and API logs. Changes: - Add paidQueryResponseSchema + related Zod schemas to shared package - Add traceId to top level of buildPaidResponse in x402 handler - Add traceId to safe failure (502) response in demo/sponsored route - Update web PaidQueryResponse type with traceId and correct evidence shape (removed stale paymentResponseHeader field) - Redesign dashboard trace-box: show full traceId with copy button, display evidence status instead of broken paymentResponseHeader ref - Add trace-row/trace-copy-btn CSS styles with hover/active states - Update idempotency and demo tests to assert top-level traceId Closes emrekayat#85 * Fix prettier formatting * Fix prettier formatting across the codebase
emrekayat#51) * feat: add provider catalog sorting and payment header redaction tests (emrekayat#35, emrekayat#39) * style: format files with Prettier * chore: revert package-lock.json to main version --------- Co-authored-by: temitopehannahbolarin-beep <[email protected]>
…pt job (emrekayat#70) Verified from emrekayat before merge. Checks run locally on Node 22.16.0: - `git diff --check main...pr-70-merge` - `npm run typecheck --workspace @query402/agent-client` - `npm run build --workspace @query402/agent-client` - full `npm run build` - CI-style demo flow with placeholder env: API start, `/health`, `npm run demo:transcript --workspace @query402/agent-client`, transcript artifact creation, and secret-pattern scan This completes emrekayat#60 with a deterministic DEMO_MODE transcript artifact path.
a84be90 to
0f7f44f
Compare
Resolves #83
Description
When a paid route fails, reviewers and operators need to know whether it was a payment issue, provider issue, validation issue, or internal error. This PR introduces a stable failure code to paid-route responses, maps it to persisted analytics records, prints it in the CLI, and adds tests for validation and provider failure paths.
Taxonomy Mapping
payment_required: Returned when no payment proof was sent (402 status code).payment_invalid: Returned when payment proof is invalid, failed verification, or user rejected (400 status code).provider_timeout: Returned when provider execution times out (504 status code).provider_failed: Returned when the provider returns an error or execution fails (502 status code).invalid_query: Returned when input validation fails, such as missing queries or invalid scrape URLs (400 status code).internal_error: Returned for other unhandled exceptions (500 status code).Acceptance Criteria Met
error_codecolumn via database migration version 3).protected.validation.test.ts).