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(Turborepo): Handle new packages in lockfile comparisons #8127

Merged
merged 3 commits into from May 13, 2024

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented May 10, 2024

Description

When comparing lockfiles between revisions to identify what packages have been affected, we treated missing packages in the previous lockfile (added in the new lockfile) as errors, and fell back to considering all packages as affected. This change adds a boolean to determine what the behavior should be when we can't find a package that we expect. When building the package graph, it continues to be an error, as well as when tracing the dependencies of a package we've already found in the lockfile. However, for the first round of packages that we look for in a previous lockfile, we ignore missing packages. This allows us to more gracefully handle comparisons between commits that add new packages.

Testing Instructions

Added an integration test inspired by the repro from the linked issue.

Fixes #8125

Copy link

vercel bot commented May 10, 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 13, 2024 6:57pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 6:57pm
8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm
rust-docs ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 6:57pm

Copy link
Contributor

github-actions bot commented May 10, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented May 10, 2024

🟢 CI successful 🟢

Thanks

Comment on lines +12 to +17
Now build and verify that only the new package is in scope
Note that we need --skip-infer because we've now installed a local
turbo in this repo
Note that we need to disable path conversion because on windows, git bash considers
'//' to be an escape sequence translating to '/'.
$ MSYS_NO_PATHCONV=1 ${TURBO} --skip-infer build -F '[HEAD]' -F '!//' --dry=json | jq '.packages'
Copy link
Contributor

Choose a reason for hiding this comment

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

If this env var is just for the -F '!// flag on CLI, can you set it globally with this explanation?

https://github.com/vercel/turbo/blob/cc565e86be3506bc80592813a192217a8cc5b0c1/turborepo-tests/helpers/setup_integration_test.sh

It's very likely that this will come up again, especially as we do more work with root packages (e.g. tracing deps through root package.json)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried it, and it appears we are relying on this behavior in other parts of our scripts. It might be possible to set it up properly, but I think that's beyond the scope of this particular PR.

@gsoltis gsoltis merged commit 04248f4 into main May 13, 2024
56 checks passed
@gsoltis gsoltis deleted the gsoltis/handle_new_packages branch May 13, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turbo --filter builds all the packages when a new workspace is added
3 participants