UAT: agents invariant add --plan and --action flags are not repeatable — spec requires multi-target support #3990

Open
opened 2026-04-06 08:20:38 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-invariant-add-repeatable-plan-action
  • Commit Message: fix(invariant): support repeatable --plan and --action flags in invariant add
  • Milestone: None (Backlog)
  • Parent Epic: #3370

Summary

The agents invariant add CLI command does not support repeatable --plan and --action flags. The specification (line 17808) explicitly states: "--plan and --action can be repeated to attach the same invariant to multiple plans or actions." The current implementation only accepts a single value for each flag.

Backlog note: This issue was discovered during autonomous UAT operation. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment.

Current Behavior

The add command in src/cleveragents/cli/commands/invariant.py defines --plan and --action as single-value options:

plan: Annotated[str | None, typer.Option("--plan", help="Plan ID (ULID)")] = None,
action: Annotated[str | None, typer.Option("--action", help="Action name")] = None,

Running agents invariant add --plan PLAN1 --plan PLAN2 "some constraint" would fail or only use the last value.

Additionally, _resolve_scope() only handles a single plan/action value and can only create one invariant per invocation.

Expected Behavior

Per spec (line 17808): "--plan and --action can be repeated to attach the same invariant to multiple plans or actions."

Running agents invariant add --plan PLAN1 --plan PLAN2 "some constraint" should create two plan-scoped invariants, one for each plan ID.

Running agents invariant add --action local/deploy --action local/test "some constraint" should create two action-scoped invariants.

Steps to Reproduce

  1. Run: agents invariant add --plan PLAN1 --plan PLAN2 "some constraint"
  2. Observe: Only one invariant is created (or the command fails)
  3. Expected: Two plan-scoped invariants are created, one for PLAN1 and one for PLAN2

Code Location

  • File: src/cleveragents/cli/commands/invariant.py
  • Function: add() command (lines 107-150) and _resolve_scope() (lines 73-88)
  • Fix: Change --plan and --action to list[str] types with typer.Option(...) supporting multiple values, and update _resolve_scope() to return a list of (scope, source_name) tuples

Subtasks

  • Change plan parameter type from str | None to list[str] in add() command
  • Change action parameter type from str | None to list[str] in add() command
  • Update _resolve_scope() to handle multi-value plan/action lists
  • Update add() to create multiple invariants when multiple plans/actions are specified
  • Add Behave BDD tests for repeatable --plan and --action flags
  • Verify existing single-value tests still pass

Definition of Done

  • agents invariant add --plan P1 --plan P2 "text" creates two plan-scoped invariants
  • agents invariant add --action A1 --action A2 "text" creates two action-scoped invariants
  • Single-value usage still works: agents invariant add --plan P1 "text"
  • Unit tests cover multi-value cases
  • Code passes nox -e typecheck and nox -e unit_tests
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/backlog-invariant-add-repeatable-plan-action` - **Commit Message**: `fix(invariant): support repeatable --plan and --action flags in invariant add` - **Milestone**: None (Backlog) - **Parent Epic**: #3370 ## Summary The `agents invariant add` CLI command does not support repeatable `--plan` and `--action` flags. The specification (line 17808) explicitly states: "`--plan` and `--action` can be repeated to attach the same invariant to multiple plans or actions." The current implementation only accepts a single value for each flag. > **Backlog note:** This issue was discovered during autonomous UAT operation. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment. ## Current Behavior The `add` command in `src/cleveragents/cli/commands/invariant.py` defines `--plan` and `--action` as single-value options: ```python plan: Annotated[str | None, typer.Option("--plan", help="Plan ID (ULID)")] = None, action: Annotated[str | None, typer.Option("--action", help="Action name")] = None, ``` Running `agents invariant add --plan PLAN1 --plan PLAN2 "some constraint"` would fail or only use the last value. Additionally, `_resolve_scope()` only handles a single plan/action value and can only create one invariant per invocation. ## Expected Behavior Per spec (line 17808): "`--plan` and `--action` can be repeated to attach the same invariant to multiple plans or actions." Running `agents invariant add --plan PLAN1 --plan PLAN2 "some constraint"` should create two plan-scoped invariants, one for each plan ID. Running `agents invariant add --action local/deploy --action local/test "some constraint"` should create two action-scoped invariants. ## Steps to Reproduce 1. Run: `agents invariant add --plan PLAN1 --plan PLAN2 "some constraint"` 2. Observe: Only one invariant is created (or the command fails) 3. Expected: Two plan-scoped invariants are created, one for PLAN1 and one for PLAN2 ## Code Location - **File**: `src/cleveragents/cli/commands/invariant.py` - **Function**: `add()` command (lines 107-150) and `_resolve_scope()` (lines 73-88) - **Fix**: Change `--plan` and `--action` to `list[str]` types with `typer.Option(...)` supporting multiple values, and update `_resolve_scope()` to return a list of `(scope, source_name)` tuples ## Subtasks - [ ] Change `plan` parameter type from `str | None` to `list[str]` in `add()` command - [ ] Change `action` parameter type from `str | None` to `list[str]` in `add()` command - [ ] Update `_resolve_scope()` to handle multi-value plan/action lists - [ ] Update `add()` to create multiple invariants when multiple plans/actions are specified - [ ] Add Behave BDD tests for repeatable `--plan` and `--action` flags - [ ] Verify existing single-value tests still pass ## Definition of Done - [ ] `agents invariant add --plan P1 --plan P2 "text"` creates two plan-scoped invariants - [ ] `agents invariant add --action A1 --action A2 "text"` creates two action-scoped invariants - [ ] Single-value usage still works: `agents invariant add --plan P1 "text"` - [ ] Unit tests cover multi-value cases - [ ] Code passes `nox -e typecheck` and `nox -e unit_tests` - All nox stages pass - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:14 +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.

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