Skip to content

Add provider sla#103

Open
OG-wura wants to merge 12 commits into
emrekayat:mainfrom
OG-wura:Add_provider_SLA
Open

Add provider sla#103
OG-wura wants to merge 12 commits into
emrekayat:mainfrom
OG-wura:Add_provider_SLA

Conversation

@OG-wura

@OG-wura OG-wura commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Close #72

R description:

Summary

Adds lightweight SLA badge fields to provider catalog responses so
reviewers can assess provider safety and reliability at a glance
before paying for a query.

Changes

packages/shared/

  • types.ts — New LatencyBand, ReliabilityBand, PaymentMode
    types; SlaBadges interface with band enums + UI-safe label strings.
    Added slaBadges: SlaBadges to ProviderDefinition.
  • schemas.ts — New latencyBandSchema, reliabilityBandSchema,
    paymentModeSchema, slaBadgesSchema. Extended providerSchema
    to require slaBadges.

apps/api/

  • src/lib/pricing.tsderiveSlaBadges() helper maps existing
    metadata (latencyEstimateMs → fast/standard/slow, sourceType
    live/fallback/demo). All 7 providers now include slaBadges.

apps/web/

  • pages/ControlDeckPage.tsx — Provider cards render 3 badges
    below metrics. Missing badges show "Not verified" fallback.
  • styles.css — Badge styles with color coding per band.

Tests

  • Shared schema tests for all 4 new schemas
  • Pricing badge shape/derivation tests for all 7 providers
  • Catalog response tests verifying badge shape on /api/catalog
    and /api/providers

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@OG-wura 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

@OG-wura 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 functional checks pass:

git diff --check main...pr-103-merge
npm run test --workspace @query402/shared
npm run test --workspace @query402/api -- src/lib/pricing.test.ts src/providers/registry.test.ts src/routes/public.test.ts
npm run test --workspace @query402/agent-client -- src/validate-real.test.ts
npm run typecheck --workspace @query402/api
npm run typecheck --workspace @query402/web
npm run typecheck --workspace @query402/agent-client

Results: shared tests pass (20), API tests pass (38), validate-real tests pass (7), and all typechecks pass.

I cannot merge this exact PR yet because the diff is too broad/noisy for #72:

  • package-lock.json has large unrelated dependency metadata/version churn with no apparent dependency change.
  • The issue is provider SLA badge data, but the PR also changes apps/agent-client/src/validate-real.ts and adds validate-real.test.ts, which looks unrelated to catalog SLA badge rendering.

Please remove the lockfile churn and keep the branch focused on provider SLA/catalog/shared/web changes. Once narrowed, the green checks above look promising.

OG-wura added 2 commits June 30, 2026 22:14
- Revert package-lock.json to main (no dependency changes, only metadata churn)
- Revert apps/agent-client/src/validate-real.ts to main (unrelated to SLA badges)
- Remove apps/agent-client/src/validate-real.test.ts (added by this PR, unrelated)
Resolved conflicts in public.ts (merged import of getSortedProviders
with DemoScenarioManifest) and public.test.ts (kept all PR-added tests).
@OG-wura

OG-wura commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

done

@emrekayat

Copy link
Copy Markdown
Owner

I rechecked from the maintainer account, but npm run typecheck still fails, so this is not merge-ready.

Output:

src/lib/pricing.test.ts(76,20): error TS2345: Argument of type '{ id: string; name: string; category: "search"; priceUsd: number; description: string; latencyEstimateMs: number; qualityScore: number; sourceType: "deterministic-fallback"; enabled: true; }' is not assignable to parameter of type 'ProviderDefinition'.
src/lib/pricing.test.ts(88,20): error TS2345: Argument of type '{ ... }' is not assignable to parameter of type 'ProviderDefinition'.

The test fixtures in pricing.test.ts build provider objects that no longer satisfy the ProviderDefinition type — a required field is missing/mismatched. Please update the fixtures to match ProviderDefinition, then run npm run typecheck && npm test until both are clean and I will recheck and merge.

OG-wura added 7 commits July 5, 2026 09:35
Resolved conflict in apps/api/src/routes/public.test.ts:
- Kept SLA badge tests and demo scenario manifest from PR branch
- Kept paid query fixture tests from main
- Fixed missing closing braces in demo scenario manifest describe block
…port

- Added slaBadges to 3 test fixture objects in pricing.test.ts to satisfy
  updated ProviderDefinition type
- Added buildTestUsageEvent import in public.test.ts that was missing after
  merge
The PR branch replaced the x402 price consistency describe block with
SLA badge tests. Both should be present.
Resolved conflict in pricing.test.ts: kept both describe blocks
(provider SLA badges shape + x402 cross-layer price consistency)
Resolves missing package entries in package-lock.json that caused
npm ci to fail. Lockfile now matches package.json.
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 SLA badge data to catalog responses

2 participants