UAT: agents invariant list --effective missing "Conflicts Resolved" section and panel format #3527

Open
opened 2026-04-05 18:56:50 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/invariant-list-effective-panel-conflicts
  • Commit Message: fix(cli): add rich Panel format and Conflicts Resolved section to invariant list --effective
  • Milestone: Backlog (no milestone — see backlog note below)
  • 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.

Summary

The agents invariant list --effective command is missing two spec-required output elements:

  1. The bordered panel format (uses a plain Table instead of a Panel-wrapped table)
  2. The "Conflicts Resolved" section showing which invariants were overridden and why

Background and Context

Code analysis of src/cleveragents/cli/commands/invariant.py lines 218-239 compared against docs/specification.md §17968-18014 reveals that the --effective output path does not match the spec-defined rich output format. All other CLI commands (e.g., action.py, plan.py, project.py) correctly use from rich.panel import Panel — the --effective branch of invariant.py renders a plain rich.table.Table with no panel wrapper and no conflict summary.

Additionally, the underlying service architecture does not surface conflict information to the CLI: InvariantService.list_invariants(effective=True) returns only list[Invariant], discarding the ReconciliationResult.conflicts data produced by InvariantReconciliationActor.run().

Expected Behavior (from spec §17968-18014)

agents invariant list --plan 01HXM8C2ZK4Q7C2B3F2R4VYV6J --effective should produce:

╭─ Effective Invariants (Plan 01HXM8C2ZK4Q7C2B3F2R4VYV6J) ──────────────────────────────────╮
│ ID              Source   Text                                                             │
│ ──────────────  ───────  ──────────────────────────────────────────────────────           │
│ inv_01HXM9A1B  global   All public APIs must maintain backward compatibility              │
│ inv_01HXM9A2C  project  All endpoints must validate auth tokens                           │
│ inv_01HXM9G3A  plan     All database queries must use parameterized statements            │
╰───────────────────────────────────────────────────────────────────────────────────────────╯

│ Conflicts Resolved: 1                                                              │
│   Global "Use shared DB pool" overridden by plan "All database queries must use    │
│   parameterized statements"                                                        │

✓ OK 3 effective invariants (1 global, 1 project, 1 plan; 1 conflict resolved)

Actual Behavior

The implementation (src/cleveragents/cli/commands/invariant.py lines 218-239) renders a plain rich.table.Table with columns: ID, Scope, Source, Text, Active. There is:

  1. No bordered panel wrapper (no ╭─ Effective Invariants ─╮ header)
  2. No "Conflicts Resolved" section — the list_invariants(effective=True) call returns only the merged invariant list, with no conflict information passed back to the CLI
  3. No summary line like ✓ OK 3 effective invariants (1 global, 1 project, 1 plan; 1 conflict resolved)

Root Cause

The InvariantService.list_invariants(effective=True) method calls get_effective_invariants() which returns only list[Invariant] — it does not return conflict records. The InvariantReconciliationActor.run() returns a ReconciliationResult with conflicts: list[ConflictRecord], but the CLI list command does not use the reconciliation actor — it only calls the service's merge function.

To show conflicts in --effective output, the CLI would need to either:

  • Call the reconciliation actor directly and use its ReconciliationResult.conflicts
  • Or have get_effective_invariants() return conflict information alongside the merged list

Code Location

  • src/cleveragents/cli/commands/invariant.py lines 218-239 (list rich output)
  • src/cleveragents/application/services/invariant_service.py lines 165-200 (get_effective_invariants)
  • src/cleveragents/actor/reconciliation.py lines 293-389 (InvariantReconciliationActor.run)

Steps to Reproduce

  1. Add invariants at multiple scopes with some conflicts
  2. Run agents invariant list --plan <PLAN_ID> --effective
  3. Observe: no panel format, no conflicts section

Subtasks

  • Wrap the --effective table output in a rich.panel.Panel with title Effective Invariants (<scope context>) matching the spec format
  • Extend get_effective_invariants() (or add a new method) in InvariantService to return both the merged list[Invariant] and the list[ConflictRecord] from the reconciliation result
  • Update the CLI list --effective handler to receive and render the "Conflicts Resolved" section using the returned conflict records
  • Add the summary line ✓ OK N effective invariants (X global, Y project, Z plan; W conflict(s) resolved) below the panel
  • Tests (Behave): Add/update scenarios in features/invariant_cli.feature asserting panel format and conflicts section appear in --effective output
  • Tests (Behave): Add scenario for zero-conflict case (no "Conflicts Resolved" section rendered when there are no conflicts)
  • Tests (Robot): Add integration test for agents invariant list --effective with multi-scope invariants and at least one conflict
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

  • agents invariant list --effective renders a rich bordered panel matching the spec format (§17968-18014)
  • The "Conflicts Resolved" section is displayed when conflicts exist, and omitted when there are none
  • The summary line correctly counts invariants by scope and resolved conflicts
  • InvariantService.get_effective_invariants() (or equivalent) surfaces conflict records to the CLI layer
  • Output is visually consistent with all other CLI commands
  • All subtasks completed and checked off
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly
  • 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-list-effective-panel-conflicts` - **Commit Message**: `fix(cli): add rich Panel format and Conflicts Resolved section to invariant list --effective` - **Milestone**: Backlog (no milestone — see backlog note below) - **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. ## Summary The `agents invariant list --effective` command is missing two spec-required output elements: 1. The bordered panel format (uses a plain `Table` instead of a `Panel`-wrapped table) 2. The "Conflicts Resolved" section showing which invariants were overridden and why ## Background and Context Code analysis of `src/cleveragents/cli/commands/invariant.py` lines 218-239 compared against `docs/specification.md` §17968-18014 reveals that the `--effective` output path does not match the spec-defined rich output format. All other CLI commands (e.g., `action.py`, `plan.py`, `project.py`) correctly use `from rich.panel import Panel` — the `--effective` branch of `invariant.py` renders a plain `rich.table.Table` with no panel wrapper and no conflict summary. Additionally, the underlying service architecture does not surface conflict information to the CLI: `InvariantService.list_invariants(effective=True)` returns only `list[Invariant]`, discarding the `ReconciliationResult.conflicts` data produced by `InvariantReconciliationActor.run()`. ## Expected Behavior (from spec §17968-18014) `agents invariant list --plan 01HXM8C2ZK4Q7C2B3F2R4VYV6J --effective` should produce: ``` ╭─ Effective Invariants (Plan 01HXM8C2ZK4Q7C2B3F2R4VYV6J) ──────────────────────────────────╮ │ ID Source Text │ │ ────────────── ─────── ────────────────────────────────────────────────────── │ │ inv_01HXM9A1B global All public APIs must maintain backward compatibility │ │ inv_01HXM9A2C project All endpoints must validate auth tokens │ │ inv_01HXM9G3A plan All database queries must use parameterized statements │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ │ Conflicts Resolved: 1 │ │ Global "Use shared DB pool" overridden by plan "All database queries must use │ │ parameterized statements" │ ✓ OK 3 effective invariants (1 global, 1 project, 1 plan; 1 conflict resolved) ``` ## Actual Behavior The implementation (`src/cleveragents/cli/commands/invariant.py` lines 218-239) renders a plain `rich.table.Table` with columns: ID, Scope, Source, Text, Active. There is: 1. No bordered panel wrapper (no `╭─ Effective Invariants ─╮` header) 2. No "Conflicts Resolved" section — the `list_invariants(effective=True)` call returns only the merged invariant list, with no conflict information passed back to the CLI 3. No summary line like `✓ OK 3 effective invariants (1 global, 1 project, 1 plan; 1 conflict resolved)` ## Root Cause The `InvariantService.list_invariants(effective=True)` method calls `get_effective_invariants()` which returns only `list[Invariant]` — it does not return conflict records. The `InvariantReconciliationActor.run()` returns a `ReconciliationResult` with `conflicts: list[ConflictRecord]`, but the CLI `list` command does not use the reconciliation actor — it only calls the service's merge function. To show conflicts in `--effective` output, the CLI would need to either: - Call the reconciliation actor directly and use its `ReconciliationResult.conflicts` - Or have `get_effective_invariants()` return conflict information alongside the merged list ## Code Location - `src/cleveragents/cli/commands/invariant.py` lines 218-239 (list rich output) - `src/cleveragents/application/services/invariant_service.py` lines 165-200 (`get_effective_invariants`) - `src/cleveragents/actor/reconciliation.py` lines 293-389 (`InvariantReconciliationActor.run`) ## Steps to Reproduce 1. Add invariants at multiple scopes with some conflicts 2. Run `agents invariant list --plan <PLAN_ID> --effective` 3. Observe: no panel format, no conflicts section ## Subtasks - [ ] Wrap the `--effective` table output in a `rich.panel.Panel` with title `Effective Invariants (<scope context>)` matching the spec format - [ ] Extend `get_effective_invariants()` (or add a new method) in `InvariantService` to return both the merged `list[Invariant]` and the `list[ConflictRecord]` from the reconciliation result - [ ] Update the CLI `list --effective` handler to receive and render the "Conflicts Resolved" section using the returned conflict records - [ ] Add the summary line `✓ OK N effective invariants (X global, Y project, Z plan; W conflict(s) resolved)` below the panel - [ ] Tests (Behave): Add/update scenarios in `features/invariant_cli.feature` asserting panel format and conflicts section appear in `--effective` output - [ ] Tests (Behave): Add scenario for zero-conflict case (no "Conflicts Resolved" section rendered when there are no conflicts) - [ ] Tests (Robot): Add integration test for `agents invariant list --effective` with multi-scope invariants and at least one conflict - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] `agents invariant list --effective` renders a rich bordered panel matching the spec format (§17968-18014) - [ ] The "Conflicts Resolved" section is displayed when conflicts exist, and omitted when there are none - [ ] The summary line correctly counts invariants by scope and resolved conflicts - [ ] `InvariantService.get_effective_invariants()` (or equivalent) surfaces conflict records to the CLI layer - [ ] Output is visually consistent with all other CLI commands - [ ] All subtasks completed and checked off - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation - [ ] The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly - [ ] 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
freemo added this to the v3.7.0 milestone 2026-04-05 20:05:37 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Low — CLI output formatting issue. The --effective flag output is missing panel format and "Conflicts Resolved" section. Requires service layer changes to surface conflict data.
  • Milestone: v3.7.0
  • Story Points: 5 — L — Requires extending InvariantService.get_effective_invariants() to return conflict records, updating CLI rendering, and writing both Behave and Robot Framework tests. More complex than a simple output fix.
  • MoSCoW: Could Have — Output formatting polish that also requires service layer changes. The effective invariant list works functionally; it just doesn't show conflict resolution details. Can be deferred.
  • Parent Epic: #394 (dependency link already exists)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Low — CLI output formatting issue. The `--effective` flag output is missing panel format and "Conflicts Resolved" section. Requires service layer changes to surface conflict data. - **Milestone**: v3.7.0 - **Story Points**: 5 — L — Requires extending `InvariantService.get_effective_invariants()` to return conflict records, updating CLI rendering, and writing both Behave and Robot Framework tests. More complex than a simple output fix. - **MoSCoW**: Could Have — Output formatting polish that also requires service layer changes. The effective invariant list works functionally; it just doesn't show conflict resolution details. Can be deferred. - **Parent Epic**: #394 (dependency link already exists) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo removed this from the v3.7.0 milestone 2026-04-06 23:43:28 +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#3527
No description provided.