UAT: CloudResourceHandler does not inherit from BaseResourceHandler — inconsistent with DatabaseResourceHandler and missing shared lifecycle methods #5944

Open
opened 2026-04-09 12:06:30 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: Resource Management — Cloud Infrastructure Resources / Handler Architecture
Milestone Scope: v3.6.0 (cloud resource handler, issue #343)
Severity: Low — architectural inconsistency, missing inherited lifecycle methods


What Was Tested

Code-level analysis of src/cleveragents/resource/handlers/cloud.py vs src/cleveragents/resource/handlers/database.py and src/cleveragents/resource/handlers/_base.py.

Expected Behavior (from spec / architecture)

Per docs/reference/resource_handlers.md and the handler architecture:

All resource handlers should implement the ResourceHandler protocol. The BaseResourceHandler class provides shared implementations for:

  • create_sandbox() — idempotent sandbox creation
  • project_access() — permission checking
  • content_hash() — default file/directory hashing
  • _require_location() — location validation helper
  • _safe_resolve() — path traversal protection

DatabaseResourceHandler correctly inherits from BaseResourceHandler.

Actual Behavior

CloudResourceHandler is a standalone class that does NOT inherit from BaseResourceHandler:

class CloudResourceHandler:  # ← no base class
    """Handler for cloud infrastructure resource types."""

Compare with DatabaseResourceHandler:

class DatabaseResourceHandler(BaseResourceHandler):  # ← correct
    """Handler for database resource types."""

As a result, CloudResourceHandler:

  1. Duplicates the create_sandbox(), create_checkpoint(), rollback_to(), and project_access() lifecycle stubs instead of inheriting them
  2. Does not inherit _require_location() and _safe_resolve() helpers
  3. Does not inherit the default content_hash() implementation from BaseResourceHandler (though it provides its own override, which is correct)
  4. Is architecturally inconsistent with the rest of the handler system

Code Location

  • src/cleveragents/resource/handlers/cloud.pyCloudResourceHandler class definition
  • src/cleveragents/resource/handlers/_base.pyBaseResourceHandler base class
  • src/cleveragents/resource/handlers/database.pyDatabaseResourceHandler(BaseResourceHandler) (correct pattern)

Impact

  • Code duplication: lifecycle stubs (create_sandbox, create_checkpoint, rollback_to, project_access) are duplicated in CloudResourceHandler instead of inherited
  • Future changes to BaseResourceHandler (e.g., adding new lifecycle methods) will not automatically apply to CloudResourceHandler
  • Inconsistency makes the codebase harder to maintain and understand

Fix

Change CloudResourceHandler to inherit from BaseResourceHandler:

from cleveragents.resource.handlers._base import BaseResourceHandler

class CloudResourceHandler(BaseResourceHandler):
    """Handler for cloud infrastructure resource types."""
    
    _default_strategy = SandboxStrategy.NONE
    _type_label = "cloud"

Then remove the duplicated lifecycle stubs (create_sandbox, create_checkpoint, rollback_to, project_access) since they are inherited from BaseResourceHandler. Keep the resolve() and content_hash() overrides since they are cloud-specific.


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

## Bug Report **Feature Area**: Resource Management — Cloud Infrastructure Resources / Handler Architecture **Milestone Scope**: v3.6.0 (cloud resource handler, issue #343) **Severity**: Low — architectural inconsistency, missing inherited lifecycle methods --- ## What Was Tested Code-level analysis of `src/cleveragents/resource/handlers/cloud.py` vs `src/cleveragents/resource/handlers/database.py` and `src/cleveragents/resource/handlers/_base.py`. ## Expected Behavior (from spec / architecture) Per `docs/reference/resource_handlers.md` and the handler architecture: All resource handlers should implement the `ResourceHandler` protocol. The `BaseResourceHandler` class provides shared implementations for: - `create_sandbox()` — idempotent sandbox creation - `project_access()` — permission checking - `content_hash()` — default file/directory hashing - `_require_location()` — location validation helper - `_safe_resolve()` — path traversal protection `DatabaseResourceHandler` correctly inherits from `BaseResourceHandler`. ## Actual Behavior `CloudResourceHandler` is a **standalone class** that does NOT inherit from `BaseResourceHandler`: ```python class CloudResourceHandler: # ← no base class """Handler for cloud infrastructure resource types.""" ``` Compare with `DatabaseResourceHandler`: ```python class DatabaseResourceHandler(BaseResourceHandler): # ← correct """Handler for database resource types.""" ``` As a result, `CloudResourceHandler`: 1. **Duplicates** the `create_sandbox()`, `create_checkpoint()`, `rollback_to()`, and `project_access()` lifecycle stubs instead of inheriting them 2. **Does not inherit** `_require_location()` and `_safe_resolve()` helpers 3. **Does not inherit** the default `content_hash()` implementation from `BaseResourceHandler` (though it provides its own override, which is correct) 4. Is **architecturally inconsistent** with the rest of the handler system ## Code Location - `src/cleveragents/resource/handlers/cloud.py` — `CloudResourceHandler` class definition - `src/cleveragents/resource/handlers/_base.py` — `BaseResourceHandler` base class - `src/cleveragents/resource/handlers/database.py` — `DatabaseResourceHandler(BaseResourceHandler)` (correct pattern) ## Impact - Code duplication: lifecycle stubs (`create_sandbox`, `create_checkpoint`, `rollback_to`, `project_access`) are duplicated in `CloudResourceHandler` instead of inherited - Future changes to `BaseResourceHandler` (e.g., adding new lifecycle methods) will not automatically apply to `CloudResourceHandler` - Inconsistency makes the codebase harder to maintain and understand ## Fix Change `CloudResourceHandler` to inherit from `BaseResourceHandler`: ```python from cleveragents.resource.handlers._base import BaseResourceHandler class CloudResourceHandler(BaseResourceHandler): """Handler for cloud infrastructure resource types.""" _default_strategy = SandboxStrategy.NONE _type_label = "cloud" ``` Then remove the duplicated lifecycle stubs (`create_sandbox`, `create_checkpoint`, `rollback_to`, `project_access`) since they are inherited from `BaseResourceHandler`. Keep the `resolve()` and `content_hash()` overrides since they are cloud-specific. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

🏷️ Label compliance fix applied by backlog groomer (cycle 60)

This issue was missing its State/ label. The following label has been added:

  • State/Verified — UAT-confirmed architectural inconsistency; existing Priority/Backlog and Type/Bug labels retained

Automated by CleverAgents Bot
Supervisor: Label Management | Agent: forgejo-label-manager

🏷️ **Label compliance fix applied by backlog groomer (cycle 60)** This issue was missing its `State/` label. The following label has been added: - `State/Verified` — UAT-confirmed architectural inconsistency; existing `Priority/Backlog` and `Type/Bug` labels retained --- **Automated by CleverAgents Bot** Supervisor: Label Management | Agent: forgejo-label-manager
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#5944
No description provided.