Skip to content

RUST-117 Add Agent Quality Profile for AI agents#188

Closed
benzonico wants to merge 2 commits intomasterfrom
feature/agent-quality-profile
Closed

RUST-117 Add Agent Quality Profile for AI agents#188
benzonico wants to merge 2 commits intomasterfrom
feature/agent-quality-profile

Conversation

@benzonico
Copy link
Copy Markdown

@benzonico benzonico commented Mar 11, 2026

Summary

Create a quality profile for AI agents focused on reliability, security, and complexity with high-severity rules only (Major, Critical, Blocker).

Profile Statistics

  • Total rules: 61 high-severity rules
  • Security: 0 rules (Rust's memory safety provides built-in security)
  • Reliability: 59 rules (bugs, error handling)
  • Complexity: 3 rules (cognitive complexity, code structure)

Severity Distribution

  • Major: 51 rules available → 51 included
  • Critical: 19 rules available → 9 included
  • Blocker: 6 rules available → 1 included

Why Fewer Security Rules?

Rust's ownership system and borrow checker provide memory safety guarantees at compile time, eliminating entire classes of security vulnerabilities (buffer overflows, use-after-free, data races, etc.).

Changes

Files added/modified:

  • Agent_quality_profile.json - Curated high-severity rule list
  • RustAgentQualityProfile.java - Profile loader implementation
  • RustPlugin.java - Profile registration

Why This Matters

AI agents benefit from focused guidance on critical code quality issues. This minimalist profile enforces only the most severe reliability and complexity standards for Rust code.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@benzonico benzonico requested a review from a team as a code owner March 11, 2026 10:07
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Add Agent Quality Profile for AI agents RUST-117 Add Agent Quality Profile for AI agents Mar 11, 2026
@hashicorp-vault-sonar-prod
Copy link
Copy Markdown

hashicorp-vault-sonar-prod Bot commented Mar 11, 2026

RUST-117

Create a quality profile for AI agents focused on reliability, security,
and complexity with high-severity rules only (Major, Critical, Blocker).

This profile activates 61 high-severity rules:
- Security vulnerabilities and hotspots: 0 rules (Rust's memory safety provides built-in security)
- Reliability issues (bugs): 59 rules
- Code complexity metrics: 3 rules

The Agent Quality Profile helps AI agents maintain code quality by
enforcing critical reliability and complexity standards for Rust code.

Changes:
- Add Agent_quality_profile.json with curated high-severity rules
- Add RustAgentQualityProfile.java profile loader
- Register profile in RustPlugin.java

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@benzonico benzonico force-pushed the feature/agent-quality-profile branch from 3abdb97 to 6cd1b34 Compare March 11, 2026 15:26
Copy link
Copy Markdown
Contributor

@Wohops Wohops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Nico,

The build is not passing, your agent didn't modified RustPluginTest.java accordingly, and didn't generate any tests corresponding to the new feature you are adding. According to the javadoc of the RustAgentQualityProfile.java class, I would expect that there is some logic that have been encoded to select rules and I'm surprised not to see related tests. Can you please remediate to this? I would also expect some end-2-end (ITs?) test to validate that the profile can be leveraged correctly and that the rules are triggered.

I also have a question related to the feature itself. The corresponding ticket (RUST-117) is empty (it has been generated when opening the PR), not tied to any Epic or Initiative, not documented and as far as I can tell no communication has been done around this initiative to the RAD squad... So I don't know what to do with it.

So, what are your expectation with this work? Is it a one shot or an experiment? Is it part of a bigger initiative? Do you expect us to ship this with the next SQS release? (code freeze is this Friday for next SQS release)

Cheers,
Michael

LcovSensor.class,
RustLanguage.class,
RustProfile.class,
RustAgentQualityProfile.class,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are adding a new extension, unit tests of this class should be updated accordingly.

@@ -0,0 +1,66 @@
{
"name": "Agent Quality Profile",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These quality profiles are usually populated leveraging metadata from RSPEC and rule-api, so we don't have to maintain them by hand and the knowledge is centralized, and shared within languages.

From your previous commit, I feel that you are generating a list using an agent, and this does not feel sustainable if this logic is not centralized in RSPEC (it's a "one shot").

For instance, for S1656, I would expect to see in its metadata the presence of the new Quality profile. Without it, how to control on the long which new rule would be enabled or not?

"S7462",
"S7463",
"S7464",
"S905"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the equivalent SonarWay profile, S905 is placed before S1XXX. Rules are ordered by key numbers, can you fix it? It helps review what is "a new rule" from "an old rule". Old rule keys are more likely to be shared with other languages.

@@ -0,0 +1,66 @@
{
"name": "Agent Quality Profile",
"ruleKeys": [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review what rules are part of this quality profile and which one are not compared to SonarWay. Should I?

The Agent Quality Profile adds one more extension to the plugin,
so the test now expects 19 extensions instead of 18.
@sonarqube-next
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed for 'sonar-rust'

Failed conditions
1 New issue

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

@benzonico benzonico closed this Mar 18, 2026
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