You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update documentation for AzureDevOpsApi trait convention
Add trait convention to CLAUDE.md, code-reviewer, and plan-reviewer.
Update PROJECT.md tool function signature and ARCHITECTURE.md with
api_trait.rs and tests/ directory listing. Update plan checkmarks.
Copy file name to clipboardExpand all lines: .claude/agents/code-reviewer.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,7 @@ You MUST verify ALL of the following in changed code:
86
86
-**Async safety**: No blocking calls in async context. `tokio::task::spawn_blocking` for blocking operations. No fire-and-forget spawns without shutdown path. Flag violations as CRITICAL.
87
87
-**Shared state**: `Arc<T>` for shared immutable state across tasks. `Arc<Mutex<T>>` or `tokio::sync::Mutex<T>` for shared mutable state. Flag unprotected shared mutable state as CRITICAL.
88
88
-**MCP tool pattern**: Tools use `#[mcp_tool(name, description)]`, args struct with `Deserialize + JsonSchema`, return `Result<CallToolResult, McpError>`, convert domain errors via `.map_err()`. Flag deviations.
89
+
-**AzureDevOpsApi trait**: Tool functions MUST accept `&(dyn AzureDevOpsApi + Send + Sync)`, not `&AzureDevOpsClient`. API calls MUST go through trait methods, not standalone functions. Flag deviations.
89
90
-**Logging**: Use `log` crate. Correct log levels (trace/debug/info/warn/error). Never log secrets or tokens. Flag violations.
90
91
-**CLI conventions**: All config via clap CLI flags. No env vars for config (except `RUST_LOG` for logging). Flag deviations.
Copy file name to clipboardExpand all lines: .claude/agents/plan-reviewer.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,7 @@ You MUST verify ALL of the following for EVERY action's planned code:
105
105
-**Async safety**: No blocking calls in async context. `tokio::task::spawn_blocking` for blocking operations. No fire-and-forget spawns without shutdown path. Flag violations as CRITICAL.
106
106
-**Shared state**: `Arc<T>` for shared immutable state. `Arc<Mutex<T>>` for shared mutable state. Flag unprotected shared mutable state as CRITICAL.
107
107
-**MCP tool pattern**: Tools use `#[mcp_tool(name, description)]`, args struct with `Deserialize + JsonSchema`, return `Result<CallToolResult, McpError>`, convert domain errors via `.map_err()`. Flag deviations.
108
+
-**AzureDevOpsApi trait**: Planned tool functions MUST accept `&(dyn AzureDevOpsApi + Send + Sync)`, not `&AzureDevOpsClient`. API calls MUST go through trait methods. Flag deviations.
108
109
-**Logging**: Use `log` crate. Correct log levels (trace/debug/info/warn/error). Never log secrets. Flag violations.
109
110
-**CLI conventions**: All config via clap CLI flags. No env vars for config (except `RUST_LOG`). Flag deviations.
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,9 +246,15 @@ This project uses specialized subagents (defined in `.claude/agents/`) to enforc
246
246
- Use `mockall` (in dev-dependencies) for generating mock implementations.
247
247
- Keep traits small (1–3 methods). Prefer composing small traits over large ones.
248
248
249
+
### AzureDevOpsApi trait
250
+
- All MCP tool functions accept `&(dyn AzureDevOpsApi + Send + Sync)` instead of `&AzureDevOpsClient`.
251
+
-`AzureDevOpsApi` is defined in `src/azure/api_trait.rs` with `#[cfg_attr(feature = "test-support", mockall::automock)]`.
252
+
-`AzureDevOpsClient` implements the trait by delegating to the standalone API functions.
253
+
- Integration tests use `MockAzureDevOpsApi` (enabled via `test-support` feature) to verify tool behavior without external services.
254
+
249
255
### Dependency injection
250
256
- Pass dependencies explicitly via constructor parameters (`new()`).
251
-
- Use `Arc<T>` for shared ownership across async tasks (e.g., `Arc<AzureDevOpsClient>` in `AzureMcpServer`).
257
+
- Use `Arc<T>` for shared ownership across async tasks (e.g., `Arc<dyn AzureDevOpsApi + Send + Sync>` in `AzureMcpServer`).
252
258
- Do NOT rely on mutable global state or `lazy_static!` for wiring dependencies (compile-time constants via `once_cell::sync::Lazy` for regex patterns are acceptable).
4. Convert domain errors to `McpError` via `.map_err()`.
159
159
5. Return `tool_text_success(content)` (from `support/tool_text_success.rs`) — this automatically prepends the anti-prompt-injection warning to all tool responses. Never use `CallToolResult::success(vec![Content::text(...)])` directly.
0 commit comments