Skip to content

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 24, 2025

Updates salsa to include a fix for salsa-rs/salsa#1014

Testing

I tested that ty now "successfully" and consistently crashes with "too many cycle iterations" instead of an internal salsa panic (mismatching iteration counts).

Since I didn't manage to write a regression test in Salsa, I wrote one in ty instead. I extended mdtest to support tests that expect panics (needed because the example now panics with too many iterations) and added a minified version of steam.py.

This mdtest might also be helpful when debugging why steam.py still panics.

@MichaReiser MichaReiser added bug Something isn't working ty Multi-file analysis & type inference labels Oct 24, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-10-24 16:13:42.515954648 +0000
+++ new-output.txt	2025-10-24 16:13:45.600972650 +0000
@@ -1,4 +1,4 @@
-fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/d38145c/src/function/execute.rs:417:17 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(17843)): execute: too many cycle iterations`
+fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/25b3ef1/src/function/execute.rs:419:17 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(17843)): execute: too many cycle iterations`
 _directives_deprecated_library.py:15:31: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `int`
 _directives_deprecated_library.py:30:26: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `str`
 _directives_deprecated_library.py:36:41: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `Self@__add__`

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser force-pushed the micha/update-salsa-iteration-count branch from 6af4562 to b1a5cdb Compare October 24, 2025 13:08
@MichaReiser MichaReiser marked this pull request as ready for review October 24, 2025 13:08
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice!

The code is an excerpt from <https://github.com/Gobot1234/steam.py> that is minimal enough to
trigger the iteration count mismatch bug in Salsa.

<!-- expect-panic: execute: too many cycle iterations -->
Copy link
Member

Choose a reason for hiding this comment

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

haha, nice feature! This might be useful to track the remaining panics in astral-sh/ty#256

Copy link
Member

Choose a reason for hiding this comment

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

Playing around with this locally, I can make this test quite a lot more minimal while still triggerin the too many cycle iterations panic. But I'm guessing you can no longer repro the Salsa bug on the more minimal versions of this test?

Copy link
Member Author

@MichaReiser MichaReiser Oct 24, 2025

Choose a reason for hiding this comment

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

Yes, removing any line immediately goes from the panic that I'm fixing in salsa to too many cycle iterations.

I suspect that it might be possible to inline some TypeVars (reduce some indirection) and still get the same outcome but I decided that it's already pretty good and not to spend more time (2h!) on minimizing

Copy link
Member

Choose a reason for hiding this comment

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

oh yeah, for sure. This is fine as-is

@MichaReiser MichaReiser merged commit adbf058 into main Oct 24, 2025
42 of 43 checks passed
@MichaReiser MichaReiser deleted the micha/update-salsa-iteration-count branch October 24, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants