mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 02:08:18 +00:00
refactor(memory): the memory store and the spend meter leave the plane package (C1)
openultrasast.plane.memory and openultrasast.plane.budget are now
openultrasast.memory and openultrasast.budget; every importer follows. A pure move:
no behaviour changes. The two renames themselves were swept into 1aad435 by mistake
(they were staged when that spec commit was made), so the three commits between it
and this one do not import; this commit completes the move.
memory.py still reaches into the plane in two lazy imports (results_root in
open_store, the reconciler in seed); the cut of the plane has to settle both.
Checked: ruff, ruff format, mypy; 163 test files around memory, budget, plane, learn
and hunt passed across three runs by the implementing agent, and the six closest
files again before this commit. The whole suite was not run locally.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
e22bd420d9
commit
b975acb7e0
@@ -27,7 +27,7 @@ import yaml
|
||||
|
||||
from benchmarks.valid.artifact_contract import read_benchmark_artifact, write_benchmark_artifact
|
||||
from openultrasast.config import load_dotenv
|
||||
from openultrasast.plane.memory import PRESIGNED_ARCHIVE_SUFFIX, S3Store, open_store
|
||||
from openultrasast.memory import PRESIGNED_ARCHIVE_SUFFIX, S3Store, open_store
|
||||
from openultrasast.search.task_storage import diagnostic, exception_reason
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from pathlib import Path
|
||||
|
||||
from openultrasast.config import load_dotenv
|
||||
from openultrasast.learn import experiments as ex
|
||||
from openultrasast.plane.memory import open_store
|
||||
from openultrasast.memory import open_store
|
||||
|
||||
EXPERIMENT = "exp-004-pooled-block-gate"
|
||||
UNITS = Path(f"plane/experiments/{EXPERIMENT}.units.jsonl")
|
||||
|
||||
@@ -45,6 +45,7 @@ from collections.abc import Mapping
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from openultrasast import memory
|
||||
from openultrasast.findings import quick_scan_findings
|
||||
from openultrasast.learn.features import (
|
||||
NONE,
|
||||
@@ -71,7 +72,6 @@ from openultrasast.learn.features import (
|
||||
from openultrasast.learn.labels import Clone
|
||||
from openultrasast.learn.roles import RoleSet, from_model_roles, infer_for_checkout
|
||||
from openultrasast.pairs import DEFAULT_CATALOG, _materialize_side, _targets, load_pair_catalog
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast.plane.harvest import declares
|
||||
from openultrasast.plane.tasks.alerts import covers
|
||||
from openultrasast.plane.tasks.alerts import engine_languages as _engine_languages
|
||||
|
||||
@@ -31,11 +31,11 @@ from engine_trace_worker import EXCLUDED_DIRS, safe_path, unit_record, write_jso
|
||||
|
||||
from openultrasast.learn.examples import read_jsonl
|
||||
from openultrasast.learn.labels import load_sources, repo_name
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.model.specs import taint_specs
|
||||
from openultrasast.model.taint import request_params
|
||||
from openultrasast.pairs import _materialize_side, load_pair_catalog
|
||||
from openultrasast.plane.engine_alerts import export_pin
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.plane.tasks.alerts import engine_languages
|
||||
from openultrasast.preprocess import detect_language
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from engine_trace_k8s import pack
|
||||
|
||||
from benchmarks.ax.batch import AXLane, Item, SandboxFailure, Workload, manifest
|
||||
from benchmarks.ax.batch import task_state as task_state
|
||||
from openultrasast.plane.memory import open_store as open_store
|
||||
from openultrasast.memory import open_store as open_store
|
||||
|
||||
|
||||
def task_manifest(name, args, urls):
|
||||
|
||||
@@ -12,7 +12,7 @@ import time
|
||||
import uuid
|
||||
from datetime import timedelta
|
||||
|
||||
from openultrasast.plane.memory import PRESIGNED_ARCHIVE_SUFFIX, S3Store, open_store
|
||||
from openultrasast.memory import PRESIGNED_ARCHIVE_SUFFIX, S3Store, open_store
|
||||
|
||||
IMAGE = "ghcr.io/norandom/openultrasast:2.0.1"
|
||||
BOOTSTRAP = r"""
|
||||
|
||||
@@ -9,7 +9,7 @@ import uuid
|
||||
|
||||
from engine_worker_service import PENDING, client_from_env, pack, put, read, result_key, status
|
||||
|
||||
from openultrasast.plane.memory import PRESIGNED_ARCHIVE_SUFFIX
|
||||
from openultrasast.memory import PRESIGNED_ARCHIVE_SUFFIX
|
||||
|
||||
|
||||
class Dispatcher:
|
||||
|
||||
@@ -28,7 +28,7 @@ from pathlib import Path
|
||||
|
||||
from engine_trace_worker import unit_record, worker
|
||||
|
||||
from openultrasast.plane.memory import S3Client, s3_settings
|
||||
from openultrasast.memory import S3Client, s3_settings
|
||||
|
||||
PENDING = "engine-queue/pending/"
|
||||
CLAIMED = "engine-queue/claimed/"
|
||||
|
||||
@@ -22,7 +22,7 @@ from openultrasast.config import load_dotenv
|
||||
from openultrasast.learn.examples import load_examples
|
||||
from openultrasast.learn.labels import load_sources
|
||||
from openultrasast.learn.slice import function_slice
|
||||
from openultrasast.plane.memory import MemoryStore, open_store
|
||||
from openultrasast.memory import MemoryStore, open_store
|
||||
|
||||
UNITS = Path("plane/experiments/exp-004-pooled-block-gate.units.jsonl")
|
||||
OUTPUT = Path("benchmarks/measurements/2026-10-03-graph-slice-leak-audit/record.json")
|
||||
|
||||
@@ -21,7 +21,9 @@ from pathlib import Path
|
||||
from benchmarks.ax.batch import AXLane, ClusterUnavailable, SearchExecutorTask, Workload, validate_image
|
||||
from benchmarks.ax.search_verify import AXSideDispatcher, validate_result
|
||||
from benchmarks.search.executor_smoke import CLONE
|
||||
from openultrasast.budget import BudgetExhausted, SpendBudget
|
||||
from openultrasast.config import load_dotenv
|
||||
from openultrasast.memory import FileStore, open_store
|
||||
from openultrasast.model.endpoint import (
|
||||
DEEPSEEK_BASE_ENV,
|
||||
DEEPSEEK_BASE_URL,
|
||||
@@ -30,8 +32,6 @@ from openultrasast.model.endpoint import (
|
||||
Prices,
|
||||
price_of,
|
||||
)
|
||||
from openultrasast.plane.budget import BudgetExhausted, SpendBudget
|
||||
from openultrasast.plane.memory import FileStore, open_store
|
||||
from openultrasast.provider.openrouter import OpenRouterChatClient
|
||||
from openultrasast.search import _sandbox
|
||||
from openultrasast.search.board import Board
|
||||
|
||||
@@ -837,8 +837,7 @@ def run(
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
from openultrasast import config
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import config, memory
|
||||
from openultrasast.plane.reconciler import results_root
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
@@ -18,7 +18,7 @@ from urllib.parse import urlsplit
|
||||
|
||||
import yaml
|
||||
|
||||
from openultrasast.plane.memory import MemoryStore
|
||||
from openultrasast.memory import MemoryStore
|
||||
|
||||
URL = re.compile(r"github\.com/([\w.-]+/[\w.-]+)", re.I)
|
||||
NAME = re.compile(r"[\w.-]+/[\w.-]+")
|
||||
@@ -327,8 +327,7 @@ def verify_tests(root: Path) -> dict:
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
import os
|
||||
|
||||
from openultrasast import config
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import config, memory
|
||||
from openultrasast.plane.reconciler import results_root
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
@@ -12,6 +12,7 @@ from copy import deepcopy
|
||||
from pathlib import Path
|
||||
|
||||
from openultrasast import tool_hunter
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.complexity.map import Hotspot
|
||||
from openultrasast.config import load_config
|
||||
from openultrasast.hunt.runner import _full_checkout as full_checkout
|
||||
@@ -19,7 +20,6 @@ from openultrasast.hunter_tools import clamp_repo_path
|
||||
from openultrasast.learn.program import ANSWER_FORMAT, Caller, Prompt, classify
|
||||
from openultrasast.model.endpoint import resolve_models
|
||||
from openultrasast.model.taxonomy import FAMILY_IDS, load_families
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
|
||||
if __package__ in {None, ""}:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# OpenRouter serves embeddings only; the chat model stays DeepSeek. `openrouter` is not an ax provider, so the
|
||||
# annotation declares the extension. `secretKey` names the Kubernetes Secret and key that hold OPENROUTER_API_KEY;
|
||||
# the key itself is never in a manifest. Prices in USD per million tokens: embeddings bill input only, so the cache
|
||||
# and output rates are 0 and `plane.budget.MeteredEmbeddingClient` prices the provider's `usage.prompt_tokens`.
|
||||
# and output rates are 0 and `openultrasast.budget.MeteredEmbeddingClient` prices the provider's `usage.prompt_tokens`.
|
||||
apiVersion: ax.io/v1alpha1
|
||||
kind: Model
|
||||
metadata:
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ docs = [
|
||||
"mkdocs>=1.6,<2",
|
||||
"mkdocs-material>=9.5,<10",
|
||||
]
|
||||
# The plane's memory store on an S3-compatible bucket (OUSAST_MEMORY=s3://<bucket>, plane/memory.py; RustFS is the
|
||||
# The plane's memory store on an S3-compatible bucket (OUSAST_MEMORY=s3://<bucket>, memory.py; RustFS is the
|
||||
# tested server). Imported lazily; the core install and the file store need nothing beyond PyYAML.
|
||||
s3 = [
|
||||
"boto3>=1.35,<2",
|
||||
@@ -81,7 +81,7 @@ warn_unused_configs = true
|
||||
module = "tree_sitter"
|
||||
ignore_missing_imports = true
|
||||
|
||||
# boto3 is an optional extra without inline types, absent in the type-check environment (plane/memory.py imports
|
||||
# boto3 is an optional extra without inline types, absent in the type-check environment (memory.py imports
|
||||
# it lazily).
|
||||
[[tool.mypy.overrides]]
|
||||
module = ["boto3", "botocore.*"]
|
||||
|
||||
@@ -13,8 +13,8 @@ from collections.abc import Mapping
|
||||
from decimal import Decimal
|
||||
from typing import Any, Protocol
|
||||
|
||||
from ..model.endpoint import Prices
|
||||
from ..tool_hunter import ChatClient, ChatResponse
|
||||
from .model.endpoint import Prices
|
||||
from .tool_hunter import ChatClient, ChatResponse
|
||||
|
||||
_ACCOUNT_MARKERS = ("HTTP Error 401", "HTTP Error 402", "Insufficient Balance")
|
||||
_USAGE_FIELDS = ("prompt_tokens", "prompt_cache_hit_tokens", "completion_tokens")
|
||||
|
||||
@@ -1542,7 +1542,7 @@ def _plane(args: argparse.Namespace) -> int:
|
||||
print(f"plane: {exc}", file=sys.stderr)
|
||||
return 2
|
||||
if args.plane_command == "run":
|
||||
from .plane.memory import MemoryStoreError
|
||||
from .memory import MemoryStoreError
|
||||
|
||||
_plane_memory("seed", args.run_manifest)
|
||||
try:
|
||||
@@ -1618,7 +1618,7 @@ def _plane_alerts_engine(args: argparse.Namespace) -> int:
|
||||
|
||||
def _plane_memory_normalise(args: argparse.Namespace) -> int:
|
||||
"""``ousast plane memory-normalise``: one pass over every row object; prints the counts."""
|
||||
from .plane import memory
|
||||
from . import memory
|
||||
|
||||
try:
|
||||
store = memory.open_store(args.store)
|
||||
@@ -1640,7 +1640,8 @@ def _plane_memory(
|
||||
) -> int:
|
||||
"""``seed`` before a Run, ``ingest`` after it (and ``ousast plane remember``). A store failure is reported and
|
||||
never changes the run's result: ingest can be repeated by hand."""
|
||||
from .plane import memory, reconciler
|
||||
from . import memory
|
||||
from .plane import reconciler
|
||||
from .plane.tasks.remember import UNKNOWN, remember_run
|
||||
|
||||
try:
|
||||
|
||||
@@ -20,8 +20,8 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from .. import source
|
||||
from ..budget import cost_of
|
||||
from ..model.endpoint import _PRICES
|
||||
from ..plane.budget import cost_of
|
||||
from ..preprocess import detect_language
|
||||
from .artifact import RunArtifact, UsageLedger
|
||||
from .labels import label_rows
|
||||
|
||||
@@ -116,8 +116,8 @@ def _experiment(args: argparse.Namespace) -> int:
|
||||
ceiling stops the run (``unfinished``: a rerun resumes from the outcome rows)."""
|
||||
from datetime import date
|
||||
|
||||
from ..plane.budget import MeteredClient
|
||||
from ..plane.memory import open_store
|
||||
from ..budget import MeteredClient
|
||||
from ..memory import open_store
|
||||
from . import experiments as ex
|
||||
from .program import Caller, ReplayMiss
|
||||
|
||||
@@ -240,7 +240,7 @@ def _write(report: dict[str, Any], out: Path | None) -> None:
|
||||
|
||||
def _caller(args: argparse.Namespace, store: Any, model: str) -> Any:
|
||||
"""The metered, cached caller; ``None`` client under --replay-only. Exits 2 without a ceiling or a key."""
|
||||
from ..plane.budget import MeteredClient
|
||||
from ..budget import MeteredClient
|
||||
from .program import Caller
|
||||
|
||||
parameters = _model_parameters(args.manifest)
|
||||
@@ -275,8 +275,8 @@ def _program_command(args: argparse.Namespace) -> int:
|
||||
"""compile | evaluate | curve. Exit 3 when the ceiling stops the run (``unfinished``, no artifact, no number)."""
|
||||
from datetime import date
|
||||
|
||||
from ..plane.budget import BudgetExhausted
|
||||
from ..plane.memory import open_store
|
||||
from ..budget import BudgetExhausted
|
||||
from ..memory import open_store
|
||||
from .compile import DEFAULT_SPEC, compile_program, load_program, load_spec, spec_of
|
||||
from .embeddings import EmbeddingCache
|
||||
from .evaluate import candidate_from_example, evaluate, learning_curve, predict, targets, unevaluable_families
|
||||
@@ -341,8 +341,8 @@ def _model_parameters(path: Path) -> dict[str, Any]:
|
||||
|
||||
def _memory_embed(args: argparse.Namespace) -> int:
|
||||
"""Exit 2 without a ceiling, 3 when the ceiling stops the run (``unfinished``; a rerun resumes from the cache)."""
|
||||
from ..plane.budget import BudgetExhausted, MeteredEmbeddingClient
|
||||
from ..plane.memory import open_store
|
||||
from ..budget import BudgetExhausted, MeteredEmbeddingClient
|
||||
from ..memory import open_store
|
||||
from .embeddings import embed_excerpts
|
||||
from .examples import EXAMPLE_KIND
|
||||
|
||||
@@ -370,7 +370,7 @@ def _memory_embed(args: argparse.Namespace) -> int:
|
||||
|
||||
def _memory_build(args: argparse.Namespace) -> int:
|
||||
"""Exit 2 on a refused label (``origin: user``, a source outside the list) or a source with >10% unread excerpts."""
|
||||
from ..plane.memory import open_store
|
||||
from ..memory import open_store
|
||||
from .examples import ExampleBuildError, SideReader, build_examples, pair_pins, read_jsonl, records_by_key
|
||||
from .labels import DEFAULT_CACHE, DEFAULT_SOURCES, load_sources
|
||||
|
||||
@@ -402,7 +402,7 @@ def _memory_build(args: argparse.Namespace) -> int:
|
||||
|
||||
def _audit_leaks(args: argparse.Namespace) -> int:
|
||||
"""Exit 2 when the store holds no pair to audit (an unread store is not a clean one)."""
|
||||
from ..plane.memory import open_store
|
||||
from ..memory import open_store
|
||||
from .leaks import MIN_PAIRS, THRESHOLD, audit, pair_rows, sides_from_units
|
||||
|
||||
store = open_store(args.memory)
|
||||
|
||||
@@ -36,8 +36,8 @@ from dataclasses import dataclass, field, replace
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from ..plane.budget import BudgetExhausted
|
||||
from ..plane.memory import MemoryStore
|
||||
from ..budget import BudgetExhausted
|
||||
from ..memory import MemoryStore
|
||||
from .examples import Example
|
||||
from .folds import CompileSplit, Fold, assert_disjoint, compile_split, folds_digest, outer_folds
|
||||
from .labels import _ADVISORY
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
OpenRouter serves embeddings only (``openai/text-embedding-3-small``, 1,536 dimensions, $0.02 per million input
|
||||
tokens; ``plane/models/openrouter-embedding.yaml``). Every call goes through
|
||||
:class:`..plane.budget.MeteredEmbeddingClient`, so a ceiling stops the next batch and a call reporting no tokens is
|
||||
:class:`..budget.MeteredEmbeddingClient`, so a ceiling stops the next batch and a call reporting no tokens is
|
||||
an error, not a free call. The cache key is the excerpt's sha (the content-addressed blob ``excerpts/<sha>.txt``)
|
||||
per embedding model: ``embeddings/<model-slug>/<excerpt_sha>.json`` holds ``{model, dimensions, vector (float32,
|
||||
base64, little-endian), tokens, created}``. An excerpt is embedded once; a rerun makes no call.
|
||||
@@ -20,8 +20,8 @@ from dataclasses import asdict, dataclass
|
||||
from datetime import date
|
||||
from typing import Any
|
||||
|
||||
from ..plane.budget import EmbeddingClient
|
||||
from ..plane.memory import MemoryStore
|
||||
from ..budget import EmbeddingClient
|
||||
from ..memory import MemoryStore
|
||||
from .excerpt import excerpt_sha, normalise
|
||||
|
||||
DEFAULT_MODEL = "openai/text-embedding-3-small"
|
||||
|
||||
@@ -37,7 +37,7 @@ from dataclasses import asdict, dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from ..plane.memory import MemoryStore, repo_key, row_id
|
||||
from ..memory import MemoryStore, repo_key, row_id
|
||||
from .excerpt import EXAMPLE, Bounds, delta_diff, excerpt, function_bounds, identities_of
|
||||
from .labels import Label, Sources
|
||||
from .schema import features_for
|
||||
|
||||
@@ -42,8 +42,8 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from ..plane.budget import BudgetExhausted, MeteredClient
|
||||
from ..plane.memory import MemoryStore, row_id
|
||||
from ..budget import BudgetExhausted, MeteredClient
|
||||
from ..memory import MemoryStore, row_id
|
||||
from .compile import load_program, spec_of
|
||||
from .evaluate import (
|
||||
BOUNDS,
|
||||
|
||||
@@ -12,9 +12,9 @@ from collections.abc import Callable, Mapping, Sequence
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from ..budget import BudgetExhausted, MeteredClient, cost_of, prices_from
|
||||
from ..memory import MemoryStore
|
||||
from ..model.endpoint import DeepSeekChatClient
|
||||
from ..plane.budget import BudgetExhausted, MeteredClient, cost_of, prices_from
|
||||
from ..plane.memory import MemoryStore
|
||||
from ..tool_hunter import ChatClient, ChatResponse
|
||||
from . import experiments as ex
|
||||
from .examples import Example
|
||||
|
||||
@@ -32,8 +32,8 @@ from collections.abc import Callable, Collection, Mapping, Sequence
|
||||
from dataclasses import asdict, dataclass, field, replace
|
||||
from typing import Any
|
||||
|
||||
from ..plane.budget import cost_of, prices_from
|
||||
from ..plane.memory import MemoryStore
|
||||
from ..budget import cost_of, prices_from
|
||||
from ..memory import MemoryStore
|
||||
from .examples import Example
|
||||
from .folds import Fold
|
||||
from .retrieve import Retrieval, Target, assert_boundary, demonstrations_for, retrieve
|
||||
@@ -368,7 +368,7 @@ def params_digest(parameters: Mapping[str, Any] | None) -> str:
|
||||
@dataclass
|
||||
class Caller:
|
||||
"""Every model call of a program run: cached by request in ``responses/<sha>.json`` (and in memory), replayed at
|
||||
$0. ``client`` is a metered client (``plane.budget.MeteredClient``); ``None`` is replay-only."""
|
||||
$0. ``client`` is a metered client (``budget.MeteredClient``); ``None`` is replay-only."""
|
||||
|
||||
client: Any
|
||||
model: str
|
||||
|
||||
@@ -901,7 +901,7 @@ def s3_settings(environ: Mapping[str, str] | None = None) -> dict[str, Any]:
|
||||
"""Endpoint, keys, region and session token from ``.env``/the environment; a missing key is named, a value
|
||||
never is. ``S3_ENDPOINT`` is a full URL (``https://host[:port]``)."""
|
||||
if environ is None:
|
||||
from ..config import load_dotenv
|
||||
from .config import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
environ = os.environ
|
||||
@@ -925,7 +925,7 @@ def open_store(spec: str | None = None, environ: Mapping[str, str] | None = None
|
||||
"""The store ``spec`` (else ``OUSAST_MEMORY``, else ``file://<results_root()>/memory``) names. ``s3://`` with no
|
||||
bucket uses ``S3_BUCKET``. ``read_only`` skips the S3 write/Select capability probe and refuses S3 mutations;
|
||||
it is intended for GET/list inventory readers, which do not need Select. Default opening is unchanged."""
|
||||
from .reconciler import results_root
|
||||
from .plane.reconciler import results_root
|
||||
|
||||
env = environ if environ is not None else os.environ
|
||||
text = spec or env.get("OUSAST_MEMORY") or ""
|
||||
@@ -980,7 +980,7 @@ def seed(run_manifest: Path, store: MemoryStore | None = None, *, results_root:
|
||||
"""Reuse stored facts for a Run's tasks whose ``openultrasast.io/memory-key`` matches (Req 6.1): each such task
|
||||
without a directory or a state gets ``facts.json`` and a ``done`` summary and is marked done under the run
|
||||
lock. Returns the seeded task names. A changed pin, candidate set or runner image finds nothing and recomputes."""
|
||||
from . import reconciler
|
||||
from .plane import reconciler
|
||||
|
||||
run_spec, manifests = reconciler.load_run(Path(run_manifest))
|
||||
store = store or open_store()
|
||||
|
||||
@@ -30,8 +30,8 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from ..memory import RUNS_PREFIX, MemoryStore
|
||||
from .manifests import Run
|
||||
from .memory import RUNS_PREFIX, MemoryStore
|
||||
|
||||
__all__ = ["DONE", "GRACE_SECONDS", "OUTPUT_TAR", "STATE", "Delivery", "DeliveryError", "declared", "expiry", "input_var"]
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ def doctor(profile: PlaneProfile | None = None) -> list[tuple[str, bool, str]]:
|
||||
else:
|
||||
ok, out = _registry_has(runner)
|
||||
checks.append((f"runner image in {profile.registry}", ok, out if ok else f"{out}; {hint} and loads it"))
|
||||
from .memory import MemoryStoreError, open_store # lazy: boto3 only when the profile names an S3 store
|
||||
from ..memory import MemoryStoreError, open_store # lazy: boto3 only when the profile names an S3 store
|
||||
|
||||
try:
|
||||
store = open_store(profile.memory)
|
||||
|
||||
@@ -21,7 +21,7 @@ under ``--plane`` (default ``plane/``), everything a Run over the set needs besi
|
||||
stems) the memory rows carry.
|
||||
|
||||
Each ``repo-facts`` Task carries ``openultrasast.io/memory-key`` (repository, pin, candidates digest, runner image
|
||||
digest): the key under which stored facts are reused instead of recomputed (``plane/memory.py``, ``seed``).
|
||||
digest): the key under which stored facts are reused instead of recomputed (``memory.py``, ``seed``).
|
||||
|
||||
Why per-case Tasks rather than one Task per step: an ax Task binds its Workspaces by name and a Run entry adds
|
||||
neither a binding nor env (it names a Task, artifacts and a budget), and ``Run.inputs`` accepts only
|
||||
@@ -57,10 +57,10 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from ..budget import cost_of
|
||||
from ..memory import MEMORY_KEY_ANNOTATION, POPULATION_ANNOTATION, SPLIT_ANNOTATION, memory_key
|
||||
from ..model.endpoint import price_of
|
||||
from .budget import cost_of
|
||||
from .manifests import GIT_COMMITS_ANNOTATION, RUN_API_VERSION, Task, load_manifests
|
||||
from .memory import MEMORY_KEY_ANNOTATION, POPULATION_ANNOTATION, SPLIT_ANNOTATION, memory_key
|
||||
from .reconciler import _ax_name, _doc
|
||||
from .tasks.repo_facts import _digest
|
||||
from .tasks.verify import MAX_STEPS, units_of
|
||||
|
||||
@@ -42,11 +42,11 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from ..memory import open_store
|
||||
from .delivery import Delivery, DeliveryError, declared
|
||||
from .doctor import doctor
|
||||
from .egress import Egress, policy_for
|
||||
from .manifests import AX_API_VERSION, Manifests, Model, Run, RunTask, Task, Workspace, load_manifests
|
||||
from .memory import open_store
|
||||
from .profile import PlaneProfile, load_profile
|
||||
from .router import Router, credentials, open_router
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ from typing import Any
|
||||
import yaml
|
||||
|
||||
from ...learn.schema import validate_record
|
||||
from ..memory import REMEMBER_OUTPUT, IngestResult, MemoryStore, image_digest, ingest, repo_key, row_id, validate_row
|
||||
from ...memory import REMEMBER_OUTPUT, IngestResult, MemoryStore, image_digest, ingest, repo_key, row_id, validate_row
|
||||
from .repo_facts import _digest
|
||||
|
||||
PASSES = ("a", "b", "c")
|
||||
|
||||
@@ -30,11 +30,11 @@ from collections.abc import Mapping, Sequence
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from ...budget import AccountError, BudgetExhausted, MeteredClient
|
||||
from ...learn.roles import MODEL_ROLE_KINDS
|
||||
from ...learn.schema import OPERATIONS, SOURCE_KINDS
|
||||
from ...source import MODULE_FUNCTION, product_files
|
||||
from ...tool_hunter import ChatClient
|
||||
from ..budget import AccountError, BudgetExhausted, MeteredClient
|
||||
from .verify import build_client
|
||||
|
||||
CHUNK_LINES = 400
|
||||
|
||||
@@ -26,8 +26,8 @@ from collections.abc import Mapping, Sequence
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from ...budget import AccountError, BudgetExhausted, MeteredClient
|
||||
from ...tool_hunter import CLIENT_ENV, ChatClient, ChatResponse, resolve_hunter_client, run_tool_hunter, scripted_hunter_client
|
||||
from ..budget import AccountError, BudgetExhausted, MeteredClient
|
||||
|
||||
PER_HUNT = 6
|
||||
MAX_STEPS = 6
|
||||
|
||||
@@ -15,7 +15,7 @@ from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
from ..plane.memory import MemoryStore
|
||||
from ..memory import MemoryStore
|
||||
|
||||
|
||||
class Board:
|
||||
|
||||
@@ -14,7 +14,7 @@ from collections.abc import Callable
|
||||
from dataclasses import asdict, dataclass, replace
|
||||
from typing import Any, Protocol
|
||||
|
||||
from ..plane.budget import BudgetExhausted, SpendBudget
|
||||
from ..budget import BudgetExhausted, SpendBudget
|
||||
from .board import Board
|
||||
from .budget import SearchBudget
|
||||
|
||||
@@ -43,7 +43,7 @@ class Executor(Protocol):
|
||||
|
||||
A missing cost on a model task charges its entire reservation. Model
|
||||
workers must reserve each call against limits.max_call_usd (the task's
|
||||
total allowance) using plane.budget.SpendBudget. Exceptions are untrusted
|
||||
total allowance) using openultrasast.budget.SpendBudget. Exceptions are untrusted
|
||||
diagnostics and must never be copied into the board.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -11,8 +11,8 @@ from typing import Any, Protocol, cast
|
||||
|
||||
import yaml
|
||||
|
||||
from ..budget import BudgetExhausted, SpendBudget, cost_of
|
||||
from ..model.endpoint import Prices
|
||||
from ..plane.budget import BudgetExhausted, SpendBudget, cost_of
|
||||
from ..provider.openrouter import parse_json_content
|
||||
from . import _sandbox
|
||||
from .budget import SearchBudget
|
||||
|
||||
@@ -10,7 +10,7 @@ from datetime import timedelta
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from urllib.parse import unquote, urlsplit
|
||||
|
||||
from openultrasast.plane.memory import MemoryStore
|
||||
from openultrasast.memory import MemoryStore
|
||||
|
||||
|
||||
class HttpObjectStore(MemoryStore):
|
||||
|
||||
@@ -130,7 +130,7 @@ def test_rustfs_page_lists_the_complete_policy_and_no_secret() -> None:
|
||||
|
||||
def test_rustfs_page_quotes_the_refusals_verify_bucket_writes() -> None:
|
||||
"""Each refusal line the page quotes still appears, as a template fragment, in the store's code."""
|
||||
code = (ROOT / "src" / "openultrasast" / "plane" / "memory.py").read_text(encoding="utf-8")
|
||||
code = (ROOT / "src" / "openultrasast" / "memory.py").read_text(encoding="utf-8")
|
||||
for fragment in (
|
||||
"the bucket is not set up for the store. The store never configures its ",
|
||||
"it must be Enabled (provenance cites object versions)",
|
||||
|
||||
@@ -1238,7 +1238,7 @@ def test_kubernetes_host_pin_success_failure_and_cleanup(tmp_path, monkeypatch,
|
||||
|
||||
from engine_trace_k8s import Kubernetes
|
||||
|
||||
from openultrasast.plane.memory import S3Store
|
||||
from openultrasast.memory import S3Store
|
||||
|
||||
objects, calls, expiries = {}, [], []
|
||||
|
||||
@@ -1372,7 +1372,7 @@ def test_scheduler_bounds_lanes_and_progress(tmp_path, monkeypatch, executor, pa
|
||||
def test_k8s_check_roundtrip_and_retention(tmp_path, monkeypatch, capsys, keep):
|
||||
from engine_trace_k8s import Kubernetes
|
||||
|
||||
from openultrasast.plane.memory import S3Store
|
||||
from openultrasast.memory import S3Store
|
||||
|
||||
data, manifests_seen, commands = {}, [], []
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import pytest
|
||||
from learn_fixtures import ScriptedChat, by_id, corpus, default_answer, example
|
||||
from test_plane_memory import FakeObjects, _real_s3
|
||||
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.learn import compile as compile_module
|
||||
from openultrasast.learn.compile import (
|
||||
DEFAULT_SPEC,
|
||||
@@ -33,8 +34,7 @@ from openultrasast.learn.compile import (
|
||||
from openultrasast.learn.examples import Example
|
||||
from openultrasast.learn.folds import Fold, FoldError
|
||||
from openultrasast.learn.program import Caller, Demo
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
from openultrasast.plane.memory import FileStore, MemoryStore, S3Store
|
||||
from openultrasast.memory import FileStore, MemoryStore, S3Store
|
||||
|
||||
PRICES = {"cache_hit_per_m": 0.014, "input_per_m": 0.44, "output_per_m": 1.32}
|
||||
MEMORY = corpus(groups=24, per_group=4)
|
||||
|
||||
@@ -10,6 +10,7 @@ import random
|
||||
import pytest
|
||||
from learn_fixtures import ScriptedChat, corpus
|
||||
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.learn.evaluate import (
|
||||
Prediction,
|
||||
candidate_from_example,
|
||||
@@ -28,7 +29,6 @@ from openultrasast.learn.evaluate import (
|
||||
from openultrasast.learn.folds import compile_split, outer_folds
|
||||
from openultrasast.learn.program import SIGNATURE, Caller, Program, ProgramSpec
|
||||
from openultrasast.learn.schema import SCHEMA_VERSION, feature_set_digest
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
|
||||
|
||||
def _preds(n: int = 300, *, folds: int = 3, seed: int = 0, unsure_every: int = 0) -> list[Prediction]:
|
||||
|
||||
@@ -10,6 +10,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
from test_plane_memory import FakeObjects
|
||||
|
||||
from openultrasast.budget import BudgetExhausted, MeteredEmbeddingClient, UnmeteredUsage
|
||||
from openultrasast.learn.embeddings import (
|
||||
EmbeddingCache,
|
||||
EmbeddingError,
|
||||
@@ -21,9 +22,8 @@ from openultrasast.learn.embeddings import (
|
||||
vector_for,
|
||||
)
|
||||
from openultrasast.learn.excerpt import excerpt_sha
|
||||
from openultrasast.plane.budget import BudgetExhausted, MeteredEmbeddingClient, UnmeteredUsage
|
||||
from openultrasast.memory import FileStore, MemoryStore, S3Store
|
||||
from openultrasast.plane.manifests import load_manifests
|
||||
from openultrasast.plane.memory import FileStore, MemoryStore, S3Store
|
||||
from openultrasast.provider.openrouter import parse_embedding_payload
|
||||
|
||||
PRICES = {"cache_hit_per_m": 0, "input_per_m": 0.02, "output_per_m": 0}
|
||||
|
||||
@@ -24,7 +24,7 @@ from openultrasast.learn.examples import (
|
||||
)
|
||||
from openultrasast.learn.features import Part, quick_part, record
|
||||
from openultrasast.learn.labels import Source, Sources
|
||||
from openultrasast.plane.memory import FileStore, MemoryStore, MemoryStoreError, S3Store
|
||||
from openultrasast.memory import FileStore, MemoryStore, MemoryStoreError, S3Store
|
||||
|
||||
PIN = "0123456789abcdef0123456789abcdef01234567"
|
||||
SOURCES = Sources(
|
||||
|
||||
@@ -13,13 +13,13 @@ from unittest.mock import Mock
|
||||
import pytest
|
||||
from learn_fixtures import ScriptedChat, corpus, x_record
|
||||
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.cli import main
|
||||
from openultrasast.learn import experiments as ex
|
||||
from openultrasast.learn.compile import canonical, program_id
|
||||
from openultrasast.learn.program import TEMPERATURES, Caller, Candidate, Program, ProgramSpec
|
||||
from openultrasast.learn.retrieve import Target
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
from openultrasast.plane.memory import FileStore, MemoryStore, Record
|
||||
from openultrasast.memory import FileStore, MemoryStore, Record
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
PRICES = {"cache_hit_per_m": 0.014, "input_per_m": 0.44, "output_per_m": 1.32}
|
||||
|
||||
@@ -16,7 +16,7 @@ from openultrasast.learn import experiments as ex
|
||||
from openultrasast.learn.fill import fill_rule
|
||||
from openultrasast.learn.program import Candidate, Program, Prompt
|
||||
from openultrasast.learn.retrieve import Target
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
|
||||
|
||||
def snapshot(root: Path) -> dict[str, bytes]:
|
||||
|
||||
@@ -12,7 +12,7 @@ from learn_fixtures import x_record
|
||||
from openultrasast.cli import main
|
||||
from openultrasast.learn.leaks import Pair, Signal, audit, pair_rows, separation
|
||||
from openultrasast.learn.schema import BY_NAME
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
|
||||
|
||||
def _pairs(n: int = 20) -> list[Pair]:
|
||||
|
||||
@@ -12,6 +12,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
from learn_fixtures import ScriptedChat, by_id, corpus, x_record
|
||||
|
||||
from openultrasast.budget import BudgetExhausted, MeteredClient
|
||||
from openultrasast.learn import program as program_module
|
||||
from openultrasast.learn.folds import outer_folds
|
||||
from openultrasast.learn.program import (
|
||||
@@ -34,9 +35,8 @@ from openultrasast.learn.program import (
|
||||
)
|
||||
from openultrasast.learn.retrieve import BoundaryViolation, Retrieval, Target
|
||||
from openultrasast.learn.schema import EXCLUDED_FIELDS, FeatureRecordError
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.model.endpoint import DeepSeekChatClient
|
||||
from openultrasast.plane.budget import BudgetExhausted, MeteredClient
|
||||
from openultrasast.plane.memory import FileStore
|
||||
|
||||
PRICES = {"cache_hit_per_m": 0.014, "input_per_m": 0.44, "output_per_m": 1.32}
|
||||
EXAMPLES = corpus(groups=10)
|
||||
|
||||
@@ -7,6 +7,7 @@ from __future__ import annotations
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.learn.features import Vocabulary, function_of, model_sinks_part, roles_part
|
||||
from openultrasast.learn.roles import (
|
||||
RoleSet,
|
||||
@@ -19,7 +20,6 @@ from openultrasast.learn.roles import (
|
||||
vocabulary_overlay,
|
||||
)
|
||||
from openultrasast.model.specs import taint_specs
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
from openultrasast.plane.tasks import roles as roles_task
|
||||
from openultrasast.tool_hunter import ChatResponse, ScriptedChatClient
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ from openultrasast.learn.evaluate import (
|
||||
) # fmt: skip
|
||||
from openultrasast.learn.program import Candidate, Program
|
||||
from openultrasast.learn.retrieve import Target
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.budget import AccountError, BudgetExhausted, MeteredClient, cost_of, prices_from
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import AccountError, BudgetExhausted, MeteredClient, cost_of, prices_from
|
||||
from openultrasast.tool_hunter import ChatResponse
|
||||
|
||||
FLASH = {"cache_hit_per_m": 0.014, "input_per_m": 0.44, "output_per_m": 1.32}
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.plane.tasks import features
|
||||
from openultrasast.plane.tasks.remember import remember_run
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@ import pytest
|
||||
import yaml
|
||||
from test_plane_reconciler import AX_FIELDS, non_ax_fields
|
||||
|
||||
from openultrasast.budget import prices_from
|
||||
from openultrasast.memory import MEMORY_KEY_ANNOTATION, POPULATION_ANNOTATION, SPLIT_ANNOTATION, parse_memory_key
|
||||
from openultrasast.model.endpoint import price_of
|
||||
from openultrasast.plane import reconciler
|
||||
from openultrasast.plane.budget import prices_from
|
||||
from openultrasast.plane.generate import TEMPLATES, fix_ranges, increment, read_cases, render, repin_templates
|
||||
from openultrasast.plane.manifests import load_manifests
|
||||
from openultrasast.plane.memory import MEMORY_KEY_ANNOTATION, POPULATION_ANNOTATION, SPLIT_ANNOTATION, parse_memory_key
|
||||
from openultrasast.source import _digest
|
||||
|
||||
PLANE = Path("plane")
|
||||
|
||||
@@ -18,8 +18,8 @@ from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane import memory, reconciler
|
||||
from openultrasast.plane.memory import (
|
||||
from openultrasast import memory
|
||||
from openultrasast.memory import (
|
||||
S3_KEYS,
|
||||
ExpiryRule,
|
||||
FileStore,
|
||||
@@ -34,6 +34,7 @@ from openultrasast.plane.memory import (
|
||||
seed,
|
||||
where_sql,
|
||||
)
|
||||
from openultrasast.plane import reconciler
|
||||
from openultrasast.source import _digest
|
||||
|
||||
PIN = "0123456789abcdef0123456789abcdef01234567"
|
||||
@@ -219,7 +220,7 @@ def test_a_malformed_row_fails_naming_it_and_writes_nothing(store: MemoryStore)
|
||||
def test_facts_that_no_longer_match_their_hash_are_dropped(store: MemoryStore, caplog: pytest.LogCaptureFixture) -> None:
|
||||
sha = store.put_facts(FACTS)
|
||||
store._put(f"facts/{sha}.json", b"tampered")
|
||||
with caplog.at_level(logging.WARNING, logger="openultrasast.plane.memory"):
|
||||
with caplog.at_level(logging.WARNING, logger="openultrasast.memory"):
|
||||
assert store.get_facts(sha) is None
|
||||
assert "no longer matches" in caplog.text and store._get(f"facts/{sha}.json") is None
|
||||
|
||||
@@ -347,7 +348,7 @@ def _filled(client: FakeObjects) -> S3Store:
|
||||
def test_select_is_pushed_down_when_the_probe_answers(caplog: pytest.LogCaptureFixture) -> None:
|
||||
client = FakeObjects("works")
|
||||
store = _filled(client)
|
||||
with caplog.at_level(logging.WARNING, logger="openultrasast.plane.memory"):
|
||||
with caplog.at_level(logging.WARNING, logger="openultrasast.memory"):
|
||||
got = [r.row["candidate"] for r in store.rows(kind="verdict", where={"final": "disputed"})]
|
||||
assert got == ["a.py::x"] and "locally" not in caplog.text
|
||||
assert client.selects[0] == 'SELECT * FROM S3Object s WHERE s."probe" = 1'
|
||||
|
||||
@@ -959,8 +959,8 @@ def test_state_is_mirrored_to_the_store_and_seeds_a_rerun_from_an_empty_results_
|
||||
def test_a_store_that_cannot_open_stops_the_run_before_ax_and_leaves_no_lock(
|
||||
fake: Fake, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast.plane.memory import MemoryStoreError
|
||||
from openultrasast import memory
|
||||
from openultrasast.memory import MemoryStoreError
|
||||
|
||||
monkeypatch.setattr(reconciler, "open_store", memory.open_store) # the real one, not the fixture's fake
|
||||
monkeypatch.setenv("OUSAST_MEMORY", "s3://nowhere") # the profile's override; no S3_* in the test environment
|
||||
|
||||
@@ -13,9 +13,8 @@ from typing import Any
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from openultrasast import cli
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast.plane.memory import FileStore, MemoryStoreError, ingest, row_id
|
||||
from openultrasast import cli, memory
|
||||
from openultrasast.memory import FileStore, MemoryStoreError, ingest, row_id
|
||||
from openultrasast.plane.tasks import remember
|
||||
from openultrasast.plane.tasks.remember import Context, candidates_digest, remember_run, rows_for
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@ def test_matching_verdicts_are_identical_on_the_recorded_outputs(reference: tupl
|
||||
|
||||
def _units(case_id: str, kept: list[list[Any]]) -> tuple[list[dict[str, Any]], list[dict[str, Any]], float]:
|
||||
"""The recorded per-file hunts as two `verify` passes: a hunt's usd is the file's spend minus its triage."""
|
||||
from openultrasast.budget import cost_of
|
||||
from openultrasast.model.endpoint import price_of
|
||||
from openultrasast.plane.budget import cost_of
|
||||
|
||||
prices = price_of("deepseek-flash")
|
||||
assert prices is not None
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
from test_plane_verify import CANDIDATES, FACTS, FLASH, HuntClient, _two_passes, _workspace
|
||||
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.plane.tasks import agree, verify
|
||||
from openultrasast.tool_hunter import CLIENT_ENV
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.budget import MeteredClient
|
||||
from openultrasast.budget import MeteredClient
|
||||
from openultrasast.plane.tasks import agree, verify
|
||||
from openultrasast.tool_hunter import ChatResponse, ToolCall
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.search.board import Board
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.budget import BudgetExhausted, SpendBudget
|
||||
from openultrasast.budget import BudgetExhausted, SpendBudget
|
||||
from openultrasast.search.budget import SearchBudget
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.search.board import Board
|
||||
from openultrasast.search.budget import SearchBudget
|
||||
from openultrasast.search.coordinator import Coordinator
|
||||
@@ -204,7 +204,7 @@ def test_worker_limit_preserves_fact_and_survives_resume(tmp_path, detail):
|
||||
|
||||
@pytest.mark.parametrize("detail", ["spend", "tasks", "reason_rounds", "demonstrations", "task_wall", "search_wall", "run_ceiling"])
|
||||
def test_coordinator_identifies_each_own_limit(tmp_path, detail):
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
from openultrasast.budget import SpendBudget
|
||||
|
||||
now = [0]
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ def test_driver_allocates_fair_share_with_settled_rollover(tmp_path, monkeypatch
|
||||
from types import SimpleNamespace
|
||||
|
||||
from benchmarks.search import pilot_run
|
||||
from openultrasast.plane.budget import BudgetExhausted
|
||||
from openultrasast.budget import BudgetExhausted
|
||||
|
||||
monkeypatch.chdir(tmp_path)
|
||||
root = Path("benchmarks/search/private")
|
||||
@@ -145,9 +145,9 @@ def make_pilot(tmp_path, *, side="fixed", dry_run=False):
|
||||
from argparse import Namespace
|
||||
|
||||
from benchmarks.search.pilot_run import Pilot
|
||||
from openultrasast.budget import SpendBudget
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.search.worker import StubModel
|
||||
|
||||
args = Namespace(side=side, dry_run=dry_run, model="scripted", max_tokens=128, verify_lane="vm", image="unused")
|
||||
@@ -209,8 +209,8 @@ def test_worker_failure_is_not_no_evidence(tmp_path):
|
||||
|
||||
|
||||
def test_shared_budget_reserved_and_settled_on_error(tmp_path):
|
||||
from openultrasast.budget import SpendBudget
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
from openultrasast.search.worker import Worker
|
||||
|
||||
run = SpendBudget(0.5)
|
||||
@@ -400,8 +400,8 @@ def test_vm_preflight_refuses_before_client_or_store(tmp_path, monkeypatch):
|
||||
|
||||
|
||||
def test_actual_usage_settles_shared_budget_and_counts_tokens(tmp_path):
|
||||
from openultrasast.budget import SpendBudget
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
from openultrasast.search.worker import Worker
|
||||
|
||||
run, task = SpendBudget(0.5), SpendBudget(0.05)
|
||||
@@ -421,8 +421,8 @@ def test_actual_usage_settles_shared_budget_and_counts_tokens(tmp_path):
|
||||
|
||||
|
||||
def test_refused_shared_reservation_releases_task_allowance(tmp_path):
|
||||
from openultrasast.budget import BudgetExhausted, SpendBudget
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import BudgetExhausted, SpendBudget
|
||||
from openultrasast.search.worker import StubModel, Worker
|
||||
|
||||
run, task = SpendBudget(0), SpendBudget(0.05)
|
||||
|
||||
@@ -3,7 +3,7 @@ from dataclasses import asdict
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
from openultrasast.search import _sandbox
|
||||
from openultrasast.search.board import Board
|
||||
from openultrasast.search.budget import SearchBudget
|
||||
@@ -100,8 +100,8 @@ def test_coordinator_stub_smoke_real_verify(tmp_path):
|
||||
|
||||
|
||||
def test_reservation_precedes_each_call_and_refuses_over_budget(tmp_path):
|
||||
from openultrasast.budget import SpendBudget
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
|
||||
class MeteredStub(StubModel):
|
||||
def complete_chat_raw(self, **kwargs):
|
||||
@@ -353,8 +353,8 @@ def test_task_spend_finishes_with_confirmed_observations(tmp_path, with_evidence
|
||||
def test_calibrated_reservation_covers_reported_usage(tmp_path):
|
||||
import math
|
||||
|
||||
from openultrasast.budget import SpendBudget
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
|
||||
class UsageStub(StubModel):
|
||||
def complete_chat_raw(self, **kwargs):
|
||||
@@ -375,8 +375,8 @@ def test_calibrated_reservation_covers_reported_usage(tmp_path):
|
||||
|
||||
@pytest.mark.parametrize("detail", ["worker_steps", "worker_wall", "run_ceiling"])
|
||||
def test_worker_exhaustion_is_structured(tmp_path, monkeypatch, detail):
|
||||
from openultrasast.budget import SpendBudget
|
||||
from openultrasast.model.endpoint import Prices
|
||||
from openultrasast.plane.budget import SpendBudget
|
||||
|
||||
worker = Worker(
|
||||
StubModel([tool("list_files")]),
|
||||
|
||||
@@ -464,8 +464,7 @@ def test_cli_uses_environment_and_injected_stores(
|
||||
):
|
||||
import json
|
||||
|
||||
from openultrasast import config
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import config, memory
|
||||
|
||||
seen = []
|
||||
monkeypatch.setenv("GH_TOKEN", "fake-secret")
|
||||
@@ -1700,8 +1699,7 @@ def test_bank_crash_resume_and_durability_failure(tmp_path, monkeypatch, failure
|
||||
|
||||
@pytest.mark.parametrize("bank_args,prefix", [([], None), (["--bank"], "unseen"), (["--bank", "custom"], "custom")])
|
||||
def test_cli_corpus_bank_is_opt_in(tmp_path, monkeypatch, capsys, bank_args, prefix):
|
||||
from openultrasast import config
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import config, memory
|
||||
|
||||
objects = CorpusFakeObjects()
|
||||
monkeypatch.setattr(config, "load_dotenv", lambda *a: None)
|
||||
|
||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from openultrasast.plane.memory import FileStore
|
||||
from openultrasast.memory import FileStore
|
||||
|
||||
with pytest.MonkeyPatch.context() as patch:
|
||||
patch.syspath_prepend(str(Path(__file__).resolve().parents[1] / "benchmarks/unseen"))
|
||||
@@ -109,8 +109,7 @@ def test_registered_units_and_read_only_store(tmp_path):
|
||||
|
||||
|
||||
def test_cli_injected_store_and_credentials(tmp_path, monkeypatch, capsys):
|
||||
from openultrasast import config
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import config, memory
|
||||
|
||||
calls = []
|
||||
monkeypatch.setattr(config, "load_dotenv", lambda path: calls.append("dotenv"))
|
||||
@@ -129,7 +128,7 @@ def test_cli_injected_store_and_credentials(tmp_path, monkeypatch, capsys):
|
||||
|
||||
|
||||
def test_s3_open_is_read_only(tmp_path, monkeypatch):
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import memory
|
||||
|
||||
class Objects:
|
||||
def keys(self, prefix):
|
||||
@@ -267,8 +266,7 @@ def test_memory_values_are_skipped_and_counted(tmp_path, capsys):
|
||||
|
||||
@pytest.mark.parametrize("step", ["open_stores", "build_used", "report", "canonicalize", "verify_tests"])
|
||||
def test_cli_failure_reports_only_step_and_exception_type(tmp_path, monkeypatch, capsys, step):
|
||||
from openultrasast import config
|
||||
from openultrasast.plane import memory
|
||||
from openultrasast import config, memory
|
||||
|
||||
def fail(*args, **kwargs):
|
||||
raise RuntimeError("sensitive/identity")
|
||||
|
||||
Reference in New Issue
Block a user