b122ec7ed5
CI / lint (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m0s
CI / security (pull_request) Successful in 55s
CI / build (pull_request) Successful in 25s
CI / helm (pull_request) Successful in 32s
CI / push-validation (pull_request) Successful in 26s
CI / e2e_tests (pull_request) Successful in 3m38s
CI / integration_tests (pull_request) Successful in 6m42s
CI / unit_tests (pull_request) Successful in 8m19s
CI / docker (pull_request) Successful in 13s
CI / coverage (pull_request) Successful in 15m23s
CI / status-check (pull_request) Successful in 2s
Remove the local ${PYTHON} python (and python3) variable definitions from
the *** Variables *** sections of all affected robot files. These local
definitions were overriding the pabot-injected venv Python path passed via
--variable PYTHON:/path/to/venv/python, causing tests to use the system
Python (which lacks required packages like structlog, sqlalchemy, etc.)
instead of the nox venv Python.
The correct ${PYTHON} value is already set by Setup Test Environment in
common.resource via sys.executable, and pabot passes it via --variable.
The local fallback definitions are redundant and harmful in parallel runs.
Audit found 56 robot files with the pattern (more than the 9 originally
identified in the issue). All occurrences have been removed.
ISSUES CLOSED: #1309
95 lines
4.0 KiB
Plaintext
95 lines
4.0 KiB
Plaintext
*** Settings ***
|
|
Documentation Integration test: file tool writes produce ChangeSet output
|
|
Library OperatingSystem
|
|
Library Process
|
|
Library Collections
|
|
|
|
*** Test Cases ***
|
|
File Write Produces ChangeSet Entry
|
|
[Documentation] Run a file-write tool via ChangeSetCapture and
|
|
... verify the resulting ChangeSet contains the entry.
|
|
${result}= Run Process ${PYTHON} -c
|
|
... ${CHANGESET_SCRIPT}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} PASS:entries=1
|
|
Should Contain ${result.stdout} PASS:operation=create
|
|
|
|
ChangeSet Summary Counts Match
|
|
[Documentation] Verify summary counts after multiple operations.
|
|
${result}= Run Process ${PYTHON} -c
|
|
... ${SUMMARY_SCRIPT}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} PASS:total=2
|
|
Should Contain ${result.stdout} PASS:creates=1
|
|
Should Contain ${result.stdout} PASS:modifies=1
|
|
|
|
InMemoryChangeSetStore Round Trip
|
|
[Documentation] Verify start/record/get via InMemoryChangeSetStore.
|
|
${result}= Run Process ${PYTHON} -c
|
|
... ${STORE_SCRIPT}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} PASS:store_get_ok
|
|
Should Contain ${result.stdout} PASS:entry_count=1
|
|
|
|
*** Keywords ***
|
|
|
|
*** Variables ***
|
|
${CHANGESET_SCRIPT} SEPARATOR=\n
|
|
... import tempfile, os, sys
|
|
... sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
|
... from pathlib import Path
|
|
... from cleveragents.tool.builtins.changeset import ChangeSetCapture
|
|
... from cleveragents.tool.builtins.file_tools import FILE_WRITE_SPEC
|
|
... tmpdir = tempfile.mkdtemp()
|
|
... capture = ChangeSetCapture(plan_id="plan-robot", resource_id="res-r", sandbox_root=tmpdir)
|
|
... wrapped = capture.wrap_tool(FILE_WRITE_SPEC)
|
|
... result = wrapped.handler({"path": "hello.txt", "content": "hello world", "sandbox_root": tmpdir})
|
|
... cs = capture.get_changeset()
|
|
... print(f"PASS:entries={len(cs.entries)}")
|
|
... print(f"PASS:operation={cs.entries[0].operation}")
|
|
|
|
${SUMMARY_SCRIPT} SEPARATOR=\n
|
|
... import tempfile, os, sys
|
|
... sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
|
... from pathlib import Path
|
|
... from cleveragents.tool.builtins.changeset import ChangeSetCapture
|
|
... from cleveragents.tool.builtins.file_tools import FILE_WRITE_SPEC, FILE_EDIT_SPEC
|
|
... tmpdir = tempfile.mkdtemp()
|
|
... capture = ChangeSetCapture(plan_id="plan-robot2", resource_id="res-r", sandbox_root=tmpdir)
|
|
... w = capture.wrap_tool(FILE_WRITE_SPEC)
|
|
... e = capture.wrap_tool(FILE_EDIT_SPEC)
|
|
... w.handler({"path": "f.txt", "content": "aaa", "sandbox_root": tmpdir})
|
|
... e.handler({"path": "f.txt", "old_text": "aaa", "new_text": "bbb", "sandbox_root": tmpdir})
|
|
... spec = capture.to_spec_changeset()
|
|
... s = spec.summary()
|
|
... print(f"PASS:total={s['total']}")
|
|
... print(f"PASS:creates={s['creates']}")
|
|
... print(f"PASS:modifies={s['modifies']}")
|
|
|
|
${STORE_SCRIPT} SEPARATOR=\n
|
|
... import os, sys
|
|
... sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
|
... from cleveragents.domain.models.core.change import (
|
|
... ChangeEntry, ChangeOperation, InMemoryChangeSetStore
|
|
... )
|
|
... store = InMemoryChangeSetStore()
|
|
... cid = store.start("plan-robot-store")
|
|
... entry = ChangeEntry(
|
|
... plan_id="plan-robot-store", resource_id="r1",
|
|
... tool_name="builtin/file-write",
|
|
... operation=ChangeOperation.CREATE, path="new.py",
|
|
... )
|
|
... store.record(cid, entry)
|
|
... cs = store.get(cid)
|
|
... if cs is not None:
|
|
... ${SPACE}${SPACE}${SPACE}${SPACE}print("PASS:store_get_ok")
|
|
... ${SPACE}${SPACE}${SPACE}${SPACE}print(f"PASS:entry_count={len(cs.entries)}")
|
|
... else:
|
|
... ${SPACE}${SPACE}${SPACE}${SPACE}print("FAIL:store_get_returned_none")
|