Skip to content

Conversation

ilevkivskyi
Copy link
Member

Fixes #9554

This is another case where I am surprised id didn't work like this in the first place. Right now the freshness info originates from the dependency itself (like trust me, I am fresh, whatever it means). IMO this doesn't make much sense, instead a dependent should verify whether all dependencies are the same it last seen them. On the surface the idea is simple, but there are couple tricky parts:

  • This requires splitting write_cache() in two phases: first write all data files in an SCC (or at least serialize them), the write all meta files. I didn't find any elegant way to do the split, but it is probably fine, as we already have this untyped meta JSON in few places.
  • I am adding plugin data (used by mypyc separate compilation currently) as part of interface hash. It is not documented whether it should be this way or not, but I would say it should, and this is essentially how mypyc expects it (group name will appear in #include <__native_group_name.h>, so it is a part of the interface). It used to work ~accidentally because we check plugin data in find_cache_meta() that is called before setting interface_hash, not in validate_meta().

cc @msullivan who wrote some of the relevant code.

@ilevkivskyi ilevkivskyi requested a review from JukkaL September 7, 2025 23:02
Copy link
Contributor

github-actions bot commented Sep 7, 2025

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

The new logic makes much more sense.

@JukkaL JukkaL merged commit 9edd29a into python:master Sep 8, 2025
20 checks passed
@ilevkivskyi ilevkivskyi deleted the inverse-fresh branch September 8, 2025 12:21
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.

Type errors caused by dependency changes are missed in incremental mode if the dependency is checked first
2 participants