*** Settings ***
Documentation    TDD Issue #980 — skill add cross-process persistence
...              Integration smoke tests verifying that skills registered via
...              ``agents skill add --config <file>`` in one CLI process are
...              visible when ``agents skill list`` is run in a separate CLI
...              process.  Bug #980 reports that the skill is lost across
...              process boundaries because the SkillService falls back to
...              in-memory storage when the database is not properly initialised.
...              Tests were originally tagged tdd_expected_fail; tag removed after bug fix.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
TDD Skill Add Cross Process Persistence
    [Documentation]    Verify that a skill added via CLI in one process is
    ...                visible via ``skill list`` in a separate process.
    [Tags]    tdd_issue    tdd_issue_980
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    cross-process-list    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-skill-add-cross-process-list-ok

TDD Skill Add Cross Process Show
    [Documentation]    Verify that a skill added via CLI in one process can be
    ...                shown via ``skill show`` in a separate process.
    [Tags]    tdd_issue    tdd_issue_980
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    cross-process-show    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-skill-add-cross-process-show-ok
