Feature: Resource CLI coverage boost for remaining uncovered lines As a developer I want edge-case paths in resource.py thoroughly tested So that the line-rate and branch-rate improve beyond 0.93 / 0.88 # ---- _get_registry_service (lines 79-81) ---- Scenario: _get_registry_service delegates to the DI container Given the DI container is mocked for resource registry When _get_registry_service is called directly Then the returned service should be the mock registry service # ---- type_add --update re-raises ValidationError (line 181) ---- Scenario: type_add --update re-raises ValidationError whose message lacks "already exists" Given a mock resource service that raises a non-already-exists ValidationError on register_type When I invoke type add with update flag via CliRunner Then the CliRunner exit code should be non-zero And the CliRunner output should contain "Validation error" # ---- type_add FileNotFoundError (lines 193-195) ---- Scenario: type_add catches FileNotFoundError from service Given a mock resource service that raises FileNotFoundError on register_type When I invoke type add with a dummy config via CliRunner Then the CliRunner exit code should be non-zero And the CliRunner output should contain "Config file not found" # ---- type_remove confirm declined (lines 234-236) ---- Scenario: type_remove aborts when user declines confirmation prompt Given a mock resource service with a removable custom type When I invoke type remove without --yes and answer no via CliRunner Then the CliRunner exit code should be non-zero And the CliRunner output should contain "Aborted" # ---- type_remove NotFoundError from service (lines 263-265) ---- Scenario: type_remove aborts when service.remove_type raises NotFoundError Given a mock resource service whose remove_type raises NotFoundError When I invoke type remove with --yes via CliRunner for the phantom type Then the CliRunner exit code should be non-zero And the CliRunner output should contain "Resource type not found" # ---- type_remove ValidationError from service (lines 269-271) ---- Scenario: type_remove aborts when service.remove_type raises ValidationError Given a mock resource service whose remove_type raises ValidationError When I invoke type remove with --yes via CliRunner for the failing type Then the CliRunner exit code should be non-zero And the CliRunner output should contain "Error:" # ---- resource_remove edge_count > 0 (lines 653-658) ---- Scenario: resource_remove aborts when resource has edges Given a mock resource service whose session reports edges on the resource When I invoke resource remove with --yes via CliRunner for the edged resource Then the CliRunner exit code should be non-zero And the CliRunner output should contain "edge(s) still reference it" # ---- resource_remove generic Exception rollback (lines 668-672) ---- Scenario: resource_remove rolls back session on unexpected exception Given a mock resource service whose session delete raises a generic exception for resource When I invoke resource remove with --yes via CliRunner for the failing resource Then the CliRunner exit code should be non-zero And the mock session rollback should have been called for resource remove