*** Settings ***
Documentation    Smoke tests for plan preflight guardrails (7 checks)
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_plan_preflight_guardrails.py

*** Test Cases ***
Preflight All Checks Pass With Populated Registries
    [Documentation]    All 7 pre-flight checks pass when registries are populated
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    all-pass    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    all-pass-ok

Preflight Rejects Missing Action
    [Documentation]    PreflightRejection raised when action is missing
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    action-missing    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    action-missing-ok

Preflight Rollback Feasibility Check
    [Documentation]    Rollback check detects non-checkpointable tools
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    rollback-check    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    rollback-check-ok

Preflight Estimation Actor Warning
    [Documentation]    Preflight emits warning when estimation actor lacks response_format
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    estimation-warning    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    estimation-warning-ok

Preflight Estimation Context View Warning
    [Documentation]    Preflight emits warning when estimation actor uses non-strategist context_view
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    estimation-context-view-warning    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    estimation-context-view-warning-ok
