https://entire.com/gh/phaseoteam/-/trails/153/changes/Phaseo/153
What changed
tools/provider-simulator/src/catalogue.tsnow reads the catalogue from the database:v2_model_provider_routes,v2_route_capabilities, and activev2_pricing_skuswith their billablev2_pricing_sku_meters. It uses SELECTs only, reads paged (1,000 rows per request), and loads once per process throughloadCatalogue(). The sync accessors (loadCatalogueRoutes,loadCataloguePriceCard,catalogueRouteRows,catalogueSkus) serve the cached rows.- Credentials:
SUPABASE_URL/NEXT_PUBLIC_SUPABASE_URLplusSUPABASE_SERVICE_ROLE_KEY, read from the environment,apps/api/.dev.vars,apps/api/.env.localorapps/web/.env.local.- Without a service-role key the simulator falls back to the public anon key and prints a warning. Row-level security then hides internal and stealth routes and SKUs not in effect now.
- With no credentials at all, every
*.sim.tsrun andsimulate:providers:expectationsfail with a message saying what to set.
- The rule shaping in
pipeline/pricing/loader.tsmoved unchanged intopipeline/pricing/sku-card.ts(buildPriceCardFromSkuRows).loadPriceCardcalls it, and so does the simulator, so both shape price cards with the same code. pricing/catalogue-cards.tsbuilds the request-context-RPC-shaped sweep cards from the same rows. Rule ids are now<sku_code>@v<version>#<meter_key>, prefixed with the route id when a card spans several routes. Each card inexpectations/pricing/*.jsonlists itsroutesandskusinstead of a file path.e2e/context.ts,scripts/build-expectations.ts, the sim entry points, the README, the audits and the e2enontext.jsonexpectation no longer point at the deleted JSON.- The pricing sweep clock defaults to the start of the run (
SIM_PRICING_NOWstill overrides it). - The "unsupported card field" sanity check is gone: SKU rows have no card-level fields that the engine ignores.
- Expectations (
expectations/pricing/*) and results (results/**) are regenerated from the database.expectations/providers/*regenerated with no diff.
Why
#3334 removed the committed catalogue JSON, so the simulator could no longer load routes or prices. The database is the only source of catalogue rows now, and no catalogue snapshot is committed here. The expectation files are test expectations, keyed by database identity.
How
- Async loading: each sim file awaits
loadCatalogue()before it touches the catalogue, before the e2e network guard goes in.- Supabase gets the real
fetch, captured at import, so the simulator's fetch capture never sees the catalogue reads.
- Supabase gets the real
- Why a separate module:
sku-card.tshas no loader or runtime imports. The e2e sim mocks@pipeline/pricing/loaderwith a factory that imports the harness, which imports the catalogue. Importing the loader from the catalogue deadlocked the e2e sim at import time, so the helper lives in its own module. - CI:
simulate:providers:testkeeps serving its small route and price-card fixture throughvi.mock, so it needs no credentials.
Before and after
| Before (JSON, committed 10-19 run) | After (database, this run) | |
|---|---|---|
| Catalogue source | packages/data/catalog (deleted in #3334) | v2 tables, read once per run |
| Price identity in expectations | file path + #<index> | route ids + <sku_code>@v<version>#<meter_key> |
| Active routes priced by the sweep | 1,571 | 1,345 |
| Active routes with a rule in effect | 1,532 (97.5%) | 1,327 (98.7%) |
| Rules exercised | 6,130 / 6,381 | 6,290 / 6,508 |
| Gate: mismatches / allowed / failing | 9,033 / 9,033 / 0 | 8,548 / 7,887 / 661 |
| Runs without credentials | n/a | unit tests yes; sims fail with a clear message |
Verification
git grep packages/data/catalog -- apps/api/tools/provider-simulator: no matches.pnpm --filter @phaseo/gateway-api typecheckpasses. The simulator files also typecheck with a temporary tsconfig that addstools/provider-simulator: 0 errors.pnpm --filter @phaseo/gateway-api simulate:providers:test(no credentials): 5 files, 52 tests passed.vitest run src/pipeline/pricing: 26 files, 229 tests passed. This coversloader.test.tsafter the move.simulate:providers:expectations: 80 provider files, unchanged.- I ran the full
simulate:providersonce.- It read the catalogue with the anon key, because no service-role key was available locally: 4,339 routes (1,317 active), 2,472 active SKUs. Every live SKU on an active route is public, so the sweep sees all live prices. Future-dated and expired SKUs and internal routes are not visible.
- Pricing and e2e passed (75 s). The executor run took 9.6 min, and the gate fails: 661 mismatches (156 groups) are not on the allow-list.
- Not all of these come from the catalogue. The committed results date from 10-19 (#2968), and the gateway has changed since.
Gate failures by cause (156 groups)
| Groups | Cause | Kind of change |
|---|---|---|
| 2 (136 mismatches) | Chat Completions providers now reject input_image file parts and document_url with unsupported_parameter (#2993, 10-19) | gateway change |
| 14 | e2e error bodies: error is now an object, and 400s keep their status (errors.*.400, failover.all-*) | gateway change |
| 4 | input_audio / file_id parts no longer reach Anthropic, Azure, AI Studio and Mistral | gateway change (likely) |
| 44 | e2e cases pin routes that are no longer live: Vertex google/gemini-2.5-flash (retired 10-22) and OpenAI openai/gpt-image-1 (ended 10-23); the context lookup fails with a 500 | catalogue change |
| 56 | Amazon Bedrock's sampled OpenAI route moved from openai/gpt-6-astra to openai/gpt-5.4, and the simulated response loses text, tool calls and usage on every surface | catalogue change exposing an executor or simulator gap |
| 6 | Anthropic US and Azure now sample anthropic/claude-opus-5.5, which returns 400 for tool_choice and disabled reasoning | catalogue change |
| 28 | Haiku 5.5 and the Venice cards now condition on long_context_input_tokens. The engine derives that value from usage (engine.ts:500); the oracle in pricing/calculator.ts doesn't, so it prices $0 | simulator oracle gap |
| 2 | openai-eu batch: the cached-write meter is missing on the documented case | catalogue change |
Other notable catalogue changes since 09-28
- Active text routes went to zero for
modelscope(38 before),ai21andsakana, and down to 2 forparasail(35 before). Their pricing expectation files were removed or shrunk. - New pricing expectations exist for
doubleword,empiriolabs,inference-net,reflection,typesafeandwafer-zdr. - Sora 2 has two overlapping active SKUs for 1280x720: $0.10/s (
offer-e48eb6ccb12e03192f71, from 2025-09-30) and $0.05/s (offer-1f77c24dd43e9d79056f, from 2026-03-12). The e2e reservation expectation still says $0.10 and passed in this run. The overlap is worth a data check.
Follow-ups, not in this PR
- Point the e2e cases at live routes.
- Teach the pricing oracle
long_context_input_tokens. - Re-run with a service-role key, then triage the failing groups into fixes or allow-list entries.
🤖 Generated with Claude Code
Activity
12IMPORTANT
Review skipped
Too many files!
This PR contains 110 files, which is 10 over the limit of 100.
To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.
Upgrade to a paid plan to raise the limit.
This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.
Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6b4e3410-3623-4725-a0e9-067e3c4d28e2
Commits
Reviewing files that changed from the base of the PR and between 401dbdf6b9b4cacad6be56f9adcb305a9f45081d and 77d272593467a77e912e5e68975e79e9154334a4.
Files selected for processing: 110
apps/api/src/pipeline/pricing/loader.tsapps/api/src/pipeline/pricing/sku-card.tsapps/api/tools/provider-simulator/AUDIT-traced-nontext.mdapps/api/tools/provider-simulator/AUDIT.mdapps/api/tools/provider-simulator/README.mdapps/api/tools/provider-simulator/debug.sim.tsapps/api/tools/provider-simulator/e2e/context.tsapps/api/tools/provider-simulator/e2e/e2e.sim.tsapps/api/tools/provider-simulator/e2e/state.tsapps/api/tools/provider-simulator/expectations/e2e/nontext.jsonapps/api/tools/provider-simulator/expectations/pricing/ai21.jsonapps/api/tools/provider-simulator/expectations/pricing/aion-labs.jsonapps/api/tools/provider-simulator/expectations/pricing/akashml.jsonapps/api/tools/provider-simulator/expectations/pricing/alibaba-cloud.jsonapps/api/tools/provider-simulator/expectations/pricing/amazon-bedrock.jsonapps/api/tools/provider-simulator/expectations/pricing/ambient.jsonapps/api/tools/provider-simulator/expectations/pricing/anthropic-aws-us.jsonapps/api/tools/provider-simulator/expectations/pricing/anthropic-aws.jsonapps/api/tools/provider-simulator/expectations/pricing/anthropic-us.jsonapps/api/tools/provider-simulator/expectations/pricing/anthropic.jsonapps/api/tools/provider-simulator/expectations/pricing/arcee-ai.jsonapps/api/tools/provider-simulator/expectations/pricing/atlascloud.jsonapps/api/tools/provider-simulator/expectations/pricing/avian.jsonapps/api/tools/provider-simulator/expectations/pricing/azure.jsonapps/api/tools/provider-simulator/expectations/pricing/baidu.jsonapps/api/tools/provider-simulator/expectations/pricing/baseten.jsonapps/api/tools/provider-simulator/expectations/pricing/black-forest-labs.jsonapps/api/tools/provider-simulator/expectations/pricing/byteplus.jsonapps/api/tools/provider-simulator/expectations/pricing/canopy-wave.jsonapps/api/tools/provider-simulator/expectations/pricing/cerebras.jsonapps/api/tools/provider-simulator/expectations/pricing/cloudflare.jsonapps/api/tools/provider-simulator/expectations/pricing/cohere.jsonapps/api/tools/provider-simulator/expectations/pricing/deepinfra.jsonapps/api/tools/provider-simulator/expectations/pricing/deepseek.jsonapps/api/tools/provider-simulator/expectations/pricing/doubleword.jsonapps/api/tools/provider-simulator/expectations/pricing/elevenlabs.jsonapps/api/tools/provider-simulator/expectations/pricing/empiriolabs.jsonapps/api/tools/provider-simulator/expectations/pricing/fireworks.jsonapps/api/tools/provider-simulator/expectations/pricing/friendli.jsonapps/api/tools/provider-simulator/expectations/pricing/gmicloud.jsonapps/api/tools/provider-simulator/expectations/pricing/google-ai-studio.jsonapps/api/tools/provider-simulator/expectations/pricing/google-vertex-eu.jsonapps/api/tools/provider-simulator/expectations/pricing/google-vertex.jsonapps/api/tools/provider-simulator/expectations/pricing/groq.jsonapps/api/tools/provider-simulator/expectations/pricing/inception.jsonapps/api/tools/provider-simulator/expectations/pricing/inference-net.jsonapps/api/tools/provider-simulator/expectations/pricing/inflection.jsonapps/api/tools/provider-simulator/expectations/pricing/io-net.jsonapps/api/tools/provider-simulator/expectations/pricing/ionrouter.jsonapps/api/tools/provider-simulator/expectations/pricing/longcat.jsonapps/api/tools/provider-simulator/expectations/pricing/ltx.jsonapps/api/tools/provider-simulator/expectations/pricing/meta.jsonapps/api/tools/provider-simulator/expectations/pricing/minimax-lightning.jsonapps/api/tools/provider-simulator/expectations/pricing/minimax.jsonapps/api/tools/provider-simulator/expectations/pricing/mistral-eu.jsonapps/api/tools/provider-simulator/expectations/pricing/mistral.jsonapps/api/tools/provider-simulator/expectations/pricing/modelscope.jsonapps/api/tools/provider-simulator/expectations/pricing/moonshotai.jsonapps/api/tools/provider-simulator/expectations/pricing/morph.jsonapps/api/tools/provider-simulator/expectations/pricing/morpheus.jsonapps/api/tools/provider-simulator/expectations/pricing/nebius-token-factory.jsonapps/api/tools/provider-simulator/expectations/pricing/novita.jsonapps/api/tools/provider-simulator/expectations/pricing/openai-eu.jsonapps/api/tools/provider-simulator/expectations/pricing/openai.jsonapps/api/tools/provider-simulator/expectations/pricing/ovhcloud.jsonapps/api/tools/provider-simulator/expectations/pricing/parasail.jsonapps/api/tools/provider-simulator/expectations/pricing/perplexity.jsonapps/api/tools/provider-simulator/expectations/pricing/poolside.jsonapps/api/tools/provider-simulator/expectations/pricing/reflection.jsonapps/api/tools/provider-simulator/expectations/pricing/reka.jsonapps/api/tools/provider-simulator/expectations/pricing/relace.jsonapps/api/tools/provider-simulator/expectations/pricing/sail-research.jsonapps/api/tools/provider-simulator/expectations/pricing/sakana.jsonapps/api/tools/provider-simulator/expectations/pricing/sambanova.jsonapps/api/tools/provider-simulator/expectations/pricing/siliconflow.jsonapps/api/tools/provider-simulator/expectations/pricing/spacex-ai.jsonapps/api/tools/provider-simulator/expectations/pricing/stepfun.jsonapps/api/tools/provider-simulator/expectations/pricing/streamlake.jsonapps/api/tools/provider-simulator/expectations/pricing/tensorix.jsonapps/api/tools/provider-simulator/expectations/pricing/together.jsonapps/api/tools/provider-simulator/expectations/pricing/typesafe.jsonapps/api/tools/provider-simulator/expectations/pricing/upstage.jsonapps/api/tools/provider-simulator/expectations/pricing/venice.jsonapps/api/tools/provider-simulator/expectations/pricing/voyage.jsonapps/api/tools/provider-simulator/expectations/pricing/wafer-zdr.jsonapps/api/tools/provider-simulator/expectations/pricing/wafer.jsonapps/api/tools/provider-simulator/expectations/pricing/weights-and-biases.jsonapps/api/tools/provider-simulator/expectations/pricing/xiaomi.jsonapps/api/tools/provider-simulator/expectations/pricing/z-ai.jsonapps/api/tools/provider-simulator/pricing/cases.tsapps/api/tools/provider-simulator/pricing/catalogue-cards.tsapps/api/tools/provider-simulator/pricing/pricing.sim.tsapps/api/tools/provider-simulator/pricing/sanity.tsapps/api/tools/provider-simulator/pricing/summary.tsapps/api/tools/provider-simulator/results/COVERAGE.mdapps/api/tools/provider-simulator/results/EXPECTATIONS.mdapps/api/tools/provider-simulator/results/MATRIX.mdapps/api/tools/provider-simulator/results/e2e/SUMMARY.mdapps/api/tools/provider-simulator/results/e2e/coverage.jsonapps/api/tools/provider-simulator/results/e2e/mismatches.jsonapps/api/tools/provider-simulator/results/pricing/SUMMARY.mdapps/api/tools/provider-simulator/results/pricing/coverage.jsonapps/api/tools/provider-simulator/results/pricing/mismatches.jsonapps/api/tools/provider-simulator/results/summary.jsonapps/api/tools/provider-simulator/scripts/build-expectations.tsapps/api/tools/provider-simulator/scripts/refresh-specs.tsapps/api/tools/provider-simulator/simulate.sim.tsapps/api/tools/provider-simulator/src/catalogue.tsapps/api/tools/provider-simulator/src/providers.tsapps/api/tools/provider-simulator/src/report.tsYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
- (https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- Mastodon
Comment @coderabbitai help to get the list of available commands.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
|---|---|---|---|
| 📝 Code Review | ✅ Completed 2026-10-29T15:11:10.628074Z | e56a3e4 | PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Dependency Review
✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned Files
None💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e56a3e4bb0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment