[BENCH-766] Model pricing in Postgres: admin-recorded rates with history - #600
Conversation
benchmarks_v2.pricing_rates is an append-only log seeded with the 61 rates verified against providers' public pricing pages. GET /v1/pricing?as_of= serves the rate in force on a day with earlier spans as history, under the same roster and embargo filters as every other data endpoint. GET/POST /v1/admin/pricing (coval org only) reads the whole log and appends recordings stamped with the caller's Clerk id. A missing table or grant is a 503 on every route; the downgrade refuses to drop the table once admin recordings exist.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Linear: BENCH-766
Replaces #594: same change, rebased onto current main and cut from 2,549 to 1,517 lines.
What
benchmarks_v2.pricing_rates(migration20260903_0027): append-only log seeded with the 61 rates verified against providers' public pricing pages. A correction appends and marks the earlier row superseded, a future date schedules a change, null unit + price records "no known public rate". Nothing updates or deletes a row.GET /v1/pricing?as_of=: the rate in force on a day (default today) with earlier spans ashistory. Same roster and embargo filters as every other data endpoint.GET/POST /v1/admin/pricing: coval-org only viarequire_coval_admin; each recording is stamped with the caller's Clerk user id and email.Deploy
production-runnermust equal it), then run the migration:gcloud run jobs execute benchmarks-runner --region=us-east1 --project=coval-benchmarks-prod --args="db,migrate"pricing_rates. Plan and apply it only after the table exists.cooper/bench-766-pricing-postgresin coval-ai/benchmarks-web.Until the grant lands,
GET /v1/pricingand the admin routes return 503. Nothing else is affected.Verification
cd runner && uv run ruff check . && uv run ruff format --check . && uv run mypy --strict src tests && uv run pytest -q --disable-socket --allow-unix-socket --allow-hosts=127.0.0.1,::1— 2006 passed. Live on the local stack with a mock Clerk issuer: 401 no token, 403 other org, 422 bad unit / float price / bad URL / two years out, 201 stamped recording, repeat 200, hidden model priced ahead of launch stays off the public read.