feat(resources): design and implement resource type extension interface #10784

Merged
HAL9000 merged 2 commits from feat/resources-extension-interface into master 2026-06-06 19:15:05 +00:00

2 Commits

Author SHA1 Message Date
HAL9000 82e6a7135e fix(resources): convert ResourceConfig to Pydantic and exercise real registry
CI / push-validation (pull_request) Successful in 34s
CI / lint (pull_request) Successful in 43s
CI / build (pull_request) Successful in 41s
CI / quality (pull_request) Successful in 1m3s
CI / helm (pull_request) Successful in 1m6s
CI / typecheck (pull_request) Successful in 1m14s
CI / security (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Successful in 6m29s
CI / docker (pull_request) Successful in 1m41s
CI / integration_tests (pull_request) Successful in 10m3s
CI / coverage (pull_request) Successful in 11m37s
CI / status-check (pull_request) Successful in 3s
Resolves the three remaining issues on PR #10784:

1. CI / unit_tests was failing on features/architecture.feature:38
   "Type hints are used throughout". That scenario asserts every
   src/cleveragents class decorated with @dataclass inherits from
   Pydantic BaseModel. Convert ResourceConfig from a dataclass to a
   pydantic.BaseModel; swap dataclasses.field(default_factory=dict)
   for pydantic.Field(default_factory=dict); drop the dataclasses
   import.

2. features/steps/resource_type_extension_interface_steps.py line 127
   used "# type: ignore[abstract]" to test that ResourceType refuses
   direct instantiation. CONTRIBUTING.md prohibits "# type: ignore"
   unconditionally. Replace the suppression with an Any-typed alias
   (resource_type_cls: Any = context.ResourceType); Pyright accepts
   the indirection and the runtime TypeError assertion is unchanged.

3. The previous attempt's diff_coverage gate failed because the step
   file installed a local fake registry on context instead of calling
   the real cleveragents.resources.{register,get,list}_resource_type
   functions, so lines 248-275 of extension.py were never executed by
   the test suite. Wire the steps to the real registry; suffix every
   registered type name with a per-scenario uuid so parallel behave
   processes do not collide.

Also adds the "## [Unreleased]" CHANGELOG entry the reviewer cited as
blocker 3.

Verified locally: local_ci_gate.sh --gate unit_tests against
features/architecture.feature and
features/resource_type_extension_interface.feature - 32 scenarios
pass (was 1 failing).

ISSUES CLOSED: #9998
2026-06-06 14:56:30 -04:00
HAL9000 de2cc75b27 feat(resources): design and implement resource type extension interface
Introduces a stable extension interface for third-party resource type
implementations in CleverAgents. Rebases cleanly onto current master HEAD.

Changes:
- New cleveragents.resources package with ResourceStatus (StrEnum),
  ResourceConfig (dataclass), ResourceType (ABC with 5 abstract methods)
- Registry functions: register_resource_type, get_resource_type,
  list_resource_types with proper type validation and duplicate protection
- 25 BDD scenarios covering all interface contracts with parallel-safe
  local registry isolation per scenario

ISSUES CLOSED: #9998
2026-06-06 14:56:30 -04:00