mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
Board as immutable versioned blobs (coordinator sole writer); budget reserve/settle before model calls; per-task and run caps; coordinator loop over an injected executor; batch.py accepts a fixed allow-list of search variables; XSS browser oracle; ousast-search-task image (Python, Node/TypeScript, PHP, Java 17, sqlite, bwrap, chromium) built by CI. 103 tests on the host. Co-Authored-By: Claude Opus 5.5 <[email protected]>
40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
import json
|
|
|
|
import pytest
|
|
|
|
from openultrasast.plane.memory import FileStore
|
|
from openultrasast.search.board import Board
|
|
|
|
|
|
def test_versions_provenance_claims_and_resume(tmp_path):
|
|
store = FileStore(tmp_path)
|
|
board = Board(store, "search-1", coordinator="host")
|
|
first = board.commit(
|
|
writer="host", facts=[dict(id="f1", text="sink", evidence_refs=["engine:1"], from_intents=[], step="triage", task_id="seed")]
|
|
)
|
|
second = board.commit(
|
|
writer="host",
|
|
intents=[dict(id="i1", description="trace input", from_facts=["f1"], status="open", claimant=None, step="reason", task_id="r1")],
|
|
)
|
|
assert first != second
|
|
assert json.loads(store.get_blob(board.prefix, first))["intents"] == []
|
|
assert Board.resume(store, "search-1", second, coordinator="host").state == board.state
|
|
with pytest.raises(PermissionError):
|
|
board.commit(writer="worker", hints=[])
|
|
state = board.state
|
|
state["facts"].clear()
|
|
assert board.state["facts"]
|
|
assert len(board.snapshot(max_bytes=256).encode()) <= 256
|
|
with pytest.raises(ValueError):
|
|
board.commit(writer="host", end_reason="clean")
|
|
|
|
|
|
def test_bad_references_and_oversize_are_atomic(tmp_path):
|
|
board = Board(FileStore(tmp_path), "one", coordinator="host", max_bytes=1024)
|
|
before = board.head
|
|
with pytest.raises(ValueError):
|
|
board.commit(writer="host", facts=[dict(id="f", text="x", evidence_refs=[], from_intents=["missing"], step="explore", task_id="t")])
|
|
with pytest.raises(ValueError):
|
|
board.commit(writer="host", hints=[dict(id="h", text="x" * 2048, step="human", task_id="operator")])
|
|
assert board.head == before
|