fix(cli): remove extra --mode flag from validation attach #1305

Merged
freemo merged 1 commits from fix/validation-attach-remove-mode-flag into master 2026-04-02 17:07:26 +00:00
Owner

Summary

Remove the --mode/-m CLI flag from validation attach to align with the specification. The validation mode is an inherent property of the validation definition, set at registration time via validation add, not a per-attachment override.

Changes

CLI Layer (src/cleveragents/cli/commands/validation.py)

  • Removed the --mode/-m Typer option from the attach() command
  • Updated docstring to clarify mode comes from the validation definition
  • Removed mode=mode from the service.attach_validation() call

Service Layer (src/cleveragents/application/services/tool_registry_service.py)

  • Removed mode parameter from attach_validation() signature
  • The method now reads mode from the validation's registered definition via self._tool_repo.get_by_name()
  • Removed unused ValidationError import (no longer needed without mode validation)

Repository Layer (src/cleveragents/infrastructure/database/repositories.py)

  • Added mode to ToolRegistryRepository._to_legacy_domain() so the mode field is available from tool lookups

Test Updates

  • Removed "Attach validation with mode informational" scenario from features/tool_cli.feature
  • Removed step_run_validation_attach_mode step from features/steps/tool_cli_steps.py
  • Removed 3 "invalid mode" service-layer scenarios from features/consolidated_tool.feature
  • Updated service-layer attach step definitions to not pass mode
  • Updated mock sentinel to include mode field
  • Updated Robot Framework helpers to not pass mode to attach_validation()

Quality Gates

All 11 nox sessions pass:

  • lint | format | typecheck | security_scan | dead_code
  • unit_tests | integration_tests | e2e_tests
  • docs | build | benchmark
  • coverage_report (98.7% >= 97%)

Closes #913

## Summary Remove the `--mode/-m` CLI flag from `validation attach` to align with the specification. The validation mode is an inherent property of the validation definition, set at registration time via `validation add`, not a per-attachment override. ## Changes ### CLI Layer (`src/cleveragents/cli/commands/validation.py`) - Removed the `--mode/-m` Typer option from the `attach()` command - Updated docstring to clarify mode comes from the validation definition - Removed `mode=mode` from the `service.attach_validation()` call ### Service Layer (`src/cleveragents/application/services/tool_registry_service.py`) - Removed `mode` parameter from `attach_validation()` signature - The method now reads mode from the validation's registered definition via `self._tool_repo.get_by_name()` - Removed unused `ValidationError` import (no longer needed without mode validation) ### Repository Layer (`src/cleveragents/infrastructure/database/repositories.py`) - Added `mode` to `ToolRegistryRepository._to_legacy_domain()` so the mode field is available from tool lookups ### Test Updates - Removed "Attach validation with mode informational" scenario from `features/tool_cli.feature` - Removed `step_run_validation_attach_mode` step from `features/steps/tool_cli_steps.py` - Removed 3 "invalid mode" service-layer scenarios from `features/consolidated_tool.feature` - Updated service-layer attach step definitions to not pass `mode` - Updated mock sentinel to include `mode` field - Updated Robot Framework helpers to not pass `mode` to `attach_validation()` ## Quality Gates All 11 nox sessions pass: - lint ✅ | format ✅ | typecheck ✅ | security_scan ✅ | dead_code ✅ - unit_tests ✅ | integration_tests ✅ | e2e_tests ✅ - docs ✅ | build ✅ | benchmark ✅ - coverage_report ✅ (98.7% >= 97%) Closes #913
brent.edwards force-pushed fix/validation-attach-remove-mode-flag from a856f52b0b to 9f83786ca4 2026-04-02 09:44:06 +00:00 Compare
brent.edwards added this to the v3.4.0 milestone 2026-04-02 09:44:28 +00:00
brent.edwards added the
Type
Task
label 2026-04-02 09:44:32 +00:00
Author
Owner

Review claimed by reviewer pool instance reviewer-pool-1. Dispatching independent code review.

Review claimed by reviewer pool instance reviewer-pool-1. Dispatching independent code review.
Author
Owner

