Skip to content

Add main-passing regression tests#352

Merged
alexmojaki merged 5 commits intomainfrom
codex/main-passing-test-regressions
May 4, 2026
Merged

Add main-passing regression tests#352
alexmojaki merged 5 commits intomainfrom
codex/main-passing-test-regressions

Conversation

@alexmojaki
Copy link
Copy Markdown
Contributor

@alexmojaki alexmojaki commented May 1, 2026

Extracts the tests from #351 that are independent of the unit-registry implementation and already pass when run directly on main.

This PR is test-only. It keeps the behavior-changing assertions in #351, including the unpriced-descendant pricing regression and registry-specific export/update checks.

Included here:

  • existing price-calculation parity regressions
  • extractor accumulation, unknown-extra, contradiction-storage, and public extraction parity regressions
  • provider-array remote payload and update-fetch parsing regressions

Verification:

  • uv run pytest tests/test_price_regressions.py tests/test_extract_usage.py tests/test_lifecycle.py tests/test_update_prices.py
  • make test
  • uv run basedpyright

@alexmojaki alexmojaki mentioned this pull request May 1, 2026
@alexmojaki alexmojaki marked this pull request as draft May 4, 2026 12:21
@alexmojaki alexmojaki marked this pull request as ready for review May 4, 2026 12:22
@alexmojaki alexmojaki requested a review from Copilot May 4, 2026 12:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a set of regression tests (extracted from #351) that are intended to already pass on main, covering pricing math parity, usage extraction/parity invariants, update-price JSON payload parsing, bundled JSON payload shape, and stable top-level public exports.

Changes:

  • Add pricing calculation regression tests for ModelPrice.calc_price (cache, audio overlap, request pricing).
  • Add usage extraction regression tests covering accumulation behavior, ignoring unknown extras, and contradiction handling.
  • Add regressions for update-price fetch parsing (provider-array payload), bundled payload shape, and stable genai_prices top-level exports.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_update_prices.py Adds a regression ensuring UpdatePrices.fetch() correctly parses a provider-array JSON payload.
tests/test_public_exports.py Adds a stability test for genai_prices.__all__ and top-level symbol re-exports.
tests/test_price_regressions.py Adds focused regression coverage for ModelPrice pricing decomposition and request pricing behavior.
tests/test_lifecycle.py Adds a regression asserting bundled JSON payloads remain provider-array shaped.
tests/test_extract_usage.py Expands extraction regressions for public parity, mapping accumulation, unknown extras, and contradiction storage until pricing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_price_regressions.py Outdated
from genai_prices import Usage
from genai_prices.types import ModelPrice

pytestmark = pytest.mark.anyio
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Claude) Addressed in c45e7b6

Comment thread tests/test_price_regressions.py Outdated
).calc_price(Usage(input_tokens=1_000, cache_write_tokens=20, cache_read_tokens=30, output_tokens=100))

assert price == {
'input_price': Decimal('0.0019175'),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these assertions need to make it clear where these numbers come from for this test to be readable and useful

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Claude) Addressed in c45e7b6

Comment thread tests/test_public_exports.py Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Claude) Addressed in c45e7b6

@alexmojaki alexmojaki merged commit 8f08544 into main May 4, 2026
12 checks passed
@alexmojaki alexmojaki deleted the codex/main-passing-test-regressions branch May 4, 2026 12:34
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.

2 participants