Skip to content

Conversation

@dcreager
Copy link
Member

This doesn't seem to be flaky in the sense of tests failing non-deterministically, but they are flaky in the sense of unrelated changes causing testing failures from the clauses of a constraint set being rendered in different orders. This flakiness is because we're using Salsa IDs to determine the order in which typevars appear in a constraint set BDD, and those IDs are assigned non-deterministically.

The fix is ham-fisted but effective: sort the constraints in each clause, and the clauses in each set, as part of the rendering process. Constraint sets are only rendered in our test cases, so we don't need to over-optimize this.

@dcreager dcreager added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Sep 30, 2025
@github-actions
Copy link
Contributor

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@sharkdp
Copy link
Contributor

sharkdp commented Oct 1, 2025

Merging this, as I'm seeing it on some other PRs too.

@sharkdp sharkdp merged commit a422716 into main Oct 1, 2025
41 checks passed
@sharkdp sharkdp deleted the dcreager/fix-flaky-constraints branch October 1, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants