Commit Graph

1 Commits

Author SHA1 Message Date
freemo 0a8e5cb388 fix(cli): display resource name in project show linked resources list
- What was implemented
  - Added _resolve_resource_names() helper in src/cleveragents/cli/commands/project.py that queries the Resource Registry to map resource ULIDs to their namespaced names, with graceful fallback to None when the registry is unavailable or a resource has no name
  - Updated _project_spec_dict() to accept an optional resource_names dict parameter and include resource_name alongside resource_id in JSON/YAML output formats
  - Updated show command to resolve resource names before display, showing human-readable names (e.g. local/my-git-repo) instead of raw ULIDs, falling back to ULID when name is unavailable
  - Added BDD feature file features/project_show_resource_name.feature with 6 regression scenarios
  - Added step definitions features/steps/project_show_resource_name_steps.py

- Key design decisions
  - Graceful degradation: if the Resource Registry is unavailable, the show command still works and falls back to displaying the raw ULID
  - Resources without names (auto-discovered) also fall back to ULID display
  - JSON/YAML output includes both resource_id and resource_name for completeness
  - The fix is minimal and non-breaking: _project_spec_dict() only includes resource_name when resource_names dict is explicitly passed

- Rationale and implementation notes
  - _resolve_resource_names() provides a bounded, resilient means to enrich output with human-readable names without breaking on registry failures
  - The show command uses resolved names for display while preserving IDs as the underlying data source
  - Outputs (JSON/YAML) expose both IDs and names when available, ensuring downstream consumers have full context

- Modules/Components Affected
  - src/cleveragents/cli/commands/project.py
  - tests/BDD: features/project_show_resource_name.feature
  - tests/BDD steps: features/steps/project_show_resource_name_steps.py

- Backwards compatibility
  - Non-breaking: if resource_names is not provided or the registry is unavailable, behavior remains compatible by falling back to ULIDs

- Testing
  - Added regression scenarios via the new feature file and step definitions to validate name resolution and fallback behavior

ISSUES CLOSED: #2943
2026-06-06 03:29:32 -04:00