UAT: agents invariant add missing --non-overridable flag — spec-defined non-overridable global invariants cannot be created via CLI #2534

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

Metadata

  • Branch: feat/invariant-non-overridable-flag
  • Commit Message: feat(invariant): add --non-overridable flag to agents invariant add command
  • Milestone: v3.4.0
  • Parent Epic: #394

Background and Context

The Invariant domain model has a non_overridable field:

non_overridable: bool = Field(
    default=False,
    description=(
        "When True and scope is GLOBAL, this invariant cannot be "
        "overridden by lower-scope invariants during reconciliation"
    ),
)

The InvariantReconciliationActor correctly handles non_overridable invariants — when a global invariant has non_overridable=True, it cannot be overridden by plan, project, or action invariants (verified in features/invariant_reconciliation_actor.feature).

However, the agents invariant add CLI command has no --non-overridable flag, making it impossible to create non-overridable invariants via the CLI.

Steps to Reproduce

agents invariant add --global "Payment processing must be idempotent" --non-overridable
# Error: No such option: --non-overridable

Expected Behavior (per spec)

The agents invariant add command should accept a --non-overridable flag that sets non_overridable=True on the created invariant. This flag should only be valid with --global scope (since non_overridable only applies to global invariants).

Actual Behavior

The agents invariant add command signature is:

def add(
    text: str,
    is_global: bool = False,
    project: str | None = None,
    plan: str | None = None,
    action: str | None = None,
    fmt: str = "rich",
) -> None:

There is no --non-overridable flag. The InvariantService.add_invariant() method also does not accept a non_overridable parameter.

Code Location

  • src/cleveragents/cli/commands/invariant.pyadd() command missing --non-overridable flag
  • src/cleveragents/application/services/invariant_service.pyadd_invariant() missing non_overridable parameter

Impact

  • Non-overridable global invariants can only be created programmatically, not via CLI
  • The InvariantReconciliationActor correctly handles non_overridable invariants but they cannot be created through the standard user interface
  • The feature is tested in features/invariant_reconciliation_actor.feature but not accessible via CLI

Subtasks

  • Add --non-overridable flag to agents invariant add command
  • Add validation that --non-overridable is only valid with --global scope
  • Add non_overridable: bool = False parameter to InvariantService.add_invariant()
  • Pass non_overridable to the Invariant constructor
  • Add unit tests for the new flag

Definition of Done

  • agents invariant add --global "rule" --non-overridable creates a non-overridable global invariant
  • agents invariant add --project myapp "rule" --non-overridable is rejected with a clear error
  • InvariantService.add_invariant() accepts non_overridable parameter
  • All tests pass

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

## Metadata - **Branch**: `feat/invariant-non-overridable-flag` - **Commit Message**: `feat(invariant): add --non-overridable flag to agents invariant add command` - **Milestone**: v3.4.0 - **Parent Epic**: #394 ## Background and Context The `Invariant` domain model has a `non_overridable` field: ```python non_overridable: bool = Field( default=False, description=( "When True and scope is GLOBAL, this invariant cannot be " "overridden by lower-scope invariants during reconciliation" ), ) ``` The `InvariantReconciliationActor` correctly handles `non_overridable` invariants — when a global invariant has `non_overridable=True`, it cannot be overridden by plan, project, or action invariants (verified in `features/invariant_reconciliation_actor.feature`). However, the `agents invariant add` CLI command has no `--non-overridable` flag, making it impossible to create non-overridable invariants via the CLI. ## Steps to Reproduce ```bash agents invariant add --global "Payment processing must be idempotent" --non-overridable # Error: No such option: --non-overridable ``` ## Expected Behavior (per spec) The `agents invariant add` command should accept a `--non-overridable` flag that sets `non_overridable=True` on the created invariant. This flag should only be valid with `--global` scope (since `non_overridable` only applies to global invariants). ## Actual Behavior The `agents invariant add` command signature is: ```python def add( text: str, is_global: bool = False, project: str | None = None, plan: str | None = None, action: str | None = None, fmt: str = "rich", ) -> None: ``` There is no `--non-overridable` flag. The `InvariantService.add_invariant()` method also does not accept a `non_overridable` parameter. ## Code Location - `src/cleveragents/cli/commands/invariant.py` — `add()` command missing `--non-overridable` flag - `src/cleveragents/application/services/invariant_service.py` — `add_invariant()` missing `non_overridable` parameter ## Impact - Non-overridable global invariants can only be created programmatically, not via CLI - The `InvariantReconciliationActor` correctly handles `non_overridable` invariants but they cannot be created through the standard user interface - The feature is tested in `features/invariant_reconciliation_actor.feature` but not accessible via CLI ## Subtasks - [ ] Add `--non-overridable` flag to `agents invariant add` command - [ ] Add validation that `--non-overridable` is only valid with `--global` scope - [ ] Add `non_overridable: bool = False` parameter to `InvariantService.add_invariant()` - [ ] Pass `non_overridable` to the `Invariant` constructor - [ ] Add unit tests for the new flag ## Definition of Done - `agents invariant add --global "rule" --non-overridable` creates a non-overridable global invariant - `agents invariant add --project myapp "rule" --non-overridable` is rejected with a clear error - `InvariantService.add_invariant()` accepts `non_overridable` parameter - All tests pass --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Spec compliance or quality improvement.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Spec compliance or quality improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo added this to the v3.3.0 milestone 2026-04-05 05:07:03 +00:00
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.

Dependencies

No dependencies set.

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