*** Settings ***
Documentation     Integration smoke test for actor list on fresh project (bug #592).
...               Verifies that ``agents actor list`` on a fresh project exits
...               cleanly without validation errors.
Resource          ${CURDIR}/common.resource
Library           Process
Library           OperatingSystem
Library           String
Suite Setup       Setup Test Environment
Suite Teardown    Cleanup Test Environment

*** Test Cases ***
Actor List On Fresh Project Exits Without Error
    [Documentation]    On a fresh project with no actors, actor list should
    ...                exit cleanly (code 0) without a validation error.
    ...                Expected to FAIL while bug #592 is present.
    ${tmpdir}=    Evaluate    __import__('tempfile').mkdtemp(prefix='actor_592_')
    ${init}=    Run Process    ${PYTHON}    -m    cleveragents    init    actor-test
    ...    timeout=120s    on_timeout=kill    cwd=${tmpdir}
    Should Be Equal As Integers    ${init.rc}    0
    ...    msg=agents init failed: ${init.stderr}
    ${result}=    Run Process    ${PYTHON}    -m    cleveragents    actor    list
    ...    timeout=120s    on_timeout=kill    cwd=${tmpdir}
    Should Be Equal As Integers    ${result.rc}    0
    ...    msg=actor list should exit 0 but got ${result.rc}. stderr: ${result.stderr}
    Should Not Contain    ${result.stdout}    VALIDATION_FAILED
    ...    msg=actor list should not contain VALIDATION_FAILED: ${result.stdout}
    Should Not Contain    ${result.stderr}    VALIDATION_FAILED
    ...    msg=actor list stderr should not contain VALIDATION_FAILED: ${result.stderr}
    [Teardown]    Remove Directory    ${tmpdir}    recursive=True

Actor List On Fresh Project Does Not Show Slash Validation Message
    [Documentation]    On a fresh project, actor list should never mention the
    ...                slash-separator validation error in stdout or stderr.
    ...                Note: this test validates fresh-env behavior; it does NOT
    ...                configure a multi-slash provider (that code path is covered
    ...                by the Behave and benchmark tests).
    ${tmpdir}=    Evaluate    __import__('tempfile').mkdtemp(prefix='actor_592_slash_')
    ${init}=    Run Process    ${PYTHON}    -m    cleveragents    init    actor-slash-test
    ...    timeout=120s    on_timeout=kill    cwd=${tmpdir}
    Should Be Equal As Integers    ${init.rc}    0
    ...    msg=agents init failed: ${init.stderr}
    ${result}=    Run Process    ${PYTHON}    -m    cleveragents    actor    list
    ...    timeout=120s    on_timeout=kill    cwd=${tmpdir}
    Should Be Equal As Integers    ${result.rc}    0
    ...    msg=actor list should exit 0 but got ${result.rc}. stderr: ${result.stderr}
    Should Not Contain    ${result.stdout}    must include exactly one
    ...    msg=actor list should not show slash error: ${result.stdout}
    Should Not Contain    ${result.stderr}    must include exactly one
    ...    msg=actor list stderr should not show slash error: ${result.stderr}
    [Teardown]    Remove Directory    ${tmpdir}    recursive=True
