Feature: Scope chain resolver extension registration and invocation
  As a plugin developer
  I want to register custom scope chain resolvers
  So that I can extend entity name resolution with custom logic

  Background:
    Given the plugin manager is initialized
    And the extension catalog is loaded

  Scenario: ScopeChainResolverExtension protocol is defined
    When I check the extension protocols
    Then ScopeChainResolverExtension protocol should exist
    And it should have a resolver_name property
    And it should have a can_resolve method
    And it should have a resolve method

  Scenario: Scope chain resolver extension point is registered
    When I get all extension point definitions
    Then the extension point "scope.chain_resolver" should be registered
    And its protocol type should be ScopeChainResolverExtension
    And its description should mention custom scope chain resolution
    And its registry key should be "scope"

  Scenario: Custom scope resolver can be registered
    Given a custom scope resolver implementation
    When I register it with the plugin manager
    Then the resolver should be available in the registry
    And it should be retrievable by name

  Scenario: Custom scope resolver can resolve names
    Given a custom scope resolver that handles "custom:" prefix
    And the resolver is registered
    When I invoke the resolver with name "custom:entity"
    And context data is provided
    Then the resolver should return the resolved name
    And the resolution should be correct

  Scenario: Multiple scope resolvers can coexist
    Given a resolver for "custom:" prefix
    And a resolver for "remote:" prefix
    When both are registered
    Then both should be available
    And each should handle its own prefix

  Scenario: Scope resolver can decline to resolve
    Given a scope resolver
    When I ask it to resolve a name it doesn't handle
    Then can_resolve should return False
    And resolve should return None

  Scenario: Scope resolver receives context
    Given a scope resolver that uses context data
    When I invoke it with context containing "namespace" key
    Then the resolver should receive the context
    And it should be able to use context values

  Scenario: Extension point count is updated
    When I count all extension points
    Then the total should be 31
    And scope.chain_resolver should be included
