mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 04:29:27 +00:00
search-with-proof: name the exhausted limit, keep partial evidence, tighter reservation
budget_spent carries end_detail (spend, task_spend, reason_rounds, ...); a task whose allowance cannot cover the next call finishes with its facts; per-task metrics in pilot records; input reservation bytes/2 + 1024 per message (measured 3-4x over-reservation before). Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
4be2063d40
commit
c33b053b15
@@ -2,7 +2,9 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
@@ -224,6 +226,63 @@ def test_scratch_failure_preserves_exit_and_stderr(workspace, monkeypatch):
|
||||
assert result["reason"].startswith("ScratchLimit:")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("project", [".", "subproject"])
|
||||
def test_preparation_uses_project_gradle_wrapper(workspace, monkeypatch, project):
|
||||
repo = workspace / "checkout"
|
||||
repo.mkdir()
|
||||
root = repo / project
|
||||
root.mkdir(exist_ok=True)
|
||||
# A real local child proves wrapper execution without system Gradle or network.
|
||||
wrapper = root / "gradlew"
|
||||
wrapper.write_text(
|
||||
'test "$1" = "--no-daemon" || exit 1\n'
|
||||
'test "$2" = "--project-dir" || exit 2\n'
|
||||
'test "$4" = "assemble" || exit 3\n'
|
||||
'mkdir -p "$3/build"\n'
|
||||
'printf compiled > "$3/build/product"\n'
|
||||
)
|
||||
wrapper.chmod(0o644)
|
||||
app = executor.InProcessExecutor(repo, task_boundary=True)
|
||||
app.prepared_put_url = "https://files.example/output"
|
||||
blobs = []
|
||||
monkeypatch.setattr(executor.URLTransport, "put", lambda self, url, data, timeout: blobs.append(data))
|
||||
request = spec()
|
||||
request["demo"]["build"] = {"recipe": "gradle", "arguments": [project]}
|
||||
result = app.submit("prepare_verification", request)
|
||||
assert result["status"] == "ok", result
|
||||
unpacked = workspace / "unpacked"
|
||||
verify_task.extract_checkout(blobs[0], unpacked)
|
||||
assert (unpacked / "checkout" / project / "build/product").read_text() == "compiled"
|
||||
assert json.loads((unpacked / "spec.json").read_text())["demo"]["build"]["recipe"] == "none"
|
||||
|
||||
|
||||
def test_preparation_with_many_host_processes(workspace, monkeypatch):
|
||||
repo = workspace / "checkout"
|
||||
repo.mkdir()
|
||||
(repo / "gradlew").write_text('mkdir -p "$3/build"\nprintf compiled > "$3/build/product"\n')
|
||||
app = executor.InProcessExecutor(repo, task_boundary=True)
|
||||
app.prepared_put_url = "https://files.example/output"
|
||||
monkeypatch.setattr(executor.URLTransport, "put", lambda self, url, data, timeout: None)
|
||||
request = spec()
|
||||
request["demo"]["build"] = {"recipe": "gradle", "arguments": ["."]}
|
||||
children = []
|
||||
try:
|
||||
for _ in range(300):
|
||||
pid = os.fork()
|
||||
if pid == 0:
|
||||
time.sleep(60)
|
||||
os._exit(0)
|
||||
children.append(pid)
|
||||
result = app.submit("prepare_verification", request)
|
||||
assert result["status"] == "ok", result
|
||||
assert (repo / "build/product").read_text() == "compiled"
|
||||
finally:
|
||||
for pid in children:
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
for pid in children:
|
||||
os.waitpid(pid, 0)
|
||||
|
||||
|
||||
def test_capacity_deadline_plain_diagnostic_survives():
|
||||
from benchmarks.ax.batch import CapacityDeadline
|
||||
|
||||
|
||||
Reference in New Issue
Block a user