*** Settings ***
Documentation    TDD Issue #822 — checkpoint rollback is simulated, not real
...              Integration tests verifying that
...              CheckpointService.rollback_to_checkpoint() actually restores
...              file system state via git reset --hard.  Currently the method
...              only constructs a RollbackResult without executing the git
...              operation, so files modified after the checkpoint remain
...              unchanged.  Tests are tagged tdd_expected_fail so CI passes
...              via result inversion.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
TDD Checkpoint Rollback Restores File Content
    [Documentation]    Verify that rollback reverts a modified file to its checkpoint state
    [Tags]    tdd_issue    tdd_issue_822
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    rollback-restores-content    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-checkpoint-rollback-restores-content-ok

TDD Checkpoint Rollback Removes Added Files
    [Documentation]    Verify that rollback removes files added after the checkpoint
    [Tags]    tdd_issue    tdd_issue_822
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    rollback-removes-added-files    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-checkpoint-rollback-removes-added-files-ok
