UAT: agents validation detach confirmation prompt and output format deviate from spec — shows attachment ID only, missing validation/resource/scope #4678

Open
opened 2026-04-08 17:59:59 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Tested by: UAT tester instance uat-tester-validation-deep-dive
Feature area: Validation system — agents validation detach command output format
Severity: Medium — confirmation prompt and all output formats deviate from spec
Source: src/cleveragents/cli/commands/validation.py


Summary

The agents validation detach command has three spec deviations: (1) the confirmation prompt shows only the raw attachment ID instead of the human-readable validation name + resource + scope; (2) the rich output is plain text instead of a Panel; (3) the JSON/YAML output uses the wrong key structure.


Deviations Found

1. Confirmation prompt shows only attachment ID

Actual (line 393 of validation.py):

confirm = typer.confirm(f"Detach validation attachment '{attachment_id}'?")

Expected (spec §9805–9807):

Detach validation local/run-tests from resource local/api-repo (scope: project local/api-service)? [y/N]: y

The spec shows the confirmation prompt with the validation name, resource name, and scope — not just the opaque attachment ULID. This requires looking up the attachment record before prompting (using get_by_id on the repository, or having the service return the full attachment details). The current implementation never fetches the attachment details before prompting, so users cannot tell what they are about to detach.


2. Rich output: plain text instead of Panel

Actual (line 410 of validation.py):

console.print(f"[green]Detached validation:[/green] {attachment_id}")

Expected (spec §9809–9816):

╭─ Validation Detached ───────────────────────────────────────╮
│ Attachment ID: 01HXM5A1B2C3D4E5F6G7H8J9K0                   │
│ Validation: local/run-tests                                  │
│ Resource: local/api-repo                                     │
│ Scope: project local/api-service                             │
╰─────────────────────────────────────────────────────────────╯

✓ OK Validation detached

The spec requires a rich.panel.Panel with Attachment ID, Validation, Resource, and Scope fields.


3. JSON/YAML output: wrong key structure

Actual (lines 405–408 of validation.py):

data = {"attachment_id": attachment_id, "detached": True}
console.print(format_output(data, fmt))

Expected (spec §9837–9874):

{
  "data": {
    "validation_detached": {
      "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0",
      "validation": "local/run-tests",
      "resource": "local/api-repo",
      "scope": "project local/api-service"
    },
    "confirmation": "Detach validation local/run-tests from resource local/api-repo (scope: project local/api-service)? [y/N]: y"
  }
}

The spec uses:

  • validation_detached as the top-level key (not a flat dict with detached: true)
  • validation, resource, scope fields (not just attachment_id)
  • A confirmation field recording the prompt text

Root Cause

The detach command never fetches the attachment record before proceeding. It only has the attachment_id string. To implement the spec-compliant confirmation prompt and output, the command needs to:

  1. Call service.get_attachment(attachment_id) (or equivalent) to retrieve the full attachment details before prompting.
  2. Use those details to build the human-readable confirmation message.
  3. Use those details to populate the Panel and structured output after detaching.

The ValidationAttachmentRepository.get_by_id method exists (lines 3974–4002 of repositories.py) but is not exposed through ToolRegistryService. The service needs a get_attachment method, or the CLI needs direct access to the repository.


Code Location

src/cleveragents/cli/commands/validation.py

  • detach command: lines 370–411
  • Confirmation prompt: line 393
  • Rich output: line 410
  • JSON/YAML output: lines 405–408

src/cleveragents/application/services/tool_registry_service.py

  • Missing get_attachment method (only detach_validation and list_validations_for_resource exist)

Fix Outline

  1. Add get_attachment(attachment_id) to ToolRegistryService (delegates to attachment_repo.get_by_id).
  2. In detach command: fetch attachment details before prompting; build confirmation message from validation/resource/scope.
  3. Replace plain console.print with a Panel containing Attachment ID, Validation, Resource, Scope.
  4. Replace flat {"attachment_id": ..., "detached": True} with {"validation_detached": {...}, "confirmation": "..."}.

