Feature: ToolLifecycle domain model execute hook Verify that ToolLifecycle exposes the execute hook required by the spec four-stage lifecycle (discover / activate / execute / deactivate). # --------------------------------------------------------------- # TDD issue-capture test for #2820 # The @tdd_expected_fail tag is removed once the fix is in place. # --------------------------------------------------------------- @tdd_issue @tdd_issue_2820 Scenario: ToolLifecycle has an execute field (issue capture) When I create a tool lifecycle with execute hook "my.module.execute" Then the tool lifecycle execute should be "my.module.execute" # --------------------------------------------------------------- # Positive scenarios — all four lifecycle hooks present # --------------------------------------------------------------- Scenario: ToolLifecycle with all four hooks set When I create a tool lifecycle with all four hooks set Then the tool lifecycle discover should be "hooks.discover" And the tool lifecycle activate should be "hooks.activate" And the tool lifecycle execute should be "hooks.execute" And the tool lifecycle deactivate should be "hooks.deactivate" Scenario: ToolLifecycle execute defaults to None When I create a tool lifecycle with no hooks Then the tool lifecycle execute should be None Scenario: ToolLifecycle execute can be set independently When I create a tool lifecycle with only execute hook "run.tool" Then the tool lifecycle execute should be "run.tool" And the tool lifecycle discover should be None And the tool lifecycle activate should be None And the tool lifecycle deactivate should be None # --------------------------------------------------------------- # Round-trip YAML serialisation/deserialisation # --------------------------------------------------------------- Scenario: Tool from_config parses execute hook from YAML lifecycle block When I load a tool from config with lifecycle execute "my.execute.hook" Then the tool model should be created And the tool lifecycle execute should be "my.execute.hook" Scenario: Tool from_config with execute=None preserves None When I load a tool from config with lifecycle execute None Then the tool model should be created And the tool lifecycle execute should be None Scenario: Tool as_cli_dict renders execute hook when set When I create a tool with lifecycle execute "cli.execute.hook" and call as_cli_dict Then the tool cli dict lifecycle should have key "execute" And the tool cli dict lifecycle execute should be "cli.execute.hook" Scenario: Tool as_cli_dict omits execute when None When I create a tool with no lifecycle and call as_cli_dict Then the tool cli dict should not have key "lifecycle"