Add a bring-up script and a transcript dump; let nisse-dev install on its own VM (M0.2)
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m16s
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m16s
Development Plan M0.2. - scripts/bringup.sh: start [REF] sets the previous run aside under /root/nisse-e2e/runs/, exports the ref under test and starts the agent as the transient systemd unit nisse-bringup, so it outlives the shell that started it; stop (SIGTERM, clean shutdown), status, logs, and collect (the journal log and a readable transcript). - nisse_dev.dump (python -m nisse_dev.dump STATE_DB [--full]): a readable dump of a state store's state, pending intents and canonical log. Opens the store read-only, so it is safe against a live agent. - The agent runs as root on this development VM, as it will on its own VM. Architecture D3/D6/D7 corrected to match the operator's intent: installing packages and toolchains on its own VM is class 2, recorded so the environment can be rebuilt (it was class 3 with provisioning an open question); egress names OS package mirrors. The plan's M0.2, M4.1, M4.2 and bring-up guards follow. Acceptance: a smoke run started, answered status in the test room, stopped cleanly, and collect produced the log and transcript. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE
This commit is contained in:
1 parent
678466c176
commit
a18321b4b0
5 files changed
+288
-23
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import io
|
||||
from pathlib import Path
|
||||
|
||||
from nisse_dev.canonical import PlanSubmitted, ToolCall, ToolResult, UserMessage
|
||||
from nisse_dev.dump import main, render
|
||||
from nisse_dev.oplog import OpLog
|
||||
from nisse_dev.state import StateStore
|
||||
|
||||
|
||||
def store_with_a_run(path: Path) -> None:
|
||||
store = StateStore(path, oplog=OpLog("nisse-dev", io.StringIO()))
|
||||
store.transition(
|
||||
"AWAIT_ARCH_SIGNOFF",
|
||||
cause="test",
|
||||
project="demo",
|
||||
data={"task_id": "demo-1", "gate": {"name": "arch", "rev": 1}},
|
||||
)
|
||||
store.append_event(UserMessage(text="Add a truncate helper", source="matrix"))
|
||||
store.append_event(PlanSubmitted(plan="x" * 500, model="opus"))
|
||||
store.append_event(
|
||||
ToolCall(call_id="c1", tool="run_command", arguments={"command": "ls"})
|
||||
)
|
||||
store.append_event(ToolResult(call_id="c1", result="README.md", success=False))
|
||||
store.begin_intent("open_pr", {"branch": "b"}, cause="test")
|
||||
store.close()
|
||||
|
||||
|
||||
def test_the_dump_shows_state_intents_and_each_event(tmp_path: Path) -> None:
|
||||
db = tmp_path / "state.db"
|
||||
store_with_a_run(db)
|
||||
text = render(db)
|
||||
assert (
|
||||
"state: AWAIT_ARCH_SIGNOFF project: demo task: demo-1 gate: arch rev-1"
|
||||
in text
|
||||
)
|
||||
assert "pending intent #1 open_pr" in text
|
||||
assert "USER [matrix]: Add a truncate helper" in text
|
||||
assert "PLAN (opus, 500 chars): " in text and "[340 more]" in text
|
||||
assert 'CALL run_command {"command": "ls"}' in text
|
||||
assert "result (FAILED): README.md" in text
|
||||
|
||||
|
||||
def test_full_shows_long_texts_whole(tmp_path: Path) -> None:
|
||||
db = tmp_path / "state.db"
|
||||
store_with_a_run(db)
|
||||
assert "x" * 500 in render(db, full=True)
|
||||
|
||||
|
||||
def test_the_dump_never_writes_to_the_store(tmp_path: Path) -> None:
|
||||
db = tmp_path / "state.db"
|
||||
store_with_a_run(db)
|
||||
before = db.read_bytes()
|
||||
render(db)
|
||||
assert db.read_bytes() == before
|
||||
|
||||
|
||||
def test_a_missing_store_is_reported(tmp_path: Path, capsys) -> None:
|
||||
assert main([str(tmp_path / "nope.db")]) == 1
|
||||
assert "no state store" in capsys.readouterr().err
|
||||
Reference in new issue
Block a user