*** Settings ***
Documentation    Smoke tests for hierarchical actor YAML extensions
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_actor_hierarchy.py

*** Test Cases ***
Discover Hierarchical Actor Example
    [Documentation]    Load hierarchical workflow example and verify extensions
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    discover-hierarchical    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    actor-loaded: workflows/dev-workflow
    Should Contain    ${result.stdout}    skills-count: 2
    Should Contain    ${result.stdout}    lsp-configured: True

Parse Actor With LSP Binding
    [Documentation]    Validate that per-node LSP bindings parse correctly
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    parse-lsp-binding    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    lsp-binding-server: local/pyright
    Should Contain    ${result.stdout}    lsp-binding-langs: python

Parse Actor With Tool Sources
    [Documentation]    Validate that per-node tool-source references parse correctly
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    parse-tool-sources    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tool-sources-count: 2

Parse Actor With Subgraph Actor Ref
    [Documentation]    Validate subgraph node with actor_ref
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    parse-subgraph-ref    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    actor-ref: local/code-reviewer

Reject Invalid LSP Binding
    [Documentation]    Reject actor with non-namespaced LSP server
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    reject-bad-lsp    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    validation-error: lsp_binding
