UAT: agents invariant list --effective not restricted to --plan scope — spec requires --effective only with --plan #2092

Open
opened 2026-04-03 03:59:22 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/invariant-list-effective-plan-only
  • Commit Message: fix(cli): restrict --effective flag to --plan scope in invariant list command
  • Milestone: v3.7.0
  • Parent Epic: #936

Description

The specification (docs/specification.md line 17982) states:

--effective: (Only with --plan) Show the reconciled invariant view after precedence resolution across all scopes.

However, the current implementation in src/cleveragents/cli/commands/invariant.py allows --effective to be combined with any scope flag (--global, --project, --action) or even no scope flag at all, without any error or warning.

Current Behavior:

  • agents invariant list --effective --project myapp → succeeds (exit code 0), returns merged set
  • agents invariant list --effective --global → succeeds (exit code 0), returns merged set
  • agents invariant list --effective (no scope) → succeeds (exit code 0), returns merged set

Expected Behavior (per spec):

  • agents invariant list --effective --plan <PLAN_ID> → succeeds, shows reconciled view for that plan
  • agents invariant list --effective --project myapp → should error: --effective is only valid with --plan
  • agents invariant list --effective --global → should error: --effective is only valid with --plan
  • agents invariant list --effective → should error: --effective requires --plan <PLAN_ID>

Code Location: src/cleveragents/cli/commands/invariant.py, list_invariants() function (lines 150–243). The effective parameter is passed directly to service.list_invariants() without validating that --plan was also specified.

Steps to Reproduce:

  1. Run: agents invariant list --effective --project myapp
  2. Observe: command succeeds instead of erroring with a usage error

Spec Reference: docs/specification.md line 17982: --effective: (Only with --plan) Show the reconciled invariant view after precedence resolution across all scopes.

Subtasks

  • Write a failing Behave scenario (TDD) that asserts --effective without --plan exits with a non-zero code and an appropriate error message
  • Write a failing Behave scenario that asserts --effective --plan <PLAN_ID> succeeds as expected
  • Add validation logic in list_invariants() (src/cleveragents/cli/commands/invariant.py, lines 150–243) to raise a UsageError when --effective is provided without --plan
  • Ensure the error message clearly states: "--effective is only valid with --plan <PLAN_ID>"
  • Update Robot Framework integration test suite (robot/) to cover the invalid-combination scenario end-to-end
  • Run nox -e lint and nox -e typecheck and resolve any issues
  • Run nox -e unit_tests and confirm all Behave scenarios pass
  • Run nox -e integration_tests and confirm Robot Framework tests pass
  • Run nox -e coverage_report and confirm coverage remains ≥ 97%

Definition of Done

  • All subtasks above are checked off
  • agents invariant list --effective --project myapp exits non-zero with a clear error message
  • agents invariant list --effective --global exits non-zero with a clear error message
  • agents invariant list --effective (no scope) exits non-zero with a clear error message
  • agents invariant list --effective --plan <PLAN_ID> continues to succeed
  • Behave unit test scenarios cover all four cases above
  • Robot Framework integration test covers the invalid-combination scenario
  • All nox stages pass (nox with no arguments)
  • Coverage >= 97%
  • Commit pushed to branch fix/invariant-list-effective-plan-only with message fix(cli): restrict --effective flag to --plan scope in invariant list command
  • PR created, linked to this issue, and merged

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

## Metadata - **Branch**: `fix/invariant-list-effective-plan-only` - **Commit Message**: `fix(cli): restrict --effective flag to --plan scope in invariant list command` - **Milestone**: v3.7.0 - **Parent Epic**: #936 ## Description The specification (`docs/specification.md` line 17982) states: > `--effective: (Only with --plan) Show the reconciled invariant view after precedence resolution across all scopes.` However, the current implementation in `src/cleveragents/cli/commands/invariant.py` allows `--effective` to be combined with any scope flag (`--global`, `--project`, `--action`) or even no scope flag at all, without any error or warning. **Current Behavior:** - `agents invariant list --effective --project myapp` → succeeds (exit code 0), returns merged set - `agents invariant list --effective --global` → succeeds (exit code 0), returns merged set - `agents invariant list --effective` (no scope) → succeeds (exit code 0), returns merged set **Expected Behavior (per spec):** - `agents invariant list --effective --plan <PLAN_ID>` → succeeds, shows reconciled view for that plan - `agents invariant list --effective --project myapp` → should error: `--effective is only valid with --plan` - `agents invariant list --effective --global` → should error: `--effective is only valid with --plan` - `agents invariant list --effective` → should error: `--effective requires --plan <PLAN_ID>` **Code Location:** `src/cleveragents/cli/commands/invariant.py`, `list_invariants()` function (lines 150–243). The `effective` parameter is passed directly to `service.list_invariants()` without validating that `--plan` was also specified. **Steps to Reproduce:** 1. Run: `agents invariant list --effective --project myapp` 2. Observe: command succeeds instead of erroring with a usage error **Spec Reference:** `docs/specification.md` line 17982: `--effective: (Only with --plan) Show the reconciled invariant view after precedence resolution across all scopes.` ## Subtasks - [ ] Write a failing Behave scenario (TDD) that asserts `--effective` without `--plan` exits with a non-zero code and an appropriate error message - [ ] Write a failing Behave scenario that asserts `--effective --plan <PLAN_ID>` succeeds as expected - [ ] Add validation logic in `list_invariants()` (`src/cleveragents/cli/commands/invariant.py`, lines 150–243) to raise a `UsageError` when `--effective` is provided without `--plan` - [ ] Ensure the error message clearly states: `"--effective is only valid with --plan <PLAN_ID>"` - [ ] Update Robot Framework integration test suite (`robot/`) to cover the invalid-combination scenario end-to-end - [ ] Run `nox -e lint` and `nox -e typecheck` and resolve any issues - [ ] Run `nox -e unit_tests` and confirm all Behave scenarios pass - [ ] Run `nox -e integration_tests` and confirm Robot Framework tests pass - [ ] Run `nox -e coverage_report` and confirm coverage remains ≥ 97% ## Definition of Done - [ ] All subtasks above are checked off - [ ] `agents invariant list --effective --project myapp` exits non-zero with a clear error message - [ ] `agents invariant list --effective --global` exits non-zero with a clear error message - [ ] `agents invariant list --effective` (no scope) exits non-zero with a clear error message - [ ] `agents invariant list --effective --plan <PLAN_ID>` continues to succeed - [ ] Behave unit test scenarios cover all four cases above - [ ] Robot Framework integration test covers the invalid-combination scenario - [ ] All nox stages pass (`nox` with no arguments) - [ ] Coverage >= 97% - [ ] Commit pushed to branch `fix/invariant-list-effective-plan-only` with message `fix(cli): restrict --effective flag to --plan scope in invariant list command` - [ ] PR created, linked to this issue, and merged --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-03 03:59:27 +00:00
freemo self-assigned this 2026-04-03 16:58:08 +00:00
Author
Owner

MoSCoW classification: Should Have

Rationale: This issue addresses a spec requirement or important quality improvement. It should be included in the milestone if possible.


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

MoSCoW classification: **Should Have** Rationale: This issue addresses a spec requirement or important quality improvement. It should be included in the milestone if possible. --- **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#2092
No description provided.