refactor(agent-runtime): extract tool traits into corvus-traits#506
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
✅ Contributor ReportUser: @yacosta738
Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-04-11 to 2026-04-11 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@clients/agent-runtime/crates/corvus-traits/src/testing.rs`:
- Around line 4-6: The testing harness struct is currently declared pub(crate)
(TraitHarness) while the crate still exposes pub mod testing, so downstream
crates cannot use the harness; either make the harness fully exported by
changing TraitHarness's visibility from pub(crate) to pub, or if the harness
should remain internal, stop exporting the module by removing or changing the
pub mod testing declaration in lib.rs; locate the TraitHarness declaration in
testing.rs and adjust its visibility to pub, or update lib.rs to make the
testing module private to resolve the mismatch.
In `@clients/agent-runtime/crates/corvus-traits/src/tools.rs`:
- Around line 92-105: validate_tool_schema currently accepts any schema with a
"type" field, allowing non-object types (e.g., "type":"string") which breaks
function-calling parameter binding; update validate_tool_schema so that if a
"type" field exists it must be the string "object" (otherwise return an error
via anyhow::bail), and keep the existing warning when an object schema lacks
"properties"; reference validate_tool_schema and the "type"/"properties" keys
when making the change so spec() only receives object-typed parameter schemas.
In `@clients/agent-runtime/tests/traits_api_compat.rs`:
- Around line 167-182: Extend the TypeId compatibility assertions to cover the
moved metadata types: add assert_eq! checks comparing
TypeId::of::<ToolSourceMetadata>() and each descriptor hint struct re-exported
by the shim (the same names as in corvus_traits, e.g., any ToolDescriptorHint
types) against their corvus_traits counterparts
(TypeId::of::<corvus_traits::...>()) just like the existing assertions for
RuntimeTool, ToolResult, and ToolSpec; place these new assert_eq! lines
alongside the existing assertions so the test fails if those re-exports drift.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4680d0fd-a52b-4741-983c-c7315ac263aa
⛔ Files ignored due to path filters (1)
clients/agent-runtime/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
clients/agent-runtime/crates/corvus-traits/Cargo.tomlclients/agent-runtime/crates/corvus-traits/src/channels.rsclients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/src/tools.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/tests/traits_api_compat.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (8)
clients/agent-runtime/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
Run
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings, andcargo testfor code validation, or document which checks were skipped and why
Files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/src/channels.rsclients/agent-runtime/tests/traits_api_compat.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
**/*.rs
⚙️ CodeRabbit configuration file
**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.
Files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/src/channels.rsclients/agent-runtime/tests/traits_api_compat.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
**/*
⚙️ CodeRabbit configuration file
**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.
Files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/Cargo.tomlclients/agent-runtime/crates/corvus-traits/src/channels.rsclients/agent-runtime/tests/traits_api_compat.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
clients/agent-runtime/**/Cargo.toml
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
clients/agent-runtime/**/Cargo.toml: Preserve release-size profile assumptions inCargo.tomland avoid adding heavy dependencies unless clearly justified
Do not add heavy dependencies for minor convenience; justify new crate additions
Files:
clients/agent-runtime/crates/corvus-traits/Cargo.toml
clients/agent-runtime/src/tools/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
Implement
Tooltrait insrc/tools/with strict parameter schema, validate and sanitize all inputs, and return structuredToolResultwithout panics in runtime path
Files:
clients/agent-runtime/src/tools/traits.rs
clients/agent-runtime/src/{security,gateway,tools}/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
Treat
src/security/,src/gateway/,src/tools/as high-risk surfaces and never broaden filesystem/network execution scope without explicit policy checks
Files:
clients/agent-runtime/src/tools/traits.rs
clients/agent-runtime/src/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
clients/agent-runtime/src/**/*.rs: Never log secrets, tokens, raw credentials, or sensitive payloads in any logging statements
Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency
Files:
clients/agent-runtime/src/tools/traits.rs
clients/agent-runtime/src/{security,gateway,tools,config}/**/*.rs
📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)
Do not silently weaken security policy or access constraints; keep default behavior secure-by-default with deny-by-default where applicable
Files:
clients/agent-runtime/src/tools/traits.rs
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/tools/**/*.rs : Implement `Tool` trait in `src/tools/` with strict parameter schema, validate and sanitize all inputs, and return structured `ToolResult` without panics in runtime path
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/tools/**/*.rs : Implement `Tool` trait in `src/tools/` with strict parameter schema, validate and sanitize all inputs, and return structured `ToolResult` without panics in runtime path
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/tests/traits_api_compat.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/Cargo.tomlclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/{security,gateway,tools}/**/*.rs : Treat `src/security/`, `src/gateway/`, `src/tools/` as high-risk surfaces and never broaden filesystem/network execution scope without explicit policy checks
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/Cargo.tomlclients/agent-runtime/tests/traits_api_compat.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/Cargo.tomlclients/agent-runtime/tests/traits_api_compat.rsclients/agent-runtime/src/tools/traits.rsclients/agent-runtime/crates/corvus-traits/src/tools.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/lib.rsclients/agent-runtime/crates/corvus-traits/src/testing.rsclients/agent-runtime/crates/corvus-traits/Cargo.tomlclients/agent-runtime/src/tools/traits.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/channels/**/*.rs : Implement `Channel` trait in `src/channels/` with consistent `send`, `listen`, and `health_check` semantics and cover auth/allowlist/health behavior with tests
Applied to files:
clients/agent-runtime/crates/corvus-traits/src/channels.rsclients/agent-runtime/tests/traits_api_compat.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/{security,gateway,tools,config}/**/*.rs : Do not silently weaken security policy or access constraints; keep default behavior secure-by-default with deny-by-default where applicable
Applied to files:
clients/agent-runtime/src/tools/traits.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/**/*.rs : Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency
Applied to files:
clients/agent-runtime/src/tools/traits.rs
🔇 Additional comments (3)
clients/agent-runtime/crates/corvus-traits/Cargo.toml (1)
15-19: Nicetokiofeature split.Keeping
syncin normal deps and movingmacros/rtintodev-dependenciespreserves the smaller runtime surface while still supporting the crate’s async tests.Based on learnings "Preserve release-size profile assumptions in
Cargo.tomland avoid adding heavy dependencies unless clearly justified".clients/agent-runtime/crates/corvus-traits/src/channels.rs (1)
70-74: Good compatibility fallback.Returning legacy
contentwhen the multimodal parts contain no extractable text prevents empty projections for older text-only callers.clients/agent-runtime/src/tools/traits.rs (1)
3-6: Good compatibility shim.Directly re-exporting the canonical symbols is the right shape here; it preserves trait and type identity for legacy imports instead of introducing adapter drift.
| #[allow(dead_code)] | ||
| #[derive(Debug, Default, Clone, Copy)] | ||
| pub struct TraitHarness; | ||
| pub(crate) struct TraitHarness; |
There was a problem hiding this comment.
Keep the exported harness public, or make the module private.
clients/agent-runtime/crates/corvus-traits/src/lib.rs still exposes pub mod testing;, but TraitHarness is now pub(crate). That leaves downstream crates with no usable compliance-test surface, which undercuts the extraction goal for shared harness scaffolding.
Suggested fix
-#[allow(dead_code)]
#[derive(Debug, Default, Clone, Copy)]
-pub(crate) struct TraitHarness;
+pub struct TraitHarness;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@clients/agent-runtime/crates/corvus-traits/src/testing.rs` around lines 4 -
6, The testing harness struct is currently declared pub(crate) (TraitHarness)
while the crate still exposes pub mod testing, so downstream crates cannot use
the harness; either make the harness fully exported by changing TraitHarness's
visibility from pub(crate) to pub, or if the harness should remain internal,
stop exporting the module by removing or changing the pub mod testing
declaration in lib.rs; locate the TraitHarness declaration in testing.rs and
adjust its visibility to pub, or update lib.rs to make the testing module
private to resolve the mismatch.
| fn validate_tool_schema(schema: &serde_json::Value) -> anyhow::Result<()> { | ||
| let obj = schema | ||
| .as_object() | ||
| .ok_or_else(|| anyhow::anyhow!("Schema must be an object"))?; | ||
|
|
||
| if !obj.contains_key("type") { | ||
| anyhow::bail!("Schema missing required 'type' field"); | ||
| } | ||
|
|
||
| if let Some(serde_json::Value::String(schema_type)) = obj.get("type") { | ||
| if schema_type == "object" && !obj.contains_key("properties") { | ||
| tracing::warn!("Object schema without 'properties' field may cause issues"); | ||
| } | ||
| } |
There was a problem hiding this comment.
Reject non-object parameter schemas.
validate_tool_schema() currently accepts any schema that merely has a "type" field, so "type": "string" passes spec(). For tool/function-calling parameters, that produces a spec the caller cannot bind like an argument object.
Suggested tightening
fn validate_tool_schema(schema: &serde_json::Value) -> anyhow::Result<()> {
let obj = schema
.as_object()
.ok_or_else(|| anyhow::anyhow!("Schema must be an object"))?;
- if !obj.contains_key("type") {
- anyhow::bail!("Schema missing required 'type' field");
- }
-
- if let Some(serde_json::Value::String(schema_type)) = obj.get("type") {
- if schema_type == "object" && !obj.contains_key("properties") {
- tracing::warn!("Object schema without 'properties' field may cause issues");
- }
- }
+ match obj.get("type") {
+ Some(serde_json::Value::String(schema_type)) if schema_type == "object" => {
+ if !obj.contains_key("properties") && !obj.contains_key("additionalProperties") {
+ tracing::warn!(
+ "Object schema without 'properties' or 'additionalProperties' may cause issues"
+ );
+ }
+ }
+ Some(serde_json::Value::String(schema_type)) => {
+ anyhow::bail!("Tool parameter schema must have type 'object', got '{schema_type}'");
+ }
+ _ => anyhow::bail!("Schema missing required 'type' field"),
+ }
Ok(())
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn validate_tool_schema(schema: &serde_json::Value) -> anyhow::Result<()> { | |
| let obj = schema | |
| .as_object() | |
| .ok_or_else(|| anyhow::anyhow!("Schema must be an object"))?; | |
| if !obj.contains_key("type") { | |
| anyhow::bail!("Schema missing required 'type' field"); | |
| } | |
| if let Some(serde_json::Value::String(schema_type)) = obj.get("type") { | |
| if schema_type == "object" && !obj.contains_key("properties") { | |
| tracing::warn!("Object schema without 'properties' field may cause issues"); | |
| } | |
| } | |
| fn validate_tool_schema(schema: &serde_json::Value) -> anyhow::Result<()> { | |
| let obj = schema | |
| .as_object() | |
| .ok_or_else(|| anyhow::anyhow!("Schema must be an object"))?; | |
| match obj.get("type") { | |
| Some(serde_json::Value::String(schema_type)) if schema_type == "object" => { | |
| if !obj.contains_key("properties") && !obj.contains_key("additionalProperties") { | |
| tracing::warn!( | |
| "Object schema without 'properties' or 'additionalProperties' may cause issues" | |
| ); | |
| } | |
| } | |
| Some(serde_json::Value::String(schema_type)) => { | |
| anyhow::bail!("Tool parameter schema must have type 'object', got '{schema_type}'"); | |
| } | |
| _ => anyhow::bail!("Schema missing required 'type' field"), | |
| } | |
| Ok(()) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@clients/agent-runtime/crates/corvus-traits/src/tools.rs` around lines 92 -
105, validate_tool_schema currently accepts any schema with a "type" field,
allowing non-object types (e.g., "type":"string") which breaks function-calling
parameter binding; update validate_tool_schema so that if a "type" field exists
it must be the string "object" (otherwise return an error via anyhow::bail), and
keep the existing warning when an object schema lacks "properties"; reference
validate_tool_schema and the "type"/"properties" keys when making the change so
spec() only receives object-typed parameter schemas.
| assert_eq!( | ||
| TypeId::of::<&dyn RuntimeTool>(), | ||
| TypeId::of::<&dyn corvus_traits::tools::Tool>() | ||
| ); | ||
| assert_eq!( | ||
| TypeId::of::<&dyn tools::traits::Tool>(), | ||
| TypeId::of::<&dyn corvus_traits::tools::Tool>() | ||
| ); | ||
| assert_eq!( | ||
| TypeId::of::<RuntimeToolResult>(), | ||
| TypeId::of::<corvus_traits::tools::ToolResult>() | ||
| ); | ||
| assert_eq!( | ||
| TypeId::of::<RuntimeToolSpec>(), | ||
| TypeId::of::<corvus_traits::tools::ToolSpec>() | ||
| ); |
There was a problem hiding this comment.
Extend the compat assertions to the moved metadata types.
This suite locks Tool, ToolResult, and ToolSpec, but the shim also re-exports ToolSourceMetadata and the descriptor hint structs. Without asserting those too, part of the extracted public surface can drift unnoticed.
Suggested assertions
assert_eq!(
TypeId::of::<RuntimeToolSpec>(),
TypeId::of::<corvus_traits::tools::ToolSpec>()
);
+ assert_eq!(
+ TypeId::of::<tools::traits::ToolSourceMetadata>(),
+ TypeId::of::<corvus_traits::tools::ToolSourceMetadata>()
+ );
+ assert_eq!(
+ TypeId::of::<tools::traits::ToolDescriptorHint>(),
+ TypeId::of::<corvus_traits::tools::ToolDescriptorHint>()
+ );
+ assert_eq!(
+ TypeId::of::<tools::traits::ToolDescriptorMcpHint>(),
+ TypeId::of::<corvus_traits::tools::ToolDescriptorMcpHint>()
+ );
+ assert_eq!(
+ TypeId::of::<tools::traits::ToolDescriptorMcpPromptArgumentHint>(),
+ TypeId::of::<corvus_traits::tools::ToolDescriptorMcpPromptArgumentHint>()
+ );📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| assert_eq!( | |
| TypeId::of::<&dyn RuntimeTool>(), | |
| TypeId::of::<&dyn corvus_traits::tools::Tool>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<&dyn tools::traits::Tool>(), | |
| TypeId::of::<&dyn corvus_traits::tools::Tool>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<RuntimeToolResult>(), | |
| TypeId::of::<corvus_traits::tools::ToolResult>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<RuntimeToolSpec>(), | |
| TypeId::of::<corvus_traits::tools::ToolSpec>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<&dyn RuntimeTool>(), | |
| TypeId::of::<&dyn corvus_traits::tools::Tool>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<&dyn tools::traits::Tool>(), | |
| TypeId::of::<&dyn corvus_traits::tools::Tool>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<RuntimeToolResult>(), | |
| TypeId::of::<corvus_traits::tools::ToolResult>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<RuntimeToolSpec>(), | |
| TypeId::of::<corvus_traits::tools::ToolSpec>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<tools::traits::ToolSourceMetadata>(), | |
| TypeId::of::<corvus_traits::tools::ToolSourceMetadata>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<tools::traits::ToolDescriptorHint>(), | |
| TypeId::of::<corvus_traits::tools::ToolDescriptorHint>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<tools::traits::ToolDescriptorMcpHint>(), | |
| TypeId::of::<corvus_traits::tools::ToolDescriptorMcpHint>() | |
| ); | |
| assert_eq!( | |
| TypeId::of::<tools::traits::ToolDescriptorMcpPromptArgumentHint>(), | |
| TypeId::of::<corvus_traits::tools::ToolDescriptorMcpPromptArgumentHint>() | |
| ); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@clients/agent-runtime/tests/traits_api_compat.rs` around lines 167 - 182,
Extend the TypeId compatibility assertions to cover the moved metadata types:
add assert_eq! checks comparing TypeId::of::<ToolSourceMetadata>() and each
descriptor hint struct re-exported by the shim (the same names as in
corvus_traits, e.g., any ToolDescriptorHint types) against their corvus_traits
counterparts (TypeId::of::<corvus_traits::...>()) just like the existing
assertions for RuntimeTool, ToolResult, and ToolSpec; place these new assert_eq!
lines alongside the existing assertions so the test fails if those re-exports
drift.
6df8efa
into
feature/capability-architecture
Related Issues
closes #431
Summary
Toolcontract, metadata types, and defaultspec()implementation intoclients/agent-runtime/crates/corvus-traits/src/tools.rsclients/agent-runtime/src/tools/traits.rsas a compatibility shim so legacy imports still resolve to the same tool trait and metadata identitiesTool::spec()validation behavior with a minimal extracted schema validator and add compatibility coverage for legacy/new tool pathsTested Information
cargo test --manifest-path Cargo.toml --test traits_api_compat(RED: failed before implementation becausecorvus_traits::toolsdid not exist)cargo test --manifest-path Cargo.toml --test traits_api_compatcargo test --manifest-path Cargo.toml -p corvus-traits tools::testscargo clippy --manifest-path Cargo.toml -p corvus-traits --all-targets -- -D warningscargo clippy --manifest-path Cargo.toml -p corvus --test traits_api_compat -- -D warningscargo fmt --all -- --checkcargo test(ran via pre-push hook; 3507 passed)Documentation Impact
corvus-traitsand preserves the existing public/runtime behavior through a compatibility shim.Breaking Changes
None.
Checklist