UAT: agents project delete --force has wrong semantics — blocks on linked resources instead of active plans as spec requires #3609

Open
opened 2026-04-05 20:24:00 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/project-delete-force-semantics
  • Commit Message: fix(cli): correct --force semantics in agents project delete to guard active plans not linked resources
  • Milestone: v3.2.0
  • Parent Epic: #397

What Was Tested

Code-level analysis of src/cleveragents/cli/commands/project.py, the delete command implementation.

Expected Behavior (from spec)

Per docs/specification.md, the agents project delete command has:

agents project delete [(-f|--force)] [(-y|--yes)] <NAME>
--force/-f: Delete even if active plans exist.

The --force flag is specifically documented to allow deletion "even if active plans exist."

Additionally, the spec states: "Delete a project and unlink all associated resources. The resources themselves remain in the Resource Registry." — there is no mention of blocking deletion due to linked resources. The spec's only guard is active plans.

Actual Behavior

The implementation uses --force to bypass a check for linked resources, not active plans:

# src/cleveragents/cli/commands/project.py, ~line 954-960
# 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 --force flag help text also says: "Force delete even if resources are linked" — this directly contradicts the spec.

Impact

  1. The --force flag has completely wrong semantics — it bypasses the wrong guard
  2. Projects with linked resources cannot be deleted without --force, which is not a spec requirement
  3. Projects with active plans can be deleted without --force, which is a spec violation
  4. The help text misleads users about what --force does

Code Location

  • src/cleveragents/cli/commands/project.pydelete() function, lines ~925–979

Subtasks

  • Audit delete() in src/cleveragents/cli/commands/project.py to understand the full current guard logic
  • Remove the linked-resources guard (or convert it to an unconditional unlink per spec — resources are unlinked, not blocked)
  • Add an active-plans guard: if the project has active plans and --force is not set, abort with a clear error message
  • Update the --force flag help text to: "Force delete even if active plans exist"
  • Ensure the delete path always unlinks associated resources (without requiring --force) and leaves the resources themselves in the Resource Registry
  • Update or add BDD unit test scenarios in features/ covering:
    • Delete with no active plans and no --force → succeeds
    • Delete with active plans and no --force → fails with correct error
    • Delete with active plans and --force → succeeds
    • Delete with linked resources and no --force → succeeds (resources unlinked, not blocked)
  • Update or add Robot Framework integration tests in robot/ for the corrected agents project delete behaviour
  • Update benchmark in benchmarks/ if applicable
  • Verify all nox sessions pass: nox -e lint, nox -e typecheck, nox -e unit_tests, nox -e integration_tests, nox -e coverage_report

Definition of Done

  • agents project delete <NAME> without --force succeeds when no active plans exist (regardless of linked resources)
  • agents project delete <NAME> without --force fails with a clear error when active plans exist, referencing --force
  • agents project delete <NAME> --force succeeds even when active plans exist
  • Linked resources are always unlinked on delete; the resources themselves remain in the Resource Registry
  • --force / -f help text reads: "Force delete even if active plans exist"
  • No regression in other agents project subcommands
  • All nox stages pass
  • Coverage >= 97%

Critical bug note: This issue was discovered during UAT testing and directly blocks milestone acceptance for v3.2.0 (M3), which includes project CLI commands. The --force flag has inverted semantics from the specification.


