Files
cleveragents-core/robot/changeset_persistence.robot
T
brent.edwards 3eecb79003
CI / lint (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 46s
CI / typecheck (pull_request) Successful in 56s
CI / security (pull_request) Successful in 56s
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 29s
CI / e2e_tests (pull_request) Successful in 2m7s
CI / unit_tests (pull_request) Successful in 3m8s
CI / docker (pull_request) Successful in 9s
CI / integration_tests (pull_request) Successful in 3m57s
CI / coverage (pull_request) Successful in 7m48s
CI / benchmark-regression (pull_request) Successful in 40m48s
test(plan): TDD failing tests for checkpoint real rollback (bug #822)
TDD expected-fail tests proving bug #822 exists:
CheckpointService.rollback_to_checkpoint() returns a successful
RollbackResult but does not execute git reset --hard. Files modified
after the checkpoint remain unchanged after rollback.

Also fixes Robot Framework timeout robustness across the entire test
suite: all Run Process calls now use on_timeout=kill (prevents
SIGTERM-induced -15 exit codes under CI load) and timeouts increased
to 120s (prevents premature kills during heavy parallel execution).

ISSUES CLOSED: #839
2026-03-16 01:45:50 +00:00

89 lines
3.9 KiB
Plaintext

*** Settings ***
Documentation Integration tests for ChangeSet persistence via CLI plan artifacts output.
Library OperatingSystem
Library Process
Library Collections
Suite Setup Set Suite Variables
Force Tags changeset persistence
*** Variables ***
${PYTHON} python
# Normal duration: ~5-10s per test. Timeout raised from 30s to 120s for
# pabot cold-start (16 parallel processes) + Alembic migration overhead.
${TIMEOUT} 120s
*** Keywords ***
Set Suite Variables
Set Suite Variable ${AGENTS} ${PYTHON} -m cleveragents.cli.main
Run Agents Command
[Arguments] @{args}
${result}= Run Process ${PYTHON} -m cleveragents.cli.main @{args}
... timeout=${TIMEOUT} on_timeout=kill
... env:CLEVERAGENTS_TESTING_USE_MOCK_AI=true
... env:CLEVERAGENTS_AUTO_APPLY_MIGRATIONS=true
... env:NO_COLOR=1
RETURN ${result}
*** Test Cases ***
Plan Artifacts Shows Changeset ID Field
[Documentation] Verify plan artifacts output contains changeset_id field.
${result}= Run Agents Command plan artifacts --help
Should Contain ${result.stdout} plan_id
... msg=Plan artifacts help should mention plan_id
Plan Diff Help Shows Format Options
[Documentation] Verify plan diff command exposes format options.
${result}= Run Agents Command plan diff --help
Should Contain ${result.stdout} format
... msg=Plan diff help should mention format option
Plan Artifacts Help Contains Expected Text
[Documentation] Verify plan artifacts help text is present.
${result}= Run Agents Command plan artifacts --help
Should Contain ${result.stdout} artifacts
... msg=Help text should mention artifacts
Changeset Persistence Module Is Importable
[Documentation] Verify the changeset_repository module can be imported.
${result}= Run Process ${PYTHON} -c
... from cleveragents.infrastructure.database.changeset_repository import SqliteChangeSetStore; print("OK")
... timeout=${TIMEOUT} on_timeout=kill
... env:PYTHONPATH=src
Should Be Equal As Strings ${result.stdout.strip()} OK
SqliteChangeSetStore Round Trip Via CLI Script
[Documentation] Run a Python script that exercises SqliteChangeSetStore round-trip.
${script}= Catenate SEPARATOR=\n
... import sys
... from sqlalchemy import create_engine
... from sqlalchemy.orm import sessionmaker
... from cleveragents.infrastructure.database.models import Base
... from cleveragents.infrastructure.database.changeset_repository import SqliteChangeSetStore
... from cleveragents.domain.models.core.change import ChangeEntry, ChangeOperation
... engine = create_engine("sqlite:///:memory:", connect_args={"check_same_thread": False})
... Base.metadata.create_all(engine)
... factory = sessionmaker(bind=engine)
... store = SqliteChangeSetStore(factory)
... cs_id = store.start("plan-robot-1")
... entry = ChangeEntry(plan_id="plan-robot-1", resource_id="res-1", tool_name="file-write", operation=ChangeOperation.CREATE, path="src/test.py", after_hash="abc123")
... store.record(cs_id, entry)
... factory().commit()
... cs = store.get(cs_id)
... assert cs is not None
... assert len(cs.entries) == 1
... summary = store.summarize(cs_id)
... assert summary["total"] == 1
... assert summary["creates"] == 1
... store.delete_for_plan("plan-robot-1")
... factory().commit()
... cs2 = store.get(cs_id)
... assert cs2 is None or len(cs2.entries) == 0
... print("PASS")
${result}= Run Process ${PYTHON} -c ${script}
... timeout=${TIMEOUT} on_timeout=kill
... env:PYTHONPATH=src
Should Contain ${result.stdout} PASS
... msg=SqliteChangeSetStore round-trip failed: ${result.stderr}