E1-A: computeClass + canonical pricing engine - #34
Merged
Conversation
New ./pricing subpath (Invariant #31 single source): ComputeClass ('CACHE_ONLY' | 'LIVE_ALLOWED' | 'LIVE_PRIORITY'), OfferingPricing, PRICING_TABLE classifying all 9 offerings, and networkMultiplier resolution (x402/acp both 1.00x, grandfathered per spec 2.3). Canonicalizes the existing 7 prices as-is -- no repricing. The 2 offerings with no existing canonical price (daily_greenlight_list, scam_alert_feed) carry canonicalUsd: null, flagged for Desktop to source before merge rather than invented. EXPANSION-E1-A-KOV-directive.md Task 1.
Invariant #30: CACHE_ONLY offerings never trigger live compute, incl. a paid retry. O extends ComputeOfferingSlug already makes the 5 CACHE_ONLY slugs uncallable at compile time -- adds the runtime fail-closed assertion as defense-in-depth (same posture as Invariant #27's fail-open guards, inverted), plus tests proving every CACHE_ONLY offering is rejected before any discovery/pipeline side effect runs. EXPANSION-E1-A-KOV-directive.md Task 2.
Invariant #31: adapters never hold a hardcoded price literal now. x402-middleware/prices.ts derives its PRICE_TABLE from @grey/schemas/pricing's resolvePriceUsd(slug, 'x402') instead of holding the literal USD/atomic table; priceAtomicFor/priceUsdFor resolve through the canonical table at call time. acp-adapter gets its own resolver (pricing.ts, channel 'acp') instead of borrowing x402's priceUsdFor -- both channels are 1.00x today, so output is byte-identical, but a future per-channel multiplier (E3 Olas 0.65x) is now a config entry in @grey/schemas, not new code in either adapter. No external surface change: existing prices.test.ts (7 slugs' usd + atomic values) passes unmodified: request/response behavior is byte-identical pre/post. EXPANSION-E1-A-KOV-directive.md Task 3.
3 tasks
1 task
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.
Summary
@grey/schemas/pricing:ComputeClass(CACHE_ONLY/LIVE_ALLOWED/LIVE_PRIORITY), canonical price table classifying all 9 offerings,networkMultiplierresolution (x402/acp both 1.00x, grandfathered).cacheOrLive.tsboundary: CACHE_ONLY offerings can never trigger live compute, including a paid retry. Type-level guarantee (O extends ComputeOfferingSlug) backed by a runtime fail-closed assertion.x402-middleware/prices.tsandacp-adapter/pricing.tsnow resolve price via the canonical table x each channel's own multiplier, instead of holding hardcoded literals.prices.test.tspassing unmodified).Test plan
pnpm build && pnpm test && pnpm typecheck && pnpm lintgreen across all 7 workspace packagespricing.test.ts,cacheOrLive.test.tsInvariant M6 Phase D — run acp-adapter under node --import tsx (FDQ-70) #30 block, acp-adapterpricing.test.tsx402-middleware/prices.test.tspasses unmodified (byte-identical output proof)EXPANSION-E1-A-KOV-directive.md.
🤖 Generated with Claude Code