Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cache invalidation for nested pyproject.toml files #12727

Merged
merged 1 commit into from
Aug 7, 2024
Merged

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 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.

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
20 checks passed
@MichaReiser MichaReiser deleted the fix-12721 branch August 7, 2024 19:53
This pull request was closed.
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
3 participants