feat(graph): ToolExecutor wrapper [W2.C.2]#57
Draft
TimothyVang wants to merge 2 commits into
Draft
Conversation
added 2 commits
May 2, 2026 08:37
…C.2] Failing test: tests/graph/wrappers/test_tool_executor.py — import fails because verdict/graph/wrappers/tool_executor.py does not exist yet. Assertions: - Dispatches tool_name to the correct registered ToolWrapper subclass. - UnknownToolError raised with informative message for unregistered tools. - Returns a correctly-formed ToolOutput with tool_name, tool_version, invocation_hash (64-char blake3 hex), parsed_artifacts, stdout_sha256. - NotImplementedError from _execute propagates (W2.B not landed yet). - Duplicate tool_name at construction raises ValueError. - registered_tool_names property lists all registered tools.
ToolExecutor is the second wrapper in the DenyRuleWrapper → ToolExecutor → LedgerEmitter composition (ARCHITECTURE.md §2). - Registry: dict[tool_name → ToolWrapper] built at construction; duplicate tool_name raises ValueError; UnknownToolError on unregistered dispatch. - registered_tool_names property returns frozenset for introspection. - run() resolves the wrapper and calls _execute(args, evidence_path, work_dir). NotImplementedError from _execute propagates (W2.B integration not landed). - __call__ makes the instance directly satisfy DenyRuleWrapper's Callable[[str, dict], Any] executor contract with no adapter shim. - 13 tests GREEN; ruff clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
verdict/graph/wrappers/tool_executor.py— second wrapper in the executor_work composition.(tool_name, args)to registeredToolWrappersubclasses.UnknownToolErrorwith informative message (lists registered tools) for unregistered tools.__call__satisfiesDenyRuleWrapper'sCallable[[str, dict], Any]executor contract.tool_nameat construction raisesValueError.NotImplementedErrorfrom_execute()propagates (W2.B integration not landed yet).TDD trace
f63be79— test imports fail2c41188— implementation, all 13 tests passTest plan
pytest tests/graph/wrappers/test_tool_executor.py -v→ 13 passedruff check verdict/graph/wrappers/tool_executor.py→ All checks passed