-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
[Bug]: pkg is a directory; dependency checking of directories is unsound #1408
Comments
You can also get the same warnings, on latest ( |
Yup, I see that. Every package warns about this. |
I believe Bazel 7 made this existing warning more noisy for some reason. It would be really useful if someone could bisect where this was introduced in Bazel, maybe that commit message will give us more clues about why it does this. Adding this to
(from https://docs.aspect.build/guides/bazelrc#correctness-options ) |
Why not use globs instead? I’d rather not be relying on unsound behavior |
Hey, FYI i am using rules_js only to provide a macro to release component in my monorepo through semantic-release |
@UebelAndre We don't want globs since that produces thousands of input files. We just want one input directory. It's Bazel's fault :) |
I just don't want this warning and don't want to be required to use some experimental behavior to make them go away :( |
It would be a massive performance regression to hand Bazel an input file for every file in the node_modules directory, so I don't think we'd consider turning that on for everyone. If you have a specific proposal of how to change it, I guess someone can make a PR on a fork of rules_js to bypass the warning. |
@alexeagle Have you considered downloading the archive with |
The relevant commit to Bazel appears to be bazelbuild/bazel@2fe450f, referencing bazelbuild/bazel#18579 This does indeed appear to be also related to outputting directories.
This implies that the |
@alexeagle Alternatively to avoid doing an untar in a build action, you could |
@SanjayVas I believe this is referring to rules which do A directory properly declared with |
If a performance hit is observed with this change, odds are they can be reclaimed by making changes to Bazel. Analysis time should perform well (hashing of "Preparation" tasks before execution such as runfiles creation might take a hit if Bazel is symlinking |
I tested this with an implementation of the suggested change. Bazel symlinks the I'll get a PR for this. |
@jesses-canva that's a clever idea - but currently we need access to some files inside the package earlier (e.g. repository rule needs to read package.json) so it's not enough to delay extraction until an action runs. Perhaps we can extract just some of the files in a repository rule and ALSO extract them again in an action later. Thanks for tracking down that change @SanjayVas - I'll reach out to @tjgq about our options here to keep the same performance but not trigger the warning. |
Patches are applied before However it is possible to be more frugal. # ...
packages:
# ...
/@aspect-test/a@5.0.2:
resolution: {integrity: sha512-bURS+F0+tS2XPxUPbrqsTZxIre1U5ZglwzDqcOCrU7MbxuRrkO24hesgTMGJldCglwL/tiEGRlvdMndlPgRdNw==}
hasBin: true
# ^^^^^^^^^^
dependencies:
'@aspect-test/b': 5.0.2
'@aspect-test/c': 2.0.2
'@aspect-test/d': 2.0.0(@aspect-test/c@2.0.2)
dev: true This means for a typical scenario (out of all dependencies, few have
On paper performance should be close with potential for savings seen in certain scenarios (since extraction can potentially be skipped). Stats for perspective (pulled from Rules JS
If desiring to removal all extraction from repository generation, it may be doable with an API change (breaking change). The generated lambdas and other symbols do not appear to need much information about the package. It may be possible to generalise them such that the user is responsible for specifying which binary to use (information which must already be known by users). # From Rules JS, //e2e/bzlmod:BUILD.bazel
load("@npm//:jasmine/package_json.bzl", jasmine_bin = "bin")
jasmine_bin.test(
name = "jasmine_test",
bin = "jasmine",
# ^^^^^^^^^^^^^^
args = ["*.spec.js"],
data = ["test.spec.js"],
# jasmine doesn't know to run without runfiles
target_compatible_with = not_windows,
) With the user provided
|
This has been "mostly" mitigated in the latest rules_js release now that for most npm package the input to the graph is the See the PR summary of #1538 and this comment on #1412 for more info. Since there are still cases where a source directory input is required for packages with lifecycle hooks and/or patches this issue should stay open. The lifecycle and patches cases will be fixed in the future. |
Is there any ETA on the lifecycle hooks/patches part of this? In CockroachDB, the newer version of |
We set `-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` as a workaround for a bug in `rules_js`. See aspect-build/rules_js#1408 for more details. Closes cockroachdb#123237 Epic: CRDB-17171 Release note: None
127868: bazel: upgrade to Bazel 7.2.1 r=rail a=rickystewart We set `-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` as a workaround for a bug in `rules_js`. See aspect-build/rules_js#1408 for more details. Closes #123237 Epic: CRDB-17171 Release note: None Co-authored-by: Ricky Stewart <ricky@cockroachlabs.com>
We set `-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` as a workaround for a bug in `rules_js`. See aspect-build/rules_js#1408 for more details. Closes cockroachdb#123237 Epic: CRDB-17171 Release note: None
We set `-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` as a workaround for a bug in `rules_js`. See aspect-build/rules_js#1408 for more details. Closes cockroachdb#123237 Epic: CRDB-17171 Release note: None
A few changes were necessary to make this upgrade happen: 1. `--enable_bzlmod` is now `true` by default, however this seems to break the workspace name which becomes `_main` and breaks the renderer tool. This is probably easily fixable, but bzlmod isn't supported yet anyways, so I think it's better to just turn this off altogether and tackle it separately. 2. Bazel 7 gives a very noisy warning about NPM directory outputs being unsound. This is tracked in [`aspect-build/rules_js#1408`](aspect-build/rules_js#1408) but unfortunately is not easily fixable at the moment. Setting `-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` seems to be [the recommendation](aspect-build/rules_js#1408 (comment)) to silence this warning for the time being. 3. `--incompatible_disable_third_party_license_checking` appears to have been removed. 4. `--incompatible_fail_on_unknown_attributes` is set by default and breaks `jasmine_web_test_suite` which passed a couple attributes not known to the `web_test` rule. Since they aren't used anywhere and don't actually do anything anyways, I think the best option is to just remove those options.
* Release notes: https://github.com/bazelbuild/bazel/releases/tag/7.0.0 * Blog post: https://blog.bazel.build/2023/12/11/bazel-7-release.html A few changes were necessary to make this upgrade happen: 1. `--enable_bzlmod` is now `true` by default, however this seems to break the workspace name which becomes `_main` and breaks the renderer tool. This is probably easily fixable, but bzlmod isn't supported yet anyways, so I think it's better to just turn this off altogether and tackle it separately. 2. Bazel 7 gives a very noisy warning about NPM directory outputs being unsound. This is tracked in [`aspect-build/rules_js#1408`](aspect-build/rules_js#1408) but unfortunately is not easily fixable at the moment. Setting `-DBAZEL_TRACK_SOURCE_DIRECTORIES=1` seems to be [the recommendation](aspect-build/rules_js#1408 (comment)) to silence this warning for the time being. 3. `--incompatible_disable_third_party_license_checking` appears to have been removed. 4. `--incompatible_fail_on_unknown_attributes` is set by default and breaks `jasmine_web_test_suite` which passed a couple attributes not known to the `web_test` rule. Since they aren't used anywhere and don't actually do anything anyways, I think the best option is to just remove those options.
What happened?
I have a dependencies on
prettier@2.8.8
and after updating to the latest1.34.1
and Bazel 7.0.0 I get the following errorVersion
Development (host) and target OS/architectures:
Output of
bazel --version
: 7.0.0How to reproduce
I'm not able to provide too much detail on my workspace but suspect anything which depends at least on `prettier==2.8.8` would repro this problem.
Any other information?
No response
The text was updated successfully, but these errors were encountered: