aspect-build / aspect-build/rules_js
[Bug]: Incompatible version-less patches are not skipped
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 32
Description
### What happened?
#2059 introduced support for version-less patches, but does not match pnpm behaviour.
From the pnpm [9.7 release notes](https://github.com/pnpm/pnpm/releases/tag/v9.7.0);
> ... Failures will be skipped. ...
Not a major issue. This can be worked around fairly easily.
### Version
Development (host) and target OS/architectures:
```
host: Linux wksp-three 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
target: Same as host
```
Output of `bazel --version`:
```
Build label: 7.6.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Mar 31 17:08:56 2025 (1743440936)
Build timestamp: 1743440936
Build timestamp as int: 1743440936
```
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: `2.3.7`
Language(s) and/or frameworks involved: NA
### How to reproduce
Add a version-less patch for `postcss` with multiple versions (v7 and v8) in the dependency graph.
Patch content
```patch
removes the annoying migration log from tooling that uses postcss
diff --git a/lib/postcss.js b/lib/postcss.js
index 080ee8378977d092c94f10c9e567dac78db78812..54af711b98e2c8282f48cc6621393103fb7ead40 100644
--- a/lib/postcss.js
+++ b/lib/postcss.js
@@ -27,27 +27,7 @@ function postcss(...plugins) {
}
postcss.plugin = function plugin(name, initializer) {
- let warningPrinted = false
function creator(...args) {
- // eslint-disable-next-line no-console
- if (console && console.warn && !warningPrinted) {
- warningPrinted = true
- // eslint-disable-next-line no-console
- console.warn(
- name +
- ': postcss.plugin was deprecated. Migration guide:\n' +
- 'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
- )
- if (process.env.LANG && process.env.LANG.startsWith('cn')) {
- /* c8 ignore next 7 */
- // eslint-disable-next-line no-console
- console.warn(
- name +
- ': 里面 postcss.plugin 被弃用. 迁移指南:\n' +
- 'https://www.w3ctech.com/topic/2226'
- )
- }
- }
let transformer = initializer(...args)
transformer.postcssPlugin = name
transformer.postcssVersion = new Processor().version
```
### Any other information?
_No response_
Contributor guide
Research direction
Start by reviewing the version-less patch support introduced in #2059, then reproduce the dependency graph with postcss versions 7 and 8 using the patch targeting lib/postcss.js. Compare the result with pnpm 9.7 behavior; done means incompatible version-less patch failures are skipped rather than reported as errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100