Repository navigation
fix(claude-code): catch up to v2.1.117 + tighten clippy gate #756
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e55778
fix(claude-code): catch up to v2.1.117 (Monitor tool, xhigh effort, c…
avifenesh ad9de18
chore(ci): tighten clippy gate to --all-targets and fix latent warnings
avifenesh b100c71
fix(clippy): sort_by_key with Reverse for the remaining sort_by sites
avifenesh 34bca17
fix: address review comments (round 1) + cfg(unix) on lsp test imports
avifenesh 5a3008b
docs(changelog): reference VALID_EFFORT_LEVELS not the removed VALID_…
avifenesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ use crate::{ | |
| rules::{Validator, ValidatorMetadata}, | ||
| schemas::agent::AgentSchema, | ||
| schemas::hooks::HooksSchema, | ||
| schemas::skill::VALID_EFFORT_LEVELS, | ||
| validation::is_valid_mcp_tool_format, | ||
| }; | ||
| use rust_i18n::t; | ||
|
|
@@ -74,8 +75,9 @@ const VALID_PERMISSION_MODES: &[&str] = &[ | |
| /// Valid memory scopes per CC-AG-008 | ||
| const VALID_MEMORY_SCOPES: &[&str] = &["user", "project", "local"]; | ||
|
|
||
| /// Valid effort values per CC-AG-014 | ||
| const VALID_EFFORT_VALUES: &[&str] = &["low", "medium", "high", "max"]; | ||
| // Valid effort values per CC-AG-014: shared with CC-SK-018 via | ||
| // schemas::skill::VALID_EFFORT_LEVELS so agent and skill effort lists | ||
| // stay in lock-step (Claude Code uses the same set for both). | ||
|
|
||
| /// Valid isolation values per CC-AG-015 | ||
| const VALID_ISOLATION_VALUES: &[&str] = &["worktree"]; | ||
|
|
@@ -98,6 +100,7 @@ const KNOWN_AGENT_FIELDS: &[&str] = &[ | |
| "skills", | ||
| "hooks", | ||
| "mode", | ||
| "color", | ||
| ]; | ||
|
|
||
| /// Known Claude Code tools for CC-AG-009 and CC-AG-010 | ||
|
|
@@ -121,6 +124,7 @@ const KNOWN_AGENT_TOOLS: &[&str] = &[ | |
| "Skill", | ||
| "StatusBarMessageTool", | ||
| "TaskOutput", | ||
| "Monitor", | ||
| ]; | ||
|
|
||
| const RULE_IDS: &[&str] = &[ | ||
|
|
@@ -915,8 +919,8 @@ impl Validator for AgentValidator { | |
| // CC-AG-014: Invalid effort value | ||
| if config.is_rule_enabled("CC-AG-014") { | ||
| if let Some(effort) = &schema.effort { | ||
| if !VALID_EFFORT_VALUES.contains(&effort.as_str()) { | ||
| let valid_display = VALID_EFFORT_VALUES.join(", "); | ||
| if !VALID_EFFORT_LEVELS.contains(&effort.as_str()) { | ||
| let valid_display = VALID_EFFORT_LEVELS.join(", "); | ||
| let mut diagnostic = Diagnostic::error( | ||
| path.to_path_buf(), | ||
| 1, | ||
|
|
@@ -931,7 +935,7 @@ impl Validator for AgentValidator { | |
|
|
||
| // Unsafe auto-fix: replace with closest valid effort value | ||
| if let Some(closest) = | ||
| super::find_closest_value(effort.as_str(), VALID_EFFORT_VALUES) | ||
| super::find_closest_value(effort.as_str(), VALID_EFFORT_LEVELS) | ||
| { | ||
| if let Some((start, end)) = | ||
| frontmatter_value_byte_range_from_parts(&parts, "effort") | ||
|
|
@@ -3774,25 +3778,50 @@ Body"; | |
| } | ||
|
|
||
| #[test] | ||
| fn test_effort_valid_values() { | ||
| for e in &["low", "medium", "high", "max"] { | ||
| let c = format!( | ||
| "--- | ||
| fn test_monitor_tool_accepted() { | ||
| // tools: list (CC-AG-009) | ||
| let c = "--- | ||
| name: a | ||
| description: b | ||
| effort: {} | ||
| tools: [Monitor] | ||
| --- | ||
| Body", | ||
| e | ||
| ); | ||
| let d = validate(&c); | ||
| assert_eq!( | ||
| d.iter().filter(|x| x.rule == "CC-AG-014").count(), | ||
| 0, | ||
| "Valid effort '{}' should not trigger CC-AG-014", | ||
| e | ||
| ); | ||
| } | ||
| Body"; | ||
| let d = validate(c); | ||
| assert_eq!( | ||
| d.iter().filter(|x| x.rule == "CC-AG-009").count(), | ||
| 0, | ||
| "Monitor tool should not trigger CC-AG-009 (added in Claude Code v2.1.98)" | ||
| ); | ||
|
Comment on lines
+3790
to
+3794
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR description mentions that the assert_eq!(
d.iter().filter(|x| x.rule == "CC-AG-009").count(),
0,
"Monitor tool should not trigger CC-AG-009 (added in Claude Code v2.1.98)"
);
assert_eq!(
d.iter().filter(|x| x.rule == "CC-AG-010").count(),
0,
"Monitor tool should not trigger CC-AG-010"
); |
||
|
|
||
| // disallowedTools list (CC-AG-010) - same KNOWN_AGENT_TOOLS list | ||
| let c2 = "--- | ||
| name: a | ||
| description: b | ||
| disallowedTools: [Monitor] | ||
| --- | ||
| Body"; | ||
| let d2 = validate(c2); | ||
| assert_eq!( | ||
| d2.iter().filter(|x| x.rule == "CC-AG-010").count(), | ||
| 0, | ||
| "Monitor tool should not trigger CC-AG-010 in disallowedTools" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_color_field_accepted() { | ||
| let c = "--- | ||
| name: a | ||
| description: b | ||
| color: blue | ||
| --- | ||
| Body"; | ||
| let d = validate(c); | ||
| assert_eq!( | ||
| d.iter().filter(|x| x.rule == "CC-AG-019").count(), | ||
| 0, | ||
| "color field should not trigger CC-AG-019 unknown-field" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
|
|
@@ -3898,7 +3927,7 @@ Agent instructions"#; | |
|
|
||
| #[test] | ||
| fn test_cc_ag_014_all_valid_effort_values() { | ||
| for effort in VALID_EFFORT_VALUES { | ||
| for effort in VALID_EFFORT_LEVELS { | ||
| let content = format!( | ||
| "---\nname: test\ndescription: Test agent\neffort: {}\n---\nBody", | ||
| effort | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CHANGELOG entry mentions
xhighbeing added toVALID_EFFORT_VALUES, but the implementation now usesschemas::skill::VALID_EFFORT_LEVELSfor both agent and skill effort validation (and there is noVALID_EFFORT_VALUESsymbol left in the codebase). Update this line to reference the actual constant(s) used so the changelog stays accurate.