Files
freemo abf250901f
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 33s
CI / typecheck (pull_request) Successful in 51s
CI / security (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 53s
CI / unit_tests (pull_request) Failing after 2m4s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m4s
CI / integration_tests (pull_request) Successful in 23m32s
CI / coverage (pull_request) Failing after 2m7s
CI / status-check (pull_request) Failing after 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m42s
fix(tool): implement tool_type filter in ToolRegistry.list_tools()
The tool_type parameter in ToolRegistry.list_tools() was explicitly
silenced with '_ = tool_type', making it a no-op. Both
'agents tool list --type validation' and 'agents tool list --type tool'
returned the full unfiltered tool list.

Changes:
- src/cleveragents/tool/runtime.py: Add tool_type: Literal['tool',
  'validation'] field to ToolSpec (default 'tool') so the registry
  has a discriminator to filter on.
- src/cleveragents/tool/registry.py: Remove '_ = tool_type' no-op and
  implement actual filter: specs = [s for s in specs if s.tool_type == tool_type].
  Update docstring to reflect the parameter is now active.
- features/consolidated_tool.feature: Add 7 comprehensive Behave
  scenarios covering all filter combinations (tool, validation, None,
  default type, exclusion).
- features/steps/tool_runtime_steps.py: Add step definition for
  registering a ToolSpec with an explicit tool_type.
- robot/helper_tool_cli.py: Add tool_list_type_tool() and
  tool_list_type_validation() helper functions that verify the CLI
  passes tool_type through to the service layer.
- robot/tool_cli.robot: Add two Robot test cases for
  'tool list --type tool' and 'tool list --type validation'.

The CLI handler (cli/commands/tool.py) and database repository
(infrastructure/database/repositories.py) already passed tool_type
through correctly — no changes needed there.

ISSUES CLOSED: #2974
2026-04-05 17:49:35 +00:00

74 lines
3.5 KiB
Plaintext

*** Settings ***
Documentation Smoke tests for Tool and Validation CLI commands
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER} ${CURDIR}/helper_tool_cli.py
*** Test Cases ***
Tool Add Config Creates Tool
[Documentation] Verify that ``tool add --config`` registers a tool
${result}= Run Process ${PYTHON} ${HELPER} tool-add-config cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tool-cli-add-config-ok
Tool List Shows Tools
[Documentation] Verify that ``tool list`` shows registered tools
${result}= Run Process ${PYTHON} ${HELPER} tool-list cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tool-cli-list-ok
Tool Show Accepts Namespaced Name
[Documentation] Verify that ``tool show`` accepts a namespaced name argument
${result}= Run Process ${PYTHON} ${HELPER} tool-show cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tool-cli-show-ok
Tool Remove Accepts Namespaced Name
[Documentation] Verify that ``tool remove --yes`` removes a tool
${result}= Run Process ${PYTHON} ${HELPER} tool-remove cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tool-cli-remove-ok
Validation Add Config Creates Validation
[Documentation] Verify that ``validation add --config`` registers a validation
${result}= Run Process ${PYTHON} ${HELPER} validation-add-config cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} validation-cli-add-ok
Validation Attach Links Validation To Resource
[Documentation] Verify that ``validation attach`` links a validation to a resource
${result}= Run Process ${PYTHON} ${HELPER} validation-attach cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} validation-cli-attach-ok
Validation Detach Removes Attachment
[Documentation] Verify that ``validation detach --yes`` removes an attachment
${result}= Run Process ${PYTHON} ${HELPER} validation-detach cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} validation-cli-detach-ok
Tool List Type Tool Filter Works
[Documentation] Verify that ``tool list --type tool`` passes tool_type to service
${result}= Run Process ${PYTHON} ${HELPER} tool-list-type-tool cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tool-cli-list-type-tool-ok
Tool List Type Validation Filter Works
[Documentation] Verify that ``tool list --type validation`` passes tool_type to service
${result}= Run Process ${PYTHON} ${HELPER} tool-list-type-validation cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tool-cli-list-type-validation-ok