UAT: agents automation-profile remove JSON output returns full profile dict with removed: true instead of spec-required {"name": "..."} only #2085

Open
opened 2026-04-03 03:56:25 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/automation-profile-remove-json-output
  • Commit Message: fix(cli): correct automation-profile remove JSON output to return only name per spec
  • Milestone: v3.7.0
  • Parent Epic: #362

Summary

The agents automation-profile remove command's JSON output returns the full profile dict with an added "removed": true field, but the specification requires only {"name": "<profile-name>"} in the data field. Additionally, the rich output uses a plain text message instead of the spec-required "Profile Removed" panel.

Expected Behavior (from spec)

Per docs/specification.md lines 16901–16925, the JSON output for remove should be:

{
  "command": "automation-profile remove",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "name": "local/careful-auto"
  },
  "timing": { "started": "2026-02-08T14:31:00Z", "duration_ms": 40 },
  "messages": ["Profile removed"]
}

The rich output should show a "Profile Removed" panel with just the name:

╭─ Profile Removed ──────────╮
│ Name: local/careful-auto   │
╰────────────────────────────╯

✓ OK Profile removed

Actual Behavior

In src/cleveragents/cli/commands/automation_profile.py lines 298–302:

if fmt != OutputFormat.RICH.value:
    data = _profile_spec_dict(profile)
    data["removed"] = True
    console.print(format_output(data, fmt))
    return

The command returns the full profile dict (with phase_transitions, decision_automation, self_repair, execution_controls, guards, schema_version, source, description) plus "removed": True, instead of just {"name": "local/careful-auto"}.

Additionally, the rich output (line 303) prints "✓ Automation profile removed: {name}" as a plain text message, not as a "Profile Removed" panel.

Impact

  • Programmatic consumers of --format json output receive an unexpectedly large response
  • The data field structure is inconsistent with the spec
  • The rich output doesn't use the spec-required "Profile Removed" panel

Steps to Reproduce

# First add a profile
agents automation-profile add --config ./profile.yaml

# Then remove it
agents automation-profile remove acme/test-profile --yes --format json
# Expected: {"data": {"name": "acme/test-profile"}}
# Actual: {"data": {"name": "acme/test-profile", "description": "...", "source": "custom", "phase_transitions": {...}, ..., "removed": true}}

Code Location

  • src/cleveragents/cli/commands/automation_profile.py lines 296–305: remove_profile() function, non-rich format branch
  • src/cleveragents/cli/commands/automation_profile.py line 303: rich output uses plain text instead of a panel

Subtasks

  • Change the non-rich output branch in remove_profile() to return {"name": profile.name} instead of the full profile dict with "removed": True
  • Implement a "Profile Removed" rich panel in remove_profile() that displays only the profile name (matching spec layout)
  • Ensure the messages field in JSON output is ["Profile removed"] (lowercase, matching spec)
  • Ensure the rich output footer shows ✓ OK Profile removed after the panel
  • Tests (Behave): Add/update scenarios asserting remove JSON output contains only {"name": "..."} in data (no extra fields, no removed key)
  • Tests (Behave): Add/update scenarios asserting remove rich output renders a "Profile Removed" panel with the name
  • Tests (Robot): Add/update integration test asserting --format json output structure for automation-profile remove
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

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

## Metadata - **Branch**: `fix/automation-profile-remove-json-output` - **Commit Message**: `fix(cli): correct automation-profile remove JSON output to return only name per spec` - **Milestone**: v3.7.0 - **Parent Epic**: #362 ## Summary The `agents automation-profile remove` command's JSON output returns the full profile dict with an added `"removed": true` field, but the specification requires only `{"name": "<profile-name>"}` in the `data` field. Additionally, the rich output uses a plain text message instead of the spec-required "Profile Removed" panel. ## Expected Behavior (from spec) Per `docs/specification.md` lines 16901–16925, the JSON output for `remove` should be: ```json { "command": "automation-profile remove", "status": "ok", "exit_code": 0, "data": { "name": "local/careful-auto" }, "timing": { "started": "2026-02-08T14:31:00Z", "duration_ms": 40 }, "messages": ["Profile removed"] } ``` The rich output should show a "Profile Removed" panel with just the name: ``` ╭─ Profile Removed ──────────╮ │ Name: local/careful-auto │ ╰────────────────────────────╯ ✓ OK Profile removed ``` ## Actual Behavior In `src/cleveragents/cli/commands/automation_profile.py` lines 298–302: ```python if fmt != OutputFormat.RICH.value: data = _profile_spec_dict(profile) data["removed"] = True console.print(format_output(data, fmt)) return ``` The command returns the full profile dict (with `phase_transitions`, `decision_automation`, `self_repair`, `execution_controls`, `guards`, `schema_version`, `source`, `description`) plus `"removed": True`, instead of just `{"name": "local/careful-auto"}`. Additionally, the rich output (line 303) prints `"✓ Automation profile removed: {name}"` as a plain text message, not as a "Profile Removed" panel. ## Impact - Programmatic consumers of `--format json` output receive an unexpectedly large response - The `data` field structure is inconsistent with the spec - The rich output doesn't use the spec-required "Profile Removed" panel ## Steps to Reproduce ```bash # First add a profile agents automation-profile add --config ./profile.yaml # Then remove it agents automation-profile remove acme/test-profile --yes --format json # Expected: {"data": {"name": "acme/test-profile"}} # Actual: {"data": {"name": "acme/test-profile", "description": "...", "source": "custom", "phase_transitions": {...}, ..., "removed": true}} ``` ## Code Location - `src/cleveragents/cli/commands/automation_profile.py` lines 296–305: `remove_profile()` function, non-rich format branch - `src/cleveragents/cli/commands/automation_profile.py` line 303: rich output uses plain text instead of a panel ## Subtasks - [ ] Change the non-rich output branch in `remove_profile()` to return `{"name": profile.name}` instead of the full profile dict with `"removed": True` - [ ] Implement a "Profile Removed" rich panel in `remove_profile()` that displays only the profile name (matching spec layout) - [ ] Ensure the `messages` field in JSON output is `["Profile removed"]` (lowercase, matching spec) - [ ] Ensure the rich output footer shows `✓ OK Profile removed` after the panel - [ ] Tests (Behave): Add/update scenarios asserting `remove` JSON output contains only `{"name": "..."}` in `data` (no extra fields, no `removed` key) - [ ] Tests (Behave): Add/update scenarios asserting `remove` rich output renders a "Profile Removed" panel with the name - [ ] Tests (Robot): Add/update integration test asserting `--format json` output structure for `automation-profile remove` - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.7.0 milestone 2026-04-03 03:56:29 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium (confirmed)
  • Milestone: v3.7.0 (confirmed — part of Security & Safety Hardening Epic #362)
  • MoSCoW: Should Have — The JSON output structure for automation-profile remove doesn't match the spec. Programmatic consumers receive an unexpectedly large response with extra fields. Important for API contract compliance.
  • Parent Epic: #362 (confirmed correct)

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium (confirmed) - **Milestone**: v3.7.0 (confirmed — part of Security & Safety Hardening Epic #362) - **MoSCoW**: Should Have — The JSON output structure for `automation-profile remove` doesn't match the spec. Programmatic consumers receive an unexpectedly large response with extra fields. Important for API contract compliance. - **Parent Epic**: #362 (confirmed correct) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo self-assigned this 2026-04-03 16:58:09 +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.

Blocks
#362 Epic: Security & Safety Hardening
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2085
No description provided.