-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: Skip over repo root package for package inferrence #3503
fix: Skip over repo root package for package inferrence #3503
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
7 Ignored Deployments
|
@chris-olszewski is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
"//": { | ||
Dir: turbopath.AnchoredSystemPath("").ToSystemPath(), | ||
Name: "monorepo", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need a test helper to construct all the internal bits that make up a valid monorepo representation... it's quite a pain to dig through the code to do this right. There's a beginning of one here: https://github.com/vercel/turbo/blob/3bbbc471d3f8b9f6c141d620ae6f18dd206fd8cd/cli/internal/core/engine_persistent_deps_test.go#L448-L449
@@ -165,7 +165,8 @@ func calculateInference(repoRoot turbopath.AbsoluteSystemPath, rawPkgInferenceDi | |||
if err != nil { | |||
return nil, err | |||
} | |||
if inferredPathIsBelow { | |||
// We skip over the root package as the inferred path will always be below it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about this feature, but is this true? If you run turbo run
from the root of the repo, will inference be skipped altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turbo run
from repo root will cause rawPkgInferenceDir
to be ""
which triggers a return at the beginning of this function
Once again map iteration is the culprit. The failure of
infer_pkg.t
is caused by package inference iterating over the root package before the correct candidate package. This results inpkgPath == repoRoot
and sincefullInferencePath
is necessarily contained in the repo root, the root package will always be selected as the exact package. The fix is just skipping over the root package.First commit adds a root package to the tests. The package inference cases will fail in a non-deterministic fashion since this bug depends on the repo root package being iterated over before the package that should be inferred. The next commit is a fix.