UAT: agents invariant add --plan and --action flags not repeatable — spec requires multi-value support #3531

Open
opened 2026-04-05 19:00:43 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/invariant-add-repeatable-plan-action-flags
  • Commit Message: fix(cli): make invariant add --plan and --action flags repeatable
  • Milestone: Backlog (none assigned)
  • Parent Epic: #394

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

Background and context

The agents invariant add command's --plan and --action flags only accept a single value each, but the specification (docs/specification.md §17794–17808) requires them to be repeatable, allowing the same invariant to be attached to multiple plans or actions in a single command invocation.

The specification is the source of truth. The implementation must be updated to match it.

Current behavior (for bugs)

The implementation defines both flags as str | None (single value):

# src/cleveragents/cli/commands/invariant.py, lines 121-122
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 PLAN_01 --plan PLAN_02 "All tests must pass"

results in only one invariant being created (for the last --plan value), not two. The _resolve_scope function (lines 70–97) also only handles a single plan/action value.

Expected behavior

Per the spec:

agents invariant add [--global] [(--project|-p) PROJECT] [--plan PLAN_ID]... [--action ACTION]... <INVARIANT_TEXT>

The ... notation means the flags are repeatable. Both of these should work:

agents invariant add --plan PLAN_01 --plan PLAN_02 "All tests must pass"
agents invariant add --action deploy --action test "No unsafe operations"

Each repetition should create one invariant scoped to the respective plan or action.

Steps to Reproduce

  1. Run agents invariant add --plan PLAN_01 --plan PLAN_02 "test invariant"
  2. Observe: only one invariant is created (for PLAN_02), not two

Code Location

  • src/cleveragents/cli/commands/invariant.py lines 121–122 — plan/action option type definitions
  • src/cleveragents/cli/commands/invariant.py lines 70–97 — _resolve_scope function (only handles single values)

Subtasks

  • Change plan parameter type from str | None to list[str] using typer.Option(..., multiple=True) or equivalent
  • Change action parameter type from str | None to list[str] using typer.Option(..., multiple=True) or equivalent
  • Update _resolve_scope (or equivalent logic) to iterate over all provided plan IDs and create one invariant per entry
  • Update _resolve_scope (or equivalent logic) to iterate over all provided action names and create one invariant per entry
  • Tests (Behave): Add @tdd_expected_fail scenario reproducing the bug before fixing
  • Tests (Behave): Add scenarios for single and multiple --plan values
  • Tests (Behave): Add scenarios for single and multiple --action values
  • Tests (Behave): Add scenario for combined --plan and --action repetitions in one command
  • Tests (Robot): Add integration test for the full multi-value workflow
  • 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 fix(cli): make invariant add --plan and --action flags repeatable exactly, followed by a blank line, then additional detail lines, and a footer ISSUES CLOSED: #<this issue number>.
  • The commit is pushed to the remote on branch fix/invariant-add-repeatable-plan-action-flags.
  • 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-new-issue-creator

## Metadata - **Branch**: `fix/invariant-add-repeatable-plan-action-flags` - **Commit Message**: `fix(cli): make invariant add --plan and --action flags repeatable` - **Milestone**: Backlog (none assigned) - **Parent Epic**: #394 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and context The `agents invariant add` command's `--plan` and `--action` flags only accept a single value each, but the specification (`docs/specification.md` §17794–17808) requires them to be repeatable, allowing the same invariant to be attached to multiple plans or actions in a single command invocation. The specification is the source of truth. The implementation must be updated to match it. ## Current behavior (for bugs) The implementation defines both flags as `str | None` (single value): ```python # src/cleveragents/cli/commands/invariant.py, lines 121-122 plan: Annotated[str | None, typer.Option("--plan", help="Plan ID (ULID)")] = None, action: Annotated[str | None, typer.Option("--action", help="Action name")] = None, ``` Running: ```bash agents invariant add --plan PLAN_01 --plan PLAN_02 "All tests must pass" ``` results in only one invariant being created (for the last `--plan` value), not two. The `_resolve_scope` function (lines 70–97) also only handles a single plan/action value. ## Expected behavior Per the spec: ``` agents invariant add [--global] [(--project|-p) PROJECT] [--plan PLAN_ID]... [--action ACTION]... <INVARIANT_TEXT> ``` The `...` notation means the flags are repeatable. Both of these should work: ```bash agents invariant add --plan PLAN_01 --plan PLAN_02 "All tests must pass" agents invariant add --action deploy --action test "No unsafe operations" ``` Each repetition should create one invariant scoped to the respective plan or action. ## Steps to Reproduce 1. Run `agents invariant add --plan PLAN_01 --plan PLAN_02 "test invariant"` 2. Observe: only one invariant is created (for PLAN_02), not two ## Code Location - `src/cleveragents/cli/commands/invariant.py` lines 121–122 — `plan`/`action` option type definitions - `src/cleveragents/cli/commands/invariant.py` lines 70–97 — `_resolve_scope` function (only handles single values) ## Subtasks - [ ] Change `plan` parameter type from `str | None` to `list[str]` using `typer.Option(..., multiple=True)` or equivalent - [ ] Change `action` parameter type from `str | None` to `list[str]` using `typer.Option(..., multiple=True)` or equivalent - [ ] Update `_resolve_scope` (or equivalent logic) to iterate over all provided plan IDs and create one invariant per entry - [ ] Update `_resolve_scope` (or equivalent logic) to iterate over all provided action names and create one invariant per entry - [ ] Tests (Behave): Add `@tdd_expected_fail` scenario reproducing the bug before fixing - [ ] Tests (Behave): Add scenarios for single and multiple `--plan` values - [ ] Tests (Behave): Add scenarios for single and multiple `--action` values - [ ] Tests (Behave): Add scenario for combined `--plan` and `--action` repetitions in one command - [ ] Tests (Robot): Add integration test for the full multi-value workflow - [ ] 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 `fix(cli): make invariant add --plan and --action flags repeatable` exactly, followed by a blank line, then additional detail lines, and a footer `ISSUES CLOSED: #<this issue number>`. - The commit is pushed to the remote on branch `fix/invariant-add-repeatable-plan-action-flags`. - 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-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Low — The --plan and --action flags work for single values. Multi-value support is a convenience feature for batch operations. Users can run the command multiple times as a workaround.
  • Milestone: v3.3.0 — Invariant CLI is part of the Decision Framework (Epic #394).
  • Story Points: 3 — M — Requires changing parameter types from str | None to list[str], updating _resolve_scope to iterate, and adding tests for multi-value scenarios.
  • MoSCoW: Could Have — The spec uses ... notation indicating repeatability, but single-value usage covers the primary use case. Multi-value is a convenience improvement.
  • Parent Epic: #394 (Decision Framework)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Low — The `--plan` and `--action` flags work for single values. Multi-value support is a convenience feature for batch operations. Users can run the command multiple times as a workaround. - **Milestone**: v3.3.0 — Invariant CLI is part of the Decision Framework (Epic #394). - **Story Points**: 3 — M — Requires changing parameter types from `str | None` to `list[str]`, updating `_resolve_scope` to iterate, and adding tests for multi-value scenarios. - **MoSCoW**: Could Have — The spec uses `...` notation indicating repeatability, but single-value usage covers the primary use case. Multi-value is a convenience improvement. - **Parent Epic**: #394 (Decision Framework) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo added this to the v3.3.0 milestone 2026-04-05 19:37:45 +00:00
freemo removed this from the v3.3.0 milestone 2026-04-06 20:53:03 +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
#394 Epic: Decision Framework
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3531
No description provided.