@phase1 @domain @tool_binding @coverage Feature: Binding Resolution Service - Coverage Gaps As a developer ensuring binding resolution correctness I want to cover edge cases in static, parameter, contextual, disambiguation, and type-compatibility paths So that every code path is exercised Background: Given a mock resource registry And a binding resolution service using the registry # --------------------------------------------------------------------------- # Static binding -- unknown resource (lines 147-148) # --------------------------------------------------------------------------- @static @error_handling Scenario: Static binding raises ValidationError for unknown resource Given a tool "local/deployer" with a static slot "cfg" bound to "local/nonexistent" of type "fs-directory" And a project "local/proj" with no linked resources When the binding resolution is attempted Then a binding ValidationError should be raised mentioning "Static binding for slot" # --------------------------------------------------------------------------- # Parameter binding -- provided ref not found (lines 198-201) # --------------------------------------------------------------------------- @parameter @error_handling Scenario: Parameter binding raises ValidationError for unknown ref Given a tool "local/builder" with a parameter slot "target" of type "fs-directory" And a project "local/proj" with no linked resources When the bindings are resolved with invocation params: | slot | ref | | target | local/does-not-exist | Then a binding ValidationError should be raised mentioning "Parameter binding for slot" # --------------------------------------------------------------------------- # Parameter binding -- valid ref resolves (lines 209, 214) # --------------------------------------------------------------------------- @parameter @resolve Scenario: Parameter binding resolves successfully with valid ref Given a named resource "01HGZ6FE0AQDYTR4BX00000060" called "local/my-dir" of type "fs-directory" in the registry And a tool "local/builder" with a parameter slot "target" of type "fs-directory" And a project "local/proj" with no linked resources When the bindings are resolved with invocation params: | slot | ref | | target | local/my-dir | Then the binding for slot "target" should have mode "parameter" And the binding for slot "target" should have resource_id "01HGZ6FE0AQDYTR4BX00000060" And the binding for slot "target" should not be deferred # --------------------------------------------------------------------------- # Contextual binding -- no match, slot NOT required (line 274) # --------------------------------------------------------------------------- @contextual @optional Scenario: Contextual binding returns None resource when slot is not required Given a project "local/empty" with no linked resources And a tool "local/reader" with an optional contextual slot "extras" of type "git-checkout" When the bindings are resolved Then the binding for slot "extras" should have mode "contextual" And the binding for slot "extras" should have no resource_id And the binding for slot "extras" should not be deferred # --------------------------------------------------------------------------- # _find_matching_resources -- NotFoundError skipped (lines 298-299) # --------------------------------------------------------------------------- @contextual @not_found_skip Scenario: Contextual binding skips linked resources that raise NotFoundError Given a project "local/mixed" with linked resources including a missing one: | resource_id | type_name | alias | exists | | 01HGZ6FE0AQDYTR4BX00000070 | git-checkout | gone | false | | 01HGZ6FE0AQDYTR4BX00000071 | git-checkout | repo | true | And a tool "local/reader" with a contextual slot "repo" of type "git-checkout" When the bindings are resolved Then the binding for slot "repo" should have resource_id "01HGZ6FE0AQDYTR4BX00000071" And the binding for slot "repo" should not be deferred # --------------------------------------------------------------------------- # _disambiguate -- name suffix matching (lines 325-329) # --------------------------------------------------------------------------- @contextual @disambiguate @name_suffix Scenario: Disambiguation matches slot name against resource name suffix Given a project "local/multi" with named linked resources: | resource_id | type_name | alias | resource_name | | 01HGZ6FE0AQDYTR4BX00000080 | git-checkout | alpha | local/frontend/repo | | 01HGZ6FE0AQDYTR4BX00000081 | git-checkout | beta | local/backend/other | And a tool "local/reader" with a contextual slot "repo" of type "git-checkout" When the bindings are resolved Then the binding for slot "repo" should have resource_id "01HGZ6FE0AQDYTR4BX00000080" And the binding for slot "repo" should have resource_name "local/frontend/repo" # --------------------------------------------------------------------------- # _disambiguate -- ambiguous (lines 337-338) # --------------------------------------------------------------------------- @contextual @disambiguate @ambiguous @error_handling Scenario: Disambiguation raises ValidationError for ambiguous candidates Given a project "local/multi" with named linked resources: | resource_id | type_name | alias | resource_name | | 01HGZ6FE0AQDYTR4BX00000090 | git-checkout | alpha | local/first | | 01HGZ6FE0AQDYTR4BX00000091 | git-checkout | beta | local/second | And a tool "local/reader" with a contextual slot "repo" of type "git-checkout" When the binding resolution is attempted Then a binding ValidationError should be raised mentioning "Ambiguous contextual binding" # --------------------------------------------------------------------------- # _is_type_compatible -- show_type raises NotFoundError (lines 369-370) # --------------------------------------------------------------------------- @type_compat @not_found Scenario: Type compatibility returns False when show_type raises NotFoundError Given a project "local/typed" with a linked resource: | resource_id | type_name | alias | | 01HGZ6FE0AQDYTR4BX00000095 | unknown-type | repo | And the resource type "unknown-type" is removed from the registry And a tool "local/reader" with a contextual slot "repo" of type "git-checkout" And the slot "repo" is required When the binding resolution is attempted Then a binding ValidationError should be raised mentioning "No resource of type"