UAT: agents validation attach --format json outputs raw attachment dict instead of spec-required data.validation_attached nested structure #6859

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

Background and Context

The spec (§ "agents validation attach") defines that --format json output must be nested under data.validation_attached with specific field names. Code analysis of src/cleveragents/cli/commands/validation.py shows the implementation outputs a flat attachment dict instead.

Current Behavior

agents validation attach --format json (lines 344–348 of validation.py):

att_data = _attachment_dict(attachment)
if fmt != OutputFormat.RICH.value:
    console.print(format_output(att_data, fmt))
    return

_attachment_dict() (lines 109–129) returns:

{
  "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0",
  "validation_name": "local/run-tests",
  "resource_id": "local/api-repo",
  "mode": "required",
  "project_name": "local/api-service",
  "plan_id": null,
  "created_at": "..."
}

This is a flat dict at the top level with wrong field names (validation_name instead of validation, resource_id instead of resource, project_name → missing scope field).

Expected Behavior

Per spec, agents validation attach --project local/api-service local/api-repo local/run-tests --format json must produce:

{
  "command": "validation attach",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "validation_attached": {
      "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0",
      "validation": "local/run-tests",
      "mode": "required",
      "resource": "local/api-repo",
      "scope": "project local/api-service"
    }
  },
  "timing": { "started": "...", "duration_ms": 45 },
  "messages": ["Validation attached"]
}

Key differences:

  1. Output must be nested under data.validation_attached (not flat at top level)
  2. Field validation_namevalidation
  3. Field resource_idresource
  4. Field project_name/plan_id must be synthesized into single scope field (e.g. "project local/api-service", "direct (always active)", or "plan <PLAN_ID>")
  5. When args were provided, a args field must also be included in validation_attached

Acceptance Criteria

  • Output nested under data.validation_attached
  • validation field (not validation_name)
  • resource field (not resource_id)
  • scope field synthesized from project/plan/direct context
  • args field included when validation-specific args were passed
  • Add Behave scenario verifying JSON schema for agents validation attach
  • Run nox (all default sessions), fix any errors

Supporting Information

  • Spec: docs/specification.md § "agents validation attach" (JSON tab examples, lines ~9588–9607)
  • Code: src/cleveragents/cli/commands/validation.py lines 109–129, 344–348

Subtasks

  • Update attach command JSON output to use data.validation_attached structure
  • Rename validation_namevalidation, resource_idresource
  • Compute scope string from project/plan/direct context
  • Include args in output when extra args present
  • Tests (Behave): add scenario for validation attach 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 attach") defines that `--format json` output must be nested under `data.validation_attached` with specific field names. Code analysis of `src/cleveragents/cli/commands/validation.py` shows the implementation outputs a flat attachment dict instead. ## Current Behavior `agents validation attach --format json` (lines 344–348 of `validation.py`): ```python att_data = _attachment_dict(attachment) if fmt != OutputFormat.RICH.value: console.print(format_output(att_data, fmt)) return ``` `_attachment_dict()` (lines 109–129) returns: ```json { "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0", "validation_name": "local/run-tests", "resource_id": "local/api-repo", "mode": "required", "project_name": "local/api-service", "plan_id": null, "created_at": "..." } ``` This is a **flat dict at the top level** with wrong field names (`validation_name` instead of `validation`, `resource_id` instead of `resource`, `project_name` → missing `scope` field). ## Expected Behavior Per spec, `agents validation attach --project local/api-service local/api-repo local/run-tests --format json` must produce: ```json { "command": "validation attach", "status": "ok", "exit_code": 0, "data": { "validation_attached": { "attachment_id": "01HXM5A1B2C3D4E5F6G7H8J9K0", "validation": "local/run-tests", "mode": "required", "resource": "local/api-repo", "scope": "project local/api-service" } }, "timing": { "started": "...", "duration_ms": 45 }, "messages": ["Validation attached"] } ``` Key differences: 1. Output must be nested under `data.validation_attached` (not flat at top level) 2. Field `validation_name` → `validation` 3. Field `resource_id` → `resource` 4. Field `project_name`/`plan_id` must be synthesized into single `scope` field (e.g. `"project local/api-service"`, `"direct (always active)"`, or `"plan <PLAN_ID>"`) 5. When args were provided, a `args` field must also be included in `validation_attached` ## Acceptance Criteria - [ ] Output nested under `data.validation_attached` - [ ] `validation` field (not `validation_name`) - [ ] `resource` field (not `resource_id`) - [ ] `scope` field synthesized from project/plan/direct context - [ ] `args` field included when validation-specific args were passed - [ ] Add Behave scenario verifying JSON schema for `agents validation attach` - [ ] Run `nox` (all default sessions), fix any errors ## Supporting Information - Spec: `docs/specification.md` § "agents validation attach" (JSON tab examples, lines ~9588–9607) - Code: `src/cleveragents/cli/commands/validation.py` lines 109–129, 344–348 ## Subtasks - [ ] Update `attach` command JSON output to use `data.validation_attached` structure - [ ] Rename `validation_name` → `validation`, `resource_id` → `resource` - [ ] Compute `scope` string from project/plan/direct context - [ ] Include `args` in output when extra args present - [ ] Tests (Behave): add scenario for `validation attach` 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#6859
No description provided.