fix(validation): enforce type discriminator in attach_validation to reject plain tools #3317

Closed
freemo wants to merge 1 commits from fix/tool-registry-validation-type-discriminator into master

1 Commits

Author SHA1 Message Date
freemo 94f780e82d fix(validation): enforce type discriminator in attach_validation to reject plain tools
CI / lint (pull_request) Successful in 27s
CI / typecheck (pull_request) Successful in 49s
CI / quality (pull_request) Successful in 34s
CI / security (pull_request) Successful in 57s
CI / build (pull_request) Successful in 17s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Successful in 7m1s
CI / e2e_tests (pull_request) Successful in 18m48s
CI / integration_tests (pull_request) Successful in 22m41s
CI / docker (pull_request) Successful in 1m22s
CI / coverage (pull_request) Successful in 10m51s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Failing after 14m11s
Add tool_type discriminator check in ToolRegistryService.attach_validation()
to enforce the spec requirement that only entries tagged as 'validation' may
be attached. Passing a plain tool (tool_type='tool') now raises ValidationError
instead of silently succeeding.

Changes:
- src/cleveragents/application/services/tool_registry_service.py: Add
  tool_type discriminator check after existence check; raise ValidationError
  when tool_type != 'validation'; update docstring to document enforcement
- features/consolidated_tool.feature: Add TDD scenario for plain tool rejection
- features/steps/tool_registry_service_coverage_steps.py: Add Given step for
  plain tool entry and Then step for ValidationError assertion
- robot/tool_cli.robot: Add integration test 'Validation Attach Rejects Plain Tool'
- robot/helper_tool_cli.py: Add validation_attach_plain_tool() helper function

ISSUES CLOSED: #2912
2026-04-05 09:35:20 +00:00