Skip to content

Build coverage's C tracer from source in the Python 3.15 coverage shards - #6085

Merged
Koudai Aono (koxudaxi) merged 9 commits into
fix2-8from
fix2-9
Nov 3, 2026
Merged

Koudai Aono (koxudaxi) merged 9 commits into
fix2-8from
fix2-9

Conversation

@koxudaxi

@koxudaxi Koudai Aono (koxudaxi) commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Updated the automated testing setup. This change does not affect app features or behavior.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The py315-parallel-!nocov tox environment now sets UV_NO_BINARY_PACKAGE to coverage.

Changes: Tox environment configuration

Layer / File(s) Summary
Coverage installation setting
tox.ini
The py315-parallel-!nocov environment sets UV_NO_BINARY_PACKAGE = coverage.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Merge Risk: Minimal · previous review ca4da

The configuration requests a source build of coverage for the targeted Python 3.15 environments. No actionable merge-blocking risk is identified; merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and specifically describes the main change: building coverage's C tracer from source in the Python 3.15 coverage shards.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 364a80197c96fae2473c10386ce384d9b74c2fe8 and ca4dafba10427221fa6633de797f73419de45704.

Files selected for processing: 1
  • tox.ini

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

@koxudaxi
Koudai Aono (koxudaxi) marked this pull request as ready for review November 3, 2026 09:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T09:26:32.445948Z ca4dafb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 52.2%

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 52 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 52 improved benchmarks
⏩ 98 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_perf_simple_msgspec_unset_field_rendering 594.7 ms 323.8 ms +83.68%
⚡ test_perf_client_calls[sync] 44.5 ms 25.2 ms +76.94%
⚡ test_perf_large_models_pydantic_v2_builtin_double_quotes 1,687.5 ms 963.8 ms +75.08%
⚡ test_perf_client_calls[async] 49.2 ms 28.4 ms +73.11%
⚡ test_perf_scalar_root_collapsed_builtin 232.2 ms 138.2 ms +68.04%
⚡ test_perf_ordinary_array_constraint_generation 2.3 s 1.4 s +65.4%
⚡ test_perf_inherited_required_fields[required-base-first] 753.6 ms 460.1 ms +63.79%
⚡ test_perf_large_models_typed_dict[legacy-requiredness] 1,362.1 ms 835.5 ms +63.03%
⚡ test_perf_large_models_dataclass_builtin 1,586.1 ms 973.2 ms +62.97%
⚡ test_perf_large_models_pydantic_v2_noformat 1,502.3 ms 924.2 ms +62.55%
⚡ test_perf_load_pyproject_config[mapping-None] 369.6 µs 227.7 µs +62.34%
⚡ test_perf_large_models_msgspec 2.3 s 1.4 s +62.01%
⚡ test_perf_load_pyproject_config[config-None] 364 µs 224.8 µs +61.95%
⚡ test_perf_load_pyproject_config[mapping-multiple] 377.8 µs 235.1 µs +60.69%
⚡ test_perf_local_reference_file_resolution 149.8 ms 93.5 ms +60.23%
⚡ test_perf_inherited_required_fields[required-derived-first] 817.4 ms 510.8 ms +60.01%
⚡ test_perf_load_pyproject_config[config-multiple] 378.5 µs 237.5 µs +59.36%
⚡ test_perf_large_models_typed_dict[total-false-requiredness] 1,322.7 ms 830.4 ms +59.29%
⚡ test_perf_large_models_single_module_stdout 1.7 s 1.1 s +59.27%
⚡ test_perf_false_reference_validation 306.7 ms 193.2 ms +58.73%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix2-9 (1cad19c) with fix2-8 (d2a3304)

Open in CodSpeed

Footnotes

  1. 98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

`--set-default-enum-member` writes each enum member of a default by the expression its type names the enum by then
(`annotations.Kind.book`). Importing the models of a hidden submodule from the submodule renamed the type to `Kind`
and dropped the module import, while the defaults kept naming `annotations`, the `__future__` feature, so the class
failed to define. The defaults now follow the new expression (`Kind.book`), through `name_enum_member`, as the other
import renames of the module do.

The new import of such a model kept off the names the module's resolver held, but not the names that the module's
other imports bind without it or that the shared imports bind: a model `Counter` beside `collections.Counter`, which
`x-python-type` or `--additional-imports` writes, took the name, and `Counter[str]` named the model. The import takes
another name now (`from .annotations import Counter as Counter_1`). A class of a package `__init__.py` hides its
submodule also where the `__init__.py` loads the submodule only for the class of an enum member literal.

