fix(cli): add Invariants and Validations panels to project show rich output #9460

Open
HAL9000 wants to merge 2 commits from fix/project-show-missing-panels into master

2 Commits

Author SHA1 Message Date
HAL9000 1e5797507a fix(db,cli): restore PlanModel.result_success and fix import ordering
CI / lint (pull_request) Successful in 43s
CI / typecheck (pull_request) Successful in 1m10s
CI / quality (pull_request) Successful in 49s
CI / helm (pull_request) Successful in 34s
CI / build (pull_request) Successful in 41s
CI / security (pull_request) Successful in 1m11s
CI / push-validation (pull_request) Successful in 46s
CI / unit_tests (pull_request) Failing after 4m46s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Has been skipped
CI / integration_tests (pull_request) Failing after 14m53s
CI / status-check (pull_request) Has been cancelled
Blocker 1 — Restore result_success column in PlanModel:
Commit 45b0e084 unintentionally removed the result_success=Column(Boolean, nullable=True)
column from PlanModel. This column is actively referenced by repositories.py at lines
297, 376, and 425-432 (result derivation logic). Its absence caused unit_tests,
integration_tests, and e2e_tests CI failures due to AttributeError on unknown column.

Blocker 2 — Fix import ordering in project_legacy.py:
The if TYPE_CHECKING: block appeared between stdlib imports and third-party imports
(import typer), violating ruff isort rule I001. Moved the TYPE_CHECKING block after
all unconditional imports (stdlib, third-party, first-party) to satisfy lint.
2026-06-03 12:16:20 -04:00
HAL9000 207d65e87e fix(cli): add Invariants and Validations panels to project show rich output
The `agents project show` command now displays Invariants and Validations
panels in its rich output, completing the specification for project display.

Domain model updates:
- Added `invariants: list[str]` and `invariant_actor: str | None` fields to
  NamespacedProject domain model with backward-compatible defaults
- Updated NamespacedProjectModel.to_domain() to parse invariants from JSON
- Fixed from_domain() to preserve actual invariants/invariant_actor data

CLI output enhancements:
- Extracted project show logic into dedicated project_show.py module
- Invariants panel: displays count and list of project-level invariants
  or '(none)' when no invariants are defined
- Validations panel: displays validation attachments for linked resources
- Invariant Actor field displayed when configured

Refactoring:
- Split oversized project.py (654 lines) into modular files under 500 lines:
  * project_show.py - show command and display helpers
  * project_legacy.py - legacy file-filter sub-app preserved
  * project_resource_commands.py - resource link/unlink/delete commands

Database roundtrip fix:
- from_domain() now properly serializes actual invariants_json (was hardcoded
  to empty list) and invariant_actor (was hardcoded to None)

BDD/Behave coverage added:
- Scenario: Create a project with invariants
- Scenario: Project spec dict contains invariants and validations keys
- Scenario: Show project with no invariants displays none
- Scenario: Show project with invariants displays invariant list
- Scenario: Show project with invariant_actor displays actor

ISSUES CLOSED: #9333
2026-06-03 12:16:20 -04:00