UAT: agents invariant add --plan and --action flags are not repeatable as required by spec #2818

Open
opened 2026-04-04 20:39:40 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/invariant-add-repeatable-plan-action-flags
  • Commit Message: fix(invariant): make --plan and --action flags repeatable in agents invariant add
  • Milestone: v3.3.0
  • Parent Epic: #394

Bug Report

What Was Tested

Code analysis of src/cleveragents/cli/commands/invariant.py — the add() function (lines 121–122) and the _resolve_scope() helper (lines 70–97).

Expected Behavior (from spec)

Per docs/specification.md line 17808:

7e "At least one scope flag (--global, --project, --plan, or --action) must be provided. --plan and --action can be repeated to attach the same invariant to multiple plans or actions."

The synopsis at line 17794 shows:

agents invariant add [--global] [(--project|-p) PROJECT] [--plan PLAN_ID]... [--action ACTION]... \u2039INVARIANT_TEXT\u203a

The ... notation means these flags are repeatable — the same invariant can be attached to multiple plans or actions in a single command invocation.

Actual Behavior

In 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,

Both --plan and --action are typed as str | None (single value only). They should be list[str] with typer.Option() configured for multiple values.

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

Additionally, the _resolve_scope() helper (lines 70–97) only handles a single plan/action value, so the underlying scope-resolution logic would also need updating to iterate over multiple values.

Steps to Reproduce

  1. Run agents invariant add --plan 01HXM8C2ZK4Q7C2B3F2R4VYV6J --plan 01HXM8C2ZK4Q7C2B3F2R4VYV6K "Some invariant text"
  2. Observe: Only one plan is targeted (or error is raised)
  3. Expected: Invariant is attached to both plans

Code Location

  • src/cleveragents/cli/commands/invariant.py, add() function, lines 121–122 (plan and action parameters)
  • src/cleveragents/cli/commands/invariant.py, _resolve_scope() function, lines 70–97

Subtasks

  • Write a failing BDD scenario in features/ demonstrating --plan repeated twice attaches the invariant to both plans
  • Write a failing BDD scenario demonstrating --action repeated twice attaches the invariant to both actions
  • Change plan parameter type from str | None to list[str] with typer.Option() supporting multiple values
  • Change action parameter type from str | None to list[str] with typer.Option() supporting multiple values
  • Update _resolve_scope() to iterate over list[str] for both plan and action and produce the correct multi-scope result
  • Update any downstream service calls that receive the scope to handle multiple plan/action values
  • Ensure all nox quality gates pass (nox -e lint, nox -e typecheck, nox -e unit_tests, nox -e coverage_report)
  • Open a PR, obtain two approving reviews, and merge

Definition of Done

  • --plan flag is repeatable: agents invariant add --plan A --plan B "text" attaches the invariant to both plans A and B
  • --action flag is repeatable: agents invariant add --action foo --action bar "text" attaches the invariant to both actions
  • BDD scenarios cover single and multiple values for both flags
  • _resolve_scope() correctly handles list[str] inputs for plan and action
  • All type annotations are explicit and pass nox -e typecheck (Pyright) with no suppressions
  • All nox stages pass
  • Coverage e= 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(invariant): make --plan and --action flags repeatable in agents invariant add` - **Milestone**: v3.3.0 - **Parent Epic**: #394 ## Bug Report ### What Was Tested Code analysis of `src/cleveragents/cli/commands/invariant.py` — the `add()` function (lines 121–122) and the `_resolve_scope()` helper (lines 70–97). ### Expected Behavior (from spec) Per `docs/specification.md` line 17808: 7e "At least one scope flag (`--global`, `--project`, `--plan`, or `--action`) must be provided. `--plan` and `--action` can be repeated to attach the same invariant to multiple plans or actions." The synopsis at line 17794 shows: ``` agents invariant add [--global] [(--project|-p) PROJECT] [--plan PLAN_ID]... [--action ACTION]... \u2039INVARIANT_TEXT\u203a ``` The `...` notation means these flags are repeatable — the same invariant can be attached to multiple plans or actions in a single command invocation. ### Actual Behavior In `src/cleveragents/cli/commands/invariant.py` lines 121–122: ```python plan: Annotated[str | None, typer.Option("--plan", help="Plan ID (ULID)")] = None, action: Annotated[str | None, typer.Option("--action", help="Action name")] = None, ``` Both `--plan` and `--action` are typed as `str | None` (single value only). They should be `list[str]` with `typer.Option()` configured for multiple values. Running `agents invariant add --plan PLAN1 --plan PLAN2 "text"` would only use the last value or fail entirely. Additionally, the `_resolve_scope()` helper (lines 70–97) only handles a single plan/action value, so the underlying scope-resolution logic would also need updating to iterate over multiple values. ### Steps to Reproduce 1. Run `agents invariant add --plan 01HXM8C2ZK4Q7C2B3F2R4VYV6J --plan 01HXM8C2ZK4Q7C2B3F2R4VYV6K "Some invariant text"` 2. Observe: Only one plan is targeted (or error is raised) 3. Expected: Invariant is attached to both plans ### Code Location - `src/cleveragents/cli/commands/invariant.py`, `add()` function, lines 121–122 (`plan` and `action` parameters) - `src/cleveragents/cli/commands/invariant.py`, `_resolve_scope()` function, lines 70–97 ## Subtasks - [ ] Write a failing BDD scenario in `features/` demonstrating `--plan` repeated twice attaches the invariant to both plans - [ ] Write a failing BDD scenario demonstrating `--action` repeated twice attaches the invariant to both actions - [ ] Change `plan` parameter type from `str | None` to `list[str]` with `typer.Option()` supporting multiple values - [ ] Change `action` parameter type from `str | None` to `list[str]` with `typer.Option()` supporting multiple values - [ ] Update `_resolve_scope()` to iterate over `list[str]` for both `plan` and `action` and produce the correct multi-scope result - [ ] Update any downstream service calls that receive the scope to handle multiple plan/action values - [ ] Ensure all nox quality gates pass (`nox -e lint`, `nox -e typecheck`, `nox -e unit_tests`, `nox -e coverage_report`) - [ ] Open a PR, obtain two approving reviews, and merge ## Definition of Done - [ ] `--plan` flag is repeatable: `agents invariant add --plan A --plan B "text"` attaches the invariant to both plans A and B - [ ] `--action` flag is repeatable: `agents invariant add --action foo --action bar "text"` attaches the invariant to both actions - [ ] BDD scenarios cover single and multiple values for both flags - [ ] `_resolve_scope()` correctly handles `list[str]` inputs for plan and action - [ ] All type annotations are explicit and pass `nox -e typecheck` (Pyright) with no suppressions - [ ] All nox stages pass - [ ] Coverage e= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.3.0 milestone 2026-04-04 20:39:44 +00:00
Author
Owner

Starting implementation on branch fix/invariant-add-repeatable-plan-action-flags.

Plan: Fix --plan and --action flags in agents invariant add to be repeatable (accept multiple values via list[str]), update _resolve_scope() to handle lists, write BDD scenarios, and ensure all nox quality gates pass.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

Starting implementation on branch `fix/invariant-add-repeatable-plan-action-flags`. **Plan:** Fix `--plan` and `--action` flags in `agents invariant add` to be repeatable (accept multiple values via `list[str]`), update `_resolve_scope()` to handle lists, write BDD scenarios, and ensure all nox quality gates pass. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
freemo removed this from the v3.3.0 milestone 2026-04-06 20:57:35 +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#2818
No description provided.