Skip to content

Fix two different crashes in the new clippy integration#747

Open
Synss wants to merge 2 commits intoaspect-build:mainfrom
Synss:fix-clippy
Open

Fix two different crashes in the new clippy integration#747
Synss wants to merge 2 commits intoaspect-build:mainfrom
Synss:fix-clippy

Conversation

@Synss
Copy link
Contributor

@Synss Synss commented Feb 5, 2026

This fixes two bugs producing crashes in the recent clippy (rust) integration,


Even with these patches, fail_on_violation doesn't work reliably in our repo.


Changes are visible to end-users: no

Test plan

  • Covered by existing test cases
  • Manual testing; please provide instructions so we can reproduce: tested in work repo

@Synss Synss marked this pull request as draft February 5, 2026 08:39
@CLAassistant
Copy link

CLAassistant commented Feb 5, 2026

CLA assistant check
All committers have signed the CLA.

@aspect-workflows
Copy link

aspect-workflows bot commented Feb 5, 2026

Bazel 7 (Test)

All tests were cache hits

6 tests (100.0%) were fully cached saving 2s.


Bazel 8 (Test)

All tests were cache hits

6 tests (100.0%) were fully cached saving 2s.


Bazel 9 (Test)

All tests were cache hits

6 tests (100.0%) were fully cached saving 2s.

This fixes the following error
```% bazel lint --fixes=true //packages/check-cert/...
INFO: Invocation ID: 7be4597f-1cdb-4599-8cd8-c795b94fb9ba
ERROR: file 'packages/check-cert/src/main.rs' is generated by these conflicting actions:
Label: //packages/check-cert:check-cert
Aspects: [//bazel/tools:aspects.bzl%clippy], []
RuleClass: rust_binary rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction, class com.google.devtools.build.lib.analysis.actions.SymlinkAction
Configuration: 11c983bfde6556f27385ff463d234d63620916bbadff4748d5a3134668d2d2a3
Mnemonic: CopyFile, Symlink
Action key: 89b77dc2f00dcd76ab89e69c729a73c02f3f6f42216718dadf546eb08b264d71, 7a39b61d5744a8903119e17b3ddc7e56e330f240d2bead98c3ba081a81b5c9ac
Progress message: Copying file packages/check-cert/src/main.rs, Creating symlink to source file:
packages/check-cert/src/main.rs
Action describeKey: Copying file packages/check-cert/src/main.rs
  Execution info: no-sandbox=1
  Argument: external/aspect_bazel_lib++toolchains+coreutils_linux_amd64/coreutils
  Argument: cp
  Argument: packages/check-cert/src/main.rs
  Argument: bazel-out/k8-fastbuild/bin/packages/check-cert/src/main.rs
  Output paths mode: OFF
, GUID: 7f4fab4d-d0a7-4f0f-8649-1d0337a21fee
inputPath: null

PrimaryInput: File:[/home/mathiaslaurin/src/checkmk/master.git[source]]packages/check-cert/src/main.rs
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-fastbuild/bin]packages/check-cert/src/main.rs
Owner information: //packages/check-cert:check-cert#//bazel/tools:aspects.bzl%clippy
ConfiguredTargetKey{label=//packages/check-cert:check-cert, config=BuildConfigurationKey[11c983bfde6556f27385ff463d234d63620916bbadff4748d5a3134668d2d2a3]} {},
ConfiguredTargetKey{label=//packages/check-cert:check-cert, config=BuildConfigurationKey[11c983bfde6556f27385ff463d234d63620916bbadff4748d5a3134668d2d2a3]}
MandatoryInputs: Attempted action contains artifacts not in previous action (first 5):
        coreutils
Outputs: are equal
Use --verbose_failures to see the command lines of failed build steps.
ERROR: file 'packages/check-cert/src/main.rs' is generated by these conflicting actions:
Label: //packages/check-cert:check-cert
Aspects: [//bazel/tools:aspects.bzl%clippy], []
RuleClass: rust_binary rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction, class
com.google.devtools.build.lib.anal
ysis.actions.SymlinkAction
Configuration: 11c983bfde6556f27385ff463d234d63620916bbadff4748d5a3134668d2d2a3
Mnemonic: CopyFile, Symlink
Action key: 89b77dc2f00dcd76ab89e69c729a73c02f3f6f42216718dadf546eb08b264d71, 7a39b61d5744a8903119e17b3ddc7e56e330f240d2bead98c3ba081a81b5c9ac
Progress message: Copying file packages/check-cert/src/main.rs, Creating symlink to source file:
packages/check-cert/src/main.rs
Action describeKey: Copying file packages/check-cert/src/main.rs
  Execution info: no-sandbox=1
  Argument: external/aspect_bazel_lib++toolchains+coreutils_linux_amd64/coreutils
  Argument: cp
  Argument: packages/check-cert/src/main.rs
  Argument: bazel-out/k8-fastbuild/bin/packages/check-cert/src/main.rs
  Output paths mode: OFF
, GUID: 7f4fab4d-d0a7-4f0f-8649-1d0337a21fee
inputPath: null

PrimaryInput: File:[/home/mathiaslaurin/src/checkmk/master.git[source]]packages/check-cert/src/main.rs
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-fastbuild/bin]packages/check-cert/src/main.rs
Owner information: //packages/check-cert:check-cert#//bazel/tools:aspects.bzl%clippy
ConfiguredTargetKey{label=//packages/chec
k-cert:check-cert, config=BuildConfigurationKey[11c983bfde6556f27385ff463d234d63620916bbadff4748d5a3134668d2d2a3]} {},
ConfiguredTargetKey{label=//packages/check-cert:check-cert, config=BuildConfigurationKey[11c983bfde6556f27385ff463d234d63620916bbadff4748d5a3134668d2d2a3]}
MandatoryInputs: Attempted action contains artifacts not in previous action (first 5):
        coreutils
Outputs: are equal
INFO: Elapsed time: 0.445s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
INFO: Build Event Protocol files produced successfully.
FAILED:
```
@Synss Synss force-pushed the fix-clippy branch 2 times, most recently from 939cb8e to 062343d Compare February 5, 2026 12:56
Fixes crash
```
The following files have no generating action:
packages/check-cert/check-cert-lib.AspectRulesLintClippy.out.exit_code
packages/check-cert/check-cert-lib.AspectRulesLintClippy.report.exit_code
```

Also fixes handling of exit_code, because we pass `-Wwarnings` to
clippy, the linter does not treat warnings as errors, as a result,
`clippy` may return with an exit code of 0 on findings.

In such cases, `fail_on_violation` is ignored.

We can fix this by explicitly searching whether clippy reports any
warning and use this value as well to determine which exit code
to emit.
@Synss Synss marked this pull request as ready for review February 5, 2026 13:32
@Synss
Copy link
Contributor Author

Synss commented Feb 5, 2026

The CI failure comes from linting rust code that actually contains linting errors. That's the expected behavior, isn't it?

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