e476d2de0e
Extend actor YAML schema to support hierarchical graphs with explicit node types (agent, tool, conditional, subgraph), per-node LSP bindings (lsp_binding with server, languages, auto, capabilities), and tool-source references (skills, mcp_servers, agent_skills). Add schema validation for namespaced actor references, duplicate node IDs, edge target existence, and graph reachability — all nodes must be reachable from entry_node via explicit edges or conditional node routing targets. Update loader to report YAML parse errors with precise line/column positions and schema validation errors with dotted field paths and remediation hints pointing to docs/reference/actor_config.md. Add docs/reference/actor_config.md as the practical configuration reference covering hierarchical graph examples, node type table, topology rules, and common error cases with fix guidance. Refresh examples/actors/graph_workflow.yaml to replace deprecated actor_path with actor_ref. Add benchmarks/actor_yaml_bench.py for schema load overhead. Tests: 95 Behave scenarios, 10 Robot smoke tests (including hierarchical loader smoke test), security scan clean, coverage 99% (threshold 97%). ISSUES CLOSED: #157
179 lines
8.1 KiB
Gherkin
179 lines
8.1 KiB
Gherkin
Feature: Hierarchical Actor YAML Schema Extensions
|
|
As a developer configuring actors
|
|
I want to extend actor YAML with LSP bindings, tool-source references,
|
|
and improved subgraph support
|
|
So that graph nodes have fine-grained control over language servers and tools
|
|
|
|
# -------------------------------------------------------------------
|
|
# LSP Binding on NodeDefinition
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Node with explicit LSP binding
|
|
Given a hierarchy actor YAML with node lsp_binding
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy graph node "code_writer" should have lsp_binding
|
|
And the hierarchy node "code_writer" lsp_binding server should be "local/pyright"
|
|
And the hierarchy node "code_writer" lsp_binding languages should contain "python"
|
|
|
|
Scenario: Node with auto LSP binding
|
|
Given a hierarchy actor YAML with auto lsp_binding
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy graph node "implementer" should have lsp_binding
|
|
And the hierarchy node "implementer" lsp_binding auto should be true
|
|
|
|
Scenario: Node without LSP binding is valid
|
|
Given a hierarchy actor YAML with no lsp_binding
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy graph node "agent_node" should not have lsp_binding
|
|
|
|
Scenario: LSP binding with invalid server name
|
|
Given a hierarchy actor YAML with lsp_binding server "no-namespace"
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "lsp_binding"
|
|
|
|
# -------------------------------------------------------------------
|
|
# Tool-Source References on NodeDefinition
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Node with tool_sources referencing skills
|
|
Given a hierarchy actor YAML with node tool_sources skills
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy graph node "executor" should have tool_sources
|
|
And the hierarchy node "executor" tool_sources should have 1 items
|
|
|
|
Scenario: Node with tool_sources referencing MCP server
|
|
Given a hierarchy actor YAML with node tool_sources mcp
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy node "executor" tool_sources item 0 type should be "mcp"
|
|
And the hierarchy node "executor" tool_sources item 0 name should be "local/filesystem"
|
|
|
|
Scenario: Node with tool_sources referencing builtin group
|
|
Given a hierarchy actor YAML with node tool_sources builtin
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy node "executor" tool_sources item 0 type should be "builtin"
|
|
And the hierarchy node "executor" tool_sources item 0 group should be "file_operations"
|
|
|
|
Scenario: Node with mixed tool_sources
|
|
Given a hierarchy actor YAML with mixed node tool_sources
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy node "executor" tool_sources should have 3 items
|
|
|
|
Scenario: Node with invalid tool_sources type
|
|
Given a hierarchy actor YAML with invalid tool_sources type
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "tool_sources"
|
|
|
|
Scenario: Node without tool_sources is valid
|
|
Given a hierarchy actor YAML with no lsp_binding
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy graph node "agent_node" should not have tool_sources
|
|
|
|
# -------------------------------------------------------------------
|
|
# Subgraph Node Enhancements
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Subgraph node with actor_ref
|
|
Given a hierarchy actor YAML with subgraph actor_ref
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy graph node "review" should have type "subgraph"
|
|
And the hierarchy node "review" actor_ref should be "local/code-reviewer"
|
|
|
|
Scenario: Subgraph node with actor_ref non-namespaced fails
|
|
Given a hierarchy actor YAML with subgraph actor_ref "bad-ref"
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "actor_ref"
|
|
|
|
# -------------------------------------------------------------------
|
|
# Skills Field on ActorConfigSchema
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Actor with skills list
|
|
Given a hierarchy actor YAML with skills list
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy actor should have 2 skills
|
|
|
|
Scenario: Actor with empty skills is valid
|
|
Given a hierarchy actor YAML with empty skills
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy actor should have 0 skills
|
|
|
|
# -------------------------------------------------------------------
|
|
# LSP Fields on ActorConfigSchema (top-level)
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Actor with lsp list
|
|
Given a hierarchy actor YAML with lsp list
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy actor lsp should have 2 items
|
|
|
|
Scenario: Actor with lsp auto binding
|
|
Given a hierarchy actor YAML with lsp auto
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy actor lsp_auto should be true
|
|
|
|
Scenario: Actor with lsp_capabilities list
|
|
Given a hierarchy actor YAML with lsp_capabilities
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy actor lsp_capabilities should contain "diagnostics"
|
|
|
|
Scenario: Actor with lsp_capabilities all
|
|
Given a hierarchy actor YAML with lsp_capabilities all
|
|
When I parse the hierarchy actor YAML
|
|
Then the hierarchy actor should be valid
|
|
And the hierarchy actor lsp_capabilities should be "all"
|
|
|
|
# -------------------------------------------------------------------
|
|
# Precise Validation Error Messages
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Missing entry node gives precise field path
|
|
Given a hierarchy actor YAML with bad entry_node "nonexistent"
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "entry_node"
|
|
And the hierarchy parse error should mention "nonexistent"
|
|
|
|
Scenario: Duplicate node IDs gives precise error
|
|
Given a hierarchy actor YAML with duplicate node ids
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "Duplicate"
|
|
|
|
Scenario: Cycle detection gives node path
|
|
Given a hierarchy actor YAML with cycle
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "cycle"
|
|
|
|
Scenario: Edge referencing non-existent node gives precise error
|
|
Given a hierarchy actor YAML with bad edge from_node "ghost"
|
|
When I parse the hierarchy actor YAML expecting failure
|
|
Then the hierarchy parse error should mention "ghost"
|
|
|
|
# -------------------------------------------------------------------
|
|
# Loader Integration with Hierarchical Actors
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Loader discovers hierarchical actor YAML
|
|
Given a hierarchy temp dir with a hierarchical actor YAML file
|
|
When I create a hierarchy loader and run discovery
|
|
Then the hierarchy loader should find 1 actors
|
|
And the hierarchy loaded actor should have skills
|
|
And the hierarchy loaded actor should have lsp
|
|
|
|
Scenario: Loader rejects actor with invalid lsp_binding
|
|
Given a hierarchy temp dir with invalid lsp_binding actor YAML
|
|
When I create a hierarchy loader and run discovery expecting error
|
|
Then the hierarchy loader error should mention "lsp_binding"
|