Commit Message: fix(cli): align agents validation detach confirmation prompt and output with spec


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Tested by:** UAT tester instance `uat-tester-validation-deep-dive` **Feature area:** Validation system — `agents validation detach` command output format **Severity:** Medium — confirmation prompt and all output formats deviate from spec **Source:** `src/cleveragents/cli/commands/validation.py` --- ## Summary The `agents validation detach` command has three spec deviations: (1) the confirmation prompt shows only the raw attachment ID instead of the human-readable validation name + resource + scope; (2) the rich output is plain text instead of a Panel; (3) the JSON/YAML output uses the wrong key structure. --- ## Deviations Found ### 1. Confirmation prompt shows only attachment ID **Actual (line 393 of `validation.py`):** ```python confirm = typer.confirm(f"Detach validation attachment '{attachment_id}'?") ``` **Expected (spec §9805–9807):** ``` Detach validation local/run-tests from resource local/api-repo (scope: project local/api-service)? [y/N]: y ``` The spec shows the confirmation prompt with the **validation name**, **resource name**, and **scope** — not just the opaque attachment ULID. This requires looking up the attachment record before prompting (using `get_by_id` on the repository, or having the service return the full attachment details). The current implementation never fetches the attachment details before prompting, so users cannot tell what they are about to detach. --- ### 2. Rich output: plain text instead of Panel **Actual (line 410 of `validation.py`):** ```python console.print(f"[green]Detached validation:[/green] {attachment_id}") ``` **Expected (spec §9809–9816):** ``` ╭─ Validation Detached ───────────────────────────────────────╮ │ Attachment ID: 01HXM5A1B2C3D4E5F6G7H8J9K0 │ │ Validation: local/run-tests │ │ Resource: local/api-repo │ │ Scope: project local/api-service │ ╰─────────────────────────────────────────────────────────────╯ ✓ OK Validation detached ``` The spec requires a `rich.panel.Panel` with `Attachment ID`, `Validation`, `Resource`, and `Scope` fields. --- ### 3. JSON/YAML output: wrong key structure **Actual (lines 405–408 of `validation.py`):** ```python data = {"attachment_id": attachment_id, "detached": True} console.print(format_output(data, fmt)) ``` **Expected (spec §9837–9874):** ```json { "data": { "validation_detached": { "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0", "validation": "local/run-tests", "resource": "local/api-repo", "scope": "project local/api-service" }, "confirmation": "Detach validation local/run-tests from resource local/api-repo (scope: project local/api-service)? [y/N]: y" } } ``` The spec uses: - `validation_detached` as the top-level key (not a flat dict with `detached: true`) - `validation`, `resource`, `scope` fields (not just `attachment_id`) - A `confirmation` field recording the prompt text --- ## Root Cause The `detach` command never fetches the attachment record before proceeding. It only has the `attachment_id` string. To implement the spec-compliant confirmation prompt and output, the command needs to: 1. Call `service.get_attachment(attachment_id)` (or equivalent) to retrieve the full attachment details before prompting. 2. Use those details to build the human-readable confirmation message. 3. Use those details to populate the Panel and structured output after detaching. The `ValidationAttachmentRepository.get_by_id` method exists (lines 3974–4002 of `repositories.py`) but is not exposed through `ToolRegistryService`. The service needs a `get_attachment` method, or the CLI needs direct access to the repository. --- ## Code Location `src/cleveragents/cli/commands/validation.py` - `detach` command: lines 370–411 - Confirmation prompt: line 393 - Rich output: line 410 - JSON/YAML output: lines 405–408 `src/cleveragents/application/services/tool_registry_service.py` - Missing `get_attachment` method (only `detach_validation` and `list_validations_for_resource` exist) --- ## Fix Outline 1. Add `get_attachment(attachment_id)` to `ToolRegistryService` (delegates to `attachment_repo.get_by_id`). 2. In `detach` command: fetch attachment details before prompting; build confirmation message from `validation`/`resource`/`scope`. 3. Replace plain `console.print` with a `Panel` containing `Attachment ID`, `Validation`, `Resource`, `Scope`. 4. Replace flat `{"attachment_id": ..., "detached": True}` with `{"validation_detached": {...}, "confirmation": "..."}`. --- **Commit Message:** `fix(cli): align agents validation detach confirmation prompt and output with spec` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-08 18:05:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#4678
No description provided.