UAT: agents validation detach --format json outputs {attachment_id, detached} instead of spec-required data.validation_detached structure with validation, resource, scope fields #6861

Open
opened 2026-04-10 03:42:01 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

The spec (§ "agents validation detach") defines that --format json output must be nested under data.validation_detached and include validation, resource, and scope fields in addition to attachment_id. Code analysis of src/cleveragents/cli/commands/validation.py shows the implementation outputs a minimal 2-field dict instead.

Current Behavior

agents validation detach --format json (lines 405–408 of validation.py):

if fmt != OutputFormat.RICH.value:
    data = {"attachment_id": attachment_id, "detached": True}
    console.print(format_output(data, fmt))
    return

Actual output:

{
  "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0",
  "detached": true
}

This is:

  1. A flat dict at the top level (not nested under data.validation_detached)
  2. Missing validation field (the validation name)
  3. Missing resource field (the resource the validation was attached to)
  4. Missing scope field (the project/plan/direct scope of the attachment)
  5. Using detached: true boolean which is not in the spec

Expected Behavior

Per spec, agents validation detach 01HXM5A1B2C3D4E5F6G7H8J9K0 --format json must produce:

{
  "command": "validation detach",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "validation_detached": {
      "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0",
      "validation": "local/run-tests",
      "resource": "local/api-repo",
      "scope": "project local/api-service"
    }
  },
  "timing": { "started": "...", "duration_ms": 1200 },
  "messages": ["Validation detached"]
}

This requires that before removing the attachment, the service should look up the attachment details (validation name, resource, scope) so they can be included in the response.

Acceptance Criteria

  • JSON output uses data.validation_detached nested structure
  • validation field contains the validation name
  • resource field contains the resource ID
  • scope field contains the scope string
  • Service layer must retrieve attachment details before deletion (or return them as part of the delete operation)
  • Add Behave scenario verifying validation detach JSON schema
  • Run nox (all default sessions), fix any errors

Supporting Information

  • Spec: docs/specification.md § "agents validation detach" (JSON tab, lines ~9835–9873)
  • Code: src/cleveragents/cli/commands/validation.py lines 405–408

Subtasks

  • Update detach_validation() service method to return attachment details (or look up before deletion)
  • Update detach command JSON output to use data.validation_detached structure
  • Include validation, resource, scope in output
  • Tests (Behave): add scenario for validation detach JSON schema
  • Run nox, fix all errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit with Conventional Changelog format first line.
  • Pushed to remote on appropriate branch and submitted as PR to master.

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

## Background and Context The spec (§ "agents validation detach") defines that `--format json` output must be nested under `data.validation_detached` and include `validation`, `resource`, and `scope` fields in addition to `attachment_id`. Code analysis of `src/cleveragents/cli/commands/validation.py` shows the implementation outputs a minimal 2-field dict instead. ## Current Behavior `agents validation detach --format json` (lines 405–408 of `validation.py`): ```python if fmt != OutputFormat.RICH.value: data = {"attachment_id": attachment_id, "detached": True} console.print(format_output(data, fmt)) return ``` Actual output: ```json { "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0", "detached": true } ``` This is: 1. A flat dict at the top level (not nested under `data.validation_detached`) 2. Missing `validation` field (the validation name) 3. Missing `resource` field (the resource the validation was attached to) 4. Missing `scope` field (the project/plan/direct scope of the attachment) 5. Using `detached: true` boolean which is not in the spec ## Expected Behavior Per spec, `agents validation detach 01HXM5A1B2C3D4E5F6G7H8J9K0 --format json` must produce: ```json { "command": "validation detach", "status": "ok", "exit_code": 0, "data": { "validation_detached": { "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0", "validation": "local/run-tests", "resource": "local/api-repo", "scope": "project local/api-service" } }, "timing": { "started": "...", "duration_ms": 1200 }, "messages": ["Validation detached"] } ``` This requires that before removing the attachment, the service should look up the attachment details (validation name, resource, scope) so they can be included in the response. ## Acceptance Criteria - [ ] JSON output uses `data.validation_detached` nested structure - [ ] `validation` field contains the validation name - [ ] `resource` field contains the resource ID - [ ] `scope` field contains the scope string - [ ] Service layer must retrieve attachment details before deletion (or return them as part of the delete operation) - [ ] Add Behave scenario verifying `validation detach` JSON schema - [ ] Run `nox` (all default sessions), fix any errors ## Supporting Information - Spec: `docs/specification.md` § "agents validation detach" (JSON tab, lines ~9835–9873) - Code: `src/cleveragents/cli/commands/validation.py` lines 405–408 ## Subtasks - [ ] Update `detach_validation()` service method to return attachment details (or look up before deletion) - [ ] Update `detach` command JSON output to use `data.validation_detached` structure - [ ] Include `validation`, `resource`, `scope` in output - [ ] Tests (Behave): add scenario for `validation detach` JSON schema - [ ] Run `nox`, fix all errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit with Conventional Changelog format first line. - Pushed to remote on appropriate branch and submitted as PR to `master`. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 04:39:49 +00:00
HAL9000 self-assigned this 2026-04-10 06:06:36 +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#6861
No description provided.