Code Review — PR #1305: fix(cli): remove extra --mode flag from validation attach

APPROVED

I've reviewed the complete diff across all changed files against the specification and project standards. This is a clean, well-scoped fix.


Specification Alignment

The spec defines validation attach as:

agents validation attach [--project <PROJECT>|--plan <PLAN_ID>]
                         <RESOURCE> <VALIDATION> [<ARGS>...]

The --mode flag was not part of the spec signature. Validation mode is an inherent property of the validation definition, set at registration time via validation add. This PR correctly removes the non-spec --mode/-m flag from the CLI and service layer.

Changes Reviewed

CLI Layer (validation.py): --mode/-m Typer option correctly removed from attach() command. Docstring updated.

Service Layer (tool_registry_service.py): mode parameter removed from attach_validation() signature. Mode now correctly read from the validation's registered definition via self._tool_repo.get_by_name(). Handles both dict and object return types. Type safety maintained with mode_str: str. Unused ValidationError import removed.

Repository Layer (repositories.py): mode field added to _to_legacy_domain() so the service can access it from tool lookups.

Test Updates: CLI scenario for --mode removed. Step definition removed. 3 "invalid mode" service-layer scenarios removed. Service-layer attach steps updated. Mock sentinel updated. Robot Framework helpers updated.

Commit Quality

  • Single atomic commit with Conventional Changelog format
  • ISSUES CLOSED: #913 footer present
  • Branch name follows convention

PR Metadata

  • Closes #913 in PR body
  • Type/Task label present
  • Milestone v3.4.0 matches linked issue
  • Coverage reported at 98.7% (≥ 97% threshold)

No Issues Found

  • No # type: ignore suppressions
  • No secrets or credentials
  • Error handling follows fail-fast principles

Proceeding to merge.

## Code Review — PR #1305: fix(cli): remove extra --mode flag from validation attach ### ✅ APPROVED I've reviewed the complete diff across all changed files against the specification and project standards. This is a clean, well-scoped fix. --- ### Specification Alignment ✅ The spec defines `validation attach` as: ``` agents validation attach [--project <PROJECT>|--plan <PLAN_ID>] <RESOURCE> <VALIDATION> [<ARGS>...] ``` The `--mode` flag was **not** part of the spec signature. Validation mode is an inherent property of the validation definition, set at registration time via `validation add`. This PR correctly removes the non-spec `--mode/-m` flag from the CLI and service layer. ### Changes Reviewed **CLI Layer (`validation.py`)**: `--mode/-m` Typer option correctly removed from `attach()` command. Docstring updated. ✅ **Service Layer (`tool_registry_service.py`)**: `mode` parameter removed from `attach_validation()` signature. Mode now correctly read from the validation's registered definition via `self._tool_repo.get_by_name()`. Handles both dict and object return types. Type safety maintained with `mode_str: str`. Unused `ValidationError` import removed. ✅ **Repository Layer (`repositories.py`)**: `mode` field added to `_to_legacy_domain()` so the service can access it from tool lookups. ✅ **Test Updates**: CLI scenario for `--mode` removed. Step definition removed. 3 "invalid mode" service-layer scenarios removed. Service-layer attach steps updated. Mock sentinel updated. Robot Framework helpers updated. ✅ ### Commit Quality ✅ - Single atomic commit with Conventional Changelog format - `ISSUES CLOSED: #913` footer present - Branch name follows convention ### PR Metadata ✅ - `Closes #913` in PR body - `Type/Task` label present - Milestone v3.4.0 matches linked issue - Coverage reported at 98.7% (≥ 97% threshold) ### No Issues Found - No `# type: ignore` suppressions - No secrets or credentials - Error handling follows fail-fast principles **Proceeding to merge.**
freemo merged commit 1d36449a98 into master 2026-04-02 17:07:26 +00:00
freemo deleted branch fix/validation-attach-remove-mode-flag 2026-04-02 17:07:27 +00:00
Sign in to join this conversation.
No Reviewers
No Label
Type
Task
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#1305