Skip to content

[ty] Preserve generic alias identity during cycle recovery - #26166

Merged
charliermarsh merged 6 commits into
mainfrom
charlie/fix-steam-instability
Jun 22, 2026
Merged

charliermarsh merged 6 commits into
mainfrom
charlie/fix-steam-instability

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Summary

After the tainted iterations, cycle recovery normally unions the current and previous query results to force monotonic convergence. When a cyclic generic base alternated between specializations of the same class, such as Outer[int] and Outer[Unknown], that produced a union of generic alias class objects. The union is not a valid class base, so downstream inheritance lost the shared class identity and inherited attributes became Unknown.

This keeps the generic alias origin intact and merges the approximations within its specialization. Equal arguments are retained, while a plain Unknown widens the corresponding argument. Mismatched known arguments continue through the existing union path, and UnknownGeneric remains distinct so we preserve its generic context.

The regression coverage drives a deterministic Salsa cycle through the production recovery path and checks the merge policy for known invariant arguments and UnknownGeneric. An end-to-end mdtest also preserves the cross-module cyclic generic base and verifies that Member.rank remains inherited as int.

Closes astral-sh/ty#3812.

@astral-sh-bot astral-sh-bot Bot added the ty The ty type checker label Jun 19, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 94.37%. The percentage of expected errors that received a diagnostic held steady at 89.00%. The number of fully passing files held steady at 94/134.

@charliermarsh
charliermarsh marked this pull request as ready for review June 19, 2026 21:40
@charliermarsh
charliermarsh requested a review from a team as a code owner June 19, 2026 21:40
@astral-sh-bot
astral-sh-bot Bot requested a review from carljm June 19, 2026 21:40
@charliermarsh charliermarsh added the bug An issue describing something that isn't working, or a PR that fixes a bug label Jun 19, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-type-form 0 5 0
Total 0 5 0

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Raw diff:

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
- pytest_robotframework/_internal/pytest/robot_file_support.py:40:30 error[invalid-type-form] Variable of type `type[Keyword]` is not allowed in a type expression
- pytest_robotframework/_internal/pytest/robot_file_support.py:42:33 error[invalid-type-form] Variable of type `type[Keyword]` is not allowed in a type expression
- pytest_robotframework/_internal/pytest/robot_file_support.py:127:37 error[invalid-type-form] Variable of type `type[Keyword]` is not allowed in a parameter annotation
- pytest_robotframework/_internal/robot/utils.py:21:32 error[invalid-type-form] Variable of type `type[Keyword]` is not allowed in a type expression
- pytest_robotframework/_internal/robot/utils.py:25:34 error[invalid-type-form] Variable of type `type[Keyword]` is not allowed in a type expression

Full report with detailed diff (timing results)

@charliermarsh
charliermarsh force-pushed the charlie/fix-steam-instability branch from 210be74 to 5b72c80 Compare June 22, 2026 14:56

@carljm carljm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, thank you.

current.cycle_normalized(db, *previous, cycle)
}

#[salsa::tracked(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think in addition to this unit test, it would be useful to preserve the end-to-end case as an mdtest regression test, including validating that the merged alias remains a valid class base and that Member.rank is inherited.

@charliermarsh
charliermarsh enabled auto-merge (squash) June 22, 2026 17:22
@charliermarsh
charliermarsh merged commit 95b2326 into main Jun 22, 2026
60 checks passed
@charliermarsh
charliermarsh deleted the charlie/fix-steam-instability branch June 22, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

steam.py instability

2 participants