feat(resource): wire inheritance polymorphism into tool binding and auto-discovery #1197

Closed
freemo wants to merge 1 commits from feature/resource-inheritance-wiring into master

1 Commits

Author SHA1 Message Date
freemo 2235fece22 feat(resource): wire inheritance polymorphism into tool binding and auto-discovery
CI / build (pull_request) Successful in 22s
CI / helm (pull_request) Successful in 22s
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m53s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m8s
CI / integration_tests (pull_request) Successful in 9m14s
CI / unit_tests (pull_request) Successful in 9m21s
CI / docker (pull_request) Successful in 1m18s
CI / coverage (pull_request) Failing after 8m52s
CI / e2e_tests (pull_request) Successful in 22m12s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-regression (pull_request) Successful in 55m0s
Refactor tool binding to use polymorphic resource type matching via
is_subtype_of() instead of exact string comparison or static parent_types
lists.  A tool declared for resource type 'code' now automatically binds
to 'code/python', 'code/rust', etc.

Resource auto-discovery gains discover_most_specific_type() to resolve
the deepest subtype in the hierarchy, and get_type_tree() enables the
new 'resource type tree' CLI command to visualise the full inheritance
hierarchy.

Plugins can now register custom resource types at runtime via
register_plugin_resource_type() on the registry service and
register_resource_types() on the plugin manager, extending the hierarchy
without code changes.

Resource metadata output includes the full inheritance chain for
debugging (inheritance_chain field in JSON/YAML output).

Key changes:
- BindingResolutionService._is_type_compatible(): delegates to
  is_subtype_of() for polymorphic matching (ADR-042)
- ResourceRegistryService: add discover_most_specific_type(),
  get_type_tree(), register_plugin_resource_type(), and
  get_resource_inheritance_metadata()
- PluginManager: add register_resource_types() extension point
- CLI: add 'resource type tree' command and inheritance_chain in
  resource metadata output
- 14 BDD scenarios covering polymorphic binding, auto-discovery,
  tree hierarchy, plugin registration, and metadata chain

ISSUES CLOSED: #942
2026-03-30 22:17:00 +00:00