UAT: agents project delete blocks on linked resources instead of active plans — spec requires --force only for active plans #1801

Open
opened 2026-04-02 23:52:42 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/project-delete-force-flag-active-plans
  • Commit Message: fix(cli): correct project delete --force to block on active plans, not linked resources
  • Milestone: v3.6.0
  • Parent Epic: #945

Background

A UAT audit of the agents project delete command revealed that the --force flag implementation diverges from the specification. The spec is the authoritative source of truth per CONTRIBUTING.md §Specification-First Development.

What Was Tested

The agents project delete command's --force flag behavior in src/cleveragents/cli/commands/project.py.

Expected Behavior (from spec)

Per docs/specification.md lines 3423 and 3431:

Use --force to also cancel active plans targeting this project.
--force/-f: Delete even if active plans exist.

The spec is clear: --force is required when the project has active plans. Without --force, deleting a project with active plans should fail with a "Delete Blocked" panel showing the active plans and resolution options.

The spec also shows (lines 3439–3467) that deleting a project without active plans should succeed immediately (with --yes to skip confirmation), regardless of whether resources are linked — resources are simply unlinked, not deleted.

Actual Behavior (from code)

In src/cleveragents/cli/commands/project.py, the delete command (lines 954–961):

# Check for linked resources (unless --force)
if proj.linked_resources and not force:
    err_console.print(
        f"[red]Project '{name}' has {len(proj.linked_resources)} "
        f"linked resource(s). Use --force to delete anyway.[/red]"
    )
    raise typer.Exit(1)

The implementation:

  1. Incorrectly blocks deletion when linked resources exist (without --force) — the spec does NOT require --force for linked resources
  2. Does NOT check for active plans — the spec requires --force when active plans exist
  3. Missing "Delete Blocked" panel with active plan details when blocked
  4. Missing "Deletion Summary" panel on successful deletion (showing resources unlinked, data dir, etc.)

Steps to Reproduce

  1. Create a project with linked resources but no active plans
  2. Run agents project delete --yes <project-name>
  3. Expected: Deletion succeeds (resources are unlinked, not deleted)
  4. Actual: Command fails with "has linked resource(s). Use --force to delete anyway."

Code Location

src/cleveragents/cli/commands/project.py, delete() function, lines 954–961

Spec References

  • docs/specification.md lines 3417–3650 (agents project delete section)
  • Line 3423: "Use --force to also cancel active plans targeting this project"
  • Line 3431: "--force/-f: Delete even if active plans exist"

Subtasks

  • Remove the linked-resources guard that incorrectly requires --force for linked resources
  • Add an active-plans check: query for plans in active states targeting this project
  • Implement "Delete Blocked" Rich panel (spec lines 3439–3467) when active plans exist and --force is not passed, listing each active plan with its ID, name, and state
  • Implement --force path: cancel all active plans targeting the project before deletion
  • Implement "Deletion Summary" Rich panel on successful deletion (resources unlinked count, data directory path, etc.)
  • Update unit tests (Behave) in features/ to cover: delete with linked resources (no --force needed), delete with active plans (blocked without --force), delete with active plans and --force (succeeds)
  • Update integration tests (Robot Framework) in robot/ if applicable
  • Verify nox passes with coverage >= 97%

Definition of Done

  • agents project delete --yes <project> succeeds when project has linked resources but no active plans (resources are unlinked, not deleted)
  • agents project delete --yes <project> fails with a spec-conformant "Delete Blocked" panel when active plans exist and --force is not passed
  • agents project delete --yes --force <project> succeeds when active plans exist, cancelling them first
  • "Deletion Summary" panel is rendered on successful deletion
  • No regression in existing project delete tests
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/project-delete-force-flag-active-plans` - **Commit Message**: `fix(cli): correct project delete --force to block on active plans, not linked resources` - **Milestone**: v3.6.0 - **Parent Epic**: #945 ## Background A UAT audit of the `agents project delete` command revealed that the `--force` flag implementation diverges from the specification. The spec is the authoritative source of truth per CONTRIBUTING.md §Specification-First Development. ## What Was Tested The `agents project delete` command's `--force` flag behavior in `src/cleveragents/cli/commands/project.py`. ## Expected Behavior (from spec) Per `docs/specification.md` lines 3423 and 3431: > Use `--force` to also cancel active plans targeting this project. > `--force/-f`: Delete even if active plans exist. The spec is clear: `--force` is required when the project has **active plans**. Without `--force`, deleting a project with active plans should fail with a "Delete Blocked" panel showing the active plans and resolution options. The spec also shows (lines 3439–3467) that deleting a project **without** active plans should succeed immediately (with `--yes` to skip confirmation), regardless of whether resources are linked — resources are simply unlinked, not deleted. ## Actual Behavior (from code) In `src/cleveragents/cli/commands/project.py`, the `delete` command (lines 954–961): ```python # Check for linked resources (unless --force) if proj.linked_resources and not force: err_console.print( f"[red]Project '{name}' has {len(proj.linked_resources)} " f"linked resource(s). Use --force to delete anyway.[/red]" ) raise typer.Exit(1) ``` The implementation: 1. **Incorrectly blocks deletion when linked resources exist** (without `--force`) — the spec does NOT require `--force` for linked resources 2. **Does NOT check for active plans** — the spec requires `--force` when active plans exist 3. **Missing "Delete Blocked" panel** with active plan details when blocked 4. **Missing "Deletion Summary" panel** on successful deletion (showing resources unlinked, data dir, etc.) ## Steps to Reproduce 1. Create a project with linked resources but no active plans 2. Run `agents project delete --yes <project-name>` 3. **Expected**: Deletion succeeds (resources are unlinked, not deleted) 4. **Actual**: Command fails with "has linked resource(s). Use --force to delete anyway." ## Code Location `src/cleveragents/cli/commands/project.py`, `delete()` function, lines 954–961 ## Spec References - `docs/specification.md` lines 3417–3650 (agents project delete section) - Line 3423: "Use `--force` to also cancel active plans targeting this project" - Line 3431: "`--force/-f`: Delete even if active plans exist" ## Subtasks - [ ] Remove the linked-resources guard that incorrectly requires `--force` for linked resources - [ ] Add an active-plans check: query for plans in active states targeting this project - [ ] Implement "Delete Blocked" Rich panel (spec lines 3439–3467) when active plans exist and `--force` is not passed, listing each active plan with its ID, name, and state - [ ] Implement `--force` path: cancel all active plans targeting the project before deletion - [ ] Implement "Deletion Summary" Rich panel on successful deletion (resources unlinked count, data directory path, etc.) - [ ] Update unit tests (Behave) in `features/` to cover: delete with linked resources (no `--force` needed), delete with active plans (blocked without `--force`), delete with active plans and `--force` (succeeds) - [ ] Update integration tests (Robot Framework) in `robot/` if applicable - [ ] Verify `nox` passes with coverage >= 97% ## Definition of Done - [ ] `agents project delete --yes <project>` succeeds when project has linked resources but no active plans (resources are unlinked, not deleted) - [ ] `agents project delete --yes <project>` fails with a spec-conformant "Delete Blocked" panel when active plans exist and `--force` is not passed - [ ] `agents project delete --yes --force <project>` succeeds when active plans exist, cancelling them first - [ ] "Deletion Summary" panel is rendered on successful deletion - [ ] No regression in existing `project delete` tests - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.6.0 milestone 2026-04-02 23:53:38 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Should Have — bug or error handling improvement.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Should Have — bug or error handling improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

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