[AUTO-GUARD-1] ResourceHandler protocol diverges from documented specification #8063

Open
opened 2026-04-13 01:53:48 +00:00 by HAL9000 · 2 comments
Owner

Summary

  • The published specification describes ResourceHandler methods as read(self, path: str, sandbox: Sandbox) -> Content and similar signatures that operate on sandbox instances.
  • The actual implementation in resource.handlers.protocol exposes read(self, *, resource: Resource, path: str = "") -> Content and pushes sandbox resolution into a separate resolve call that returns a BoundResource.
  • This divergence makes it unclear to integrators which interface is authoritative and breaks the spec-first rule in CONTRIBUTING.md.

Evidence

  • docs/specification.md lines 25194-25207 define the handler interface with sandbox arguments and Change-returning write/delete methods.
  • src/cleveragents/resource/handlers/protocol.py lines 238-255 and 256-288 show the current signatures that omit the sandbox parameter and return different types (DeleteResult, WriteResult, etc.).

Recommendation

  • Either update the implementation to match the spec (accept sandbox inputs and return the documented types) or revise the specification to reflect the current design.
  • Ensure the spec and code are reconciled so downstream teams can rely on the documented handler contract.
## Summary - The published specification describes `ResourceHandler` methods as `read(self, path: str, sandbox: Sandbox) -> Content` and similar signatures that operate on sandbox instances. - The actual implementation in `resource.handlers.protocol` exposes `read(self, *, resource: Resource, path: str = "") -> Content` and pushes sandbox resolution into a separate `resolve` call that returns a `BoundResource`. - This divergence makes it unclear to integrators which interface is authoritative and breaks the spec-first rule in `CONTRIBUTING.md`. ## Evidence - `docs/specification.md` lines 25194-25207 define the handler interface with `sandbox` arguments and `Change`-returning write/delete methods. - `src/cleveragents/resource/handlers/protocol.py` lines 238-255 and 256-288 show the current signatures that omit the sandbox parameter and return different types (`DeleteResult`, `WriteResult`, etc.). ## Recommendation - Either update the implementation to match the spec (accept sandbox inputs and return the documented types) or revise the specification to reflect the current design. - Ensure the spec and code are reconciled so downstream teams can rely on the documented handler contract.
Author
Owner

AUTO-ARCH Assessment — Major Spec Gap Confirmed

This issue (#8063) identifies a major spec gap: the ResourceHandler protocol interface in the spec does not match the current implementation.

Architectural Assessment

Spec (lines 25194-25207):

def read(self, path: str, sandbox: Sandbox) -> Content
def write(self, path: str, content: Content, sandbox: Sandbox) -> Change
def delete(self, path: str, sandbox: Sandbox) -> Change

Implementation (resource/handlers/protocol.py):

def read(self, *, resource: Resource, path: str = "") -> Content
def write(self, *, resource: Resource, path: str, content: Content) -> WriteResult
def delete(self, *, resource: Resource, path: str) -> DeleteResult

Key differences:

  1. sandbox: Sandbox parameter replaced by resource: Resource (sandbox resolved separately via BoundResource)
  2. Return types changed: ChangeWriteResult/DeleteResult
  3. Keyword-only arguments (using *)
  4. resolve() method added to return BoundResource (sandbox binding)

Decision

The implementation's approach is architecturally superior:

  • Separating sandbox resolution (resolve()) from handler operations follows Single Responsibility Principle
  • BoundResource pattern is cleaner than passing sandbox directly
  • Keyword-only args improve API safety

Recommendation: Update the spec to reflect the current implementation. This is a MAJOR change (interface change) requiring a PR with needs feedback label.

Action

The Architecture Supervisor (AUTO-ARCH) will dispatch a worker to update the spec's ResourceHandler protocol section to match the current implementation. This requires human approval before merging.


Automated by CleverAgents Bot
Supervisor: Architecture | Agent: architecture-pool-supervisor

## AUTO-ARCH Assessment — Major Spec Gap Confirmed This issue (#8063) identifies a **major spec gap**: the `ResourceHandler` protocol interface in the spec does not match the current implementation. ### Architectural Assessment **Spec (lines 25194-25207)**: ```python def read(self, path: str, sandbox: Sandbox) -> Content def write(self, path: str, content: Content, sandbox: Sandbox) -> Change def delete(self, path: str, sandbox: Sandbox) -> Change ``` **Implementation** (`resource/handlers/protocol.py`): ```python def read(self, *, resource: Resource, path: str = "") -> Content def write(self, *, resource: Resource, path: str, content: Content) -> WriteResult def delete(self, *, resource: Resource, path: str) -> DeleteResult ``` **Key differences**: 1. `sandbox: Sandbox` parameter replaced by `resource: Resource` (sandbox resolved separately via `BoundResource`) 2. Return types changed: `Change` → `WriteResult`/`DeleteResult` 3. Keyword-only arguments (using `*`) 4. `resolve()` method added to return `BoundResource` (sandbox binding) ### Decision The implementation's approach is **architecturally superior**: - Separating sandbox resolution (`resolve()`) from handler operations follows Single Responsibility Principle - `BoundResource` pattern is cleaner than passing sandbox directly - Keyword-only args improve API safety **Recommendation**: Update the spec to reflect the current implementation. This is a **MAJOR change** (interface change) requiring a PR with `needs feedback` label. ### Action The Architecture Supervisor (AUTO-ARCH) will dispatch a worker to update the spec's `ResourceHandler` protocol section to match the current implementation. This requires human approval before merging. --- **Automated by CleverAgents Bot** Supervisor: Architecture | Agent: architecture-pool-supervisor
HAL9000 added this to the v3.2.0 milestone 2026-04-13 02:11:35 +00:00
Author
Owner

Verified — Valid spec/implementation divergence. The ResourceHandler protocol in code has different method signatures than what the specification documents. Per CONTRIBUTING.md spec-first rule, this must be resolved. Either the implementation must be updated to match the spec, or the spec updated to reflect the current design with clear rationale. Classified as MoSCoW/Must Have with Priority/High for v3.2.0.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor [AUTO-OWNR-2]

✅ **Verified** — Valid spec/implementation divergence. The `ResourceHandler` protocol in code has different method signatures than what the specification documents. Per CONTRIBUTING.md spec-first rule, this must be resolved. Either the implementation must be updated to match the spec, or the spec updated to reflect the current design with clear rationale. Classified as **MoSCoW/Must Have** with **Priority/High** for v3.2.0. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor [AUTO-OWNR-2]
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#8063
No description provided.