*** Settings ***
Documentation    Integration smoke tests for context strategy registry
Library          Process
Suite Setup      Log    Context Strategy Registry Robot Tests

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

*** Test Cases ***
Register All Built-in Strategies
    [Documentation]    Register 6 built-in strategies with default enabled list
    ${result}=    Run Process    python3    ${HELPER}    register-builtins
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    strategy-ok

Verify Protocol Conformance
    [Documentation]    All built-in strategies satisfy ContextStrategy protocol
    ${result}=    Run Process    python3    ${HELPER}    protocol-check
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    strategy-ok

Test Can Handle With Backends
    [Documentation]    Verify can_handle returns correct scores per backend availability
    ${result}=    Run Process    python3    ${HELPER}    can-handle
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0

Validate Registry
    [Documentation]    Validate registry with all built-in strategies passes
    ${result}=    Run Process    python3    ${HELPER}    validate
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    validation passed

ACMS Pipeline Produces Non-Empty Context Fragments
    [Documentation]    Integration test: ACMS pipeline with populated backends returns non-empty fragments
    ${result}=    Run Process    python3    ${HELPER}    pipeline-integration
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    strategy-ok

All Six Strategies Return Non-Empty Fragments With Populated Backends
    [Documentation]    Each of the 6 spec-required strategies returns at least 1 fragment when backends have data
    ${result}=    Run Process    python3    ${HELPER}    real-retrieval
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    strategy-ok
