UAT: ResourceHandlerService._DefaultHandler raises NotImplementedError for all CRUD operations — resources without explicit handlers fail at runtime #3709

Open
opened 2026-04-05 22:15:45 +00:00 by freemo · 0 comments
Owner

Bug Report

What Was Tested

src/cleveragents/application/services/resource_handler_service.py _DefaultHandler class (lines 287-423) was analyzed for runtime behavior when a resource type has no handler or handler resolution fails.

Expected Behavior (from spec)

Resources should be accessible (read/write/list) through their handlers. When a resource type has no explicit handler, a reasonable default behavior should be provided — at minimum, the resolve() method should work for sandbox creation, and CRUD operations should either work or provide a meaningful error message.

Actual Behavior (from code analysis)

_DefaultHandler raises NotImplementedError for ALL CRUD and lifecycle operations:

def read(self, *, resource: Resource, path: str = "") -> Content:
    raise NotImplementedError("Default handler does not support read()")

def write(self, *, resource: Resource, path: str, data: bytes) -> WriteResult:
    raise NotImplementedError("Default handler does not support write()")

def delete(self, *, resource: Resource, path: str = "") -> DeleteResult:
    raise NotImplementedError("Default handler does not support delete()")

def list_children(self, *, resource: Resource) -> list[str]:
    raise NotImplementedError("Default handler does not support list_children()")

def diff(self, *, resource: Resource, other_location: str) -> DiffResult:
    raise NotImplementedError("Default handler does not support diff()")

def discover_children(self, *, resource: Resource) -> list[Resource]:
    raise NotImplementedError("Default handler does not support discover_children()")

def create_sandbox(self, ...) -> SandboxResult:
    raise NotImplementedError("Default handler does not support create_sandbox()")

def create_checkpoint(self, ...) -> CheckpointResult:
    raise NotImplementedError("Default handler does not support create_checkpoint()")

def rollback_to(self, ...) -> RollbackResult:
    raise NotImplementedError("Default handler does not support rollback_to()")

def project_access(self, ...) -> AccessResult:
    raise NotImplementedError("Default handler does not support project_access()")

The _DefaultHandler is used when:

  1. A resource type has handler=None (e.g., all virtual types: file, directory, commit, branch, tag, tree)
  2. Handler resolution fails (e.g., handler module not found)

This means all virtual resource types (which have handler=None) will raise NotImplementedError for any CRUD operation attempted through ResourceHandlerService.

Impact

  • All virtual resource types (file, directory, commit, branch, tag, tree, remote, submodule, symlink) will fail with NotImplementedError on any CRUD operation
  • Handler resolution failures silently fall back to _DefaultHandler which then raises NotImplementedError — the original error is lost
  • project_access() raises NotImplementedError — access control checks for resources will fail

Code Locations

  • src/cleveragents/application/services/resource_handler_service.py lines 287-423
  • Virtual types with handler=None: src/cleveragents/application/services/_resource_registry_virtual.py

Steps to Reproduce

  1. Register a virtual resource (e.g., type file)
  2. Attempt ResourceHandlerService.resolve_resource(resource, plan_id, slot_name) — succeeds (uses sandbox)
  3. Attempt handler.read(resource=resource) — raises NotImplementedError

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

## Bug Report ### What Was Tested `src/cleveragents/application/services/resource_handler_service.py` `_DefaultHandler` class (lines 287-423) was analyzed for runtime behavior when a resource type has no handler or handler resolution fails. ### Expected Behavior (from spec) Resources should be accessible (read/write/list) through their handlers. When a resource type has no explicit handler, a reasonable default behavior should be provided — at minimum, the `resolve()` method should work for sandbox creation, and CRUD operations should either work or provide a meaningful error message. ### Actual Behavior (from code analysis) `_DefaultHandler` raises `NotImplementedError` for ALL CRUD and lifecycle operations: ```python def read(self, *, resource: Resource, path: str = "") -> Content: raise NotImplementedError("Default handler does not support read()") def write(self, *, resource: Resource, path: str, data: bytes) -> WriteResult: raise NotImplementedError("Default handler does not support write()") def delete(self, *, resource: Resource, path: str = "") -> DeleteResult: raise NotImplementedError("Default handler does not support delete()") def list_children(self, *, resource: Resource) -> list[str]: raise NotImplementedError("Default handler does not support list_children()") def diff(self, *, resource: Resource, other_location: str) -> DiffResult: raise NotImplementedError("Default handler does not support diff()") def discover_children(self, *, resource: Resource) -> list[Resource]: raise NotImplementedError("Default handler does not support discover_children()") def create_sandbox(self, ...) -> SandboxResult: raise NotImplementedError("Default handler does not support create_sandbox()") def create_checkpoint(self, ...) -> CheckpointResult: raise NotImplementedError("Default handler does not support create_checkpoint()") def rollback_to(self, ...) -> RollbackResult: raise NotImplementedError("Default handler does not support rollback_to()") def project_access(self, ...) -> AccessResult: raise NotImplementedError("Default handler does not support project_access()") ``` The `_DefaultHandler` is used when: 1. A resource type has `handler=None` (e.g., all virtual types: `file`, `directory`, `commit`, `branch`, `tag`, `tree`) 2. Handler resolution fails (e.g., handler module not found) This means **all virtual resource types** (which have `handler=None`) will raise `NotImplementedError` for any CRUD operation attempted through `ResourceHandlerService`. ### Impact - All virtual resource types (`file`, `directory`, `commit`, `branch`, `tag`, `tree`, `remote`, `submodule`, `symlink`) will fail with `NotImplementedError` on any CRUD operation - Handler resolution failures silently fall back to `_DefaultHandler` which then raises `NotImplementedError` — the original error is lost - `project_access()` raises `NotImplementedError` — access control checks for resources will fail ### Code Locations - `src/cleveragents/application/services/resource_handler_service.py` lines 287-423 - Virtual types with `handler=None`: `src/cleveragents/application/services/_resource_registry_virtual.py` ### Steps to Reproduce 1. Register a virtual resource (e.g., type `file`) 2. Attempt `ResourceHandlerService.resolve_resource(resource, plan_id, slot_name)` — succeeds (uses sandbox) 3. Attempt `handler.read(resource=resource)` — raises `NotImplementedError` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
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#3709
No description provided.