fix(cli): fix invariant add scope handling #11058

Merged
HAL9000 merged 10 commits from fix/invariant-scope-handling into master 2026-06-18 06:55:58 +00:00

10 Commits

Author SHA1 Message Date
HAL9000 c7a20eccd0 fix(cli): preserve no-flag list_invariants "all scopes" semantics
CI / load-versions (pull_request) Successful in 31s
CI / push-validation (pull_request) Successful in 37s
CI / lint (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 1m10s
CI / security (pull_request) Successful in 1m24s
CI / build (pull_request) Successful in 36s
CI / quality (pull_request) Successful in 1m22s
CI / helm (pull_request) Successful in 2m7s
CI / unit_tests (pull_request) Successful in 7m55s
CI / docker (pull_request) Successful in 2m54s
CI / integration_tests (pull_request) Successful in 12m23s
CI / coverage (pull_request) Successful in 14m4s
CI / status-check (pull_request) Successful in 3s
The previous refactor routed list_invariants through _resolve_scope,
which silently changed the no-flags behavior: _resolve_scope returns
(GLOBAL, "system") when no flag is given (the `add` default), so
`agents invariant list` filtered to only global+system invariants
instead of returning every active invariant.

InvariantService.list_invariants documents scope=None / source_name=None
as "all scopes" / "all sources"; the listing CLI must preserve that
contract. Inline the mutual-exclusion check in list_invariants and
restore the if/elif chain that leaves scope/source_name=None when no
flag is set, while keeping `agents invariant add` defaulting to global.

Tests added:
- "List invariants with no flags passes no scope filter" verifies the
  service is called with scope=None, source_name=None.
- "List invariants with conflicting scope flags rejected" covers the
  new BadParameter raise path.

ISSUES CLOSED: #11049
2026-06-18 02:28:23 -04:00
controller-ci-rerun 875dce304e chore: re-trigger CI [controller] 2026-06-18 02:28:23 -04:00
CleverAgents Bot b7e2a03f6f ci: rerun helm gate after transient failure 2026-06-18 02:28:23 -04:00
cleveragents-auto 26662836aa test(cli): preserve invariant scope coverage after rebase 2026-06-18 02:28:23 -04:00
cleveragents-auto 5a711f9776 chore: re-trigger CI after no-status timeout 2026-06-18 02:28:23 -04:00
controller-ci-rerun d4e0307e29 chore: re-trigger CI [controller] 2026-06-18 02:28:23 -04:00
controller-ci-rerun ff97875c67 chore: re-trigger CI [controller] 2026-06-18 02:28:23 -04:00
controller-ci-rerun 4b87e68619 chore: re-trigger CI [controller] 2026-06-18 02:28:23 -04:00
HAL9000 ca2a050d51 fix(cli): fix invariant add scope handling (#11049)
Fix `_resolve_scope()` to properly check the `is_global` parameter
instead of silently ignoring it. Replace the standalone if/elif chain
in `list_invariants` with a call to `_resolve_scope()` so that scope
flag conflicts are consistently rejected on both `add` and `list`
commands via mutual-exclusion validation.

- Explicit global check in _resolve_scope() for correctness
- list_invariants uses shared _resolve_scope for consistent validation
- BDD coverage: add scenario for list with conflicting scope flags
- Robot coverage: add list-scope-conflict smoke test
- CHANGELOG.md and CONTRIBUTORS.md updated

ISSUES CLOSED: #11049
2026-06-18 02:28:23 -04:00
HAL9000 dd69f7cfbd fix invariant: use _resolve_scope consistently in list_invariants and respect is_global param
- Fix _resolve_scope() to properly use the is_global parameter instead of ignoring it
- Replace standalone if/elif chain in list_invariants with a call to _resolve_scope for consistent scope resolution
2026-06-18 02:28:23 -04:00