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

feat: factor engines into global cache key #8173

Conversation

chris-olszewski
Copy link
Member

Description

Changing the engines field in the root package.json can affect the execution of tasks so it should affect the global cache.

This PR adds the engines struct to the global cache key.

Testing Instructions

Added new integration test verifying that changing engines results in a cache miss.

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-gatsby-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 29, 2024 9:42pm
examples-kitchensink-blog 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 29, 2024 9:42pm
examples-native-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 29, 2024 9:42pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2024 9:42pm
examples-tailwind-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 29, 2024 9:42pm
5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview May 29, 2024 9:42pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview May 29, 2024 9:42pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview May 29, 2024 9:42pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview May 29, 2024 9:42pm
rust-docs ⬜️ Ignored (Inspect) Visit Preview May 29, 2024 9:42pm

@chris-olszewski chris-olszewski force-pushed the chrisolszewski/turbo-3123-root-packagejson-s-engine-should-factor-into-cache branch from c1cf131 to 5d05506 Compare May 17, 2024 18:50
@chris-olszewski chris-olszewski marked this pull request as ready for review May 17, 2024 18:50
@chris-olszewski chris-olszewski requested a review from a team as a code owner May 17, 2024 18:50
Copy link
Contributor

github-actions bot commented May 17, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented May 17, 2024

🟢 CI successful 🟢

Thanks

Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

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

All of the root package.json is in the global cache inputs though, right? Is this double-including it?

@chris-olszewski
Copy link
Member Author

All of the root package.json is in the global cache inputs though, right? Is this double-including it?

No, we don't include the file hash of the root package.json. Previously the only information that went in the global hash were external package dependencies. With 2.0 it will now be engines, and all of the various dependencies

Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

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

Could you rebase this so I can see the diff again? The explanation makes sense, I was thinking of aa019da, but that was for package-specific package.jsons that we try to always include.

@chris-olszewski chris-olszewski force-pushed the chrisolszewski/turbo-3123-root-packagejson-s-engine-should-factor-into-cache branch from 31952ca to 986d423 Compare May 29, 2024 17:22
Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

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

Some merge conflicts, but looks good otherwise!

@@ -407,14 +426,15 @@ mod test {
global_file_hash_map: &global_file_hash_map,
root_external_dependencies_hash: Some("0000000000000000"),
root_internal_dependencies_hash: Some("0000000000000001"),
engines: Default::default(),
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the default?

Copy link
Member Author

Choose a reason for hiding this comment

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

{}

@chris-olszewski chris-olszewski merged commit 52268d4 into turborepo_2 May 29, 2024
58 of 59 checks passed
@chris-olszewski chris-olszewski deleted the chrisolszewski/turbo-3123-root-packagejson-s-engine-should-factor-into-cache branch May 29, 2024 22:03
chris-olszewski added a commit that referenced this pull request May 31, 2024
### Description

Changing the `engines` field in the root `package.json` can affect the
execution of tasks so it should affect the global cache.

This PR adds the `engines` struct to the global cache key.

### Testing Instructions

Added new integration test verifying that changing `engines` results in
a cache miss.
chris-olszewski added a commit that referenced this pull request Jun 4, 2024
### Description

Changing the `engines` field in the root `package.json` can affect the
execution of tasks so it should affect the global cache.

This PR adds the `engines` struct to the global cache key.

### Testing Instructions

Added new integration test verifying that changing `engines` results in
a cache miss.
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.

2 participants