Automated by CleverAgents Bot
Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/project-delete-force-semantics` - **Commit Message**: `fix(cli): correct --force semantics in agents project delete to guard active plans not linked resources` - **Milestone**: v3.2.0 - **Parent Epic**: #397 ## What Was Tested Code-level analysis of `src/cleveragents/cli/commands/project.py`, the `delete` command implementation. ## Expected Behavior (from spec) Per `docs/specification.md`, the `agents project delete` command has: ``` agents project delete [(-f|--force)] [(-y|--yes)] <NAME> --force/-f: Delete even if active plans exist. ``` The `--force` flag is specifically documented to allow deletion "even if active plans exist." Additionally, the spec states: _"Delete a project and unlink all associated resources. The resources themselves remain in the Resource Registry."_ — there is no mention of blocking deletion due to linked resources. The spec's only guard is active plans. ## Actual Behavior The implementation uses `--force` to bypass a check for **linked resources**, not active plans: ```python # src/cleveragents/cli/commands/project.py, ~line 954-960 # 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 `--force` flag help text also says: `"Force delete even if resources are linked"` — this directly contradicts the spec. ## Impact 1. The `--force` flag has completely wrong semantics — it bypasses the wrong guard 2. Projects with linked resources cannot be deleted without `--force`, which is **not** a spec requirement 3. Projects with active plans can be deleted without `--force`, which **is** a spec violation 4. The help text misleads users about what `--force` does ## Code Location - `src/cleveragents/cli/commands/project.py` — `delete()` function, lines ~925–979 ## Subtasks - [ ] Audit `delete()` in `src/cleveragents/cli/commands/project.py` to understand the full current guard logic - [ ] Remove the linked-resources guard (or convert it to an unconditional unlink per spec — resources are unlinked, not blocked) - [ ] Add an active-plans guard: if the project has active plans and `--force` is not set, abort with a clear error message - [ ] Update the `--force` flag help text to: `"Force delete even if active plans exist"` - [ ] Ensure the delete path always unlinks associated resources (without requiring `--force`) and leaves the resources themselves in the Resource Registry - [ ] Update or add BDD unit test scenarios in `features/` covering: - Delete with no active plans and no `--force` → succeeds - Delete with active plans and no `--force` → fails with correct error - Delete with active plans and `--force` → succeeds - Delete with linked resources and no `--force` → succeeds (resources unlinked, not blocked) - [ ] Update or add Robot Framework integration tests in `robot/` for the corrected `agents project delete` behaviour - [ ] Update benchmark in `benchmarks/` if applicable - [ ] Verify all nox sessions pass: `nox -e lint`, `nox -e typecheck`, `nox -e unit_tests`, `nox -e integration_tests`, `nox -e coverage_report` ## Definition of Done - [ ] `agents project delete <NAME>` without `--force` succeeds when no active plans exist (regardless of linked resources) - [ ] `agents project delete <NAME>` without `--force` fails with a clear error when active plans exist, referencing `--force` - [ ] `agents project delete <NAME> --force` succeeds even when active plans exist - [ ] Linked resources are always unlinked on delete; the resources themselves remain in the Resource Registry - [ ] `--force` / `-f` help text reads: `"Force delete even if active plans exist"` - [ ] No regression in other `agents project` subcommands - [ ] All nox stages pass - [ ] Coverage >= 97% --- > **Critical bug note:** This issue was discovered during UAT testing and directly blocks milestone acceptance for v3.2.0 (M3), which includes project CLI commands. The `--force` flag has inverted semantics from the specification. --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.2.0 milestone 2026-04-05 20:24:05 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Critical — agents project delete --force has wrong semantics. It blocks on linked resources instead of actually force-deleting. The --force flag is supposed to bypass safety checks and delete regardless.
  • Milestone: v3.2.0 (already assigned)
  • Story Points: 3 — M — Requires fixing the force-delete logic to actually bypass resource checks.
  • MoSCoW: Must Have — The --force flag is a spec-defined destructive operation that must work correctly. Users who explicitly pass --force expect the operation to succeed regardless of linked resources.

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Critical — `agents project delete --force` has wrong semantics. It blocks on linked resources instead of actually force-deleting. The `--force` flag is supposed to bypass safety checks and delete regardless. - **Milestone**: v3.2.0 (already assigned) - **Story Points**: 3 — M — Requires fixing the force-delete logic to actually bypass resource checks. - **MoSCoW**: Must Have — The `--force` flag is a spec-defined destructive operation that must work correctly. Users who explicitly pass `--force` expect the operation to succeed regardless of linked resources. --- **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.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3609
No description provided.