UAT: agents validation attach rich/JSON/YAML output deviates from spec — wrong keys, missing scope/note/args, plain text instead of Panel #4673

Open
opened 2026-04-08 17:59:34 +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 attach command output format
Severity: Medium — all output formats deviate from spec
Source: src/cleveragents/cli/commands/validation.py


Summary

The agents validation attach command's output deviates from the spec in every format (rich, JSON, YAML, plain). The implementation uses a simple inline console.print for rich output instead of a Panel, uses wrong field names in structured output, and is missing the scope, note, and args fields entirely.


Deviations Found

1. Rich output: plain text instead of Panel

Actual (lines 350–354 of validation.py):

att_id = att_data.get("attachment_id", "")
console.print(
    f"[green]Attached validation:[/green] {validation_name} -> "
    f"{resource} (id: {att_id})"
)

Expected (spec §9562–9644):

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

✓ OK Validation attached

The spec requires a rich.panel.Panel with Attachment ID, Validation, Mode, Resource, Scope fields, plus an optional Args row when extra args are present, and an optional note line for direct (no-scope) attachments.


2. JSON/YAML output: wrong field names and missing fields

Actual _attachment_dict (lines 109–129 of validation.py):

{
    "attachment_id": ...,
    "validation_name": ...,   # ← wrong key
    "resource_id": ...,       # ← wrong key
    "mode": ...,
    "project_name": ...,      # ← wrong key
    "plan_id": ...,           # ← wrong key
    "created_at": ...,
}

Expected (spec §9596–9784):

{
  "data": {
    "validation_attached": {
      "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0",
      "validation": "local/run-tests",
      "mode": "required",
      "resource": "local/api-repo",
      "scope": "project local/api-service"
    }
  }
}

The spec uses:

  • validation (not validation_name)
  • resource (not resource_id)
  • scope (computed from project_name/plan_id, not raw fields)
  • The whole attachment is nested under data.validation_attached

3. _attachment_dict uses args_json (raw JSON string) instead of parsed args dict

Actual (line 119 in dict branch, line 128 in object branch):

"args_json": attachment.get("args_json"),   # raw JSON string

Expected (spec §9750–9784):

"args": {
  "coverage_threshold": 90
}

The spec shows args as a parsed dict in the output. The implementation stores args_json (a JSON-encoded string) and never deserialises it for output. The format_output call will emit the raw string, not the parsed dict.


4. Missing note field for direct (no-scope) attachments

When no --project or --plan scope is given, the spec shows:

│ Scope: direct (always active)                              │
│ This validation will run for ALL plans/projects            │
│ that access this resource.                                 │

And in JSON:

"note": "This validation will run for ALL plans/projects that access this resource."

The implementation emits no scope or note at all.


Code Location

src/cleveragents/cli/commands/validation.py

  • _attachment_dict function: lines 109–129
  • attach command rich output: lines 350–354

Fix Outline

  1. _attachment_dict: rename validation_namevalidation, resource_idresource; compute scope from project_name/plan_id; deserialise args_jsonargs dict; add note for direct attachments; wrap result under validation_attached key.

  2. attach rich output: replace inline console.print with a Panel containing Attachment ID, Validation, Mode, Resource, Scope rows, optional Args row, optional note line, and a ✓ OK Validation attached footer.


Commit Message: fix(cli): align agents validation attach output with spec — Panel, correct field names, scope, note, args


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 attach` command output format **Severity:** Medium — all output formats deviate from spec **Source:** `src/cleveragents/cli/commands/validation.py` --- ## Summary The `agents validation attach` command's output deviates from the spec in every format (rich, JSON, YAML, plain). The implementation uses a simple inline `console.print` for rich output instead of a `Panel`, uses wrong field names in structured output, and is missing the `scope`, `note`, and `args` fields entirely. --- ## Deviations Found ### 1. Rich output: plain text instead of Panel **Actual (lines 350–354 of `validation.py`):** ```python att_id = att_data.get("attachment_id", "") console.print( f"[green]Attached validation:[/green] {validation_name} -> " f"{resource} (id: {att_id})" ) ``` **Expected (spec §9562–9644):** ``` ╭─ Validation Attached ──────────────────────────────────────╮ │ Attachment ID: 01HXM5A1B2C3D4E5F6G7H8J9K0 │ │ Validation: local/run-tests │ │ Mode: required │ │ Resource: local/api-repo │ │ Scope: project local/api-service │ ╰────────────────────────────────────────────────────────────╯ ✓ OK Validation attached ``` The spec requires a `rich.panel.Panel` with `Attachment ID`, `Validation`, `Mode`, `Resource`, `Scope` fields, plus an optional `Args` row when extra args are present, and an optional note line for direct (no-scope) attachments. --- ### 2. JSON/YAML output: wrong field names and missing fields **Actual `_attachment_dict` (lines 109–129 of `validation.py`):** ```python { "attachment_id": ..., "validation_name": ..., # ← wrong key "resource_id": ..., # ← wrong key "mode": ..., "project_name": ..., # ← wrong key "plan_id": ..., # ← wrong key "created_at": ..., } ``` **Expected (spec §9596–9784):** ```json { "data": { "validation_attached": { "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0", "validation": "local/run-tests", "mode": "required", "resource": "local/api-repo", "scope": "project local/api-service" } } } ``` The spec uses: - `validation` (not `validation_name`) - `resource` (not `resource_id`) - `scope` (computed from `project_name`/`plan_id`, not raw fields) - The whole attachment is nested under `data.validation_attached` --- ### 3. `_attachment_dict` uses `args_json` (raw JSON string) instead of parsed `args` dict **Actual (line 119 in dict branch, line 128 in object branch):** ```python "args_json": attachment.get("args_json"), # raw JSON string ``` **Expected (spec §9750–9784):** ```json "args": { "coverage_threshold": 90 } ``` The spec shows `args` as a parsed dict in the output. The implementation stores `args_json` (a JSON-encoded string) and never deserialises it for output. The `format_output` call will emit the raw string, not the parsed dict. --- ### 4. Missing `note` field for direct (no-scope) attachments When no `--project` or `--plan` scope is given, the spec shows: ``` │ Scope: direct (always active) │ │ This validation will run for ALL plans/projects │ │ that access this resource. │ ``` And in JSON: ```json "note": "This validation will run for ALL plans/projects that access this resource." ``` The implementation emits no `scope` or `note` at all. --- ## Code Location `src/cleveragents/cli/commands/validation.py` - `_attachment_dict` function: lines 109–129 - `attach` command rich output: lines 350–354 --- ## Fix Outline 1. **`_attachment_dict`**: rename `validation_name` → `validation`, `resource_id` → `resource`; compute `scope` from `project_name`/`plan_id`; deserialise `args_json` → `args` dict; add `note` for direct attachments; wrap result under `validation_attached` key. 2. **`attach` rich output**: replace inline `console.print` with a `Panel` containing `Attachment ID`, `Validation`, `Mode`, `Resource`, `Scope` rows, optional `Args` row, optional note line, and a `✓ OK Validation attached` footer. --- **Commit Message:** `fix(cli): align agents validation attach output with spec — Panel, correct field names, scope, note, args` --- **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#4673
No description provided.