Skip to content

Conversation

@MichaReiser
Copy link
Member

Summary

This PR fixes an issue with cache invalidation where changing a nested pyproject.toml didn't invalidate the cache for those files.

The root cause of the issue was that the Resolver returned the wrong configuration when querying the settings by the directory because it only registers a route for directory/{files} but a query by directory misses the trailing /.

Fixes #12721
Fixes #12264

Test Plan

Played throught the example in #12721

@MichaReiser MichaReiser requested a review from ibraheemdev August 7, 2024 06:33
@MichaReiser MichaReiser added the cli Related to the command-line interface label Aug 7, 2024
// Insert a mapping that matches the directory itself (without a trailing slash).
// Inserting should always succeed because conflicts are resolved above and the above insertion guarantees
// that the path is correctly escaped.
self.router.insert(path, self.settings.len() - 1).unwrap();
Copy link
Member Author

Choose a reason for hiding this comment

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

@ibraheemdev is there some wild card expression that we could use that I'm not aware of instead of inserting two routes (e.g. {path}(/{{#filepath}})?)

Copy link
Member

Choose a reason for hiding this comment

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

No, this is the recommended way of doing it.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@fellhorn
Copy link

fellhorn commented Aug 7, 2024

Thank you, Micha! I can confirm it fixes both the test script from #12721 as well as our own original case, where we discovered the bug.

You folks are so fast! The issue is not even 12h old and you already have a fix :)

@MichaReiser MichaReiser merged commit a631d60 into main Aug 7, 2024
@MichaReiser MichaReiser deleted the fix-12721 branch August 7, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the command-line interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changes in sub pyproject.toml do not cause a cache bust Mismatched diagnostics with and without cache with hierarchical configs

4 participants