The behaviour diff accepts the import paths that the fix removes from the importing modules of the new fixtures
(`from api import annotations`, the `__future__` feature, and `from pkg.api import Warn`, the package's class), whose
models failed to import or decode on 0.88.0 with every backend that resolves annotations late (#6009).
Under --use-enum-values-in-discriminator a variant spells the tag it inherits
by the Enum that types the tag property of its bases, as it spells a tag its
own Enum field holds: `Literal[FunctionType.function]`. The lookup of that
Enum read only the direct bases, so `NamedCall`, two levels below the
`FunctionBase` whose Enum types `type`, wrote `Literal['function']` while
`FunctionCall` wrote the member. It now reads the direct bases first and then
the ancestors above them, so both write the member, through the one lookup the
appended and the retyped tag fields and the check of the union share.

The same lookup ends a crash under --use-enum-values-in-discriminator
--reuse-model on a float Enum (`discriminator_enum_float_values.yaml`, a float
literal was built for a reused variant) and drops the internal marker that a
reused inline variant was tagged with (`discriminator_inline_variants.yaml`).

The #5338 test records the payload verdicts of each union: a plain Enum member
is no JSON string, so under the option the unions take the member from Python,
as they do for an own Enum field, and without it the JSON value.
A field that takes its alias after it is built keeps `alias=` below a generated base class, as that dataclass gives
the class its signature. L3 `delete_duplicate_models` drops a root model from the bases of the models that inherit
it, so a class whose only base was a root model was left without a base class and kept a non-identifier `alias=`,
which Pydantic before 2.4 rejects: `ValueError: 'x-y' is not a valid parameter name`.

`GenerationStore.set_base_classes` now writes the alias form again, through `DataModelFieldBase.alias_form`, for the
fields of a model it leaves without a base class, after the model is changed and the bases are final for it. The
declaration of `delete_duplicate_models` lists the aliases it writes that way.
…een the strict typing runs of a test process
@koxudaxi
Koudai Aono (koxudaxi) merged commit dc29889 into main Nov 3, 2026
166 checks passed
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: Breaking changes detected

Reasoning: I read the whole analysis context, diff and deleted-lines file. The read-boundary marker request was denied as expected. The only change to existing generated output is in the discriminator tag logic. _get_enum_from_base now searches every ancestor in method resolution order instead of only the direct bases. Under --use-enum-values-in-discriminator, the expected output for NamedCall changes from a string literal to a Literal of the FunctionType.function Enum member. The new payload file shows that the union now rejects JSON the schema accepts and accepts the Enum member from Python, so I flagged this as a code generation change for users of that option. One caveat: the old expected string literal value function may never have shipped. The behaviour diff shows the last release still wrote schema-name tags such as NamedCall by default, so this item may overlap the release note of the earlier tag fix. I found nothing else breaking. The default-option cells added in this PR are allowlist entries for crash fixes in how modules named annotations or named like a package class are imported. They replace imports that resolved to the future feature or a package class. Those import fixes also cover Enum defaults following the renamed import, the Counter_1 rename next to a shared import, and Enum member literal classes. The union-constraint decision now reads written_constraints, the constraints a field actually writes. It is limited to --field-constraints and to a constraint check that may be unreleased, and it leaves msgspec output unchanged. The alias change applies only to pydantic_v2.dataclass with --target-pydantic-version 2 when a model loses its only base. It writes serialization_alias plus validation_alias, which is a fix that keeps runtime behaviour equivalent. The new written_constraints property is an addition. Removed items are private helpers or type-hint, docs, test and tooling changes. No CLI options, Python version support or error handling changed.

Content for Release Notes

Code Generation Changes

  • Inherited discriminator tags use the Enum member under --use-enum-values-in-discriminator - Some variants of a discriminated union inherit their tag field from an ancestor two or more levels up, for example NamedCall below FunctionCall below a base whose type field is typed by the Enum FunctionType. The generator used to check only a variant's direct bases for the Enum. It now looks through all ancestors and takes the Enum from the nearest one that declares the field. Such a variant now gets type: Literal[FunctionType.function] instead of a plain string literal like Literal['function'], which matches how direct subclasses were already written. With a plain (non-str) Enum, the variant now accepts the Enum member passed from Python but rejects the raw JSON string "function". Code that builds or validates these variants with the raw string may need updating (Build coverage's C tracer from source in the Python 3.15 coverage shards #6085)

This analysis was produced by the release draft workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant