feat(rust): enforce error-string policy lint#378
Conversation
yordis
commented
Jun 21, 2026
- Error-derived behavior should depend on typed variants or domain categories instead of display text.
- Rust policy checks need compiler type information so wording changes cannot silently affect decisions.
PR SummaryMedium Risk Overview CI and local gates now install A small scheduler test exercises default Reviewed by Cursor Bugbot for commit 72d3417. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (15)
✅ Files skipped from review due to trivial changes (8)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughIntroduces a new Changestrogon_lints Dylint crate and CI wiring
Sequence Diagram(s)sequenceDiagram
participant CI as ci-rust workflow
participant SetupRust as setup-rust action
participant Nightly as Install nightly<br/>for trogon_lints
participant TrogonTest as cargo test<br/>(trogon_lints)
participant TrogonDylint as cargo dylint<br/>(workspace)
participant Clippy as cargo clippy
CI->>SetupRust: install stable Rust toolchain
SetupRust->>CI: rustup component add rustfmt,clippy,llvm-tools-preview
CI->>Nightly: detect trogon_lints/rust-toolchain.toml, parse nightly-2026-04-16
Nightly->>CI: rustup toolchain install nightly-2026-04-16 with rustc-dev,rust-src,llvm-tools-preview
CI->>TrogonTest: cargo test (under RUSTUP_TOOLCHAIN override)
CI->>TrogonDylint: cargo dylint --workspace --no-deps --all-features (RUSTUP_TOOLCHAIN unset, DYLINT_RUSTFLAGS=-Derror-string-comparison)
CI->>Clippy: cargo clean -p CRATE && cargo clippy
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Coverage SummaryDetailsDiff against mainResults for commit: 72d3417 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
34da8eb to
9656ae6
Compare
bbb18d0 to
9cf2ee1
Compare
9cf2ee1 to
f23d066
Compare
f23d066 to
d838d75
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci-rust.yml:
- Around line 57-60: The `Run repo Rust policy lints` step runs cargo dylint
from the rsworkspace root with RUSTUP_TOOLCHAIN unset and uses --path to
reference a subdirectory containing its own rust-toolchain.toml with
nightly-2026-04-16. Cargo may not automatically traverse into the subdirectory's
toolchain configuration when invoked from a parent without an active toolchain.
Fix this by either changing the working-directory to
rsworkspace/dylints/trogon_lints and adjusting the --path argument accordingly,
or by explicitly setting the required toolchain at the rsworkspace root level
using a rust-toolchain.toml or adding a rustup override set command before the
cargo dylint invocation.
In `@rsworkspace/dylints/trogon_lints/Cargo.toml`:
- Line 5: The edition field in the Cargo.toml file is set to "2024", which is
not a valid Rust edition and will cause the build to fail. Change the edition
value in the edition = "2024" line to "2021", which is the latest supported
edition. Replace "2024" with "2021" to resolve the manifest parsing error.
In `@rsworkspace/dylints/trogon_lints/src/error_string_comparison.rs`:
- Around line 69-71: The pattern matching in the conditional expression
incorrectly pairs PatKind::TupleStruct with ExprKind::Tup. Tuple-struct
constructors (like Foo(a, b)) are represented as ExprKind::Call, not
ExprKind::Tup which represents literal tuples. Separate the PatKind::TupleStruct
case from PatKind::Tuple and create a new match arm that pairs
PatKind::TupleStruct with ExprKind::Call to correctly handle tuple-struct
destructuring patterns and ensure taint is properly bound for cases like
Foo(error.to_string(), ...).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ef9ed82e-7cd1-4f65-bae6-517bc7169462
⛔ Files ignored due to path filters (1)
rsworkspace/dylints/trogon_lints/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
.config/mise/tasks/rust-pr-check.github/actions/setup-rust/action.yml.github/workflows/ci-rust.yml.mise.tomlrsworkspace/dylints/trogon_lints/.cargo/config.tomlrsworkspace/dylints/trogon_lints/.gitignorersworkspace/dylints/trogon_lints/Cargo.tomlrsworkspace/dylints/trogon_lints/README.mdrsworkspace/dylints/trogon_lints/rust-toolchain.tomlrsworkspace/dylints/trogon_lints/src/error_string_comparison.rsrsworkspace/dylints/trogon_lints/src/lib.rsrsworkspace/dylints/trogon_lints/ui/main.rsrsworkspace/dylints/trogon_lints/ui/main.stderr
d838d75 to
157ec51
Compare
a66dd7c to
745965b
Compare
4d277a1 to
35df76d
Compare
8bbb647 to
f520c41
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/actions/setup-rust/action.yml:
- Around line 15-22: The nightly version nightly-2026-04-16 is hardcoded in the
Install Dylint Rust components step, creating maintenance drift with the version
declared in rsworkspace/dylints/trogon_lints/rust-toolchain.toml. Remove the
explicit rustup toolchain install command for the hardcoded nightly version and
remove the --toolchain nightly-2026-04-16 flag from the rustup component add
command. Instead, rely on rustup's automatic toolchain detection which will use
the version specified in the rust-toolchain.toml file, eliminating the need to
maintain the version in two places.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8a91b6d0-5478-46fb-8647-5c1a31d04966
⛔ Files ignored due to path filters (1)
rsworkspace/dylints/trogon_lints/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (15)
.config/mise/tasks/rust-pr-check.github/actions/setup-rust/action.yml.github/workflows/ci-rust.yml.mise.tomlrsworkspace/crates/trogon-scheduler/src/processor/execution/worker/dispatcher.rsrsworkspace/dylints/trogon_lints/.cargo/config.tomlrsworkspace/dylints/trogon_lints/.gitignorersworkspace/dylints/trogon_lints/Cargo.tomlrsworkspace/dylints/trogon_lints/README.mdrsworkspace/dylints/trogon_lints/rust-toolchain.tomlrsworkspace/dylints/trogon_lints/src/error_string_comparison.rsrsworkspace/dylints/trogon_lints/src/lib.rsrsworkspace/dylints/trogon_lints/ui/main.rsrsworkspace/dylints/trogon_lints/ui/main.stderrrust-toolchain.toml
✅ Files skipped from review due to trivial changes (6)
- rsworkspace/dylints/trogon_lints/.gitignore
- rsworkspace/dylints/trogon_lints/.cargo/config.toml
- rust-toolchain.toml
- rsworkspace/dylints/trogon_lints/rust-toolchain.toml
- rsworkspace/dylints/trogon_lints/README.md
- rsworkspace/dylints/trogon_lints/ui/main.stderr
🚧 Files skipped from review as they are similar to previous changes (6)
- rsworkspace/dylints/trogon_lints/Cargo.toml
- .mise.toml
- .github/workflows/ci-rust.yml
- rsworkspace/dylints/trogon_lints/src/lib.rs
- .config/mise/tasks/rust-pr-check
- rsworkspace/dylints/trogon_lints/src/error_string_comparison.rs
f8ded0d to
8049295
Compare
8049295 to
975efb0
Compare
e003664 to
6955dd9
Compare
6955dd9 to
2253e82
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2253e82. Configure here.
2253e82 to
784de19
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
784de19 to
72d3417
Compare
