diff --git a/tasks/candidate-1247-security-reverse-engineering/tests/test_outputs.py b/tasks/candidate-1247-security-reverse-engineering/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..0431c87a76f9762b9825e1474d435dc0f1bf0d4d --- /dev/null +++ b/tasks/candidate-1247-security-reverse-engineering/tests/test_outputs.py @@ -0,0 +1,169 @@ +from __future__ import annotations + +import ast +import hashlib +import json +import os +import re +import subprocess +import sys +from pathlib import Path + +import pytest + + +APP = Path("/app") +PROJECT = APP / "vendor/dissect-cstruct" +FIXTURES = Path("/tests/fixtures") +REPORT = APP / "repair_report.json" +CONTEXT_PATTERN = re.compile(r"^([ >])(\d+): (.*)$") + + +def load_cases() -> dict[str, object]: + return json.loads((FIXTURES / "regression_cases.json").read_text()) + + +def expected_context(definition: str, line: int, radius: int = 2) -> dict[int, str]: + lines = definition.splitlines() + start = max(1, line - radius) + end = min(len(lines), line + radius) + return {number: lines[number - 1] for number in range(start, end + 1)} + + +def parse_diagnostic(message: str) -> tuple[int, dict[int, str], set[int]]: + header = re.match(r"line (\d+):", message) + assert header, f"missing line-number header: {message!r}" + rows: dict[int, str] = {} + marked: set[int] = set() + for raw_line in message.splitlines()[1:]: + match = CONTEXT_PATTERN.fullmatch(raw_line) + assert match, f"malformed context row: {raw_line!r}" + marker, number, source = match.groups() + line_number = int(number) + assert line_number not in rows, f"duplicate context line {line_number}" + rows[line_number] = source + if marker == ">": + marked.add(line_number) + return int(header.group(1)), rows, marked + + +def run_load(definition: str) -> Exception: + from dissect.cstruct import cstruct + + with pytest.raises(Exception) as captured: + cstruct().load(definition) + return captured.value + + +def test_gate_workspace_integrity_and_report() -> None: + integrity = json.loads((FIXTURES / "source_integrity.json").read_text()) + assert PROJECT.is_dir() + for relative_path, expected_hash in integrity.items(): + path = APP / relative_path + assert path.is_file(), f"required frozen asset missing: {relative_path}" + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected_hash + + for relative_path in ("dissect/cstruct/lexer.py", "dissect/cstruct/parser.py"): + source = (PROJECT / relative_path).read_text() + ast.parse(source) + assert len(source) > 1000 + + report = json.loads(REPORT.read_text()) + assert report["schema_version"] == "tbench.cstruct_repair_report.v1" + assert {item["name"] for item in report["diagnostics"]} == {"unknown_directive", "missing_terminator"} + assert report["decode_probe"] == { + "count": 2, + "flags": 129, + "magic": 50010, + "offsets": [16, 44], + "size": 12, + } + + +def test_gate_focused_upstream_suite() -> None: + environment = os.environ.copy() + environment["PYTHONPATH"] = str(PROJECT) + completed = subprocess.run( + [ + sys.executable, + "-c", + ( + "import sys, types, pytest; " + "package = types.ModuleType('tests'); " + f"package.__path__ = [{str(PROJECT / 'tests')!r}]; " + "sys.modules['tests'] = package; " + "raise SystemExit(pytest.main(sys.argv[1:]))" + ), + "-q", + str(PROJECT / "tests/test_lexer.py"), + str(PROJECT / "tests/test_parser.py"), + ], + cwd=PROJECT, + env=environment, + capture_output=True, + text=True, + timeout=45, + ) + assert completed.returncode == 0, completed.stdout + completed.stderr + assert "passed" in completed.stdout + + +def test_core_lexer_context_is_dynamic_and_numbered() -> None: + case = load_cases()["lexer"] + error = run_load(case["definition"]) + assert type(error).__name__ == case["error_type"] + assert case["message_fragment"] in str(error) + line, rows, marked = parse_diagnostic(str(error)) + assert line == case["line"] + assert rows == expected_context(case["definition"], line) + assert marked == {line} + + +def test_core_parser_context_uses_failing_token() -> None: + case = load_cases()["parser"] + error = run_load(case["definition"]) + assert type(error).__name__ == case["error_type"] + assert case["message_fragment"] in str(error) + line, rows, marked = parse_diagnostic(str(error)) + assert line == case["line"] + assert rows == expected_context(case["definition"], line) + assert marked == {line} + + +def test_core_valid_big_endian_binary_decode_is_preserved() -> None: + from dissect.cstruct import cstruct + + case = load_cases()["binary"] + parser = cstruct(endian=case["endian"]).load(case["definition"]) + value = parser.EvidenceHeader(bytes.fromhex(case["hex"])) + actual = { + "signature": value.signature, + "flags": value.flags, + "count": value.count, + "record_offsets": list(value.record_offsets), + "size": len(parser.EvidenceHeader), + } + assert actual == case["expected"] + assert value.dumps().hex() == case["hex"] + + +def test_edge_line_continuations_use_normalized_source() -> None: + case = load_cases()["continued_parser"] + error = run_load(case["definition"]) + assert type(error).__name__ == case["error_type"] + line, rows, marked = parse_diagnostic(str(error)) + assert line == case["line"] + assert rows == expected_context(case["normalized_definition"], line) + assert marked == {line} + assert all("\\" not in source for source in rows.values()) + + +def test_edge_preload_parser_error_is_safe_and_line_only() -> None: + from dissect.cstruct import cstruct + from dissect.cstruct.lexer import Token, TokenType + from dissect.cstruct.parser import CStyleParser + + parser = CStyleParser(cstruct()) + error = parser._error("pre-load failure", token=Token(TokenType.IDENTIFIER, "bad", 17)) + assert type(error).__name__ == "ParserError" + assert str(error) == "line 17: pre-load failure" diff --git a/tasks/candidate-1257-software-systems/environment/Dockerfile b/tasks/candidate-1257-software-systems/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d1c446a9eac38ffb508e7940babf8659f6386ae9 --- /dev/null +++ b/tasks/candidate-1257-software-systems/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5dde74728d7d458d80c166752b6e0afa5e870a4d5a4c5e79976c75c5e8b92ed5 diff --git a/tasks/candidate-1257-software-systems/environment/setup/setup.sh b/tasks/candidate-1257-software-systems/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1257-software-systems/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1257-software-systems/instruction.md b/tasks/candidate-1257-software-systems/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5c29394fec5473ece005f87ded27641358ed015a --- /dev/null +++ b/tasks/candidate-1257-software-systems/instruction.md @@ -0,0 +1,33 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair compressed wheel-tag parsing + +You are given a frozen Python packaging library under `/app/vendor/packaging`. +The public tag parser currently accepts malformed interpreter components in a +compressed tag. For example, a dotted numeric component can be expanded into +several bogus interpreter tags. The wheel filename utility then exposes the +same defect through its public API. + +Repair the existing production source in both `src/packaging/tags.py` and +`src/packaging/utils.py`. + +Requirements: + +1. Every interpreter member of a compressed tag must be a Python identifier. + Reject invalid members before creating any `Tag` objects. Digits are valid + when the complete value is an identifier: preserve values such as `py3`, + `graalpy311`, and `_custom`. +2. Keep existing empty-component, three-component, ordering, and tag-limit + checks intact. +3. `parse_wheel_filename()` must translate tag validation failures to its own + `InvalidWheelFilename` exception while retaining normal project-name, + version, build, and valid-tag normalization behavior. +4. Run the offline integration audit at `/app/run_audit.py`. It reads + `/app/inputs/tag_cases.json` and writes the required artifact + `/app/output.json` using the schema in `/app/contract.json`. + +Do not add dependencies or access the network. The deliverable is the modified +source tree plus the generated JSON artifact. + diff --git a/tasks/candidate-1257-software-systems/task.toml b/tasks/candidate-1257-software-systems/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..569443a568bcbc88053e5efd114837bc4e6c86fe --- /dev/null +++ b/tasks/candidate-1257-software-systems/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1257-software-systems" +description = "MiMo-V2.6-RL terminal task candidate-1257-software-systems" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1257-software-systems" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:5dde74728d7d458d80c166752b6e0afa5e870a4d5a4c5e79976c75c5e8b92ed5" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1257-software-systems/tests/anti_hack_guard.py b/tasks/candidate-1257-software-systems/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1257-software-systems/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1257-software-systems/tests/fixtures/cases.json b/tasks/candidate-1257-software-systems/tests/fixtures/cases.json new file mode 100644 index 0000000000000000000000000000000000000000..90adf7eac4454e97750d837f5c1992ee16505434 --- /dev/null +++ b/tasks/candidate-1257-software-systems/tests/fixtures/cases.json @@ -0,0 +1,14 @@ +{ + "direct": [ + {"tag": "py2.py3-none-any", "status": "ok", "tags": ["py2-none-any", "py3-none-any"]}, + {"tag": "_custom.graalpy311-none-any", "status": "ok", "tags": ["_custom-none-any", "graalpy311-none-any"]}, + {"tag": "2.7.6-cp27-manylinux_2_17_x86_64", "status": "error", "error_type": "InvalidTag"}, + {"tag": "py3..py2-none-any", "status": "error", "error_type": "InvalidTag"} + ], + "wheels": [ + {"filename": "demo_pkg-1.4-py3.py2-none-any.whl", "status": "ok", "name": "demo-pkg", "version": "1.4", "build": [], "tags": ["py2-none-any", "py3-none-any"]}, + {"filename": "demo_pkg-2.0-1abc-cp311-abi3-manylinux_2_17_x86_64.whl", "status": "ok", "name": "demo-pkg", "version": "2.0", "build": [1, "abc"], "tags": ["cp311-abi3-manylinux_2_17_x86_64"]}, + {"filename": "demo_pkg-1.4-2.7.6-none-any.whl", "status": "error", "error_type": "InvalidWheelFilename"}, + {"filename": "demo_pkg-1.4-py3..py2-none-any.whl", "status": "error", "error_type": "InvalidWheelFilename"} + ] +} diff --git a/tasks/candidate-1257-software-systems/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1257-software-systems/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3c742879edb4f540f895acadb16c917fe92f9f7c --- /dev/null +++ b/tasks/candidate-1257-software-systems/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,43 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "contract.json": "8e2c57170bb87ecabeb87f35cc88b68d62df53c66767441acd1bfff6dc3ff1bd", + "inputs/tag_cases.json": "407e6bec7a3114350887395b6c399cfa1bbd2a49782c0f0b218af291ca829fe1", + "run_audit.py": "7ca92adf058d01e96c1ada6e42ed328db23294813cd981f0c315cd854d11f377", + "vendor/packaging/LICENSE": "cad1ef5bd340d73e074ba614d26f7deaca5c7940c3d8c34852e65c4909686c48", + "vendor/packaging/README.rst": "62ffae0495b4ed9b8357c03f661b923861565fc8f3bdd42de23a4e5217514e3a", + "vendor/packaging/pyproject.toml": "b0a54ca7272d1dce914f64e6dddf6026e5664aff3622971994956b320c00f59e", + "vendor/packaging/src/packaging/__init__.py": "bf01887ad0f4a9fa9e3b9cd4601dc40a7b2970b5c808cde59e64c4aa1e797c91", + "vendor/packaging/src/packaging/_elffile.py": "1f025f54c573f1a85740c4fbd908cc1d1fb0c177c14377ebf5f09d6cd5368780", + "vendor/packaging/src/packaging/_manylinux.py": "5b6e84324c42538ab4cdb148e2430fdba36f04427b0efda55bea083a35fa6136", + "vendor/packaging/src/packaging/_musllinux.py": "0328fb827b1170c77df4c107d49be8df8d37262103490a61e8acad8a2f9cadff", + "vendor/packaging/src/packaging/_parser.py": "88a348115209327497e453b635e5db099fd592f9335d710c7313b29cdb30c50c", + "vendor/packaging/src/packaging/_ranges.py": "b7b595f2e692aeb3697c545b85c24cbbcb4552f2adc6d9059aa82d0877e816b7", + "vendor/packaging/src/packaging/_structures.py": "eb48d16c5efca7ccf930a9cd77a700a6b80e69d0891d5d03966526441a8565cb", + "vendor/packaging/src/packaging/_tokenizer.py": "cc25e57c0d564c89e15073471d6e1c264299ca946fb17c0e1e4af54ef7713ee6", + "vendor/packaging/src/packaging/dependency_groups.py": "5309cc564ca3022dfb594816e9d593bb09cdf34208c1fb8c5ec9afb6c670278c", + "vendor/packaging/src/packaging/direct_url.py": "843baa95d04cbb49288de9d9fd77ee946e862cb603123e7e46a69e171fa7d06b", + "vendor/packaging/src/packaging/errors.py": "ea17c461701ff2ffc817ae7e94569d24e30889e04fdb120ab721178c6d67188b", + "vendor/packaging/src/packaging/licenses/__init__.py": "590d12eee73ddbec53b4e9ee5bfc64d9cb3aacb4940e8ebcba260757ce56740b", + "vendor/packaging/src/packaging/licenses/_spdx.py": "596ec35e2ca0ebcba9fd8343ff0a51625af548786257815f24b41f7e08613314", + "vendor/packaging/src/packaging/markers.py": "9056d5d4882a3ba14a7624ba64c3a33aadb00c563dce4d15343dc229fbef5f8a", + "vendor/packaging/src/packaging/metadata.py": "de04e563692ed785d4779c711639b9c464f92fb5865d80c9a540602f8f12ba14", + "vendor/packaging/src/packaging/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/packaging/src/packaging/pylock.py": "1bc9a1fc8835202b3b5722fcde0b142f71064b31d9c67647ea879d9b21c855c5", + "vendor/packaging/src/packaging/ranges.py": "b4781ce913e5dff9e07906f20585c54c3028e1f7ff56341828e79d522ddbfab6", + "vendor/packaging/src/packaging/requirements.py": "c3e8fd347d4c92e4083445fd95441fcb02d2def922c96d1b2147728c394168aa", + "vendor/packaging/src/packaging/specifiers.py": "f9e37cfb1ceba333a1302c2af605ec6f2fb67801f341af70d347f9271ab8e9cb", + "vendor/packaging/src/packaging/tags.py": "cb6d67388b647f87e4e83b89a005949e682c6b804f4b7f2bb0a2853e6d15b590", + "vendor/packaging/src/packaging/utils.py": "0074d32bf98c4bc4a400507c499615ac8c29b09a456d538422d82fd39640c8aa", + "vendor/packaging/src/packaging/version.py": "af4b2bfdbdaaf743eb5ef831e7981963857ef39ab96fdbeee4d402539f715059" + }, + "mutable": [ + "vendor/packaging/src/packaging/tags.py", + "vendor/packaging/src/packaging/utils.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1257-software-systems/tests/task_test.sh b/tasks/candidate-1257-software-systems/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6e964614f2afdad11e39f5c7e2364a77835f0e1e --- /dev/null +++ b/tasks/candidate-1257-software-systems/tests/task_test.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set +e +mkdir -p /logs/verifier +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +if [ "$status" -eq 0 ]; then + echo 1 > /logs/verifier/reward.txt +else + echo 0 > /logs/verifier/reward.txt +fi +exit 0 + diff --git a/tasks/candidate-1257-software-systems/tests/test.sh b/tasks/candidate-1257-software-systems/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1257-software-systems/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1257-software-systems/tests/test_outputs.py b/tasks/candidate-1257-software-systems/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..40e57e5150315791df031b9a56537d01e033a7cd --- /dev/null +++ b/tasks/candidate-1257-software-systems/tests/test_outputs.py @@ -0,0 +1,107 @@ +from __future__ import annotations + +import json +import os +import subprocess +import sys +from pathlib import Path + +import pytest + +APP = Path('/app') +SRC = APP / 'vendor/packaging/src' +sys.path.insert(0, str(SRC)) +from packaging.tags import InvalidTag, parse_tag # noqa: E402 +from packaging.utils import InvalidWheelFilename, parse_wheel_filename # noqa: E402 + +FIXTURE = json.loads((Path(__file__).parent / 'fixtures/cases.json').read_text()) + + +def load_report(): + path = APP / 'output.json' + assert path.is_file(), 'required artifact is missing' + report = json.loads(path.read_text()) + assert report['schema_version'] == 'packaging-tag-audit.v1' + assert set(report) == {'schema_version', 'direct_cases', 'wheel_cases', 'summary'} + return report + + +def test_gate_artifact_and_source_tree(): + report = load_report() + assert len(report['direct_cases']) == len(FIXTURE['direct']) + assert len(report['wheel_cases']) == len(FIXTURE['wheels']) + for rel in ('tags.py', 'utils.py', 'version.py', 'specifiers.py', 'requirements.py'): + assert (SRC / 'packaging' / rel).is_file() + assert (APP / 'run_audit.py').is_file() + + +def test_gate_source_compiles(): + result = subprocess.run( + [sys.executable, '-m', 'compileall', '-q', str(SRC / 'packaging')], + env={**os.environ, 'PYTHONPATH': str(SRC)}, + capture_output=True, + text=True, + ) + assert result.returncode == 0, result.stderr + + +def test_core_direct_independent_recompute(): + report = load_report() + by_input = {item['input']: item for item in report['direct_cases']} + for case in FIXTURE['direct']: + observed = by_input[case['tag']] + try: + actual = sorted(map(str, parse_tag(case['tag']))) + except Exception as exc: + assert case['status'] == 'error' + assert type(exc).__name__ == case['error_type'] + assert observed['status'] == 'error' + assert observed['error_type'] == case['error_type'] + else: + assert case['status'] == 'ok' + assert actual == case['tags'] + assert observed['status'] == 'ok' + assert observed['tags'] == actual + + +def test_core_wheel_independent_recompute(): + report = load_report() + by_input = {item['input']: item for item in report['wheel_cases']} + for case in FIXTURE['wheels']: + observed = by_input[case['filename']] + try: + name, version, build, tags = parse_wheel_filename( + case['filename'] + ) + except Exception as exc: + assert case['status'] == 'error' + assert type(exc).__name__ == case['error_type'] + assert observed['status'] == 'error' + assert observed['error_type'] == case['error_type'] + else: + assert case['status'] == 'ok' + assert str(name) == case['name'] + assert str(version) == case['version'] + assert list(build) == case['build'] + assert sorted(map(str, tags)) == case['tags'] + assert observed['status'] == 'ok' + assert observed['name'] == str(name) + assert observed['version'] == str(version) + assert observed['build'] == list(build) + assert observed['tags'] == case['tags'] + + +def test_edge_public_error_contract_and_summary(): + report = load_report() + with pytest.raises(InvalidTag, match='invalid interpreter'): + parse_tag('2.7.6-cp27-any') + with pytest.raises(ValueError, match='not in sorted order'): + parse_tag('py3.py2-none-any', validate_order=True) + with pytest.raises(InvalidWheelFilename, match='invalid tag component'): + parse_wheel_filename('demo_pkg-1.4-2.7.6-none-any.whl') + assert report['summary'] == { + 'direct_ok': 2, + 'direct_errors': 2, + 'wheel_ok': 2, + 'wheel_errors': 2, + } diff --git a/tasks/candidate-1271-media-games/environment/Dockerfile b/tasks/candidate-1271-media-games/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..de8d2b84b4f667c5f1b019154ff4ac9056665d9d --- /dev/null +++ b/tasks/candidate-1271-media-games/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:37034a49d0e3b9840cf385f178466f3db6777e2a656c2765c6f711b5c7894f96 diff --git a/tasks/candidate-1271-media-games/environment/setup/setup.sh b/tasks/candidate-1271-media-games/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1271-media-games/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1271-media-games/instruction.md b/tasks/candidate-1271-media-games/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..609b11c2b22e17a5a8d8ecffd490d013d4eac735 --- /dev/null +++ b/tasks/candidate-1271-media-games/instruction.md @@ -0,0 +1,59 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair Arcade's camera and batch rendering integration + +A dependency upgrade changed how window cameras and batch drawing interact. +The frozen Arcade tree in `/app/vendor/project` still uses the old integration: +camera activation writes matrices to obsolete window attributes, the default +projector does not implement the batch-camera scope protocol, and both graphics +backends bypass Arcade's buffer abstraction when binding the window matrix +block. + +Repair the existing source tree. Modify these six production modules: + +- `arcade/camera/camera_2d.py` +- `arcade/camera/default.py` +- `arcade/camera/orthographic.py` +- `arcade/camera/perspective.py` +- `arcade/gl/backends/opengl/context.py` +- `arcade/gl/backends/webgl/context.py` + +The repaired behavior must satisfy all of the following: + +1. `Camera2D.use()`, `OrthographicProjector.use()`, and + `PerspectiveProjector.use()` make themselves current, preserve their + viewport/scissor behavior, and write generated projection and view matrices + to `window.ctx.projection_matrix` and `window.ctx.view_matrix`. They must not + create or rely on legacy `window.projection` or `window.view` attributes. +2. `DefaultProjector` exposes live `projection` and `view` properties backed by + its Arcade context. It implements batch camera `begin()` and `end()` hooks as + no-ops and `get_group_scissor()` returns `None`, so a batch does not inherit + an Arcade scissor rectangle as an extra pyglet group. +3. Camera activation scopes continue to restore the previous camera, matrices, + viewport, scissor, and framebuffer state even when drawing raises an + exception. +4. Both `OpenGLArcadeContext.bind_window_block()` and + `WebGLArcadeContext.bind_window_block()` bind the Arcade-owned buffer through + `buffer.bind_to_uniform_block(binding=0, offset=0, size=128)`. Do not call a + raw backend binding API or use the underlying buffer id. +5. Keep the public API and the rest of the source tree intact. Do not replace + the six modules, modify `/app/tools/check_camera_integration.py`, or change + the camera data/projection helpers or Arcade buffer abstraction. + +After repairing the modules, run: + +```bash +python3 /app/tools/check_camera_integration.py +``` + +This must exit successfully and create `/app/repair_report.json`. The output +contract is `/app/output_contract.json`; its `output_schema_version` is +`arcade.camera-repair-report.v1`. The report must show `status: "pass"`, no +errors, all six compiled modules, context-routed state for all three camera +families, a complete default-projector protocol result, and identical recorded +uniform-buffer calls for both backends. + +The final submission is the repaired source tree plus +`/app/repair_report.json`. Runtime work must remain offline and CPU-only. diff --git a/tasks/candidate-1271-media-games/task.toml b/tasks/candidate-1271-media-games/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..73662ca0cd8136c9e98403f78b8e101100f4b4fc --- /dev/null +++ b/tasks/candidate-1271-media-games/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1271-media-games" +description = "MiMo-V2.6-RL terminal task candidate-1271-media-games" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1271-media-games" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:37034a49d0e3b9840cf385f178466f3db6777e2a656c2765c6f711b5c7894f96" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1271-media-games/tests/anti_hack_guard.py b/tasks/candidate-1271-media-games/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1271-media-games/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1271-media-games/tests/fixtures/expected.json b/tasks/candidate-1271-media-games/tests/fixtures/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cd9b6ff5df80d0b0c97679d9566006d7dd09493f --- /dev/null +++ b/tasks/candidate-1271-media-games/tests/fixtures/expected.json @@ -0,0 +1,28 @@ +{ + "schema_version": "arcade.camera-repair-report.v1", + "compiled_modules": [ + "arcade/camera/camera_2d.py", + "arcade/camera/orthographic.py", + "arcade/camera/perspective.py", + "arcade/camera/default.py", + "arcade/gl/backends/opengl/context.py", + "arcade/gl/backends/webgl/context.py" + ], + "report_camera_viewport": [11, 13, 640, 360], + "report_camera_scissor": [17, 19, 320, 180], + "base_sha256": { + "arcade/camera/camera_2d.py": "75878ad5777108667453d1385671294d250b0d004b614555394f1b93ffb06cf7", + "arcade/camera/default.py": "2a7e2f3537a64b5764228766f616e51263a83331eaeab2afd6f6d3bbc6bd03e8", + "arcade/camera/orthographic.py": "cd9b8895c22fabc09da6291b9039889d9a1fdc06ad8907b06555dc690d50a622", + "arcade/camera/perspective.py": "ecb5113d0b9c77e2de2fc2ed77459d5b84e4058f64197315f4db13e8e93e49ea", + "arcade/gl/backends/opengl/context.py": "2470825bcf5d91711980c9748baa462153ac2f79fe7357e2e8d2b6b172bc71b4", + "arcade/gl/backends/webgl/context.py": "dd18073f2278b5cafad9e15be2bf72d3a696236c91b49fb1d1303c9b142c6b2d" + }, + "immutable_sha256": { + "output_contract.json": "882592eea5f1783af8c05d5f3980b61927fecccadcbe4156f3c64393b05d5e1a", + "tools/check_camera_integration.py": "e0c2730568cdf27ca5e0cacfdd4ddad2ae25d9079e05290288cbde84eaf24682", + "vendor/project/arcade/camera/data_types.py": "5448abb1f64fa300003002d4e7ba741f399e06170f97ea69a82758fef711553e", + "vendor/project/arcade/camera/projection_functions.py": "210b50e41c343a352cfa47dc92ceee5b5e36dc9e9d0a7e70680e8790fc10a067", + "vendor/project/arcade/gl/buffer.py": "9d1849f827cc8a5bc4da919615a336906544bbcb4a86f2a77b5979264a354a25" + } +} diff --git a/tasks/candidate-1271-media-games/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1271-media-games/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..8c1a478d35703a4a5979b459358e507e48634328 --- /dev/null +++ b/tasks/candidate-1271-media-games/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,255 @@ +{ + "artifacts": [ + "repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "output_contract.json": "882592eea5f1783af8c05d5f3980b61927fecccadcbe4156f3c64393b05d5e1a", + "tools/check_camera_integration.py": "e0c2730568cdf27ca5e0cacfdd4ddad2ae25d9079e05290288cbde84eaf24682", + "vendor/project/README.md": "8691237bab1d39b6a6588b517d7ec347ae84d4e2c1c15f324cfea4d6f8c32381", + "vendor/project/arcade/__init__.py": "83eb914c7830e3e13439ffb25f97b1d491aa3ec56def292f8f13e27de9112ace", + "vendor/project/arcade/__main__.py": "bc83487cfc66a56b2e035b05dcaf3946d1a32c660f92464005b31abab3f88edf", + "vendor/project/arcade/anim/__init__.py": "f0b51c257706e4aa7b7055f186ffec4ab41cfecdcba59aab8dc1e3f09810964d", + "vendor/project/arcade/anim/easing.py": "5b0c14aaccfba1b5111f6177230763a65a92bc52897cbd37c431859153e7d13b", + "vendor/project/arcade/application.py": "b0efac623bfc9531298fbe270f4dc6860be308a743797d94d9926ecc6931bb39", + "vendor/project/arcade/cache/__init__.py": "5ea65253f700e27bfb87f132513ed531110cf284354b44fa7d2d5ed405e1274e", + "vendor/project/arcade/cache/hit_box.py": "09a95ef0d6c100c0531d8dba758580265056643176e03274f8560a3f25f34880", + "vendor/project/arcade/cache/image_data.py": "fa090def75a2575cb21ab172ef528064f5e2cd32bc89e23f186e19802a46f843", + "vendor/project/arcade/cache/texture.py": "4113b10e24b113e650a2631f48d67e776b609c828c6acd69edf3f1ef8747e2dd", + "vendor/project/arcade/camera/__init__.py": "dd00fe3272d286366d7c167a7d13e234e99a6af8df7fd22d4c8fbd16ede1cdfc", + "vendor/project/arcade/camera/camera_2d.py": "75878ad5777108667453d1385671294d250b0d004b614555394f1b93ffb06cf7", + "vendor/project/arcade/camera/data_types.py": "5448abb1f64fa300003002d4e7ba741f399e06170f97ea69a82758fef711553e", + "vendor/project/arcade/camera/default.py": "2a7e2f3537a64b5764228766f616e51263a83331eaeab2afd6f6d3bbc6bd03e8", + "vendor/project/arcade/camera/grips/__init__.py": "fa4648f1ad335d722d33fbf3bef28bfbcd5ec90ccfc60e0e55b72017335d1154", + "vendor/project/arcade/camera/grips/constrain.py": "c86f2c33cd699ef1cf0a9ccad8ea266a2936d733d8cd141ec037d0bdc0a9df5e", + "vendor/project/arcade/camera/grips/position.py": "25bf549e01a31888056393d1398effb36c0522bbcfc415ae36bee042fc1c8cb3", + "vendor/project/arcade/camera/grips/rotate.py": "29bf877f3e1ccbb919cc81a5c574131413f3341923b6b76e97c866543461a5a8", + "vendor/project/arcade/camera/grips/screen_shake_2d.py": "7347e197344ff52279a9c0c9aec6f0abaf7e58088b09f80f70b881de65266a60", + "vendor/project/arcade/camera/grips/strafe.py": "6df9a9a6c3659cb0e15b5afa8e13bc7620208e2b160b315aaf927d9a1bc16655", + "vendor/project/arcade/camera/orthographic.py": "cd9b8895c22fabc09da6291b9039889d9a1fdc06ad8907b06555dc690d50a622", + "vendor/project/arcade/camera/perspective.py": "ecb5113d0b9c77e2de2fc2ed77459d5b84e4058f64197315f4db13e8e93e49ea", + "vendor/project/arcade/camera/projection_functions.py": "210b50e41c343a352cfa47dc92ceee5b5e36dc9e9d0a7e70680e8790fc10a067", + "vendor/project/arcade/camera/static.py": "b0247d4d6efc7b5714472dcf2380969f25dffa8f5f7896e9f340a5809073e024", + "vendor/project/arcade/camera/viewport.py": "81f0610689479b1dcc63a4277395f5826b33b33e0e7d956ea39b67b4fea922aa", + "vendor/project/arcade/clock.py": "03491bd7b2f6bfdad81bcea814d74ec53fe83f1444b01bcec5983a9f1a8fffea", + "vendor/project/arcade/color/__init__.py": "be137ee7d5597fd76a97b5a2f0037c044ff4954ac9ed9eec1463b066d6de24fa", + "vendor/project/arcade/context.py": "2a419296a04cba56b310ffa87134e047f7f54bbb870ef8f15d4d27889856eb20", + "vendor/project/arcade/controller.py": "cd99c18fdfa46e446342f61e9720a237609593c3b40efc57ec34f3d0246c3f67", + "vendor/project/arcade/csscolor/__init__.py": "9477008ecac9f1c31fbb2b73ef11b98470f085ba99e12470f42b41cb67507644", + "vendor/project/arcade/draw/__init__.py": "90833d89d69228826133003dfe87138526facbc32db99c533b1aa24adaa82a25", + "vendor/project/arcade/draw/arc.py": "157f02fd989b8d98b4ae44a5d1228bbe8f8001f6491f6a64c27bf836ef34c90a", + "vendor/project/arcade/draw/circle.py": "daed7c18473bca66680e4586f0ecf58a41040296d57280af0947bbf1ae15c36c", + "vendor/project/arcade/draw/helpers.py": "c57f6d44ee8b43bd1ad64357fb05311ad774da3251d23a4cb53fd0ee7520b233", + "vendor/project/arcade/draw/line.py": "2e717481bd4782bd6ab75935fff9cdad3aa36826de45f53369b028e796d500aa", + "vendor/project/arcade/draw/parabola.py": "ba83837992345577c54574d4f515442b9ccc6104f231078c2d498f878d5ace3d", + "vendor/project/arcade/draw/point.py": "d1ea8796f61323b70bc91dfecfac9c617b623bdabdbdac384f458e10d46feb44", + "vendor/project/arcade/draw/polygon.py": "703b9c787247da44eeebeabb91ea23aa6008f38d7fd93099a89b77e0da622d5e", + "vendor/project/arcade/draw/rect.py": "99e14c44e21f3354622c01a9eacfca7293c5fc2398000110cbe9fef4bdb8736e", + "vendor/project/arcade/draw/triangle.py": "edd316fbf7ac951c995dfa23867ae32e5fbc4fcbd2d79e3ce1b4071138aafc3a", + "vendor/project/arcade/earclip.py": "6d943204f38c59a42a1d3a9858baf806541916ced6550fa198f6b190abdeadb8", + "vendor/project/arcade/exceptions.py": "b06703564372247c106604764a8d7706b67f8f6c692ba911d9653f8f5d789150", + "vendor/project/arcade/experimental/__init__.py": "c1799dacb0d56c1799d4e4313089b4550d898b73428a9632a0c534b290071a35", + "vendor/project/arcade/experimental/atlas_render_into.py": "250e5c31f8614c62d20bc49aa0c1a4777de60a93162fe55677340df9f2307920", + "vendor/project/arcade/experimental/atlas_replace_image.py": "a8b7afffb7355a3958385281023b57ad23c94253b15a4e1b78cfcfe3491c0de1", + "vendor/project/arcade/experimental/bloom_filter.py": "497370eb73401688e1119f7e6682cef2782a3d8b97a2f18da597dacfd05995d5", + "vendor/project/arcade/experimental/controller_window.py": "89599dfc4927dbd3c0bedb6a35273ff6f410f0b8949f6c0a57398d9a06ab881b", + "vendor/project/arcade/experimental/crt_filter.py": "1b541f508e5801b88f70f4e4c5cf9bb3dfd497e887be3888b2628a008307bb8c", + "vendor/project/arcade/experimental/gaussian_kernel.py": "05437f4071424a0f88e91859ebd5f89861b3c197069c5681ef9a17a052eed9af", + "vendor/project/arcade/experimental/geo_culling_check.py": "2ee17df10e6cac35132352d8b4dee05c95c3d3b88308d8124efd167215b098a8", + "vendor/project/arcade/experimental/input_manager_example.py": "510f32044c256255da3dcdd22597ffb7d9da10bb5196dd67dae0ef4ba6b669a3", + "vendor/project/arcade/experimental/perspective_parallax.py": "ac12efcaa6ebbe9cc973221c6360e20e06b005bee8a43a041d81b2b8ee23ceea", + "vendor/project/arcade/experimental/postprocessing.py": "eb1e9c96974614e4d707975f961fa23e589a0f4a86aae9a1e06f3b5286bc7a9c", + "vendor/project/arcade/experimental/profiling.py": "7ad21e352f6f04b91987feb395df5a6573991c81aaa3f04bafcde52715f91eeb", + "vendor/project/arcade/experimental/pygame_interaction.py": "53c9dcae863366239545fafedbfd371f943fedf7ea264cb405f9d21824ef2378", + "vendor/project/arcade/experimental/query_demo.py": "57b6e6d0b211fcf5decdcb86f98bd9a3ff15cde562f7dbaa70e5edc763695faa", + "vendor/project/arcade/experimental/render_offscreen_animated.py": "f4113a22f4d727ae702bb12b033d540976ea7478c5a76e97b05f49e80ba327b6", + "vendor/project/arcade/experimental/shadertoy.py": "019a26e66463dd67c7949cbf017758faa489e9d35d08665d32adfc8aba66bdf6", + "vendor/project/arcade/experimental/shadertoy_demo.py": "aaf71d62a17b838d8760e7207445eb43030ca42be05c516238f45a5c0c77bbcd", + "vendor/project/arcade/experimental/shadertoy_demo_simple.py": "a369097951366c7c02e11a6f60624f11f2c647837044eb77547e8c904a2c1536", + "vendor/project/arcade/experimental/shadertoy_textures.py": "debf9561c26f6290fa6eb65a2942d31d1a37d1f29ea8d67c8bafe8ef66a44afb", + "vendor/project/arcade/experimental/shadertoy_video_cv2.py": "170f5fe91b7355f0558df10c55fa66dc64e871b461cbbd63d400ed323d662e7c", + "vendor/project/arcade/experimental/shapes_buffered_2_glow.py": "a9d283e7b3dfa5200ad339b45bb043a86a35a8ef604e30563256f07c1923ab04", + "vendor/project/arcade/experimental/shapes_perf.py": "014cce45c9fd1813f66075dc91e839f20a135065da7034dd3c2fd7bc7e1f0a38", + "vendor/project/arcade/experimental/star_nest.glsl": "dddc0d8afdb2cd775f8442a273d3491e6981715539c463df823d10e05a042d6c", + "vendor/project/arcade/experimental/texture_transforms.py": "dc216dc7b83db3104a5aa145bd846266b5ff08dce5d2bd073e3adee4e80e9ff4", + "vendor/project/arcade/future/__init__.py": "3c7e6210d632b179fe365d126e13bb1b7a9c6c78a8754ee00d6c66633aef69fe", + "vendor/project/arcade/future/background/__init__.py": "82d33ff016f2d5aea30a135647ba22ed3600e60d6b9c2cadf52ca94364f5995f", + "vendor/project/arcade/future/background/background.py": "aadf84e473f40193efc304824fae7b9dc161e485041c70f23720e996e22f342a", + "vendor/project/arcade/future/background/background_texture.py": "dab2ddfc3b90b71dacb8ee56dfe1e0391c3a70e3cf71c5c79cf4186adcae4014", + "vendor/project/arcade/future/background/groups.py": "3ab6be0ddbe2c5dd3a8063e2583a2264fdfafa88c14b3f6ed1bea6c2f4c4859c", + "vendor/project/arcade/future/light/__init__.py": "ca37126fb23b4bced8789635c338c456a9b1cf9bf864c1c16c92cff230218a7b", + "vendor/project/arcade/future/light/light_demo.py": "1df521270432aa8b2f5f7d3dd2c85fed5c465e342e9abb1b5b2b9bbc50ea0fbb", + "vendor/project/arcade/future/light/light_demo_perf.py": "5fd83cbc4c54647b51b417c8c36c76e92d8c79e7b9eca8bcb2e639841b07bd03", + "vendor/project/arcade/future/light/lights.py": "7b1c58dac662464c4718749c5cf3111ffe9f53a4f402635938cf6ff9f253260f", + "vendor/project/arcade/future/splash.py": "5bb82bbac03ee9afb6331b241074984f1f025e8e89474b0dfed33ba16b0e9560", + "vendor/project/arcade/future/sub_clock.py": "93ced605b8a841ad1745a329c211364c3d9245e33529a4247485e7fc352849a8", + "vendor/project/arcade/future/texture_render_target.py": "b6481daf8a9046f8b8a791dd5d4473574bac1bce5d22ab1226ea41b3c8c5800a", + "vendor/project/arcade/future/video/__init__.py": "df546af31fbc9244ca73f11821fd1be833588344bbbca616893f532aa10f2fed", + "vendor/project/arcade/future/video/video_cv2.py": "ab2ad4a0a83082c5258b2101dd454abf7655b0d03968cd1a864a4068ea31b7ee", + "vendor/project/arcade/future/video/video_player.py": "68e7861f40c238551d770770b7d617fc269e01052abb9eed35076dc68f948309", + "vendor/project/arcade/future/video/video_record_cv2.py": "19d5a4f06244b1db57ff7ff2b13665d96bf6bdf558c3fac218212311715faea4", + "vendor/project/arcade/geometry.py": "01a76d814d64bef44443331e42325416b54bac4459ccfb5502efdadd421562fd", + "vendor/project/arcade/gl/__init__.py": "af8c93b542cc6e5514985289acb631aadbab5f6b2c39726c17dc27186dcc6f7e", + "vendor/project/arcade/gl/backends/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/project/arcade/gl/backends/opengl/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/project/arcade/gl/backends/opengl/buffer.py": "c62bfb087f58a430093b9250913f047dcd2e86a080b1ab40ba1b3007036e3827", + "vendor/project/arcade/gl/backends/opengl/compute_shader.py": "458b373a788c648bbc72915a51f1960dcfe9cbedbd53081c3b1ea776c5e8e1e6", + "vendor/project/arcade/gl/backends/opengl/context.py": "2470825bcf5d91711980c9748baa462153ac2f79fe7357e2e8d2b6b172bc71b4", + "vendor/project/arcade/gl/backends/opengl/framebuffer.py": "e872cc66344f3773b4754e2baa493270735e398921a6ce9073458542f30a1f68", + "vendor/project/arcade/gl/backends/opengl/glsl.py": "251c57127c18c6000d7ab7cdf22dfae64fafcf95c977f11ea6f4947dab16bb0c", + "vendor/project/arcade/gl/backends/opengl/program.py": "77aadf012f5642f6c7ce2a321fedfeacf3533ded0b74de255dacfeedef08a9bd", + "vendor/project/arcade/gl/backends/opengl/provider.py": "3d0ec3b7e9d2c3b369e3c270e8d5a4878b1bc4f0da5dd155b3456def2d130f7c", + "vendor/project/arcade/gl/backends/opengl/query.py": "3d08b82bc9a0c71223aee314b9689adac16a609e9bd439447bfc2300275758d5", + "vendor/project/arcade/gl/backends/opengl/sampler.py": "ce988f1eba0a43e4b11bdec06ae8f4cfdc9a4dc5a2cf482ac6baa6ba0fd37864", + "vendor/project/arcade/gl/backends/opengl/texture.py": "126f2fd6ef228e62e0783827920839b96f81bdedae4093dd1daad6cb658bf7e0", + "vendor/project/arcade/gl/backends/opengl/texture_array.py": "ac0df0c4ae448a2b9270481ef1ad561590a2afd1d377bf2b74b176dbfcffa979", + "vendor/project/arcade/gl/backends/opengl/uniform.py": "5a7ed82f91e48250b6095be15b8ddd2c6a32c0cb94778887e22eb0b32d7040d6", + "vendor/project/arcade/gl/backends/opengl/utils.py": "a0f7fd81ff544b61bd0dbe3cde71a33d021118c4aee98bbd9cb4c9e97462e1cc", + "vendor/project/arcade/gl/backends/opengl/vertex_array.py": "398f64386a4596e2855e7daea56a352597543e802b937c4698bb8c10707bf106", + "vendor/project/arcade/gl/backends/webgl/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/project/arcade/gl/backends/webgl/buffer.py": "a0ee6d72a851f897c3d1c764a08b12db399bed0b170a3a317fe027165acd2922", + "vendor/project/arcade/gl/backends/webgl/context.py": "dd18073f2278b5cafad9e15be2bf72d3a696236c91b49fb1d1303c9b142c6b2d", + "vendor/project/arcade/gl/backends/webgl/framebuffer.py": "819e66224117a5059107c58a5cfa3da0b6d62cad156ac6c2fe18421bf275c8a8", + "vendor/project/arcade/gl/backends/webgl/glsl.py": "61c33478d2162e240a1b27dcdca7b51fbaad18f281ab2b77fcfe8609400b135d", + "vendor/project/arcade/gl/backends/webgl/program.py": "a26f5fa009d20299c240d6de0e4d5e5336003990fd2a0ba7d1e7f82e417d8278", + "vendor/project/arcade/gl/backends/webgl/provider.py": "7e1922add90eaa20d8b864821750309f93b18ac594fac436cf8ff2a609795648", + "vendor/project/arcade/gl/backends/webgl/query.py": "01de30c1d4fba4cd13546e2dfabf5d26e8313c347ee162e39db81d3978fed762", + "vendor/project/arcade/gl/backends/webgl/sampler.py": "72942455fa2322848cd431bfb2858c549409a672a9a3d0968ec16f8f5202aad3", + "vendor/project/arcade/gl/backends/webgl/texture.py": "29fa3fad3906c8ca592e2f18fee4f75d54e8548a1215f989bedea858c28e326a", + "vendor/project/arcade/gl/backends/webgl/texture_array.py": "a00a836d742c2999b88259bcd866619980d0d925fa2de506721146dbd2be7ed5", + "vendor/project/arcade/gl/backends/webgl/uniform.py": "b023631fa61d265ccb472e9ac631128bcdeef62362c6a18ded5bd76aacbbf771", + "vendor/project/arcade/gl/backends/webgl/utils.py": "9220cc7b4c72180dcc66cf019afb907c00a1514d39e31f7cb88b80e2b79ce8a3", + "vendor/project/arcade/gl/backends/webgl/vertex_array.py": "b32ff07acb169c623ac834a14746f8854ca654b05f9ca09fc70e794b3a1e24c4", + "vendor/project/arcade/gl/buffer.py": "9d1849f827cc8a5bc4da919615a336906544bbcb4a86f2a77b5979264a354a25", + "vendor/project/arcade/gl/compute_shader.py": "154b1b047122aac6e3f0753d6ed5e626fdce8346e8ad9fe57ef47defd470c6e3", + "vendor/project/arcade/gl/context.py": "5f11dc19d67f38ba1652dce015c7f6f9938051ab8aa373549f312d470a26f741", + "vendor/project/arcade/gl/enums.py": "32e4a12903e282b26f74888003c5d24ab514deaa1c25580ecabb11aaefca8243", + "vendor/project/arcade/gl/exceptions.py": "0bb0b6e4056ddf77c1e23bd3fd04c80d8e1fc1e31d4dd66d64cb8efd2215e120", + "vendor/project/arcade/gl/framebuffer.py": "ceb7842cadd38d45d024d7e334af1bae9c2fbea03ac02588f1a1de69a624cd76", + "vendor/project/arcade/gl/geometry.py": "4bdeec67228c4bd9e06e80a375cb75375219dc94b264328d2b95798e016a45b7", + "vendor/project/arcade/gl/program.py": "d98652087ec2bec32c1971dc3fb17f9befdedab57e816f5f4ec2ee7ec5af4ed2", + "vendor/project/arcade/gl/provider.py": "121ab346d83c856c19173609881b10abf6f5e261cbcdcfbf54970e5a953b9db2", + "vendor/project/arcade/gl/query.py": "c907c844471eccd7d0fd52fc47548f51f93095e3fbbdbb845e3645bf7c222f48", + "vendor/project/arcade/gl/sampler.py": "1e93d349a425f8ada7794b9e714ceae19ca6ee7111d31fea2ef2f65c431e4732", + "vendor/project/arcade/gl/texture.py": "dc29f1f4f3adbe8c666305591820f0faa82a43a164e1a81c145fa8e9544f4c3d", + "vendor/project/arcade/gl/texture_array.py": "7b5e82179e329e8f48ae96e264c4029ebe12ca0a1adc1558a9de699ff07219d8", + "vendor/project/arcade/gl/types.py": "9da5c0ea5960ef46ba302807bb922ddde46ffff16ea1378562e19234400e0d6a", + "vendor/project/arcade/gl/vertex_array.py": "a91553bc11b733f34619f7802718ccf6d109ae0357f0c9be6f53c462fa45b1db", + "vendor/project/arcade/gui/__init__.py": "d078ca7c564ae2cf2fe72c7cf4987c5b23e02a4922bda9b76822373b29ff21c0", + "vendor/project/arcade/gui/constructs.py": "deb107d83e7f3d4d4bfdcb68acb3cbbeafef263f3ad994408a5883a29da19bed", + "vendor/project/arcade/gui/events.py": "4edf5e63d5b041b175fa11886c95da8aff8cd9b59bd8de6e0cd462d183ed74d1", + "vendor/project/arcade/gui/experimental/__init__.py": "4ac92d3a1dffb801677f0f1d04d08d0d3e1f49156538b10a4971d88901b34069", + "vendor/project/arcade/gui/experimental/animate.py": "f607c3d14c867eee1cdc4026e75aa1c4cc7b55c0fca2f29442a0d43aa6e27233", + "vendor/project/arcade/gui/experimental/focus.py": "286e8c9e5ea9b102cd2ee852b1a38c19f81864451529e48926d2346f2297875f", + "vendor/project/arcade/gui/experimental/group.py": "19b74f961fb5feafdf89217cca63d894702eed91e27d92afe5d1255dde740c68", + "vendor/project/arcade/gui/experimental/password_input.py": "0527a2ed05781af8301a204066f181e86cc4bc2ce148ab8171d1f75a4f875b57", + "vendor/project/arcade/gui/experimental/restricted_input.py": "26b284c7d26e53d8c1527267933c9d41575d236f562171af2d5ba6cff6dccebe", + "vendor/project/arcade/gui/experimental/scroll_area.py": "7c32f2a41c3c1e82747e4f72b8d1af82647a1ccf7928009fdbab863d5ad25725", + "vendor/project/arcade/gui/experimental/transition.py": "b4ea5534759b6006eeab9d3115dda3d27e0ad4b67bf1a1034a232492a7eda5ff", + "vendor/project/arcade/gui/experimental/typed_text_input.py": "fa0729f4d03c3552bafe010a475e4c04f3269898bd355dde83e387e0ef9f5bed", + "vendor/project/arcade/gui/mixins.py": "eaaa8c33dfbf452001b2115828e9b3dc32b0b5b8230887617d5cfe1ba8783caa", + "vendor/project/arcade/gui/nine_patch.py": "447158336768b46d40f1e3e4dd7d64aae929e5f18259af7dd6e234c333b4222c", + "vendor/project/arcade/gui/property.py": "6a158f1825772eaf050c2ab7e03dbe59d2df0ed1e8c0821444ca6a7ebbb871ec", + "vendor/project/arcade/gui/style.py": "0938d087745d19e7c941ef4e47867d79b19ed22441067859a390b6c3be856e1e", + "vendor/project/arcade/gui/surface.py": "e9f16864412ffa25103ba23a1e3679d95369523fa8965db9f5783f9dddad5c13", + "vendor/project/arcade/gui/ui_manager.py": "428842164988b7352bc95ab0910dfdafa6c6d8ac519efe3ce9aa359258ff7164", + "vendor/project/arcade/gui/view.py": "e0e5024ac2dc6f67b455a9450472f59fdc4519db48b36982f4c3c557f6bc8eb9", + "vendor/project/arcade/gui/widgets/__init__.py": "5f195cd718ccf16d454677c23cd344fb55f93b468c0af11f0142a36b390e5417", + "vendor/project/arcade/gui/widgets/buttons.py": "7349a4d5b4175b7c121e036b3c453ac1b4e248b812e4e3a31b666ebe5ae64cb2", + "vendor/project/arcade/gui/widgets/dropdown.py": "663b1d13633691cc839a7d93806fa434b696749f998e6ad29a08f15c400d5375", + "vendor/project/arcade/gui/widgets/image.py": "4ea450d50c387f5b120a15c90fb134c14b8f91b6dcf70c70bf37a535059c914f", + "vendor/project/arcade/gui/widgets/layout.py": "24effd242de3dbc7e328207c9043ec12c50e3187f481a013028f7a5d461df9dd", + "vendor/project/arcade/gui/widgets/slider.py": "b8a5a2511e9b8f2f36a78ae97a87ae95ba7b23f445cbc37d4088d2d0bb23d1ca", + "vendor/project/arcade/gui/widgets/text.py": "4ac2bc5d8895ca0b9b1caa644bafe4a6b58eda4a9afbc4f9f2359c01f1ca1b46", + "vendor/project/arcade/gui/widgets/toggle.py": "1dbf1c06686e33775cfa7c7e139443ba3fddfa657c20b2f96875815e780b2e64", + "vendor/project/arcade/hexagon.py": "ce34ac7600ec9a50c206fb9f69411cad2608a9a665b568b3b096e9abf7ccbf9c", + "vendor/project/arcade/hitbox/__init__.py": "1a8d6830b9a48ace63471e2ebf9760fd6d1e6cf34aaa3b09b1dd0a9e05d3fd95", + "vendor/project/arcade/hitbox/base.py": "8df96c1714f931ec4cc45471b1d8b5d2435a55782d0aa8831811f40d42eb48c6", + "vendor/project/arcade/hitbox/bounding_box.py": "51603c72227964b47fa45e90aa4befe82564f731bcc66ae52e8e223b2ddf7be8", + "vendor/project/arcade/hitbox/pymunk.py": "aaa6d234c7676fe1e416994012d6b15d48e8739d677681b816cddc3bffa67f81", + "vendor/project/arcade/hitbox/simple.py": "cbd648a8e28604a0a92ae28bc4695533386af9bef466124a8a0715b97b8050e4", + "vendor/project/arcade/input/README.md": "5cd5424b88d4aa93512965ae904c514acf9d6e9b69ac2fcf4f2b946cd37f9a08", + "vendor/project/arcade/input/__init__.py": "f92d3f380d13576bd1934de6ecba898395cfc888e80c8bb689791df6b9a6a17e", + "vendor/project/arcade/input/input_mapping.py": "f277d7c045bf90fd700158f7563b4358547be2b3f0b40b144f25fd7ae9ce0343", + "vendor/project/arcade/input/inputs.py": "815c9b9eb1ad2a14de5db086288d84ea029d300350bba0e931334460fb145c5f", + "vendor/project/arcade/input/manager.py": "ee696d7f65d0a3b1a9732bca5deac2cef3c28e74832bd4d5c8eebddef88acf72", + "vendor/project/arcade/input/raw_dicts.py": "12e798f3e01aa907ad4dbc3e050b8a5c9286f56121666f9b3373d721a44e3f69", + "vendor/project/arcade/isometric.py": "bef065d6bcdd4778762975e46c1a212230e33dc88bd2dcf0225bcda4c3579104", + "vendor/project/arcade/joysticks.py": "af44f983a29928ab3a3ff42a555388ec55a558fad6122712123e5c6a878678d0", + "vendor/project/arcade/key/__init__.py": "370d21c3906e63f7a87a807979bc243e98c125f066af5f09701579c44ac43b87", + "vendor/project/arcade/math.py": "a48cabcc41ebe08eff23fd3e1b1e4c125fb0b87bba00e3c757adb494c98f9aa7", + "vendor/project/arcade/particles/__init__.py": "9c36fc2dbd30c5f824e9ca2567542bde0616ef45363a31865c0afeb5581c0dac", + "vendor/project/arcade/particles/emitter.py": "b547c984db4431dc5cc240d061c620e76a9c136555ecca01a731f248eaf3fae1", + "vendor/project/arcade/particles/emitter_simple.py": "be3259ee1217624d438f6762e9b11c288938bae5bb66201edfa7587e1f2d4b88", + "vendor/project/arcade/particles/particle.py": "14a25a4f0d8a0b40141e4a85ef6633bcbd89cb1336a4cc04e7a468f9d45ff7c6", + "vendor/project/arcade/paths.py": "80d74c2dce3002f548909785da67a6159475b467ccda860efe3fb28230e440b4", + "vendor/project/arcade/perf_graph.py": "4e727f1e61410141c905643a0ce7b7d17fa090178eeae04c18b5cca56934217c", + "vendor/project/arcade/perf_info.py": "05f954736c75e8ee90873cd7a2314e58a5d61793a9642b52f42861662f6c40b5", + "vendor/project/arcade/physics_engines.py": "d68fdc819bfed448e1b92d3455cc802c2935112f4ec03ff62b6d94db1de79891", + "vendor/project/arcade/pymunk_physics_engine.py": "e351e762ea61d0a53f7dadb01ee07ee0995586fc61aa77af36df910f9bb5053c", + "vendor/project/arcade/scene.py": "d04d270742a68795de416aef329eaded839ad2b6de29789b8d501a6a2aff7cce", + "vendor/project/arcade/screenshot.py": "a6d04af9f0d3791fa6a8c0bfc90762684a8cb1304ab76b02c1f48c04da000293", + "vendor/project/arcade/sections.py": "ceb00f7499b7b850ca97dc93a7310dfe14b558d1ae7083b60f6275e12d5f01dc", + "vendor/project/arcade/shape_list.py": "13fae49e036357a4829caaa021887b72792d15d229b3d2bdd305c52906c72ab3", + "vendor/project/arcade/sound.py": "68cdb8131dae3a5d10b82bfd2609c355a285a3cdb9fd987500875baedb658783", + "vendor/project/arcade/sprite/__init__.py": "8f470d422d00e5801ce733c9c443e16f510b3d5e34f77f53f674c79ea97ed050", + "vendor/project/arcade/sprite/animated.py": "dc75b118178f35f7c16e94e86d71e63a058f2556ab12e25ae52f316167f24243", + "vendor/project/arcade/sprite/base.py": "6146cf410dba3f2fd98b93f39849e3128ce0394eff9b3aae4352d9080203b88c", + "vendor/project/arcade/sprite/colored.py": "1b014512d0f1fba8fe3e23d6b5765f322811fa4acf1a844377211b54ed328770", + "vendor/project/arcade/sprite/enums.py": "cd7f1aa47af129dc38cac9355a0d94e93d0263e79db81557789070080058e2c1", + "vendor/project/arcade/sprite/mixins.py": "fe5105135734ad00c20a31ed995ff9440a6c09f9f91fabd30d88d56586ddc3f8", + "vendor/project/arcade/sprite/sprite.py": "b5fd0afee9000886fb435f8aa4388d220f6dd484c5c939de735c004f83cfdd05", + "vendor/project/arcade/sprite_list/__init__.py": "fcbbf5d0b1f0e24c9deb278bdfb3c228ca15c93e7617bf06925c2e1d1062e1d7", + "vendor/project/arcade/sprite_list/collision.py": "8142d9fad46a408f8fa341a5d5274570374e705d9db4bba107b09f1716e25f2a", + "vendor/project/arcade/sprite_list/spatial_hash.py": "e0b36a15c5cd8c22dc4d81bcd736c391ca3031f749851d359019880aaa2f67b0", + "vendor/project/arcade/sprite_list/sprite_list.py": "c29849ef67f186c84f3b5a8b2c14f47622838018d02fc793a1ab37a76e013d26", + "vendor/project/arcade/start_finish_data.py": "6f72e2b4a83c05b8f753410d20cea40d7720360b083ef89fd45b8826d792a208", + "vendor/project/arcade/text.py": "c99f5d2b556cd78ce2aeb75a873da3098b7e6ab5cf17959d4ece112948e75666", + "vendor/project/arcade/texture/__init__.py": "9dd55a11c6209716443acd2ee3300ff730dc275932d758343a1de0349067d69e", + "vendor/project/arcade/texture/generate.py": "19f2ce73d9b33ce6abb9f2e0f0c75448c2ab8d031c19a509c0b4632ff13e40e3", + "vendor/project/arcade/texture/loading.py": "0fab90dad90cb57ab21b9073def9b42701f72e7d01c081ea45dd0d17c1d397f1", + "vendor/project/arcade/texture/manager.py": "7bcb57c64595a48a01fc6509cca7711461661fca77029a44b23d41dd8dd0f6b6", + "vendor/project/arcade/texture/spritesheet.py": "8e16fce9c86acd415bb0f6111bd257dee6131b35a51a3d3f5e142e9976b814e7", + "vendor/project/arcade/texture/texture.py": "7ec9f3daee965d7f77c3392bb125db1362a93ab5b37b86b1e0ca64fd992f6829", + "vendor/project/arcade/texture/tools.py": "08774782f05acdc8fab97ea7d8f295bae11206386ce268753a277b0554a0e431", + "vendor/project/arcade/texture/transforms.py": "e5fda86a85453cd02920abcf882f306719f4f82737daa865eb8a1ce8bcf6f396", + "vendor/project/arcade/texture_atlas/__init__.py": "5d46bbabdd596a3b62557675734b39b69765b7a914c64f2d070ce26c7f7dff29", + "vendor/project/arcade/texture_atlas/atlas_array.py": "235da5a5cce2a1fef98ec477c1e37b4be17d6f3bed36410388fdcee9234958dc", + "vendor/project/arcade/texture_atlas/atlas_bindless.py": "c5e4e0322e2e8d1952b5bf4988bcbefc3fd8a3c656230d4dea46a1d42eda5665", + "vendor/project/arcade/texture_atlas/atlas_default.py": "6dbe51dab94b49f7187e07e2519c8995ab79b2880da5ee77651d348603da5939", + "vendor/project/arcade/texture_atlas/base.py": "4e82b326c6faf6c830117e176ebf4f55169dc09a8c027bd013c9c5cb91973932", + "vendor/project/arcade/texture_atlas/ref_counters.py": "31d3007b9458b9ef283e1b5d87dfea5dd622ac36aca3647765b4a27218a9297b", + "vendor/project/arcade/texture_atlas/region.py": "03aba1589cc5a62c85da4517142b9c964f2b907bc840ee616477558a56162376", + "vendor/project/arcade/texture_atlas/uv_data.py": "60b61f7ef21d9406d7dd3e6ef179dd7baef490427212f06fa4dbd1107ea213b8", + "vendor/project/arcade/tilemap/__init__.py": "f1b38b6c6f2f53766cb543ac2855b71fa3317920efb1fe17919196a2ff62973a", + "vendor/project/arcade/tilemap/tilemap.py": "574869fdaa607bca21926179ed89e10aa38f8dcda149ee30b5c04cc85b146579", + "vendor/project/arcade/types/__init__.py": "e9f4326dc5171cdbbbbad9d27831ca78eb21d783473e2faa607e3de37b766844", + "vendor/project/arcade/types/box.py": "fd2bea1459417a2b13e2eb903004a6a2f459ec6f2376066b9a3cb94484de3244", + "vendor/project/arcade/types/color.py": "972950b98a3c3b55422c8a84ab2e4b7da0728130661bbf1d7bd4c0dc57630bc6", + "vendor/project/arcade/types/numbers.py": "1dfa2278f0f8963a4c85f587902e38053793e2ab16f238ddde4e93927c3248f2", + "vendor/project/arcade/types/rect.py": "f23a895c46c759d4d9355c4a1851bba862360ce4bb272dbbefa27e7a3f515617", + "vendor/project/arcade/types/vector_like.py": "1c495b4f9475b2894897a43f4222e73b1753edc975c417360bfbea52bb48072d", + "vendor/project/arcade/uicolor.py": "456868fc6de37a05552f6dd94db846736862b9043f956265feb1b44ded09b5df", + "vendor/project/arcade/utils.py": "cc9537d96c7f6752d1af3de0e6dc2887d8d4f935ac6ac4902ad6a1c3895f003d", + "vendor/project/arcade/version.py": "59f6d50292f5c1cf1d9ca0b46a3c11243937eaeac349357109539c540c843cb4", + "vendor/project/arcade/window_commands.py": "ee076ccd605f1f93422d4cdfdf9a3357b29e10f08599abb873c8acacfec65abb", + "vendor/project/license.rst": "9713d1f2b74f9c4af4f674dabe76053970cbd0065e8377bbcae10c4b27c70e4a", + "vendor/project/pyproject.toml": "b207089c1c905a10dd3b5287f1af358e592507bd54570e1fb73577800fc3b3ef", + "vendor/project/tests/unit/camera/test_camera2d.py": "80c0422a53c0bc4cdc6b02f43a27585a65174aa8866866104a1ae29bf50fb26f", + "vendor/project/tests/unit/camera/test_camera_controller_methods.py": "9797c79c9d977b4b4794da94df4cf07adbb5ccb87d05478396b8c6e44d8514de", + "vendor/project/tests/unit/camera/test_camera_shake.py": "00ca24936a59faf05e0e33815d4c47ee6bf988103f0a99768974317ba970aa35", + "vendor/project/tests/unit/camera/test_orthographic_projector.py": "d43dc466d0dbef0d7f82fdf6eb58e35c14d0a279aa39edc9bc9415b9b7e6a18f", + "vendor/project/tests/unit/camera/test_perspective_projector.py": "54a770be0a3b4a16ae0d955e26af697c1e57abb743fa006bf72ad3e6787ee0ae", + "vendor/project/tests/unit/camera/test_viewport_projector.py": "3720053104d45ddac6d0fa51cc1970d15c976b4fe9795cb9c48da283027ae4da" + }, + "mutable": [ + "vendor/project/arcade/camera/camera_2d.py", + "vendor/project/arcade/camera/default.py", + "vendor/project/arcade/camera/orthographic.py", + "vendor/project/arcade/camera/perspective.py", + "vendor/project/arcade/gl/backends/opengl/context.py", + "vendor/project/arcade/gl/backends/webgl/context.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1271-media-games/tests/task_test.sh b/tasks/candidate-1271-media-games/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e375e642a3f0afad8255d0d14898f9a447004975 --- /dev/null +++ b/tasks/candidate-1271-media-games/tests/task_test.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -u +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +set +e +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e + +if [ ! -s /logs/verifier/ctrf.json ]; then + echo "pytest did not produce CTRF output" >&2 + exit 2 +fi + +if [ "$status" -eq 0 ]; then + echo 1 > /logs/verifier/reward.txt +else + echo 0 > /logs/verifier/reward.txt +fi + +exit 0 diff --git a/tasks/candidate-1271-media-games/tests/test.sh b/tasks/candidate-1271-media-games/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1271-media-games/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1271-media-games/tests/test_outputs.py b/tasks/candidate-1271-media-games/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..5fd7146ee938acf74fcbb29e3441440380e43087 --- /dev/null +++ b/tasks/candidate-1271-media-games/tests/test_outputs.py @@ -0,0 +1,244 @@ +from __future__ import annotations + +import ast +import copy +import hashlib +import json +import os +from contextlib import contextmanager +from pathlib import Path +from types import SimpleNamespace + + +APP = Path(os.environ.get("APP_ROOT", "/app")) +PROJECT = APP / "vendor" / "project" +TESTS = Path(os.environ.get("TESTS_ROOT", "/tests")) +EXPECTED = json.loads((TESTS / "fixtures" / "expected.json").read_text()) + +CAMERAS = { + "camera_2d": ("arcade/camera/camera_2d.py", "Camera2D", "orthographic"), + "orthographic": ("arcade/camera/orthographic.py", "OrthographicProjector", "orthographic"), + "perspective": ("arcade/camera/perspective.py", "PerspectiveProjector", "perspective"), +} + + +class Rect: + def __init__(self, *values): + self.lbwh_int = tuple(values) + + +class BufferRecorder: + def __init__(self): + self.calls = [] + + def bind_to_uniform_block(self, **kwargs): + self.calls.append(kwargs) + + +class ForbiddenRawBackend: + def __getattr__(self, name): + raise AssertionError(f"raw backend API was used: {name}") + + +def extracted_method(relative, class_name, method_name, globals_=None): + path = PROJECT / relative + tree = ast.parse(path.read_text(), filename=str(path)) + class_node = next( + node for node in tree.body if isinstance(node, ast.ClassDef) and node.name == class_name + ) + original = next( + node + for node in class_node.body + if isinstance(node, ast.FunctionDef) and node.name == method_name + ) + node = copy.deepcopy(original) + node.decorator_list = [] + node.returns = None + for arg in (*node.args.posonlyargs, *node.args.args, *node.args.kwonlyargs): + arg.annotation = None + namespace = dict(globals_ or {}) + module = ast.fix_missing_locations(ast.Module(body=[node], type_ignores=[])) + exec(compile(module, str(path), "exec"), namespace) + return namespace[method_name] + + +def run_camera_case(name): + relative, class_name, projection_kind = CAMERAS[name] + use = extracted_method( + relative, + class_name, + "use", + { + "generate_orthographic_matrix": lambda data, zoom: f"projection:{projection_kind}", + "generate_perspective_matrix": lambda data, zoom: f"projection:{projection_kind}", + "generate_view_matrix": lambda data: f"view:{name}", + }, + ) + ctx = SimpleNamespace( + viewport=(0, 0, 0, 0), + scissor=None, + projection_matrix="old-projection", + view_matrix="old-view", + ) + window = SimpleNamespace(ctx=ctx, current_camera="old-camera") + camera = SimpleNamespace( + _window=window, + render_target=None, + projection_data=object(), + view_data=object(), + zoom=1.0, + _projection=object(), + _view=SimpleNamespace(zoom=1.0), + _viewport=Rect(2, 4, 800, 450), + viewport=Rect(2, 4, 800, 450), + scissor=Rect(10, 20, 400, 225), + ) + use(camera) + return window, camera + + +def recompute_report_surfaces(): + camera_state = {} + for name in CAMERAS: + window, camera = run_camera_case(name) + camera_state[name] = { + "projection": window.ctx.projection_matrix, + "view": window.ctx.view_matrix, + "viewport": list(window.ctx.viewport), + "scissor": list(window.ctx.scissor), + "current_camera_updated": window.current_camera is camera, + "legacy_window_matrix_writes": hasattr(window, "projection") + or hasattr(window, "view"), + } + + backend_bindings = {} + for backend, class_name in ( + ("opengl", "OpenGLArcadeContext"), + ("webgl", "WebGLArcadeContext"), + ): + bind = extracted_method( + f"arcade/gl/backends/{backend}/context.py", class_name, "bind_window_block" + ) + recorder = BufferRecorder() + context = SimpleNamespace( + _window_block=SimpleNamespace(buffer=recorder), _gl=ForbiddenRawBackend() + ) + bind(context) + backend_bindings[backend] = {"calls": recorder.calls} + return camera_state, backend_bindings + + +def test_gate_artifact_schema_and_source_tree(): + report = json.loads((APP / "repair_report.json").read_text()) + contract = json.loads((APP / "output_contract.json").read_text()) + assert set(report) == { + "schema_version", + "status", + "compiled_modules", + "camera_state", + "default_projector", + "backend_bindings", + "errors", + } + assert report["schema_version"] == "arcade.camera-repair-report.v1" + assert EXPECTED["schema_version"] == "arcade.camera-repair-report.v1" + assert contract["output_schema_version"] == report["schema_version"] + assert contract["artifact"] == "/app/repair_report.json" + assert report["status"] == "pass" and report["errors"] == [] + assert report["compiled_modules"] == EXPECTED["compiled_modules"] + for relative, base_hash in EXPECTED["base_sha256"].items(): + path = PROJECT / relative + assert path.is_file() and path.stat().st_size > 100 + assert hashlib.sha256(path.read_bytes()).hexdigest() != base_hash + compile(path.read_text(), relative, "exec") + for relative, expected_hash in EXPECTED["immutable_sha256"].items(): + path = APP / relative + assert path.is_file() + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected_hash + + +def test_core_camera_context_routing(): + for name, (_, _, projection_kind) in CAMERAS.items(): + window, camera = run_camera_case(name) + assert window.current_camera is camera + assert window.ctx.projection_matrix == f"projection:{projection_kind}" + assert window.ctx.view_matrix == f"view:{name}" + assert window.ctx.viewport == (2, 4, 800, 450) + assert window.ctx.scissor == (10, 20, 400, 225) + assert not hasattr(window, "projection") and not hasattr(window, "view") + + +def test_core_default_batch_protocol(): + ctx = SimpleNamespace( + projection_matrix="projection-A", view_matrix="view-A", scissor=(1, 2, 3, 4) + ) + projector = SimpleNamespace(_ctx=ctx) + projection = extracted_method("arcade/camera/default.py", "DefaultProjector", "projection") + view = extracted_method("arcade/camera/default.py", "DefaultProjector", "view") + begin = extracted_method("arcade/camera/default.py", "DefaultProjector", "begin") + end = extracted_method("arcade/camera/default.py", "DefaultProjector", "end") + group_scissor = extracted_method( + "arcade/camera/default.py", "DefaultProjector", "get_group_scissor" + ) + assert projection(projector) == "projection-A" + assert view(projector) == "view-A" + ctx.projection_matrix, ctx.view_matrix = "projection-B", "view-B" + assert projection(projector) == "projection-B" and view(projector) == "view-B" + assert begin(projector) is None and end(projector) is None + assert group_scissor(projector) is None + + +def test_core_backend_buffer_abstraction(): + _, bindings = recompute_report_surfaces() + expected_call = {"binding": 0, "offset": 0, "size": 128} + assert bindings["opengl"]["calls"] == [expected_call] + assert bindings["webgl"]["calls"] == [expected_call] + assert bindings["opengl"] == bindings["webgl"] + + +def test_edge_activation_restores_state_and_report_is_recomputed(): + ctx = SimpleNamespace( + current_camera="previous-camera", + view_matrix="previous-view", + projection_matrix="previous-projection", + scissor=(1, 3, 5, 7), + viewport=(2, 4, 640, 360), + ) + previous = dict(vars(ctx)) + + def use_active(): + ctx.current_camera = projector + ctx.view_matrix = "active-view" + ctx.projection_matrix = "active-projection" + ctx.scissor = None + ctx.viewport = (0, 0, 100, 100) + + projector = SimpleNamespace(_ctx=ctx, use=use_active) + activate_generator = extracted_method( + "arcade/camera/default.py", "DefaultProjector", "activate" + ) + try: + with contextmanager(activate_generator)(projector): + assert ctx.current_camera is projector + raise RuntimeError("simulated draw failure") + except RuntimeError: + pass + assert vars(ctx) == previous + + report = json.loads((APP / "repair_report.json").read_text()) + camera_state, backend_bindings = recompute_report_surfaces() + for name, values in camera_state.items(): + assert report["camera_state"][name]["projection"] == values["projection"] + assert report["camera_state"][name]["view"] == values["view"] + assert report["camera_state"][name]["viewport"] == EXPECTED["report_camera_viewport"] + assert report["camera_state"][name]["scissor"] == EXPECTED["report_camera_scissor"] + assert report["camera_state"][name]["current_camera_updated"] is True + assert report["camera_state"][name]["legacy_window_matrix_writes"] is False + assert report["default_projector"] == { + "projection": "default-projection", + "view": "default-view", + "begin_return": None, + "end_return": None, + "group_scissor": None, + } + assert report["backend_bindings"] == backend_bindings diff --git a/tasks/candidate-1305-software-data-engineering/environment/Dockerfile b/tasks/candidate-1305-software-data-engineering/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..568bc6c75742109769103099456e5252a21ac5ff --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6af5f2e49a663c7fce492eb4d3e5d1d08fd3f004bb4e7608586504a072d4de9c diff --git a/tasks/candidate-1305-software-data-engineering/environment/setup/setup.sh b/tasks/candidate-1305-software-data-engineering/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1305-software-data-engineering/instruction.md b/tasks/candidate-1305-software-data-engineering/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9907454a4ea31f0692f9145f4e6cbb79230aae56 --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/instruction.md @@ -0,0 +1,48 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +You are repairing the vendored petl ETL library in `/app/vendor/project`. + +The frozen source has a cross-module fluent-API regression: some `Table` view +classes store constructor options in instance attributes named `cache`, +`complement`, `index`, or `skip`. Those names are inherited operations on table +containers, so composed pipelines can fail with `TypeError` when a fluent +operation is called. Correct the existing source modules; do not replace the +library with a new evaluator or a one-off script. + +Requirements: + +1. Preserve the public fluent operations and their function-form equivalents. + A view created with `cache`, `complement`, `index`, or `skip` options must + still apply those options during lazy iteration and materialisation. +2. Cover every affected view family in the vendored tree, including hash joins, + sorting, row/field selection, regex search, basic field operations, + materialisation, and the optional Avro and bcolz readers. Keep optional + backends import-safe; do not install or download their dependencies. +3. Preserve exact headers, row values, duplicate-key join rows, ordering, and + the meaning of false/true option values. Do not eagerly consume a source + merely to make a method callable. +4. Exercise a composed pipeline from `fixtures/pipeline.json` and write + `/app/repair_report.json` with this exact schema: + +```json +{ + "schema_version": "petl-repair-report.v1", + "output_schema_version": "petl-repair-report.v1", + "source_tree": "vendor/project", + "modules_repaired": ["petl/..."], + "joined_rows": [[...]], + "complement_rows": [[...]], + "sorted_rows": [[...]], + "regex_rows": [[...]], + "index_position": 0, + "method_checks": {"cache": true, "complement": true, "index": true, "skip": true} +} +``` + +`modules_repaired` must name the existing source modules you actually changed. +The rows must come from running petl, not from hardcoded expected output. The +report must be valid JSON and written at the absolute path above. You may use +standard-library tooling and the vendored package only; leave the fixture +unchanged. diff --git a/tasks/candidate-1305-software-data-engineering/task.toml b/tasks/candidate-1305-software-data-engineering/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ed38f7fdb47ba3da30d233f3ce4e86f682725388 --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1305-software-data-engineering" +description = "MiMo-V2.6-RL terminal task candidate-1305-software-data-engineering" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1305-software-data-engineering" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6af5f2e49a663c7fce492eb4d3e5d1d08fd3f004bb4e7608586504a072d4de9c" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1305-software-data-engineering/tests/anti_hack_guard.py b/tasks/candidate-1305-software-data-engineering/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1305-software-data-engineering/tests/fixtures/base_hashes.json b/tasks/candidate-1305-software-data-engineering/tests/fixtures/base_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..883671aec7c1f90a208d100ff41af5497b122a6b --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/fixtures/base_hashes.json @@ -0,0 +1,10 @@ +{ + "petl/io/avro.py": "22bf288b24756edaba41b4e65f86225658d50565fe822f48bb5a549d16ac2cfb", + "petl/io/bcolz.py": "3fd08b5074048cb95c0e2664df316a6ad4441073412e7d4e55d9d31738775ff6", + "petl/transform/basics.py": "c6568f5957cd99951cde713dae31b69a2c5a369320d8af6ab18d5240836f9ff3", + "petl/transform/hashjoins.py": "d3d67b18f8bc142bfb47f7508305ecf2ba81b2bd2494f669a05913df567f7fda", + "petl/transform/regex.py": "2bc5d1ca46f4c46caee7f64754cda58186eec1c531b0ce1cc0771d600fccf86c", + "petl/transform/selects.py": "f7d6e9ec1c6f2a155368bd5d6062866b127489d4f4a03e3de0838b3c095830be", + "petl/transform/sorts.py": "45c9058d5eeefcb589ca14f0a70cd8d351e55aec11b418f24367a20010f2d833", + "petl/util/materialise.py": "45849d9929fb08f3d15a4e00bf4bc1d1d1e12f054a7f2461f3da88a099902762" +} diff --git a/tasks/candidate-1305-software-data-engineering/tests/fixtures/pipeline.json b/tasks/candidate-1305-software-data-engineering/tests/fixtures/pipeline.json new file mode 100644 index 0000000000000000000000000000000000000000..166f6faf121b9c7afb0fd63c2808aab852faadd3 --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/fixtures/pipeline.json @@ -0,0 +1,7 @@ +{ + "left": [["id", "team", "score", "text"], [1, "A", 8, "alpha"], [2, "B", 3, "beta"], [3, "A", 7, "gamma"], [4, "C", 5, "delta"], [5, "B", 9, "epsilon"]], + "right": [["id", "label"], [1, "one"], [1, "uno"], [3, "three"], [5, "five"], [6, "six"]], + "exclude_ids": [3], + "regex": "^u", + "skip_regex_rows": 1 +} diff --git a/tasks/candidate-1305-software-data-engineering/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1305-software-data-engineering/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..063aa86b1699a276694a3501ad027f53aa619811 --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,154 @@ +{ + "artifacts": [ + "repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "fixtures/pipeline.json": "11f886f5ecda75645bf1973cfecc6c7974d3f8679ca4bbb6b38958ec8dc005a1", + "vendor/project/LICENSE.txt": "229ce990bc98e631baf741926f7f237f303f8bc2166742ab5f0f406eb76f0162", + "vendor/project/petl/__init__.py": "e86a2a7e6848609ea4fd3d3fb00c8d8c59a968a920a9cdf5e25f95f07dc632ba", + "vendor/project/petl/comparison.py": "91b4b449fbcffe242f07af593b9d2bd0850852580dbcfadd978fbff219b2a6e3", + "vendor/project/petl/compat.py": "22b8e7c74f150f60f30db5c5144f23ea846360e9823d31723cd7462bfdc5c353", + "vendor/project/petl/config.py": "5f08e3ccf5c1016f9579ec1db02f8091b92bc21c77cf30919afa198e1cbe5f46", + "vendor/project/petl/errors.py": "ea62cba5b647a7f3670afb5f097502bfd65a27c7f0d6990e30f259c73666b411", + "vendor/project/petl/io/__init__.py": "461beee51c7437852097f6bd659e0635f2427f00c106a5b1044a4b84aa3ae1c0", + "vendor/project/petl/io/avro.py": "22bf288b24756edaba41b4e65f86225658d50565fe822f48bb5a549d16ac2cfb", + "vendor/project/petl/io/base.py": "105ab4feced4951d974c39e69ca3b12088e2c7dc515ddcc92bba6e521f68a0ae", + "vendor/project/petl/io/bcolz.py": "3fd08b5074048cb95c0e2664df316a6ad4441073412e7d4e55d9d31738775ff6", + "vendor/project/petl/io/csv.py": "41a236d11aa17a6c88232576ff150cb21b50f8a616345978c371302b42fc8e6f", + "vendor/project/petl/io/csv_py2.py": "3cdb941a590dad86b14bd4087a5298577ea06705e53481d9aba31c57c4569af6", + "vendor/project/petl/io/csv_py3.py": "779e341e54f3db81c7ef9294bec54fe2e9555f1b9a8ba5ed8d80a6ceace00375", + "vendor/project/petl/io/db.py": "5039984a738b1cb0ff8332dd982e45c7322a6017c3f402d4ebac4d534ef1c312", + "vendor/project/petl/io/db_create.py": "d489c19eaac062b7010900d2c1696ebf355fe1927c4d3c392c3785aaf502f460", + "vendor/project/petl/io/db_utils.py": "e2e5115e50fe0257f1be3a84eb8adbf9874d398274b20d0724b5a36122d1bf51", + "vendor/project/petl/io/gsheet.py": "83ecb1494ad6cb5e62851b924ba9394c28c86b329f5857edc50653df18a2ed42", + "vendor/project/petl/io/html.py": "5c60d5930e9bc6c8793c9f1e4d5c1f2f363d3f06b0664759af76ebd6794fc5af", + "vendor/project/petl/io/json.py": "a5b433902bcc972d71d72201d970f39310908a9cd3d9d2fdd5cb0d0e76b12ca6", + "vendor/project/petl/io/numpy.py": "b16a588f06290d8daa4ecc46696b1df6641fd6d07be49673d9b124b92a0cb48f", + "vendor/project/petl/io/pandas.py": "645876d06e259b40582812ae255b414e3da959df880ae84d119da850e54c5315", + "vendor/project/petl/io/pickle.py": "00e8ce8b678dee734c86ebfd848b585fca3100a8462da6090634feebc6a66164", + "vendor/project/petl/io/pytables.py": "8465eb869f94ecfa50078697616c426147025324077eb0beb0fd17431daf2012", + "vendor/project/petl/io/remotes.py": "72e2a64b6b5aff419dfefaf5c5b983174c7859d83773681d07a91f509f60695b", + "vendor/project/petl/io/sources.py": "ef40a98159428fee4220255524e7ed656c893de2dacf17285b08b892852f6788", + "vendor/project/petl/io/text.py": "db98827c906972735880445f9995d9860ccab77cef40b5d3cc6a5dfe92f9a8dc", + "vendor/project/petl/io/whoosh.py": "bf86ae43412e07ed6a6d539894ba4cb675fb0c24bfd8086c8cf952dc3e959a58", + "vendor/project/petl/io/xls.py": "fa73c2150a3e4fa0850fd4536267a5974738be1ca0e1a15d06c5531099d1f95b", + "vendor/project/petl/io/xlsx.py": "8bad13e82154ec670b8d71c3d93e33b641d3fa569d2f567bbe400177e5d91690", + "vendor/project/petl/io/xlutils_view.py": "ff5cfda4263414e6421c23407d829799b24fc419652ccb38275e40bcef1483b9", + "vendor/project/petl/io/xml.py": "99e371906f4c8110cd3eb06f00f7fc9f9b550310b326534841ce0bacf5bf62d3", + "vendor/project/petl/test/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/project/petl/test/conftest.py": "1f0fec5821f7a9076bc6ae525c5bb7db9dd2141b30a2e2995b94e06f110556e0", + "vendor/project/petl/test/failonerror.py": "fc878a521661cfd10c64a34b26e683ba6e9afc5fdd90b4a779895b98f4e39bdf", + "vendor/project/petl/test/helpers.py": "493ae8ca36f0d9edf6ba0631ff242e2231b3998f8f672c873d91daf7b5f94091", + "vendor/project/petl/test/io/__init__.py": "b409d7b2819b6d184e08ba2f6d0dbe32130f4716255b5230ffc4db36ab529688", + "vendor/project/petl/test/io/test_avro.py": "9d612ca566956444eff2100ae2206399e0c878118a987d9ef788fcf0168bdd1f", + "vendor/project/petl/test/io/test_avro_schemas.py": "ac563e3464dd4b2d032487957bd225b431b250ba2799571dd1ea0d79bd458df0", + "vendor/project/petl/test/io/test_bcolz.py": "622d11718541b9794d29bee517d7bb59d1838fde3ab704230dced3b7c93f7a27", + "vendor/project/petl/test/io/test_csv.py": "efa75dc02f4e09ac01b6a0ab96bb07db957adc67ecf3dca18950aeaba33793b6", + "vendor/project/petl/test/io/test_csv_unicode.py": "2ab286b9e0a233640e1e788d89e0f6712627b2ea05bd795b7aa195bc72806e9a", + "vendor/project/petl/test/io/test_db.py": "38c3716afad806ea41d2dcf13ab556cb47260c0b4850b9714a0f978efadbf732", + "vendor/project/petl/test/io/test_db_create.py": "ac03466b4d2faf82631d36815b61876273ad8a392d16b45e68af2e5b07120cd4", + "vendor/project/petl/test/io/test_db_inference.py": "bc3f2b5bf277db2680b5736e88b20dbecc17a01ff72c1c619a41f1a373b131e3", + "vendor/project/petl/test/io/test_db_server.py": "fe06a9bada1804d4f0a46480b8e379091b0acfcc9e8b614337a5c3a37d91ddff", + "vendor/project/petl/test/io/test_gsheet.py": "83268aa5dbadb996196f054e9332e73309a39361b8914bd260fe85f50cd1f73b", + "vendor/project/petl/test/io/test_html.py": "c8884066d53ea81f46a0889371a408cdb5f5c284ea06fc5a6a24ad0972691ee9", + "vendor/project/petl/test/io/test_html_unicode.py": "f1b5fad185da409042af417ac5be1724054a2bb34d170d3b2de56c06fce4d829", + "vendor/project/petl/test/io/test_json.py": "c2987bd970fe0b534aee4853e1579c224fd8fe983d8cbddbf805caea250d7859", + "vendor/project/petl/test/io/test_json_unicode.py": "cfd436a73f527317d4afd2969f1b072b79e7d06521086c55e6ebfe2947d5adcf", + "vendor/project/petl/test/io/test_jsonl.py": "c8f19d00edebf5577e103aca4dbaf2387da5635e9c8ac21b17491117f0a2a049", + "vendor/project/petl/test/io/test_numpy.py": "39cab1514585420b4be1110b8b5ea5fa7ad6c72484b2ae60016c4be4a0d8bdb5", + "vendor/project/petl/test/io/test_pandas.py": "8bfd9fc3e52af29492b2afc6a2112d61fc1fe0209fb76b41ed9659946940623c", + "vendor/project/petl/test/io/test_pickle.py": "86e2a01bd5d72403033f67246a671e81bd0971e4f93d681f2d6927290ee2078c", + "vendor/project/petl/test/io/test_pytables.py": "70b411ba711037d32de7a28fc74de0fdf09713c09240aebee3f18c9e34c2f36f", + "vendor/project/petl/test/io/test_remotes.py": "8ae399844d49d1e6de90f942514a14a0edede8847e4cdf6c3569cb32b878ee83", + "vendor/project/petl/test/io/test_sources.py": "a61891b1508e7f673bfcdc682f51f7d49bce974634ab43950cab0b47c547f675", + "vendor/project/petl/test/io/test_sqlite3.py": "788708e999a3f8ec42483a4f0402f1170df41e5f21b32737d47d74fe9506e43d", + "vendor/project/petl/test/io/test_tees.py": "0d7968009eb684d4a67f2e57e87eacfeacef1ab39c33e36d8fc944ad2bd37ea9", + "vendor/project/petl/test/io/test_text.py": "3ae6361710d97cecb293c502539be295b3b240b575024cfcb6721175f59341f9", + "vendor/project/petl/test/io/test_text_unicode.py": "9a541cf3b31245eb33936d5a87a663db3476f6156b407a7e4a5376c3afeb1947", + "vendor/project/petl/test/io/test_whoosh.py": "5594f579363533e01165b7d612d237de4f6c4b09c982f09f8c71a2b4442b956a", + "vendor/project/petl/test/io/test_xls.py": "094cce80a43d9914133a1b5dd55eafed66c1fb8c1fdb1eafaccfc9749700e8b2", + "vendor/project/petl/test/io/test_xlsx.py": "ecc87d1fac9fc3a687ea786de31d056cdf30d9e820cfb7b1e84c3a79b76979c2", + "vendor/project/petl/test/io/test_xml.py": "ee4646b075baa1f92a60dc9d09a289cf13988cede7627c748269fd735133d70f", + "vendor/project/petl/test/resources/test.xls": "ce2b34cfb7764bca30c315c06c80427d10a30fd962161c84ec10b79a02dd7dd1", + "vendor/project/petl/test/resources/test.xlsx": "608dfeff0c7013ee3493960b107ee616d7a3b5766a3142af4cfaac1e9d071976", + "vendor/project/petl/test/resources/test.xml": "59e7ea8fa325794aa281d2e6a4577158d5c1e664d79d3813d63cfab3c43365b5", + "vendor/project/petl/test/test_comparison.py": "2c3c7e9f5e0852255f2b2e3687d2cd162004a1022efba01e45ec7e9055817ac4", + "vendor/project/petl/test/test_fluent.py": "f56159d1eb27e567035fea73b47c256f704c66f951dc851c4a4e04719afb38f6", + "vendor/project/petl/test/test_helpers.py": "778503e2f58a43803f604061144d7538c2543dfc3b6e620d162e68f1c2379b63", + "vendor/project/petl/test/test_interactive.py": "bd545630a10173242a6fe3cd2c8f54eecfd1c941fddb22c3c6f968038dbb167f", + "vendor/project/petl/test/test_method_shadow.py": "1848c67eb7739449b38b39bb117bf71776c3884493f195d342f789042e441f11", + "vendor/project/petl/test/transform/__init__.py": "b409d7b2819b6d184e08ba2f6d0dbe32130f4716255b5230ffc4db36ab529688", + "vendor/project/petl/test/transform/test_basics.py": "5c8c5e2251ec4251e7ab44e3f17d93659bc1b7e923bd953fbdf759261c9dde5e", + "vendor/project/petl/test/transform/test_conversions.py": "ce57294a13bb54e40d617c52ef355d7bacff2b96c34325500d68a9188f69f2a2", + "vendor/project/petl/test/transform/test_dedup.py": "927f6a0d5fc14a730e3a62ba3e8c91d6b0292387b28f92b5c960355f9ed9aba4", + "vendor/project/petl/test/transform/test_fills.py": "e4c52a45febdd972b238ce42422987cd286d68287bc97981c1e5e0317526f3e7", + "vendor/project/petl/test/transform/test_headers.py": "ea6146061b44f7c83311922ef9de962e18de097a7624fb30c22e1d0894433b5e", + "vendor/project/petl/test/transform/test_intervals.py": "60ef858c8b82b0d084f99d8155084152ab250a5c060e9a4a9281c3ccc7c2f27d", + "vendor/project/petl/test/transform/test_joins.py": "3e2ff1547900c3ff2c35368bab3375c5129e3a4cbcd83c9791e423e084844dea", + "vendor/project/petl/test/transform/test_maps.py": "da1527dba1b7b3315602d3ea811efae19f1bae66e3c1c3d4cd01cd9a7c87a020", + "vendor/project/petl/test/transform/test_reductions.py": "8226dfb26ebd41f39209b80f487a386b1bc84c53fd45e26450b3517534157c83", + "vendor/project/petl/test/transform/test_regex.py": "741e3de173252ec97858441b2f0ea5f18dcf6869617ab676da75ddbe73213107", + "vendor/project/petl/test/transform/test_reshape.py": "940fe2d0a43b279196f060019340429000668e158541da314839b3404ad7b0f1", + "vendor/project/petl/test/transform/test_selects.py": "960af707d2ff128c7a0a921112dfb7c0797cbe0d475162654db1e6f7abef0623", + "vendor/project/petl/test/transform/test_setops.py": "d26ee9642081a65324f704a310b098c618521ea68cd1cc45af8932fd5ac55064", + "vendor/project/petl/test/transform/test_sorts.py": "2b9216f029dcb1215da9ecf4c41e8e8af9e614fa30154ee9d0406c8fd675cc1f", + "vendor/project/petl/test/transform/test_unpacks.py": "7c9369360825f771bcb48a289d76d0249c15952578dd009f503f1f94c69668d9", + "vendor/project/petl/test/transform/test_validation.py": "4dbff0a0b5902b44cb5304131ff722cf4bc8be48d8dfa6012c1c4c34f773aae5", + "vendor/project/petl/test/util/__init__.py": "4137243893d1da9b9fb877034fbcf41a43dee67e38def7f22b5115cee2a71913", + "vendor/project/petl/test/util/test_base.py": "a531b4da8176e07780034b52cbef0bd9e154f828ace2d53b71d7b9de34bcaed6", + "vendor/project/petl/test/util/test_counting.py": "e41b08dc9034981afcdb37f40b313c5f02b7a82ce2849b90cf8ab7f34ab1c2f5", + "vendor/project/petl/test/util/test_lookups.py": "c4cfea17b9c6d5fa248f7f06e9810bf835a878b2b2a8bacc0b9c567a39f326fd", + "vendor/project/petl/test/util/test_materialise.py": "3c8de6010748cbf2a9d4f0de447293a490eb3659c82ca40ffb33dca72d8cf589", + "vendor/project/petl/test/util/test_misc.py": "0795853a84bbdbef13295722231795c05323fa17575bca34ef9781adf968a0b6", + "vendor/project/petl/test/util/test_parsers.py": "67a0f5322c6d679661814bc8e8137d464b9401062123755c98039aa3df8ede29", + "vendor/project/petl/test/util/test_random.py": "00f856e4b7c14c33945fcfb8be669b5a9294e29a0a26875e9a687fb824fb0d6e", + "vendor/project/petl/test/util/test_statistics.py": "a07527bbacc7f4eb02b17de11e9f1e0e0b19ff4b27ad87c0a9b21b007fc30b6b", + "vendor/project/petl/test/util/test_timing.py": "eaacfc65433f77271ee56abca072305d9d9717e833e20fb5549cb8002043b1b1", + "vendor/project/petl/test/util/test_vis.py": "1f5d1ba402000c16968bd033ae0311b3658e580aa2a790f13224199690c767ee", + "vendor/project/petl/transform/__init__.py": "0283aed158196edead2f30fa2151a983294ca92d2993a31fa728ab141f6e85ac", + "vendor/project/petl/transform/basics.py": "c6568f5957cd99951cde713dae31b69a2c5a369320d8af6ab18d5240836f9ff3", + "vendor/project/petl/transform/conversions.py": "8b89190c12de678b1cd86205d99aec90bcaa5c45005da116e19e6ccfed626ded", + "vendor/project/petl/transform/dedup.py": "32585f1cc73864baa0b4443b1172949a1da12da9a2a03747d79cc450bc68a10c", + "vendor/project/petl/transform/fills.py": "85c53c4aab37805fb39f0834e2bf96cde8362888a837e135b402d9b63f0aacfc", + "vendor/project/petl/transform/hashjoins.py": "d3d67b18f8bc142bfb47f7508305ecf2ba81b2bd2494f669a05913df567f7fda", + "vendor/project/petl/transform/headers.py": "4d468d16028b08edce4627b0c43b9ce6997a8e1872c0586828e0bb37c55ebc95", + "vendor/project/petl/transform/intervals.py": "8da053e0262f4596e07889fc237f182b1e45dbc74c0c5b3cc8f58cfbbfc30f28", + "vendor/project/petl/transform/joins.py": "065bda794d575d48eb1b7fd14ef1bdfedc6467b575a2364c1d55a52784237dd0", + "vendor/project/petl/transform/maps.py": "18014a9ddbfb78d3bb0acb3b32a10b3d493146b11e37821ef30596ca63ea25a8", + "vendor/project/petl/transform/reductions.py": "563b78faa011491d83a2b295faa1fdd5aaf108e4acfd80f8cd2d2192e8f6c699", + "vendor/project/petl/transform/regex.py": "2bc5d1ca46f4c46caee7f64754cda58186eec1c531b0ce1cc0771d600fccf86c", + "vendor/project/petl/transform/reshape.py": "01138dcc88b478262fbd97a00bd7c08415dd582a28d2bb08a79d3d6748de80b6", + "vendor/project/petl/transform/selects.py": "f7d6e9ec1c6f2a155368bd5d6062866b127489d4f4a03e3de0838b3c095830be", + "vendor/project/petl/transform/setops.py": "71e8c5a4ae225ea28f364bb09b6590fabd88c7d86e2d7e7c5debe35ef7c67bed", + "vendor/project/petl/transform/sorts.py": "45c9058d5eeefcb589ca14f0a70cd8d351e55aec11b418f24367a20010f2d833", + "vendor/project/petl/transform/unpacks.py": "198ab9519bde9b783d520e77640818e2c7207f8a19cef8ebd87951497c23be75", + "vendor/project/petl/transform/validation.py": "5d6940a374d5e58a9bf9f7943712d3e1d9de686000491dca5502fd8b3da45566", + "vendor/project/petl/util/__init__.py": "2ec41e5e7761192f701cca40fd3aae321f13b13b32dbcf7e9523a4f774896cf7", + "vendor/project/petl/util/base.py": "a444b8a07943b52f6cac155d9d280d79fdf611f0c33b10e7f9ffa232b7ab37a2", + "vendor/project/petl/util/counting.py": "5426f3ac00e26eda7709b9b781bdd9b2e667a2b3c827d66d6c5fddd70a00dc6a", + "vendor/project/petl/util/lookups.py": "56217a6ee9e1ea676ece69a6971cfbdae16a530491bb9f2d92f97134c5d273a9", + "vendor/project/petl/util/materialise.py": "45849d9929fb08f3d15a4e00bf4bc1d1d1e12f054a7f2461f3da88a099902762", + "vendor/project/petl/util/misc.py": "4c5807fcee5016b0e6ee2f22ce5051109d51746b501b3ba1a34120f7c4d5db96", + "vendor/project/petl/util/parsers.py": "87d259ea226a97404063c46cf8977028517e57f9a7505c61f331bfcdf66fbd17", + "vendor/project/petl/util/random.py": "227e351f57e333e549e21b1a97fce48f04eb9726ac4fd2b65e34065bf43420ec", + "vendor/project/petl/util/statistics.py": "2bf45bed9647ac8174f2cb80b8eb01145aee5e041941c00a88fac3964f19016e", + "vendor/project/petl/util/timing.py": "46f19f128510d6d00f3101af3a2d5c5c63439106d330d2ae634c6466c32a4ae3", + "vendor/project/petl/util/vis.py": "4ec1b23fbd5164aa18d3449db64836d3d388a12f88c5ce0d716d35d1301e4b0c", + "vendor/project/petl/version.py": "cf2aae3d11d9fd2a98f3aaeb73a997e212298d592e3add876c02b8b37b8fa7bd", + "vendor/project/pyproject.toml": "8e780909621cc0ca57276f828accd6cc54b7e107c0a4d1eff5b7046efc5cf2b6", + "vendor/project/setup.py": "5ca32459812e2ee50aa4d9f860a74dd2d248fe9667dec19dac246be4a2c876d7" + }, + "mutable": [ + "vendor/project/petl/io/avro.py", + "vendor/project/petl/io/bcolz.py", + "vendor/project/petl/transform/basics.py", + "vendor/project/petl/transform/hashjoins.py", + "vendor/project/petl/transform/regex.py", + "vendor/project/petl/transform/selects.py", + "vendor/project/petl/transform/sorts.py", + "vendor/project/petl/util/materialise.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1305-software-data-engineering/tests/task_test.sh b/tasks/candidate-1305-software-data-engineering/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a42b7039594775ed1c814097a0c61dd8a7b55eda --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/task_test.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -u +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +rc=$? +set -e +if [ "$rc" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit "$rc" diff --git a/tasks/candidate-1305-software-data-engineering/tests/test.sh b/tasks/candidate-1305-software-data-engineering/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1305-software-data-engineering/tests/test_outputs.py b/tasks/candidate-1305-software-data-engineering/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..65508b7630779b17a601f1f89bdee7bb239976cc --- /dev/null +++ b/tasks/candidate-1305-software-data-engineering/tests/test_outputs.py @@ -0,0 +1,167 @@ +import ast +import hashlib +import json +import os +import subprocess +import sys +from functools import lru_cache +from pathlib import Path + + +APP = Path('/app') +PACKAGE = APP / 'vendor' / 'project' +FIXTURE = json.loads((Path('/tests/fixtures/pipeline.json')).read_text()) +MODULES = { + 'petl/io/avro.py', 'petl/io/bcolz.py', 'petl/transform/basics.py', + 'petl/transform/hashjoins.py', 'petl/transform/regex.py', + 'petl/transform/selects.py', 'petl/transform/sorts.py', + 'petl/util/materialise.py', +} + + +def _expected_join(): + left, right = FIXTURE['left'], FIXTURE['right'] + lh, rh = left[0], right[0] + li, ri = lh.index('id'), rh.index('id') + out_h = [f'L_{x}' for x in lh] + [f'R_{x}' for i, x in enumerate(rh) if i != ri] + rows = [out_h] + lookup = {} + for row in right[1:]: + lookup.setdefault(row[ri], []).append(row) + for row in left[1:]: + for match in lookup.get(row[li], []): + rows.append([f for f in row] + [v for i, v in enumerate(match) if i != ri]) + return rows + + +def _expected_stages(): + joined = _expected_join() + selected = [joined[0]] + [r for r in joined[1:] if r[2] >= 5] + excluded = [r for r in selected[1:] if r[0] != 3] + ordered = [selected[0]] + sorted(selected[1:], key=lambda r: r[0], reverse=True) + regex_data = [r for r in ordered[1:] if not r[-1].startswith(FIXTURE['regex'].lstrip('^'))] + return joined, [selected[0]] + excluded, ordered, regex_data + + +@lru_cache(maxsize=1) +def _petl_stages(): + script = r''' +import json +import petl as etl +from pathlib import Path +f = json.loads(Path('/tests/fixtures/pipeline.json').read_text()) +left, right = f['left'], f['right'] +j = etl.hashjoin(left, right, key='id', cache=True, lprefix='L_', rprefix='R_') +joined = list(j.cache(n=64)) +s = etl.select(j, 'L_score', lambda value: value >= 5) +exclude = [joined[0], [3, 'A', 7, 'gamma', 'three']] +complement = list(s.complement(exclude, cache=False)) +sv = etl.sort(s, key='L_id', reverse=True, cache=False) +ordered = list(sv.cache(n=64)) +rv = etl.search(sv, 'R_label', f['regex'], complement=True) +regex_rows = list(rv.skip(f['skip_regex_rows'])) +added = etl.addfield(sv, 'marker', lambda row: 'ok', index=0) +print(json.dumps({'joined': joined, 'complement': complement, 'ordered': ordered, + 'regex': regex_rows, 'index': added.index(('marker', 'L_id', 'L_team', 'L_score', 'L_text', 'R_label'))})) +''' + env = dict(os.environ, PYTHONPATH='/app/vendor/project') + proc = subprocess.run([sys.executable, '-c', script], env=env, + capture_output=True, text=True, timeout=45) + assert proc.returncode == 0, proc.stderr + return json.loads(proc.stdout) + + +def test_gate_report_schema_and_required_modules(): + report_path = APP / 'repair_report.json' + assert report_path.is_file() + report = json.loads(report_path.read_text()) + assert report['schema_version'] == 'petl-repair-report.v1' + assert report['output_schema_version'] == 'petl-repair-report.v1' + assert report['source_tree'] == 'vendor/project' + assert set(report['modules_repaired']) == MODULES + assert report['method_checks'] == {'cache': True, 'complement': True, 'index': True, 'skip': True} + for rel in MODULES: + assert (PACKAGE / rel).is_file() + + +def test_gate_all_mutable_modules_changed_from_pristine(): + baseline = json.loads((Path('/tests/fixtures/base_hashes.json')).read_text()) + for rel, expected in baseline.items(): + digest = hashlib.sha256((PACKAGE / rel).read_bytes()).hexdigest() + assert digest != expected, rel + + +def test_core_fluent_pipeline_and_duplicate_join_rows(): + got = _petl_stages() + expected_joined, expected_complement, expected_ordered, expected_regex = _expected_stages() + assert got['joined'] == expected_joined + assert got['joined'][0] == ['L_id', 'L_team', 'L_score', 'L_text', 'R_label'] + assert sum(1 for row in got['joined'] if row and row[0] == 1) == 2 + assert got['complement'] == expected_complement + assert got['ordered'] == expected_ordered + + +def test_core_independent_regex_skip_and_index_recompute(): + got = _petl_stages() + _, _, ordered, expected_regex = _expected_stages() + assert got['regex'] == expected_regex + assert got['regex'] == [ordered[1], ordered[2], ordered[3]] + assert got['index'] == 0 + assert all(len(row) == 5 for row in got['ordered']) + + +def test_core_constructor_options_remain_semantically_active(): + script = r''' +import petl as etl +rows = [['id', 'value'], [1, 'a'], [2, 'b']] +h = etl.hashjoin(rows, [['id', 'label'], [1, 'x']], key='id', cache=False) +s = etl.sort(rows, key='id', cache=False) +assert h._cache is False +assert s._cache is False +sel = etl.select(rows, 'id', lambda value: value == 1, complement=True) +assert list(sel) == [('id', 'value'), (2, 'b')] +''' + env = dict(os.environ, PYTHONPATH='/app/vendor/project') + proc = subprocess.run([sys.executable, '-c', script], env=env, + capture_output=True, text=True, timeout=45) + assert proc.returncode == 0, proc.stderr + + +def test_core_ast_collision_scan_covers_source_tree(): + blocked = {'cache', 'complement', 'index', 'skip'} + collisions = [] + for rel in MODULES: + path = PACKAGE / rel + tree = ast.parse(path.read_text(), filename=str(path)) + for node in ast.walk(tree): + target = getattr(node, 'targets', []) + if isinstance(node, ast.AnnAssign): + target = [node.target] + for item in target: + if (isinstance(item, ast.Attribute) and isinstance(item.value, ast.Name) + and item.value.id == 'self' and item.attr in blocked): + collisions.append(f'{path}:{node.lineno}: self.{item.attr}') + assert not collisions, '\n'.join(collisions) + + +def test_edge_optional_readers_keep_skip_semantics_without_imports(): + script = r''' +from petl.io.avro import AvroView +from petl.io.bcolz import BcolzView +class Fake: + names = ('id', 'value') + def iter(self, outcols=None, skip=0, limit=None): + rows = [(1, 'a'), (2, 'b'), (3, 'c')][skip:] + yield from rows[:limit] + def where(self, expression, outcols=None, skip=0, limit=None): + yield from self.iter(outcols, skip, limit) +b = BcolzView(Fake(), skip=1) +assert callable(b.skip) +assert list(b) == [('id', 'value'), (2, 'b'), (3, 'c')] +a = AvroView(None, limit=None, skips=2) +assert callable(a.skip) and a._skip == 2 +''' + env = dict(os.environ, PYTHONPATH='/app/vendor/project') + proc = subprocess.run([sys.executable, '-c', script], env=env, + capture_output=True, text=True, timeout=45) + assert proc.returncode == 0, proc.stderr diff --git a/tasks/candidate-1399-security-reverse-engineering/environment/Dockerfile b/tasks/candidate-1399-security-reverse-engineering/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4d089caf90934ec43527413af22b0202820c780e --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:04f742598087c75a634ddf50808e42bb441f18d7a9af3072834626435e40e315 diff --git a/tasks/candidate-1399-security-reverse-engineering/environment/setup/setup.sh b/tasks/candidate-1399-security-reverse-engineering/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1399-security-reverse-engineering/instruction.md b/tasks/candidate-1399-security-reverse-engineering/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..51efefbbbfa3c5ee9605b2d1d4b0f48cbeaf2bc4 --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/instruction.md @@ -0,0 +1,21 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair cross-backend address semantics + +You are working in a frozen reverse-engineering feature extractor. Repair the existing source tree, not by replacing it with a new evaluator or modifying the regression runner. + +The three backend file extractors receive virtual addresses from their analysis APIs. File-scope ASCII and UTF-16 strings must retain those values as `AbsoluteVirtualAddress`; they must not be relabeled as file offsets merely because downstream code also supports file offsets. + +Embedded PE detection is different: when a backend can prove a byte-to-file mapping, emit `FileOffsetAddress`. Ghidra can report an unmapped address with `-1`; in that case emit the embedded feature at the original `AbsoluteVirtualAddress` instead of dropping it. Preserve the existing Binary Ninja and IDA mapped-offset behavior and keep feature values unchanged. + +Work in `vendor/capa/features/extractors/{ghidra,ida,binja}/file.py`. Then run: + +```sh +python3 tools/run_regression.py +``` + +The command executes the existing extractor functions against deterministic backend doubles whose virtual addresses deliberately differ from file offsets. It must produce `/app/output.json` with `output_schema_version` equal to `capa-address-regression.v1`, two string observations per backend, all four mapped/unmapped embedded-PE cases, and a compatibility section. Preserve the detected feature values and exact backend-provided coordinates. + +Do not install packages, use the network, edit `tools/run_regression.py`, or add a replacement extractor. The verifier protects the rest of the frozen project and independently executes the repaired functions with its own fixtures. diff --git a/tasks/candidate-1399-security-reverse-engineering/task.toml b/tasks/candidate-1399-security-reverse-engineering/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c9432b24bb769808ba957c6639307d3f058a953d --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1399-security-reverse-engineering" +description = "MiMo-V2.6-RL terminal task candidate-1399-security-reverse-engineering" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1399-security-reverse-engineering" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:04f742598087c75a634ddf50808e42bb441f18d7a9af3072834626435e40e315" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/anti_hack_guard.py b/tasks/candidate-1399-security-reverse-engineering/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/expected_schema.json b/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/expected_schema.json new file mode 100644 index 0000000000000000000000000000000000000000..6a08d882d8378194d8b8b8f2a0f74eee39f02ae7 --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/expected_schema.json @@ -0,0 +1 @@ +{"output_schema_version":"capa-address-regression.v1","required_backends":["ghidra","ida","binja"],"required_embedded_cases":["ghidra_mapped","ghidra_unmapped","ida_mapped","binja_mapped"]} diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..a3b9318a78c98cd553d319c758f9dd0c38c66779 --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,125 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "tools/run_regression.py": "b757966156436ff3d300f3378ae5192da35253b8c3e0c022a7f0d4df71a17b16", + "vendor/LICENSE.txt": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30", + "vendor/capa/exceptions.py": "12adbe09bbc555fecb3dc5ee70643511fcc7ec5427d34e48635fb574493c8c72", + "vendor/capa/features/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/address.py": "5b4945bfa4e35dc45cbe6d50b4bccbf46c0e09f570f9e57156fcb309dfb8033e", + "vendor/capa/features/basicblock.py": "efb5819ded8782e10a7b4c6fe24908dd9291f02edf9fe97a44e6d7bff229c352", + "vendor/capa/features/com/__init__.py": "12bdcd6a78dde3f652643e030ad776645c5d474bd12cf3a165744b9c6d47849f", + "vendor/capa/features/com/classes.py": "745f7f79e56b19dd2cf1dd487c6d45db2378081c16d2fca49a200686970c7f90", + "vendor/capa/features/com/interfaces.py": "774d6d3009169183fd4ee8b4be08184a32e729d14f4e7c90eb5b029af4a4d47b", + "vendor/capa/features/common.py": "b49ed429e273d091df6bc99455144eed885ca4a54150f3c6e53a4a3451dea17d", + "vendor/capa/features/extractors/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/base_extractor.py": "c630308916f3ee7394ff1287a17360af9647de3af9b0bc14a9c9b9395e00310d", + "vendor/capa/features/extractors/binexport2/__init__.py": "46f9d90292b3bab1869212cfec46ada08012b7a5ab24fd65fccbfa88651a4f8a", + "vendor/capa/features/extractors/binexport2/arch/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binexport2/arch/arm/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binexport2/arch/arm/helpers.py": "785de2d90894ba28368d53c1c5cd38099858419b6b9ab5a976f49a04357e8d74", + "vendor/capa/features/extractors/binexport2/arch/arm/insn.py": "69908022eabbd5ebd95d66361c32e5691e5352eb8dadfd22b6d2100722c0aa9f", + "vendor/capa/features/extractors/binexport2/arch/intel/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binexport2/arch/intel/helpers.py": "03d9963f8f0e91816a51b6d2b3830e62d1d92bb01d9275384e0998e5298478bd", + "vendor/capa/features/extractors/binexport2/arch/intel/insn.py": "389bd3e526b2c282c0cc4f7c73904d5f611cd190cead029bf788f6cb97385645", + "vendor/capa/features/extractors/binexport2/basicblock.py": "aa27d712f7c6af5167a012464b2ab2fa619e20ca84f2ee654a90a4ac299c0944", + "vendor/capa/features/extractors/binexport2/binexport2_pb2.py": "9ade22c7cbafa07c7513cc3129d09fa3b12c73c6a6f8001267aab07db00eea86", + "vendor/capa/features/extractors/binexport2/binexport2_pb2.pyi": "d05c80ad5397be2dae91466bd5b6f15bef119bf6e23f1e4b76058e3707f06b06", + "vendor/capa/features/extractors/binexport2/extractor.py": "046c9f4792df8a8e50138e6cdefb087b3c6811fa196be1de911b0b3eec343ec2", + "vendor/capa/features/extractors/binexport2/file.py": "1598d35449a5ad4d6e036016d2c963072d3b8ce04785fad57836d3af6a6e71c3", + "vendor/capa/features/extractors/binexport2/function.py": "3cb828119b5303b004782a053c9bf37a4d09c45871c293767e7f2b1b455d02ad", + "vendor/capa/features/extractors/binexport2/helpers.py": "f4ef7546f41df482c15b75509e2b8557d9eeb8a6736c47a9331d4088b69046f4", + "vendor/capa/features/extractors/binexport2/insn.py": "a8ed39292e4b984186582e32ebd0f0a4d3b41beb4a1d1e4564f53ac4cee8c08f", + "vendor/capa/features/extractors/binja/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binja/basicblock.py": "463564d0c239661ecade35e40bfbd0920cf23ff6c1d2912a0f0ab1bcc870ed20", + "vendor/capa/features/extractors/binja/extractor.py": "f97bc7e306e038c40ddbe3a5cadafc2760ae0657f01487dca88425e2f7435834", + "vendor/capa/features/extractors/binja/file.py": "4dc292ae9a7ac3be748fe5c83626886eb80c2005730a9b98f39430e1b2ce10ce", + "vendor/capa/features/extractors/binja/find_binja_api.py": "d10bc8408ac9ab2f23c2fbd96957452c98cd90d35d81528d0b2fceb104494317", + "vendor/capa/features/extractors/binja/function.py": "824423ecbe46cad334ce3f793491651ee518f54664927b33647d40148655c8c2", + "vendor/capa/features/extractors/binja/global_.py": "5e6257e3a421851b23a6d4f660fbe2ff8708135e1e967a2050c8d7b2d23c32a1", + "vendor/capa/features/extractors/binja/helpers.py": "cebb5363b9998052ae4b2b4601e530ab25479a7b258932c128e38b675b7f944d", + "vendor/capa/features/extractors/binja/insn.py": "4d4b94227bc00fd97f985511479a4c14920cba2653dac784097da3aed276c01b", + "vendor/capa/features/extractors/cape/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/cape/call.py": "10c6e38c6daf58a81cf67fa70d879ca781f9ca6e486ec6dcda2c65bc8e495928", + "vendor/capa/features/extractors/cape/extractor.py": "0368403ce98cbb3e0499fab06ea6e9e9745fd9c0f7a8e363e833c3a47abcc173", + "vendor/capa/features/extractors/cape/file.py": "3cbdf40c7e16fcf3174737f6dfb7a5a303523b5ddd7ee150d8322979cfb25752", + "vendor/capa/features/extractors/cape/global_.py": "36df9126e7e3cd5881c88c564185e87ee7162efa8fd2ddd60d6259464de07164", + "vendor/capa/features/extractors/cape/models.py": "fd7ec3b7dcd892b0dca80ca75592d49e30a7b172164f7b982d6bd0ee0e314755", + "vendor/capa/features/extractors/cape/process.py": "f57416634702332d64159bac35e8f6ba5e7f07e2240c4e13f927e38c83302a37", + "vendor/capa/features/extractors/cape/thread.py": "d6b1d27ec060c393e63f4c8b503d9bdbdbac84e249d4a6509fff3545b94b7192", + "vendor/capa/features/extractors/common.py": "d5df60e1b02006605505270cd2f7bebc2a715fa845a8e7607e33e5badad67cb1", + "vendor/capa/features/extractors/dnfile/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/dnfile/extractor.py": "1a85560f9343a5dce72e3b3b336f8aaad2981698f8b76d0e363617415bf98231", + "vendor/capa/features/extractors/dnfile/file.py": "251e54168fd7f90d7a9e513010d3ffc703a2b25d3420f72cf3bec917bd806d86", + "vendor/capa/features/extractors/dnfile/function.py": "0c943f9aca13e17d1e64800892b973585e1d2f796f276ded6baacb180cc8389b", + "vendor/capa/features/extractors/dnfile/helpers.py": "553765220f6bf3ac933c49100b9c6d1468e81eeb66b646b912d68e86001e571e", + "vendor/capa/features/extractors/dnfile/insn.py": "9d8dada3ac8da1d1d02e5d74dd6ddd4334318b987732c0df884a6cde0fdac404", + "vendor/capa/features/extractors/dnfile/types.py": "11ceea648a028258c63e1481291a9fa1e4dbddbd43f64c15841c9e7e46120e52", + "vendor/capa/features/extractors/dotnetfile.py": "d4530a0b64a0d6854cd89c79cdad63b1f076d041ad76cd0c82205588d70473b8", + "vendor/capa/features/extractors/drakvuf/call.py": "2d99a6d58ade1e597ff5668cf455586f4c296e1562f046d9b5b351aed2fa7f6b", + "vendor/capa/features/extractors/drakvuf/extractor.py": "c80ffe65f5ca5e927b8474b89a4778622339cdd55dcdfc53a971d749ba23ca55", + "vendor/capa/features/extractors/drakvuf/file.py": "2af51cf016b98c2b5214d4229bd64e99f7b8ea482541bcf2db56fe5e4140d2b9", + "vendor/capa/features/extractors/drakvuf/global_.py": "7c58e43f7f23856d9b3c5654fe7ea4935a75d4fb30de7c8e9f6ee0424317eb01", + "vendor/capa/features/extractors/drakvuf/helpers.py": "41362b1bef90d6977e071f2acbe196508a5b65e556434b79c59f6c1f213f8fd4", + "vendor/capa/features/extractors/drakvuf/models.py": "98aac89ddba3d01d2e632a70a819c6a0e34e27ca542aefb68da41fce9a81c7df", + "vendor/capa/features/extractors/drakvuf/process.py": "35548a615dd04d1e766de197493f41cbe9b670b2489b135fcc86e3b32e1c670e", + "vendor/capa/features/extractors/drakvuf/thread.py": "a55c37699a8dd09aa25c0d30d383d717466513f81d18a16e508b6e9b71286c76", + "vendor/capa/features/extractors/elf.py": "d593283dca2256af030dc146d7fc93de843f3ba016aac38bc479fefbc6d36226", + "vendor/capa/features/extractors/elffile.py": "b756b7670fd97f8f5d73c143c7e4fc6dfa0c4175a762214405adb024862e551b", + "vendor/capa/features/extractors/ghidra/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/ghidra/basicblock.py": "57b99ee9c498b7355d12d9cfaef7059adb6c34bcf54c6f5de7b8fdd230693308", + "vendor/capa/features/extractors/ghidra/context.py": "e9e467378eb61c4efe5fed2a3e24fa1c322d2d1375370edce264947aaf6e8cf2", + "vendor/capa/features/extractors/ghidra/extractor.py": "1d4bb94a32d5de97d4b4ad7802b77cc34a5cd8cb4de4e184b3adb7af6af619de", + "vendor/capa/features/extractors/ghidra/file.py": "b6b6bf2c7197b7bb6a73db2fb0cf2a52f07433723fa6a4b30d6470f7fa4f1830", + "vendor/capa/features/extractors/ghidra/function.py": "67569b32d544f0a3822644a929b26532c79eac532c1e459da3518330ab95941b", + "vendor/capa/features/extractors/ghidra/global_.py": "7d93fabb6e8ce35d0b6b28322ef2b3108c5ad84cf35fc79c0e3d738f6161a03d", + "vendor/capa/features/extractors/ghidra/helpers.py": "fc71d08f451dd422f4e6fdcf707662e8fa7648eead34b0ed1c4eedc3f59c9884", + "vendor/capa/features/extractors/ghidra/insn.py": "9501a87c13130b1bb138a9813cae8bc87647750ee25141f05d5727cef4fad350", + "vendor/capa/features/extractors/helpers.py": "3a74da5cfcff2c7014a4c84e9e7237af2815e8f31617b332b838fb824ac4e085", + "vendor/capa/features/extractors/ida/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/ida/basicblock.py": "ff89e4d1701979e8bb1a7430e561c01818f31ff4ad90100bb2be3f4f3e4a570a", + "vendor/capa/features/extractors/ida/extractor.py": "b83b30d9eaf262c14910ee208843471116772c2ca43ff033eb3046d6c40eb1c9", + "vendor/capa/features/extractors/ida/file.py": "c36d84e6564a6a888895883d5bad5541f65ee25b61b78000d2c3e9421d31a51e", + "vendor/capa/features/extractors/ida/function.py": "af70904ea796c6709ca181111452f91a3053886036c8c850002d2e9765a98cc8", + "vendor/capa/features/extractors/ida/global_.py": "06058b45d58d9a22528fad58d2c28af0050a65ad0cd328e512372566e1c1c2b6", + "vendor/capa/features/extractors/ida/helpers.py": "568124859eebc615d030aea7be03e32dc620e884c6fa1d57575393f857e69cd8", + "vendor/capa/features/extractors/ida/idalib.py": "a598abe2e4d290b3241098250eecaf2861bd7ea75fe10f39d3425625c38a9dfe", + "vendor/capa/features/extractors/ida/insn.py": "695d374c3b8e1a71b01d81b59d8dff5b3cb4ddcdcf6bbd1184cd608da10f3341", + "vendor/capa/features/extractors/loops.py": "ae544b0cad6da5c472b3abbbc58cf84fcfd8ba29d5a8d2f8798a5893507768e2", + "vendor/capa/features/extractors/null.py": "224dd08bc53c6fab7980c991a8c9a2889ba0f4fd087f0294d91bce34b904eae0", + "vendor/capa/features/extractors/pefile.py": "c97b5fa2f00124f5937a00f0f78b8f795a373a30dbee8558c5b7b91150a699e7", + "vendor/capa/features/extractors/strings.py": "6a4ebb77291b8e598a7c8cc19f282a1bdd593f6294c19279b3139e7d023799c2", + "vendor/capa/features/extractors/viv/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/viv/basicblock.py": "9d7499d704f31eddee84a348b998b9c33e14d406cb18a4a8d884eaddcf16a1b2", + "vendor/capa/features/extractors/viv/extractor.py": "c47545a78b8638bd84fe8b4eec087249608823430f300050fba6595a1edd815b", + "vendor/capa/features/extractors/viv/file.py": "9901b1b2af24c03b4b7d947826865e9bcf4c8a5cc63f2e75c461e545ee5b967d", + "vendor/capa/features/extractors/viv/function.py": "501b80f14db804d9b6aaa23e38c09b31ab2c0a687dc0a56f1b1f035c6484f999", + "vendor/capa/features/extractors/viv/global_.py": "fb1875014869edfa1eef9a83c6021286a8b9179a549d5cdb5fad50bc33e6bccd", + "vendor/capa/features/extractors/viv/helpers.py": "c9b2fd92d6ae07c22c7f4146263861d93846b84195d767b623150851c56ed685", + "vendor/capa/features/extractors/viv/indirect_calls.py": "2787227b13ff3dbb6218b8e6528d36dcaf5445e51196f86172b18589cf1b3444", + "vendor/capa/features/extractors/viv/insn.py": "184d34ec258bf725415ed45e83a1d0f0e6d9a2d9c4df3d74680f71f07f6a7f27", + "vendor/capa/features/extractors/vmray/__init__.py": "35405864af7837a9e7d67d4670e90110d3db6f46000d559535ceb1d4ef78830b", + "vendor/capa/features/extractors/vmray/call.py": "56fc1c3ae4dccb32b8424028fd2af8f4834f977de9354bb925e5b777349b7ec7", + "vendor/capa/features/extractors/vmray/extractor.py": "b0c23cff85145f18723bab21a3debddc86783c319215a4a7803764ce5c966e7b", + "vendor/capa/features/extractors/vmray/file.py": "8b78b2ced74065e2d6409ebec3ba41744394591546d72d1b4c0b7f98ea97d2ff", + "vendor/capa/features/extractors/vmray/global_.py": "9660a07ab9c4448efd399b93c14c3173e241f48c65b3393f535a53d603c2d849", + "vendor/capa/features/extractors/vmray/models.py": "8a1f3b607e49048cd07f485f39b324e7ba918f1d70170741afc74208fc23ea00", + "vendor/capa/features/file.py": "0ebebea72576eabed7ac8ef969f474ac1cd115f9e5f801ebeba0531f4008ffd3", + "vendor/capa/features/freeze/__init__.py": "023a5ddb63e67b4a5c12001550a1cfdbba5c1f763007d7233e9e9c77943d5afb", + "vendor/capa/features/freeze/__main__.py": "9fc9901f416ad5b2e9d238e46fb5cfc94b12fe12cade230e8ca43cc4f1be1651", + "vendor/capa/features/freeze/features.py": "cbe79a81c0146a2961bb763a9b157f2daebbdb64aebc53861d2c8ae8e8952ad6", + "vendor/capa/features/insn.py": "c6c08dd8ca05c6ad9d4b6a050fd191f4412c3aa7ea2e6216634aca1f16175009", + "vendor/capa/helpers.py": "62854d9337422e03111a086a541488f4a1e89de2c132f83746454aec2118d710", + "vendor/capa/version.py": "379de2c4f16a18df933b0f467fc9f470c94753700f62010e9c4f1d59309a4db1", + "vendor/pyproject.toml": "53797e2fec66ace49ff88aa7dd0d14a0d43e7af37bf08f076ae966a93b4635a3" + }, + "mutable": [ + "vendor/capa/features/extractors/binja/file.py", + "vendor/capa/features/extractors/ghidra/file.py", + "vendor/capa/features/extractors/ida/file.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/protected_hashes.json b/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/protected_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..ca82f17df7fe9fe3274f05eab7ec8c7dd5251ecd --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/fixtures/protected_hashes.json @@ -0,0 +1,110 @@ +{ + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "tools/run_regression.py": "b757966156436ff3d300f3378ae5192da35253b8c3e0c022a7f0d4df71a17b16", + "vendor/LICENSE.txt": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30", + "vendor/capa/exceptions.py": "12adbe09bbc555fecb3dc5ee70643511fcc7ec5427d34e48635fb574493c8c72", + "vendor/capa/features/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/address.py": "5b4945bfa4e35dc45cbe6d50b4bccbf46c0e09f570f9e57156fcb309dfb8033e", + "vendor/capa/features/basicblock.py": "efb5819ded8782e10a7b4c6fe24908dd9291f02edf9fe97a44e6d7bff229c352", + "vendor/capa/features/com/__init__.py": "12bdcd6a78dde3f652643e030ad776645c5d474bd12cf3a165744b9c6d47849f", + "vendor/capa/features/com/classes.py": "745f7f79e56b19dd2cf1dd487c6d45db2378081c16d2fca49a200686970c7f90", + "vendor/capa/features/com/interfaces.py": "774d6d3009169183fd4ee8b4be08184a32e729d14f4e7c90eb5b029af4a4d47b", + "vendor/capa/features/common.py": "b49ed429e273d091df6bc99455144eed885ca4a54150f3c6e53a4a3451dea17d", + "vendor/capa/features/extractors/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/base_extractor.py": "c630308916f3ee7394ff1287a17360af9647de3af9b0bc14a9c9b9395e00310d", + "vendor/capa/features/extractors/binexport2/__init__.py": "46f9d90292b3bab1869212cfec46ada08012b7a5ab24fd65fccbfa88651a4f8a", + "vendor/capa/features/extractors/binexport2/arch/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binexport2/arch/arm/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binexport2/arch/arm/helpers.py": "785de2d90894ba28368d53c1c5cd38099858419b6b9ab5a976f49a04357e8d74", + "vendor/capa/features/extractors/binexport2/arch/arm/insn.py": "69908022eabbd5ebd95d66361c32e5691e5352eb8dadfd22b6d2100722c0aa9f", + "vendor/capa/features/extractors/binexport2/arch/intel/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binexport2/arch/intel/helpers.py": "03d9963f8f0e91816a51b6d2b3830e62d1d92bb01d9275384e0998e5298478bd", + "vendor/capa/features/extractors/binexport2/arch/intel/insn.py": "389bd3e526b2c282c0cc4f7c73904d5f611cd190cead029bf788f6cb97385645", + "vendor/capa/features/extractors/binexport2/basicblock.py": "aa27d712f7c6af5167a012464b2ab2fa619e20ca84f2ee654a90a4ac299c0944", + "vendor/capa/features/extractors/binexport2/binexport2_pb2.py": "9ade22c7cbafa07c7513cc3129d09fa3b12c73c6a6f8001267aab07db00eea86", + "vendor/capa/features/extractors/binexport2/binexport2_pb2.pyi": "d05c80ad5397be2dae91466bd5b6f15bef119bf6e23f1e4b76058e3707f06b06", + "vendor/capa/features/extractors/binexport2/extractor.py": "046c9f4792df8a8e50138e6cdefb087b3c6811fa196be1de911b0b3eec343ec2", + "vendor/capa/features/extractors/binexport2/file.py": "1598d35449a5ad4d6e036016d2c963072d3b8ce04785fad57836d3af6a6e71c3", + "vendor/capa/features/extractors/binexport2/function.py": "3cb828119b5303b004782a053c9bf37a4d09c45871c293767e7f2b1b455d02ad", + "vendor/capa/features/extractors/binexport2/helpers.py": "f4ef7546f41df482c15b75509e2b8557d9eeb8a6736c47a9331d4088b69046f4", + "vendor/capa/features/extractors/binexport2/insn.py": "a8ed39292e4b984186582e32ebd0f0a4d3b41beb4a1d1e4564f53ac4cee8c08f", + "vendor/capa/features/extractors/binja/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/binja/basicblock.py": "463564d0c239661ecade35e40bfbd0920cf23ff6c1d2912a0f0ab1bcc870ed20", + "vendor/capa/features/extractors/binja/extractor.py": "f97bc7e306e038c40ddbe3a5cadafc2760ae0657f01487dca88425e2f7435834", + "vendor/capa/features/extractors/binja/find_binja_api.py": "d10bc8408ac9ab2f23c2fbd96957452c98cd90d35d81528d0b2fceb104494317", + "vendor/capa/features/extractors/binja/function.py": "824423ecbe46cad334ce3f793491651ee518f54664927b33647d40148655c8c2", + "vendor/capa/features/extractors/binja/global_.py": "5e6257e3a421851b23a6d4f660fbe2ff8708135e1e967a2050c8d7b2d23c32a1", + "vendor/capa/features/extractors/binja/helpers.py": "cebb5363b9998052ae4b2b4601e530ab25479a7b258932c128e38b675b7f944d", + "vendor/capa/features/extractors/binja/insn.py": "4d4b94227bc00fd97f985511479a4c14920cba2653dac784097da3aed276c01b", + "vendor/capa/features/extractors/cape/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/cape/call.py": "10c6e38c6daf58a81cf67fa70d879ca781f9ca6e486ec6dcda2c65bc8e495928", + "vendor/capa/features/extractors/cape/extractor.py": "0368403ce98cbb3e0499fab06ea6e9e9745fd9c0f7a8e363e833c3a47abcc173", + "vendor/capa/features/extractors/cape/file.py": "3cbdf40c7e16fcf3174737f6dfb7a5a303523b5ddd7ee150d8322979cfb25752", + "vendor/capa/features/extractors/cape/global_.py": "36df9126e7e3cd5881c88c564185e87ee7162efa8fd2ddd60d6259464de07164", + "vendor/capa/features/extractors/cape/models.py": "fd7ec3b7dcd892b0dca80ca75592d49e30a7b172164f7b982d6bd0ee0e314755", + "vendor/capa/features/extractors/cape/process.py": "f57416634702332d64159bac35e8f6ba5e7f07e2240c4e13f927e38c83302a37", + "vendor/capa/features/extractors/cape/thread.py": "d6b1d27ec060c393e63f4c8b503d9bdbdbac84e249d4a6509fff3545b94b7192", + "vendor/capa/features/extractors/common.py": "d5df60e1b02006605505270cd2f7bebc2a715fa845a8e7607e33e5badad67cb1", + "vendor/capa/features/extractors/dnfile/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/dnfile/extractor.py": "1a85560f9343a5dce72e3b3b336f8aaad2981698f8b76d0e363617415bf98231", + "vendor/capa/features/extractors/dnfile/file.py": "251e54168fd7f90d7a9e513010d3ffc703a2b25d3420f72cf3bec917bd806d86", + "vendor/capa/features/extractors/dnfile/function.py": "0c943f9aca13e17d1e64800892b973585e1d2f796f276ded6baacb180cc8389b", + "vendor/capa/features/extractors/dnfile/helpers.py": "553765220f6bf3ac933c49100b9c6d1468e81eeb66b646b912d68e86001e571e", + "vendor/capa/features/extractors/dnfile/insn.py": "9d8dada3ac8da1d1d02e5d74dd6ddd4334318b987732c0df884a6cde0fdac404", + "vendor/capa/features/extractors/dnfile/types.py": "11ceea648a028258c63e1481291a9fa1e4dbddbd43f64c15841c9e7e46120e52", + "vendor/capa/features/extractors/dotnetfile.py": "d4530a0b64a0d6854cd89c79cdad63b1f076d041ad76cd0c82205588d70473b8", + "vendor/capa/features/extractors/drakvuf/call.py": "2d99a6d58ade1e597ff5668cf455586f4c296e1562f046d9b5b351aed2fa7f6b", + "vendor/capa/features/extractors/drakvuf/extractor.py": "c80ffe65f5ca5e927b8474b89a4778622339cdd55dcdfc53a971d749ba23ca55", + "vendor/capa/features/extractors/drakvuf/file.py": "2af51cf016b98c2b5214d4229bd64e99f7b8ea482541bcf2db56fe5e4140d2b9", + "vendor/capa/features/extractors/drakvuf/global_.py": "7c58e43f7f23856d9b3c5654fe7ea4935a75d4fb30de7c8e9f6ee0424317eb01", + "vendor/capa/features/extractors/drakvuf/helpers.py": "41362b1bef90d6977e071f2acbe196508a5b65e556434b79c59f6c1f213f8fd4", + "vendor/capa/features/extractors/drakvuf/models.py": "98aac89ddba3d01d2e632a70a819c6a0e34e27ca542aefb68da41fce9a81c7df", + "vendor/capa/features/extractors/drakvuf/process.py": "35548a615dd04d1e766de197493f41cbe9b670b2489b135fcc86e3b32e1c670e", + "vendor/capa/features/extractors/drakvuf/thread.py": "a55c37699a8dd09aa25c0d30d383d717466513f81d18a16e508b6e9b71286c76", + "vendor/capa/features/extractors/elf.py": "d593283dca2256af030dc146d7fc93de843f3ba016aac38bc479fefbc6d36226", + "vendor/capa/features/extractors/elffile.py": "b756b7670fd97f8f5d73c143c7e4fc6dfa0c4175a762214405adb024862e551b", + "vendor/capa/features/extractors/ghidra/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/ghidra/basicblock.py": "57b99ee9c498b7355d12d9cfaef7059adb6c34bcf54c6f5de7b8fdd230693308", + "vendor/capa/features/extractors/ghidra/context.py": "e9e467378eb61c4efe5fed2a3e24fa1c322d2d1375370edce264947aaf6e8cf2", + "vendor/capa/features/extractors/ghidra/extractor.py": "1d4bb94a32d5de97d4b4ad7802b77cc34a5cd8cb4de4e184b3adb7af6af619de", + "vendor/capa/features/extractors/ghidra/function.py": "67569b32d544f0a3822644a929b26532c79eac532c1e459da3518330ab95941b", + "vendor/capa/features/extractors/ghidra/global_.py": "7d93fabb6e8ce35d0b6b28322ef2b3108c5ad84cf35fc79c0e3d738f6161a03d", + "vendor/capa/features/extractors/ghidra/helpers.py": "fc71d08f451dd422f4e6fdcf707662e8fa7648eead34b0ed1c4eedc3f59c9884", + "vendor/capa/features/extractors/ghidra/insn.py": "9501a87c13130b1bb138a9813cae8bc87647750ee25141f05d5727cef4fad350", + "vendor/capa/features/extractors/helpers.py": "3a74da5cfcff2c7014a4c84e9e7237af2815e8f31617b332b838fb824ac4e085", + "vendor/capa/features/extractors/ida/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/ida/basicblock.py": "ff89e4d1701979e8bb1a7430e561c01818f31ff4ad90100bb2be3f4f3e4a570a", + "vendor/capa/features/extractors/ida/extractor.py": "b83b30d9eaf262c14910ee208843471116772c2ca43ff033eb3046d6c40eb1c9", + "vendor/capa/features/extractors/ida/function.py": "af70904ea796c6709ca181111452f91a3053886036c8c850002d2e9765a98cc8", + "vendor/capa/features/extractors/ida/global_.py": "06058b45d58d9a22528fad58d2c28af0050a65ad0cd328e512372566e1c1c2b6", + "vendor/capa/features/extractors/ida/helpers.py": "568124859eebc615d030aea7be03e32dc620e884c6fa1d57575393f857e69cd8", + "vendor/capa/features/extractors/ida/idalib.py": "a598abe2e4d290b3241098250eecaf2861bd7ea75fe10f39d3425625c38a9dfe", + "vendor/capa/features/extractors/ida/insn.py": "695d374c3b8e1a71b01d81b59d8dff5b3cb4ddcdcf6bbd1184cd608da10f3341", + "vendor/capa/features/extractors/loops.py": "ae544b0cad6da5c472b3abbbc58cf84fcfd8ba29d5a8d2f8798a5893507768e2", + "vendor/capa/features/extractors/null.py": "224dd08bc53c6fab7980c991a8c9a2889ba0f4fd087f0294d91bce34b904eae0", + "vendor/capa/features/extractors/pefile.py": "c97b5fa2f00124f5937a00f0f78b8f795a373a30dbee8558c5b7b91150a699e7", + "vendor/capa/features/extractors/strings.py": "6a4ebb77291b8e598a7c8cc19f282a1bdd593f6294c19279b3139e7d023799c2", + "vendor/capa/features/extractors/viv/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/capa/features/extractors/viv/basicblock.py": "9d7499d704f31eddee84a348b998b9c33e14d406cb18a4a8d884eaddcf16a1b2", + "vendor/capa/features/extractors/viv/extractor.py": "c47545a78b8638bd84fe8b4eec087249608823430f300050fba6595a1edd815b", + "vendor/capa/features/extractors/viv/file.py": "9901b1b2af24c03b4b7d947826865e9bcf4c8a5cc63f2e75c461e545ee5b967d", + "vendor/capa/features/extractors/viv/function.py": "501b80f14db804d9b6aaa23e38c09b31ab2c0a687dc0a56f1b1f035c6484f999", + "vendor/capa/features/extractors/viv/global_.py": "fb1875014869edfa1eef9a83c6021286a8b9179a549d5cdb5fad50bc33e6bccd", + "vendor/capa/features/extractors/viv/helpers.py": "c9b2fd92d6ae07c22c7f4146263861d93846b84195d767b623150851c56ed685", + "vendor/capa/features/extractors/viv/indirect_calls.py": "2787227b13ff3dbb6218b8e6528d36dcaf5445e51196f86172b18589cf1b3444", + "vendor/capa/features/extractors/viv/insn.py": "184d34ec258bf725415ed45e83a1d0f0e6d9a2d9c4df3d74680f71f07f6a7f27", + "vendor/capa/features/extractors/vmray/__init__.py": "35405864af7837a9e7d67d4670e90110d3db6f46000d559535ceb1d4ef78830b", + "vendor/capa/features/extractors/vmray/call.py": "56fc1c3ae4dccb32b8424028fd2af8f4834f977de9354bb925e5b777349b7ec7", + "vendor/capa/features/extractors/vmray/extractor.py": "b0c23cff85145f18723bab21a3debddc86783c319215a4a7803764ce5c966e7b", + "vendor/capa/features/extractors/vmray/file.py": "8b78b2ced74065e2d6409ebec3ba41744394591546d72d1b4c0b7f98ea97d2ff", + "vendor/capa/features/extractors/vmray/global_.py": "9660a07ab9c4448efd399b93c14c3173e241f48c65b3393f535a53d603c2d849", + "vendor/capa/features/extractors/vmray/models.py": "8a1f3b607e49048cd07f485f39b324e7ba918f1d70170741afc74208fc23ea00", + "vendor/capa/features/file.py": "0ebebea72576eabed7ac8ef969f474ac1cd115f9e5f801ebeba0531f4008ffd3", + "vendor/capa/features/freeze/__init__.py": "023a5ddb63e67b4a5c12001550a1cfdbba5c1f763007d7233e9e9c77943d5afb", + "vendor/capa/features/freeze/__main__.py": "9fc9901f416ad5b2e9d238e46fb5cfc94b12fe12cade230e8ca43cc4f1be1651", + "vendor/capa/features/freeze/features.py": "cbe79a81c0146a2961bb763a9b157f2daebbdb64aebc53861d2c8ae8e8952ad6", + "vendor/capa/features/insn.py": "c6c08dd8ca05c6ad9d4b6a050fd191f4412c3aa7ea2e6216634aca1f16175009", + "vendor/capa/helpers.py": "62854d9337422e03111a086a541488f4a1e89de2c132f83746454aec2118d710", + "vendor/capa/version.py": "379de2c4f16a18df933b0f467fc9f470c94753700f62010e9c4f1d59309a4db1", + "vendor/pyproject.toml": "53797e2fec66ace49ff88aa7dd0d14a0d43e7af37bf08f076ae966a93b4635a3" +} \ No newline at end of file diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/task_test.sh b/tasks/candidate-1399-security-reverse-engineering/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..c97c09dc5db84f2af9fe99d11cec402aed8c89c6 --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then echo 1 > /logs/verifier/reward.txt; else echo 0 > /logs/verifier/reward.txt; fi +exit 0 diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/test.sh b/tasks/candidate-1399-security-reverse-engineering/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1399-security-reverse-engineering/tests/test_outputs.py b/tasks/candidate-1399-security-reverse-engineering/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..196ce673bec7aff249b6b03016ef65944d47fc4f --- /dev/null +++ b/tasks/candidate-1399-security-reverse-engineering/tests/test_outputs.py @@ -0,0 +1,299 @@ +from __future__ import annotations + +import ast +import hashlib +import json +from pathlib import Path +from types import SimpleNamespace + + +ROOT = Path("/app") +EXTRACTORS = ROOT / "vendor/capa/features/extractors" +OUT = ROOT / "output.json" + + +class Feature: + def __init__(self, value: str): + self.value = value + + +class String(Feature): + pass + + +class Characteristic(Feature): + pass + + +class Address(int): + pass + + +class AbsoluteVirtualAddress(Address): + pass + + +class FileOffsetAddress(Address): + pass + + +class GhidraAddress: + def __init__(self, value: int): + self.value = value + + def add(self, offset: int): + return GhidraAddress(self.value + offset) + + def getOffset(self): + return self.value + + +class GhidraBlock: + def __init__(self, start: int, data: bytes, name: str): + self.start = GhidraAddress(start) + self.data = data + self.name = name + + def getStart(self): + return self.start + + def getName(self): + return self.name + + def isLoaded(self): + return True + + def isInitialized(self): + return True + + +class GhidraProgram: + def __init__(self, blocks): + self.blocks = blocks + + def getMemory(self): + return SimpleNamespace(getBlocks=lambda: self.blocks) + + +class IdaSegment: + def __init__(self, start: int): + self.start_ea = start + + +class BinjaSegment: + def __init__(self): + self.start = 0x810000 + self.data_offset = 0x1800 + self.data_length = 0x400 + self.length = 0x400 + + +class BinjaView: + view_type = "Raw" + start = 0 + + def __init__(self, segment): + self.segment = segment + self.strings = [ + SimpleNamespace(start=0x810031, value="alpha-ascii"), + SimpleNamespace(start=0x8100A0, value="beta-wide"), + ] + + def get_segment_at(self, address): + return self.segment if self.segment.start <= address < self.segment.start + self.segment.length else None + + def read(self, _start, length): + return bytes(length) + + +def load_function(relative_path: str, name: str, globals_: dict): + path = ROOT / relative_path + tree = ast.parse(path.read_text(), filename=str(path)) + function = next(node for node in tree.body if isinstance(node, ast.FunctionDef) and node.name == name) + module = ast.Module( + body=[ast.ImportFrom(module="__future__", names=[ast.alias(name="annotations")], level=0), function], + type_ignores=[], + ) + namespace = dict(globals_) + exec(compile(ast.fix_missing_locations(module), str(path), "exec"), namespace) + return namespace[name] + + +def encode(items): + return [(feature.value, type(address).__name__, int(address)) for feature, address in items] + + +def recompute_strings(): + ghidra_block = GhidraBlock(0x401000, b"fixture", "strings") + ghidra_helpers = SimpleNamespace( + get_current_program=lambda: GhidraProgram([ghidra_block]), + get_block_bytes=lambda block: block.data, + get_file_offset=lambda address: {0x401023: 0x223, 0x4010B0: 0x2B0}.get(address.getOffset(), -1), + ) + ghidra_capa = SimpleNamespace( + features=SimpleNamespace( + extractors=SimpleNamespace( + strings=SimpleNamespace( + extract_ascii_strings=lambda _data: [SimpleNamespace(offset=0x23, s="alpha-ascii")], + extract_unicode_strings=lambda _data: [SimpleNamespace(offset=0xB0, s="beta-wide")], + ), + ghidra=SimpleNamespace(helpers=ghidra_helpers), + ) + ) + ) + ghidra = load_function( + "vendor/capa/features/extractors/ghidra/file.py", + "extract_file_strings", + {"capa": ghidra_capa, "String": String, "AbsoluteVirtualAddress": AbsoluteVirtualAddress, "FileOffsetAddress": FileOffsetAddress}, + ) + + ida_segment = IdaSegment(0x710000) + ida_capa = SimpleNamespace( + features=SimpleNamespace( + extractors=SimpleNamespace( + strings=SimpleNamespace( + extract_ascii_strings=lambda _data: [SimpleNamespace(offset=0x19, s="alpha-ascii")], + extract_unicode_strings=lambda _data: [SimpleNamespace(offset=0x88, s="beta-wide")], + ), + ida=SimpleNamespace( + helpers=SimpleNamespace(get_segments=lambda **_kwargs: [ida_segment], get_segment_buffer=lambda _seg: b"fixture") + ), + ) + ) + ) + ida_loader = SimpleNamespace(get_fileregion_offset=lambda address: {0x710019: 0x319, 0x710088: 0x388}.get(address, -1)) + ida = load_function( + "vendor/capa/features/extractors/ida/file.py", + "extract_file_strings", + {"capa": ida_capa, "ida_loader": ida_loader, "String": String, "AbsoluteVirtualAddress": AbsoluteVirtualAddress, "FileOffsetAddress": FileOffsetAddress}, + ) + + binja_segment = BinjaSegment() + binja_view = BinjaView(binja_segment) + binja = load_function( + "vendor/capa/features/extractors/binja/file.py", + "extract_file_strings", + {"String": String, "AbsoluteVirtualAddress": AbsoluteVirtualAddress, "FileOffsetAddress": FileOffsetAddress}, + ) + return { + "ghidra": encode(ghidra()), + "ida": encode(ida()), + "binja": encode(binja(binja_view)), + } + + +def recompute_embedded(): + ghidra_blocks = [GhidraBlock(0x510000, b"mapped", "mapped"), GhidraBlock(0x620000, b"unmapped", "unmapped")] + ghidra_helpers = SimpleNamespace( + get_current_program=lambda: GhidraProgram(ghidra_blocks), + get_block_bytes=lambda block: block.data, + get_file_offset=lambda address: 0x940 if address.getOffset() == 0x510040 else -1, + ) + ghidra_capa = SimpleNamespace( + features=SimpleNamespace( + extractors=SimpleNamespace( + helpers=SimpleNamespace(xor_static=lambda data, _key: data), + ghidra=SimpleNamespace(helpers=ghidra_helpers), + ) + ) + ) + ghidra = load_function( + "vendor/capa/features/extractors/ghidra/file.py", + "extract_file_embedded_pe", + { + "capa": ghidra_capa, + "find_embedded_pe": lambda _data, _pairs: [(0x40, 0)], + "Characteristic": Characteristic, + "AbsoluteVirtualAddress": AbsoluteVirtualAddress, + "FileOffsetAddress": FileOffsetAddress, + }, + ) + + ida_segment = IdaSegment(0x710000) + ida_capa = SimpleNamespace( + features=SimpleNamespace(extractors=SimpleNamespace(ida=SimpleNamespace(helpers=SimpleNamespace(get_segments=lambda **_kwargs: [ida_segment])))) + ) + ida = load_function( + "vendor/capa/features/extractors/ida/file.py", + "extract_file_embedded_pe", + { + "capa": ida_capa, + "ida_loader": SimpleNamespace(get_fileregion_offset=lambda address: 0x1240 if address == 0x710240 else -1), + "check_segment_for_pe": lambda _segment: [(0x710240, 0)], + "Characteristic": Characteristic, + "FileOffsetAddress": FileOffsetAddress, + }, + ) + + segment = BinjaSegment() + view = BinjaView(segment) + binja_capa = SimpleNamespace( + features=SimpleNamespace(extractors=SimpleNamespace(helpers=SimpleNamespace(carve_pe=lambda _data, _start: [(0xA4, 0)]))) + ) + binja = load_function( + "vendor/capa/features/extractors/binja/file.py", + "check_segment_for_pe", + {"capa": binja_capa, "Characteristic": Characteristic, "FileOffsetAddress": FileOffsetAddress}, + ) + ghidra_items = encode(ghidra()) + return { + "ghidra_mapped": ghidra_items[:1], + "ghidra_unmapped": ghidra_items[1:], + "ida_mapped": encode(ida()), + "binja_mapped": encode(binja(view, segment)), + } + + +def artifact_tuples(data, section, key): + return [(item["feature"], item["address_class"], item["address"]) for item in data[section][key]] + + +def test_gate_artifact_schema_and_protected_tree(): + schema = json.loads(Path("/tests/fixtures/expected_schema.json").read_text()) + data = json.loads(OUT.read_text()) + assert data["output_schema_version"] == schema["output_schema_version"] + assert set(data) == {"output_schema_version", "string_features", "embedded_pe", "downstream_compatibility"} + assert set(data["string_features"]) == set(schema["required_backends"]) + assert set(data["embedded_pe"]) == set(schema["required_embedded_cases"]) + protected = json.loads(Path("/tests/fixtures/protected_hashes.json").read_text()) + for relative_path, expected_hash in protected.items(): + assert hashlib.sha256((ROOT / relative_path).read_bytes()).hexdigest() == expected_hash + + +def test_core_string_extractors_execute_with_virtual_addresses(): + expected = { + "ghidra": [("alpha-ascii", "AbsoluteVirtualAddress", 0x401023), ("beta-wide", "AbsoluteVirtualAddress", 0x4010B0)], + "ida": [("alpha-ascii", "AbsoluteVirtualAddress", 0x710019), ("beta-wide", "AbsoluteVirtualAddress", 0x710088)], + "binja": [("alpha-ascii", "AbsoluteVirtualAddress", 0x810031), ("beta-wide", "AbsoluteVirtualAddress", 0x8100A0)], + } + observed = recompute_strings() + assert observed == expected + data = json.loads(OUT.read_text()) + for backend in expected: + assert artifact_tuples(data, "string_features", backend) == expected[backend] + + +def test_core_embedded_extractors_preserve_backend_mapping_rules(): + expected = { + "ghidra_mapped": [("embedded pe", "FileOffsetAddress", 0x940)], + "ghidra_unmapped": [("embedded pe", "AbsoluteVirtualAddress", 0x620040)], + "ida_mapped": [("embedded pe", "FileOffsetAddress", 0x1240)], + "binja_mapped": [("embedded pe", "FileOffsetAddress", 0x18A4)], + } + observed = recompute_embedded() + assert observed == expected + data = json.loads(OUT.read_text()) + for case in expected: + assert artifact_tuples(data, "embedded_pe", case) == expected[case] + + +def test_edge_coordinate_domains_and_feature_values_remain_distinct(): + strings = recompute_strings() + embedded = recompute_embedded() + assert all([item[0] for item in strings[backend]] == ["alpha-ascii", "beta-wide"] for backend in strings) + assert strings["ghidra"][0][2] != 0x223 + assert strings["ida"][0][2] != 0x319 + assert strings["binja"][0][2] != 0x1831 + assert embedded["ghidra_mapped"][0][1] != embedded["ghidra_unmapped"][0][1] + compatibility = json.loads(OUT.read_text())["downstream_compatibility"] + assert compatibility == {"address_domains_distinct": True, "feature_values_preserved": True} diff --git a/tasks/candidate-1442-software-languages/environment/Dockerfile b/tasks/candidate-1442-software-languages/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c046a72150fc274dc0ce73ebf7176b5d3d9133f6 --- /dev/null +++ b/tasks/candidate-1442-software-languages/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:01477582487894e1982905b5a201d8eab0e426f2a426d7941cfadae6c672bc47 diff --git a/tasks/candidate-1442-software-languages/environment/setup/setup.sh b/tasks/candidate-1442-software-languages/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1442-software-languages/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1442-software-languages/instruction.md b/tasks/candidate-1442-software-languages/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..197bd049cc796b091d8d5ecb3d0345a44a7300a8 --- /dev/null +++ b/tasks/candidate-1442-software-languages/instruction.md @@ -0,0 +1,52 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Task: repair wheel interpreter-tag validation + +The frozen library in `/app/vendor/packaging` accepts malformed wheel interpreter-tag +members and expands them into `Tag` objects. Repair the existing parser pipeline. + +## Required behavior + +1. In `src/packaging/tags.py`, every member of the interpreter field in a direct + `parse_tag()` call must be a non-empty valid Python identifier. Invalid members must + raise `packaging.tags.InvalidTag` with an informative message that identifies the + interpreter problem and the offending member. +2. In `src/packaging/utils.py`, `parse_wheel_filename()` must translate that failure to + `packaging.utils.InvalidWheelFilename`. Its message must preserve useful interpreter + validation context and identify the rejected wheel filename. Do not expose a chained + internal parser exception for this validation failure. +3. Preserve valid behavior: compressed interpreter identifiers still expand as a set; + ABI and platform members retain their distinct syntax; version/name normalization, + build-tag parsing, order validation, empty-component validation, and tag-count limits + must continue to work. +4. Make substantive repairs in both existing production modules above. Do not replace + the package, edit its tests to hide failures, disable validation, or special-case one + filename. + +## Required artifact + +After repairing and checking the source, write `/app/repair_report.json` with this public +contract: + +```json +{ + "output_schema_version": "tbench.packaging_repair_report.v1", + "status": "repaired", + "source_files": [ + "vendor/packaging/src/packaging/tags.py", + "vendor/packaging/src/packaging/utils.py" + ], + "checks": { + "direct_invalid_rejected": true, + "wheel_invalid_wrapped": true, + "valid_compressed_preserved": true, + "abi_platform_preserved": true + } +} +``` + +You may include additional fields, but the declared fields and values must be present. +The verifier independently imports and exercises the repaired source; a fabricated +report does not pass. diff --git a/tasks/candidate-1442-software-languages/task.toml b/tasks/candidate-1442-software-languages/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f41f7f6c4d68e97b1a51250f94d9f979150afc43 --- /dev/null +++ b/tasks/candidate-1442-software-languages/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1442-software-languages" +description = "MiMo-V2.6-RL terminal task candidate-1442-software-languages" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1442-software-languages" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:01477582487894e1982905b5a201d8eab0e426f2a426d7941cfadae6c672bc47" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1442-software-languages/tests/anti_hack_guard.py b/tasks/candidate-1442-software-languages/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1442-software-languages/tests/fixtures/base_mutable_hashes.json b/tasks/candidate-1442-software-languages/tests/fixtures/base_mutable_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..31ca1e3f0aeb57e6d7ff51b24a2561cc1c97b01a --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/fixtures/base_mutable_hashes.json @@ -0,0 +1,4 @@ +{ + "src/packaging/tags.py": "cb6d67388b647f87e4e83b89a005949e682c6b804f4b7f2bb0a2853e6d15b590", + "src/packaging/utils.py": "0074d32bf98c4bc4a400507c499615ac8c29b09a456d538422d82fd39640c8aa" +} diff --git a/tasks/candidate-1442-software-languages/tests/fixtures/immutable_hashes.json b/tasks/candidate-1442-software-languages/tests/fixtures/immutable_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..e786750924c514cd3c5040c1ee67fb609671619c --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/fixtures/immutable_hashes.json @@ -0,0 +1,15 @@ +{ + "src/packaging/__init__.py": "bf01887ad0f4a9fa9e3b9cd4601dc40a7b2970b5c808cde59e64c4aa1e797c91", + "src/packaging/_elffile.py": "1f025f54c573f1a85740c4fbd908cc1d1fb0c177c14377ebf5f09d6cd5368780", + "src/packaging/_manylinux.py": "5b6e84324c42538ab4cdb148e2430fdba36f04427b0efda55bea083a35fa6136", + "src/packaging/_musllinux.py": "0328fb827b1170c77df4c107d49be8df8d37262103490a61e8acad8a2f9cadff", + "src/packaging/_parser.py": "88a348115209327497e453b635e5db099fd592f9335d710c7313b29cdb30c50c", + "src/packaging/_ranges.py": "b7b595f2e692aeb3697c545b85c24cbbcb4552f2adc6d9059aa82d0877e816b7", + "src/packaging/_structures.py": "eb48d16c5efca7ccf930a9cd77a700a6b80e69d0891d5d03966526441a8565cb", + "src/packaging/_tokenizer.py": "cc25e57c0d564c89e15073471d6e1c264299ca946fb17c0e1e4af54ef7713ee6", + "src/packaging/errors.py": "ea17c461701ff2ffc817ae7e94569d24e30889e04fdb120ab721178c6d67188b", + "src/packaging/markers.py": "9056d5d4882a3ba14a7624ba64c3a33aadb00c563dce4d15343dc229fbef5f8a", + "src/packaging/ranges.py": "b4781ce913e5dff9e07906f20585c54c3028e1f7ff56341828e79d522ddbfab6", + "src/packaging/specifiers.py": "f9e37cfb1ceba333a1302c2af605ec6f2fb67801f341af70d347f9271ab8e9cb", + "src/packaging/version.py": "af4b2bfdbdaaf743eb5ef831e7981963857ef39ab96fdbeee4d402539f715059" +} diff --git a/tasks/candidate-1442-software-languages/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1442-software-languages/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..dd55854f4b28670a2d89d0c895c4c2c760f374f5 --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,46 @@ +{ + "artifacts": [ + "repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "vendor/packaging/LICENSE": "cad1ef5bd340d73e074ba614d26f7deaca5c7940c3d8c34852e65c4909686c48", + "vendor/packaging/pyproject.toml": "b0a54ca7272d1dce914f64e6dddf6026e5664aff3622971994956b320c00f59e", + "vendor/packaging/src/packaging/__init__.py": "bf01887ad0f4a9fa9e3b9cd4601dc40a7b2970b5c808cde59e64c4aa1e797c91", + "vendor/packaging/src/packaging/_elffile.py": "1f025f54c573f1a85740c4fbd908cc1d1fb0c177c14377ebf5f09d6cd5368780", + "vendor/packaging/src/packaging/_manylinux.py": "5b6e84324c42538ab4cdb148e2430fdba36f04427b0efda55bea083a35fa6136", + "vendor/packaging/src/packaging/_musllinux.py": "0328fb827b1170c77df4c107d49be8df8d37262103490a61e8acad8a2f9cadff", + "vendor/packaging/src/packaging/_parser.py": "88a348115209327497e453b635e5db099fd592f9335d710c7313b29cdb30c50c", + "vendor/packaging/src/packaging/_ranges.py": "b7b595f2e692aeb3697c545b85c24cbbcb4552f2adc6d9059aa82d0877e816b7", + "vendor/packaging/src/packaging/_structures.py": "eb48d16c5efca7ccf930a9cd77a700a6b80e69d0891d5d03966526441a8565cb", + "vendor/packaging/src/packaging/_tokenizer.py": "cc25e57c0d564c89e15073471d6e1c264299ca946fb17c0e1e4af54ef7713ee6", + "vendor/packaging/src/packaging/errors.py": "ea17c461701ff2ffc817ae7e94569d24e30889e04fdb120ab721178c6d67188b", + "vendor/packaging/src/packaging/markers.py": "9056d5d4882a3ba14a7624ba64c3a33aadb00c563dce4d15343dc229fbef5f8a", + "vendor/packaging/src/packaging/ranges.py": "b4781ce913e5dff9e07906f20585c54c3028e1f7ff56341828e79d522ddbfab6", + "vendor/packaging/src/packaging/specifiers.py": "f9e37cfb1ceba333a1302c2af605ec6f2fb67801f341af70d347f9271ab8e9cb", + "vendor/packaging/src/packaging/tags.py": "cb6d67388b647f87e4e83b89a005949e682c6b804f4b7f2bb0a2853e6d15b590", + "vendor/packaging/src/packaging/utils.py": "0074d32bf98c4bc4a400507c499615ac8c29b09a456d538422d82fd39640c8aa", + "vendor/packaging/src/packaging/version.py": "af4b2bfdbdaaf743eb5ef831e7981963857ef39ab96fdbeee4d402539f715059", + "vendor/packaging/tests/__init__.py": "b3da0a090db2705757a0445d4b58a669fb9e4a406c2fd92f6f27e085a6ae67d6", + "vendor/packaging/tests/conftest.py": "db1c9380b05876d19711a7ccb9d5e81de45f5cc93367b94137464ad49472514d", + "vendor/packaging/tests/manylinux/build.sh": "f6930bfb34d37f7753987d55113cff4454f80cce7762911cfa3f420d6856ac0a", + "vendor/packaging/tests/manylinux/hello-world-armv7l-armel": "d0946e4b30a9d67f5ee811dddf6227376b2e9e09ac1d7836c7fec9c4825fb7f3", + "vendor/packaging/tests/manylinux/hello-world-armv7l-armhf": "67e5fd8dc9298c96b97aa42f68036f86e707077e4850c5112440fd79d890c560", + "vendor/packaging/tests/manylinux/hello-world-invalid-class": "1ae2af7c78f88a20d4cd69e3d0daaa91444caa0dc9d18c6cc313931524f4b00c", + "vendor/packaging/tests/manylinux/hello-world-invalid-data": "22e7fb680271534efb9f187ba7113e5f4ba93f4e9cda164891d88f1d958d02cf", + "vendor/packaging/tests/manylinux/hello-world-invalid-magic": "7add6a4ffe6d82ee55c8fdbc76151298fa5750149f09d77862195507ecb66504", + "vendor/packaging/tests/manylinux/hello-world-s390x-s390x": "9c62fa176e3ade50bedf2f57e96c16a9ad7c3b541530f33944158e6001894572", + "vendor/packaging/tests/manylinux/hello-world-too-short": "57dca6651be6c3977755336a3533c633c22e4ff6bd99f21f313517e2e0433d68", + "vendor/packaging/tests/manylinux/hello-world-x86_64-amd64": "bf76a3af4839959dce2f88862fafe0696cc05910d230afc2ea4845df8f8e1c21", + "vendor/packaging/tests/manylinux/hello-world-x86_64-i386": "73d1f60fad7910e928e0185b8ff43eb795d81f33952a13a463e4ef407b5aad1d", + "vendor/packaging/tests/manylinux/hello-world-x86_64-x32": "3e9bbb13d68a7ac99a71e019b6b5ebfc296704bc01cc07475e8b9f088ee813ba", + "vendor/packaging/tests/test_tags.py": "a015559c1b895327d5e0170c2cd1e606914b4056d2baeafbaea61b2e9b07b539", + "vendor/packaging/tests/test_utils.py": "74ac2b0c4785428c8393ea27eea36749c90ae10a5b01b039b5c7a29b116f8a4c" + }, + "mutable": [ + "vendor/packaging/src/packaging/tags.py", + "vendor/packaging/src/packaging/utils.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1442-software-languages/tests/fixtures/tag_cases.json b/tasks/candidate-1442-software-languages/tests/fixtures/tag_cases.json new file mode 100644 index 0000000000000000000000000000000000000000..0c616139b6aac115b5b3a695c3855d9039006ae6 --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/fixtures/tag_cases.json @@ -0,0 +1,42 @@ +{ + "invalid_direct": [ + {"tag": "7-none-any", "member": "7"}, + {"tag": "py3.11-none-any", "member": "11"}, + {"tag": "cp311.42-none-any", "member": "42"}, + {"tag": "custom.0-none-any", "member": "0"} + ], + "invalid_wheels": [ + {"filename": "widget-1.0-7-none-any.whl", "member": "7"}, + {"filename": "widget-1.0-py3.11-none-any.whl", "member": "11"}, + {"filename": "widget-1.0-cp311.42-none-any.whl", "member": "42"} + ], + "valid_tags": [ + { + "tag": "py2.py3-none-any", + "expected": ["py2-none-any", "py3-none-any"] + }, + { + "tag": "cp311-cp311.cp311t-manylinux_2_17_x86_64.manylinux2014_x86_64", + "expected": [ + "cp311-cp311-manylinux2014_x86_64", + "cp311-cp311-manylinux_2_17_x86_64", + "cp311-cp311t-manylinux2014_x86_64", + "cp311-cp311t-manylinux_2_17_x86_64" + ] + }, + { + "tag": "cp311-2.7-manylinux_2_17_x86_64", + "expected": [ + "cp311-2-manylinux_2_17_x86_64", + "cp311-7-manylinux_2_17_x86_64" + ] + } + ], + "valid_wheel": { + "filename": "Acme.Widget-1.0-12abc-cp311-abi3-manylinux_2_17_x86_64.whl", + "name": "acme-widget", + "version": "1.0", + "build": [12, "abc"], + "tags": ["cp311-abi3-manylinux_2_17_x86_64"] + } +} diff --git a/tasks/candidate-1442-software-languages/tests/task_test.sh b/tasks/candidate-1442-software-languages/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..32aba8b75c6619c9a7493f49d985eba8084561da --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/task_test.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -euo pipefail +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +set +e +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e + +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi + +exit "$status" diff --git a/tasks/candidate-1442-software-languages/tests/test.sh b/tasks/candidate-1442-software-languages/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1442-software-languages/tests/test_outputs.py b/tasks/candidate-1442-software-languages/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..c11af1ba02a52e2f64ec6837b75d68174052ac3b --- /dev/null +++ b/tasks/candidate-1442-software-languages/tests/test_outputs.py @@ -0,0 +1,131 @@ +from __future__ import annotations + +import hashlib +import json +import py_compile +import sys +from pathlib import Path + +import pytest + + +APP = Path("/app") +PROJECT = APP / "vendor/packaging" +SRC = PROJECT / "src" +FIXTURES = Path("/tests/fixtures") +MUTABLE = { + "src/packaging/tags.py", + "src/packaging/utils.py", +} + +sys.path.insert(0, str(SRC)) +for module_name in list(sys.modules): + if module_name == "packaging" or module_name.startswith("packaging."): + del sys.modules[module_name] + +from packaging.tags import ( # noqa: E402 + InvalidTag, + TooManyTagsError, + parse_tag, +) +from packaging.utils import ( # noqa: E402 + InvalidWheelFilename, + parse_wheel_filename, +) +import packaging # noqa: E402 + + +def _sha256(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def _cases() -> dict[str, object]: + return json.loads((FIXTURES / "tag_cases.json").read_text()) + + +def test_gate_workspace_integrity_and_report() -> None: + immutable = json.loads((FIXTURES / "immutable_hashes.json").read_text()) + base_mutable = json.loads((FIXTURES / "base_mutable_hashes.json").read_text()) + + assert Path(packaging.__file__).resolve().is_relative_to(SRC.resolve()) + for relative_path, expected_hash in immutable.items(): + path = PROJECT / relative_path + assert path.is_file() and not path.is_symlink() + assert _sha256(path) == expected_hash + + for relative_path in MUTABLE: + path = PROJECT / relative_path + assert path.is_file() and not path.is_symlink() + assert _sha256(path) != base_mutable[relative_path] + py_compile.compile(str(path), doraise=True) + + report_path = APP / "repair_report.json" + assert report_path.is_file() and not report_path.is_symlink() + report = json.loads(report_path.read_text()) + assert report["output_schema_version"] == "tbench.packaging_repair_report.v1" + assert report["status"] == "repaired" + assert report["source_files"] == [ + "vendor/packaging/src/packaging/tags.py", + "vendor/packaging/src/packaging/utils.py", + ] + assert report["checks"] == { + "direct_invalid_rejected": True, + "wheel_invalid_wrapped": True, + "valid_compressed_preserved": True, + "abi_platform_preserved": True, + } + + +def test_core_direct_interpreter_members_are_validated() -> None: + cases = _cases() + for case in cases["invalid_direct"]: + with pytest.raises(InvalidTag) as caught: + parse_tag(case["tag"]) + message = str(caught.value).lower() + assert "interpreter" in message + assert repr(case["member"]) in str(caught.value) + + valid_abi = parse_tag("cp311-2.7-manylinux_2_17_x86_64") + assert {tag.abi for tag in valid_abi} == {"2", "7"} + assert {tag.platform for tag in valid_abi} == {"manylinux_2_17_x86_64"} + + +def test_core_wheel_failures_preserve_parser_context() -> None: + cases = _cases() + for case in cases["invalid_wheels"]: + with pytest.raises(InvalidWheelFilename) as caught: + parse_wheel_filename(case["filename"]) + message = str(caught.value) + assert "interpreter" in message.lower() + assert repr(case["member"]) in message + assert case["filename"][:-4] in message + assert caught.value.__cause__ is None + + +def test_core_valid_compressed_tags_match_independent_cross_products() -> None: + cases = _cases() + for case in cases["valid_tags"]: + observed = sorted(str(tag) for tag in parse_tag(case["tag"])) + assert observed == sorted(case["expected"]) + + wheel = cases["valid_wheel"] + name, version, build, tags = parse_wheel_filename(wheel["filename"]) + assert name == wheel["name"] + assert str(version) == wheel["version"] + assert list(build) == wheel["build"] + assert sorted(str(tag) for tag in tags) == sorted(wheel["tags"]) + + +def test_edge_existing_order_empty_and_limit_contracts_survive() -> None: + with pytest.raises(InvalidWheelFilename, match="sorted order"): + parse_wheel_filename( + "widget-1.0-py3.py2-none-any.whl", validate_order=True + ) + + with pytest.raises(InvalidTag, match="empty component"): + parse_tag("py3..py2-none-any") + + with pytest.raises(TooManyTagsError, match="exceeding limit 3"): + parse_tag("py2.py3-cp311.cp311t-any", limit=3) + + assert len(parse_tag("py2.py3-cp311.cp311t-any", limit=4)) == 4 diff --git a/tasks/candidate-1559-ml-evaluation/environment/Dockerfile b/tasks/candidate-1559-ml-evaluation/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..37ca866bdab970332f8c2b13fdd53944853f27d6 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4b0334efbc88b88f371f109114d0a2eb2f90bbffec2e25a7d5bbf1fd3c4e1a4c diff --git a/tasks/candidate-1559-ml-evaluation/environment/setup/setup.sh b/tasks/candidate-1559-ml-evaluation/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1559-ml-evaluation/instruction.md b/tasks/candidate-1559-ml-evaluation/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..538ac316b6c94e0093e73aa24b523711b05e0b06 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/instruction.md @@ -0,0 +1,49 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair adversarial backend feature-matrix validation + +The vendored Fairlearn adversarial backend infers neural-network widths from +feature, target, and sensitive-feature matrices. Its generic backend currently +indexes the feature shape without first enforcing the matrix contract. As a +result, malformed feature data can either fail with an incidental exception or +silently construct a model with the wrong feature semantics. + +Repair the existing source tree under `/app/vendor/fairlearn`. + +Requirements: + +1. In `fairlearn/adversarial/_constants.py`, define the shared `_X_NOT_2D` + error-message template used for this validation. It must format with the + received rank and clearly state that `X` must be two-dimensional. +2. In `fairlearn/adversarial/_backend_engine.py`, import and use that shared + template. `BackendEngine` must reject every `X` whose `ndim` is not exactly + `2` by raising `ValueError` formatted with the actual rank. +3. Perform this validation before inferring widths or constructing either + model. Do not flatten, reshape, squeeze, or otherwise reinterpret invalid + input. +4. Preserve valid behavior: predictor input width is `X.shape[1]`; target and + sensitive-feature widths come from the fitted transformers; warm-start, + loss, optimizer, shuffling, evaluation, and training contracts remain + unchanged. +5. Do not replace or delete the vendored package or diagnostic runner. The + repair must be implemented in both existing modules named above; changing + callers or generating a report without repairing the backend is not a + solution. + +After repairing the source, compile it and run the supplied integration +diagnostic: + +```bash +cd /app/vendor/fairlearn +python3 -m compileall -q fairlearn +cd /app +python3 tools/backend_diagnostics.py --output /app/repair_report.json +``` + +Submit the repaired source tree and `/app/repair_report.json`. The report must +use schema version `fairlearn.backend-diagnostics.v1`, include rejected rank +cases `0`, `1`, `3`, and `4`, and include the valid-path model widths, shuffle +alignment, evaluation result, and training losses produced by the runner. + diff --git a/tasks/candidate-1559-ml-evaluation/task.toml b/tasks/candidate-1559-ml-evaluation/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dc79da9e3fb4869845e7833a6bce5d057b89b331 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1559-ml-evaluation" +description = "MiMo-V2.6-RL terminal task candidate-1559-ml-evaluation" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1559-ml-evaluation" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4b0334efbc88b88f371f109114d0a2eb2f90bbffec2e25a7d5bbf1fd3c4e1a4c" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1559-ml-evaluation/tests/anti_hack_guard.py b/tasks/candidate-1559-ml-evaluation/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1559-ml-evaluation/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1559-ml-evaluation/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..d740ab423afcce770ce5f0f611984a732fd1fd28 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,26 @@ +{ + "artifacts": [ + "repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "tools/backend_diagnostics.py": "724ef1a7b818c3c5afb1109507bb314845deb1ee648902c2cda99e06110715fc", + "vendor/fairlearn/LICENSE": "d5256e70bf84093c7de391e7a5771f37cfb91cb720c308ea983dce6101dc10ab", + "vendor/fairlearn/fairlearn/__init__.py": "b2dad8c30e0300928a4773b81c9c559615333206ea9e5d191bc8fe3da0fbf0d6", + "vendor/fairlearn/fairlearn/adversarial/__init__.py": "9d31025d731dfae6fd6e76c4566264f0d93b0e41e12f30d08b1a1bf4bae92024", + "vendor/fairlearn/fairlearn/adversarial/_adversarial_mitigation.py": "85b39155ac6880aaa2f1760be64103c0cb3e605d05825d84b7d7bca64c376c67", + "vendor/fairlearn/fairlearn/adversarial/_backend_engine.py": "a7f3317fa88a7ca127922e6afcbffc4cb5929aeeb7eb54a727c1f21d286df191", + "vendor/fairlearn/fairlearn/adversarial/_constants.py": "37dce8178b551ce40f339612d551a90cf3ee9b626278decb6f930bbc1e5268b0", + "vendor/fairlearn/fairlearn/adversarial/_preprocessor.py": "50d467e996c8fcdd099434a47af2c75a0dcb0aef81b9eea9f2d2e37126d6f146", + "vendor/fairlearn/fairlearn/adversarial/_pytorch_engine.py": "02a1cc4b7b878e81d99296b9db90e46de0d9e5bda3bae1149061914b5d7c4a2e", + "vendor/fairlearn/fairlearn/adversarial/_tensorflow_engine.py": "e4f3c6a244721182f3da86185b1719ed1e0e98b85b6497c5078550788e12df03", + "vendor/fairlearn/fairlearn/show_versions.py": "13cfb7517245004128995e6d1cd107d5c30f49995e3473fe78a5c26152f9f936", + "vendor/fairlearn/pyproject.toml": "4501522eb9efa48ad6b43ae1ec069e7f1f2212c155efec6d39322d2910768247" + }, + "mutable": [ + "vendor/fairlearn/fairlearn/adversarial/_backend_engine.py", + "vendor/fairlearn/fairlearn/adversarial/_constants.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1559-ml-evaluation/tests/fixtures/protected_files.json b/tasks/candidate-1559-ml-evaluation/tests/fixtures/protected_files.json new file mode 100644 index 0000000000000000000000000000000000000000..4db754e7774e15ad795968452ea6b8cce3dce7ea --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/fixtures/protected_files.json @@ -0,0 +1,12 @@ +{ + "vendor/fairlearn/LICENSE": "d5256e70bf84093c7de391e7a5771f37cfb91cb720c308ea983dce6101dc10ab", + "vendor/fairlearn/pyproject.toml": "4501522eb9efa48ad6b43ae1ec069e7f1f2212c155efec6d39322d2910768247", + "vendor/fairlearn/fairlearn/__init__.py": "b2dad8c30e0300928a4773b81c9c559615333206ea9e5d191bc8fe3da0fbf0d6", + "vendor/fairlearn/fairlearn/show_versions.py": "13cfb7517245004128995e6d1cd107d5c30f49995e3473fe78a5c26152f9f936", + "vendor/fairlearn/fairlearn/adversarial/__init__.py": "9d31025d731dfae6fd6e76c4566264f0d93b0e41e12f30d08b1a1bf4bae92024", + "vendor/fairlearn/fairlearn/adversarial/_adversarial_mitigation.py": "85b39155ac6880aaa2f1760be64103c0cb3e605d05825d84b7d7bca64c376c67", + "vendor/fairlearn/fairlearn/adversarial/_preprocessor.py": "50d467e996c8fcdd099434a47af2c75a0dcb0aef81b9eea9f2d2e37126d6f146", + "vendor/fairlearn/fairlearn/adversarial/_pytorch_engine.py": "02a1cc4b7b878e81d99296b9db90e46de0d9e5bda3bae1149061914b5d7c4a2e", + "vendor/fairlearn/fairlearn/adversarial/_tensorflow_engine.py": "e4f3c6a244721182f3da86185b1719ed1e0e98b85b6497c5078550788e12df03", + "tools/backend_diagnostics.py": "724ef1a7b818c3c5afb1109507bb314845deb1ee648902c2cda99e06110715fc" +} diff --git a/tasks/candidate-1559-ml-evaluation/tests/fixtures/regression_cases.json b/tasks/candidate-1559-ml-evaluation/tests/fixtures/regression_cases.json new file mode 100644 index 0000000000000000000000000000000000000000..0fb9de7cb680470b81140eb41f911d43b94faff5 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/fixtures/regression_cases.json @@ -0,0 +1,17 @@ +{ + "schema_version": "fairlearn.private-regression.v1", + "invalid_ranks": [0, 1, 3, 5], + "valid_matrix": [ + [2.0, -1.0, 4.0, 0.5, 3.0, 1.0, -2.0], + [0.0, 5.0, 2.0, -1.0, 1.5, 2.5, 4.0], + [3.0, 1.0, -3.0, 2.0, 0.0, 4.0, 1.0], + [-2.0, 2.0, 1.0, 3.0, 5.0, -1.0, 0.0], + [1.0, 0.0, 2.0, 4.0, -2.0, 3.0, 5.0] + ], + "target_width": 2, + "sensitive_width": 3, + "predictor_hidden": [5], + "adversary_hidden": [4], + "pass_y": true +} + diff --git a/tasks/candidate-1559-ml-evaluation/tests/task_test.sh b/tasks/candidate-1559-ml-evaluation/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bbc1080eee98219d1efddf0100e07fedcb63584 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/task_test.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -u +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit 0 + diff --git a/tasks/candidate-1559-ml-evaluation/tests/test.sh b/tasks/candidate-1559-ml-evaluation/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1559-ml-evaluation/tests/test_outputs.py b/tasks/candidate-1559-ml-evaluation/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..1b319c2863c837af4c283cc7ce779819f287b567 --- /dev/null +++ b/tasks/candidate-1559-ml-evaluation/tests/test_outputs.py @@ -0,0 +1,197 @@ +import hashlib +import json +import sys +from pathlib import Path +from types import SimpleNamespace + +import numpy as np +import pytest + +APP = Path("/app") +FIXTURES = Path("/tests/fixtures") +PACKAGE_ROOT = APP / "vendor/fairlearn" +sys.path.insert(0, str(PACKAGE_ROOT)) + +from fairlearn.adversarial import _backend_engine as backend_module # noqa: E402 +from fairlearn.adversarial import _constants as constants_module # noqa: E402 + +BackendEngine = backend_module.BackendEngine + + +class TrackingModel: + def __init__(self, nodes): + self.nodes = list(nodes) + + +class TrackingOptimizer: + def __init__(self, model): + self.model = model + + +class TrackingEngine(BackendEngine): + model_class = TrackingModel + optim_class = TrackingOptimizer + build_events = [] + + def get_model(self, list_nodes): + self.build_events.append(list(list_nodes)) + return TrackingModel(list_nodes) + + def get_loss(self, dist_type): + return lambda prediction, target: float(np.mean(np.abs(prediction - target))) + + def get_optimizer(self, optim_param, model): + return TrackingOptimizer(model) + + def evaluate(self, X): + return np.sum(np.asarray(X, dtype=float), axis=1, keepdims=True) + + def train_step(self, X, Y, A): + predicted = self.evaluate(X) + return ( + float(np.mean(np.abs(predicted - Y))), + float(np.mean(np.abs(Y[:, :1] - A[:, :1]))), + ) + + +def fixture_cases(): + return json.loads((FIXTURES / "regression_cases.json").read_text()) + + +def make_base(cases=None, **overrides): + cases = cases or fixture_cases() + values = dict( + _y_transform=SimpleNamespace(n_features_out_=cases["target_width"]), + _sf_transform=SimpleNamespace(n_features_out_=cases["sensitive_width"]), + predictor_model=cases["predictor_hidden"], + adversary_model=cases["adversary_hidden"], + predictor_loss_="continuous", + adversary_loss_="continuous", + predictor_optimizer="private", + adversary_optimizer="private", + warm_start=False, + pass_y_=cases["pass_y"], + random_state_=2390, + ) + values.update(overrides) + return SimpleNamespace(**values) + + +def test_gate_required_tree_compiles_and_report_exists(): + backend_path = PACKAGE_ROOT / "fairlearn/adversarial/_backend_engine.py" + constants_path = PACKAGE_ROOT / "fairlearn/adversarial/_constants.py" + report_path = APP / "repair_report.json" + assert backend_path.is_file() + assert constants_path.is_file() + assert report_path.is_file() + compile(backend_path.read_text(), str(backend_path), "exec") + compile(constants_path.read_text(), str(constants_path), "exec") + + +def test_gate_immutable_source_and_diagnostic_are_intact(): + expected = json.loads((FIXTURES / "protected_files.json").read_text()) + assert len(expected) >= 10 + for relative_path, expected_hash in expected.items(): + candidate = APP / relative_path + assert candidate.is_file(), f"protected source asset missing: {relative_path}" + actual_hash = hashlib.sha256(candidate.read_bytes()).hexdigest() + assert actual_hash == expected_hash, f"protected source asset changed: {relative_path}" + + +def test_core_invalid_ranks_use_shared_error_before_model_construction(): + cases = fixture_cases() + assert hasattr(constants_module, "_X_NOT_2D") + template = constants_module._X_NOT_2D + assert backend_module._X_NOT_2D == template + assert "two-dimensional" in template.lower() + for rank in cases["invalid_ranks"]: + TrackingEngine.build_events = [] + shape = (2,) * rank + X = np.zeros(shape) if shape else np.array(0.0) + with pytest.raises(ValueError) as captured: + TrackingEngine(make_base(cases), X, np.zeros((2, 2)), np.zeros((2, 3))) + assert str(captured.value) == template.format(rank) + assert str(rank) in str(captured.value) + assert TrackingEngine.build_events == [] + + +def test_core_hidden_valid_matrix_infers_all_interface_widths(): + cases = fixture_cases() + X = np.asarray(cases["valid_matrix"], dtype=float) + Y = np.zeros((len(X), cases["target_width"])) + A = np.zeros((len(X), cases["sensitive_width"])) + TrackingEngine.build_events = [] + engine = TrackingEngine(make_base(cases), X, Y, A) + expected_predictor = [X.shape[1], *cases["predictor_hidden"], cases["target_width"]] + adversary_input = cases["target_width"] * 2 + expected_adversary = [ + adversary_input, + *cases["adversary_hidden"], + cases["sensitive_width"], + ] + assert engine.predictor_model.nodes == expected_predictor + assert engine.adversary_model.nodes == expected_adversary + assert TrackingEngine.build_events == [expected_predictor, expected_adversary] + assert isinstance(engine.predictor_optimizer, TrackingOptimizer) + assert isinstance(engine.adversary_optimizer, TrackingOptimizer) + + +def test_core_valid_downstream_shuffle_evaluate_and_train_are_preserved(): + X = np.array([[1.0, 2.0], [4.0, 5.0], [7.0, 8.0], [10.0, 11.0]]) + Y = np.array([[3.0], [9.0], [15.0], [21.0]]) + A = np.array([[1.0], [4.0], [7.0], [10.0]]) + cases = fixture_cases() + base = make_base( + cases, + _y_transform=SimpleNamespace(n_features_out_=1), + _sf_transform=SimpleNamespace(n_features_out_=1), + pass_y_=False, + ) + engine = TrackingEngine(base, X, Y, A) + shuffled_X, shuffled_Y, shuffled_A = engine.shuffle(X, Y, A) + assert sorted(map(tuple, shuffled_X)) == sorted(map(tuple, X)) + assert all(row.sum() == target[0] for row, target in zip(shuffled_X, shuffled_Y)) + assert all(row[0] == sensitive[0] for row, sensitive in zip(shuffled_X, shuffled_A)) + np.testing.assert_allclose(engine.evaluate(X).ravel(), Y.ravel(), rtol=0, atol=1e-12) + np.testing.assert_allclose(engine.train_step(X, Y, A), [0.0, 6.5], rtol=0, atol=1e-12) + + +def test_edge_rank_two_single_column_and_warm_start_remain_valid(): + cases = fixture_cases() + old_predictor = TrackingModel([1, 2]) + old_adversary = TrackingModel([2, 1]) + previous = SimpleNamespace( + predictor_model=old_predictor, + adversary_model=old_adversary, + ) + base = make_base( + cases, + _y_transform=SimpleNamespace(n_features_out_=1), + _sf_transform=SimpleNamespace(n_features_out_=1), + warm_start=True, + backendEngine_=previous, + pass_y_=False, + ) + X = np.arange(4.0).reshape(4, 1) + TrackingEngine.build_events = [] + engine = TrackingEngine(base, X, np.zeros((4, 1)), np.zeros((4, 1))) + assert engine.predictor_model is old_predictor + assert engine.adversary_model is old_adversary + assert TrackingEngine.build_events == [] + + +def test_edge_diagnostic_report_matches_independent_expectations(): + report = json.loads((APP / "repair_report.json").read_text()) + assert report["schema_version"] == "fairlearn.backend-diagnostics.v1" + invalid = {item["rank"]: item for item in report["invalid_rank_cases"]} + assert set(invalid) == {0, 1, 3, 4} + assert all(item["status"] == "rejected" for item in invalid.values()) + assert all(item["error_type"] == "ValueError" for item in invalid.values()) + assert all(str(rank) in item["message"] for rank, item in invalid.items()) + valid = report["valid_case"] + assert valid["input_shape"] == [3, 3] + assert valid["predictor_nodes"] == [3, 4, 1, "sigmoid"] + assert valid["adversary_nodes"] == [1, 3, 1, "sigmoid"] + assert valid["shuffle_alignment"] is True + np.testing.assert_allclose(valid["evaluation"], [6.0, 15.0, 24.0], rtol=0, atol=1e-12) + np.testing.assert_allclose(valid["training_losses"], [0.5, 15.166666666666666], rtol=0, atol=1e-12) diff --git a/tasks/candidate-1601-software-data-engineering/environment/Dockerfile b/tasks/candidate-1601-software-data-engineering/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..bbc763b346b7c63f7cfe2452feadd428220741a9 --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2490cc50a00a3f3589109540e80053457897ec9e48d840f6d1a95712c45f17a1 diff --git a/tasks/candidate-1601-software-data-engineering/environment/setup/setup.sh b/tasks/candidate-1601-software-data-engineering/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1601-software-data-engineering/instruction.md b/tasks/candidate-1601-software-data-engineering/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9635471a77d4bbbc38cf9c8b2d20cea9e8825d38 --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/instruction.md @@ -0,0 +1,48 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair uneven-row joins in petl + +An ETL pipeline built on the frozen petl tree in `/app/vendor/petl` receives +iterable tables whose data-row widths do not always match their headers. The +current relational join implementations can raise `IndexError`, shift a value +under the wrong output field, or emit a row shorter or longer than the output +header. + +Repair the existing implementation in both: + +- `/app/vendor/petl/petl/transform/joins.py` +- `/app/vendor/petl/petl/transform/hashjoins.py` + +The public sort-based and hash-based join families must share these semantics: + +1. Before relational processing, each data row behaves as a row of exactly its + source header width. Missing positions use the operation's `missing` value + when that API has one, otherwise `None`. Values beyond the source header do + not leak into the joined schema. +2. Key selection by field name, index, natural key, distinct `lkey`/`rkey`, or + compound key remains correct even when a key component is absent from a + short row. +3. Inner, left, right, outer, lookup, anti, and cross joins preserve documented + match cardinality and duplicate-key behavior. The equivalent hash joins + must agree semantically while retaining their normal input-order behavior. +4. Prefix handling, custom missing sentinels, lazy iteration, cached and + uncached execution, and repeated materialization continue to work. Do not + mutate caller-owned input rows. + +Do not modify the visible workflow, existing tests, or other library modules. +The verifier protects those assets and exercises additional private tables. + +After repairing the source, run: + +```sh +cd /app +python3 -m py_compile vendor/petl/petl/transform/joins.py vendor/petl/petl/transform/hashjoins.py +python3 workflow.py /app/output.json +``` + +`/app/output.json` must use schema `petl-uneven-joins.v1` with the keys +`case_order`, `cases`, `row_counts`, and `all_rectangular`; it must be produced +by the supplied workflow from the repaired source tree. + diff --git a/tasks/candidate-1601-software-data-engineering/task.toml b/tasks/candidate-1601-software-data-engineering/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..db299cb4d2ab50005826ed311c713c3cb30a8073 --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1601-software-data-engineering" +description = "MiMo-V2.6-RL terminal task candidate-1601-software-data-engineering" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1601-software-data-engineering" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:2490cc50a00a3f3589109540e80053457897ec9e48d840f6d1a95712c45f17a1" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1601-software-data-engineering/tests/anti_hack_guard.py b/tasks/candidate-1601-software-data-engineering/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1601-software-data-engineering/tests/fixtures/cases.json b/tasks/candidate-1601-software-data-engineering/tests/fixtures/cases.json new file mode 100644 index 0000000000000000000000000000000000000000..b8b570738c7bf93fcae1af7e9665029801165509 --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/tests/fixtures/cases.json @@ -0,0 +1,29 @@ +{ + "left": [ + ["account_id", "region", "amount", "note"], + [2, "west", 20], + [1, "east", 10, "first"], + [1, "east"], + [4, "north", 40, "solo", "discarded"] + ], + "right": [ + ["dim_id", "segment", "risk"], + [1, "retail", "low"], + [1, "priority"], + [3, "new", "high"], + [4, "legacy"] + ], + "compound_left": [ + ["site", "day", "value"], + ["A", 1, 10], + ["A"], + ["B", 2] + ], + "compound_right": [ + ["plant", "date", "flag", "owner"], + ["A", 1, "ok"], + ["A", null, "missing-day", "ops"], + ["B", 2] + ] +} + diff --git a/tasks/candidate-1601-software-data-engineering/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1601-software-data-engineering/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..5d3dd82c415a8016e707ba2efabb61e294ccfa0e --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,151 @@ +{ + "artifacts": [ + "vendor/petl/petl/transform/joins.py", + "vendor/petl/petl/transform/hashjoins.py", + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "README.md": "fab753f917cb4377addd5dcc57861a8172f7f193a262f3163e72d2713cd18662", + "vendor/petl/LICENSE.txt": "229ce990bc98e631baf741926f7f237f303f8bc2166742ab5f0f406eb76f0162", + "vendor/petl/README.rst": "0ab0f63f94543de936a8b7c102126f865d47682242207f22a7f5138a97149f8d", + "vendor/petl/petl/__init__.py": "e86a2a7e6848609ea4fd3d3fb00c8d8c59a968a920a9cdf5e25f95f07dc632ba", + "vendor/petl/petl/comparison.py": "91b4b449fbcffe242f07af593b9d2bd0850852580dbcfadd978fbff219b2a6e3", + "vendor/petl/petl/compat.py": "22b8e7c74f150f60f30db5c5144f23ea846360e9823d31723cd7462bfdc5c353", + "vendor/petl/petl/config.py": "5f08e3ccf5c1016f9579ec1db02f8091b92bc21c77cf30919afa198e1cbe5f46", + "vendor/petl/petl/errors.py": "ea62cba5b647a7f3670afb5f097502bfd65a27c7f0d6990e30f259c73666b411", + "vendor/petl/petl/io/__init__.py": "461beee51c7437852097f6bd659e0635f2427f00c106a5b1044a4b84aa3ae1c0", + "vendor/petl/petl/io/avro.py": "22bf288b24756edaba41b4e65f86225658d50565fe822f48bb5a549d16ac2cfb", + "vendor/petl/petl/io/base.py": "9c43767b9f78572a9594bc1eaf500e69d56f887ab07c5ac11bb1c84aeda3d68e", + "vendor/petl/petl/io/bcolz.py": "3fd08b5074048cb95c0e2664df316a6ad4441073412e7d4e55d9d31738775ff6", + "vendor/petl/petl/io/csv.py": "41a236d11aa17a6c88232576ff150cb21b50f8a616345978c371302b42fc8e6f", + "vendor/petl/petl/io/csv_py2.py": "12604a82e38d2cd03844827ac5d7455860ffd7d605ec700d7038bd97a478f8a4", + "vendor/petl/petl/io/csv_py3.py": "44fe3b9fdab24846e5cf8bf70966d5b2bc45a1405018bc1f50f4d41a46e3e4e5", + "vendor/petl/petl/io/db.py": "4f0549aed2abff9896f5ebe805239c5aea07260b4ee2713913669d7447fb1321", + "vendor/petl/petl/io/db_create.py": "d910b346cff5b2d063ae988b753dd51b730aa39675bace9e42bd85dbec14071a", + "vendor/petl/petl/io/db_utils.py": "e2e5115e50fe0257f1be3a84eb8adbf9874d398274b20d0724b5a36122d1bf51", + "vendor/petl/petl/io/gsheet.py": "83ecb1494ad6cb5e62851b924ba9394c28c86b329f5857edc50653df18a2ed42", + "vendor/petl/petl/io/html.py": "5c60d5930e9bc6c8793c9f1e4d5c1f2f363d3f06b0664759af76ebd6794fc5af", + "vendor/petl/petl/io/json.py": "085a150e4f94d7850a7c02714abee1d6ec4fa3bf06eb5f68a504ffad4a506166", + "vendor/petl/petl/io/numpy.py": "b16a588f06290d8daa4ecc46696b1df6641fd6d07be49673d9b124b92a0cb48f", + "vendor/petl/petl/io/pandas.py": "645876d06e259b40582812ae255b414e3da959df880ae84d119da850e54c5315", + "vendor/petl/petl/io/pickle.py": "00e8ce8b678dee734c86ebfd848b585fca3100a8462da6090634feebc6a66164", + "vendor/petl/petl/io/pytables.py": "8465eb869f94ecfa50078697616c426147025324077eb0beb0fd17431daf2012", + "vendor/petl/petl/io/remotes.py": "c0d2adf9f698e566e2895e3b40d50d382b4f41024ce046d57d936d0644cbae07", + "vendor/petl/petl/io/sources.py": "ef40a98159428fee4220255524e7ed656c893de2dacf17285b08b892852f6788", + "vendor/petl/petl/io/text.py": "58b4786ffa14d1e9ca0253a22e1521c52eba9291cd4b1c473bf22415cb0c6a90", + "vendor/petl/petl/io/whoosh.py": "bf86ae43412e07ed6a6d539894ba4cb675fb0c24bfd8086c8cf952dc3e959a58", + "vendor/petl/petl/io/xls.py": "fa73c2150a3e4fa0850fd4536267a5974738be1ca0e1a15d06c5531099d1f95b", + "vendor/petl/petl/io/xlsx.py": "8bad13e82154ec670b8d71c3d93e33b641d3fa569d2f567bbe400177e5d91690", + "vendor/petl/petl/io/xlutils_view.py": "ff5cfda4263414e6421c23407d829799b24fc419652ccb38275e40bcef1483b9", + "vendor/petl/petl/io/xml.py": "99e371906f4c8110cd3eb06f00f7fc9f9b550310b326534841ce0bacf5bf62d3", + "vendor/petl/petl/test/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/petl/petl/test/conftest.py": "1f0fec5821f7a9076bc6ae525c5bb7db9dd2141b30a2e2995b94e06f110556e0", + "vendor/petl/petl/test/failonerror.py": "fc878a521661cfd10c64a34b26e683ba6e9afc5fdd90b4a779895b98f4e39bdf", + "vendor/petl/petl/test/helpers.py": "ba0af07c4a605b59688bb9a3873289c69c3506115fdffaaaff263503a180f3d7", + "vendor/petl/petl/test/io/__init__.py": "b409d7b2819b6d184e08ba2f6d0dbe32130f4716255b5230ffc4db36ab529688", + "vendor/petl/petl/test/io/test_avro.py": "9d612ca566956444eff2100ae2206399e0c878118a987d9ef788fcf0168bdd1f", + "vendor/petl/petl/test/io/test_avro_schemas.py": "ac563e3464dd4b2d032487957bd225b431b250ba2799571dd1ea0d79bd458df0", + "vendor/petl/petl/test/io/test_bcolz.py": "622d11718541b9794d29bee517d7bb59d1838fde3ab704230dced3b7c93f7a27", + "vendor/petl/petl/test/io/test_csv.py": "efa75dc02f4e09ac01b6a0ab96bb07db957adc67ecf3dca18950aeaba33793b6", + "vendor/petl/petl/test/io/test_csv_unicode.py": "2ab286b9e0a233640e1e788d89e0f6712627b2ea05bd795b7aa195bc72806e9a", + "vendor/petl/petl/test/io/test_db.py": "754505b8b52697dbb26bf11faa8b187e29d6c9c5830cb6c6b9a746957289f74d", + "vendor/petl/petl/test/io/test_db_create.py": "ced5ed9b8a47824ae03442e784e43e993020c3e4c9539099892fdc12b3e6edf5", + "vendor/petl/petl/test/io/test_db_server.py": "43f5a0d4edb45add45d7755636204d93abc981cc70ff369609ce422af066354d", + "vendor/petl/petl/test/io/test_gsheet.py": "83268aa5dbadb996196f054e9332e73309a39361b8914bd260fe85f50cd1f73b", + "vendor/petl/petl/test/io/test_html.py": "c8884066d53ea81f46a0889371a408cdb5f5c284ea06fc5a6a24ad0972691ee9", + "vendor/petl/petl/test/io/test_html_unicode.py": "f1b5fad185da409042af417ac5be1724054a2bb34d170d3b2de56c06fce4d829", + "vendor/petl/petl/test/io/test_json.py": "cdb95b82ee3b18b0b9a13ecf3e9b91a857f130797be7310acd613f9958420cf0", + "vendor/petl/petl/test/io/test_json_unicode.py": "cfd436a73f527317d4afd2969f1b072b79e7d06521086c55e6ebfe2947d5adcf", + "vendor/petl/petl/test/io/test_jsonl.py": "c8f19d00edebf5577e103aca4dbaf2387da5635e9c8ac21b17491117f0a2a049", + "vendor/petl/petl/test/io/test_numpy.py": "09ec72a7099193357d14c172c3e5ba3ba98390a2e9e5b8e3ce4fbd3b172c4c24", + "vendor/petl/petl/test/io/test_pandas.py": "4326a1dd967aa9f8e9a0cb313c82a2056f5985cc983f9a47475605394290550d", + "vendor/petl/petl/test/io/test_pickle.py": "86e2a01bd5d72403033f67246a671e81bd0971e4f93d681f2d6927290ee2078c", + "vendor/petl/petl/test/io/test_pytables.py": "7283ec951732ce657d27e8df287a2fa2e49e1f671a5fd3878578aff60817c8bb", + "vendor/petl/petl/test/io/test_remotes.py": "8c95a3d4985b58c2d741656f776d56ffb42c1662d6402e32c6cd9b8f8ae1c4bd", + "vendor/petl/petl/test/io/test_sources.py": "a61891b1508e7f673bfcdc682f51f7d49bce974634ab43950cab0b47c547f675", + "vendor/petl/petl/test/io/test_sqlite3.py": "17caac927b905ebcd8dd6f6d2c1950b45b7432d31a6b7b233b92443495cbb304", + "vendor/petl/petl/test/io/test_tees.py": "0d7968009eb684d4a67f2e57e87eacfeacef1ab39c33e36d8fc944ad2bd37ea9", + "vendor/petl/petl/test/io/test_text.py": "3ae6361710d97cecb293c502539be295b3b240b575024cfcb6721175f59341f9", + "vendor/petl/petl/test/io/test_text_unicode.py": "9a541cf3b31245eb33936d5a87a663db3476f6156b407a7e4a5376c3afeb1947", + "vendor/petl/petl/test/io/test_whoosh.py": "e4019dd7f6b8ed2c9335fa5eaab633e1467eca926c6301b40268bc5ee7d9c13a", + "vendor/petl/petl/test/io/test_xls.py": "ab7b50424ea4fced7d7aa58ff3625b4fa5260222bfa7d8c6bffad275edc28e78", + "vendor/petl/petl/test/io/test_xlsx.py": "237446a1b58d48b74001d37c1eee0013dc68b13a4f8b23aff4abfb966e683c1f", + "vendor/petl/petl/test/io/test_xml.py": "b1e30bfa58031fd22b18c8bade95063f9c84e44152049615db569999b4c976ec", + "vendor/petl/petl/test/resources/test.xls": "ce2b34cfb7764bca30c315c06c80427d10a30fd962161c84ec10b79a02dd7dd1", + "vendor/petl/petl/test/resources/test.xlsx": "608dfeff0c7013ee3493960b107ee616d7a3b5766a3142af4cfaac1e9d071976", + "vendor/petl/petl/test/resources/test.xml": "59e7ea8fa325794aa281d2e6a4577158d5c1e664d79d3813d63cfab3c43365b5", + "vendor/petl/petl/test/test_comparison.py": "2c3c7e9f5e0852255f2b2e3687d2cd162004a1022efba01e45ec7e9055817ac4", + "vendor/petl/petl/test/test_fluent.py": "f56159d1eb27e567035fea73b47c256f704c66f951dc851c4a4e04719afb38f6", + "vendor/petl/petl/test/test_helpers.py": "778503e2f58a43803f604061144d7538c2543dfc3b6e620d162e68f1c2379b63", + "vendor/petl/petl/test/test_interactive.py": "bd545630a10173242a6fe3cd2c8f54eecfd1c941fddb22c3c6f968038dbb167f", + "vendor/petl/petl/test/transform/__init__.py": "b409d7b2819b6d184e08ba2f6d0dbe32130f4716255b5230ffc4db36ab529688", + "vendor/petl/petl/test/transform/test_basics.py": "5c8c5e2251ec4251e7ab44e3f17d93659bc1b7e923bd953fbdf759261c9dde5e", + "vendor/petl/petl/test/transform/test_conversions.py": "ce57294a13bb54e40d617c52ef355d7bacff2b96c34325500d68a9188f69f2a2", + "vendor/petl/petl/test/transform/test_dedup.py": "927f6a0d5fc14a730e3a62ba3e8c91d6b0292387b28f92b5c960355f9ed9aba4", + "vendor/petl/petl/test/transform/test_fills.py": "ed48a4dc866f8c5e059422d1c7b4f8ffe2b9ae3d2b1d1b0c4689e3bc622c7e3e", + "vendor/petl/petl/test/transform/test_headers.py": "ea6146061b44f7c83311922ef9de962e18de097a7624fb30c22e1d0894433b5e", + "vendor/petl/petl/test/transform/test_intervals.py": "ab6d721fa859bc126690d482a41ae751a4b4eaf6a5e23efd7063692459036a9c", + "vendor/petl/petl/test/transform/test_joins.py": "46a4e38e2dbc85d9222c611f311c47693698abe57c350c08aa6b9760431581d6", + "vendor/petl/petl/test/transform/test_maps.py": "0dc03c5112fac38a449490dfa159d28afd977d6e10e95bdbaff6c04eae6bbbff", + "vendor/petl/petl/test/transform/test_reductions.py": "8226dfb26ebd41f39209b80f487a386b1bc84c53fd45e26450b3517534157c83", + "vendor/petl/petl/test/transform/test_regex.py": "cddbd1a580b6629c1af3472a34207e5ae9ac40a5acb53b57620a84a65d30d46e", + "vendor/petl/petl/test/transform/test_reshape.py": "940fe2d0a43b279196f060019340429000668e158541da314839b3404ad7b0f1", + "vendor/petl/petl/test/transform/test_selects.py": "6c4c1a0c06200de0f858d865247d10b94ee36c743f85f07387c31385ebe3c012", + "vendor/petl/petl/test/transform/test_setops.py": "d26ee9642081a65324f704a310b098c618521ea68cd1cc45af8932fd5ac55064", + "vendor/petl/petl/test/transform/test_sorts.py": "2b9216f029dcb1215da9ecf4c41e8e8af9e614fa30154ee9d0406c8fd675cc1f", + "vendor/petl/petl/test/transform/test_unpacks.py": "7c9369360825f771bcb48a289d76d0249c15952578dd009f503f1f94c69668d9", + "vendor/petl/petl/test/transform/test_validation.py": "4dbff0a0b5902b44cb5304131ff722cf4bc8be48d8dfa6012c1c4c34f773aae5", + "vendor/petl/petl/test/util/__init__.py": "4137243893d1da9b9fb877034fbcf41a43dee67e38def7f22b5115cee2a71913", + "vendor/petl/petl/test/util/test_base.py": "6c450ef6cd73a4742de95fcd9b02b06af029a21f03229878c4ef98aef102ca86", + "vendor/petl/petl/test/util/test_counting.py": "e41b08dc9034981afcdb37f40b313c5f02b7a82ce2849b90cf8ab7f34ab1c2f5", + "vendor/petl/petl/test/util/test_lookups.py": "c4cfea17b9c6d5fa248f7f06e9810bf835a878b2b2a8bacc0b9c567a39f326fd", + "vendor/petl/petl/test/util/test_materialise.py": "3c8de6010748cbf2a9d4f0de447293a490eb3659c82ca40ffb33dca72d8cf589", + "vendor/petl/petl/test/util/test_misc.py": "0795853a84bbdbef13295722231795c05323fa17575bca34ef9781adf968a0b6", + "vendor/petl/petl/test/util/test_parsers.py": "67a0f5322c6d679661814bc8e8137d464b9401062123755c98039aa3df8ede29", + "vendor/petl/petl/test/util/test_random.py": "00f856e4b7c14c33945fcfb8be669b5a9294e29a0a26875e9a687fb824fb0d6e", + "vendor/petl/petl/test/util/test_statistics.py": "a07527bbacc7f4eb02b17de11e9f1e0e0b19ff4b27ad87c0a9b21b007fc30b6b", + "vendor/petl/petl/test/util/test_timing.py": "eaacfc65433f77271ee56abca072305d9d9717e833e20fb5549cb8002043b1b1", + "vendor/petl/petl/test/util/test_vis.py": "1f5d1ba402000c16968bd033ae0311b3658e580aa2a790f13224199690c767ee", + "vendor/petl/petl/transform/__init__.py": "0283aed158196edead2f30fa2151a983294ca92d2993a31fa728ab141f6e85ac", + "vendor/petl/petl/transform/basics.py": "861d87a6010b90d5fe117630e8c92a08a2bc0c31d8748016ac62214744bcdcf5", + "vendor/petl/petl/transform/conversions.py": "8e4346ba7cf7709016d2962e26b8d784b5cdc05d34374a4c71e9a07516ad85d4", + "vendor/petl/petl/transform/dedup.py": "32585f1cc73864baa0b4443b1172949a1da12da9a2a03747d79cc450bc68a10c", + "vendor/petl/petl/transform/fills.py": "36ac661e7d60fc949e87c341a1d699d90845541d95e3a776f68dcc61400475ef", + "vendor/petl/petl/transform/hashjoins.py": "8d7d96920b3f566d4ba56507b73daf4dc472d6144241567c90c23c85de98e629", + "vendor/petl/petl/transform/headers.py": "68f9e496ec8a055392baf2b71a1e1a6c5fa975a885006400d2c9644143d9674e", + "vendor/petl/petl/transform/intervals.py": "8da053e0262f4596e07889fc237f182b1e45dbc74c0c5b3cc8f58cfbbfc30f28", + "vendor/petl/petl/transform/joins.py": "075477145cd182339a061d7b9b6b6e1128f335695200f8a6ab545c18200e3e8d", + "vendor/petl/petl/transform/maps.py": "5be3d3979f15a35990749aa621f1989f1d2956e7a807b65fed843e0cb7257601", + "vendor/petl/petl/transform/reductions.py": "6a775192b57c0d6a6e336cd20bcaa9e6e759f22a50bd2dd9d787ebaa380b0ff3", + "vendor/petl/petl/transform/regex.py": "ba20e090cdb45db85ebd610b6fbf14b9b744cb0d24b46a5d5c93cd6664522070", + "vendor/petl/petl/transform/reshape.py": "01138dcc88b478262fbd97a00bd7c08415dd582a28d2bb08a79d3d6748de80b6", + "vendor/petl/petl/transform/selects.py": "d13b71719a1890b930eb464e717ea1e637d0feb09734ac11d2828f588863e4aa", + "vendor/petl/petl/transform/setops.py": "71e8c5a4ae225ea28f364bb09b6590fabd88c7d86e2d7e7c5debe35ef7c67bed", + "vendor/petl/petl/transform/sorts.py": "4c4fb426b9c937342af1f788d9daafd0f63f294afcf1414affff7441d7c19078", + "vendor/petl/petl/transform/unpacks.py": "198ab9519bde9b783d520e77640818e2c7207f8a19cef8ebd87951497c23be75", + "vendor/petl/petl/transform/validation.py": "432873068ee6339b6a326912f0b945f31fbec450a97cefc0e085533808ad4828", + "vendor/petl/petl/util/__init__.py": "2ec41e5e7761192f701cca40fd3aae321f13b13b32dbcf7e9523a4f774896cf7", + "vendor/petl/petl/util/base.py": "53f78ab3cce31fc8826f5973915c1ed9ae83fb714b6c5dbcec52ca441f5f86fa", + "vendor/petl/petl/util/counting.py": "5426f3ac00e26eda7709b9b781bdd9b2e667a2b3c827d66d6c5fddd70a00dc6a", + "vendor/petl/petl/util/lookups.py": "56217a6ee9e1ea676ece69a6971cfbdae16a530491bb9f2d92f97134c5d273a9", + "vendor/petl/petl/util/materialise.py": "45849d9929fb08f3d15a4e00bf4bc1d1d1e12f054a7f2461f3da88a099902762", + "vendor/petl/petl/util/misc.py": "4c5807fcee5016b0e6ee2f22ce5051109d51746b501b3ba1a34120f7c4d5db96", + "vendor/petl/petl/util/parsers.py": "aa250d11c0d383a42a60912efbe5d510c87f9394ee93bccf03f35793b172bb63", + "vendor/petl/petl/util/random.py": "227e351f57e333e549e21b1a97fce48f04eb9726ac4fd2b65e34065bf43420ec", + "vendor/petl/petl/util/statistics.py": "2bf45bed9647ac8174f2cb80b8eb01145aee5e041941c00a88fac3964f19016e", + "vendor/petl/petl/util/timing.py": "46f19f128510d6d00f3101af3a2d5c5c63439106d330d2ae634c6466c32a4ae3", + "vendor/petl/petl/util/vis.py": "4ec1b23fbd5164aa18d3449db64836d3d388a12f88c5ce0d716d35d1301e4b0c", + "vendor/petl/petl/version.py": "bf40c3d3f47d31d1a44747241cf423cece2aa45086a5edb5b675de4312f27f02", + "vendor/petl/pyproject.toml": "f2139a31258216a86096be0f4c937fef131a58f73ad7f4f20488aa56a219358f", + "vendor/petl/setup.py": "3836b1e433162859aa03fea0998651a6dffc85bda65b54effdecd60431a303d6", + "vendor/petl/tox.ini": "54de3915c541b8425b7be865b4d78980b82e90310fe9e2c225e6964908530fb3", + "workflow.py": "cd928d214a71462047f39b4da1b6a1a90fa086b90f3a5efbea0b8e2b538af157" + }, + "mutable": [ + "vendor/petl/petl/transform/joins.py", + "vendor/petl/petl/transform/hashjoins.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1601-software-data-engineering/tests/task_test.sh b/tasks/candidate-1601-software-data-engineering/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4db88e810756a069cc45ec40e5b21418c1602199 --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/tests/task_test.sh @@ -0,0 +1,30 @@ +#!/bin/sh +set -eu +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +set +e +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e + +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit 0 + diff --git a/tasks/candidate-1601-software-data-engineering/tests/test.sh b/tasks/candidate-1601-software-data-engineering/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1601-software-data-engineering/tests/test_outputs.py b/tasks/candidate-1601-software-data-engineering/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..6934c6290aaef8e2979f091ca3dc856d4066386a --- /dev/null +++ b/tasks/candidate-1601-software-data-engineering/tests/test_outputs.py @@ -0,0 +1,293 @@ +import copy +import hashlib +import json +import os +import subprocess +import sys +from pathlib import Path + +import pytest + + +APP = Path(os.environ.get("APP_ROOT", "/app")) +SOURCE = APP / "vendor" / "petl" +FIXTURES = Path(__file__).parent / "fixtures" +OUTPUT = APP / "output.json" + +PROTECTED_HASHES = { + "workflow.py": "cd928d214a71462047f39b4da1b6a1a90fa086b90f3a5efbea0b8e2b538af157", + "vendor/petl/petl/version.py": "09a66fa26175a501e5e555bb581556d658060c36ad7d52c04227030536b01d2c", + "vendor/petl/petl/__init__.py": "e86a2a7e6848609ea4fd3d3fb00c8d8c59a968a920a9cdf5e25f95f07dc632ba", + "vendor/petl/petl/transform/__init__.py": "0283aed158196edead2f30fa2151a983294ca92d2993a31fa728ab141f6e85ac", + "vendor/petl/petl/transform/basics.py": "861d87a6010b90d5fe117630e8c92a08a2bc0c31d8748016ac62214744bcdcf5", + "vendor/petl/petl/transform/sorts.py": "4c4fb426b9c937342af1f788d9daafd0f63f294afcf1414affff7441d7c19078", + "vendor/petl/petl/util/base.py": "53f78ab3cce31fc8826f5973915c1ed9ae83fb714b6c5dbcec52ca441f5f86fa", + "vendor/petl/petl/util/lookups.py": "56217a6ee9e1ea676ece69a6971cfbdae16a530491bb9f2d92f97134c5d273a9", + "vendor/petl/petl/comparison.py": "91b4b449fbcffe242f07af593b9d2bd0850852580dbcfadd978fbff219b2a6e3", + "vendor/petl/petl/compat.py": "22b8e7c74f150f60f30db5c5144f23ea846360e9823d31723cd7462bfdc5c353", + "vendor/petl/petl/test/transform/test_joins.py": "46a4e38e2dbc85d9222c611f311c47693698abe57c350c08aa6b9760431581d6", +} + +BASE_MUTABLE_HASHES = { + "vendor/petl/petl/transform/joins.py": "075477145cd182339a061d7b9b6b6e1128f335695200f8a6ab545c18200e3e8d", + "vendor/petl/petl/transform/hashjoins.py": "8d7d96920b3f566d4ba56507b73daf4dc472d6144241567c90c23c85de98e629", +} + +sys.path.insert(0, str(SOURCE)) +import petl as etl + + +def load_cases(): + return json.loads((FIXTURES / "cases.json").read_text()) + + +def normalize(table, missing=None): + header = tuple(table[0]) + width = len(header) + rows = [] + for source in table[1:]: + row = tuple((list(source) + [missing] * width)[:width]) + rows.append(row) + return header, rows + + +def indices(header, spec): + fields = [spec] if isinstance(spec, (str, int)) else list(spec) + return [field if isinstance(field, int) else header.index(field) for field in fields] + + +def key_of(row, selected): + values = tuple(row[index] for index in selected) + return values[0] if len(values) == 1 else values + + +def output_header(lhdr, rhdr, rkind, lprefix=None, rprefix=None): + rvind = [i for i in range(len(rhdr)) if i not in rkind] + left = [str(lprefix) + str(field) if lprefix is not None else field for field in lhdr] + right = [str(rprefix) + str(rhdr[i]) if rprefix is not None else rhdr[i] for i in rvind] + return tuple(left + right), rvind + + +def reference_sort_join(left, right, lkey, rkey, mode, missing=None, + lprefix=None, rprefix=None): + lhdr, lrows = normalize(left, missing) + rhdr, rrows = normalize(right, missing) + lkind = indices(lhdr, lkey) + rkind = indices(rhdr, rkey) + header, rvind = output_header(lhdr, rhdr, rkind, lprefix, rprefix) + lgroups = {} + rgroups = {} + for row in lrows: + lgroups.setdefault(key_of(row, lkind), []).append(row) + for row in rrows: + rgroups.setdefault(key_of(row, rkind), []).append(row) + + if mode == "inner": + keys = sorted(set(lgroups) & set(rgroups)) + elif mode == "left" or mode == "lookup": + keys = sorted(lgroups) + elif mode == "right": + keys = sorted(rgroups) + elif mode == "outer": + keys = sorted(set(lgroups) | set(rgroups)) + else: + raise AssertionError(mode) + + result = [header] + for key in keys: + lgroup = lgroups.get(key, []) + rgroup = rgroups.get(key, []) + if lgroup and rgroup: + selected = rgroup[:1] if mode == "lookup" else rgroup + for lrow in lgroup: + for rrow in selected: + result.append(tuple(lrow) + tuple(rrow[i] for i in rvind)) + elif lgroup and mode in ("left", "outer", "lookup"): + result.extend(tuple(row) + (missing,) * len(rvind) for row in lgroup) + elif rgroup and mode in ("right", "outer"): + for rrow in rgroup: + out = [missing] * len(lhdr) + for li, ri in zip(lkind, rkind): + out[li] = rrow[ri] + result.append(tuple(out) + tuple(rrow[i] for i in rvind)) + return result + + +def reference_hash_join(left, right, lkey, rkey, mode, missing=None, + lprefix=None, rprefix=None): + lhdr, lrows = normalize(left, missing) + rhdr, rrows = normalize(right, missing) + lkind = indices(lhdr, lkey) + rkind = indices(rhdr, rkey) + header, rvind = output_header(lhdr, rhdr, rkind, lprefix, rprefix) + result = [header] + + if mode == "right": + lookup = {} + for row in lrows: + lookup.setdefault(key_of(row, lkind), []).append(row) + for rrow in rrows: + matches = lookup.get(key_of(rrow, rkind), []) + if matches: + result.extend(tuple(row) + tuple(rrow[i] for i in rvind) for row in matches) + else: + out = [missing] * len(lhdr) + for li, ri in zip(lkind, rkind): + out[li] = rrow[ri] + result.append(tuple(out) + tuple(rrow[i] for i in rvind)) + return result + + lookup = {} + for row in rrows: + lookup.setdefault(key_of(row, rkind), []).append(row) + for lrow in lrows: + matches = lookup.get(key_of(lrow, lkind), []) + if matches: + selected = matches[:1] if mode == "lookup" else matches + result.extend(tuple(lrow) + tuple(row[i] for i in rvind) for row in selected) + elif mode in ("left", "lookup"): + result.append(tuple(lrow) + (missing,) * len(rvind)) + return result + + +def materialize(view): + return [tuple(row) for row in view] + + +def assert_rectangular(rows): + assert rows + width = len(rows[0]) + assert all(len(row) == width for row in rows[1:]) + + +def test_gate_source_tree_and_protected_assets(): + for relative, base_hash in BASE_MUTABLE_HASHES.items(): + path = APP / relative + assert path.is_file() and path.stat().st_size > 10_000, relative + assert hashlib.sha256(path.read_bytes()).hexdigest() != base_hash, relative + for relative, expected in PROTECTED_HASHES.items(): + path = APP / relative + assert path.is_file(), relative + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected, relative + + +def test_gate_visible_workflow_schema(): + completed = subprocess.run( + [sys.executable, str(APP / "workflow.py"), str(OUTPUT)], + cwd=APP, + capture_output=True, + text=True, + timeout=15, + env={**os.environ, "PYTHONPATH": str(SOURCE)}, + ) + assert completed.returncode == 0, completed.stderr + payload = json.loads(OUTPUT.read_text()) + assert set(payload) == { + "output_schema_version", "case_order", "cases", "row_counts", + "all_rectangular", + } + assert payload["output_schema_version"] == "petl-uneven-joins.v1" + assert payload["case_order"] == ["outer_sort", "left_hash", "lookup_prefixed", "cross"] + assert payload["all_rectangular"] is True + assert payload["row_counts"] == { + "cross": 2, + "left_hash": 6, + "lookup_prefixed": 4, + "outer_sort": 7, + } + + +def test_core_sort_join_family_independent_recompute(): + cases = load_cases() + left, right = cases["left"], cases["right"] + implementations = [ + (etl.join, "inner"), + (etl.leftjoin, "left"), + (etl.rightjoin, "right"), + (etl.outerjoin, "outer"), + (etl.lookupjoin, "lookup"), + ] + for function, mode in implementations: + actual = materialize(function(left, right, lkey="account_id", rkey="dim_id")) + expected = reference_sort_join(left, right, "account_id", "dim_id", mode) + assert actual == expected, function.__name__ + assert_rectangular(actual) + + actual = materialize(etl.outerjoin( + left, right, lkey="account_id", rkey="dim_id", + missing="NA", lprefix="fact_", rprefix="dim_")) + expected = reference_sort_join( + left, right, "account_id", "dim_id", "outer", + missing="NA", lprefix="fact_", rprefix="dim_") + assert actual == expected + assert actual[0] == ( + "fact_account_id", "fact_region", "fact_amount", "fact_note", + "dim_segment", "dim_risk") + + +def test_core_hash_join_family_independent_recompute(): + cases = load_cases() + left, right = cases["left"], cases["right"] + implementations = [ + (etl.hashjoin, "inner"), + (etl.hashleftjoin, "left"), + (etl.hashrightjoin, "right"), + (etl.hashlookupjoin, "lookup"), + ] + for function, mode in implementations: + actual = materialize(function(left, right, lkey="account_id", rkey="dim_id")) + expected = reference_hash_join(left, right, "account_id", "dim_id", mode) + assert actual == expected, function.__name__ + assert_rectangular(actual) + + actual = materialize(etl.hashleftjoin( + left, right, lkey="account_id", rkey="dim_id", + missing="NA", lprefix="fact_", rprefix="dim_", cache=False)) + expected = reference_hash_join( + left, right, "account_id", "dim_id", "left", + missing="NA", lprefix="fact_", rprefix="dim_") + assert actual == expected + assert actual[1][3] == "NA" + + +def test_edge_compound_missing_key_components(): + cases = load_cases() + left = cases["compound_left"] + right = cases["compound_right"] + actual = materialize(etl.hashjoin( + left, right, lkey=["site", "day"], rkey=["plant", "date"])) + expected = reference_hash_join( + left, right, ["site", "day"], ["plant", "date"], "inner") + assert actual == expected + assert len(actual) == 4 + assert actual[2] == ("A", None, None, "missing-day", "ops") + assert_rectangular(actual) + + +def test_edge_anti_cross_laziness_and_no_input_mutation(): + cases = load_cases() + left = cases["left"] + right = cases["right"] + before_left = copy.deepcopy(left) + before_right = copy.deepcopy(right) + + anti_expected = [ + ("account_id", "region", "amount", "note"), + (2, "west", 20, None), + ] + assert materialize(etl.antijoin(left, right, lkey="account_id", rkey="dim_id")) == anti_expected + assert materialize(etl.hashantijoin(left, right, lkey="account_id", rkey="dim_id")) == anti_expected + + cross = materialize(etl.crossjoin( + [["code", "label"], ["A"], ["B", "bee", "extra"]], + [["flag", "score"], [True], [False, 9]], + prefix=True)) + assert cross[0] == ("1_code", "1_label", "2_flag", "2_score") + assert len(cross) == 5 + assert_rectangular(cross) + + view = etl.leftjoin( + left, right, lkey="account_id", rkey="dim_id", cache=False) + assert materialize(view) == materialize(view) + assert left == before_left + assert right == before_right diff --git a/tasks/candidate-1634-software-databases/environment/Dockerfile b/tasks/candidate-1634-software-databases/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0ac28148b1d7bf4e15fe033836d37893d4822839 --- /dev/null +++ b/tasks/candidate-1634-software-databases/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:0da98e97526d6de162e492f79afbd442ee35de47de62fb08734396b746e19858 diff --git a/tasks/candidate-1634-software-databases/environment/setup/setup.sh b/tasks/candidate-1634-software-databases/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1634-software-databases/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1634-software-databases/instruction.md b/tasks/candidate-1634-software-databases/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc74998c05f7a431473d12bf66e3efd79a7a4652 --- /dev/null +++ b/tasks/candidate-1634-software-databases/instruction.md @@ -0,0 +1,14 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +The vendored ORM in `/app/vendor/peewee` has a transaction argument propagation regression. Repair the existing source modules, preserving their public API and backend behavior. + +Requirements: + +1. `SqliteDatabase.atomic(lock_type=...)` and `SqliteDatabase.transaction(lock_type=...)` must accept `DEFERRED`, `IMMEDIATE`, and `EXCLUSIVE` (case preserved or normalized by SQLite), and the selected mode must reach the actual `BEGIN` statement. +2. Existing positional transaction-type calls must continue to work. Nested `atomic()` scopes must use savepoints and must not issue a second top-level `BEGIN`. +3. The generic transaction implementation and the APSW adapter in `playhouse/apsw_ext.py` must retain compatible lock-mode forwarding; do not replace either module with a new standalone script. +4. Run `/app/integration_check.py` and leave its JSON result at `/app/output.json` with `schema_version` `tbench.peewee-lock.v1`, a `checks` object, and all checks true. + +Work offline. Do not add dependencies or modify the integration checker. diff --git a/tasks/candidate-1634-software-databases/task.toml b/tasks/candidate-1634-software-databases/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..08f9f952c5fe9f0b78e7c79cc5211ba8c4db8063 --- /dev/null +++ b/tasks/candidate-1634-software-databases/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1634-software-databases" +description = "MiMo-V2.6-RL terminal task candidate-1634-software-databases" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1634-software-databases" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:0da98e97526d6de162e492f79afbd442ee35de47de62fb08734396b746e19858" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1634-software-databases/tests/anti_hack_guard.py b/tasks/candidate-1634-software-databases/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1634-software-databases/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1634-software-databases/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..e833b3fb3c7a925aa5ee59b89c59ee84c79793dd --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,25 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "integration_check.py": "b18ffa237898cb0dce0a886bba4ca8434eafd46e3c0f2ff9e4e4cf54fdbc81a2", + "vendor/peewee/LICENSE": "3740096125b08735a247b8dd08cd82e0ba984d3bebd9221d378576637e5240da", + "vendor/peewee/README.rst": "16d48b475bef09808ad5a82df2f716712a2e094595560e8b60faad66c2487ead", + "vendor/peewee/peewee.py": "3f452111378d4b62b3842f973cd4d09ff33f5ca12e6461262239b0fede048f18", + "vendor/peewee/playhouse/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/peewee/playhouse/apsw_ext.py": "46c6abad5447d3797ab233124af7b399c670892a7c5a3f3718ddca5d6d834fe9", + "vendor/peewee/playhouse/sqlite_ext.py": "dae6622c88323538bd5fc5765a51f4168f3ee587fa167bfe5c573b973bee02ca", + "vendor/peewee/playhouse/test_utils.py": "e3b298f56c3ccec6991234cc8717a672bd57a8cf6c7624f97cba08b291a10e45", + "vendor/peewee/runtests.py": "6c67e02df396a546a7478f3d136bc253b161c033f9f8306e78f453b6d617a7b8", + "vendor/peewee/setup.py": "836ef32771a3cf1ddbd0874dc50036b1eb24b8001fbb98edc84646b7cc62e4e1", + "vendor/peewee/tests.py": "054c331a621a6e81749c0b76f64a2c316ea9e48826c3cf7a2f8c7af313725ae4" + }, + "mutable": [ + "vendor/peewee/peewee.py", + "vendor/peewee/playhouse/apsw_ext.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1634-software-databases/tests/integration_check.py b/tasks/candidate-1634-software-databases/tests/integration_check.py new file mode 100644 index 0000000000000000000000000000000000000000..5480d30726a44b28c304bec787a4350898901302 --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/integration_check.py @@ -0,0 +1,62 @@ +import json +import os +import sqlite3 +import sys +import tempfile + +sys.path.insert(0, "/app/vendor/peewee") +from peewee import SqliteDatabase + + +def run_checks(): + fd, path = tempfile.mkstemp(prefix="peewee-lock-", suffix=".db") + os.close(fd) + checks = {} + try: + database = SqliteDatabase(path, timeout=0.15) + database.connect() + database.execute_sql("create table records (id integer primary key, value text)") + database.execute_sql("insert into records(value) values ('seed')") + with database.atomic(lock_type="IMMEDIATE"): + database.execute_sql("insert into records(value) values ('immediate')") + checks["atomic_immediate"] = database.execute_sql( + "select count(*) from records").fetchone()[0] == 2 + with database.transaction(lock_type="DEFERRED"): + database.execute_sql("insert into records(value) values ('deferred')") + checks["transaction_deferred"] = database.execute_sql( + "select count(*) from records").fetchone()[0] == 3 + with database.atomic(lock_type="EXCLUSIVE"): + with database.atomic(): + database.execute_sql("insert into records(value) values ('nested')") + checks["nested_savepoint"] = database.execute_sql( + "select count(*) from records").fetchone()[0] == 4 + database.close() + + first = sqlite3.connect(path, timeout=0.1, isolation_level=None) + second = sqlite3.connect(path, timeout=0.1, isolation_level=None) + first.execute("BEGIN IMMEDIATE") + try: + try: + second.execute("BEGIN IMMEDIATE") + except sqlite3.OperationalError: + checks["contention"] = True + else: + checks["contention"] = False + finally: + first.execute("ROLLBACK") + second.close() + first.close() + checks["all"] = all(checks.values()) + return checks + finally: + try: + os.unlink(path) + except OSError: + pass + + +if __name__ == "__main__": + result = run_checks() + print(json.dumps(result, sort_keys=True)) + if not result["all"]: + raise SystemExit("integration checks failed: %r" % result) diff --git a/tasks/candidate-1634-software-databases/tests/task_test.sh b/tasks/candidate-1634-software-databases/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e269779a6cc8b1417b0c0ff2289c216103650fdd --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then printf '1\n' > /logs/verifier/reward.txt; else printf '0\n' > /logs/verifier/reward.txt; fi +exit "$status" diff --git a/tasks/candidate-1634-software-databases/tests/test.sh b/tasks/candidate-1634-software-databases/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1634-software-databases/tests/test_outputs.py b/tasks/candidate-1634-software-databases/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..d0ad103963b1bf51f65ec51d31948c44262b79b9 --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/test_outputs.py @@ -0,0 +1,101 @@ +import ast +import json +import os +import py_compile +import subprocess +import sys +import tempfile + +sys.path.insert(0, "/app/vendor/peewee") +from peewee import SqliteDatabase + + +def test_gate_artifact_schema(): + assert os.path.exists("/app/output.json") + result = subprocess.run([sys.executable, "/tests/integration_check.py"], + capture_output=True, text=True) + assert result.returncode == 0, result.stderr + expected = json.loads(result.stdout) + with open("/app/output.json") as handle: + data = json.load(handle) + assert data["schema_version"] == "tbench.peewee-lock.v1" + assert set(data["checks"]) == { + "atomic_immediate", "transaction_deferred", "nested_savepoint", "contention", "all" + } + assert data["checks"]["all"] is True + assert data["checks"] == expected + + +def test_core_atomic_keyword_and_commit(): + fd, path = tempfile.mkstemp() + os.close(fd) + database = SqliteDatabase(path) + database.connect() + database.execute_sql("create table records (value text)") + try: + with database.atomic(lock_type="IMMEDIATE"): + database.execute_sql("insert into records values ('committed')") + assert database.execute_sql("select value from records").fetchone()[0] == "committed" + finally: + database.close() + os.unlink(path) + + +def test_core_real_contention(): + fd, path = tempfile.mkstemp() + os.close(fd) + first = SqliteDatabase(path, timeout=0.05) + second = SqliteDatabase(path, timeout=0.05) + first.connect() + second.connect() + first.execute_sql("create table records (value text)") + try: + with first.atomic(lock_type="IMMEDIATE"): + blocked = False + try: + with second.atomic(lock_type="IMMEDIATE"): + second.execute_sql("insert into records values ('wrong')") + except Exception as error: + blocked = error.__class__.__name__ == "OperationalError" + assert blocked + finally: + first.close() + second.close() + os.unlink(path) + + +def test_core_transaction_and_nesting(): + fd, path = tempfile.mkstemp() + os.close(fd) + database = SqliteDatabase(path) + database.connect() + database.execute_sql("create table records (value text)") + try: + with database.transaction("DEFERRED"): + with database.atomic(): + database.execute_sql("insert into records values ('nested')") + assert database.execute_sql("select count(*) from records").fetchone()[0] == 1 + finally: + database.close() + os.unlink(path) + + +def test_edge_source_modules_compile_and_forward(): + peewee_path = "/app/vendor/peewee/peewee.py" + apsw_path = "/app/vendor/peewee/playhouse/apsw_ext.py" + py_compile.compile(peewee_path, doraise=True) + py_compile.compile(apsw_path, doraise=True) + peewee_source = open(peewee_path).read() + apsw_tree = ast.parse(open(apsw_path).read()) + assert "def atomic(self, transaction_type=None, **kwargs):" in peewee_source + transaction_methods = [node for node in ast.walk(apsw_tree) + if isinstance(node, ast.FunctionDef) and node.name == "transaction"] + assert any(any(arg.arg == "lock_type" for arg in method.args.args) + and any(isinstance(node, ast.Call) and getattr(node.func, "id", "") == "transaction" + for node in ast.walk(method)) for method in transaction_methods) + + +def test_edge_all_report_checks_true(): + with open("/app/output.json") as handle: + checks = json.load(handle)["checks"] + assert all(checks.values()) diff --git a/tasks/candidate-1634-software-databases/tests/vendor/LICENSE b/tasks/candidate-1634-software-databases/tests/vendor/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c752ab3ead2e7be324e5cafb5e1d53135c16af13 --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 Charles Leifer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tasks/candidate-1634-software-databases/tests/vendor/README.rst b/tasks/candidate-1634-software-databases/tests/vendor/README.rst new file mode 100644 index 0000000000000000000000000000000000000000..61192cfc750736ba900d5e4b4aba4efd062955ed --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/README.rst @@ -0,0 +1,146 @@ +.. image:: http://media.charlesleifer.com/blog/photos/p1423749536.32.png + +peewee +====== + +Peewee is a simple and small ORM. It has few (but expressive) concepts, making it easy to learn and intuitive to use. + +* A small, expressive ORM +* Written in python with support for versions 2.6+ and 3.2+. +* built-in support for sqlite, mysql and postgresql +* tons of extensions available in the `playhouse `_ + + * `Postgresql HStore, JSON, arrays and more `_ + * `SQLite full-text search, user-defined functions, virtual tables and more `_ + * `Schema migrations `_ and `model code generator `_ + * `Connection pool `_ + * `Encryption `_ + * `and much, much more... `_ + +.. image:: https://api.travis-ci.org/coleifer/peewee.png?branch=master + :target: https://travis-ci.org/coleifer/peewee + +New to peewee? Here is a list of documents you might find most helpful when getting +started: + +* `Quickstart guide `_ -- this guide covers all the essentials. It will take you between 5 and 10 minutes to go through it. +* `Guide to the various query operators `_ describes how to construct queries and combine expressions. +* `Field types table `_ lists the various field types peewee supports and the parameters they accept. + +For flask helpers, check out the `flask_utils extension module `_. You can also use peewee with the popular extension `flask-admin `_ to provide a Django-like admin interface for managing peewee models. + +Examples +-------- + +Defining models is similar to Django or SQLAlchemy: + +.. code-block:: python + + from peewee import * + from playhouse.sqlite_ext import SqliteExtDatabase + import datetime + + db = SqliteExtDatabase('my_database.db') + + class BaseModel(Model): + class Meta: + database = db + + class User(BaseModel): + username = CharField(unique=True) + + class Tweet(BaseModel): + user = ForeignKeyField(User, related_name='tweets') + message = TextField() + created_date = DateTimeField(default=datetime.datetime.now) + is_published = BooleanField(default=True) + +Connect to the database and create tables: + +.. code-block:: python + + db.connect() + db.create_tables([User, Tweet]) + +Create a few rows: + +.. code-block:: python + + charlie = User.create(username='charlie') + huey = User(username='huey') + huey.save() + + # No need to set `is_published` or `created_date` since they + # will just use the default values we specified. + Tweet.create(user=charlie, message='My first tweet') + +Queries are expressive and composable: + +.. code-block:: python + + # A simple query selecting a user. + User.get(User.username == 'charles') + + # Get tweets created by one of several users. The "<<" operator + # corresponds to the SQL "IN" operator. + usernames = ['charlie', 'huey', 'mickey'] + users = User.select().where(User.username << usernames) + tweets = Tweet.select().where(Tweet.user << users) + + # We could accomplish the same using a JOIN: + tweets = (Tweet + .select() + .join(User) + .where(User.username << usernames)) + + # How many tweets were published today? + tweets_today = (Tweet + .select() + .where( + (Tweet.created_date >= datetime.date.today()) & + (Tweet.is_published == True)) + .count()) + + # Paginate the user table and show me page 3 (users 41-60). + User.select().order_by(User.username).paginate(3, 20) + + # Order users by the number of tweets they've created: + tweet_ct = fn.Count(Tweet.id) + users = (User + .select(User, tweet_ct.alias('ct')) + .join(Tweet, JOIN.LEFT_OUTER) + .group_by(User) + .order_by(tweet_ct.desc())) + + # Do an atomic update + Counter.update(count=Counter.count + 1).where( + Counter.url == request.url) + +Check out the `example app `_ for a working Twitter-clone website written with Flask. + +Learning more +------------- + +Check the `documentation `_ for more examples. + +Specific question? Come hang out in the #peewee channel on irc.freenode.net, or post to the mailing list, http://groups.google.com/group/peewee-orm . If you would like to report a bug, `create a new issue `_ on GitHub. + +Still want more info? +--------------------- + +.. image:: http://media.charlesleifer.com/blog/photos/wat.jpg + +I've written a number of blog posts about building applications and web-services with peewee (and usually Flask). If you'd like to see some real-life applications that use peewee, the following resources may be useful: + +* `Building a note-taking app with Flask and Peewee `_ as well as `Part 2 `_ and `Part 3 `_. +* `Analytics web service built with Flask and Peewee `_. +* `Personalized news digest (with a boolean query parser!) `_. +* `Using peewee to explore CSV files `_. +* `Structuring Flask apps with Peewee `_. +* `Creating a lastpass clone with Flask and Peewee `_. +* `Building a web-based encrypted file manager with Flask, peewee and S3 `_. +* `Creating a bookmarking web-service that takes screenshots of your bookmarks `_. +* `Building a pastebin, wiki and a bookmarking service using Flask and Peewee `_. +* `Encrypted databases with Python and SQLCipher `_. +* `Dear Diary: An Encrypted, Command-Line Diary with Peewee `_. +* `Query Tree Structures in SQLite using Peewee and the Transitive Closure Extension `_. diff --git a/tasks/candidate-1634-software-databases/tests/vendor/peewee.py b/tasks/candidate-1634-software-databases/tests/vendor/peewee.py new file mode 100644 index 0000000000000000000000000000000000000000..74e5abe24861224d725b6b109fd50b98c8b244d2 --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/peewee.py @@ -0,0 +1,5274 @@ +# May you do good and not evil +# May you find forgiveness for yourself and forgive others +# May you share freely, never taking more than you give. -- SQLite source code +# +# As we enjoy great advantages from the inventions of others, we should be glad +# of an opportunity to serve others by an invention of ours, and this we should +# do freely and generously. -- Ben Franklin +# +# (\ +# ( \ /(o)\ caw! +# ( \/ ()/ /) +# ( `;.))'".) +# `(/////.-' +# =====))=))===() +# ///' +# // +# ' + +import calendar +import datetime +import decimal +import hashlib +import itertools +import logging +import operator +import re +import sys +import threading +import time +import uuid +import weakref +from bisect import bisect_left +from bisect import bisect_right +from collections import deque +from collections import namedtuple +try: + from collections import OrderedDict +except ImportError: + OrderedDict = dict +from copy import deepcopy +from functools import wraps +from inspect import isclass + +__version__ = '2.8.7' +__all__ = [ + 'BareField', + 'BigIntegerField', + 'BlobField', + 'BooleanField', + 'CharField', + 'Check', + 'Clause', + 'CompositeKey', + 'DatabaseError', + 'DataError', + 'DateField', + 'DateTimeField', + 'DecimalField', + 'DeferredRelation', + 'DoesNotExist', + 'DoubleField', + 'DQ', + 'Field', + 'FixedCharField', + 'FloatField', + 'fn', + 'ForeignKeyField', + 'ImproperlyConfigured', + 'IntegerField', + 'IntegrityError', + 'InterfaceError', + 'InternalError', + 'JOIN', + 'JOIN_FULL', + 'JOIN_INNER', + 'JOIN_LEFT_OUTER', + 'Model', + 'MySQLDatabase', + 'NotSupportedError', + 'OperationalError', + 'Param', + 'PostgresqlDatabase', + 'prefetch', + 'PrimaryKeyField', + 'ProgrammingError', + 'Proxy', + 'R', + 'SmallIntegerField', + 'SqliteDatabase', + 'SQL', + 'TextField', + 'TimeField', + 'TimestampField', + 'Tuple', + 'Using', + 'UUIDField', + 'Window', +] + +# Set default logging handler to avoid "No handlers could be found for logger +# "peewee"" warnings. +try: # Python 2.7+ + from logging import NullHandler +except ImportError: + class NullHandler(logging.Handler): + def emit(self, record): + pass + +# All peewee-generated logs are logged to this namespace. +logger = logging.getLogger('peewee') +logger.addHandler(NullHandler()) + +# Python 2/3 compatibility helpers. These helpers are used internally and are +# not exported. +_METACLASS_ = '_metaclass_helper_' +def with_metaclass(meta, base=object): + return meta(_METACLASS_, (base,), {}) + +PY2 = sys.version_info[0] == 2 +PY3 = sys.version_info[0] == 3 +PY26 = sys.version_info[:2] == (2, 6) +if PY3: + import builtins + from collections import Callable + from functools import reduce + callable = lambda c: isinstance(c, Callable) + unicode_type = str + string_type = bytes + basestring = str + print_ = getattr(builtins, 'print') + binary_construct = lambda s: bytes(s.encode('raw_unicode_escape')) + long = int + def reraise(tp, value, tb=None): + if value.__traceback__ is not tb: + raise value.with_traceback(tb) + raise value +elif PY2: + unicode_type = unicode + string_type = basestring + binary_construct = buffer + def print_(s): + sys.stdout.write(s) + sys.stdout.write('\n') + exec('def reraise(tp, value, tb=None): raise tp, value, tb') +else: + raise RuntimeError('Unsupported python version.') + +if PY26: + _D, _M = 24 * 3600., 10**6 + total_seconds = lambda t: (t.microseconds+(t.seconds+t.days*_D)*_M)/_M +else: + total_seconds = lambda t: t.total_seconds() + +# By default, peewee supports Sqlite, MySQL and Postgresql. +try: + from pysqlite2 import dbapi2 as pysq3 +except ImportError: + pysq3 = None +try: + import sqlite3 +except ImportError: + sqlite3 = pysq3 +else: + if pysq3 and pysq3.sqlite_version_info >= sqlite3.sqlite_version_info: + sqlite3 = pysq3 + +try: + from psycopg2cffi import compat + compat.register() +except ImportError: + pass +try: + import psycopg2 + from psycopg2 import extensions as pg_extensions +except ImportError: + psycopg2 = None +try: + import MySQLdb as mysql # prefer the C module. +except ImportError: + try: + import pymysql as mysql + except ImportError: + mysql = None + +try: + from playhouse._speedups import format_date_time + from playhouse._speedups import sort_models_topologically + from playhouse._speedups import strip_parens +except ImportError: + def format_date_time(value, formats, post_process=None): + post_process = post_process or (lambda x: x) + for fmt in formats: + try: + return post_process(datetime.datetime.strptime(value, fmt)) + except ValueError: + pass + return value + + def sort_models_topologically(models): + """Sort models topologically so that parents will precede children.""" + models = set(models) + seen = set() + ordering = [] + def dfs(model): + if model in models and model not in seen: + seen.add(model) + for foreign_key in model._meta.reverse_rel.values(): + dfs(foreign_key.model_class) + ordering.append(model) # parent will follow descendants + if model._meta.depends_on: + for dependency in model._meta.depends_on: + dfs(dependency) + # Order models by name and table initially to guarantee total ordering. + names = lambda m: (m._meta.name, m._meta.db_table) + for m in sorted(models, key=names, reverse=True): + dfs(m) + return list(reversed(ordering)) + + def strip_parens(s): + # Quick sanity check. + if not s or s[0] != '(': + return s + + ct = i = 0 + l = len(s) + while i < l: + if s[i] == '(' and s[l - 1] == ')': + ct += 1 + i += 1 + l -= 1 + else: + break + if ct: + # If we ever end up with negatively-balanced parentheses, then we + # know that one of the outer parentheses was required. + unbalanced_ct = 0 + required = 0 + for i in range(ct, l - ct): + if s[i] == '(': + unbalanced_ct += 1 + elif s[i] == ')': + unbalanced_ct -= 1 + if unbalanced_ct < 0: + required += 1 + unbalanced_ct = 0 + if required == ct: + break + ct -= required + if ct > 0: + return s[ct:-ct] + return s + +try: + from playhouse._speedups import _DictQueryResultWrapper + from playhouse._speedups import _ModelQueryResultWrapper + from playhouse._speedups import _SortedFieldList + from playhouse._speedups import _TuplesQueryResultWrapper +except ImportError: + _DictQueryResultWrapper = _ModelQueryResultWrapper = _SortedFieldList =\ + _TuplesQueryResultWrapper = None + +if sqlite3: + sqlite3.register_adapter(decimal.Decimal, str) + sqlite3.register_adapter(datetime.date, str) + sqlite3.register_adapter(datetime.time, str) + +DATETIME_PARTS = ['year', 'month', 'day', 'hour', 'minute', 'second'] +DATETIME_LOOKUPS = set(DATETIME_PARTS) + +# Sqlite does not support the `date_part` SQL function, so we will define an +# implementation in python. +SQLITE_DATETIME_FORMATS = ( + '%Y-%m-%d %H:%M:%S', + '%Y-%m-%d %H:%M:%S.%f', + '%Y-%m-%d', + '%H:%M:%S', + '%H:%M:%S.%f', + '%H:%M') + +def _sqlite_date_part(lookup_type, datetime_string): + assert lookup_type in DATETIME_LOOKUPS + if not datetime_string: + return + dt = format_date_time(datetime_string, SQLITE_DATETIME_FORMATS) + return getattr(dt, lookup_type) + +SQLITE_DATE_TRUNC_MAPPING = { + 'year': '%Y', + 'month': '%Y-%m', + 'day': '%Y-%m-%d', + 'hour': '%Y-%m-%d %H', + 'minute': '%Y-%m-%d %H:%M', + 'second': '%Y-%m-%d %H:%M:%S'} +MYSQL_DATE_TRUNC_MAPPING = SQLITE_DATE_TRUNC_MAPPING.copy() +MYSQL_DATE_TRUNC_MAPPING['minute'] = '%Y-%m-%d %H:%i' +MYSQL_DATE_TRUNC_MAPPING['second'] = '%Y-%m-%d %H:%i:%S' + +def _sqlite_date_trunc(lookup_type, datetime_string): + assert lookup_type in SQLITE_DATE_TRUNC_MAPPING + if not datetime_string: + return + dt = format_date_time(datetime_string, SQLITE_DATETIME_FORMATS) + return dt.strftime(SQLITE_DATE_TRUNC_MAPPING[lookup_type]) + +def _sqlite_regexp(regex, value): + return re.search(regex, value, re.I) is not None + +class attrdict(dict): + def __getattr__(self, attr): + return self[attr] + +SENTINEL = object() + +# Operators used in binary expressions. +OP = attrdict( + AND='and', + OR='or', + ADD='+', + SUB='-', + MUL='*', + DIV='/', + BIN_AND='&', + BIN_OR='|', + XOR='^', + MOD='%', + EQ='=', + LT='<', + LTE='<=', + GT='>', + GTE='>=', + NE='!=', + IN='in', + NOT_IN='not in', + IS='is', + IS_NOT='is not', + LIKE='like', + ILIKE='ilike', + BETWEEN='between', + REGEXP='regexp', + CONCAT='||', +) + +JOIN = attrdict( + INNER='INNER', + LEFT_OUTER='LEFT OUTER', + RIGHT_OUTER='RIGHT OUTER', + FULL='FULL', + CROSS='CROSS', +) +JOIN_INNER = JOIN.INNER +JOIN_LEFT_OUTER = JOIN.LEFT_OUTER +JOIN_FULL = JOIN.FULL + +RESULTS_NAIVE = 1 +RESULTS_MODELS = 2 +RESULTS_TUPLES = 3 +RESULTS_DICTS = 4 +RESULTS_AGGREGATE_MODELS = 5 + +# To support "django-style" double-underscore filters, create a mapping between +# operation name and operation code, e.g. "__eq" == OP.EQ. +DJANGO_MAP = { + 'eq': OP.EQ, + 'lt': OP.LT, + 'lte': OP.LTE, + 'gt': OP.GT, + 'gte': OP.GTE, + 'ne': OP.NE, + 'in': OP.IN, + 'is': OP.IS, + 'like': OP.LIKE, + 'ilike': OP.ILIKE, + 'regexp': OP.REGEXP, +} + +# Helper functions that are used in various parts of the codebase. +def merge_dict(source, overrides): + merged = source.copy() + merged.update(overrides) + return merged + +def returns_clone(func): + """ + Method decorator that will "clone" the object before applying the given + method. This ensures that state is mutated in a more predictable fashion, + and promotes the use of method-chaining. + """ + def inner(self, *args, **kwargs): + clone = self.clone() # Assumes object implements `clone`. + func(clone, *args, **kwargs) + return clone + inner.call_local = func # Provide a way to call without cloning. + return inner + +def not_allowed(func): + """ + Method decorator to indicate a method is not allowed to be called. Will + raise a `NotImplementedError`. + """ + def inner(self, *args, **kwargs): + raise NotImplementedError('%s is not allowed on %s instances' % ( + func, type(self).__name__)) + return inner + +class Proxy(object): + """ + Proxy class useful for situations when you wish to defer the initialization + of an object. + """ + __slots__ = ('obj', '_callbacks') + + def __init__(self): + self._callbacks = [] + self.initialize(None) + + def initialize(self, obj): + self.obj = obj + for callback in self._callbacks: + callback(obj) + + def attach_callback(self, callback): + self._callbacks.append(callback) + return callback + + def __getattr__(self, attr): + if self.obj is None: + raise AttributeError('Cannot use uninitialized Proxy.') + return getattr(self.obj, attr) + + def __setattr__(self, attr, value): + if attr not in self.__slots__: + raise AttributeError('Cannot set attribute on proxy.') + return super(Proxy, self).__setattr__(attr, value) + +class DeferredRelation(object): + _unresolved = set() + + def __init__(self, rel_model_name=None): + self.fields = [] + if rel_model_name is not None: + self._rel_model_name = rel_model_name.lower() + self._unresolved.add(self) + + def set_field(self, model_class, field, name): + self.fields.append((model_class, field, name)) + + def set_model(self, rel_model): + for model, field, name in self.fields: + field.rel_model = rel_model + field.add_to_class(model, name) + + @staticmethod + def resolve(model_cls): + unresolved = list(DeferredRelation._unresolved) + for dr in unresolved: + if dr._rel_model_name == model_cls.__name__.lower(): + dr.set_model(model_cls) + DeferredRelation._unresolved.discard(dr) + + +class _CDescriptor(object): + def __get__(self, instance, instance_type=None): + if instance is not None: + return Entity(instance._alias) + return self + +# Classes representing the query tree. + +class Node(object): + """Base-class for any part of a query which shall be composable.""" + c = _CDescriptor() + _node_type = 'node' + + def __init__(self): + self._negated = False + self._alias = None + self._bind_to = None + self._ordering = None # ASC or DESC. + + @classmethod + def extend(cls, name=None, clone=False): + def decorator(method): + method_name = name or method.__name__ + if clone: + method = returns_clone(method) + setattr(cls, method_name, method) + return method + return decorator + + def clone_base(self): + return type(self)() + + def clone(self): + inst = self.clone_base() + inst._negated = self._negated + inst._alias = self._alias + inst._ordering = self._ordering + inst._bind_to = self._bind_to + return inst + + @returns_clone + def __invert__(self): + self._negated = not self._negated + + @returns_clone + def alias(self, a=None): + self._alias = a + + @returns_clone + def bind_to(self, bt): + """ + Bind the results of an expression to a specific model type. Useful + when adding expressions to a select, where the result of the expression + should be placed on a joined instance. + """ + self._bind_to = bt + + @returns_clone + def asc(self): + self._ordering = 'ASC' + + @returns_clone + def desc(self): + self._ordering = 'DESC' + + def __pos__(self): + return self.asc() + + def __neg__(self): + return self.desc() + + def _e(op, inv=False): + """ + Lightweight factory which returns a method that builds an Expression + consisting of the left-hand and right-hand operands, using `op`. + """ + def inner(self, rhs): + if inv: + return Expression(rhs, op, self) + return Expression(self, op, rhs) + return inner + __and__ = _e(OP.AND) + __or__ = _e(OP.OR) + + __add__ = _e(OP.ADD) + __sub__ = _e(OP.SUB) + __mul__ = _e(OP.MUL) + __div__ = __truediv__ = _e(OP.DIV) + __xor__ = _e(OP.XOR) + __radd__ = _e(OP.ADD, inv=True) + __rsub__ = _e(OP.SUB, inv=True) + __rmul__ = _e(OP.MUL, inv=True) + __rdiv__ = __rtruediv__ = _e(OP.DIV, inv=True) + __rand__ = _e(OP.AND, inv=True) + __ror__ = _e(OP.OR, inv=True) + __rxor__ = _e(OP.XOR, inv=True) + + def __eq__(self, rhs): + if rhs is None: + return Expression(self, OP.IS, None) + return Expression(self, OP.EQ, rhs) + def __ne__(self, rhs): + if rhs is None: + return Expression(self, OP.IS_NOT, None) + return Expression(self, OP.NE, rhs) + + __lt__ = _e(OP.LT) + __le__ = _e(OP.LTE) + __gt__ = _e(OP.GT) + __ge__ = _e(OP.GTE) + __lshift__ = _e(OP.IN) + __rshift__ = _e(OP.IS) + __mod__ = _e(OP.LIKE) + __pow__ = _e(OP.ILIKE) + + bin_and = _e(OP.BIN_AND) + bin_or = _e(OP.BIN_OR) + + # Special expressions. + def in_(self, rhs): + return Expression(self, OP.IN, rhs) + def not_in(self, rhs): + return Expression(self, OP.NOT_IN, rhs) + def is_null(self, is_null=True): + if is_null: + return Expression(self, OP.IS, None) + return Expression(self, OP.IS_NOT, None) + def contains(self, rhs): + return Expression(self, OP.ILIKE, '%%%s%%' % rhs) + def startswith(self, rhs): + return Expression(self, OP.ILIKE, '%s%%' % rhs) + def endswith(self, rhs): + return Expression(self, OP.ILIKE, '%%%s' % rhs) + def between(self, low, high): + return Expression(self, OP.BETWEEN, Clause(low, R('AND'), high)) + def regexp(self, expression): + return Expression(self, OP.REGEXP, expression) + def concat(self, rhs): + return Expression(self, OP.CONCAT, rhs) + +class SQL(Node): + """An unescaped SQL string, with optional parameters.""" + _node_type = 'sql' + + def __init__(self, value, *params): + self.value = value + self.params = params + super(SQL, self).__init__() + + def clone_base(self): + return SQL(self.value, *self.params) +R = SQL # backwards-compat. + +class Entity(Node): + """A quoted-name or entity, e.g. "table"."column".""" + _node_type = 'entity' + + def __init__(self, *path): + super(Entity, self).__init__() + self.path = path + + def clone_base(self): + return Entity(*self.path) + + def __getattr__(self, attr): + return Entity(*filter(None, self.path + (attr,))) + +class Func(Node): + """An arbitrary SQL function call.""" + _node_type = 'func' + _no_coerce = set(('count', 'sum')) + + def __init__(self, name, *arguments): + self.name = name + self.arguments = arguments + self._coerce = (name.lower() not in self._no_coerce) if name else False + super(Func, self).__init__() + + @returns_clone + def coerce(self, coerce=True): + self._coerce = coerce + + def clone_base(self): + res = Func(self.name, *self.arguments) + res._coerce = self._coerce + return res + + def over(self, partition_by=None, order_by=None, start=None, end=None, + window=None): + if isinstance(partition_by, Window) and window is None: + window = partition_by + if start is not None and not isinstance(start, SQL): + start = SQL(*start) + if end is not None and not isinstance(end, SQL): + end = SQL(*end) + + if window is None: + sql = Window(partition_by=partition_by, order_by=order_by, + start=start, end=end).__sql__() + else: + sql = SQL(window._alias) + return Clause(self, SQL('OVER'), sql) + + def __getattr__(self, attr): + def dec(*args, **kwargs): + return Func(attr, *args, **kwargs) + return dec + +# fn is a factory for creating `Func` objects and supports a more friendly +# API. So instead of `Func("LOWER", param)`, `fn.LOWER(param)`. +fn = Func(None) + +class Expression(Node): + """A binary expression, e.g `foo + 1` or `bar < 7`.""" + _node_type = 'expression' + + def __init__(self, lhs, op, rhs, flat=False): + super(Expression, self).__init__() + self.lhs = lhs + self.op = op + self.rhs = rhs + self.flat = flat + + def clone_base(self): + return Expression(self.lhs, self.op, self.rhs, self.flat) + +class Param(Node): + """ + Arbitrary parameter passed into a query. Instructs the query compiler to + specifically treat this value as a parameter, useful for `list` which is + special-cased for `IN` lookups. + """ + _node_type = 'param' + + def __init__(self, value, adapt=None): + self.value = value + self.adapt = adapt + super(Param, self).__init__() + + def clone_base(self): + return Param(self.value, self.adapt) + +class Passthrough(Param): + _node_type = 'passthrough' + +class Clause(Node): + """A SQL clause, one or more Node objects joined by spaces.""" + _node_type = 'clause' + + glue = ' ' + parens = False + + def __init__(self, *nodes, **kwargs): + if 'glue' in kwargs: + self.glue = kwargs['glue'] + if 'parens' in kwargs: + self.parens = kwargs['parens'] + super(Clause, self).__init__() + self.nodes = list(nodes) + + def clone_base(self): + clone = Clause(*self.nodes) + clone.glue = self.glue + clone.parens = self.parens + return clone + +class CommaClause(Clause): + """One or more Node objects joined by commas, no parens.""" + glue = ', ' + +class EnclosedClause(CommaClause): + """One or more Node objects joined by commas and enclosed in parens.""" + parens = True +Tuple = EnclosedClause + +class Window(Node): + CURRENT_ROW = 'CURRENT ROW' + + def __init__(self, partition_by=None, order_by=None, start=None, end=None): + super(Window, self).__init__() + self.partition_by = partition_by + self.order_by = order_by + self.start = start + self.end = end + if self.start is None and self.end is not None: + raise ValueError('Cannot specify WINDOW end without start.') + self._alias = self._alias or 'w' + + @staticmethod + def following(value=None): + if value is None: + return SQL('UNBOUNDED FOLLOWING') + return SQL('%d FOLLOWING' % value) + + @staticmethod + def preceding(value=None): + if value is None: + return SQL('UNBOUNDED PRECEDING') + return SQL('%d PRECEDING' % value) + + def __sql__(self): + over_clauses = [] + if self.partition_by: + over_clauses.append(Clause( + SQL('PARTITION BY'), + CommaClause(*self.partition_by))) + if self.order_by: + over_clauses.append(Clause( + SQL('ORDER BY'), + CommaClause(*self.order_by))) + if self.start is not None and self.end is not None: + over_clauses.append(Clause( + SQL('RANGE BETWEEN'), + self.start, + SQL('AND'), + self.end)) + elif self.start is not None: + over_clauses.append(Clause(SQL('RANGE'), self.start)) + return EnclosedClause(Clause(*over_clauses)) + + def clone_base(self): + return Window(self.partition_by, self.order_by) + +def Check(value): + return SQL('CHECK (%s)' % value) + +class DQ(Node): + """A "django-style" filter expression, e.g. {'foo__eq': 'x'}.""" + def __init__(self, **query): + super(DQ, self).__init__() + self.query = query + + def clone_base(self): + return DQ(**self.query) + +class _StripParens(Node): + _node_type = 'strip_parens' + + def __init__(self, node): + super(_StripParens, self).__init__() + self.node = node + +JoinMetadata = namedtuple('JoinMetadata', ( + 'src_model', # Source Model class. + 'dest_model', # Dest Model class. + 'src', # Source, may be Model, ModelAlias + 'dest', # Dest, may be Model, ModelAlias, or SelectQuery. + 'attr', # Attribute name joined instance(s) should be assigned to. + 'primary_key', # Primary key being joined on. + 'foreign_key', # Foreign key being joined from. + 'is_backref', # Is this a backref, i.e. 1 -> N. + 'alias', # Explicit alias given to join expression. + 'is_self_join', # Is this a self-join? + 'is_expression', # Is the join ON clause an Expression? +)) + +class Join(namedtuple('_Join', ('src', 'dest', 'join_type', 'on'))): + def get_foreign_key(self, source, dest, field=None): + if isinstance(source, SelectQuery) or isinstance(dest, SelectQuery): + return None, None + fk_field = source._meta.rel_for_model(dest, field) + if fk_field is not None: + return fk_field, False + reverse_rel = source._meta.reverse_rel_for_model(dest, field) + if reverse_rel is not None: + return reverse_rel, True + return None, None + + def get_join_type(self): + return self.join_type or JOIN.INNER + + def model_from_alias(self, model_or_alias): + if isinstance(model_or_alias, ModelAlias): + return model_or_alias.model_class + elif isinstance(model_or_alias, SelectQuery): + return model_or_alias.model_class + return model_or_alias + + def _join_metadata(self): + # Get the actual tables being joined. + src = self.model_from_alias(self.src) + dest = self.model_from_alias(self.dest) + + join_alias = isinstance(self.on, Node) and self.on._alias or None + is_expression = isinstance(self.on, (Expression, Func, SQL)) + + on_field = isinstance(self.on, (Field, FieldProxy)) and self.on or None + if on_field: + fk_field = on_field + is_backref = on_field.name not in src._meta.fields + else: + fk_field, is_backref = self.get_foreign_key(src, dest, self.on) + if fk_field is None and self.on is not None: + fk_field, is_backref = self.get_foreign_key(src, dest) + + if fk_field is not None: + primary_key = fk_field.to_field + else: + primary_key = None + + if not join_alias: + if fk_field is not None: + if is_backref: + target_attr = dest._meta.db_table + else: + target_attr = fk_field.name + else: + try: + target_attr = self.on.lhs.name + except AttributeError: + target_attr = dest._meta.db_table + else: + target_attr = None + + return JoinMetadata( + src_model=src, + dest_model=dest, + src=self.src, + dest=self.dest, + attr=join_alias or target_attr, + primary_key=primary_key, + foreign_key=fk_field, + is_backref=is_backref, + alias=join_alias, + is_self_join=src is dest, + is_expression=is_expression) + + @property + def metadata(self): + if not hasattr(self, '_cached_metadata'): + self._cached_metadata = self._join_metadata() + return self._cached_metadata + +class FieldDescriptor(object): + # Fields are exposed as descriptors in order to control access to the + # underlying "raw" data. + def __init__(self, field): + self.field = field + self.att_name = self.field.name + + def __get__(self, instance, instance_type=None): + if instance is not None: + return instance._data.get(self.att_name) + return self.field + + def __set__(self, instance, value): + instance._data[self.att_name] = value + instance._dirty.add(self.att_name) + +class Field(Node): + """A column on a table.""" + _field_counter = 0 + _order = 0 + _node_type = 'field' + db_field = 'unknown' + + def __init__(self, null=False, index=False, unique=False, + verbose_name=None, help_text=None, db_column=None, + default=None, choices=None, primary_key=False, sequence=None, + constraints=None, schema=None, undeclared=False): + self.null = null + self.index = index + self.unique = unique + self.verbose_name = verbose_name + self.help_text = help_text + self.db_column = db_column + self.default = default + self.choices = choices # Used for metadata purposes, not enforced. + self.primary_key = primary_key + self.sequence = sequence # Name of sequence, e.g. foo_id_seq. + self.constraints = constraints # List of column constraints. + self.schema = schema # Name of schema, e.g. 'public'. + self.undeclared = undeclared # Whether this field is part of schema. + + # Used internally for recovering the order in which Fields were defined + # on the Model class. + Field._field_counter += 1 + self._order = Field._field_counter + self._sort_key = (self.primary_key and 1 or 2), self._order + + self._is_bound = False # Whether the Field is "bound" to a Model. + super(Field, self).__init__() + + def clone_base(self, **kwargs): + inst = type(self)( + null=self.null, + index=self.index, + unique=self.unique, + verbose_name=self.verbose_name, + help_text=self.help_text, + db_column=self.db_column, + default=self.default, + choices=self.choices, + primary_key=self.primary_key, + sequence=self.sequence, + constraints=self.constraints, + schema=self.schema, + undeclared=self.undeclared, + **kwargs) + if self._is_bound: + inst.name = self.name + inst.model_class = self.model_class + inst._is_bound = self._is_bound + return inst + + def add_to_class(self, model_class, name): + """ + Hook that replaces the `Field` attribute on a class with a named + `FieldDescriptor`. Called by the metaclass during construction of the + `Model`. + """ + self.name = name + self.model_class = model_class + self.db_column = self.db_column or self.name + if not self.verbose_name: + self.verbose_name = re.sub('_+', ' ', name).title() + + model_class._meta.add_field(self) + setattr(model_class, name, FieldDescriptor(self)) + self._is_bound = True + + def get_database(self): + return self.model_class._meta.database + + def get_column_type(self): + field_type = self.get_db_field() + return self.get_database().compiler().get_column_type(field_type) + + def get_db_field(self): + return self.db_field + + def get_modifiers(self): + return None + + def coerce(self, value): + return value + + def db_value(self, value): + """Convert the python value for storage in the database.""" + return value if value is None else self.coerce(value) + + def python_value(self, value): + """Convert the database value to a pythonic value.""" + return value if value is None else self.coerce(value) + + def as_entity(self, with_table=False): + if with_table: + return Entity(self.model_class._meta.db_table, self.db_column) + return Entity(self.db_column) + + def __ddl_column__(self, column_type): + """Return the column type, e.g. VARCHAR(255) or REAL.""" + modifiers = self.get_modifiers() + if modifiers: + return SQL( + '%s(%s)' % (column_type, ', '.join(map(str, modifiers)))) + return SQL(column_type) + + def __ddl__(self, column_type): + """Return a list of Node instances that defines the column.""" + ddl = [self.as_entity(), self.__ddl_column__(column_type)] + if not self.null: + ddl.append(SQL('NOT NULL')) + if self.primary_key: + ddl.append(SQL('PRIMARY KEY')) + if self.sequence: + ddl.append(SQL("DEFAULT NEXTVAL('%s')" % self.sequence)) + if self.constraints: + ddl.extend(self.constraints) + return ddl + + def __hash__(self): + return hash(self.name + '.' + self.model_class.__name__) + +class BareField(Field): + db_field = 'bare' + + def __init__(self, coerce=None, *args, **kwargs): + super(BareField, self).__init__(*args, **kwargs) + if coerce is not None: + self.coerce = coerce + + def clone_base(self, **kwargs): + return super(BareField, self).clone_base(coerce=self.coerce, **kwargs) + +class IntegerField(Field): + db_field = 'int' + coerce = int + +class BigIntegerField(IntegerField): + db_field = 'bigint' + +class SmallIntegerField(IntegerField): + db_field = 'smallint' + +class PrimaryKeyField(IntegerField): + db_field = 'primary_key' + + def __init__(self, *args, **kwargs): + kwargs['primary_key'] = True + super(PrimaryKeyField, self).__init__(*args, **kwargs) + +class _AutoPrimaryKeyField(PrimaryKeyField): + _column_name = None + + def __init__(self, *args, **kwargs): + if 'undeclared' in kwargs and not kwargs['undeclared']: + raise ValueError('%r must be created with undeclared=True.' % self) + kwargs['undeclared'] = True + super(_AutoPrimaryKeyField, self).__init__(*args, **kwargs) + + def add_to_class(self, model_class, name): + if name != self._column_name: + raise ValueError('%s must be named `%s`.' % (type(self), name)) + super(_AutoPrimaryKeyField, self).add_to_class(model_class, name) + +class FloatField(Field): + db_field = 'float' + coerce = float + +class DoubleField(FloatField): + db_field = 'double' + +class DecimalField(Field): + db_field = 'decimal' + + def __init__(self, max_digits=10, decimal_places=5, auto_round=False, + rounding=None, *args, **kwargs): + self.max_digits = max_digits + self.decimal_places = decimal_places + self.auto_round = auto_round + self.rounding = rounding or decimal.DefaultContext.rounding + self._exp = decimal.Decimal(10) ** (-self.decimal_places) + super(DecimalField, self).__init__(*args, **kwargs) + + def clone_base(self, **kwargs): + return super(DecimalField, self).clone_base( + max_digits=self.max_digits, + decimal_places=self.decimal_places, + auto_round=self.auto_round, + rounding=self.rounding, + **kwargs) + + def get_modifiers(self): + return [self.max_digits, self.decimal_places] + + def db_value(self, value): + D = decimal.Decimal + if not value: + return value if value is None else D(0) + elif self.auto_round or not isinstance(value, D): + value = D(str(value)) + if value.is_normal() and self.auto_round: + value = value.quantize(self._exp, rounding=self.rounding) + return value + + def python_value(self, value): + if value is not None: + if isinstance(value, decimal.Decimal): + return value + return decimal.Decimal(str(value)) + +def coerce_to_unicode(s, encoding='utf-8'): + if isinstance(s, unicode_type): + return s + elif isinstance(s, string_type): + try: + return s.decode(encoding) + except UnicodeDecodeError: + return s + return unicode_type(s) + +class CharField(Field): + db_field = 'string' + + def __init__(self, max_length=255, *args, **kwargs): + self.max_length = max_length + super(CharField, self).__init__(*args, **kwargs) + + def clone_base(self, **kwargs): + return super(CharField, self).clone_base( + max_length=self.max_length, + **kwargs) + + def get_modifiers(self): + return self.max_length and [self.max_length] or None + + def coerce(self, value): + return coerce_to_unicode(value or '') + +class FixedCharField(CharField): + db_field = 'fixed_char' + + def python_value(self, value): + value = super(FixedCharField, self).python_value(value) + if value: + value = value.strip() + return value + +class TextField(Field): + db_field = 'text' + + def coerce(self, value): + return coerce_to_unicode(value or '') + +class BlobField(Field): + db_field = 'blob' + _constructor = binary_construct + + def add_to_class(self, model_class, name): + if isinstance(model_class._meta.database, Proxy): + model_class._meta.database.attach_callback(self._set_constructor) + return super(BlobField, self).add_to_class(model_class, name) + + def _set_constructor(self, database): + self._constructor = database.get_binary_type() + + def db_value(self, value): + if isinstance(value, unicode_type): + value = value.encode('raw_unicode_escape') + if isinstance(value, basestring): + return self._constructor(value) + return value + +class UUIDField(Field): + db_field = 'uuid' + + def db_value(self, value): + if isinstance(value, uuid.UUID): + return value.hex + try: + return uuid.UUID(value).hex + except: + return value + + def python_value(self, value): + if isinstance(value, uuid.UUID): + return value + return None if value is None else uuid.UUID(value) + +def _date_part(date_part): + def dec(self): + return self.model_class._meta.database.extract_date(date_part, self) + return dec + +class _BaseFormattedField(Field): + formats = None + def __init__(self, formats=None, *args, **kwargs): + if formats is not None: + self.formats = formats + super(_BaseFormattedField, self).__init__(*args, **kwargs) + + def clone_base(self, **kwargs): + return super(_BaseFormattedField, self).clone_base( + formats=self.formats, + **kwargs) + +class DateTimeField(_BaseFormattedField): + db_field = 'datetime' + formats = [ + '%Y-%m-%d %H:%M:%S.%f', + '%Y-%m-%d %H:%M:%S', + '%Y-%m-%d', + ] + + def python_value(self, value): + if value and isinstance(value, basestring): + return format_date_time(value, self.formats) + return value + + year = property(_date_part('year')) + month = property(_date_part('month')) + day = property(_date_part('day')) + hour = property(_date_part('hour')) + minute = property(_date_part('minute')) + second = property(_date_part('second')) + +class DateField(_BaseFormattedField): + db_field = 'date' + formats = [ + '%Y-%m-%d', + '%Y-%m-%d %H:%M:%S', + '%Y-%m-%d %H:%M:%S.%f', + ] + + def python_value(self, value): + if value and isinstance(value, basestring): + pp = lambda x: x.date() + return format_date_time(value, self.formats, pp) + elif value and isinstance(value, datetime.datetime): + return value.date() + return value + + year = property(_date_part('year')) + month = property(_date_part('month')) + day = property(_date_part('day')) + +class TimeField(_BaseFormattedField): + db_field = 'time' + formats = [ + '%H:%M:%S.%f', + '%H:%M:%S', + '%H:%M', + '%Y-%m-%d %H:%M:%S.%f', + '%Y-%m-%d %H:%M:%S', + ] + + def python_value(self, value): + if value: + if isinstance(value, basestring): + pp = lambda x: x.time() + return format_date_time(value, self.formats, pp) + elif isinstance(value, datetime.datetime): + return value.time() + if value is not None and isinstance(value, datetime.timedelta): + return (datetime.datetime.min + value).time() + return value + + hour = property(_date_part('hour')) + minute = property(_date_part('minute')) + second = property(_date_part('second')) + +class TimestampField(IntegerField): + # Support second -> microsecond resolution. + valid_resolutions = [10**i for i in range(7)] + + def __init__(self, *args, **kwargs): + self.resolution = kwargs.pop('resolution', 1) or 1 + if self.resolution not in self.valid_resolutions: + raise ValueError('TimestampField resolution must be one of: %s' % + ', '.join(str(i) for i in self.valid_resolutions)) + + self.utc = kwargs.pop('utc', False) or False + _dt = datetime.datetime + self._conv = _dt.utcfromtimestamp if self.utc else _dt.fromtimestamp + _default = _dt.utcnow if self.utc else _dt.now + kwargs.setdefault('default', _default) + super(TimestampField, self).__init__(*args, **kwargs) + + def get_db_field(self): + # For second resolution we can get away (for a while) with using + # 4 bytes to store the timestamp (as long as they're not > ~2038). + # Otherwise we'll need to use a BigInteger type. + return (self.db_field if self.resolution == 1 + else BigIntegerField.db_field) + + def db_value(self, value): + if value is None: + return + + if isinstance(value, datetime.datetime): + pass + elif isinstance(value, datetime.date): + value = datetime.datetime(value.year, value.month, value.day) + else: + return int(round(value * self.resolution)) + + if self.utc: + timestamp = calendar.timegm(value.utctimetuple()) + else: + timestamp = time.mktime(value.timetuple()) + timestamp += (value.microsecond * .000001) + if self.resolution > 1: + timestamp *= self.resolution + return int(round(timestamp)) + + def python_value(self, value): + if value is not None and isinstance(value, (int, float, long)): + if value == 0: + return + elif self.resolution > 1: + ticks_to_microsecond = 1000000 // self.resolution + value, ticks = divmod(value, self.resolution) + microseconds = ticks * ticks_to_microsecond + return self._conv(value).replace(microsecond=microseconds) + else: + return self._conv(value) + return value + +class BooleanField(Field): + db_field = 'bool' + coerce = bool + +class RelationDescriptor(FieldDescriptor): + """Foreign-key abstraction to replace a related PK with a related model.""" + def __init__(self, field, rel_model): + self.rel_model = rel_model + super(RelationDescriptor, self).__init__(field) + + def get_object_or_id(self, instance): + rel_id = instance._data.get(self.att_name) + if rel_id is not None or self.att_name in instance._obj_cache: + if self.att_name not in instance._obj_cache: + obj = self.rel_model.get(self.field.to_field == rel_id) + instance._obj_cache[self.att_name] = obj + return instance._obj_cache[self.att_name] + elif not self.field.null: + raise self.rel_model.DoesNotExist + return rel_id + + def __get__(self, instance, instance_type=None): + if instance is not None: + return self.get_object_or_id(instance) + return self.field + + def __set__(self, instance, value): + if isinstance(value, self.rel_model): + instance._data[self.att_name] = getattr( + value, self.field.to_field.name) + instance._obj_cache[self.att_name] = value + else: + orig_value = instance._data.get(self.att_name) + instance._data[self.att_name] = value + if orig_value != value and self.att_name in instance._obj_cache: + del instance._obj_cache[self.att_name] + instance._dirty.add(self.att_name) + +class ReverseRelationDescriptor(object): + """Back-reference to expose related objects as a `SelectQuery`.""" + def __init__(self, field): + self.field = field + self.rel_model = field.model_class + + def __get__(self, instance, instance_type=None): + if instance is not None: + return self.rel_model.select().where( + self.field == getattr(instance, self.field.to_field.name)) + return self + +class ObjectIdDescriptor(object): + """Gives direct access to the underlying id""" + def __init__(self, field): + self.attr_name = field.name + self.field = weakref.ref(field) + + def __get__(self, instance, instance_type=None): + if instance is not None: + return instance._data.get(self.attr_name) + return self.field() + + def __set__(self, instance, value): + setattr(instance, self.attr_name, value) + +class ForeignKeyField(IntegerField): + def __init__(self, rel_model, related_name=None, on_delete=None, + on_update=None, extra=None, to_field=None, *args, **kwargs): + if rel_model != 'self' and not \ + isinstance(rel_model, (Proxy, DeferredRelation)) and not \ + issubclass(rel_model, Model): + raise TypeError('Unexpected value for `rel_model`. Expected ' + '`Model`, `Proxy`, `DeferredRelation`, or "self"') + self.rel_model = rel_model + self._related_name = related_name + self.deferred = isinstance(rel_model, (Proxy, DeferredRelation)) + self.on_delete = on_delete + self.on_update = on_update + self.extra = extra + self.to_field = to_field + super(ForeignKeyField, self).__init__(*args, **kwargs) + + def clone_base(self, **kwargs): + return super(ForeignKeyField, self).clone_base( + rel_model=self.rel_model, + related_name=self._get_related_name(), + on_delete=self.on_delete, + on_update=self.on_update, + extra=self.extra, + to_field=self.to_field, + **kwargs) + + def _get_descriptor(self): + return RelationDescriptor(self, self.rel_model) + + def _get_id_descriptor(self): + return ObjectIdDescriptor(self) + + def _get_backref_descriptor(self): + return ReverseRelationDescriptor(self) + + def _get_related_name(self): + if self._related_name and callable(self._related_name): + return self._related_name(self) + return self._related_name or ('%s_set' % self.model_class._meta.name) + + def add_to_class(self, model_class, name): + if isinstance(self.rel_model, Proxy): + def callback(rel_model): + self.rel_model = rel_model + self.add_to_class(model_class, name) + self.rel_model.attach_callback(callback) + return + elif isinstance(self.rel_model, DeferredRelation): + self.rel_model.set_field(model_class, self, name) + return + + self.name = name + self.model_class = model_class + self.db_column = obj_id_name = self.db_column or '%s_id' % self.name + if obj_id_name == self.name: + obj_id_name += '_id' + if not self.verbose_name: + self.verbose_name = re.sub('_+', ' ', name).title() + + model_class._meta.add_field(self) + + self.related_name = self._get_related_name() + if self.rel_model == 'self': + self.rel_model = self.model_class + + if self.to_field is not None: + if not isinstance(self.to_field, Field): + self.to_field = getattr(self.rel_model, self.to_field) + else: + self.to_field = self.rel_model._meta.primary_key + + # TODO: factor into separate method. + if model_class._meta.validate_backrefs: + def invalid(msg, **context): + context.update( + field='%s.%s' % (model_class._meta.name, name), + backref=self.related_name, + obj_id_name=obj_id_name) + raise AttributeError(msg % context) + + if self.related_name in self.rel_model._meta.fields: + invalid('The related_name of %(field)s ("%(backref)s") ' + 'conflicts with a field of the same name.') + elif self.related_name in self.rel_model._meta.reverse_rel: + invalid('The related_name of %(field)s ("%(backref)s") ' + 'is already in use by another foreign key.') + + if obj_id_name in model_class._meta.fields: + invalid('The object id descriptor of %(field)s conflicts ' + 'with a field named %(obj_id_name)s') + elif obj_id_name in model_class.__dict__: + invalid('Model attribute "%(obj_id_name)s" would be shadowed ' + 'by the object id descriptor of %(field)s.') + + setattr(model_class, name, self._get_descriptor()) + setattr(model_class, obj_id_name, self._get_id_descriptor()) + setattr(self.rel_model, + self.related_name, + self._get_backref_descriptor()) + self._is_bound = True + + model_class._meta.rel[self.name] = self + self.rel_model._meta.reverse_rel[self.related_name] = self + + def get_db_field(self): + """ + Overridden to ensure Foreign Keys use same column type as the primary + key they point to. + """ + if not isinstance(self.to_field, PrimaryKeyField): + return self.to_field.get_db_field() + return super(ForeignKeyField, self).get_db_field() + + def get_modifiers(self): + if not isinstance(self.to_field, PrimaryKeyField): + return self.to_field.get_modifiers() + return super(ForeignKeyField, self).get_modifiers() + + def coerce(self, value): + return self.to_field.coerce(value) + + def db_value(self, value): + if isinstance(value, self.rel_model): + value = value._get_pk_value() + return self.to_field.db_value(value) + + def python_value(self, value): + if isinstance(value, self.rel_model): + return value + return self.to_field.python_value(value) + + +class CompositeKey(object): + """A primary key composed of multiple columns.""" + sequence = None + + def __init__(self, *field_names): + self.field_names = field_names + + def add_to_class(self, model_class, name): + self.name = name + self.model_class = model_class + setattr(model_class, name, self) + + def __get__(self, instance, instance_type=None): + if instance is not None: + return tuple([getattr(instance, field_name) + for field_name in self.field_names]) + return self + + def __set__(self, instance, value): + pass + + def __eq__(self, other): + expressions = [(self.model_class._meta.fields[field] == value) + for field, value in zip(self.field_names, other)] + return reduce(operator.and_, expressions) + + def __hash__(self): + return hash((self.model_class.__name__, self.field_names)) + + +class AliasMap(object): + prefix = 't' + + def __init__(self, start=0): + self._alias_map = {} + self._counter = start + + def __repr__(self): + return '' % self._alias_map + + def add(self, obj, alias=None): + if obj in self._alias_map: + return + self._counter += 1 + self._alias_map[obj] = alias or '%s%s' % (self.prefix, self._counter) + + def __getitem__(self, obj): + if obj not in self._alias_map: + self.add(obj) + return self._alias_map[obj] + + def __contains__(self, obj): + return obj in self._alias_map + + def update(self, alias_map): + if alias_map: + for obj, alias in alias_map._alias_map.items(): + if obj not in self: + self._alias_map[obj] = alias + return self + + +class QueryCompiler(object): + # Mapping of `db_type` to actual column type used by database driver. + # Database classes may provide additional column types or overrides. + field_map = { + 'bare': '', + 'bigint': 'BIGINT', + 'blob': 'BLOB', + 'bool': 'SMALLINT', + 'date': 'DATE', + 'datetime': 'DATETIME', + 'decimal': 'DECIMAL', + 'double': 'REAL', + 'fixed_char': 'CHAR', + 'float': 'REAL', + 'int': 'INTEGER', + 'primary_key': 'INTEGER', + 'smallint': 'SMALLINT', + 'string': 'VARCHAR', + 'text': 'TEXT', + 'time': 'TIME', + } + + # Mapping of OP. to actual SQL operation. For most databases this will be + # the same, but some column types or databases may support additional ops. + # Like `field_map`, Database classes may extend or override these. + op_map = { + OP.EQ: '=', + OP.LT: '<', + OP.LTE: '<=', + OP.GT: '>', + OP.GTE: '>=', + OP.NE: '!=', + OP.IN: 'IN', + OP.NOT_IN: 'NOT IN', + OP.IS: 'IS', + OP.IS_NOT: 'IS NOT', + OP.BIN_AND: '&', + OP.BIN_OR: '|', + OP.LIKE: 'LIKE', + OP.ILIKE: 'ILIKE', + OP.BETWEEN: 'BETWEEN', + OP.ADD: '+', + OP.SUB: '-', + OP.MUL: '*', + OP.DIV: '/', + OP.XOR: '#', + OP.AND: 'AND', + OP.OR: 'OR', + OP.MOD: '%', + OP.REGEXP: 'REGEXP', + OP.CONCAT: '||', + } + + join_map = { + JOIN.INNER: 'INNER JOIN', + JOIN.LEFT_OUTER: 'LEFT OUTER JOIN', + JOIN.RIGHT_OUTER: 'RIGHT OUTER JOIN', + JOIN.FULL: 'FULL JOIN', + JOIN.CROSS: 'CROSS JOIN', + } + alias_map_class = AliasMap + + def __init__(self, quote_char='"', interpolation='?', field_overrides=None, + op_overrides=None): + self.quote_char = quote_char + self.interpolation = interpolation + self._field_map = merge_dict(self.field_map, field_overrides or {}) + self._op_map = merge_dict(self.op_map, op_overrides or {}) + self._parse_map = self.get_parse_map() + self._unknown_types = set(['param']) + + def get_parse_map(self): + # To avoid O(n) lookups when parsing nodes, use a lookup table for + # common node types O(1). + return { + 'expression': self._parse_expression, + 'param': self._parse_param, + 'passthrough': self._parse_passthrough, + 'func': self._parse_func, + 'clause': self._parse_clause, + 'entity': self._parse_entity, + 'field': self._parse_field, + 'sql': self._parse_sql, + 'select_query': self._parse_select_query, + 'compound_select_query': self._parse_compound_select_query, + 'strip_parens': self._parse_strip_parens, + } + + def quote(self, s): + return '%s%s%s' % (self.quote_char, s, self.quote_char) + + def get_column_type(self, f): + return self._field_map[f] if f in self._field_map else f.upper() + + def get_op(self, q): + return self._op_map[q] + + def _sorted_fields(self, field_dict): + return sorted(field_dict.items(), key=lambda i: i[0]._sort_key) + + def _parse_default(self, node, alias_map, conv): + return self.interpolation, [node] + + def _parse_expression(self, node, alias_map, conv): + if isinstance(node.lhs, Field): + conv = node.lhs + lhs, lparams = self.parse_node(node.lhs, alias_map, conv) + rhs, rparams = self.parse_node(node.rhs, alias_map, conv) + if node.op == OP.IN and rhs == '()' and not rparams: + return ('0 = 1' if node.flat else '(0 = 1)'), [] + template = '%s %s %s' if node.flat else '(%s %s %s)' + sql = template % (lhs, self.get_op(node.op), rhs) + return sql, lparams + rparams + + def _parse_passthrough(self, node, alias_map, conv): + if node.adapt: + return self.parse_node(node.adapt(node.value), alias_map, None) + return self.interpolation, [node.value] + + def _parse_param(self, node, alias_map, conv): + if node.adapt: + if conv and conv.db_value is node.adapt: + conv = None + return self.parse_node(node.adapt(node.value), alias_map, conv) + elif conv is not None: + return self.parse_node(conv.db_value(node.value), alias_map) + else: + return self.interpolation, [node.value] + + def _parse_func(self, node, alias_map, conv): + conv = node._coerce and conv or None + sql, params = self.parse_node_list(node.arguments, alias_map, conv) + return '%s(%s)' % (node.name, strip_parens(sql)), params + + def _parse_clause(self, node, alias_map, conv): + sql, params = self.parse_node_list( + node.nodes, alias_map, conv, node.glue) + if node.parens: + sql = '(%s)' % strip_parens(sql) + return sql, params + + def _parse_entity(self, node, alias_map, conv): + return '.'.join(map(self.quote, node.path)), [] + + def _parse_sql(self, node, alias_map, conv): + return node.value, list(node.params) + + def _parse_field(self, node, alias_map, conv): + if alias_map: + sql = '.'.join(( + self.quote(alias_map[node.model_class]), + self.quote(node.db_column))) + else: + sql = self.quote(node.db_column) + return sql, [] + + def _parse_compound_select_query(self, node, alias_map, conv): + csq = 'compound_select_query' + lhs, rhs = node.lhs, node.rhs + inv = rhs._node_type == csq and lhs._node_type != csq + if inv: + lhs, rhs = rhs, lhs + + new_map = self.alias_map_class() + if lhs._node_type == csq: + new_map._counter = alias_map._counter + + sql1, p1 = self.generate_select(lhs, new_map) + sql2, p2 = self.generate_select(rhs, self.calculate_alias_map(rhs, + new_map)) + + # We add outer parentheses in the event the compound query is used in + # the `from_()` clause, in which case we'll need them. + if node.database.compound_select_parentheses: + if lhs._node_type != csq: + sql1 = '(%s)' % sql1 + if rhs._node_type != csq: + sql2 = '(%s)' % sql2 + + if inv: + sql1, p1, sql2, p2 = sql2, p2, sql1, p1 + + return '(%s %s %s)' % (sql1, node.operator, sql2), (p1 + p2) + + def _parse_select_query(self, node, alias_map, conv): + clone = node.clone() + if not node._explicit_selection: + if conv and isinstance(conv, ForeignKeyField): + select_field = conv.to_field + else: + select_field = clone.model_class._meta.primary_key + clone._select = (select_field,) + sub, params = self.generate_select(clone, alias_map) + return '(%s)' % strip_parens(sub), params + + def _parse_strip_parens(self, node, alias_map, conv): + sql, params = self.parse_node(node.node, alias_map, conv) + return strip_parens(sql), params + + def _parse(self, node, alias_map, conv): + # By default treat the incoming node as a raw value that should be + # parameterized. + node_type = getattr(node, '_node_type', None) + unknown = False + if node_type in self._parse_map: + sql, params = self._parse_map[node_type](node, alias_map, conv) + unknown = (node_type in self._unknown_types and + node.adapt is None and + conv is None) + elif isinstance(node, (list, tuple, set)): + # If you're wondering how to pass a list into your query, simply + # wrap it in Param(). + sql, params = self.parse_node_list(node, alias_map, conv) + sql = '(%s)' % sql + elif isinstance(node, Model): + sql = self.interpolation + if conv and isinstance(conv, ForeignKeyField): + to_field = conv.to_field + if isinstance(to_field, ForeignKeyField): + value = conv.db_value(node) + else: + value = to_field.db_value(getattr(node, to_field.name)) + else: + value = node._get_pk_value() + params = [value] + elif (isclass(node) and issubclass(node, Model)) or \ + isinstance(node, ModelAlias): + entity = node.as_entity().alias(alias_map[node]) + sql, params = self.parse_node(entity, alias_map, conv) + elif conv is not None: + value = conv.db_value(node) + sql, params, _ = self._parse(value, alias_map, None) + else: + sql, params = self._parse_default(node, alias_map, None) + unknown = True + + return sql, params, unknown + + def parse_node(self, node, alias_map=None, conv=None): + sql, params, unknown = self._parse(node, alias_map, conv) + if unknown and (conv is not None) and params: + params = [conv.db_value(i) for i in params] + + if isinstance(node, Node): + if node._negated: + sql = 'NOT %s' % sql + if node._alias: + sql = ' '.join((sql, 'AS', node._alias)) + if node._ordering: + sql = ' '.join((sql, node._ordering)) + + if params and any(isinstance(p, Node) for p in params): + clean_params = [] + clean_sql = [] + for idx, param in enumerate(params): + if isinstance(param, Node): + csql, cparams = self.parse_node(param) + + return sql, params + + def parse_node_list(self, nodes, alias_map, conv=None, glue=', '): + sql = [] + params = [] + for node in nodes: + node_sql, node_params = self.parse_node(node, alias_map, conv) + sql.append(node_sql) + params.extend(node_params) + return glue.join(sql), params + + def calculate_alias_map(self, query, alias_map=None): + new_map = self.alias_map_class() + if alias_map is not None: + new_map._counter = alias_map._counter + + new_map.add(query.model_class, query.model_class._meta.table_alias) + for src_model, joined_models in query._joins.items(): + new_map.add(src_model, src_model._meta.table_alias) + for join_obj in joined_models: + if isinstance(join_obj.dest, Node): + new_map.add(join_obj.dest, join_obj.dest.alias) + else: + new_map.add(join_obj.dest, join_obj.dest._meta.table_alias) + + return new_map.update(alias_map) + + def build_query(self, clauses, alias_map=None): + return self.parse_node(Clause(*clauses), alias_map) + + def generate_joins(self, joins, model_class, alias_map): + # Joins are implemented as an adjancency-list graph. Perform a + # depth-first search of the graph to generate all the necessary JOINs. + clauses = [] + seen = set() + q = [model_class] + while q: + curr = q.pop() + if curr not in joins or curr in seen: + continue + seen.add(curr) + for join in joins[curr]: + src = curr + dest = join.dest + join_type = join.get_join_type() + if isinstance(join.on, (Expression, Func, Clause, Entity)): + # Clear any alias on the join expression. + constraint = join.on.clone().alias() + elif join_type != JOIN.CROSS: + metadata = join.metadata + if metadata.is_backref: + fk_model = join.dest + pk_model = join.src + else: + fk_model = join.src + pk_model = join.dest + + fk = metadata.foreign_key + if fk: + lhs = getattr(fk_model, fk.name) + rhs = getattr(pk_model, fk.to_field.name) + if metadata.is_backref: + lhs, rhs = rhs, lhs + constraint = (lhs == rhs) + else: + raise ValueError('Missing required join predicate.') + + if isinstance(dest, Node): + # TODO: ensure alias? + dest_n = dest + else: + q.append(dest) + dest_n = dest.as_entity().alias(alias_map[dest]) + + join_sql = SQL(self.join_map.get(join_type) or join_type) + if join_type == JOIN.CROSS: + clauses.append(Clause(join_sql, dest_n)) + else: + clauses.append(Clause(join_sql, dest_n, SQL('ON'), + constraint)) + + return clauses + + def generate_select(self, query, alias_map=None): + model = query.model_class + db = model._meta.database + + alias_map = self.calculate_alias_map(query, alias_map) + + if isinstance(query, CompoundSelect): + clauses = [_StripParens(query)] + else: + if not query._distinct: + clauses = [SQL('SELECT')] + else: + clauses = [SQL('SELECT DISTINCT')] + if query._distinct not in (True, False): + clauses += [SQL('ON'), EnclosedClause(*query._distinct)] + + select_clause = Clause(*query._select) + select_clause.glue = ', ' + + clauses.extend((select_clause, SQL('FROM'))) + if query._from is None: + clauses.append(model.as_entity().alias(alias_map[model])) + else: + clauses.append(CommaClause(*query._from)) + + join_clauses = self.generate_joins(query._joins, model, alias_map) + if join_clauses: + clauses.extend(join_clauses) + + if query._where is not None: + clauses.extend([SQL('WHERE'), query._where]) + + if query._group_by: + clauses.extend([SQL('GROUP BY'), CommaClause(*query._group_by)]) + + if query._having: + clauses.extend([SQL('HAVING'), query._having]) + + if query._windows is not None: + clauses.append(SQL('WINDOW')) + clauses.append(CommaClause(*[ + Clause( + SQL(window._alias), + SQL('AS'), + window.__sql__()) + for window in query._windows])) + + if query._order_by: + clauses.extend([SQL('ORDER BY'), CommaClause(*query._order_by)]) + + if query._limit is not None or (query._offset and db.limit_max): + limit = query._limit if query._limit is not None else db.limit_max + clauses.append(SQL('LIMIT %d' % limit)) + if query._offset is not None: + clauses.append(SQL('OFFSET %d' % query._offset)) + + if query._for_update: + clauses.append(SQL(query._for_update)) + + return self.build_query(clauses, alias_map) + + def generate_update(self, query): + model = query.model_class + alias_map = self.alias_map_class() + alias_map.add(model, model._meta.db_table) + if query._on_conflict: + statement = 'UPDATE OR %s' % query._on_conflict + else: + statement = 'UPDATE' + clauses = [SQL(statement), model.as_entity(), SQL('SET')] + + update = [] + for field, value in self._sorted_fields(query._update): + if not isinstance(value, (Node, Model)): + value = Param(value, adapt=field.db_value) + update.append(Expression( + field.as_entity(with_table=False), + OP.EQ, + value, + flat=True)) # No outer parens, no table alias. + clauses.append(CommaClause(*update)) + + if query._where: + clauses.extend([SQL('WHERE'), query._where]) + + if query._returning is not None: + returning_clause = Clause(*query._returning) + returning_clause.glue = ', ' + clauses.extend([SQL('RETURNING'), returning_clause]) + + return self.build_query(clauses, alias_map) + + def _get_field_clause(self, fields, clause_type=EnclosedClause): + return clause_type(*[ + field.as_entity(with_table=False) for field in fields]) + + def generate_insert(self, query): + model = query.model_class + meta = model._meta + alias_map = self.alias_map_class() + alias_map.add(model, model._meta.db_table) + if query._upsert: + statement = meta.database.upsert_sql + elif query._on_conflict: + statement = 'INSERT OR %s INTO' % query._on_conflict + else: + statement = 'INSERT INTO' + clauses = [SQL(statement), model.as_entity()] + + if query._query is not None: + # This INSERT query is of the form INSERT INTO ... SELECT FROM. + if query._fields: + clauses.append(self._get_field_clause(query._fields)) + clauses.append(_StripParens(query._query)) + + elif query._rows is not None: + fields, value_clauses = [], [] + have_fields = False + + for row_dict in query._iter_rows(): + if not have_fields: + fields = sorted( + row_dict.keys(), key=operator.attrgetter('_sort_key')) + have_fields = True + + values = [] + for field in fields: + value = row_dict[field] + if not isinstance(value, (Node, Model)): + value = Param(value, adapt=field.db_value) + values.append(value) + + value_clauses.append(EnclosedClause(*values)) + + if fields: + clauses.extend([ + self._get_field_clause(fields), + SQL('VALUES'), + CommaClause(*value_clauses)]) + elif query.model_class._meta.auto_increment: + # Bare insert, use default value for primary key. + clauses.append(query.database.default_insert_clause( + query.model_class)) + + if query.is_insert_returning: + clauses.extend([ + SQL('RETURNING'), + self._get_field_clause( + meta.get_primary_key_fields(), + clause_type=CommaClause)]) + elif query._returning is not None: + returning_clause = Clause(*query._returning) + returning_clause.glue = ', ' + clauses.extend([SQL('RETURNING'), returning_clause]) + + + return self.build_query(clauses, alias_map) + + def generate_delete(self, query): + model = query.model_class + clauses = [SQL('DELETE FROM'), model.as_entity()] + if query._where: + clauses.extend([SQL('WHERE'), query._where]) + if query._returning is not None: + returning_clause = Clause(*query._returning) + returning_clause.glue = ', ' + clauses.extend([SQL('RETURNING'), returning_clause]) + return self.build_query(clauses) + + def field_definition(self, field): + column_type = self.get_column_type(field.get_db_field()) + ddl = field.__ddl__(column_type) + return Clause(*ddl) + + def foreign_key_constraint(self, field): + ddl = [ + SQL('FOREIGN KEY'), + EnclosedClause(field.as_entity()), + SQL('REFERENCES'), + field.rel_model.as_entity(), + EnclosedClause(field.to_field.as_entity())] + if field.on_delete: + ddl.append(SQL('ON DELETE %s' % field.on_delete)) + if field.on_update: + ddl.append(SQL('ON UPDATE %s' % field.on_update)) + return Clause(*ddl) + + def return_parsed_node(function_name): + # TODO: treat all `generate_` functions as returning clauses, instead + # of SQL/params. + def inner(self, *args, **kwargs): + fn = getattr(self, function_name) + return self.parse_node(fn(*args, **kwargs)) + return inner + + def _create_foreign_key(self, model_class, field, constraint=None): + constraint = constraint or 'fk_%s_%s_refs_%s' % ( + model_class._meta.db_table, + field.db_column, + field.rel_model._meta.db_table) + fk_clause = self.foreign_key_constraint(field) + return Clause( + SQL('ALTER TABLE'), + model_class.as_entity(), + SQL('ADD CONSTRAINT'), + Entity(constraint), + *fk_clause.nodes) + create_foreign_key = return_parsed_node('_create_foreign_key') + + def _create_table(self, model_class, safe=False): + statement = 'CREATE TABLE IF NOT EXISTS' if safe else 'CREATE TABLE' + meta = model_class._meta + + columns, constraints = [], [] + if meta.composite_key: + pk_cols = [meta.fields[f].as_entity() + for f in meta.primary_key.field_names] + constraints.append(Clause( + SQL('PRIMARY KEY'), EnclosedClause(*pk_cols))) + for field in meta.declared_fields: + columns.append(self.field_definition(field)) + if isinstance(field, ForeignKeyField) and not field.deferred: + constraints.append(self.foreign_key_constraint(field)) + + if model_class._meta.constraints: + for constraint in model_class._meta.constraints: + if not isinstance(constraint, Node): + constraint = SQL(constraint) + constraints.append(constraint) + + return Clause( + SQL(statement), + model_class.as_entity(), + EnclosedClause(*(columns + constraints))) + create_table = return_parsed_node('_create_table') + + def _drop_table(self, model_class, fail_silently=False, cascade=False): + statement = 'DROP TABLE IF EXISTS' if fail_silently else 'DROP TABLE' + ddl = [SQL(statement), model_class.as_entity()] + if cascade: + ddl.append(SQL('CASCADE')) + return Clause(*ddl) + drop_table = return_parsed_node('_drop_table') + + def _truncate_table(self, model_class, restart_identity=False, + cascade=False): + ddl = [SQL('TRUNCATE TABLE'), model_class.as_entity()] + if restart_identity: + ddl.append(SQL('RESTART IDENTITY')) + if cascade: + ddl.append(SQL('CASCADE')) + return Clause(*ddl) + truncate_table = return_parsed_node('_truncate_table') + + def index_name(self, table, columns): + index = '%s_%s' % (table, '_'.join(columns)) + if len(index) > 64: + index_hash = hashlib.md5(index.encode('utf-8')).hexdigest() + index = '%s_%s' % (table[:55], index_hash[:8]) # 55 + 1 + 8 = 64 + return index + + def _create_index(self, model_class, fields, unique, *extra): + tbl_name = model_class._meta.db_table + statement = 'CREATE UNIQUE INDEX' if unique else 'CREATE INDEX' + index_name = self.index_name(tbl_name, [f.db_column for f in fields]) + return Clause( + SQL(statement), + Entity(index_name), + SQL('ON'), + model_class.as_entity(), + EnclosedClause(*[field.as_entity() for field in fields]), + *extra) + create_index = return_parsed_node('_create_index') + + def _drop_index(self, model_class, fields, fail_silently=False): + tbl_name = model_class._meta.db_table + statement = 'DROP INDEX IF EXISTS' if fail_silently else 'DROP INDEX' + index_name = self.index_name(tbl_name, [f.db_column for f in fields]) + return Clause(SQL(statement), Entity(index_name)) + drop_index = return_parsed_node('_drop_index') + + def _create_sequence(self, sequence_name): + return Clause(SQL('CREATE SEQUENCE'), Entity(sequence_name)) + create_sequence = return_parsed_node('_create_sequence') + + def _drop_sequence(self, sequence_name): + return Clause(SQL('DROP SEQUENCE'), Entity(sequence_name)) + drop_sequence = return_parsed_node('_drop_sequence') + + +class SqliteQueryCompiler(QueryCompiler): + def truncate_table(self, model_class, restart_identity=False, + cascade=False): + return model_class.delete().sql() + + +class ResultIterator(object): + def __init__(self, qrw): + self.qrw = qrw + self._idx = 0 + + def next(self): + if self._idx < self.qrw._ct: + obj = self.qrw._result_cache[self._idx] + elif not self.qrw._populated: + obj = self.qrw.iterate() + self.qrw._result_cache.append(obj) + self.qrw._ct += 1 + else: + raise StopIteration + self._idx += 1 + return obj + __next__ = next + + +class QueryResultWrapper(object): + """ + Provides an iterator over the results of a raw Query, additionally doing + two things: + - converts rows from the database into python representations + - ensures that multiple iterations do not result in multiple queries + """ + def __init__(self, model, cursor, meta=None): + self.model = model + self.cursor = cursor + + self._ct = 0 + self._idx = 0 + + self._result_cache = [] + self._populated = False + self._initialized = False + + if meta is not None: + self.column_meta, self.join_meta = meta + else: + self.column_meta = self.join_meta = None + + def __iter__(self): + if self._populated: + return iter(self._result_cache) + else: + return ResultIterator(self) + + @property + def count(self): + self.fill_cache() + return self._ct + + def __len__(self): + return self.count + + def process_row(self, row): + return row + + def iterate(self): + row = self.cursor.fetchone() + if not row: + self._populated = True + if not getattr(self.cursor, 'name', None): + self.cursor.close() + raise StopIteration + elif not self._initialized: + self.initialize(self.cursor.description) + self._initialized = True + return self.process_row(row) + + def iterator(self): + while True: + yield self.iterate() + + def next(self): + if self._idx < self._ct: + inst = self._result_cache[self._idx] + self._idx += 1 + return inst + elif self._populated: + raise StopIteration + + obj = self.iterate() + self._result_cache.append(obj) + self._ct += 1 + self._idx += 1 + return obj + __next__ = next + + def fill_cache(self, n=None): + n = n or float('Inf') + if n < 0: + raise ValueError('Negative values are not supported.') + self._idx = self._ct + while not self._populated and (n > self._ct): + try: + next(self) + except StopIteration: + break + +class ExtQueryResultWrapper(QueryResultWrapper): + def initialize(self, description): + n_cols = len(description) + self.conv = conv = [] + if self.column_meta is not None: + n_meta = len(self.column_meta) + for i, node in enumerate(self.column_meta): + if not self._initialize_node(node, i): + self._initialize_by_name(description[i][0], i) + if n_cols == n_meta: + return + else: + i = 0 + + for i in range(i, n_cols): + self._initialize_by_name(description[i][0], i) + + def _initialize_by_name(self, name, i): + model_cols = self.model._meta.columns + if name in model_cols: + field = model_cols[name] + self.conv.append((i, field.name, field.python_value)) + else: + self.conv.append((i, name, None)) + + def _initialize_node(self, node, i): + if isinstance(node, Field): + self.conv.append((i, node._alias or node.name, node.python_value)) + return True + elif isinstance(node, Func) and len(node.arguments): + arg = node.arguments[0] + if isinstance(arg, Field): + name = node._alias or arg._alias or arg.name + func = node._coerce and arg.python_value or None + self.conv.append((i, name, func)) + return True + return False + + +class TuplesQueryResultWrapper(ExtQueryResultWrapper): + def process_row(self, row): + return tuple([col if self.conv[i][2] is None else self.conv[i][2](col) + for i, col in enumerate(row)]) + +if _TuplesQueryResultWrapper is None: + _TuplesQueryResultWrapper = TuplesQueryResultWrapper + +class NaiveQueryResultWrapper(ExtQueryResultWrapper): + def process_row(self, row): + instance = self.model() + for i, column, f in self.conv: + setattr(instance, column, f(row[i]) if f is not None else row[i]) + instance._prepare_instance() + return instance + +if _ModelQueryResultWrapper is None: + _ModelQueryResultWrapper = NaiveQueryResultWrapper + +class DictQueryResultWrapper(ExtQueryResultWrapper): + def process_row(self, row): + res = {} + for i, column, f in self.conv: + res[column] = f(row[i]) if f is not None else row[i] + return res + +if _DictQueryResultWrapper is None: + _DictQueryResultWrapper = DictQueryResultWrapper + +class ModelQueryResultWrapper(QueryResultWrapper): + def initialize(self, description): + self.column_map, model_set = self.generate_column_map() + self._col_set = set(col for col in self.column_meta + if isinstance(col, Field)) + self.join_list = self.generate_join_list(model_set) + + def generate_column_map(self): + column_map = [] + models = set([self.model]) + for i, node in enumerate(self.column_meta): + attr = conv = None + if isinstance(node, Field): + if isinstance(node, FieldProxy): + key = node._model_alias + constructor = node.model + conv = node.field_instance.python_value + else: + key = constructor = node.model_class + conv = node.python_value + attr = node._alias or node.name + else: + if node._bind_to is None: + key = constructor = self.model + else: + key = constructor = node._bind_to + if isinstance(node, Node) and node._alias: + attr = node._alias + elif isinstance(node, Entity): + attr = node.path[-1] + column_map.append((key, constructor, attr, conv)) + models.add(key) + + return column_map, models + + def generate_join_list(self, models): + join_list = [] + joins = self.join_meta + stack = [self.model] + while stack: + current = stack.pop() + if current not in joins: + continue + + for join in joins[current]: + metadata = join.metadata + if metadata.dest in models or metadata.dest_model in models: + if metadata.foreign_key is not None: + fk_present = metadata.foreign_key in self._col_set + pk_present = metadata.primary_key in self._col_set + check = metadata.foreign_key.null and (fk_present or + pk_present) + else: + check = fk_present = pk_present = False + + join_list.append(( + metadata, + check, + fk_present, + pk_present)) + stack.append(join.dest) + + return join_list + + def process_row(self, row): + collected = self.construct_instances(row) + instances = self.follow_joins(collected) + for i in instances: + i._prepare_instance() + return instances[0] + + def construct_instances(self, row, keys=None): + collected_models = {} + for i, (key, constructor, attr, conv) in enumerate(self.column_map): + if keys is not None and key not in keys: + continue + value = row[i] + if key not in collected_models: + collected_models[key] = constructor() + instance = collected_models[key] + if attr is None: + attr = self.cursor.description[i][0] + setattr(instance, attr, value if conv is None else conv(value)) + + return collected_models + + def follow_joins(self, collected): + prepared = [collected[self.model]] + for (metadata, check_null, fk_present, pk_present) in self.join_list: + inst = collected[metadata.src] + try: + joined_inst = collected[metadata.dest] + except KeyError: + joined_inst = collected[metadata.dest_model] + + has_fk = True + if check_null: + if fk_present: + has_fk = inst._data.get(metadata.foreign_key.name) + elif pk_present: + has_fk = joined_inst._data.get(metadata.primary_key.name) + + if not has_fk: + continue + + # Can we populate a value on the joined instance using the current? + mpk = metadata.primary_key is not None + can_populate_joined_pk = ( + mpk and + (metadata.attr in inst._data) and + (getattr(joined_inst, metadata.primary_key.name) is None)) + if can_populate_joined_pk: + setattr( + joined_inst, + metadata.primary_key.name, + inst._data[metadata.attr]) + + if metadata.is_backref: + can_populate_joined_fk = ( + mpk and + (metadata.foreign_key is not None) and + (getattr(inst, metadata.primary_key.name) is not None) and + (joined_inst._data.get(metadata.foreign_key.name) is None)) + if can_populate_joined_fk: + setattr( + joined_inst, + metadata.foreign_key.name, + inst) + + setattr(inst, metadata.attr, joined_inst) + prepared.append(joined_inst) + + return prepared + + +JoinCache = namedtuple('JoinCache', ('metadata', 'attr')) + + +class AggregateQueryResultWrapper(ModelQueryResultWrapper): + def __init__(self, *args, **kwargs): + self._row = [] + super(AggregateQueryResultWrapper, self).__init__(*args, **kwargs) + + def initialize(self, description): + super(AggregateQueryResultWrapper, self).initialize(description) + + # Collect the set of all models (and ModelAlias objects) queried. + self.all_models = set() + for key, _, _, _ in self.column_map: + self.all_models.add(key) + + # Prepare data structures for analyzing unique rows. Also cache + # foreign key and attribute names for joined models. + self.models_with_aggregate = set() + self.back_references = {} + self.source_to_dest = {} + self.dest_to_source = {} + + for (metadata, _, _, _) in self.join_list: + if metadata.is_backref: + att_name = metadata.foreign_key.related_name + else: + att_name = metadata.attr + + is_backref = metadata.is_backref or metadata.is_self_join + if is_backref: + self.models_with_aggregate.add(metadata.src) + else: + self.dest_to_source.setdefault(metadata.dest, set()) + self.dest_to_source[metadata.dest].add(metadata.src) + + self.source_to_dest.setdefault(metadata.src, {}) + self.source_to_dest[metadata.src][metadata.dest] = JoinCache( + metadata=metadata, + attr=metadata.alias or att_name) + + # Determine which columns could contain "duplicate" data, e.g. if + # getting Users and their Tweets, this would be the User columns. + self.columns_to_compare = {} + key_to_columns = {} + for idx, (key, model_class, col_name, _) in enumerate(self.column_map): + if key in self.models_with_aggregate: + self.columns_to_compare.setdefault(key, []) + self.columns_to_compare[key].append((idx, col_name)) + + key_to_columns.setdefault(key, []) + key_to_columns[key].append((idx, col_name)) + + # Also compare columns for joins -> many-related model. + for model_or_alias in self.models_with_aggregate: + if model_or_alias not in self.columns_to_compare: + continue + sources = self.dest_to_source.get(model_or_alias, ()) + for joined_model in sources: + self.columns_to_compare[model_or_alias].extend( + key_to_columns[joined_model]) + + def read_model_data(self, row): + models = {} + for model_class, column_data in self.columns_to_compare.items(): + models[model_class] = [] + for idx, col_name in column_data: + models[model_class].append(row[idx]) + return models + + def iterate(self): + if self._row: + row = self._row.pop() + else: + row = self.cursor.fetchone() + + if not row: + self._populated = True + if not getattr(self.cursor, 'name', None): + self.cursor.close() + raise StopIteration + elif not self._initialized: + self.initialize(self.cursor.description) + self._initialized = True + + def _get_pk(instance): + if instance._meta.composite_key: + return tuple([ + instance._data[field_name] + for field_name in instance._meta.primary_key.field_names]) + return instance._get_pk_value() + + identity_map = {} + _constructed = self.construct_instances(row) + primary_instance = _constructed[self.model] + for model_or_alias, instance in _constructed.items(): + identity_map[model_or_alias] = OrderedDict() + identity_map[model_or_alias][_get_pk(instance)] = instance + + model_data = self.read_model_data(row) + while True: + cur_row = self.cursor.fetchone() + if cur_row is None: + break + + duplicate_models = set() + cur_row_data = self.read_model_data(cur_row) + for model_class, data in cur_row_data.items(): + if model_data[model_class] == data: + duplicate_models.add(model_class) + + if not duplicate_models: + self._row.append(cur_row) + break + + different_models = self.all_models - duplicate_models + + new_instances = self.construct_instances(cur_row, different_models) + for model_or_alias, instance in new_instances.items(): + # Do not include any instances which are comprised solely of + # NULL values. + all_none = True + for value in instance._data.values(): + if value is not None: + all_none = False + if not all_none: + identity_map[model_or_alias][_get_pk(instance)] = instance + + stack = [self.model] + instances = [primary_instance] + while stack: + current = stack.pop() + if current not in self.join_meta: + continue + + for join in self.join_meta[current]: + try: + metadata, attr = self.source_to_dest[current][join.dest] + except KeyError: + continue + + if metadata.is_backref or metadata.is_self_join: + for instance in identity_map[current].values(): + setattr(instance, attr, []) + + if join.dest not in identity_map: + continue + + for pk, inst in identity_map[join.dest].items(): + if pk is None: + continue + try: + # XXX: if no FK exists, unable to join. + joined_inst = identity_map[current][ + inst._data[metadata.foreign_key.name]] + except KeyError: + continue + + getattr(joined_inst, attr).append(inst) + instances.append(inst) + elif attr: + if join.dest not in identity_map: + continue + + for pk, instance in identity_map[current].items(): + # XXX: if no FK exists, unable to join. + joined_inst = identity_map[join.dest][ + instance._data[metadata.foreign_key.name]] + setattr( + instance, + metadata.foreign_key.name, + joined_inst) + instances.append(joined_inst) + + stack.append(join.dest) + + for instance in instances: + instance._prepare_instance() + + return primary_instance + + +class Query(Node): + """Base class representing a database query on one or more tables.""" + require_commit = True + + def __init__(self, model_class): + super(Query, self).__init__() + + self.model_class = model_class + self.database = model_class._meta.database + + self._dirty = True + self._query_ctx = model_class + self._joins = {self.model_class: []} # Join graph as adjacency list. + self._where = None + + def __repr__(self): + sql, params = self.sql() + return '%s %s %s' % (self.model_class, sql, params) + + def clone(self): + query = type(self)(self.model_class) + query.database = self.database + return self._clone_attributes(query) + + def _clone_attributes(self, query): + if self._where is not None: + query._where = self._where.clone() + query._joins = self._clone_joins() + query._query_ctx = self._query_ctx + return query + + def _clone_joins(self): + return dict( + (mc, list(j)) for mc, j in self._joins.items()) + + def _add_query_clauses(self, initial, expressions, conjunction=None): + reduced = reduce(operator.and_, expressions) + if initial is None: + return reduced + conjunction = conjunction or operator.and_ + return conjunction(initial, reduced) + + def _model_shorthand(self, args): + accum = [] + for arg in args: + if isinstance(arg, Node): + accum.append(arg) + elif isinstance(arg, Query): + accum.append(arg) + elif isinstance(arg, ModelAlias): + accum.extend(arg.get_proxy_fields()) + elif isclass(arg) and issubclass(arg, Model): + accum.extend(arg._meta.declared_fields) + return accum + + @returns_clone + def where(self, *expressions): + self._where = self._add_query_clauses(self._where, expressions) + + @returns_clone + def orwhere(self, *expressions): + self._where = self._add_query_clauses( + self._where, expressions, operator.or_) + + @returns_clone + def join(self, dest, join_type=None, on=None): + src = self._query_ctx + if on is None: + require_join_condition = join_type != JOIN.CROSS and ( + isinstance(dest, SelectQuery) or + (isclass(dest) and not src._meta.rel_exists(dest))) + if require_join_condition: + raise ValueError('A join condition must be specified.') + elif join_type == JOIN.CROSS: + raise ValueError('A CROSS join cannot have a constraint.') + elif isinstance(on, basestring): + on = src._meta.fields[on] + self._joins.setdefault(src, []) + self._joins[src].append(Join(src, dest, join_type, on)) + if not isinstance(dest, SelectQuery): + self._query_ctx = dest + + @returns_clone + def switch(self, model_class=None): + """Change or reset the query context.""" + self._query_ctx = model_class or self.model_class + + def ensure_join(self, lm, rm, on=None, **join_kwargs): + ctx = self._query_ctx + for join in self._joins.get(lm, []): + if join.dest == rm: + return self + return self.switch(lm).join(rm, on=on, **join_kwargs).switch(ctx) + + def convert_dict_to_node(self, qdict): + accum = [] + joins = [] + relationship = (ForeignKeyField, ReverseRelationDescriptor) + for key, value in sorted(qdict.items()): + curr = self.model_class + if '__' in key and key.rsplit('__', 1)[1] in DJANGO_MAP: + key, op = key.rsplit('__', 1) + op = DJANGO_MAP[op] + else: + op = OP.EQ + for piece in key.split('__'): + model_attr = getattr(curr, piece) + if isinstance(model_attr, relationship): + curr = model_attr.rel_model + joins.append(model_attr) + accum.append(Expression(model_attr, op, value)) + return accum, joins + + def filter(self, *args, **kwargs): + # normalize args and kwargs into a new expression + dq_node = Node() + if args: + dq_node &= reduce(operator.and_, [a.clone() for a in args]) + if kwargs: + dq_node &= DQ(**kwargs) + + # dq_node should now be an Expression, lhs = Node(), rhs = ... + q = deque([dq_node]) + dq_joins = set() + while q: + curr = q.popleft() + if not isinstance(curr, Expression): + continue + for side, piece in (('lhs', curr.lhs), ('rhs', curr.rhs)): + if isinstance(piece, DQ): + query, joins = self.convert_dict_to_node(piece.query) + dq_joins.update(joins) + expression = reduce(operator.and_, query) + # Apply values from the DQ object. + expression._negated = piece._negated + expression._alias = piece._alias + setattr(curr, side, expression) + else: + q.append(piece) + + dq_node = dq_node.rhs + + query = self.clone() + for field in dq_joins: + if isinstance(field, ForeignKeyField): + lm, rm = field.model_class, field.rel_model + field_obj = field + elif isinstance(field, ReverseRelationDescriptor): + lm, rm = field.field.rel_model, field.rel_model + field_obj = field.field + query = query.ensure_join(lm, rm, field_obj) + return query.where(dq_node) + + def compiler(self): + return self.database.compiler() + + def sql(self): + raise NotImplementedError + + def _execute(self): + sql, params = self.sql() + return self.database.execute_sql(sql, params, self.require_commit) + + def execute(self): + raise NotImplementedError + + def scalar(self, as_tuple=False, convert=False): + if convert: + row = self.tuples().first() + else: + row = self._execute().fetchone() + if row and not as_tuple: + return row[0] + else: + return row + +class RawQuery(Query): + """ + Execute a SQL query, returning a standard iterable interface that returns + model instances. + """ + def __init__(self, model, query, *params): + self._sql = query + self._params = list(params) + self._qr = None + self._tuples = False + self._dicts = False + super(RawQuery, self).__init__(model) + + def clone(self): + query = RawQuery(self.model_class, self._sql, *self._params) + query._tuples = self._tuples + query._dicts = self._dicts + return query + + join = not_allowed('joining') + where = not_allowed('where') + switch = not_allowed('switch') + + @returns_clone + def tuples(self, tuples=True): + self._tuples = tuples + + @returns_clone + def dicts(self, dicts=True): + self._dicts = dicts + + def sql(self): + return self._sql, self._params + + def execute(self): + if self._qr is None: + if self._tuples: + QRW = self.database.get_result_wrapper(RESULTS_TUPLES) + elif self._dicts: + QRW = self.database.get_result_wrapper(RESULTS_DICTS) + else: + QRW = self.database.get_result_wrapper(RESULTS_NAIVE) + self._qr = QRW(self.model_class, self._execute(), None) + return self._qr + + def __iter__(self): + return iter(self.execute()) + +def allow_extend(orig, new_val, **kwargs): + extend = kwargs.pop('extend', False) + if kwargs: + raise ValueError('"extend" is the only valid keyword argument.') + if extend: + return ((orig or []) + new_val) or None + elif new_val: + return new_val + +class SelectQuery(Query): + _node_type = 'select_query' + + def __init__(self, model_class, *selection): + super(SelectQuery, self).__init__(model_class) + self.require_commit = self.database.commit_select + self.__select(*selection) + self._from = None + self._group_by = None + self._having = None + self._order_by = None + self._windows = None + self._limit = None + self._offset = None + self._distinct = False + self._for_update = None + self._naive = False + self._tuples = False + self._dicts = False + self._aggregate_rows = False + self._alias = None + self._qr = None + + def _clone_attributes(self, query): + query = super(SelectQuery, self)._clone_attributes(query) + query._explicit_selection = self._explicit_selection + query._select = list(self._select) + if self._from is not None: + query._from = [] + for f in self._from: + if isinstance(f, Node): + query._from.append(f.clone()) + else: + query._from.append(f) + if self._group_by is not None: + query._group_by = list(self._group_by) + if self._having: + query._having = self._having.clone() + if self._order_by is not None: + query._order_by = list(self._order_by) + if self._windows is not None: + query._windows = list(self._windows) + query._limit = self._limit + query._offset = self._offset + query._distinct = self._distinct + query._for_update = self._for_update + query._naive = self._naive + query._tuples = self._tuples + query._dicts = self._dicts + query._aggregate_rows = self._aggregate_rows + query._alias = self._alias + return query + + def compound_op(operator): + def inner(self, other): + supported_ops = self.model_class._meta.database.compound_operations + if operator not in supported_ops: + raise ValueError( + 'Your database does not support %s' % operator) + return CompoundSelect(self.model_class, self, operator, other) + return inner + _compound_op_static = staticmethod(compound_op) + __or__ = compound_op('UNION') + __and__ = compound_op('INTERSECT') + __sub__ = compound_op('EXCEPT') + + def __xor__(self, rhs): + # Symmetric difference, should just be (self | rhs) - (self & rhs)... + wrapped_rhs = self.model_class.select(SQL('*')).from_( + EnclosedClause((self & rhs)).alias('_')).order_by() + return (self | rhs) - wrapped_rhs + + def union_all(self, rhs): + return SelectQuery._compound_op_static('UNION ALL')(self, rhs) + + def __select(self, *selection): + self._explicit_selection = len(selection) > 0 + selection = selection or self.model_class._meta.declared_fields + self._select = self._model_shorthand(selection) + select = returns_clone(__select) + + @returns_clone + def from_(self, *args): + self._from = list(args) if args else None + + @returns_clone + def group_by(self, *args, **kwargs): + self._group_by = self._model_shorthand(args) if args else None + + @returns_clone + def having(self, *expressions): + self._having = self._add_query_clauses(self._having, expressions) + + @returns_clone + def order_by(self, *args, **kwargs): + self._order_by = allow_extend(self._order_by, list(args), **kwargs) + + @returns_clone + def window(self, *windows, **kwargs): + self._windows = allow_extend(self._windows, list(windows), **kwargs) + + @returns_clone + def limit(self, lim): + self._limit = lim + + @returns_clone + def offset(self, off): + self._offset = off + + @returns_clone + def paginate(self, page, paginate_by=20): + if page > 0: + page -= 1 + self._limit = paginate_by + self._offset = page * paginate_by + + @returns_clone + def distinct(self, is_distinct=True): + self._distinct = is_distinct + + @returns_clone + def for_update(self, for_update=True, nowait=False): + self._for_update = 'FOR UPDATE NOWAIT' if for_update and nowait else \ + 'FOR UPDATE' if for_update else None + + @returns_clone + def with_lock(self, lock_type='UPDATE'): + self._for_update = ('FOR %s' % lock_type) if lock_type else None + + @returns_clone + def naive(self, naive=True): + self._naive = naive + + @returns_clone + def tuples(self, tuples=True): + self._tuples = tuples + + @returns_clone + def dicts(self, dicts=True): + self._dicts = dicts + + @returns_clone + def aggregate_rows(self, aggregate_rows=True): + self._aggregate_rows = aggregate_rows + + @returns_clone + def alias(self, alias=None): + self._alias = alias + + def annotate(self, rel_model, annotation=None): + if annotation is None: + annotation = fn.Count(rel_model._meta.primary_key).alias('count') + if self._query_ctx == rel_model: + query = self.switch(self.model_class) + else: + query = self.clone() + query = query.ensure_join(query._query_ctx, rel_model) + if not query._group_by: + query._group_by = [x.alias() for x in query._select] + query._select = tuple(query._select) + (annotation,) + return query + + def _aggregate(self, aggregation=None): + if aggregation is None: + aggregation = fn.Count(SQL('*')) + query = self.order_by() + query._select = [aggregation] + return query + + def aggregate(self, aggregation=None, convert=True): + return self._aggregate(aggregation).scalar(convert=convert) + + def count(self, clear_limit=False): + if self._distinct or self._group_by or self._limit or self._offset: + return self.wrapped_count(clear_limit=clear_limit) + + # defaults to a count() of the primary key + return self.aggregate(convert=False) or 0 + + def wrapped_count(self, clear_limit=False): + clone = self.order_by() + if clear_limit: + clone._limit = clone._offset = None + + sql, params = clone.sql() + wrapped = 'SELECT COUNT(1) FROM (%s) AS wrapped_select' % sql + rq = self.model_class.raw(wrapped, *params) + return rq.scalar() or 0 + + def exists(self): + clone = self.paginate(1, 1) + clone._select = [SQL('1')] + return bool(clone.scalar()) + + def get(self): + clone = self.paginate(1, 1) + try: + return next(clone.execute()) + except StopIteration: + raise self.model_class.DoesNotExist( + 'Instance matching query does not exist:\nSQL: %s\nPARAMS: %s' + % self.sql()) + + def peek(self, n=1): + res = self.execute() + res.fill_cache(n) + models = res._result_cache[:n] + if models: + return models[0] if n == 1 else models + + def first(self, n=1): + if self._limit != n: + self._limit = n + self._dirty = True + return self.peek(n=n) + + def sql(self): + return self.compiler().generate_select(self) + + def verify_naive(self): + model_class = self.model_class + for node in self._select: + if isinstance(node, Field) and node.model_class != model_class: + return False + elif isinstance(node, Node) and node._bind_to is not None: + if node._bind_to != model_class: + return False + return True + + def get_query_meta(self): + return (self._select, self._joins) + + def _get_result_wrapper(self): + if self._tuples: + return self.database.get_result_wrapper(RESULTS_TUPLES) + elif self._dicts: + return self.database.get_result_wrapper(RESULTS_DICTS) + elif self._naive or not self._joins or self.verify_naive(): + return self.database.get_result_wrapper(RESULTS_NAIVE) + elif self._aggregate_rows: + return self.database.get_result_wrapper(RESULTS_AGGREGATE_MODELS) + else: + return self.database.get_result_wrapper(RESULTS_MODELS) + + def execute(self): + if self._dirty or self._qr is None: + model_class = self.model_class + query_meta = self.get_query_meta() + ResultWrapper = self._get_result_wrapper() + self._qr = ResultWrapper(model_class, self._execute(), query_meta) + self._dirty = False + return self._qr + else: + return self._qr + + def __iter__(self): + return iter(self.execute()) + + def iterator(self): + return iter(self.execute().iterator()) + + def __getitem__(self, value): + res = self.execute() + if isinstance(value, slice): + index = value.stop + else: + index = value + if index is not None: + index = index + 1 if index >= 0 else None + res.fill_cache(index) + return res._result_cache[value] + + def __len__(self): + return len(self.execute()) + + if PY3: + def __hash__(self): + return id(self) + +class NoopSelectQuery(SelectQuery): + def sql(self): + return (self.database.get_noop_sql(), ()) + + def get_query_meta(self): + return None, None + + def _get_result_wrapper(self): + return self.database.get_result_wrapper(RESULTS_TUPLES) + +class CompoundSelect(SelectQuery): + _node_type = 'compound_select_query' + + def __init__(self, model_class, lhs=None, operator=None, rhs=None): + self.lhs = lhs + self.operator = operator + self.rhs = rhs + super(CompoundSelect, self).__init__(model_class, []) + + def _clone_attributes(self, query): + query = super(CompoundSelect, self)._clone_attributes(query) + query.lhs = self.lhs + query.operator = self.operator + query.rhs = self.rhs + return query + + def count(self, clear_limit=False): + return self.wrapped_count(clear_limit=clear_limit) + + def get_query_meta(self): + return self.lhs.get_query_meta() + + def verify_naive(self): + return self.lhs.verify_naive() and self.rhs.verify_naive() + + def _get_result_wrapper(self): + if self._tuples: + return self.database.get_result_wrapper(RESULTS_TUPLES) + elif self._dicts: + return self.database.get_result_wrapper(RESULTS_DICTS) + elif self._aggregate_rows: + return self.database.get_result_wrapper(RESULTS_AGGREGATE_MODELS) + + has_joins = self.lhs._joins or self.rhs._joins + is_naive = self.lhs._naive or self.rhs._naive or self._naive + if is_naive or not has_joins or self.verify_naive(): + return self.database.get_result_wrapper(RESULTS_NAIVE) + else: + return self.database.get_result_wrapper(RESULTS_MODELS) + +class _WriteQuery(Query): + def __init__(self, model_class): + self._returning = None + self._tuples = False + self._dicts = False + self._qr = None + super(_WriteQuery, self).__init__(model_class) + + def _clone_attributes(self, query): + query = super(_WriteQuery, self)._clone_attributes(query) + if self._returning: + query._returning = list(self._returning) + query._tuples = self._tuples + query._dicts = self._dicts + return query + + def requires_returning(method): + def inner(self, *args, **kwargs): + db = self.model_class._meta.database + if not db.returning_clause: + raise ValueError('RETURNING is not supported by your ' + 'database: %s' % type(db)) + return method(self, *args, **kwargs) + return inner + + @requires_returning + @returns_clone + def returning(self, *selection): + if len(selection) == 1 and selection[0] is None: + self._returning = None + else: + if not selection: + selection = self.model_class._meta.declared_fields + self._returning = self._model_shorthand(selection) + + @requires_returning + @returns_clone + def tuples(self, tuples=True): + self._tuples = tuples + + @requires_returning + @returns_clone + def dicts(self, dicts=True): + self._dicts = dicts + + def get_result_wrapper(self): + if self._returning is not None: + if self._tuples: + return self.database.get_result_wrapper(RESULTS_TUPLES) + elif self._dicts: + return self.database.get_result_wrapper(RESULTS_DICTS) + return self.database.get_result_wrapper(RESULTS_NAIVE) + + def _execute_with_result_wrapper(self): + ResultWrapper = self.get_result_wrapper() + meta = (self._returning, {self.model_class: []}) + self._qr = ResultWrapper(self.model_class, self._execute(), meta) + return self._qr + + +class UpdateQuery(_WriteQuery): + def __init__(self, model_class, update=None): + self._update = update + self._on_conflict = None + super(UpdateQuery, self).__init__(model_class) + + def _clone_attributes(self, query): + query = super(UpdateQuery, self)._clone_attributes(query) + query._update = dict(self._update) + query._on_conflict = self._on_conflict + return query + + @returns_clone + def on_conflict(self, action=None): + self._on_conflict = action + + join = not_allowed('joining') + + def sql(self): + return self.compiler().generate_update(self) + + def execute(self): + if self._returning is not None and self._qr is None: + return self._execute_with_result_wrapper() + elif self._qr is not None: + return self._qr + else: + return self.database.rows_affected(self._execute()) + + def __iter__(self): + if not self.model_class._meta.database.returning_clause: + raise ValueError('UPDATE queries cannot be iterated over unless ' + 'they specify a RETURNING clause, which is not ' + 'supported by your database.') + return iter(self.execute()) + + def iterator(self): + return iter(self.execute().iterator()) + +class InsertQuery(_WriteQuery): + def __init__(self, model_class, field_dict=None, rows=None, + fields=None, query=None, validate_fields=False): + super(InsertQuery, self).__init__(model_class) + + self._upsert = False + self._is_multi_row_insert = rows is not None or query is not None + self._return_id_list = False + if rows is not None: + self._rows = rows + else: + self._rows = [field_dict or {}] + + self._fields = fields + self._query = query + self._validate_fields = validate_fields + self._on_conflict = None + + def _iter_rows(self): + model_meta = self.model_class._meta + if self._validate_fields: + valid_fields = model_meta.valid_fields + def validate_field(field): + if field not in valid_fields: + raise KeyError('"%s" is not a recognized field.' % field) + + defaults = model_meta._default_dict + callables = model_meta._default_callables + + for row_dict in self._rows: + field_row = defaults.copy() + seen = set() + for key in row_dict: + if self._validate_fields: + validate_field(key) + if key in model_meta.fields: + field = model_meta.fields[key] + else: + field = key + field_row[field] = row_dict[key] + seen.add(field) + if callables: + for field in callables: + if field not in seen: + field_row[field] = callables[field]() + yield field_row + + def _clone_attributes(self, query): + query = super(InsertQuery, self)._clone_attributes(query) + query._rows = self._rows + query._upsert = self._upsert + query._is_multi_row_insert = self._is_multi_row_insert + query._fields = self._fields + query._query = self._query + query._return_id_list = self._return_id_list + query._validate_fields = self._validate_fields + query._on_conflict = self._on_conflict + return query + + join = not_allowed('joining') + where = not_allowed('where clause') + + @returns_clone + def upsert(self, upsert=True): + self._upsert = upsert + + @returns_clone + def on_conflict(self, action=None): + self._on_conflict = action + + @returns_clone + def return_id_list(self, return_id_list=True): + self._return_id_list = return_id_list + + @property + def is_insert_returning(self): + if self.database.insert_returning: + if not self._is_multi_row_insert or self._return_id_list: + return True + return False + + def sql(self): + return self.compiler().generate_insert(self) + + def _insert_with_loop(self): + id_list = [] + last_id = None + return_id_list = self._return_id_list + for row in self._rows: + last_id = (InsertQuery(self.model_class, row) + .upsert(self._upsert) + .execute()) + if return_id_list: + id_list.append(last_id) + + if return_id_list: + return id_list + else: + return last_id + + def execute(self): + insert_with_loop = ( + self._is_multi_row_insert and + self._query is None and + self._returning is None and + not self.database.insert_many) + if insert_with_loop: + return self._insert_with_loop() + + if self._returning is not None and self._qr is None: + return self._execute_with_result_wrapper() + elif self._qr is not None: + return self._qr + else: + cursor = self._execute() + if not self._is_multi_row_insert: + if self.database.insert_returning: + pk_row = cursor.fetchone() + meta = self.model_class._meta + clean_data = [ + field.python_value(column) + for field, column + in zip(meta.get_primary_key_fields(), pk_row)] + if self.model_class._meta.composite_key: + return clean_data + return clean_data[0] + return self.database.last_insert_id(cursor, self.model_class) + elif self._return_id_list: + return map(operator.itemgetter(0), cursor.fetchall()) + else: + return True + +class DeleteQuery(_WriteQuery): + join = not_allowed('joining') + + def sql(self): + return self.compiler().generate_delete(self) + + def execute(self): + if self._returning is not None and self._qr is None: + return self._execute_with_result_wrapper() + elif self._qr is not None: + return self._qr + else: + return self.database.rows_affected(self._execute()) + + +IndexMetadata = namedtuple( + 'IndexMetadata', + ('name', 'sql', 'columns', 'unique', 'table')) +ColumnMetadata = namedtuple( + 'ColumnMetadata', + ('name', 'data_type', 'null', 'primary_key', 'table')) +ForeignKeyMetadata = namedtuple( + 'ForeignKeyMetadata', + ('column', 'dest_table', 'dest_column', 'table')) + + +class PeeweeException(Exception): pass +class ImproperlyConfigured(PeeweeException): pass +class DatabaseError(PeeweeException): pass +class DataError(DatabaseError): pass +class IntegrityError(DatabaseError): pass +class InterfaceError(PeeweeException): pass +class InternalError(DatabaseError): pass +class NotSupportedError(DatabaseError): pass +class OperationalError(DatabaseError): pass +class ProgrammingError(DatabaseError): pass + + +class ExceptionWrapper(object): + __slots__ = ['exceptions'] + + def __init__(self, exceptions): + self.exceptions = exceptions + + def __enter__(self): pass + def __exit__(self, exc_type, exc_value, traceback): + if exc_type is None: + return + if exc_type.__name__ in self.exceptions: + new_type = self.exceptions[exc_type.__name__] + if PY26: + exc_args = exc_value + else: + exc_args = exc_value.args + reraise(new_type, new_type(*exc_args), traceback) + +class _BaseConnectionLocal(object): + def __init__(self, **kwargs): + super(_BaseConnectionLocal, self).__init__(**kwargs) + self.autocommit = None + self.closed = True + self.conn = None + self.context_stack = [] + self.transactions = [] + +class _ConnectionLocal(_BaseConnectionLocal, threading.local): + pass + +class Database(object): + commit_select = False + compiler_class = QueryCompiler + compound_operations = ['UNION', 'INTERSECT', 'EXCEPT', 'UNION ALL'] + compound_select_parentheses = False + distinct_on = False + drop_cascade = False + field_overrides = {} + foreign_keys = True + for_update = False + for_update_nowait = False + insert_many = True + insert_returning = False + interpolation = '?' + limit_max = None + op_overrides = {} + quote_char = '"' + reserved_tables = [] + returning_clause = False + savepoints = True + sequences = False + subquery_delete_same_table = True + upsert_sql = None + window_functions = False + + exceptions = { + 'ConstraintError': IntegrityError, + 'DatabaseError': DatabaseError, + 'DataError': DataError, + 'IntegrityError': IntegrityError, + 'InterfaceError': InterfaceError, + 'InternalError': InternalError, + 'NotSupportedError': NotSupportedError, + 'OperationalError': OperationalError, + 'ProgrammingError': ProgrammingError} + + def __init__(self, database, threadlocals=True, autocommit=True, + fields=None, ops=None, autorollback=False, use_speedups=True, + **connect_kwargs): + self.connect_kwargs = {} + if threadlocals: + self._local = _ConnectionLocal() + else: + self._local = _BaseConnectionLocal() + self.init(database, **connect_kwargs) + + self._conn_lock = threading.Lock() + self.autocommit = autocommit + self.autorollback = autorollback + self.use_speedups = use_speedups + + self.field_overrides = merge_dict(self.field_overrides, fields or {}) + self.op_overrides = merge_dict(self.op_overrides, ops or {}) + self.exception_wrapper = ExceptionWrapper(self.exceptions) + + def init(self, database, **connect_kwargs): + if not self.is_closed(): + self.close() + self.deferred = database is None + self.database = database + self.connect_kwargs.update(connect_kwargs) + + def connect(self): + with self._conn_lock: + if self.deferred: + raise OperationalError('Database has not been initialized') + if not self._local.closed: + raise OperationalError('Connection already open') + self._local.conn = self._create_connection() + self._local.closed = False + with self.exception_wrapper: + self.initialize_connection(self._local.conn) + + def initialize_connection(self, conn): + pass + + def close(self): + with self._conn_lock: + if self.deferred: + raise Exception('Error, database not properly initialized ' + 'before closing connection') + with self.exception_wrapper: + self._close(self._local.conn) + self._local.closed = True + + def get_conn(self): + if self._local.context_stack: + conn = self._local.context_stack[-1].connection + if conn is not None: + return conn + if self._local.closed: + self.connect() + return self._local.conn + + def _create_connection(self): + with self.exception_wrapper: + return self._connect(self.database, **self.connect_kwargs) + + def is_closed(self): + return self._local.closed + + def get_cursor(self): + return self.get_conn().cursor() + + def _close(self, conn): + conn.close() + + def _connect(self, database, **kwargs): + raise NotImplementedError + + @classmethod + def register_fields(cls, fields): + cls.field_overrides = merge_dict(cls.field_overrides, fields) + + @classmethod + def register_ops(cls, ops): + cls.op_overrides = merge_dict(cls.op_overrides, ops) + + def get_result_wrapper(self, wrapper_type): + if wrapper_type == RESULTS_NAIVE: + return (_ModelQueryResultWrapper if self.use_speedups + else NaiveQueryResultWrapper) + elif wrapper_type == RESULTS_MODELS: + return ModelQueryResultWrapper + elif wrapper_type == RESULTS_TUPLES: + return (_TuplesQueryResultWrapper if self.use_speedups + else TuplesQueryResultWrapper) + elif wrapper_type == RESULTS_DICTS: + return (_DictQueryResultWrapper if self.use_speedups + else DictQueryResultWrapper) + elif wrapper_type == RESULTS_AGGREGATE_MODELS: + return AggregateQueryResultWrapper + else: + return (_ModelQueryResultWrapper if self.use_speedups + else NaiveQueryResultWrapper) + + def last_insert_id(self, cursor, model): + if model._meta.auto_increment: + return cursor.lastrowid + + def rows_affected(self, cursor): + return cursor.rowcount + + def compiler(self): + return self.compiler_class( + self.quote_char, self.interpolation, self.field_overrides, + self.op_overrides) + + def execute(self, clause): + return self.execute_sql(*self.compiler().parse_node(clause)) + + def execute_sql(self, sql, params=None, require_commit=True): + logger.debug((sql, params)) + with self.exception_wrapper: + cursor = self.get_cursor() + try: + cursor.execute(sql, params or ()) + except Exception: + if self.autorollback and self.get_autocommit(): + self.rollback() + raise + else: + if require_commit and self.get_autocommit(): + self.commit() + return cursor + + def begin(self): + pass + + def commit(self): + with self.exception_wrapper: + self.get_conn().commit() + + def rollback(self): + with self.exception_wrapper: + self.get_conn().rollback() + + def set_autocommit(self, autocommit): + self._local.autocommit = autocommit + + def get_autocommit(self): + if self._local.autocommit is None: + self.set_autocommit(self.autocommit) + return self._local.autocommit + + def push_execution_context(self, transaction): + self._local.context_stack.append(transaction) + + def pop_execution_context(self): + self._local.context_stack.pop() + + def execution_context_depth(self): + return len(self._local.context_stack) + + def execution_context(self, with_transaction=True, transaction_type=None): + return ExecutionContext(self, with_transaction, transaction_type) + + __call__ = execution_context + + def push_transaction(self, transaction): + self._local.transactions.append(transaction) + + def pop_transaction(self): + self._local.transactions.pop() + + def transaction_depth(self): + return len(self._local.transactions) + + def transaction(self, transaction_type=None): + return transaction(self, transaction_type) + commit_on_success = property(transaction) + + def savepoint(self, sid=None): + if not self.savepoints: + raise NotImplementedError + return savepoint(self, sid) + + def atomic(self, transaction_type=None): + return _atomic(self, transaction_type) + + def get_tables(self, schema=None): + raise NotImplementedError + + def get_indexes(self, table, schema=None): + raise NotImplementedError + + def get_columns(self, table, schema=None): + raise NotImplementedError + + def get_primary_keys(self, table, schema=None): + raise NotImplementedError + + def get_foreign_keys(self, table, schema=None): + raise NotImplementedError + + def sequence_exists(self, seq): + raise NotImplementedError + + def create_table(self, model_class, safe=False): + qc = self.compiler() + return self.execute_sql(*qc.create_table(model_class, safe)) + + def create_tables(self, models, safe=False): + create_model_tables(models, fail_silently=safe) + + def create_index(self, model_class, fields, unique=False): + qc = self.compiler() + if not isinstance(fields, (list, tuple)): + raise ValueError('Fields passed to "create_index" must be a list ' + 'or tuple: "%s"' % fields) + fobjs = [ + model_class._meta.fields[f] if isinstance(f, basestring) else f + for f in fields] + return self.execute_sql(*qc.create_index(model_class, fobjs, unique)) + + def drop_index(self, model_class, fields, safe=False): + qc = self.compiler() + if not isinstance(fields, (list, tuple)): + raise ValueError('Fields passed to "drop_index" must be a list ' + 'or tuple: "%s"' % fields) + fobjs = [ + model_class._meta.fields[f] if isinstance(f, basestring) else f + for f in fields] + return self.execute_sql(*qc.drop_index(model_class, fobjs, safe)) + + def create_foreign_key(self, model_class, field, constraint=None): + qc = self.compiler() + return self.execute_sql(*qc.create_foreign_key( + model_class, field, constraint)) + + def create_sequence(self, seq): + if self.sequences: + qc = self.compiler() + return self.execute_sql(*qc.create_sequence(seq)) + + def drop_table(self, model_class, fail_silently=False, cascade=False): + qc = self.compiler() + return self.execute_sql(*qc.drop_table( + model_class, fail_silently, cascade)) + + def drop_tables(self, models, safe=False, cascade=False): + drop_model_tables(models, fail_silently=safe, cascade=cascade) + + def truncate_table(self, model_class, restart_identity=False, + cascade=False): + qc = self.compiler() + return self.execute_sql(*qc.truncate_table( + model_class, restart_identity, cascade)) + + def truncate_tables(self, models, restart_identity=False, cascade=False): + for model in reversed(sort_models_topologically(models)): + model.truncate_table(restart_identity, cascade) + + def drop_sequence(self, seq): + if self.sequences: + qc = self.compiler() + return self.execute_sql(*qc.drop_sequence(seq)) + + def extract_date(self, date_part, date_field): + return fn.EXTRACT(Clause(date_part, R('FROM'), date_field)) + + def truncate_date(self, date_part, date_field): + return fn.DATE_TRUNC(date_part, date_field) + + def default_insert_clause(self, model_class): + return SQL('DEFAULT VALUES') + + def get_noop_sql(self): + return 'SELECT 0 WHERE 0' + + def get_binary_type(self): + return binary_construct + +def __pragma__(name): + def __get__(self): + return self.pragma(name) + def __set__(self, value): + return self.pragma(name, value) + return property(__get__, __set__) + +class SqliteDatabase(Database): + compiler_class = SqliteQueryCompiler + field_overrides = { + 'bool': 'INTEGER', + 'smallint': 'INTEGER', + 'uuid': 'TEXT', + } + foreign_keys = False + insert_many = sqlite3 and sqlite3.sqlite_version_info >= (3, 7, 11, 0) + limit_max = -1 + op_overrides = { + OP.LIKE: 'GLOB', + OP.ILIKE: 'LIKE', + } + upsert_sql = 'INSERT OR REPLACE INTO' + + def __init__(self, database, pragmas=None, *args, **kwargs): + self._pragmas = pragmas or [] + journal_mode = kwargs.pop('journal_mode', None) # Backwards-compat. + if journal_mode: + self._pragmas.append(('journal_mode', journal_mode)) + + super(SqliteDatabase, self).__init__(database, *args, **kwargs) + + def _connect(self, database, **kwargs): + if not sqlite3: + raise ImproperlyConfigured('pysqlite or sqlite3 must be installed.') + conn = sqlite3.connect(database, **kwargs) + conn.isolation_level = None + try: + self._add_conn_hooks(conn) + except: + conn.close() + raise + return conn + + def _add_conn_hooks(self, conn): + self._set_pragmas(conn) + conn.create_function('date_part', 2, _sqlite_date_part) + conn.create_function('date_trunc', 2, _sqlite_date_trunc) + conn.create_function('regexp', 2, _sqlite_regexp) + + def _set_pragmas(self, conn): + if self._pragmas: + cursor = conn.cursor() + for pragma, value in self._pragmas: + cursor.execute('PRAGMA %s = %s;' % (pragma, value)) + cursor.close() + + def pragma(self, key, value=SENTINEL): + sql = 'PRAGMA %s' % key + if value is not SENTINEL: + sql += ' = %s' % value + return self.execute_sql(sql).fetchone() + + cache_size = __pragma__('cache_size') + foreign_keys = __pragma__('foreign_keys') + journal_mode = __pragma__('journal_mode') + journal_size_limit = __pragma__('journal_size_limit') + mmap_size = __pragma__('mmap_size') + page_size = __pragma__('page_size') + read_uncommitted = __pragma__('read_uncommitted') + synchronous = __pragma__('synchronous') + wal_autocheckpoint = __pragma__('wal_autocheckpoint') + + def begin(self, lock_type=None): + statement = 'BEGIN %s' % lock_type if lock_type else 'BEGIN' + self.execute_sql(statement, require_commit=False) + + def transaction(self, transaction_type=None): + return transaction_sqlite(self, transaction_type) + + def create_foreign_key(self, model_class, field, constraint=None): + raise OperationalError('SQLite does not support ALTER TABLE ' + 'statements to add constraints.') + + def get_tables(self, schema=None): + cursor = self.execute_sql('SELECT name FROM sqlite_master WHERE ' + 'type = ? ORDER BY name;', ('table',)) + return [row[0] for row in cursor.fetchall()] + + def get_indexes(self, table, schema=None): + query = ('SELECT name, sql FROM sqlite_master ' + 'WHERE tbl_name = ? AND type = ? ORDER BY name') + cursor = self.execute_sql(query, (table, 'index')) + index_to_sql = dict(cursor.fetchall()) + + # Determine which indexes have a unique constraint. + unique_indexes = set() + cursor = self.execute_sql('PRAGMA index_list("%s")' % table) + for row in cursor.fetchall(): + name = row[1] + is_unique = int(row[2]) == 1 + if is_unique: + unique_indexes.add(name) + + # Retrieve the indexed columns. + index_columns = {} + for index_name in sorted(index_to_sql): + cursor = self.execute_sql('PRAGMA index_info("%s")' % index_name) + index_columns[index_name] = [row[2] for row in cursor.fetchall()] + + return [ + IndexMetadata( + name, + index_to_sql[name], + index_columns[name], + name in unique_indexes, + table) + for name in sorted(index_to_sql)] + + def get_columns(self, table, schema=None): + cursor = self.execute_sql('PRAGMA table_info("%s")' % table) + return [ColumnMetadata(row[1], row[2], not row[3], bool(row[5]), table) + for row in cursor.fetchall()] + + def get_primary_keys(self, table, schema=None): + cursor = self.execute_sql('PRAGMA table_info("%s")' % table) + return [row[1] for row in cursor.fetchall() if row[-1]] + + def get_foreign_keys(self, table, schema=None): + cursor = self.execute_sql('PRAGMA foreign_key_list("%s")' % table) + return [ForeignKeyMetadata(row[3], row[2], row[4], table) + for row in cursor.fetchall()] + + def savepoint(self, sid=None): + return savepoint_sqlite(self, sid) + + def extract_date(self, date_part, date_field): + return fn.date_part(date_part, date_field) + + def truncate_date(self, date_part, date_field): + return fn.strftime(SQLITE_DATE_TRUNC_MAPPING[date_part], date_field) + + def get_binary_type(self): + return sqlite3.Binary + +class PostgresqlDatabase(Database): + commit_select = True + compound_select_parentheses = True + distinct_on = True + drop_cascade = True + field_overrides = { + 'blob': 'BYTEA', + 'bool': 'BOOLEAN', + 'datetime': 'TIMESTAMP', + 'decimal': 'NUMERIC', + 'double': 'DOUBLE PRECISION', + 'primary_key': 'SERIAL', + 'uuid': 'UUID', + } + for_update = True + for_update_nowait = True + insert_returning = True + interpolation = '%s' + op_overrides = { + OP.REGEXP: '~', + } + reserved_tables = ['user'] + returning_clause = True + sequences = True + window_functions = True + + register_unicode = True + + def _connect(self, database, encoding=None, **kwargs): + if not psycopg2: + raise ImproperlyConfigured('psycopg2 must be installed.') + conn = psycopg2.connect(database=database, **kwargs) + if self.register_unicode: + pg_extensions.register_type(pg_extensions.UNICODE, conn) + pg_extensions.register_type(pg_extensions.UNICODEARRAY, conn) + if encoding: + conn.set_client_encoding(encoding) + return conn + + def _get_pk_sequence(self, model): + meta = model._meta + if meta.primary_key is not False and meta.primary_key.sequence: + return meta.primary_key.sequence + elif meta.auto_increment: + return '%s_%s_seq' % (meta.db_table, meta.primary_key.db_column) + + def last_insert_id(self, cursor, model): + sequence = self._get_pk_sequence(model) + if not sequence: + return + + meta = model._meta + if meta.schema: + schema = '%s.' % meta.schema + else: + schema = '' + + cursor.execute("SELECT CURRVAL('%s\"%s\"')" % (schema, sequence)) + result = cursor.fetchone()[0] + if self.get_autocommit(): + self.commit() + return result + + def get_tables(self, schema='public'): + query = ('SELECT tablename FROM pg_catalog.pg_tables ' + 'WHERE schemaname = %s ORDER BY tablename') + return [r for r, in self.execute_sql(query, (schema,)).fetchall()] + + def get_indexes(self, table, schema='public'): + query = """ + SELECT + i.relname, idxs.indexdef, idx.indisunique, + array_to_string(array_agg(cols.attname), ',') + FROM pg_catalog.pg_class AS t + INNER JOIN pg_catalog.pg_index AS idx ON t.oid = idx.indrelid + INNER JOIN pg_catalog.pg_class AS i ON idx.indexrelid = i.oid + INNER JOIN pg_catalog.pg_indexes AS idxs ON + (idxs.tablename = t.relname AND idxs.indexname = i.relname) + LEFT OUTER JOIN pg_catalog.pg_attribute AS cols ON + (cols.attrelid = t.oid AND cols.attnum = ANY(idx.indkey)) + WHERE t.relname = %s AND t.relkind = %s AND idxs.schemaname = %s + GROUP BY i.relname, idxs.indexdef, idx.indisunique + ORDER BY idx.indisunique DESC, i.relname;""" + cursor = self.execute_sql(query, (table, 'r', schema)) + return [IndexMetadata(row[0], row[1], row[3].split(','), row[2], table) + for row in cursor.fetchall()] + + def get_columns(self, table, schema='public'): + query = """ + SELECT column_name, is_nullable, data_type + FROM information_schema.columns + WHERE table_name = %s AND table_schema = %s + ORDER BY ordinal_position""" + cursor = self.execute_sql(query, (table, schema)) + pks = set(self.get_primary_keys(table, schema)) + return [ColumnMetadata(name, dt, null == 'YES', name in pks, table) + for name, null, dt in cursor.fetchall()] + + def get_primary_keys(self, table, schema='public'): + query = """ + SELECT kc.column_name + FROM information_schema.table_constraints AS tc + INNER JOIN information_schema.key_column_usage AS kc ON ( + tc.table_name = kc.table_name AND + tc.table_schema = kc.table_schema AND + tc.constraint_name = kc.constraint_name) + WHERE + tc.constraint_type = %s AND + tc.table_name = %s AND + tc.table_schema = %s""" + cursor = self.execute_sql(query, ('PRIMARY KEY', table, schema)) + return [row for row, in cursor.fetchall()] + + def get_foreign_keys(self, table, schema='public'): + sql = """ + SELECT + kcu.column_name, ccu.table_name, ccu.column_name + FROM information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu + ON (tc.constraint_name = kcu.constraint_name AND + tc.constraint_schema = kcu.constraint_schema) + JOIN information_schema.constraint_column_usage AS ccu + ON (ccu.constraint_name = tc.constraint_name AND + ccu.constraint_schema = tc.constraint_schema) + WHERE + tc.constraint_type = 'FOREIGN KEY' AND + tc.table_name = %s AND + tc.table_schema = %s""" + cursor = self.execute_sql(sql, (table, schema)) + return [ForeignKeyMetadata(row[0], row[1], row[2], table) + for row in cursor.fetchall()] + + def sequence_exists(self, sequence): + res = self.execute_sql(""" + SELECT COUNT(*) FROM pg_class, pg_namespace + WHERE relkind='S' + AND pg_class.relnamespace = pg_namespace.oid + AND relname=%s""", (sequence,)) + return bool(res.fetchone()[0]) + + def set_search_path(self, *search_path): + path_params = ','.join(['%s'] * len(search_path)) + self.execute_sql('SET search_path TO %s' % path_params, search_path) + + def get_noop_sql(self): + return 'SELECT 0 WHERE false' + + def get_binary_type(self): + return psycopg2.Binary + +class MySQLDatabase(Database): + commit_select = True + compound_select_parentheses = True + compound_operations = ['UNION', 'UNION ALL'] + field_overrides = { + 'bool': 'BOOL', + 'decimal': 'NUMERIC', + 'double': 'DOUBLE PRECISION', + 'float': 'FLOAT', + 'primary_key': 'INTEGER AUTO_INCREMENT', + 'text': 'LONGTEXT', + 'uuid': 'VARCHAR(40)', + } + for_update = True + interpolation = '%s' + limit_max = 2 ** 64 - 1 # MySQL quirk + op_overrides = { + OP.LIKE: 'LIKE BINARY', + OP.ILIKE: 'LIKE', + OP.XOR: 'XOR', + } + quote_char = '`' + subquery_delete_same_table = False + upsert_sql = 'REPLACE INTO' + + def _connect(self, database, **kwargs): + if not mysql: + raise ImproperlyConfigured('MySQLdb or PyMySQL must be installed.') + conn_kwargs = { + 'charset': 'utf8', + 'use_unicode': True, + } + conn_kwargs.update(kwargs) + if 'password' in conn_kwargs: + conn_kwargs['passwd'] = conn_kwargs.pop('password') + return mysql.connect(db=database, **conn_kwargs) + + def get_tables(self, schema=None): + return [row for row, in self.execute_sql('SHOW TABLES')] + + def get_indexes(self, table, schema=None): + cursor = self.execute_sql('SHOW INDEX FROM `%s`' % table) + unique = set() + indexes = {} + for row in cursor.fetchall(): + if not row[1]: + unique.add(row[2]) + indexes.setdefault(row[2], []) + indexes[row[2]].append(row[4]) + return [IndexMetadata(name, None, indexes[name], name in unique, table) + for name in indexes] + + def get_columns(self, table, schema=None): + sql = """ + SELECT column_name, is_nullable, data_type + FROM information_schema.columns + WHERE table_name = %s AND table_schema = DATABASE()""" + cursor = self.execute_sql(sql, (table,)) + pks = set(self.get_primary_keys(table)) + return [ColumnMetadata(name, dt, null == 'YES', name in pks, table) + for name, null, dt in cursor.fetchall()] + + def get_primary_keys(self, table, schema=None): + cursor = self.execute_sql('SHOW INDEX FROM `%s`' % table) + return [row[4] for row in cursor.fetchall() if row[2] == 'PRIMARY'] + + def get_foreign_keys(self, table, schema=None): + query = """ + SELECT column_name, referenced_table_name, referenced_column_name + FROM information_schema.key_column_usage + WHERE table_name = %s + AND table_schema = DATABASE() + AND referenced_table_name IS NOT NULL + AND referenced_column_name IS NOT NULL""" + cursor = self.execute_sql(query, (table,)) + return [ + ForeignKeyMetadata(column, dest_table, dest_column, table) + for column, dest_table, dest_column in cursor.fetchall()] + + def extract_date(self, date_part, date_field): + return fn.EXTRACT(Clause(R(date_part), R('FROM'), date_field)) + + def truncate_date(self, date_part, date_field): + return fn.DATE_FORMAT(date_field, MYSQL_DATE_TRUNC_MAPPING[date_part]) + + def default_insert_clause(self, model_class): + return Clause( + EnclosedClause(model_class._meta.primary_key), + SQL('VALUES (DEFAULT)')) + + def get_noop_sql(self): + return 'DO 0' + + def get_binary_type(self): + return mysql.Binary + + +class _callable_context_manager(object): + __slots__ = () + def __call__(self, fn): + @wraps(fn) + def inner(*args, **kwargs): + with self: + return fn(*args, **kwargs) + return inner + +class ExecutionContext(_callable_context_manager): + def __init__(self, database, with_transaction=True, transaction_type=None): + self.database = database + self.with_transaction = with_transaction + self.transaction_type = transaction_type + self.connection = None + + def __enter__(self): + with self.database._conn_lock: + self.database.push_execution_context(self) + self.connection = self.database._connect( + self.database.database, + **self.database.connect_kwargs) + if self.with_transaction: + self.txn = self.database.transaction() + self.txn.__enter__() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + with self.database._conn_lock: + if self.connection is None: + self.database.pop_execution_context() + else: + try: + if self.with_transaction: + if not exc_type: + self.txn.commit(False) + self.txn.__exit__(exc_type, exc_val, exc_tb) + finally: + self.database.pop_execution_context() + self.database._close(self.connection) + +class Using(ExecutionContext): + def __init__(self, database, models, with_transaction=True): + super(Using, self).__init__(database, with_transaction) + self.models = models + + def __enter__(self): + self._orig = [] + for model in self.models: + self._orig.append(model._meta.database) + model._meta.database = self.database + return super(Using, self).__enter__() + + def __exit__(self, exc_type, exc_val, exc_tb): + super(Using, self).__exit__(exc_type, exc_val, exc_tb) + for i, model in enumerate(self.models): + model._meta.database = self._orig[i] + +class _atomic(_callable_context_manager): + __slots__ = ('db', 'transaction_type', 'context_manager') + def __init__(self, db, transaction_type=None): + self.db = db + self.transaction_type = transaction_type + + def __enter__(self): + if self.db.transaction_depth() == 0: + self.context_manager = self.db.transaction(self.transaction_type) + else: + self.context_manager = self.db.savepoint() + return self.context_manager.__enter__() + + def __exit__(self, exc_type, exc_val, exc_tb): + return self.context_manager.__exit__(exc_type, exc_val, exc_tb) + +class transaction(_callable_context_manager): + __slots__ = ('db', 'autocommit', 'transaction_type') + def __init__(self, db, transaction_type=None): + self.db = db + self.transaction_type = transaction_type + + def _begin(self): + self.db.begin() + + def commit(self, begin=True): + self.db.commit() + if begin: self._begin() + + def rollback(self, begin=True): + self.db.rollback() + if begin: self._begin() + + def __enter__(self): + self.autocommit = self.db.get_autocommit() + self.db.set_autocommit(False) + if self.db.transaction_depth() == 0: self._begin() + self.db.push_transaction(self) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + try: + if exc_type: + self.rollback(False) + elif self.db.transaction_depth() == 1: + try: + self.commit(False) + except: + self.rollback(False) + raise + finally: + self.db.set_autocommit(self.autocommit) + self.db.pop_transaction() + +class savepoint(_callable_context_manager): + __slots__ = ('db', 'sid', 'quoted_sid', 'autocommit') + def __init__(self, db, sid=None): + self.db = db + _compiler = db.compiler() + self.sid = sid or 's' + uuid.uuid4().hex + self.quoted_sid = _compiler.quote(self.sid) + + def _execute(self, query): + self.db.execute_sql(query, require_commit=False) + + def commit(self): + self._execute('RELEASE SAVEPOINT %s;' % self.quoted_sid) + + def rollback(self): + self._execute('ROLLBACK TO SAVEPOINT %s;' % self.quoted_sid) + + def __enter__(self): + self.autocommit = self.db.get_autocommit() + self.db.set_autocommit(False) + self._execute('SAVEPOINT %s;' % self.quoted_sid) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + try: + if exc_type: + self.rollback() + else: + try: + self.commit() + except: + self.rollback() + raise + finally: + self.db.set_autocommit(self.autocommit) + +class transaction_sqlite(transaction): + __slots__ = () + def _begin(self): + self.db.begin(lock_type=self.transaction_type) + +class savepoint_sqlite(savepoint): + __slots__ = ('isolation_level',) + def __enter__(self): + conn = self.db.get_conn() + # For sqlite, the connection's isolation_level *must* be set to None. + # The act of setting it, though, will break any existing savepoints, + # so only write to it if necessary. + if conn.isolation_level is not None: + self.isolation_level = conn.isolation_level + conn.isolation_level = None + else: + self.isolation_level = None + return super(savepoint_sqlite, self).__enter__() + + def __exit__(self, exc_type, exc_val, exc_tb): + try: + return super(savepoint_sqlite, self).__exit__( + exc_type, exc_val, exc_tb) + finally: + if self.isolation_level is not None: + self.db.get_conn().isolation_level = self.isolation_level + +class FieldProxy(Field): + def __init__(self, alias, field_instance): + self._model_alias = alias + self.model = self._model_alias.model_class + self.field_instance = field_instance + + def clone_base(self): + return FieldProxy(self._model_alias, self.field_instance) + + def coerce(self, value): + return self.field_instance.coerce(value) + + def python_value(self, value): + return self.field_instance.python_value(value) + + def db_value(self, value): + return self.field_instance.db_value(value) + + def __getattr__(self, attr): + if attr == 'model_class': + return self._model_alias + return getattr(self.field_instance, attr) + +class ModelAlias(object): + def __init__(self, model_class): + self.__dict__['model_class'] = model_class + + def __getattr__(self, attr): + model_attr = getattr(self.model_class, attr) + if isinstance(model_attr, Field): + return FieldProxy(self, model_attr) + return model_attr + + def __setattr__(self, attr, value): + raise AttributeError('Cannot set attributes on ModelAlias instances') + + def get_proxy_fields(self, declared_fields=False): + mm = self.model_class._meta + fields = mm.declared_fields if declared_fields else mm.sorted_fields + return [FieldProxy(self, f) for f in fields] + + def select(self, *selection): + if not selection: + selection = self.get_proxy_fields() + query = SelectQuery(self, *selection) + if self._meta.order_by: + query = query.order_by(*self._meta.order_by) + return query + + def __call__(self, **kwargs): + return self.model_class(**kwargs) + +if _SortedFieldList is None: + class _SortedFieldList(object): + __slots__ = ('_keys', '_items') + + def __init__(self): + self._keys = [] + self._items = [] + + def __getitem__(self, i): + return self._items[i] + + def __iter__(self): + return iter(self._items) + + def __contains__(self, item): + k = item._sort_key + i = bisect_left(self._keys, k) + j = bisect_right(self._keys, k) + return item in self._items[i:j] + + def index(self, field): + return self._keys.index(field._sort_key) + + def insert(self, item): + k = item._sort_key + i = bisect_left(self._keys, k) + self._keys.insert(i, k) + self._items.insert(i, item) + + def remove(self, item): + idx = self.index(item) + del self._items[idx] + del self._keys[idx] + +class DoesNotExist(Exception): pass + +if sqlite3: + default_database = SqliteDatabase('peewee.db') +else: + default_database = None + +class ModelOptions(object): + def __init__(self, cls, database=None, db_table=None, db_table_func=None, + indexes=None, order_by=None, primary_key=None, + table_alias=None, constraints=None, schema=None, + validate_backrefs=True, only_save_dirty=False, + depends_on=None, **kwargs): + self.model_class = cls + self.name = cls.__name__.lower() + self.fields = {} + self.columns = {} + self.defaults = {} + self._default_by_name = {} + self._default_dict = {} + self._default_callables = {} + self._default_callable_list = [] + self._sorted_field_list = _SortedFieldList() + self.sorted_fields = [] + self.sorted_field_names = [] + self.valid_fields = set() + self.declared_fields = [] + + self.database = database if database is not None else default_database + self.db_table = db_table + self.db_table_func = db_table_func + self.indexes = list(indexes or []) + self.order_by = order_by + self.primary_key = primary_key + self.table_alias = table_alias + self.constraints = constraints + self.schema = schema + self.validate_backrefs = validate_backrefs + self.only_save_dirty = only_save_dirty + self.depends_on = depends_on + + self.auto_increment = None + self.composite_key = False + self.rel = {} + self.reverse_rel = {} + + for key, value in kwargs.items(): + setattr(self, key, value) + self._additional_keys = set(kwargs.keys()) + + if self.db_table_func and not self.db_table: + self.db_table = self.db_table_func(cls) + + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, self.name) + + def prepared(self): + if self.order_by: + norm_order_by = [] + for item in self.order_by: + if isinstance(item, Field): + prefix = '-' if item._ordering == 'DESC' else '' + item = prefix + item.name + field = self.fields[item.lstrip('-')] + if item.startswith('-'): + norm_order_by.append(field.desc()) + else: + norm_order_by.append(field.asc()) + self.order_by = norm_order_by + + def _update_field_lists(self): + self.sorted_fields = list(self._sorted_field_list) + self.sorted_field_names = [f.name for f in self.sorted_fields] + self.valid_fields = (set(self.fields.keys()) | + set(self.fields.values()) | + set((self.primary_key,))) + self.declared_fields = [field for field in self.sorted_fields + if not field.undeclared] + + def add_field(self, field): + self.remove_field(field.name) + self.fields[field.name] = field + self.columns[field.db_column] = field + + self._sorted_field_list.insert(field) + self._update_field_lists() + + if field.default is not None: + self.defaults[field] = field.default + if callable(field.default): + self._default_callables[field] = field.default + self._default_callable_list.append((field.name, field.default)) + else: + self._default_dict[field] = field.default + self._default_by_name[field.name] = field.default + + def remove_field(self, field_name): + if field_name not in self.fields: + return + original = self.fields.pop(field_name) + del self.columns[original.db_column] + self._sorted_field_list.remove(original) + self._update_field_lists() + + if original.default is not None: + del self.defaults[original] + if self._default_callables.pop(original, None): + for i, (name, _) in enumerate(self._default_callable_list): + if name == field_name: + self._default_callable_list.pop(i) + break + else: + self._default_dict.pop(original, None) + self._default_by_name.pop(original.name, None) + + def get_default_dict(self): + dd = self._default_by_name.copy() + for field_name, default in self._default_callable_list: + dd[field_name] = default() + return dd + + def get_field_index(self, field): + try: + return self._sorted_field_list.index(field) + except ValueError: + return -1 + + def get_primary_key_fields(self): + if self.composite_key: + return [ + self.fields[field_name] + for field_name in self.primary_key.field_names] + return [self.primary_key] + + def rel_for_model(self, model, field_obj=None, multi=False): + is_field = isinstance(field_obj, Field) + is_node = not is_field and isinstance(field_obj, Node) + if multi: + accum = [] + for field in self.sorted_fields: + if isinstance(field, ForeignKeyField) and field.rel_model == model: + is_match = ( + (field_obj is None) or + (is_field and field_obj.name == field.name) or + (is_node and field_obj._alias == field.name)) + if is_match: + if not multi: + return field + accum.append(field) + if multi: + return accum + + def reverse_rel_for_model(self, model, field_obj=None, multi=False): + return model._meta.rel_for_model(self.model_class, field_obj, multi) + + def rel_exists(self, model): + return self.rel_for_model(model) or self.reverse_rel_for_model(model) + + def related_models(self, backrefs=False): + models = [] + stack = [self.model_class] + while stack: + model = stack.pop() + if model in models: + continue + models.append(model) + for fk in model._meta.rel.values(): + stack.append(fk.rel_model) + if backrefs: + for fk in model._meta.reverse_rel.values(): + stack.append(fk.model_class) + return models + + +class BaseModel(type): + inheritable = set([ + 'constraints', 'database', 'db_table_func', 'indexes', 'order_by', + 'primary_key', 'schema', 'validate_backrefs', 'only_save_dirty']) + + def __new__(cls, name, bases, attrs): + if name == _METACLASS_ or bases[0].__name__ == _METACLASS_: + return super(BaseModel, cls).__new__(cls, name, bases, attrs) + + meta_options = {} + meta = attrs.pop('Meta', None) + if meta: + for k, v in meta.__dict__.items(): + if not k.startswith('_'): + meta_options[k] = v + + model_pk = getattr(meta, 'primary_key', None) + parent_pk = None + + # inherit any field descriptors by deep copying the underlying field + # into the attrs of the new model, additionally see if the bases define + # inheritable model options and swipe them + for b in bases: + if not hasattr(b, '_meta'): + continue + + base_meta = getattr(b, '_meta') + if parent_pk is None: + parent_pk = deepcopy(base_meta.primary_key) + all_inheritable = cls.inheritable | base_meta._additional_keys + for (k, v) in base_meta.__dict__.items(): + if k in all_inheritable and k not in meta_options: + meta_options[k] = v + + for (k, v) in b.__dict__.items(): + if k in attrs: + continue + if isinstance(v, FieldDescriptor): + if not v.field.primary_key: + attrs[k] = deepcopy(v.field) + + # initialize the new class and set the magic attributes + cls = super(BaseModel, cls).__new__(cls, name, bases, attrs) + ModelOptionsBase = meta_options.get('model_options_base', ModelOptions) + cls._meta = ModelOptionsBase(cls, **meta_options) + cls._data = None + cls._meta.indexes = list(cls._meta.indexes) + + if not cls._meta.db_table: + cls._meta.db_table = re.sub('[^\w]+', '_', cls.__name__.lower()) + + # replace fields with field descriptors, calling the add_to_class hook + fields = [] + for name, attr in cls.__dict__.items(): + if isinstance(attr, Field): + if attr.primary_key and model_pk: + raise ValueError('primary key is overdetermined.') + elif attr.primary_key: + model_pk, pk_name = attr, name + else: + fields.append((attr, name)) + + composite_key = False + if model_pk is None: + if parent_pk: + model_pk, pk_name = parent_pk, parent_pk.name + else: + model_pk, pk_name = PrimaryKeyField(primary_key=True), 'id' + elif isinstance(model_pk, CompositeKey): + pk_name = '_composite_key' + composite_key = True + + if model_pk is not False: + model_pk.add_to_class(cls, pk_name) + cls._meta.primary_key = model_pk + cls._meta.auto_increment = ( + isinstance(model_pk, PrimaryKeyField) or + bool(model_pk.sequence)) + cls._meta.composite_key = composite_key + + for field, name in fields: + field.add_to_class(cls, name) + + # create a repr and error class before finalizing + if hasattr(cls, '__unicode__'): + setattr(cls, '__repr__', lambda self: '<%s: %r>' % ( + cls.__name__, self.__unicode__())) + + exc_name = '%sDoesNotExist' % cls.__name__ + exc_attrs = {'__module__': cls.__module__} + exception_class = type(exc_name, (DoesNotExist,), exc_attrs) + cls.DoesNotExist = exception_class + cls._meta.prepared() + + if hasattr(cls, 'validate_model'): + cls.validate_model() + + DeferredRelation.resolve(cls) + + return cls + + def __iter__(self): + return iter(self.select()) + +class Model(with_metaclass(BaseModel)): + def __init__(self, *args, **kwargs): + self._data = self._meta.get_default_dict() + self._dirty = set(self._data) + self._obj_cache = {} + + for k, v in kwargs.items(): + setattr(self, k, v) + + @classmethod + def alias(cls): + return ModelAlias(cls) + + @classmethod + def select(cls, *selection): + query = SelectQuery(cls, *selection) + if cls._meta.order_by: + query = query.order_by(*cls._meta.order_by) + return query + + @classmethod + def update(cls, __data=None, **update): + fdict = __data or {} + fdict.update([(cls._meta.fields[f], update[f]) for f in update]) + return UpdateQuery(cls, fdict) + + @classmethod + def insert(cls, __data=None, **insert): + fdict = __data or {} + fdict.update([(cls._meta.fields[f], insert[f]) for f in insert]) + return InsertQuery(cls, fdict) + + @classmethod + def insert_many(cls, rows, validate_fields=True): + return InsertQuery(cls, rows=rows, validate_fields=validate_fields) + + @classmethod + def insert_from(cls, fields, query): + return InsertQuery(cls, fields=fields, query=query) + + @classmethod + def delete(cls): + return DeleteQuery(cls) + + @classmethod + def raw(cls, sql, *params): + return RawQuery(cls, sql, *params) + + @classmethod + def create(cls, **query): + inst = cls(**query) + inst.save(force_insert=True) + inst._prepare_instance() + return inst + + @classmethod + def get(cls, *query, **kwargs): + sq = cls.select().naive() + if query: + sq = sq.where(*query) + if kwargs: + sq = sq.filter(**kwargs) + return sq.get() + + @classmethod + def get_or_create(cls, **kwargs): + defaults = kwargs.pop('defaults', {}) + query = cls.select() + for field, value in kwargs.items(): + if '__' in field: + query = query.filter(**{field: value}) + else: + query = query.where(getattr(cls, field) == value) + + try: + return query.get(), False + except cls.DoesNotExist: + try: + params = dict((k, v) for k, v in kwargs.items() + if '__' not in k) + params.update(defaults) + with cls._meta.database.atomic(): + return cls.create(**params), True + except IntegrityError as exc: + try: + return query.get(), False + except cls.DoesNotExist: + raise exc + + @classmethod + def create_or_get(cls, **kwargs): + try: + with cls._meta.database.atomic(): + return cls.create(**kwargs), True + except IntegrityError: + query = [] # TODO: multi-column unique constraints. + for field_name, value in kwargs.items(): + field = getattr(cls, field_name) + if field.unique or field.primary_key: + query.append(field == value) + return cls.get(*query), False + + @classmethod + def filter(cls, *dq, **query): + return cls.select().filter(*dq, **query) + + @classmethod + def table_exists(cls): + kwargs = {} + if cls._meta.schema: + kwargs['schema'] = cls._meta.schema + return cls._meta.db_table in cls._meta.database.get_tables(**kwargs) + + @classmethod + def create_table(cls, fail_silently=False): + if fail_silently and cls.table_exists(): + return + + db = cls._meta.database + pk = cls._meta.primary_key + if db.sequences and pk is not False and pk.sequence: + if not db.sequence_exists(pk.sequence): + db.create_sequence(pk.sequence) + + db.create_table(cls) + cls._create_indexes() + + @classmethod + def _fields_to_index(cls): + fields = [] + for field in cls._meta.sorted_fields: + if field.primary_key: + continue + requires_index = any(( + field.index, + field.unique, + isinstance(field, ForeignKeyField))) + if requires_index: + fields.append(field) + return fields + + @classmethod + def _index_data(cls): + return itertools.chain( + [((field,), field.unique) for field in cls._fields_to_index()], + cls._meta.indexes or ()) + + @classmethod + def _create_indexes(cls): + for field_list, is_unique in cls._index_data(): + cls._meta.database.create_index(cls, field_list, is_unique) + + @classmethod + def _drop_indexes(cls, safe=False): + for field_list, is_unique in cls._index_data(): + cls._meta.database.drop_index(cls, field_list, safe) + + @classmethod + def sqlall(cls): + queries = [] + compiler = cls._meta.database.compiler() + pk = cls._meta.primary_key + if cls._meta.database.sequences and pk.sequence: + queries.append(compiler.create_sequence(pk.sequence)) + queries.append(compiler.create_table(cls)) + for field in cls._fields_to_index(): + queries.append(compiler.create_index(cls, [field], field.unique)) + if cls._meta.indexes: + for field_names, unique in cls._meta.indexes: + fields = [cls._meta.fields[f] for f in field_names] + queries.append(compiler.create_index(cls, fields, unique)) + return [sql for sql, _ in queries] + + @classmethod + def drop_table(cls, fail_silently=False, cascade=False): + cls._meta.database.drop_table(cls, fail_silently, cascade) + + @classmethod + def truncate_table(cls, restart_identity=False, cascade=False): + cls._meta.database.truncate_table(cls, restart_identity, cascade) + + @classmethod + def as_entity(cls): + if cls._meta.schema: + return Entity(cls._meta.schema, cls._meta.db_table) + return Entity(cls._meta.db_table) + + @classmethod + def noop(cls, *args, **kwargs): + return NoopSelectQuery(cls, *args, **kwargs) + + def _get_pk_value(self): + return getattr(self, self._meta.primary_key.name) + get_id = _get_pk_value # Backwards-compatibility. + + def _set_pk_value(self, value): + if not self._meta.composite_key: + setattr(self, self._meta.primary_key.name, value) + set_id = _set_pk_value # Backwards-compatibility. + + def _pk_expr(self): + return self._meta.primary_key == self._get_pk_value() + + def _prepare_instance(self): + self._dirty.clear() + self.prepared() + + def prepared(self): + pass + + def _prune_fields(self, field_dict, only): + new_data = {} + for field in only: + if field.name in field_dict: + new_data[field.name] = field_dict[field.name] + return new_data + + def _populate_unsaved_relations(self, field_dict): + for key in self._meta.rel: + conditions = ( + key in self._dirty and + key in field_dict and + field_dict[key] is None and + self._obj_cache.get(key) is not None) + if conditions: + setattr(self, key, getattr(self, key)) + field_dict[key] = self._data[key] + + def save(self, force_insert=False, only=None): + field_dict = dict(self._data) + if self._meta.primary_key is not False: + pk_field = self._meta.primary_key + pk_value = self._get_pk_value() + else: + pk_field = pk_value = None + if only: + field_dict = self._prune_fields(field_dict, only) + elif self._meta.only_save_dirty and not force_insert: + field_dict = self._prune_fields( + field_dict, + self.dirty_fields) + if not field_dict: + self._dirty.clear() + return False + + self._populate_unsaved_relations(field_dict) + if pk_value is not None and not force_insert: + if self._meta.composite_key: + for pk_part_name in pk_field.field_names: + field_dict.pop(pk_part_name, None) + else: + field_dict.pop(pk_field.name, None) + rows = self.update(**field_dict).where(self._pk_expr()).execute() + elif pk_field is None: + self.insert(**field_dict).execute() + rows = 1 + else: + pk_from_cursor = self.insert(**field_dict).execute() + if pk_from_cursor is not None: + pk_value = pk_from_cursor + self._set_pk_value(pk_value) + rows = 1 + self._dirty.clear() + return rows + + def is_dirty(self): + return bool(self._dirty) + + @property + def dirty_fields(self): + return [f for f in self._meta.sorted_fields if f.name in self._dirty] + + def dependencies(self, search_nullable=False): + model_class = type(self) + query = self.select().where(self._pk_expr()) + stack = [(type(self), query)] + seen = set() + + while stack: + klass, query = stack.pop() + if klass in seen: + continue + seen.add(klass) + for rel_name, fk in klass._meta.reverse_rel.items(): + rel_model = fk.model_class + if fk.rel_model is model_class: + node = (fk == self._data[fk.to_field.name]) + subquery = rel_model.select().where(node) + else: + node = fk << query + subquery = rel_model.select().where(node) + if not fk.null or search_nullable: + stack.append((rel_model, subquery)) + yield (node, fk) + + def delete_instance(self, recursive=False, delete_nullable=False): + if recursive: + dependencies = self.dependencies(delete_nullable) + for query, fk in reversed(list(dependencies)): + model = fk.model_class + if fk.null and not delete_nullable: + model.update(**{fk.name: None}).where(query).execute() + else: + model.delete().where(query).execute() + return self.delete().where(self._pk_expr()).execute() + + def __hash__(self): + return hash((self.__class__, self._get_pk_value())) + + def __eq__(self, other): + return ( + other.__class__ == self.__class__ and + self._get_pk_value() is not None and + other._get_pk_value() == self._get_pk_value()) + + def __ne__(self, other): + return not self == other + +def prefetch_add_subquery(sq, subqueries): + fixed_queries = [PrefetchResult(sq)] + for i, subquery in enumerate(subqueries): + if isinstance(subquery, tuple): + subquery, target_model = subquery + else: + target_model = None + if not isinstance(subquery, Query) and issubclass(subquery, Model): + subquery = subquery.select() + subquery_model = subquery.model_class + fks = backrefs = None + for j in reversed(range(i + 1)): + prefetch_result = fixed_queries[j] + last_query = prefetch_result.query + last_model = prefetch_result.model + rels = subquery_model._meta.rel_for_model(last_model, multi=True) + if rels: + fks = [getattr(subquery_model, fk.name) for fk in rels] + pks = [getattr(last_model, fk.to_field.name) for fk in rels] + else: + backrefs = last_model._meta.rel_for_model( + subquery_model, + multi=True) + + if (fks or backrefs) and ((target_model is last_model) or + (target_model is None)): + break + + if not (fks or backrefs): + tgt_err = ' using %s' % target_model if target_model else '' + raise AttributeError('Error: unable to find foreign key for ' + 'query: %s%s' % (subquery, tgt_err)) + + if fks: + expr = reduce(operator.or_, [ + (fk << last_query.select(pk)) + for (fk, pk) in zip(fks, pks)]) + subquery = subquery.where(expr) + fixed_queries.append(PrefetchResult(subquery, fks, False)) + elif backrefs: + expr = reduce(operator.or_, [ + (backref.to_field << last_query.select(backref)) + for backref in backrefs]) + subquery = subquery.where(expr) + fixed_queries.append(PrefetchResult(subquery, backrefs, True)) + + return fixed_queries + +__prefetched = namedtuple('__prefetched', ( + 'query', 'fields', 'backref', 'rel_models', 'field_to_name', 'model')) + +class PrefetchResult(__prefetched): + def __new__(cls, query, fields=None, backref=None, rel_models=None, + field_to_name=None, model=None): + if fields: + if backref: + rel_models = [field.model_class for field in fields] + foreign_key_attrs = [field.to_field.name for field in fields] + else: + rel_models = [field.rel_model for field in fields] + foreign_key_attrs = [field.name for field in fields] + field_to_name = list(zip(fields, foreign_key_attrs)) + model = query.model_class + return super(PrefetchResult, cls).__new__( + cls, query, fields, backref, rel_models, field_to_name, model) + + def populate_instance(self, instance, id_map): + if self.backref: + for field in self.fields: + identifier = instance._data[field.name] + key = (field, identifier) + if key in id_map: + setattr(instance, field.name, id_map[key]) + else: + for field, attname in self.field_to_name: + identifier = instance._data[field.to_field.name] + key = (field, identifier) + rel_instances = id_map.get(key, []) + dest = '%s_prefetch' % field.related_name + for inst in rel_instances: + setattr(inst, attname, instance) + setattr(instance, dest, rel_instances) + + def store_instance(self, instance, id_map): + for field, attname in self.field_to_name: + identity = field.to_field.python_value(instance._data[attname]) + key = (field, identity) + if self.backref: + id_map[key] = instance + else: + id_map.setdefault(key, []) + id_map[key].append(instance) + + +def prefetch(sq, *subqueries): + if not subqueries: + return sq + fixed_queries = prefetch_add_subquery(sq, subqueries) + + deps = {} + rel_map = {} + for prefetch_result in reversed(fixed_queries): + query_model = prefetch_result.model + if prefetch_result.fields: + for rel_model in prefetch_result.rel_models: + rel_map.setdefault(rel_model, []) + rel_map[rel_model].append(prefetch_result) + + deps[query_model] = {} + id_map = deps[query_model] + has_relations = bool(rel_map.get(query_model)) + + for instance in prefetch_result.query: + if prefetch_result.fields: + prefetch_result.store_instance(instance, id_map) + + if has_relations: + for rel in rel_map[query_model]: + rel.populate_instance(instance, deps[rel.model]) + + return prefetch_result.query + +def create_model_tables(models, **create_table_kwargs): + """Create tables for all given models (in the right order).""" + for m in sort_models_topologically(models): + m.create_table(**create_table_kwargs) + +def drop_model_tables(models, **drop_table_kwargs): + """Drop tables for all given models (in the right order).""" + for m in reversed(sort_models_topologically(models)): + m.drop_table(**drop_table_kwargs) diff --git a/tasks/candidate-1634-software-databases/tests/vendor/playhouse/__init__.py b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tasks/candidate-1634-software-databases/tests/vendor/playhouse/apsw_ext.py b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/apsw_ext.py new file mode 100644 index 0000000000000000000000000000000000000000..f7b0b9830e2fe1cd428b4b8fc39468c2f369c52a --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/apsw_ext.py @@ -0,0 +1,162 @@ +""" +Peewee integration with APSW, "another python sqlite wrapper". + +Project page: https://rogerbinns.github.io/apsw/ + +APSW is a really neat library that provides a thin wrapper on top of SQLite's +C interface. + +Here are just a few reasons to use APSW, taken from the documentation: + +* APSW gives all functionality of SQLite, including virtual tables, virtual + file system, blob i/o, backups and file control. +* Connections can be shared across threads without any additional locking. +* Transactions are managed explicitly by your code. +* APSW can handle nested transactions. +* Unicode is handled correctly. +* APSW is faster. +""" +import apsw +from peewee import * +from peewee import _sqlite_date_part +from peewee import _sqlite_date_trunc +from peewee import _sqlite_regexp +from peewee import BooleanField as _BooleanField +from peewee import DateField as _DateField +from peewee import DateTimeField as _DateTimeField +from peewee import DecimalField as _DecimalField +from peewee import logger +from peewee import savepoint +from peewee import TimeField as _TimeField +from peewee import transaction as _transaction +from playhouse.sqlite_ext import SqliteExtDatabase +from playhouse.sqlite_ext import VirtualCharField +from playhouse.sqlite_ext import VirtualField +from playhouse.sqlite_ext import VirtualFloatField +from playhouse.sqlite_ext import VirtualIntegerField +from playhouse.sqlite_ext import VirtualModel + + +class transaction(_transaction): + def __init__(self, db, lock_type='deferred'): + self.db = db + self.lock_type = lock_type + + def _begin(self): + self.db.begin(self.lock_type) + + +class APSWDatabase(SqliteExtDatabase): + def __init__(self, database, timeout=None, **kwargs): + self.timeout = timeout + self._modules = {} + super(APSWDatabase, self).__init__(database, **kwargs) + + def register_module(self, mod_name, mod_inst): + self._modules[mod_name] = mod_inst + + def unregister_module(self, mod_name): + del(self._modules[mod_name]) + + def _connect(self, database, **kwargs): + conn = apsw.Connection(database, **kwargs) + if self.timeout is not None: + conn.setbusytimeout(self.timeout) + try: + self._add_conn_hooks(conn) + except: + conn.close() + raise + return conn + + def _add_conn_hooks(self, conn): + super(APSWDatabase, self)._add_conn_hooks(conn) + self._load_modules(conn) # APSW-only. + + def _load_modules(self, conn): + for mod_name, mod_inst in self._modules.items(): + conn.createmodule(mod_name, mod_inst) + return conn + + def _load_aggregates(self, conn): + for name, (klass, num_params) in self._aggregates.items(): + def make_aggregate(): + instance = klass() + return (instance, instance.step, instance.finalize) + conn.createaggregatefunction(name, make_aggregate) + + def _load_collations(self, conn): + for name, fn in self._collations.items(): + conn.createcollation(name, fn) + + def _load_functions(self, conn): + for name, (fn, num_params) in self._functions.items(): + conn.createscalarfunction(name, fn, num_params) + + def _load_extensions(self, conn): + conn.enableloadextension(True) + for extension in self._extensions: + conn.loadextension(extension) + + def load_extension(self, extension): + self._extensions.add(extension) + if not self.is_closed(): + conn = self.get_conn() + conn.enableloadextension(True) + conn.loadextension(extension) + + def _execute_sql(self, cursor, sql, params): + cursor.execute(sql, params or ()) + return cursor + + def execute_sql(self, sql, params=None, require_commit=True): + logger.debug((sql, params)) + with self.exception_wrapper: + cursor = self.get_cursor() + self._execute_sql(cursor, sql, params) + return cursor + + def last_insert_id(self, cursor, model): + if model._meta.auto_increment: + return cursor.getconnection().last_insert_rowid() + + def rows_affected(self, cursor): + return cursor.getconnection().changes() + + def begin(self, lock_type='deferred'): + self.get_cursor().execute('begin %s;' % lock_type) + + def commit(self): + self.get_cursor().execute('commit;') + + def rollback(self): + self.get_cursor().execute('rollback;') + + def transaction(self, lock_type='deferred'): + return transaction(self, lock_type) + + def savepoint(self, sid=None): + return savepoint(self, sid) + + +def nh(s, v): + if v is not None: + return str(v) + +class BooleanField(_BooleanField): + def db_value(self, v): + v = super(BooleanField, self).db_value(v) + if v is not None: + return v and 1 or 0 + +class DateField(_DateField): + db_value = nh + +class TimeField(_TimeField): + db_value = nh + +class DateTimeField(_DateTimeField): + db_value = nh + +class DecimalField(_DecimalField): + db_value = nh diff --git a/tasks/candidate-1634-software-databases/tests/vendor/playhouse/sqlite_ext.py b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/sqlite_ext.py new file mode 100644 index 0000000000000000000000000000000000000000..0ad0735a6a6bc822cc5b660c4b5c1308f0536247 --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/sqlite_ext.py @@ -0,0 +1,1055 @@ +""" +Sqlite3 extensions +================== + +* Define custom aggregates, collations and functions +* Basic support for virtual tables +* Basic support for FTS3/4 +* Specify isolation level in transactions + +Example usage of the Full-text search: + +class Document(FTSModel): + title = TextField() # type affinities are ignored in FTS + content = TextField() + +Document.create_table(tokenize='porter') # use the porter stemmer + +# populate the documents using normal operations. +for doc in documents: + Document.create(title=doc['title'], content=doc['content']) + +# use the "match" operation for FTS queries. +matching_docs = Document.select().where(match(Document.title, 'some query')) + +# to sort by best match, use the custom "rank" function. +best_docs = (Document + .select(Document, Document.rank('score')) + .where(match(Document.title, 'some query')) + .order_by(SQL('score'))) + +# or use the shortcut method. +best_docs = Document.match('some phrase') +""" +import glob +import inspect +import math +import os +import re +import struct +import sys +try: + import simplejson as json +except ImportError: + import json + +from peewee import * +from peewee import EnclosedClause +from peewee import Entity +from peewee import Expression +from peewee import Node +from peewee import OP +from peewee import SqliteQueryCompiler +from peewee import _AutoPrimaryKeyField +from peewee import sqlite3 # Import the best SQLite version. +from peewee import transaction +from peewee import _sqlite_date_part +from peewee import _sqlite_date_trunc +from peewee import _sqlite_regexp +try: + from playhouse import _sqlite_ext as _c_ext +except ImportError: + _c_ext = None + + +if sys.version_info[0] == 3: + basestring = str + +FTS_MATCHINFO_FORMAT = 'pcnalx' +FTS_MATCHINFO_FORMAT_SIMPLE = 'pcx' +FTS_VER = sqlite3.sqlite_version_info[:3] >= (3, 7, 4) and 'FTS4' or 'FTS3' +FTS5_MIN_VERSION = (3, 9, 0) + + +class RowIDField(_AutoPrimaryKeyField): + """ + Field used to access hidden primary key on FTS5 or any other SQLite + table that does not have a separately-defined primary key. + """ + _column_name = 'rowid' + + +class DocIDField(_AutoPrimaryKeyField): + """Field used to access hidden primary key on FTS3/4 tables.""" + _column_name = 'docid' + + +class PrimaryKeyAutoIncrementField(PrimaryKeyField): + """ + SQLite by default uses MAX(primary key) + 1 to set the ID on a new row. + Using the `AUTOINCREMENT` field, the IDs will increase monotonically + even if rows are deleted. Use this if you need to guarantee IDs are not + re-used in the event of deletion. + """ + def __ddl__(self, column_type): + ddl = super(PrimaryKeyAutoIncrementField, self).__ddl__(column_type) + return ddl + [SQL('AUTOINCREMENT')] + + +class JSONField(TextField): + def python_value(self, value): + if value is not None: + try: + return json.loads(value) + except (TypeError, ValueError): + return value + + def db_value(self, value): + if value is not None: + return json.dumps(value) + + def clean_path(self, path): + if path.startswith('[') or not path: + return '$%s' % path + return '$.%s' % path + + def length(self, path=None): + if path: + return fn.json_array_length(self, self.clean_path(path)) + return fn.json_array_length(self) + + def extract(self, path): + return fn.json_extract(self, self.clean_path(path)) + + def _value_for_insertion(self, value): + if isinstance(value, (list, tuple, dict)): + return fn.json(json.dumps(value)) + return value + + def _insert_like(self, fn, pairs): + npairs = len(pairs) + if npairs % 2 != 0: + raise ValueError('Mismatched path and value parameters.') + accum = [] + for i in range(0, npairs, 2): + accum.append(self.clean_path(pairs[i])) + accum.append(self._value_for_insertion(pairs[i + 1])) + return fn(self, *accum) + + def insert(self, *pairs): + return self._insert_like(fn.json_insert, pairs) + + def replace(self, *pairs): + return self._insert_like(fn.json_replace, pairs) + + def set(self, *pairs): + return self._insert_like(fn.json_set, pairs) + + def remove(self, *paths): + return fn.json_remove(self, *[self.clean_path(path) for path in paths]) + + def json_type(self, path=None): + if path: + return fn.json_type(self, self.clean_path(path)) + return fn.json_type(self) + + def children(self, path=None): + """ + Schema of `json_each` and `json_tree`: + + key, + value, + type TEXT (object, array, string, etc), + atom (value for primitive/scalar types, NULL for array and object) + id INTEGER (unique identifier for element) + parent INTEGER (unique identifier of parent element or NULL) + fullkey TEXT (full path describing element) + path TEXT (path to the container of the current element) + json JSON hidden (1st input parameter to function) + root TEXT hidden (2nd input parameter, path at which to start) + """ + if path: + return fn.json_each(self, self.clean_path(path)) + return fn.json_each(self) + + def tree(self, path=None): + if path: + return fn.json_tree(self, self.clean_path(path)) + return fn.json_tree(self) + + +class SearchField(BareField): + """ + Field class to be used with full-text search extension. Since the FTS + extensions do not support any field types besides `TEXT`, and furthermore + do not support secondary indexes, using this field will prevent you + from mistakenly creating the wrong kind of field on your FTS table. + """ + def __init__(self, unindexed=False, db_column=None, coerce=None, **_): + kwargs = {'null': True, 'db_column': db_column, 'coerce': coerce} + self._unindexed = unindexed + if unindexed: + kwargs['constraints'] = [SQL('UNINDEXED')] + super(SearchField, self).__init__(**kwargs) + + def clone_base(self, **kwargs): + clone = super(SearchField, self).clone_base(**kwargs) + clone._unindexed = self._unindexed + return clone + + +class _VirtualFieldMixin(object): + """ + Field mixin to support virtual table attributes that may not correspond + to actual columns in the database. + """ + def add_to_class(self, model_class, name): + super(_VirtualFieldMixin, self).add_to_class(model_class, name) + model_class._meta.remove_field(name) + + +# Virtual field types that can be used to reference specially-created fields +# on virtual tables. These fields are exposed as attributes on the model class, +# but are not included in any `CREATE TABLE` statements or by default when +# performing an `INSERT` or `UPDATE` query. +class VirtualField(_VirtualFieldMixin, BareField): pass +class VirtualIntegerField(_VirtualFieldMixin, IntegerField): pass +class VirtualCharField(_VirtualFieldMixin, CharField): pass +class VirtualFloatField(_VirtualFieldMixin, FloatField): pass + + +class VirtualModel(Model): + class Meta: + virtual_table = True + extension_module = None + extension_options = {} + + @classmethod + def clean_options(cls, **options): + # Called by the QueryCompiler when generating the virtual table's + # options clauses. + return options + + @classmethod + def create_table(cls, fail_silently=False, **options): + # Modified to support **options, which are passed back to the + # query compiler. + if fail_silently and cls.table_exists(): + return + + cls._meta.database.create_table(cls, options=options) + cls._create_indexes() + + +class BaseFTSModel(VirtualModel): + @classmethod + def clean_options(cls, **options): + tokenize = options.get('tokenize') + content = options.get('content') + if tokenize: + # Tokenizers need to be in quoted string. + options['tokenize'] = '"%s"' % tokenize + if isinstance(content, basestring) and content == '': + # Special-case content-less full-text search tables. + options['content'] = "''" + return options + + +class FTSModel(BaseFTSModel): + """ + VirtualModel class for creating tables that use either the FTS3 or FTS4 + search extensions. Peewee automatically determines which version of the + FTS extension is supported and will use FTS4 if possible. + + Note: because FTS5 is significantly different from FTS3 and FTS4, there is + a separate model class for FTS5 virtual tables. + """ + # FTS3/4 does not support declared primary keys, but we can use the + # implicit docid. + docid = DocIDField() + + class Meta: + extension_module = FTS_VER + + @classmethod + def validate_model(cls): + if cls._meta.primary_key.name != 'docid': + raise ImproperlyConfigured( + 'FTSModel classes must use the default `docid` primary key.') + + @classmethod + def _fts_cmd(cls, cmd): + tbl = cls._meta.db_table + res = cls._meta.database.execute_sql( + "INSERT INTO %s(%s) VALUES('%s');" % (tbl, tbl, cmd)) + return res.fetchone() + + @classmethod + def optimize(cls): + return cls._fts_cmd('optimize') + + @classmethod + def rebuild(cls): + return cls._fts_cmd('rebuild') + + @classmethod + def integrity_check(cls): + return cls._fts_cmd('integrity-check') + + @classmethod + def merge(cls, blocks=200, segments=8): + return cls._fts_cmd('merge=%s,%s' % (blocks, segments)) + + @classmethod + def automerge(cls, state=True): + return cls._fts_cmd('automerge=%s' % (state and '1' or '0')) + + @classmethod + def match(cls, term): + """ + Generate a `MATCH` expression appropriate for searching this table. + """ + return match(cls.as_entity(), term) + + @classmethod + def rank(cls, *weights): + return fn.fts_rank(fn.matchinfo( + cls.as_entity(), FTS_MATCHINFO_FORMAT_SIMPLE), *weights) + + @classmethod + def bm25(cls, *weights): + match_info = fn.matchinfo(cls.as_entity(), FTS_MATCHINFO_FORMAT) + return fn.fts_bm25(match_info, *weights) + + @classmethod + def lucene(cls, *weights): + match_info = fn.matchinfo(cls.as_entity(), FTS_MATCHINFO_FORMAT) + return fn.fts_lucene(match_info, *weights) + + @classmethod + def _search(cls, term, weights, with_score, score_alias, score_fn, + explicit_ordering): + if not weights: + rank = score_fn() + elif isinstance(weights, dict): + weight_args = [] + for field in cls._meta.declared_fields: + weight_args.append( + weights.get(field, weights.get(field.name, 1.0))) + rank = score_fn(*weight_args) + else: + rank = score_fn(*weights) + + selection = () + order_by = rank + if with_score: + selection = (cls, rank.alias(score_alias)) + if with_score and not explicit_ordering: + order_by = SQL(score_alias) + + return (cls + .select(*selection) + .where(cls.match(term)) + .order_by(order_by)) + + @classmethod + def search(cls, term, weights=None, with_score=False, score_alias='score', + explicit_ordering=False): + """Full-text search using selected `term`.""" + return cls._search( + term, + weights, + with_score, + score_alias, + cls.rank, + explicit_ordering) + + @classmethod + def search_bm25(cls, term, weights=None, with_score=False, + score_alias='score', explicit_ordering=False): + """Full-text search for selected `term` using BM25 algorithm.""" + return cls._search( + term, + weights, + with_score, + score_alias, + cls.bm25, + explicit_ordering) + + @classmethod + def search_lucene(cls, term, weights=None, with_score=False, + score_alias='score', explicit_ordering=False): + """Full-text search for selected `term` using BM25 algorithm.""" + return cls._search( + term, + weights, + with_score, + score_alias, + cls.lucene, + explicit_ordering) + + +_alphabet = 'abcdefghijklmnopqrstuvwxyz' +_alphanum = set([ + '\t', ' ', ',', '"', + chr(26), # Substitution control character. + '(', ')', '{', '}', + '*', ':', '_', '+', +]) | set('0123456789') | set(_alphabet) | set(_alphabet.upper()) +_invalid_ascii = set([chr(p) for p in range(128) if chr(p) not in _alphanum]) +_quote_re = re.compile('(?:[^\s"]|"(?:\\.|[^"])*")+') + + +class FTS5Model(BaseFTSModel): + """ + Requires SQLite >= 3.9.0. + + Table options: + + content: table name of external content, or empty string for "contentless" + content_rowid: column name of external content primary key + prefix: integer(s). Ex: '2' or '2 3 4' + tokenize: porter, unicode61, ascii. Ex: 'porter unicode61' + + The unicode tokenizer supports the following parameters: + + * remove_diacritics (1 or 0, default is 1) + * tokenchars (string of characters, e.g. '-_' + * separators (string of characters) + + Parameters are passed as alternating parameter name and value, so: + + {'tokenize': "unicode61 remove_diacritics 0 tokenchars '-_'"} + + Content-less tables: + + If you don't need the full-text content in it's original form, you can + specify a content-less table. Searches and auxiliary functions will work + as usual, but the only values returned when SELECT-ing can be rowid. Also + content-less tables do not support UPDATE or DELETE. + + External content tables: + + You can set up triggers to sync these, e.g. + + -- Create a table. And an external content fts5 table to index it. + CREATE TABLE tbl(a INTEGER PRIMARY KEY, b); + CREATE VIRTUAL TABLE ft USING fts5(b, content='tbl', content_rowid='a'); + + -- Triggers to keep the FTS index up to date. + CREATE TRIGGER tbl_ai AFTER INSERT ON tbl BEGIN + INSERT INTO ft(rowid, b) VALUES (new.a, new.b); + END; + CREATE TRIGGER tbl_ad AFTER DELETE ON tbl BEGIN + INSERT INTO ft(fts_idx, rowid, b) VALUES('delete', old.a, old.b); + END; + CREATE TRIGGER tbl_au AFTER UPDATE ON tbl BEGIN + INSERT INTO ft(fts_idx, rowid, b) VALUES('delete', old.a, old.b); + INSERT INTO ft(rowid, b) VALUES (new.a, new.b); + END; + + Built-in auxiliary functions: + + * bm25(tbl[, weight_0, ... weight_n]) + * highlight(tbl, col_idx, prefix, suffix) + * snippet(tbl, col_idx, prefix, suffix, ?, max_tokens) + """ + # FTS5 does not support declared primary keys, but we can use the + # implicit rowid. + rowid = RowIDField() + + class Meta: + extension_module = 'fts5' + + _error_messages = { + 'field_type': ('Besides the implicit `rowid` column, all columns must ' + 'be instances of SearchField'), + 'index': 'Secondary indexes are not supported for FTS5 models', + 'pk': 'FTS5 models must use the default `rowid` primary key', + } + + @classmethod + def validate_model(cls): + # Perform FTS5-specific validation and options post-processing. + if cls._meta.primary_key.name != 'rowid': + raise ImproperlyConfigured(cls._error_messages['pk']) + for field in cls._meta.fields.values(): + if not isinstance(field, (SearchField, RowIDField)): + raise ImproperlyConfigured(cls._error_messages['field_type']) + if cls._meta.indexes: + raise ImproperlyConfigured(cls._error_messages['index']) + + @classmethod + def fts5_installed(cls): + if sqlite3.sqlite_version_info[:3] < FTS5_MIN_VERSION: + return False + + # Test in-memory DB to determine if the FTS5 extension is installed. + tmp_db = sqlite3.connect(':memory:') + try: + tmp_db.execute('CREATE VIRTUAL TABLE fts5test USING fts5 (data);') + except: + try: + sqlite3.enable_load_extension(True) + sqlite3.load_extension('fts5') + except: + return False + else: + cls._meta.database.load_extension('fts5') + finally: + tmp_db.close() + + return True + + @staticmethod + def validate_query(query): + """ + Simple helper function to indicate whether a search query is a + valid FTS5 query. Note: this simply looks at the characters being + used, and is not guaranteed to catch all problematic queries. + """ + tokens = _quote_re.findall(query) + for token in tokens: + if token.startswith('"') and token.endswith('"'): + continue + if set(token) & _invalid_ascii: + return False + return True + + @staticmethod + def clean_query(query, replace=chr(26)): + """ + Clean a query of invalid tokens. + """ + accum = [] + any_invalid = False + tokens = _quote_re.findall(query) + for token in tokens: + if token.startswith('"') and token.endswith('"'): + accum.append(token) + continue + token_set = set(token) + invalid_for_token = token_set & _invalid_ascii + if invalid_for_token: + any_invalid = True + for c in invalid_for_token: + token = token.replace(c, replace) + accum.append(token) + + if any_invalid: + return ' '.join(accum) + return query + + @classmethod + def match(cls, term): + """ + Generate a `MATCH` expression appropriate for searching this table. + """ + return match(cls.as_entity(), term) + + @classmethod + def rank(cls, *args): + if args: + return cls.bm25(*args) + else: + return SQL('rank') + + @classmethod + def bm25(cls, *weights): + return fn.bm25(cls.as_entity(), *weights) + + @classmethod + def search(cls, term, weights=None, with_score=False, score_alias='score', + explicit_ordering=False): + """Full-text search using selected `term`.""" + return cls.search_bm25( + FTS5Model.clean_query(term), + weights, + with_score, + score_alias, + explicit_ordering) + + @classmethod + def search_bm25(cls, term, weights=None, with_score=False, + score_alias='score', explicit_ordering=False): + """Full-text search using selected `term`.""" + if not weights: + rank = SQL('rank') + elif isinstance(weights, dict): + weight_args = [] + for field in cls._meta.declared_fields: + weight_args.append( + weights.get(field, weights.get(field.name, 1.0))) + rank = fn.bm25(cls.as_entity(), *weight_args) + else: + rank = fn.bm25(cls.as_entity(), *weights) + + selection = () + order_by = rank + if with_score: + selection = (cls, rank.alias(score_alias)) + if with_score and not explicit_ordering: + order_by = SQL(score_alias) + + return (cls + .select(*selection) + .where(cls.match(FTS5Model.clean_query(term))) + .order_by(order_by)) + + @classmethod + def _fts_cmd(cls, cmd, **extra_params): + tbl = cls.as_entity() + columns = [tbl] + values = [cmd] + for key, value in extra_params.items(): + columns.append(Entity(key)) + values.append(value) + + inner_clause = EnclosedClause(tbl) + clause = Clause( + SQL('INSERT INTO'), + cls.as_entity(), + EnclosedClause(*columns), + SQL('VALUES'), + EnclosedClause(*values)) + return cls._meta.database.execute(clause) + + @classmethod + def automerge(cls, level): + if not (0 <= level <= 16): + raise ValueError('level must be between 0 and 16') + return cls._fts_cmd('automerge', rank=level) + + @classmethod + def merge(cls, npages): + return cls._fts_cmd('merge', rank=npages) + + @classmethod + def set_pgsz(cls, pgsz): + return cls._fts_cmd('pgsz', rank=pgsz) + + @classmethod + def set_rank(cls, rank_expression): + return cls._fts_cmd('rank', rank=rank_expression) + + @classmethod + def delete_all(cls): + return cls._fts_cmd('delete-all') + + @classmethod + def VocabModel(cls, table_type='row', table_name=None): + if table_type not in ('row', 'col'): + raise ValueError('table_type must be either "row" or "col".') + + attr = '_vocab_model_%s' % table_type + + if not hasattr(cls, attr): + class Meta: + database = cls._meta.database + db_table = table_name or cls._meta.db_table + '_v' + extension_module = fn.fts5vocab( + cls.as_entity(), + SQL(table_type)) + + attrs = { + 'term': BareField(), + 'doc': IntegerField(), + 'cnt': IntegerField(), + 'rowid': RowIDField(), + 'Meta': Meta, + } + if table_type == 'col': + attrs['col'] = BareField() + + class_name = '%sVocab' % cls.__name__ + setattr(cls, attr, type(class_name, (VirtualModel,), attrs)) + + return getattr(cls, attr) + + +def ClosureTable(model_class, foreign_key=None): + """Model factory for the transitive closure extension.""" + if foreign_key is None: + for field_obj in model_class._meta.rel.values(): + if field_obj.rel_model is model_class: + foreign_key = field_obj + break + else: + raise ValueError('Unable to find self-referential foreign key.') + + primary_key = model_class._meta.primary_key + + class BaseClosureTable(VirtualModel): + depth = VirtualIntegerField() + id = VirtualIntegerField() + idcolumn = VirtualIntegerField() + parentcolumn = VirtualIntegerField() + root = VirtualIntegerField() + tablename = VirtualCharField() + + class Meta: + extension_module = 'transitive_closure' + + @classmethod + def descendants(cls, node, depth=None, include_node=False): + query = (model_class + .select(model_class, cls.depth.alias('depth')) + .join(cls, on=(primary_key == cls.id)) + .where(cls.root == node) + .naive()) + if depth is not None: + query = query.where(cls.depth == depth) + elif not include_node: + query = query.where(cls.depth > 0) + return query + + @classmethod + def ancestors(cls, node, depth=None, include_node=False): + query = (model_class + .select(model_class, cls.depth.alias('depth')) + .join(cls, on=(primary_key == cls.root)) + .where(cls.id == node) + .naive()) + if depth: + query = query.where(cls.depth == depth) + elif not include_node: + query = query.where(cls.depth > 0) + return query + + @classmethod + def siblings(cls, node, include_node=False): + fk_value = node._data.get(foreign_key.name) + query = model_class.select().where(foreign_key == fk_value) + if not include_node: + query = query.where(primary_key != node) + return query + + class Meta: + database = model_class._meta.database + extension_options = { + 'tablename': model_class._meta.db_table, + 'idcolumn': model_class._meta.primary_key.db_column, + 'parentcolumn': foreign_key.db_column} + primary_key = False + + name = '%sClosure' % model_class.__name__ + return type(name, (BaseClosureTable,), {'Meta': Meta}) + + +class SqliteExtQueryCompiler(SqliteQueryCompiler): + """ + Subclass of QueryCompiler that can be used to construct virtual tables. + """ + def _create_table(self, model_class, safe=False, options=None): + clause = super(SqliteExtQueryCompiler, self)._create_table( + model_class, safe=safe) + + if issubclass(model_class, VirtualModel): + statement = 'CREATE VIRTUAL TABLE' + + # If we are using a special extension, need to insert that after + # the table name node. + extension = model_class._meta.extension_module + + if isinstance(extension, Node): + # If the `extension_module` attribute is a `Node` subclass, + # then we assume the VirtualModel will be responsible for + # defining not only the extension, but also the columns. + parts = clause.nodes[:2] + [SQL('USING'), extension] + clause = Clause(*parts) + else: + # The extension name is a simple string. + clause.nodes.insert(2, SQL('USING %s' % extension)) + else: + statement = 'CREATE TABLE' + + if safe: + statement += ' IF NOT EXISTS' + + clause.nodes[0] = SQL(statement) # Overwrite the statement. + + table_options = self.clean_options(model_class, clause, options) + if table_options: + columns_constraints = clause.nodes[-1] + for k, v in sorted(table_options.items()): + if isinstance(v, Field): + # Special hack here for FTS5. We want to include the + # fully-qualified column entity in most cases, but for + # FTS5 we only want the string column name. + v = v.as_entity(extension != 'fts5') + elif inspect.isclass(v) and issubclass(v, Model): + # The option points to a table name. + v = v.as_entity() + elif isinstance(v, (list, tuple)): + # Lists will be quoted and joined by commas. + v = SQL("'%s'" % ','.join(map(str, v))) + elif not isinstance(v, Node): + v = SQL(v) + option = Clause(SQL(k), v) + option.glue = '=' + columns_constraints.nodes.append(option) + + if getattr(model_class._meta, 'without_rowid', None): + clause.nodes.append(SQL('WITHOUT ROWID')) + + return clause + + def clean_options(self, model_class, clause, extra_options): + model_options = getattr(model_class._meta, 'extension_options', None) + if model_options: + options = model_class.clean_options(**model_options) + else: + options = {} + if extra_options: + options.update(model_class.clean_options(**extra_options)) + return options + + def create_table(self, model_class, safe=False, options=None): + return self.parse_node(self._create_table(model_class, safe, options)) + + +@Node.extend(clone=False) +def disqualify(self): + # In the where clause, prevent the given node/expression from constraining + # an index. + return Clause('+', self, glue='') + + +class SqliteExtDatabase(SqliteDatabase): + """ + Database class which provides additional Sqlite-specific functionality: + + * Register custom aggregates, collations and functions + * Specify a row factory + * Advanced transactions (specify isolation level) + """ + compiler_class = SqliteExtQueryCompiler + + def __init__(self, database, c_extensions=True, *args, **kwargs): + super(SqliteExtDatabase, self).__init__(database, *args, **kwargs) + self._aggregates = {} + self._collations = {} + self._functions = {} + self._extensions = set([]) + self._row_factory = None + if _c_ext and c_extensions: + self._using_c_extensions = True + self.register_function(_c_ext.peewee_date_part, 'date_part', 2) + self.register_function(_c_ext.peewee_date_trunc, 'date_trunc', 2) + self.register_function(_c_ext.peewee_regexp, 'regexp', 2) + self.register_function(_c_ext.peewee_rank, 'fts_rank', -1) + self.register_function(_c_ext.peewee_lucene, 'fts_lucene', -1) + self.register_function(_c_ext.peewee_bm25, 'fts_bm25', -1) + self.register_function(_c_ext.peewee_murmurhash, 'murmurhash', 1) + else: + self._using_c_extensions = False + self.register_function(_sqlite_date_part, 'date_part', 2) + self.register_function(_sqlite_date_trunc, 'date_trunc', 2) + self.register_function(_sqlite_regexp, 'regexp', 2) + self.register_function(rank, 'fts_rank', -1) + self.register_function(bm25, 'fts_bm25', -1) + + @property + def using_c_extensions(self): + return self._using_c_extensions + + def _add_conn_hooks(self, conn): + self._set_pragmas(conn) + self._load_aggregates(conn) + self._load_collations(conn) + self._load_functions(conn) + if self._row_factory: + conn.row_factory = self._row_factory + if self._extensions: + self._load_extensions(conn) + + def _load_aggregates(self, conn): + for name, (klass, num_params) in self._aggregates.items(): + conn.create_aggregate(name, num_params, klass) + + def _load_collations(self, conn): + for name, fn in self._collations.items(): + conn.create_collation(name, fn) + + def _load_functions(self, conn): + for name, (fn, num_params) in self._functions.items(): + conn.create_function(name, num_params, fn) + + def _load_extensions(self, conn): + conn.enable_load_extension(True) + for extension in self._extensions: + conn.load_extension(extension) + + def register_aggregate(self, klass, name=None, num_params=-1): + self._aggregates[name or klass.__name__.lower()] = (klass, num_params) + if not self.is_closed(): + self._load_aggregates(self.get_conn()) + + def aggregate(self, name=None, num_params=-1): + def decorator(klass): + self.register_aggregate(klass, name, num_params) + return klass + return decorator + + def register_collation(self, fn, name=None): + name = name or fn.__name__ + def _collation(*args): + expressions = args + (SQL('collate %s' % name),) + return Clause(*expressions) + fn.collation = _collation + self._collations[name] = fn + if not self.is_closed(): + self._load_collations(self.get_conn()) + + def collation(self, name=None): + def decorator(fn): + self.register_collation(fn, name) + return fn + return decorator + + def register_function(self, fn, name=None, num_params=-1): + self._functions[name or fn.__name__] = (fn, num_params) + if not self.is_closed(): + self._load_functions(self.get_conn()) + + def func(self, name=None, num_params=-1): + def decorator(fn): + self.register_function(fn, name, num_params) + return fn + return decorator + + def load_extension(self, extension): + self._extensions.add(extension) + if not self.is_closed(): + conn = self.get_conn() + conn.enable_load_extension(True) + conn.load_extension(extension) + + def unregister_aggregate(self, name): + del(self._aggregates[name]) + + def unregister_collation(self, name): + del(self._collations[name]) + + def unregister_function(self, name): + del(self._functions[name]) + + def unload_extension(self, extension): + self._extensions.remove(extension) + + def row_factory(self, fn): + self._row_factory = fn + + def create_table(self, model_class, safe=False, options=None): + sql, params = self.compiler().create_table(model_class, safe, options) + return self.execute_sql(sql, params) + + def create_index(self, model_class, field_name, unique=False): + if issubclass(model_class, FTSModel): + return + return super(SqliteExtDatabase, self).create_index( + model_class, field_name, unique) + + +OP.MATCH = 'match' +SqliteExtDatabase.register_ops({ + OP.MATCH: 'MATCH', +}) + +def match(lhs, rhs): + return Expression(lhs, OP.MATCH, rhs) + +def _parse_match_info(buf): + # See http://sqlite.org/fts3.html#matchinfo + bufsize = len(buf) # Length in bytes. + return [struct.unpack('@I', buf[i:i+4])[0] for i in range(0, bufsize, 4)] + +# Ranking implementation, which parse matchinfo. +def rank(raw_match_info, *weights): + # Handle match_info called w/default args 'pcx' - based on the example rank + # function http://sqlite.org/fts3.html#appendix_a + match_info = _parse_match_info(raw_match_info) + score = 0.0 + + p, c = match_info[:2] + if not weights: + weights = [1] * c + else: + weights = [0] * c + for i, weight in enumerate(weights): + weights[i] = weight + + for phrase_num in range(p): + phrase_info_idx = 2 + (phrase_num * c * 3) + for col_num in range(c): + weight = weights[col_num] + if not weight: + continue + + col_idx = phrase_info_idx + (col_num * 3) + x1, x2 = match_info[col_idx:col_idx + 2] + if x1 > 0: + score += weight * (float(x1) / x2) + + return -score + +# Okapi BM25 ranking implementation (FTS4 only). +def bm25(raw_match_info, *args): + """ + Usage: + + # Format string *must* be pcnalx + # Second parameter to bm25 specifies the index of the column, on + # the table being queries. + bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank + """ + match_info = _parse_match_info(raw_match_info) + K = 1.2 + B = 0.75 + score = 0.0 + + P_O, C_O, N_O, A_O = range(4) + term_count = match_info[P_O] + col_count = match_info[C_O] + total_docs = match_info[N_O] + L_O = A_O + col_count + X_O = L_O + col_count + + if not args: + weights = [1] * col_count + else: + weights = [0] * col_count + for i, weight in enumerate(args): + weights[i] = args[i] + + for i in range(term_count): + for j in range(col_count): + weight = weights[j] + if weight == 0: + continue + + avg_length = float(match_info[A_O + j]) + doc_length = float(match_info[L_O + j]) + if avg_length == 0: + D = 0 + else: + D = 1 - B + (B * (doc_length / avg_length)) + + x = X_O + (3 * j * (i + 1)) + term_frequency = float(match_info[x]) + docs_with_term = float(match_info[x + 2]) + + idf = max( + math.log( + (total_docs - docs_with_term + 0.5) / + (docs_with_term + 0.5)), + 0) + denom = term_frequency + (K * D) + if denom == 0: + rhs = 0 + else: + rhs = (term_frequency * (K + 1)) / denom + + score += (idf * rhs) * weight + + return -score diff --git a/tasks/candidate-1634-software-databases/tests/vendor/playhouse/test_utils.py b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/test_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..bcd7202380596a044fc4f5668a29abbbc76065ad --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/playhouse/test_utils.py @@ -0,0 +1,90 @@ +from functools import wraps +import logging + +from peewee import create_model_tables +from peewee import drop_model_tables + + +logger = logging.getLogger('peewee') + +class test_database(object): + def __init__(self, db, models, create_tables=True, drop_tables=True, + fail_silently=False): + if not isinstance(models, (list, tuple, set)): + raise ValueError('%r must be a list or tuple.' % models) + self.db = db + self.models = models + self.create_tables = create_tables + self.drop_tables = drop_tables + self.fail_silently = fail_silently + + def __enter__(self): + self.orig = [] + for m in self.models: + self.orig.append(m._meta.database) + m._meta.database = self.db + if self.create_tables: + create_model_tables(self.models, fail_silently=self.fail_silently) + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.create_tables and self.drop_tables: + drop_model_tables(self.models, fail_silently=self.fail_silently) + for i, m in enumerate(self.models): + m._meta.database = self.orig[i] + + +class _QueryLogHandler(logging.Handler): + def __init__(self, *args, **kwargs): + self.queries = [] + logging.Handler.__init__(self, *args, **kwargs) + + def emit(self, record): + self.queries.append(record) + + +class count_queries(object): + def __init__(self, only_select=False): + self.only_select = only_select + self.count = 0 + + def get_queries(self): + return self._handler.queries + + def __enter__(self): + self._handler = _QueryLogHandler() + logger.setLevel(logging.DEBUG) + logger.addHandler(self._handler) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + logger.removeHandler(self._handler) + if self.only_select: + self.count = len([q for q in self._handler.queries + if q.msg[0].startswith('SELECT ')]) + else: + self.count = len(self._handler.queries) + + +class assert_query_count(count_queries): + def __init__(self, expected, only_select=False): + super(assert_query_count, self).__init__(only_select=only_select) + self.expected = expected + + def __call__(self, f): + @wraps(f) + def decorated(*args, **kwds): + with self: + ret = f(*args, **kwds) + + self._assert_count() + return ret + + return decorated + + def _assert_count(self): + error_msg = '%s != %s' % (self.count, self.expected) + assert self.count == self.expected, error_msg + + def __exit__(self, exc_type, exc_val, exc_tb): + super(assert_query_count, self).__exit__(exc_type, exc_val, exc_tb) + self._assert_count() diff --git a/tasks/candidate-1634-software-databases/tests/vendor/runtests.py b/tasks/candidate-1634-software-databases/tests/vendor/runtests.py new file mode 100644 index 0000000000000000000000000000000000000000..2eedab2aab94a7632cc17366738ba09c9ea1e9ea --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/runtests.py @@ -0,0 +1,226 @@ +#!/usr/bin/env python +import optparse +import os +import shutil +import sys +import unittest + + +def collect(): + import tests + runtests(tests, 1) + +def runtests(suite, verbosity): + results = unittest.TextTestRunner(verbosity=verbosity).run(suite) + return results.failures, results.errors + +def get_option_parser(): + parser = optparse.OptionParser() + basic = optparse.OptionGroup(parser, 'Basic test options') + basic.add_option( + '-e', + '--engine', + dest='engine', + help=('Database engine to test, one of ' + '[sqlite, postgres, mysql, apsw, sqlcipher, berkeleydb]')) + basic.add_option('-v', '--verbosity', dest='verbosity', default=1, type='int', help='Verbosity of output') + + suite = optparse.OptionGroup(parser, 'Simple test suite options') + suite.add_option('-a', '--all', dest='all', default=False, action='store_true', help='Run all tests, including extras') + suite.add_option('-x', '--extra', dest='extra', default=False, action='store_true', help='Run only extras tests') + + cases = optparse.OptionGroup(parser, 'Individual test module options') + cases.add_option('--apsw', dest='apsw', default=False, action='store_true', help='apsw tests (requires apsw)') + cases.add_option('--berkeleydb', dest='berkeleydb', default=False, action='store_true', help='berkeleydb tests (requires pysqlite compiled against berkeleydb)') + cases.add_option('--csv', dest='csv', default=False, action='store_true', help='csv tests') + cases.add_option('--dataset', dest='dataset', default=False, action='store_true', help='dataset tests') + cases.add_option('--db-url', dest='db_url', default=False, action='store_true', help='db url tests') + cases.add_option('--djpeewee', dest='djpeewee', default=False, action='store_true', help='djpeewee tests') + cases.add_option('--fields', dest='fields', default=False, action='store_true', help='extra field tests') + cases.add_option('--flask', dest='flask', default=False, action='store_true', help='flask utils tests') + cases.add_option('--gfk', dest='gfk', default=False, action='store_true', help='gfk tests') + cases.add_option('--hybrid', dest='hybrid', default=False, action='store_true', help='hybrid property/method tests') + cases.add_option('--kv', dest='kv', default=False, action='store_true', help='key/value store tests') + cases.add_option('--manytomany', dest='manytomany', default=False, action='store_true', help='manytomany field tests') + cases.add_option('--migrations', dest='migrations', default=False, action='store_true', help='migration helper tests (requires psycopg2)') + cases.add_option('--pool', dest='pool', default=False, action='store_true', help='connection pool tests') + cases.add_option('--postgres-ext', dest='postgres_ext', default=False, action='store_true', help='postgres_ext tests (requires psycopg2)') + cases.add_option('--pwiz', dest='pwiz', default=False, action='store_true', help='pwiz, model code generator') + cases.add_option('--read-slave', dest='read_slave', default=False, action='store_true', help='read_slave tests') + cases.add_option('--reflection', dest='reflection', default=False, action='store_true', help='reflection schema introspector') + cases.add_option('--signals', dest='signals', default=False, action='store_true', help='signals tests') + cases.add_option('--shortcuts', dest='shortcuts', default=False, action='store_true', help='shortcuts tests') + cases.add_option('--speedups', dest='speedups', default=False, action='store_true', help='speedups c extension tests') + cases.add_option('--sqlcipher-ext', dest='sqlcipher', default=False, action='store_true', help='sqlcipher_ext tests (requires pysqlcipher)') + cases.add_option('--sqliteq', dest='sqliteq', default=False, action='store_true', help='sqliteq tests') + cases.add_option('--sqlite-c-ext', dest='sqlite_c', default=False, action='store_true', help='sqlite c extension tests') + cases.add_option('--sqlite-ext', dest='sqlite_ext', default=False, action='store_true', help='sqlite_ext tests') + cases.add_option('--sqlite-udf', dest='sqlite_udf', default=False, action='store_true', help='sqlite_udf tests') + cases.add_option('--test-utils', dest='test_utils', default=False, action='store_true', help='test_utils tests') + + parser.add_option_group(basic) + parser.add_option_group(suite) + parser.add_option_group(cases) + return parser + +def collect_modules(options): + modules = [] + xtra = lambda op: op or options.extra or options.all + if xtra(options.apsw): + try: + from playhouse.tests import test_apsw + modules.append(test_apsw) + except ImportError: + print_('Unable to import apsw tests, skipping') + if xtra(options.berkeleydb): + try: + from playhouse.tests import test_berkeleydb + modules.append(test_berkeleydb) + except ImportError: + print_('Unable to import berkeleydb tests, skipping') + if xtra(options.csv): + from playhouse.tests import test_csv_utils + modules.append(test_csv_utils) + if xtra(options.dataset): + from playhouse.tests import test_dataset + modules.append(test_dataset) + if xtra(options.db_url): + from playhouse.tests import test_db_url + modules.append(test_db_url) + if xtra(options.djpeewee): + from playhouse.tests import test_djpeewee + modules.append(test_djpeewee) + if xtra(options.fields): + from playhouse.tests import test_extra_fields + from playhouse.tests import test_manytomany + modules.append(test_extra_fields) + if test_manytomany not in modules: + modules.append(test_manytomany) + if xtra(options.flask): + try: + import flask + except ImportError: + print_('Unable to import Flask tests, Flask is not installed.') + else: + from playhouse.tests import test_flask_utils + modules.append(test_flask_utils) + if xtra(options.gfk): + from playhouse.tests import test_gfk + modules.append(test_gfk) + if xtra(options.hybrid): + from playhouse.tests import test_hybrid + modules.append(test_hybrid) + if xtra(options.kv): + from playhouse.tests import test_kv + modules.append(test_kv) + if xtra(options.manytomany): + from playhouse.tests import test_manytomany + if test_manytomany not in modules: + modules.append(test_manytomany) + if xtra(options.migrations): + try: + from playhouse.tests import test_migrate + modules.append(test_migrate) + except ImportError: + print_('Unable to import migration tests, skipping') + if xtra(options.pool): + try: + from playhouse.tests import test_pool + modules.append(test_pool) + except ImportError: + print_('Unable to import connection pool tests, skipping') + if xtra(options.postgres_ext): + try: + from playhouse.tests import test_postgres + modules.append(test_postgres) + except ImportError: + print_('Unable to import postgres-ext tests, skipping') + if xtra(options.pwiz): + from playhouse.tests import test_pwiz + modules.append(test_pwiz) + if xtra(options.read_slave): + from playhouse.tests import test_read_slave + modules.append(test_read_slave) + if xtra(options.reflection): + from playhouse.tests import test_reflection + modules.append(test_reflection) + if xtra(options.signals): + from playhouse.tests import test_signals + modules.append(test_signals) + if xtra(options.shortcuts): + from playhouse.tests import test_shortcuts + modules.append(test_shortcuts) + if xtra(options.speedups): + try: + from playhouse.tests import test_speedups + modules.append(test_speedups) + except ImportError: + print_('Unable to import speedups tests, skipping') + if xtra(options.sqlcipher): + try: + from playhouse.tests import test_sqlcipher_ext + modules.append(test_sqlcipher_ext) + except ImportError: + print_('Unable to import pysqlcipher tests, skipping') + if xtra(options.sqliteq): + from playhouse.tests import test_sqliteq + modules.append(test_sqliteq) + if xtra(options.sqlite_c): + try: + from playhouse.tests import test_sqlite_c_ext + modules.append(test_sqlite_c_ext) + except ImportError: + print_('Unable to import SQLite C extension tests, skipping') + if xtra(options.sqlite_ext): + from playhouse.tests import test_sqlite_ext + modules.append(test_sqlite_ext) + if xtra(options.sqlite_udf): + from playhouse.tests import test_sqlite_udf + modules.append(test_sqlite_udf) + if xtra(options.test_utils): + from playhouse.tests import test_test_utils + modules.append(test_test_utils) + + if not modules or options.all: + import tests + modules.insert(0, tests) + return modules + +if __name__ == '__main__': + parser = get_option_parser() + options, args = parser.parse_args() + + if options.engine: + os.environ['PEEWEE_TEST_BACKEND'] = options.engine + os.environ['PEEWEE_TEST_VERBOSITY'] = str(options.verbosity) + + from peewee import print_ + + suite = unittest.TestSuite() + for module in collect_modules(options): + print_('Adding tests for "%s"' % module.__name__) + module_suite = unittest.TestLoader().loadTestsFromModule(module) + suite.addTest(module_suite) + + failures, errors = runtests(suite, options.verbosity) + + files_to_delete = [ + 'peewee_test.db', + 'peewee_test', + 'tmp.db', + 'peewee_test.bdb.db', + 'peewee_test.cipher.db'] + paths_to_delete = ['peewee_test.bdb.db-journal'] + for filename in files_to_delete: + if os.path.exists(filename): + os.unlink(filename) + for path in paths_to_delete: + if os.path.exists(path): + shutil.rmtree(path) + + if errors: + sys.exit(2) + elif failures: + sys.exit(1) + + sys.exit(0) diff --git a/tasks/candidate-1634-software-databases/tests/vendor/setup.py b/tasks/candidate-1634-software-databases/tests/vendor/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..4730853a4b7fd53ca9e5cb832d693205904bccfc --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/setup.py @@ -0,0 +1,82 @@ +import os +import platform +import sys +import warnings +from distutils.core import setup +from distutils.extension import Extension +from distutils.version import StrictVersion + +f = open(os.path.join(os.path.dirname(__file__), 'README.rst')) +readme = f.read() +f.close() + +setup_kwargs = {} +cython_min_version = '0.22.1' + +try: + from Cython.Distutils import build_ext + from Cython import __version__ as cython_version +except ImportError: + cython_installed = False + warnings.warn('Cython C extensions for peewee will NOT be built, because ' + 'Cython does not seem to be installed. To enable Cython C ' + 'extensions, install Cython >=' + cython_min_version + '.') +else: + if platform.python_implementation() != 'CPython': + cython_installed = False + warnings.warn('Cython C extensions disabled as you are not using ' + 'CPython.') + elif StrictVersion(cython_version) < StrictVersion(cython_min_version): + cython_installed = False + warnings.warn('Cython C extensions for peewee will NOT be built, ' + 'because the installed Cython version ' + '(' + cython_version + ') is too old. To enable Cython ' + 'C extensions, install Cython >=' + cython_min_version + + '.') + else: + cython_installed = True + +speedups_ext_module = Extension( + 'playhouse._speedups', + ['playhouse/_speedups.pyx']) +sqlite_udf_module = Extension( + 'playhouse._sqlite_udf', + ['playhouse/_sqlite_udf.pyx']) +sqlite_ext_module = Extension( + 'playhouse._sqlite_ext', + ['playhouse/_sqlite_ext.pyx']) + + +ext_modules = [] +if cython_installed: + ext_modules.extend([ + speedups_ext_module, + sqlite_udf_module, + sqlite_ext_module]) + +if ext_modules: + setup_kwargs.update( + cmdclass={'build_ext': build_ext}, + ext_modules=ext_modules) + +setup( + name='peewee', + version=__import__('peewee').__version__, + description='a little orm', + long_description=readme, + author='Charles Leifer', + author_email='coleifer@gmail.com', + url='http://github.com/coleifer/peewee/', + packages=['playhouse'], + py_modules=['peewee', 'pwiz'], + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + ], + scripts = ['pwiz.py', 'playhouse/pskel'], + **setup_kwargs +) diff --git a/tasks/candidate-1634-software-databases/tests/vendor/tests.py b/tasks/candidate-1634-software-databases/tests/vendor/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..bb1865a60dea17403b893a274b158d365c80cc64 --- /dev/null +++ b/tasks/candidate-1634-software-databases/tests/vendor/tests.py @@ -0,0 +1,31 @@ +""" + +Aggregate all the test modules and run from the command-line. For information +about running tests, see the README located in the `playhouse/tests` directory. +""" +import sys +import unittest + +from playhouse.tests.test_apis import * +from playhouse.tests.test_compound_queries import * +from playhouse.tests.test_database import * +from playhouse.tests.test_fields import * +from playhouse.tests.test_helpers import * +from playhouse.tests.test_introspection import * +from playhouse.tests.test_keys import * +from playhouse.tests.test_models import * +from playhouse.tests.test_queries import * +from playhouse.tests.test_query_results import * +from playhouse.tests.test_transactions import * + + +if __name__ == '__main__': + from peewee import print_ + print_("""\033[1;31m + ______ ______ ______ __ __ ______ ______ + /\ == \ /\ ___\ /\ ___\ /\ \ _ \ \ /\ ___\ /\ ___\\ + \ \ _-/ \ \ __\ \ \ __\ \ \ \/ ".\ \ \ \ __\ \ \ __\\ + \ \_\ \ \_____\ \ \_____\ \ \__/".~\_\ \ \_____\ \ \_____\\ + \/_/ \/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_____/ + \033[0m""") + unittest.main(argv=sys.argv) diff --git a/tasks/candidate-1669-operations-marketing/environment/Dockerfile b/tasks/candidate-1669-operations-marketing/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..29eca08c87c401fbb1fafa198afa931933356499 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4682f20691e854905196beb7597e364509d46dde42be74a71bf1ab2af04f0e4a diff --git a/tasks/candidate-1669-operations-marketing/environment/setup/setup.sh b/tasks/candidate-1669-operations-marketing/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1669-operations-marketing/instruction.md b/tasks/candidate-1669-operations-marketing/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f4e8f530db10bbebd85bc6dfa798c8fca0b1b020 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/instruction.md @@ -0,0 +1,26 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair campaign-outcome validation in uplift evaluation + +Work in `/app/vendor/scikit-uplift`, a frozen source tree for a real marketing uplift library. Its treatment-aware metrics correctly require two binary campaign arms, but malformed non-binary response outcomes currently flow into incrementality calculations and plots. + +Diagnose and repair the existing implementation. The repair must be made in both `sklift/metrics/metrics.py` and `sklift/viz/base.py`; do not replace the library with a separate evaluator, coerce response values, or special-case the supplied fixture. + +The public behavior is: + +- Every metric entry point that accepts `y_true` must reject response arrays containing values outside binary `0` and `1` with `ValueError` before computing cohort statistics. +- Every plotting entry point that accepts `y_true` must perform the same validation locally, before delegating to metric helpers or constructing misleading diagnostics. +- Existing consistent-length validation and binary treatment validation must remain in force. +- Valid binary campaigns must retain the existing model, uplift/Qini curve, AUC, percentile, and plotting behavior. +- Keep the frozen source and existing tests intact except for the two designated production modules. + +After repairing the source, run the supplied end-to-end workflow: + +```sh +python3 /app/tools/run_campaign_evaluation.py --output /app/campaign_evaluation.json +``` + +The command must complete offline. `/app/campaign_evaluation.json` must use `output_schema_version` `sklift.campaign-evaluation.v1`, record the three workflow stages, contain the valid campaign's model predictions, curves, scores, percentile table and plot titles, record each malformed campaign case as rejected with `ValueError`, and list the five source modules exercised by the workflow. + diff --git a/tasks/candidate-1669-operations-marketing/task.toml b/tasks/candidate-1669-operations-marketing/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..24bd7240405530fc6739d5f7cfe01b83b78e3a97 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1669-operations-marketing" +description = "MiMo-V2.6-RL terminal task candidate-1669-operations-marketing" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1669-operations-marketing" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4682f20691e854905196beb7597e364509d46dde42be74a71bf1ab2af04f0e4a" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/.gitignore b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..bc1a1f6167d09c909aad37280b760bb715d0f1da --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/.gitignore @@ -0,0 +1,2 @@ +# Created by pytest automatically. +* diff --git a/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/CACHEDIR.TAG b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/CACHEDIR.TAG new file mode 100644 index 0000000000000000000000000000000000000000..fce15ad7eaa74e5682b644c84efb75334c112f95 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/CACHEDIR.TAG @@ -0,0 +1,4 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by pytest. +# For information about cache directory tags, see: +# https://bford.info/cachedir/spec.html diff --git a/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/README.md b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b89018ced91c0a8af7f3f23ce8901870da89f3a0 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/README.md @@ -0,0 +1,8 @@ +# pytest cache directory # + +This directory contains data from the pytest's cache plugin, +which provides the `--lf` and `--ff` options, as well as the `cache` fixture. + +**Do not** commit this to version control. + +See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information. diff --git a/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/v/cache/nodeids b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/v/cache/nodeids new file mode 100644 index 0000000000000000000000000000000000000000..0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/.pytest_cache/v/cache/nodeids @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tasks/candidate-1669-operations-marketing/tests/anti_hack_guard.py b/tasks/candidate-1669-operations-marketing/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1669-operations-marketing/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1669-operations-marketing/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..534127aa0756906f4116635bf91fb75af8733d68 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,41 @@ +{ + "artifacts": [ + "campaign_evaluation.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "tools/run_campaign_evaluation.py": "0dafbd8a93e98c8e376a09130038535fc71f3d84fe025d09cda8c4acdda3429a", + "vendor/scikit-uplift/LICENSE": "afd386c8b30614cfd81688e28d26c81d6eaf548e429ae14a28450e37ecc0ec70", + "vendor/scikit-uplift/Readme.rst": "a888acc1ece89010379c19f8b1befba4552e3620b258e4f1911415f380492064", + "vendor/scikit-uplift/pytest.ini": "21a9f7e2c2133f012248ef1acc981ef80d83cb5a7291c6ea78d71b4623f2d368", + "vendor/scikit-uplift/requirements.txt": "60cd9307df1b679ac48a88eab0f790896fa181c6549b6565b3f84e07a3fa5de9", + "vendor/scikit-uplift/setup.py": "cfcbbc6c17a797643a371d528cb465e5d33720ec3e1e543754b23db538e1e5ac", + "vendor/scikit-uplift/sklift/__init__.py": "6eabb81bb22cfbc59eadefa1322f92b6111a94bed05be3c06ca58667da5507a5", + "vendor/scikit-uplift/sklift/datasets/__init__.py": "7dd0396bf047d488f40dca9d82f2d27b7f7cf866fd97bfe46f554b144ca783dc", + "vendor/scikit-uplift/sklift/datasets/datasets.py": "47fcf633e4ae49ddaf989942e4e2b8bb164a77fc3a3c8e1f95cb5fbded1158ac", + "vendor/scikit-uplift/sklift/datasets/descr/criteo.rst": "fd2c94f27e7f2f4ac0909ee8886d46b780ab6b20957ec9932e21be291de224bb", + "vendor/scikit-uplift/sklift/datasets/descr/hillstrom.rst": "fbd7d4e21e80740f66df14dce9d01d79e64ab9a26ab9d22bacf1961cbe54a72c", + "vendor/scikit-uplift/sklift/datasets/descr/lenta.rst": "37fc62adc4da3aff3e7530a5ae8f43acb9e15315822cf78dba1055c8aaac261a", + "vendor/scikit-uplift/sklift/datasets/descr/megafon.rst": "1e8e911d2b0f6e5c036b54cfe66ddfa6ae7d505ab5fb8f111efef5a72fb32cce", + "vendor/scikit-uplift/sklift/datasets/descr/x5.rst": "1ea4cdf66258c50176f99c716f4d9e60f6b4f9bdea9aa9ec9e1232d2baed6c74", + "vendor/scikit-uplift/sklift/metrics/__init__.py": "8f223911f9e416896fda43e86f3ad28ad1093c2a73f452f356ec5732eb8e3910", + "vendor/scikit-uplift/sklift/metrics/metrics.py": "b8b984999c9ec31016cee3b0ecfb0060540b4a4e288a36d8899442435b83256a", + "vendor/scikit-uplift/sklift/models/__init__.py": "c6787bbe64518b53d512557ab5945dffe936999ae63a6d2edbd84e5c8c7857c4", + "vendor/scikit-uplift/sklift/models/models.py": "5ab27cefcaded854b7a232032fbca722a1255f4c6668eb039a891d1c5235cfaf", + "vendor/scikit-uplift/sklift/tests/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/scikit-uplift/sklift/tests/conftest.py": "54ded438ac9f33c160061860df2a756dc43e8dccd0e5a2f04d69b135343ff9ac", + "vendor/scikit-uplift/sklift/tests/test_datasets.py": "cc4fb67034d054b5d03aeda20f53b49ba00f615bda382694600fdd71303e5c13", + "vendor/scikit-uplift/sklift/tests/test_import.py": "9c6cabf4cf622258ea757fd8d9d3a63c03cb2486ae7bbcc9f5f11abc473ae5db", + "vendor/scikit-uplift/sklift/tests/test_models.py": "08c06d6a0a816686bb599d73ec06c56fb8bd7cd357a633a02a60971934883bbd", + "vendor/scikit-uplift/sklift/utils/__init__.py": "d2db1442946b07bdd12ff1a57d471c9d212e727893008a88a52a9c07e000f35d", + "vendor/scikit-uplift/sklift/utils/utils.py": "b1850ef77facc5a1e846d84c0c6a8ecd9e943c5415504f3564aa788f21d9faff", + "vendor/scikit-uplift/sklift/viz/__init__.py": "2c3c464e8118ee23a58fcedcdfe550109ef32dc34f4cbe9a4f0a87a35ba53242", + "vendor/scikit-uplift/sklift/viz/base.py": "a247006210696bf66fea374fdd2d0e9418d26b004d4725532a4be79c1560a57e" + }, + "mutable": [ + "vendor/scikit-uplift/sklift/metrics/metrics.py", + "vendor/scikit-uplift/sklift/viz/base.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1669-operations-marketing/tests/fixtures/protected_files.json b/tasks/candidate-1669-operations-marketing/tests/fixtures/protected_files.json new file mode 100644 index 0000000000000000000000000000000000000000..4ea1fb3c7e4d13b7f41eb6781c6074e1dbfac359 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/fixtures/protected_files.json @@ -0,0 +1,27 @@ +{ + "tools/run_campaign_evaluation.py": "0dafbd8a93e98c8e376a09130038535fc71f3d84fe025d09cda8c4acdda3429a", + "vendor/scikit-uplift/LICENSE": "afd386c8b30614cfd81688e28d26c81d6eaf548e429ae14a28450e37ecc0ec70", + "vendor/scikit-uplift/Readme.rst": "a888acc1ece89010379c19f8b1befba4552e3620b258e4f1911415f380492064", + "vendor/scikit-uplift/pytest.ini": "21a9f7e2c2133f012248ef1acc981ef80d83cb5a7291c6ea78d71b4623f2d368", + "vendor/scikit-uplift/requirements.txt": "60cd9307df1b679ac48a88eab0f790896fa181c6549b6565b3f84e07a3fa5de9", + "vendor/scikit-uplift/setup.py": "cfcbbc6c17a797643a371d528cb465e5d33720ec3e1e543754b23db538e1e5ac", + "vendor/scikit-uplift/sklift/__init__.py": "6eabb81bb22cfbc59eadefa1322f92b6111a94bed05be3c06ca58667da5507a5", + "vendor/scikit-uplift/sklift/datasets/__init__.py": "7dd0396bf047d488f40dca9d82f2d27b7f7cf866fd97bfe46f554b144ca783dc", + "vendor/scikit-uplift/sklift/datasets/datasets.py": "47fcf633e4ae49ddaf989942e4e2b8bb164a77fc3a3c8e1f95cb5fbded1158ac", + "vendor/scikit-uplift/sklift/datasets/descr/criteo.rst": "fd2c94f27e7f2f4ac0909ee8886d46b780ab6b20957ec9932e21be291de224bb", + "vendor/scikit-uplift/sklift/datasets/descr/hillstrom.rst": "fbd7d4e21e80740f66df14dce9d01d79e64ab9a26ab9d22bacf1961cbe54a72c", + "vendor/scikit-uplift/sklift/datasets/descr/lenta.rst": "37fc62adc4da3aff3e7530a5ae8f43acb9e15315822cf78dba1055c8aaac261a", + "vendor/scikit-uplift/sklift/datasets/descr/megafon.rst": "1e8e911d2b0f6e5c036b54cfe66ddfa6ae7d505ab5fb8f111efef5a72fb32cce", + "vendor/scikit-uplift/sklift/datasets/descr/x5.rst": "1ea4cdf66258c50176f99c716f4d9e60f6b4f9bdea9aa9ec9e1232d2baed6c74", + "vendor/scikit-uplift/sklift/metrics/__init__.py": "8f223911f9e416896fda43e86f3ad28ad1093c2a73f452f356ec5732eb8e3910", + "vendor/scikit-uplift/sklift/models/__init__.py": "c6787bbe64518b53d512557ab5945dffe936999ae63a6d2edbd84e5c8c7857c4", + "vendor/scikit-uplift/sklift/models/models.py": "5ab27cefcaded854b7a232032fbca722a1255f4c6668eb039a891d1c5235cfaf", + "vendor/scikit-uplift/sklift/tests/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/scikit-uplift/sklift/tests/conftest.py": "54ded438ac9f33c160061860df2a756dc43e8dccd0e5a2f04d69b135343ff9ac", + "vendor/scikit-uplift/sklift/tests/test_datasets.py": "cc4fb67034d054b5d03aeda20f53b49ba00f615bda382694600fdd71303e5c13", + "vendor/scikit-uplift/sklift/tests/test_import.py": "9c6cabf4cf622258ea757fd8d9d3a63c03cb2486ae7bbcc9f5f11abc473ae5db", + "vendor/scikit-uplift/sklift/tests/test_models.py": "08c06d6a0a816686bb599d73ec06c56fb8bd7cd357a633a02a60971934883bbd", + "vendor/scikit-uplift/sklift/utils/__init__.py": "d2db1442946b07bdd12ff1a57d471c9d212e727893008a88a52a9c07e000f35d", + "vendor/scikit-uplift/sklift/utils/utils.py": "b1850ef77facc5a1e846d84c0c6a8ecd9e943c5415504f3564aa788f21d9faff", + "vendor/scikit-uplift/sklift/viz/__init__.py": "2c3c464e8118ee23a58fcedcdfe550109ef32dc34f4cbe9a4f0a87a35ba53242" +} diff --git a/tasks/candidate-1669-operations-marketing/tests/fixtures/regression_cases.json b/tasks/candidate-1669-operations-marketing/tests/fixtures/regression_cases.json new file mode 100644 index 0000000000000000000000000000000000000000..1fbbbbc3a264a324489bb40233c961cc926b9ba6 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/fixtures/regression_cases.json @@ -0,0 +1,8 @@ +{ + "continuous": [0.0, 1.0, 0.2, 0.0, 1.0, 1.75, 0.0, -0.5, 1.0, 0.0, 1.0, 0.0], + "multiclass": [0, 1, 2, 0, 1, 0, 3, 1, 0, 1, 0, 1], + "valid_outcome": [0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0], + "treatment": [0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0], + "uplift": [0.91, 0.83, 0.72, 0.66, 0.58, 0.47, 0.39, 0.31, 0.25, 0.18, 0.09, 0.02] +} + diff --git a/tasks/candidate-1669-operations-marketing/tests/task_test.sh b/tasks/candidate-1669-operations-marketing/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..063c88d071bcc10427ea680c3e0b37aff297806a --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/task_test.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -u +mkdir -p /logs/verifier +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +rc=$? +if [ "$rc" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit "$rc" + diff --git a/tasks/candidate-1669-operations-marketing/tests/test.sh b/tasks/candidate-1669-operations-marketing/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1669-operations-marketing/tests/test_outputs.py b/tasks/candidate-1669-operations-marketing/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..b31bc8d71d12d476b5a148bebe1989acf441a836 --- /dev/null +++ b/tasks/candidate-1669-operations-marketing/tests/test_outputs.py @@ -0,0 +1,306 @@ +import hashlib +import json +import os +import subprocess +import sys +from pathlib import Path + +import numpy as np +import pytest + +APP = Path(os.environ.get("TBENCH_APP", "/app")) +PROJECT = APP / "vendor/scikit-uplift" +OUTPUT = APP / "campaign_evaluation.json" +FIXTURES = Path(os.environ.get("TBENCH_TESTS", "/tests/fixtures")) + +sys.path.insert(0, str(PROJECT)) + +from sklift.metrics import ( # noqa: E402 + perfect_qini_curve, + perfect_uplift_curve, + qini_auc_score, + qini_curve, + response_rate_by_percentile, + uplift_at_k, + uplift_auc_score, + uplift_by_percentile, + uplift_curve, + weighted_average_uplift, +) +import sklift.viz.base as viz_base # noqa: E402 + + +def _load_cases(): + return json.loads((FIXTURES / "regression_cases.json").read_text()) + + +def _expected_curves(y_true, uplift, treatment): + y_true = np.asarray(y_true) + uplift = np.asarray(uplift) + treatment = np.asarray(treatment) + order = np.argsort(uplift, kind="mergesort")[::-1] + y_true = y_true[order] + uplift = uplift[order] + treatment = treatment[order] + + thresholds = np.r_[np.where(np.diff(uplift))[0], uplift.size - 1] + x = thresholds + 1 + n_treatment = np.cumsum(treatment)[thresholds] + n_control = x - n_treatment + treatment_responders = np.cumsum(y_true * (treatment == 1))[thresholds] + control_responders = np.cumsum(y_true * (treatment == 0))[thresholds] + + treatment_rate = np.divide( + treatment_responders, + n_treatment, + out=np.zeros_like(treatment_responders, dtype=float), + where=n_treatment != 0, + ) + control_rate = np.divide( + control_responders, + n_control, + out=np.zeros_like(control_responders, dtype=float), + where=n_control != 0, + ) + uplift_values = (treatment_rate - control_rate) * x + qini_values = treatment_responders - control_responders * np.divide( + n_treatment, + n_control, + out=np.zeros_like(n_treatment, dtype=float), + where=n_control != 0, + ) + return ( + np.r_[0, x], + np.r_[0.0, uplift_values], + np.r_[0, x], + np.r_[0.0, qini_values], + ) + + +def _run_report(): + env = os.environ.copy() + env.update( + { + "PYTHONPATH": str(PROJECT) + os.pathsep + env.get("PYTHONPATH", ""), + "MPLBACKEND": "Agg", + "PYTHONDONTWRITEBYTECODE": "1", + } + ) + result = subprocess.run( + [ + "python3", + str(APP / "tools/run_campaign_evaluation.py"), + "--output", + str(OUTPUT), + ], + text=True, + capture_output=True, + timeout=45, + env=env, + ) + assert result.returncode == 0, result.stderr + return json.loads(OUTPUT.read_text()) + + +@pytest.fixture(scope="session") +def report(): + return _run_report() + + +def test_gate_required_tree_compiles_and_report_exists(report): + required = [ + PROJECT / "sklift/metrics/metrics.py", + PROJECT / "sklift/viz/base.py", + PROJECT / "sklift/models/models.py", + PROJECT / "sklift/utils/utils.py", + APP / "tools/run_campaign_evaluation.py", + OUTPUT, + ] + assert all(path.is_file() for path in required) + for path in required[:5]: + compile(path.read_text(), str(path), "exec") + assert report["output_schema_version"] == "sklift.campaign-evaluation.v1" + assert report["workflow"] == [ + "fit_and_rank", + "evaluate_incrementality", + "render_diagnostics", + ] + + +def test_gate_immutable_source_and_runner_are_intact(): + protected = json.loads((FIXTURES / "protected_files.json").read_text()) + assert len(protected) >= 25 + for relative_path, expected_hash in protected.items(): + path = APP / relative_path + assert path.is_file(), relative_path + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected_hash, relative_path + + +def test_core_all_metric_families_reject_nonbinary_outcomes(): + cases = _load_cases() + treatment = np.asarray(cases["treatment"]) + uplift = np.asarray(cases["uplift"]) + operations = [ + lambda y: uplift_curve(y, uplift, treatment), + lambda y: perfect_uplift_curve(y, treatment), + lambda y: uplift_auc_score(y, uplift, treatment), + lambda y: qini_curve(y, uplift, treatment), + lambda y: perfect_qini_curve(y, treatment), + lambda y: qini_auc_score(y, uplift, treatment), + lambda y: uplift_at_k(y, uplift, treatment, strategy="by_group", k=2), + lambda y: response_rate_by_percentile( + y, uplift, treatment, group="treatment", strategy="by_group", bins=3 + ), + lambda y: weighted_average_uplift( + y, uplift, treatment, strategy="by_group", bins=3 + ), + lambda y: uplift_by_percentile( + y, uplift, treatment, strategy="by_group", bins=3 + ), + ] + for malformed_name in ("continuous", "multiclass"): + malformed = np.asarray(cases[malformed_name]) + for operation in operations: + with pytest.raises(ValueError): + operation(malformed) + + +def test_core_valid_curves_match_independent_campaign_recompute(): + cases = _load_cases() + y_true = np.asarray(cases["valid_outcome"]) + treatment = np.asarray(cases["treatment"]) + uplift = np.asarray(cases["uplift"]) + expected_x_u, expected_y_u, expected_x_q, expected_y_q = _expected_curves( + y_true, uplift, treatment + ) + + actual_x_u, actual_y_u = uplift_curve(y_true, uplift, treatment) + actual_x_q, actual_y_q = qini_curve(y_true, uplift, treatment) + np.testing.assert_array_equal(actual_x_u, expected_x_u) + np.testing.assert_allclose(actual_y_u, expected_y_u, rtol=0, atol=1e-12) + np.testing.assert_array_equal(actual_x_q, expected_x_q) + np.testing.assert_allclose(actual_y_q, expected_y_q, rtol=0, atol=1e-12) + + +def test_core_valid_percentiles_preserve_group_response_semantics(): + cases = _load_cases() + y_true = np.asarray(cases["valid_outcome"]) + treatment = np.asarray(cases["treatment"]) + uplift = np.asarray(cases["uplift"]) + order = np.argsort(uplift, kind="mergesort")[::-1] + + treated_bins = np.array_split(y_true[order][treatment[order] == 1], 3) + control_bins = np.array_split(y_true[order][treatment[order] == 0], 3) + treated_rates = np.array([values.mean() for values in treated_bins]) + control_rates = np.array([values.mean() for values in control_bins]) + treated_sizes = np.array([len(values) for values in treated_bins]) + expected_uplift = treated_rates - control_rates + expected_weighted = np.dot(treated_sizes, expected_uplift) / treated_sizes.sum() + + table = uplift_by_percentile( + y_true, + uplift, + treatment, + strategy="by_group", + bins=3, + string_percentiles=False, + ) + np.testing.assert_allclose( + table["response_rate_treatment"], treated_rates, rtol=0, atol=1e-12 + ) + np.testing.assert_allclose( + table["response_rate_control"], control_rates, rtol=0, atol=1e-12 + ) + np.testing.assert_allclose(table["uplift"], expected_uplift, rtol=0, atol=1e-12) + assert np.isclose( + weighted_average_uplift( + y_true, uplift, treatment, strategy="by_group", bins=3 + ), + expected_weighted, + rtol=0, + atol=1e-12, + ) + + +def test_edge_plot_entrypoints_validate_locally_before_delegation(monkeypatch): + cases = _load_cases() + malformed = np.asarray(cases["continuous"]) + treatment = np.asarray(cases["treatment"]) + uplift = np.asarray(cases["uplift"]) + delegated = [] + + def record_delegation(*args, **kwargs): + delegated.append((args, kwargs)) + return np.array([0, len(uplift)]), np.array([0.0, 0.0]) + + monkeypatch.setattr(viz_base, "uplift_curve", record_delegation) + monkeypatch.setattr(viz_base, "qini_curve", record_delegation) + monkeypatch.setattr(viz_base, "uplift_by_percentile", record_delegation) + + with pytest.raises(ValueError): + viz_base.plot_uplift_curve(malformed, uplift, treatment, random=False, perfect=False) + with pytest.raises(ValueError): + viz_base.plot_qini_curve(malformed, uplift, treatment, random=False, perfect=False) + with pytest.raises(ValueError): + viz_base.plot_uplift_by_percentile(malformed, uplift, treatment, bins=3) + assert delegated == [] + + +def test_edge_length_and_treatment_contracts_remain_enforced(): + cases = _load_cases() + valid = np.asarray(cases["valid_outcome"]) + uplift = np.asarray(cases["uplift"]) + treatment = np.asarray(cases["treatment"]) + + with pytest.raises(ValueError, match="inconsistent numbers"): + uplift_curve([0, 2, 1], uplift, treatment) + invalid_treatment = treatment.copy() + invalid_treatment[4] = 2 + with pytest.raises(ValueError): + qini_curve(valid, uplift, invalid_treatment) + + +def test_edge_integration_report_is_semantic_and_complete(report): + source_modules = report["source_modules"] + assert source_modules == [ + "sklift/metrics/metrics.py", + "sklift/viz/base.py", + "sklift/models/models.py", + "sklift/utils/utils.py", + "sklift/datasets/datasets.py", + ] + invalid = {case["id"]: case for case in report["invalid_outcome_cases"]} + assert set(invalid) == { + "metric_curve_continuous", + "metric_percentile_multiclass", + "plot_curve_multiclass", + "plot_percentile_continuous", + } + assert all(case["status"] == "rejected" for case in invalid.values()) + assert all(case["error_type"] == "ValueError" for case in invalid.values()) + + valid = report["valid_campaign"] + assert valid["sample_count"] == valid["prediction_count"] == 20 + assert valid["treated_count"] == 10 + assert valid["responder_count"] == 11 + assert len(valid["percentiles"]) == 5 + assert len(valid["plot_titles"]) == 2 + assert "Uplift curve" in valid["plot_titles"][0] + assert "Qini curve" in valid["plot_titles"][1] + + report_y = np.array( + [0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1] + ) + report_treatment = np.array([i % 2 for i in range(20)]) + predictions = np.asarray(valid["uplift_predictions"]) + expected_x_u, expected_y_u, expected_x_q, expected_y_q = _expected_curves( + report_y, predictions, report_treatment + ) + np.testing.assert_array_equal(valid["uplift_curve"]["x"], expected_x_u) + np.testing.assert_allclose( + valid["uplift_curve"]["y"], expected_y_u, rtol=0, atol=1e-12 + ) + np.testing.assert_array_equal(valid["qini_curve"]["x"], expected_x_q) + np.testing.assert_allclose( + valid["qini_curve"]["y"], expected_y_q, rtol=0, atol=1e-12 + ) diff --git a/tasks/candidate-1682-science-physics/environment/Dockerfile b/tasks/candidate-1682-science-physics/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6eb8c2ced4e022111ea5a6f535bf460aa66dfdab --- /dev/null +++ b/tasks/candidate-1682-science-physics/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:512c33b53f073a3ff35859d2def7135b5c39f89e9c38d1684e97c943ef6496fd diff --git a/tasks/candidate-1682-science-physics/environment/setup/setup.sh b/tasks/candidate-1682-science-physics/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1682-science-physics/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1682-science-physics/instruction.md b/tasks/candidate-1682-science-physics/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..488ecda1a6d95957c1a2ffb0a9b40562817d8469 --- /dev/null +++ b/tasks/candidate-1682-science-physics/instruction.md @@ -0,0 +1,38 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair programmatic particle names across the domain model + +The vendored Scikit-HEP `particle` source under `/app/vendor/particle` has a +semantic regression in its Python-safe identifier generation. A trailing `0` +has two meanings in the package's domain data: + +- for an ordinary neutral particle it is a charge suffix and must be separated + in the programmatic identifier, such as `H0` becoming `H_0`; +- for a nucleus it can be the final digit of the atomic mass number and must + remain attached, such as `C10` and `Ag100` remaining `C10` and `Ag100`. + +Repair the existing implementation in place. Both of these source modules must +be changed: + +- `/app/vendor/particle/src/particle/particle/utilities.py` +- `/app/vendor/particle/src/particle/particle/particle.py` + +The lower-level `programmatic_name` utility must accept explicit nucleus +classification while remaining backward compatible for ordinary one-argument +callers. The public `Particle.programmatic_name` property must pass the domain +object's actual PDG nucleus classification into that utility. Direct utility +callers and the public property must therefore agree. + +Preserve all established normalization behavior for ordinary neutral names, +charged particles, multi-character charges, resonances, parentheses, stars, +and antiparticle markers. In particular, fixing terminal-zero nuclei must not +regress names such as `pi0`, `K*(892)0`, `Delta(1232)++`, or `Lambda~`, and an +anti-nucleus must still receive normal antiparticle normalization. + +Do not replace the project with a new evaluator, hard-code only the visible +examples, remove bundled PDG/nucleus data, edit or disable tests, or bypass the +existing `Particle` lookup and property path. The repaired source tree must +remain importable offline and the existing focused utility tests must continue +to pass. diff --git a/tasks/candidate-1682-science-physics/task.toml b/tasks/candidate-1682-science-physics/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f4c03711872ee304d321a414eea4d2247c4ad3ce --- /dev/null +++ b/tasks/candidate-1682-science-physics/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1682-science-physics" +description = "MiMo-V2.6-RL terminal task candidate-1682-science-physics" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1682-science-physics" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 360.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:512c33b53f073a3ff35859d2def7135b5c39f89e9c38d1684e97c943ef6496fd" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1682-science-physics/tests/anti_hack_guard.py b/tasks/candidate-1682-science-physics/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1682-science-physics/tests/fixtures/base_hashes.json b/tasks/candidate-1682-science-physics/tests/fixtures/base_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..08e1f0b763e7ba2f8c61cf75a1af6fc01ab133b7 --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/fixtures/base_hashes.json @@ -0,0 +1,15 @@ +{ + "mutable_pristine": { + "src/particle/particle/particle.py": "837fac50a9bff8da5b1314fefa95b8b05c398a851df007de0e31c63a9cde898b", + "src/particle/particle/utilities.py": "d89aee19b2bf22ff7548b92e63bee4e381f0c2bf00906526d6040423cde01d97" + }, + "protected": { + "LICENSE": "20516214b80e816b0a1f462fa63b44cde7e9a0716c6f9a723045f196b942aaab", + "pyproject.toml": "95c0f619372c7b0a74583f5adc60ef15e302d55127f6ad2701f799da32b26199", + "src/particle/data/nuclei2022.csv": "05e7a299561c24fa3724b16e006dfb4e0032bcf0dc86163a7143627d5b1b2c76", + "src/particle/particle/convert.py": "f1f24c9f15388dfc2df01a6a6054f587f02b6c13135a177e2aa96d85ee3069ac", + "src/particle/particle/enums.py": "dd26580aba86ed8256fcda59077f799efdad802e1d7989bd62fbc5f2e2e15995", + "src/particle/pdgid/functions.py": "8f7d86ec47cb7dc06443d1da80a1ff42eaf83d88cb0bdc4d270dac2b342dfa33", + "tests/particle/test_utilities.py": "c2729c0e4e6cb1e123f560a9aace56afd16f8341e2b5a288d61f59b49506d8af" + } +} diff --git a/tasks/candidate-1682-science-physics/tests/fixtures/name_cases.json b/tasks/candidate-1682-science-physics/tests/fixtures/name_cases.json new file mode 100644 index 0000000000000000000000000000000000000000..e0eec4f45cb65343c4838f9889c75977a70b1e70 --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/fixtures/name_cases.json @@ -0,0 +1,25 @@ +{ + "direct_utility": [ + {"name": "C10", "is_nucleus": true, "expected": "C10"}, + {"name": "Ag100", "is_nucleus": true, "expected": "Ag100"}, + {"name": "C10~", "is_nucleus": true, "expected": "C10_bar"}, + {"name": "H0", "is_nucleus": false, "expected": "H_0"}, + {"name": "pi0", "is_nucleus": false, "expected": "pi_0"}, + {"name": "K*(892)0", "is_nucleus": false, "expected": "Kst_892_0"}, + {"name": "Delta(1232)++", "is_nucleus": false, "expected": "Delta_1232_pp"}, + {"name": "~d(R)~", "is_nucleus": false, "expected": "tilde_d_R_bar"} + ], + "nuclei": [ + {"z": 1, "a": 4, "anti": false, "domain_name": "H4", "expected": "H4"}, + {"z": 6, "a": 10, "anti": false, "domain_name": "C10", "expected": "C10"}, + {"z": 47, "a": 100, "anti": false, "domain_name": "Ag100", "expected": "Ag100"}, + {"z": 6, "a": 10, "anti": true, "domain_name": "C10~", "expected": "C10_bar"} + ], + "ordinary_particles": [ + {"name": "H0", "expected": "H_0"}, + {"name": "pi0", "expected": "pi_0"}, + {"name": "K*(892)0", "expected": "Kst_892_0"}, + {"name": "Delta(1232)++", "expected": "Delta_1232_pp"}, + {"name": "Lambda~", "expected": "Lambda_bar"} + ] +} diff --git a/tasks/candidate-1682-science-physics/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1682-science-physics/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..093508bf411bd8ef73650dfb848a258b1a843ad8 --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,87 @@ +{ + "artifacts": [ + "vendor/particle/src/particle/particle/particle.py", + "vendor/particle/src/particle/particle/utilities.py" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "WORKSPACE.md": "2b68f0c4f86d4bf87b96bb9f836e88c06e180bc575b1f894ab7baaa6d2eb601d", + "vendor/offline_deps/hepunits/__init__.py": "c9fd65e12de4f5ded46e4962775dbb8b3d907b7e950a595d54d4c0991ae448d7", + "vendor/offline_deps/hepunits/constants.py": "329f377fac4661a1fd9e7dded6fffa9c9bfd70d41de426e070312f40d0a29b2c", + "vendor/offline_deps/hepunits/units.py": "2a6c7a163e8a1ee898b8ec8554f9481e0b4a4163aebb28e40ed7a8811796fbc7", + "vendor/particle/LICENSE": "20516214b80e816b0a1f462fa63b44cde7e9a0716c6f9a723045f196b942aaab", + "vendor/particle/pyproject.toml": "95c0f619372c7b0a74583f5adc60ef15e302d55127f6ad2701f799da32b26199", + "vendor/particle/src/particle/__init__.py": "71bd53f60b6f5a80e6ccfa5635aff09683ac152781e050808c0dd1ddbd0c5724", + "vendor/particle/src/particle/__main__.py": "2d10dff23a6f29ae77500ca32dbe4c284515abee75fb0edd2eb6285b966635b6", + "vendor/particle/src/particle/_compat/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/_compat/typing.py": "956188fb29838de9ef918d202e4deb520757a38f95308bb29ab731dbf9c43504", + "vendor/particle/src/particle/converters/__init__.py": "3f133b4be43ac20abe461395c72361f837be63727c92d70ce109b48472c48066", + "vendor/particle/src/particle/converters/bimap.py": "3290f629457a10a8c9d85bbd8b12cd95a8ac988557ce6c9d8465e747b93e5398", + "vendor/particle/src/particle/converters/corsika.py": "8d9d8883e69eeeadb6333a123833901580d9414e6cba533269cfe2217417dce3", + "vendor/particle/src/particle/converters/evtgen.py": "73b12a9ee6651ab5e2bfbe721cbaccfeb7f09877e612ebdacdab2b2a5a2ba8ac", + "vendor/particle/src/particle/converters/geant.py": "09beaaa8ac3d52a0c3a3cf9272989944dc7995e35c3c8695a56d231e82f250fd", + "vendor/particle/src/particle/converters/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/converters/pythia.py": "2aa8a8e739c6486789a34776fbc73d289ef350aee3f75eb8ccdf4fb871b8ebd4", + "vendor/particle/src/particle/corsika/__init__.py": "fe9b06c8bf1db9c36693b47e79344c8beedb708f90689fca0439a7c228b77e6a", + "vendor/particle/src/particle/corsika/corsika7id.py": "cf71c0bf23ded350da030542f7fb7394613b62bac54cb1dc512f87bb690de240", + "vendor/particle/src/particle/data/README.rst": "a8d801a5ddb7151b556b1fd82f64626a6f88f684f00eef5c881b02fc4f1a717c", + "vendor/particle/src/particle/data/__init__.py": "1c2f4d5d6ea2c465ae879b515de51bea20b86e479ca18eb2ae151a4691931579", + "vendor/particle/src/particle/data/conversions.csv": "95f9a9f3bd8642130032433013ece0c910d532d5bd72cd9a8ec36ae37bc441c1", + "vendor/particle/src/particle/data/mass_width_2008.fwf": "889b2ad80bdc657d8295162cb9bb39982c1383fa495616a596167e36182fc697", + "vendor/particle/src/particle/data/mass_width_2008_ext.fwf": "b4a8e39a376e0663411d282534d999598a068f1de3a18ae6ffae9083de58a8d4", + "vendor/particle/src/particle/data/mass_width_2022.mcd": "263caa5c1fa4fbc83e097918bddfac92208c98c71b0fd7f783fde84979d6c562", + "vendor/particle/src/particle/data/mass_width_2023.mcd": "939769daa91a2f68cdbca72074037a6c86dddfc8f95d1d6823a10b81d8124b36", + "vendor/particle/src/particle/data/mass_width_2024.mcd": "b3e3f1dd249a734a31d9a66e11415bc4e00812cc034d7768dc1ea5af32bd6d3e", + "vendor/particle/src/particle/data/nuclei2020.csv": "53d7e9d8c919a1420a2356397d0be2e4791ffc62d215de879fb607d85ff3510b", + "vendor/particle/src/particle/data/nuclei2022.csv": "05e7a299561c24fa3724b16e006dfb4e0032bcf0dc86163a7143627d5b1b2c76", + "vendor/particle/src/particle/data/particle2022.csv": "3b71d6946b3f1811475c1fcf928f85b65a74cbce66435762e85cbd6f324faf80", + "vendor/particle/src/particle/data/particle2023.csv": "0913ed06b1171860434001c7eb109b3cdca9c870e1518de6136fdda148f4dec4", + "vendor/particle/src/particle/data/particle2024.csv": "27ebc75f4c8db30e405790f16e8ed08b4dfac4a0d7cc17d1fed8277deded597c", + "vendor/particle/src/particle/data/pdgid_to_corsika7id.csv": "db210fb84d73773c3775b10a44fea5189e6e7e04b4cbdb5d07470dc361c93361", + "vendor/particle/src/particle/data/pdgid_to_evtgenname.csv": "825856c8f995159b0f48bdd69057a4cec07a18e8dff030c4463a5a49c22a9173", + "vendor/particle/src/particle/data/pdgid_to_geant3id.csv": "63d2a3e463abd9e25dc8fa018f8b3f818205fa17c51deb5a41e8eeee7d8c64ce", + "vendor/particle/src/particle/data/pdgid_to_latexname.csv": "c59bad804fc7be8396968a82cf86ce486e7293b857da5eb32cb774ba66a0bd8d", + "vendor/particle/src/particle/data/pdgid_to_pythiaid.csv": "13aad171de5c00a4c46853bd3bed7375ba2e2ce1d615bbb9137050ce11d56c9f", + "vendor/particle/src/particle/data/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/exceptions.py": "e3992956a2e5f719cbce353b76d089814939a62e0f29bf86a448260ba98f7e85", + "vendor/particle/src/particle/geant/__init__.py": "8ad253a48e994935898be0dceaf775927c3c7d49c4369f352a4b5e262e66fd17", + "vendor/particle/src/particle/geant/geant3id.py": "ea8bbcfe9f00f46aac1b5333050416091e21e0e9ccb1a75f242c30e6ad2a5c80", + "vendor/particle/src/particle/geant/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/lhcb/__init__.py": "51c6168f30c44343415f73073533528bfc1bb282c54821ab7dbdcdd989cc5baa", + "vendor/particle/src/particle/lhcb/converters.py": "90a246870089d8490179ddeb14e621f49bfdd4a51336d138ba20a3dea4c7a0f7", + "vendor/particle/src/particle/lhcb/data/__init__.py": "138fb0e4522afd17e2c70412d33144968c2660e29451ce37c474e51acb109390", + "vendor/particle/src/particle/lhcb/data/pdgid_to_lhcbname.csv": "cb2d7b39faa20f75b33dc200e4804782d16f15205f7c774e39a570e99954b971", + "vendor/particle/src/particle/lhcb/data/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/lhcb/functions.py": "8a94233d4c0e941e0d61b84dfd87ededcd39664d67f61b0646b12b4b6bd3fb31", + "vendor/particle/src/particle/lhcb/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/particle/__init__.py": "0f22a514f6cd7dd1fd9631506bccd3f7c46b80b46c62d3df875100156d21c83b", + "vendor/particle/src/particle/particle/convert.py": "f1f24c9f15388dfc2df01a6a6054f587f02b6c13135a177e2aa96d85ee3069ac", + "vendor/particle/src/particle/particle/enums.py": "dd26580aba86ed8256fcda59077f799efdad802e1d7989bd62fbc5f2e2e15995", + "vendor/particle/src/particle/particle/kinematics.py": "4cac492ef8e967abd87bbf16bac862510a06803f9a7407d1dd86c96090636787", + "vendor/particle/src/particle/particle/literals.py": "1a5187cb60c30f08a0e10faa4c5fad84d5ed4655558d147ac0221a9a8554044a", + "vendor/particle/src/particle/particle/particle.py": "837fac50a9bff8da5b1314fefa95b8b05c398a851df007de0e31c63a9cde898b", + "vendor/particle/src/particle/particle/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/particle/regex.py": "f9ce66d1cb7b77a94afc55883a390c359a7c90a857c580547e0a5985c2ad0470", + "vendor/particle/src/particle/particle/utilities.py": "d89aee19b2bf22ff7548b92e63bee4e381f0c2bf00906526d6040423cde01d97", + "vendor/particle/src/particle/pdgid/__init__.py": "6f88a6de40e41b52efd8ea158a962f1381c9bde487b9712256ea2334a4ef38cf", + "vendor/particle/src/particle/pdgid/functions.py": "8f7d86ec47cb7dc06443d1da80a1ff42eaf83d88cb0bdc4d270dac2b342dfa33", + "vendor/particle/src/particle/pdgid/literals.py": "9950cf90280a1316bb7f4c58969cdc6250c6a2da406d5f33913dab413d25e2ec", + "vendor/particle/src/particle/pdgid/pdgid.py": "b40ad40cf33e2e95d7ada666c9f08990d120393f2ebb78c33e254d27c64ce1d9", + "vendor/particle/src/particle/pdgid/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/pythia/__init__.py": "a429042a3f91dbcdbc1cc563962f862951e3e4a93c02ca5079a980ce4a3f0631", + "vendor/particle/src/particle/pythia/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/particle/src/particle/pythia/pythiaid.py": "a73cba34e68f7c19645a57e78447f04390cc3e36e8a734dfb2fbd6e651bf2ef2", + "vendor/particle/src/particle/shared_literals.py": "796877141194777f0641b77874001b575ffb7c5e161501a19ad237bc13654e52", + "vendor/particle/src/particle/typing.py": "b7c250ff53222e7e11e7609d1baf63e613df696994b2ba8e117bb17fd5a9aa9a", + "vendor/particle/src/particle/version.py": "eeced1a15f6dd8b9d6596e1587947887fefc2da4e6c219c6875736400a838c92", + "vendor/particle/src/particle/version.pyi": "8f991bcdf9ba94e9fc0730125d68c6200d724f43a51d35aa95bc99f128bfa341", + "vendor/particle/tests/particle/test_utilities.py": "c2729c0e4e6cb1e123f560a9aace56afd16f8341e2b5a288d61f59b49506d8af" + }, + "mutable": [ + "vendor/particle/src/particle/particle/particle.py", + "vendor/particle/src/particle/particle/utilities.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1682-science-physics/tests/task_test.sh b/tasks/candidate-1682-science-physics/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6fa5e3657a173021ed264c2f8e21aab6121d228d --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/task_test.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -uo pipefail +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +export PYTHONPATH="/app/vendor/offline_deps:/app/vendor/particle/src" + +set +e +python3 -m pytest \ + --ctrf /logs/verifier/ctrf.json \ + -q /tests/test_outputs.py +status=$? +set -e + +if [[ $status -eq 0 ]]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi + +exit 0 diff --git a/tasks/candidate-1682-science-physics/tests/test.sh b/tasks/candidate-1682-science-physics/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1682-science-physics/tests/test_outputs.py b/tasks/candidate-1682-science-physics/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..403fd5c48ae85f1e8b40551c17a304f8748738c8 --- /dev/null +++ b/tasks/candidate-1682-science-physics/tests/test_outputs.py @@ -0,0 +1,145 @@ +from __future__ import annotations + +import ast +import hashlib +import inspect +import json +import os +import sys +from pathlib import Path + +import pytest + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +PROJECT = APP / "vendor/particle" +SRC = PROJECT / "src" +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MUTABLE = { + "src/particle/particle/particle.py": PROJECT + / "src/particle/particle/particle.py", + "src/particle/particle/utilities.py": PROJECT + / "src/particle/particle/utilities.py", +} + +sys.path.insert(0, str(APP / "vendor/offline_deps")) +sys.path.insert(0, str(SRC)) + +from particle import Particle # noqa: E402 +from particle.particle.utilities import programmatic_name # noqa: E402 +import particle.particle.particle as particle_model # noqa: E402 + + +def _load_json(name: str) -> dict: + return json.loads((FIXTURES / name).read_text(encoding="utf-8")) + + +def _sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as stream: + for block in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(block) + return digest.hexdigest() + + +def test_gate_workspace_integrity() -> None: + hashes = _load_json("base_hashes.json") + assert PROJECT.is_dir(), "vendored project is missing" + assert (PROJECT / "src/particle/__init__.py").is_file() + assert (PROJECT / "src/particle/data/particle2024.csv").stat().st_size > 40_000 + assert (PROJECT / "src/particle/data/nuclei2022.csv").stat().st_size > 500_000 + for relative, expected in hashes["protected"].items(): + path = PROJECT / relative + assert path.is_file(), f"protected source asset missing: {relative}" + assert _sha256(path) == expected, f"protected source asset changed: {relative}" + + +def test_gate_mutable_modules_are_real_and_changed() -> None: + hashes = _load_json("base_hashes.json")["mutable_pristine"] + for relative, path in MUTABLE.items(): + assert path.is_file(), f"required mutable module missing: {relative}" + assert _sha256(path) != hashes[relative], f"required module was not repaired: {relative}" + ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) + + particle_tree = ast.parse(MUTABLE["src/particle/particle/particle.py"].read_text()) + particle_classes = [ + node for node in particle_tree.body if isinstance(node, ast.ClassDef) + ] + assert any(node.name == "Particle" for node in particle_classes) + particle_class = next(node for node in particle_classes if node.name == "Particle") + assert sum(isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) for node in particle_class.body) >= 35 + + utility_tree = ast.parse(MUTABLE["src/particle/particle/utilities.py"].read_text()) + utility_functions = { + node.name for node in utility_tree.body if isinstance(node, ast.FunctionDef) + } + assert {"programmatic_name", "str_with_unc", "latex_name_unicode", "latex_to_html_name"} <= utility_functions + + +def test_core_direct_utility_matrix() -> None: + cases = _load_json("name_cases.json")["direct_utility"] + observed = [ + programmatic_name(case["name"], is_nucleus=case["is_nucleus"]) + for case in cases + ] + expected = [case["expected"] for case in cases] + assert observed == expected + assert all(value.isidentifier() for value in observed) + assert observed[0] != programmatic_name(cases[0]["name"]) + assert observed[1] != programmatic_name(cases[1]["name"]) + + +def test_core_particle_table_and_nucleus_workflow() -> None: + cases = _load_json("name_cases.json") + nuclei = [] + for case in cases["nuclei"]: + particle = Particle.from_nucleus_info( + z=case["z"], a=case["a"], anti=case["anti"] + ) + nuclei.append((particle, case)) + + assert [particle.name for particle, _ in nuclei] == [ + case["domain_name"] for _, case in nuclei + ] + assert all(particle.pdgid.is_nucleus for particle, _ in nuclei) + assert [particle.programmatic_name for particle, _ in nuclei] == [ + case["expected"] for _, case in nuclei + ] + + ordinary = [ + (Particle.from_name(case["name"]), case) + for case in cases["ordinary_particles"] + ] + assert all(not particle.pdgid.is_nucleus for particle, _ in ordinary) + assert [particle.programmatic_name for particle, _ in ordinary] == [ + case["expected"] for _, case in ordinary + ] + + +def test_core_property_threads_domain_classification( + monkeypatch: pytest.MonkeyPatch, +) -> None: + calls: list[tuple[str, bool]] = [] + real_utility = particle_model.programmatic_name + + def recording_utility(name: str, is_nucleus: bool = False) -> str: + calls.append((name, is_nucleus)) + return real_utility(name, is_nucleus=is_nucleus) + + monkeypatch.setattr(particle_model, "programmatic_name", recording_utility) + nucleus = Particle.from_nucleus_info(z=6, a=10) + ordinary = Particle.from_name("H0") + + assert nucleus.programmatic_name == "C10" + assert ordinary.programmatic_name == "H_0" + assert calls == [("C10", True), ("H0", False)] + + +def test_edge_signature_antiparticles_and_resonances() -> None: + signature = inspect.signature(programmatic_name) + assert list(signature.parameters) == ["name", "is_nucleus"] + assert signature.parameters["is_nucleus"].default is False + assert programmatic_name("C10~", True) == "C10_bar" + assert programmatic_name("K*(892)0") == "Kst_892_0" + assert programmatic_name("Delta(1232)++") == "Delta_1232_pp" + assert Particle.from_nucleus_info(z=6, a=10, anti=True).programmatic_name == "C10_bar" + assert Particle.from_name("Lambda~").programmatic_name == "Lambda_bar" diff --git a/tasks/candidate-1702-ml-inference/environment/Dockerfile b/tasks/candidate-1702-ml-inference/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5691b5f0cf299d21943c572c09a043842e123bbe --- /dev/null +++ b/tasks/candidate-1702-ml-inference/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6b1a826116bf2f23e68ae41c36cb74a4173a25b563d3eb80a0e7e207bb41446b diff --git a/tasks/candidate-1702-ml-inference/environment/setup/setup.sh b/tasks/candidate-1702-ml-inference/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1702-ml-inference/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1702-ml-inference/instruction.md b/tasks/candidate-1702-ml-inference/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a8ff1ff6ab2615fbddf965f5d2eb758aa165b51b --- /dev/null +++ b/tasks/candidate-1702-ml-inference/instruction.md @@ -0,0 +1,30 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair context-length resolution + +You are given a frozen slice of a Python language-model evaluation harness under +`/app/vendor/project`. A regression causes automatic context-window detection to ignore the text +configuration nested inside composite model configs. Repair the existing production modules so +the integration runner resolves the usable text context correctly. + +Requirements: + +1. Prefer a nested `text_config` length (`n_positions`, then `max_position_embeddings`, then + `n_ctx`) over unrelated top-level modality limits. +2. Preserve the same attribute precedence for text-only configs. +3. Use a finite tokenizer `model_max_length` only when config lengths are absent. The Hugging Face + infinity sentinel means "unset" and must return the default of 2048. +4. An explicit `max_length` supplied to `HFLM` must override automatic resolution. +5. Keep resolution logic shared in `lm_eval.models.utils` and make `HFLM.max_length` use it. + +Run the offline regression: + +```sh +cd /app +python3 tools/run_fixture.py inputs.json +``` + +It must produce `/app/output.json` with schema `lm-eval-context-repair.v1` and one result per +case, retaining input order. Do not add dependencies, download models, or access the network. diff --git a/tasks/candidate-1702-ml-inference/task.toml b/tasks/candidate-1702-ml-inference/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bac8e2b1c17c91002141bee0099e16598bda6430 --- /dev/null +++ b/tasks/candidate-1702-ml-inference/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1702-ml-inference" +description = "MiMo-V2.6-RL terminal task candidate-1702-ml-inference" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1702-ml-inference" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6b1a826116bf2f23e68ae41c36cb74a4173a25b563d3eb80a0e7e207bb41446b" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1702-ml-inference/tests/anti_hack_guard.py b/tasks/candidate-1702-ml-inference/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1702-ml-inference/tests/fixtures/inputs.json b/tasks/candidate-1702-ml-inference/tests/fixtures/inputs.json new file mode 100644 index 0000000000000000000000000000000000000000..effe3fd625f5f0463d02bed5278f1a178fac7f4f --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/fixtures/inputs.json @@ -0,0 +1,13 @@ +{ + "output_schema_version": "lm-eval-context-repair.v1", + "default": 2048, + "cases": [ + {"id": "composite_nested", "config": {"top_level": {"max_position_embeddings": 1024}, "text_config": {"max_position_embeddings": 8192}}, "tokenizer_model_max_length": 1000000000000000019884624838656}, + {"id": "text_n_positions", "config": {"n_positions": 4096}, "tokenizer_model_max_length": 512}, + {"id": "text_max_position", "config": {"max_position_embeddings": 3072}, "tokenizer_model_max_length": 512}, + {"id": "text_n_ctx", "config": {"n_ctx": 1536}, "tokenizer_model_max_length": 512}, + {"id": "finite_tokenizer", "config": {}, "tokenizer_model_max_length": 768}, + {"id": "infinite_tokenizer", "config": {}, "tokenizer_model_max_length": 1000000000000000019884624838656}, + {"id": "explicit_override", "config": {"text_config": {"max_position_embeddings": 8192}}, "tokenizer_model_max_length": 512, "explicit_max_length": 1234} + ] +} diff --git a/tasks/candidate-1702-ml-inference/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1702-ml-inference/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..fbcb5014836365cd48610c7599659c71ee5a58a0 --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,30 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "inputs.json": "496ecc7f07af91421f7f359f21351a336bdde4e846d959b163306d055a1e8705", + "tools/run_fixture.py": "c9627bc930604b9a1c4864ac486ae17cdc582811a1d72ee90ed166bf49121f07", + "vendor/project/LICENSE.md": "a806e42547620dffbc2ec0333322c8b3523b4af11e059be14ef81aa5b1ae021f", + "vendor/project/lm_eval-0.4.13.dev0.dist-info/METADATA": "1a415207463a42fb91ce188543e359259c751a110c819067bb114794241efb63", + "vendor/project/lm_eval-0.4.13.dev0.dist-info/top_level.txt": "ae2b10c1fde95371285da60bfdb2981735ba12d04ebc9c49a2d29d0f3eb4e439", + "vendor/project/lm_eval/__init__.py": "e09b8004f0b93ad0153b348e02b73582f5b9319a481f0efd9fb96b9e7d245a54", + "vendor/project/lm_eval/api/model.py": "4b98863889c17ffa7a7d391e83264fde0aa76f6883ef2e863065728b126508f8", + "vendor/project/lm_eval/api/registry.py": "df76c22a872b5176620b3cd04f8c07f04ba93af66206d62f4670c1f77cf32c45", + "vendor/project/lm_eval/models/__init__.py": "b19f37cb46acb5b512adb0138ca664b309e71e1f17d05011ff426b78bcb29f39", + "vendor/project/lm_eval/models/huggingface.py": "1d0db3bae9579b268d61312da26b6c7d72ebf156de1d1854cc8bbce0432a6868", + "vendor/project/lm_eval/models/mistral3.py": "c8bbc5f41ede66b87721f7ef596b92bdc99d805a0aa49e158ed5b038dfbd7564", + "vendor/project/lm_eval/models/utils.py": "d3e1955d9d063b24ba11bf78c40cd11fe51fc7b29d7304a5431153332ad78f58", + "vendor/project/lm_eval/models/utils_hf.py": "72f7f006683841dabf59220be18040d2b83544163721aa61b92e146e7504cc88", + "vendor/project/lm_eval/models/vllm_causallms.py": "885b353d2cce0143b35fbf64650800450415ac9e0edeaed2d48f7e6df9c3f4fc", + "vendor/project/lm_eval/utils.py": "929bbd92726e12ced747267248f56a7112da8b6a65527f21a925534243cc4ba5", + "vendor/project/pyproject.toml": "40d43320a7837e6e34c2875e3befd2b3e91275f265beb01c0bf94a568969c39d" + }, + "mutable": [ + "vendor/project/lm_eval/models/huggingface.py", + "vendor/project/lm_eval/models/utils.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1702-ml-inference/tests/fixtures/source_integrity.json b/tasks/candidate-1702-ml-inference/tests/fixtures/source_integrity.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbfd09689d6add984fd89b71093a35a0a92bcc3 --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/fixtures/source_integrity.json @@ -0,0 +1,16 @@ +{ + "immutable_sha256": { + "lm_eval/__init__.py": "e09b8004f0b93ad0153b348e02b73582f5b9319a481f0efd9fb96b9e7d245a54", + "lm_eval/api/model.py": "4b98863889c17ffa7a7d391e83264fde0aa76f6883ef2e863065728b126508f8", + "lm_eval/api/registry.py": "df76c22a872b5176620b3cd04f8c07f04ba93af66206d62f4670c1f77cf32c45", + "lm_eval/models/__init__.py": "b19f37cb46acb5b512adb0138ca664b309e71e1f17d05011ff426b78bcb29f39", + "lm_eval/models/mistral3.py": "c8bbc5f41ede66b87721f7ef596b92bdc99d805a0aa49e158ed5b038dfbd7564", + "lm_eval/models/utils_hf.py": "72f7f006683841dabf59220be18040d2b83544163721aa61b92e146e7504cc88", + "lm_eval/models/vllm_causallms.py": "885b353d2cce0143b35fbf64650800450415ac9e0edeaed2d48f7e6df9c3f4fc", + "lm_eval/utils.py": "929bbd92726e12ced747267248f56a7112da8b6a65527f21a925534243cc4ba5" + }, + "mutable_min_bytes": { + "lm_eval/models/huggingface.py": 76000, + "lm_eval/models/utils.py": 35000 + } +} diff --git a/tasks/candidate-1702-ml-inference/tests/task_test.sh b/tasks/candidate-1702-ml-inference/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a7b76b6d22e09988a5bcef925542973d315f98ad --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then echo 1 > /logs/verifier/reward.txt; else echo 0 > /logs/verifier/reward.txt; fi +exit "$status" diff --git a/tasks/candidate-1702-ml-inference/tests/test.sh b/tasks/candidate-1702-ml-inference/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1702-ml-inference/tests/test_outputs.py b/tasks/candidate-1702-ml-inference/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..a24c1764f53fec2aa4f917a23cebc49cd77a3dbf --- /dev/null +++ b/tasks/candidate-1702-ml-inference/tests/test_outputs.py @@ -0,0 +1,173 @@ +import json +import hashlib +import subprocess +import sys +import types +from pathlib import Path + +INPUT = Path('/tests/fixtures/inputs.json') +OUTPUT = Path('/app/output.json') +ROOT = Path('/app/vendor/project') +TOKENIZER_INFINITY = 1000000000000000019884624838656 +PROTECTED = Path('/tests/fixtures/source_integrity.json') + + +def install_import_stubs(): + try: + import torch # noqa: F401 + except ModuleNotFoundError: + torch = types.ModuleType('torch') + torch.Tensor = type('Tensor', (), {}) + torch.dtype = type('dtype', (), {}) + torch.nn = types.ModuleType('torch.nn') + torch.nn.functional = types.ModuleType('torch.nn.functional') + sys.modules['torch'] = torch + sys.modules['torch.nn'] = torch.nn + sys.modules['torch.nn.functional'] = torch.nn.functional + + try: + import accelerate # noqa: F401 + except ModuleNotFoundError: + accelerate = types.ModuleType('accelerate') + accelerate.Accelerator = type('Accelerator', (), {}) + accelerate.InitProcessGroupKwargs = type('InitProcessGroupKwargs', (), {}) + accelerate.find_executable_batch_size = lambda function=None, **kwargs: function + accelerate_utils = types.ModuleType('accelerate.utils') + accelerate_utils.get_max_memory = lambda *args, **kwargs: {} + sys.modules['accelerate'] = accelerate + sys.modules['accelerate.utils'] = accelerate_utils + + try: + import huggingface_hub # noqa: F401 + except ModuleNotFoundError: + hub = types.ModuleType('huggingface_hub') + hub.HfApi = type('HfApi', (), {}) + sys.modules['huggingface_hub'] = hub + + try: + import packaging # noqa: F401 + except ModuleNotFoundError: + packaging = types.ModuleType('packaging') + packaging_version = types.ModuleType('packaging.version') + packaging_version.parse = lambda value: value + packaging.version = packaging_version + sys.modules['packaging'] = packaging + sys.modules['packaging.version'] = packaging_version + + try: + import transformers # noqa: F401 + except ModuleNotFoundError: + transformers = types.ModuleType('transformers') + transformers.StoppingCriteria = type('StoppingCriteria', (), {}) + transformers.StoppingCriteriaList = list + transformers.PreTrainedModel = type('PreTrainedModel', (), {}) + transformers.PreTrainedTokenizer = type('PreTrainedTokenizer', (), {}) + transformers.PreTrainedTokenizerFast = type('PreTrainedTokenizerFast', (), {}) + transformers.models = types.ModuleType('transformers.models') + transformers.models.auto = types.ModuleType('transformers.models.auto') + auto_modeling = types.ModuleType('transformers.models.auto.modeling_auto') + auto_modeling.MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = {} + auto_modeling.MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES = {} + transformers.models.auto.modeling_auto = auto_modeling + sys.modules['transformers'] = transformers + sys.modules['transformers.models'] = transformers.models + sys.modules['transformers.models.auto'] = transformers.models.auto + sys.modules['transformers.models.auto.modeling_auto'] = auto_modeling + + +def load_candidate(): + install_import_stubs() + sys.path.insert(0, str(ROOT)) + from lm_eval.models.huggingface import HFLM + from lm_eval.models.utils import resolve_max_length + return HFLM, resolve_max_length + + +class Obj: + def __init__(self, **values): + for key, value in values.items(): + setattr(self, key, Obj(**value) if isinstance(value, dict) else value) + + +class Tok: + def __init__(self, model_max_length): + self.model_max_length = model_max_length + +def run(): + subprocess.run([sys.executable, '/app/tools/run_fixture.py', '/app/inputs.json'], check=True) + return json.loads(OUTPUT.read_text()) + +def expected(case, default=2048): + cfg = case['config'].get('text_config') or case['config'] + for key in ('n_positions', 'max_position_embeddings', 'n_ctx'): + if key in cfg and cfg[key] is not None: + return int(cfg[key]) + tok = case.get('tokenizer_model_max_length') + return int(tok) if tok is not None and tok != TOKENIZER_INFINITY else default + +def test_gate_artifact_schema_and_source_tree(): + data = run() + integrity = json.loads(PROTECTED.read_text()) + assert data['schema_version'] == 'lm-eval-context-repair.v1' + assert OUTPUT.is_file() + assert len(data['results']) == 7 + for relative, digest in integrity['immutable_sha256'].items(): + path = ROOT / relative + assert path.is_file() and not path.is_symlink() + assert hashlib.sha256(path.read_bytes()).hexdigest() == digest + for relative, minimum_size in integrity['mutable_min_bytes'].items(): + path = ROOT / relative + assert path.is_file() and not path.is_symlink() + assert path.stat().st_size >= minimum_size + +def test_core_nested_precedence_independent_recompute(): + data = run(); cases = json.loads(INPUT.read_text())['cases'] + assert [x['id'] for x in data['results']] == [x['id'] for x in cases] + for case, result in zip(cases, data['results']): + assert result['resolved'] == expected(case) + +def test_core_property_matches_shared_resolution(): + data = run() + by_id = {x['id']: x for x in data['results']} + assert all( + item['resolved'] == item['via_property'] + for item in data['results'] + if item['id'] != 'explicit_override' + ) + assert by_id['composite_nested']['resolved'] == 8192 + assert by_id['text_n_positions']['resolved'] == 4096 + assert by_id['text_max_position']['resolved'] == 3072 + assert by_id['text_n_ctx']['via_property'] == 1536 + + +def test_core_production_modules_execute_shared_resolution(): + HFLM, resolve_max_length = load_candidate() + cases = json.loads(INPUT.read_text())['cases'] + for case in cases: + config = Obj(**case['config']) + tokenizer = Tok(case['tokenizer_model_max_length']) + assert resolve_max_length(config, tokenizer, default=2048) == expected(case) + model = object.__new__(HFLM) + model._max_length = case.get('explicit_max_length') + model._tokenizer = tokenizer + model.tokenizer = tokenizer + model._model = types.SimpleNamespace(config=config) + model._DEFAULT_MAX_LENGTH = 2048 + assert model.max_length == ( + case.get('explicit_max_length') or expected(case) + ) + +def test_edge_tokenizer_fallback_and_explicit_override(): + data = run(); by_id = {x['id']: x for x in data['results']} + assert by_id['text_n_ctx']['resolved'] == 1536 + assert by_id['finite_tokenizer']['resolved'] == 768 + assert by_id['infinite_tokenizer']['resolved'] == 2048 + assert by_id['explicit_override']['via_property'] == 1234 + assert by_id['explicit_override']['resolved'] == 8192 + + +def test_core_nested_attribute_precedence_is_not_top_level_fallback(): + data = run(); by_id = {x['id']: x for x in data['results']} + assert by_id['composite_nested']['resolved'] > 2048 + assert by_id['composite_nested']['resolved'] != 1024 + assert by_id['finite_tokenizer']['resolved'] != 2048 diff --git a/tasks/candidate-1736-ml-inference/environment/Dockerfile b/tasks/candidate-1736-ml-inference/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c646f0b8071910c638f57951f27b9a7661665af7 --- /dev/null +++ b/tasks/candidate-1736-ml-inference/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:725b0369357804a893331bb31905dfa7ac973d86c315499b2ff46ea40174c5de diff --git a/tasks/candidate-1736-ml-inference/environment/setup/setup.sh b/tasks/candidate-1736-ml-inference/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1736-ml-inference/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1736-ml-inference/instruction.md b/tasks/candidate-1736-ml-inference/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..70f582765b44daca4ef6f69057d3349e7c6f55e4 --- /dev/null +++ b/tasks/candidate-1736-ml-inference/instruction.md @@ -0,0 +1,17 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair PoissonRegressor mixed Array API handling + +Work in `/app`. The frozen scikit-learn source tree is under `/app/vendor/scikit-learn`. + +A Poisson generalized linear model currently validates targets and sample weights before moving them to the feature matrix's Array API namespace/device. This breaks fitting and scoring when `X` uses one compatible namespace while `y` or `sample_weight` originates in another. The estimator-check registry also still declares the mixed-input behavior unsupported. + +Repair the existing source tree so that: + +1. `sklearn/linear_model/_glm/glm.py` moves both `y` and `sample_weight` to `X`'s discovered namespace/device before dtype-sensitive validation in both `fit` and `score`. +2. Validation, Poisson target-domain checks, weighting semantics, sample order, solver behavior, and prediction mathematics remain unchanged after conversion. Do not replace namespace handling with unconditional NumPy coercion. +3. `sklearn/utils/_test_common/instance_generator.py` enables the mixed-input Array API estimator check for `PoissonRegressor`, while retaining its separate same-namespace limitation. +4. Existing source and test assets remain intact. Do not modify `/app/run_regression.py` or bypass the source methods. +5. Run `python3 /app/run_regression.py`. It must succeed offline and produce `/app/output.json` with `output_schema_version` equal to `tbench.poisson-array-api-report.v1`, successful fit/score mixed-namespace checks, and the updated estimator-check status. diff --git a/tasks/candidate-1736-ml-inference/task.toml b/tasks/candidate-1736-ml-inference/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..536f0ebf72feba6fba521f7a7a386cdad6ac24a8 --- /dev/null +++ b/tasks/candidate-1736-ml-inference/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1736-ml-inference" +description = "MiMo-V2.6-RL terminal task candidate-1736-ml-inference" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1736-ml-inference" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:725b0369357804a893331bb31905dfa7ac973d86c315499b2ff46ea40174c5de" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1736-ml-inference/tests/anti_hack_guard.py b/tasks/candidate-1736-ml-inference/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1736-ml-inference/tests/fixtures/cases.json b/tasks/candidate-1736-ml-inference/tests/fixtures/cases.json new file mode 100644 index 0000000000000000000000000000000000000000..352d266d908a86b9dab2adeea3cb5251d4e47c6e --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/fixtures/cases.json @@ -0,0 +1,4 @@ +{ + "fit": {"X": [0.25, 1.0, 3.5, 9.0, 12.0], "y": [0.0, 1.0, 2.0, 7.0, 11.0], "sample_weight": [1.0, 3.0, 0.25, 2.0, 0.5]}, + "score": {"X": [0.5, 2.0, 6.0, 10.0], "y": [0.0, 1.0, 5.0, 9.0], "sample_weight": [4.0, 1.0, 0.5, 2.0]} +} diff --git a/tasks/candidate-1736-ml-inference/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1736-ml-inference/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..65a306afae635af26dc1ffd7217bfaeed28f0564 --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,28 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "run_regression.py": "0af0f34ee23a9cfe0c5cdbc9867211533aec91566a4e168ec433c62c5932d75c", + "vendor/scikit-learn/COPYING": "50d6a9d340f19ab355609917993114daf5f47e3161067bcf34955bbd05cd9cb0", + "vendor/scikit-learn/sklearn/__init__.py": "647d8c2ce0880c7f642de0e92b6d78ac61545661cbb3235917caf1f69c8a2160", + "vendor/scikit-learn/sklearn/_loss/loss.py": "84cf0eded6e379068bd2034795dcff0c7561aa8b93966910801850811eb98481", + "vendor/scikit-learn/sklearn/linear_model/__init__.py": "0f52c324eb957221f94db06c6a2567f36e0df5ff750a38b7ac1c3ca03b3c372a", + "vendor/scikit-learn/sklearn/linear_model/_glm/__init__.py": "7d4448a22efb5fa3a3d3e31531dc44fbab8efdf84d5fb01baf11255d95081f74", + "vendor/scikit-learn/sklearn/linear_model/_glm/_newton_solver.py": "c208ca34c80764223743b98e12a3600db847b51e7a4cc987961c42c417f52003", + "vendor/scikit-learn/sklearn/linear_model/_glm/glm.py": "572693ef91167b160dc3101733a9f9248e29db58309c80e9c6a0ea27b0433814", + "vendor/scikit-learn/sklearn/linear_model/_glm/tests/__init__.py": "bca9b8c71a8921f2ba4e4e81cbe614d3761c13aa51d57d63b85aceb1a71f6636", + "vendor/scikit-learn/sklearn/linear_model/_glm/tests/test_glm.py": "42891d30080acfd1cff011acba0a2c4c94882d7256d3e3135f27d3b0cc5fc771", + "vendor/scikit-learn/sklearn/linear_model/_glm/tests/test_newton_solver.py": "329cae25c6e347cfb211e485364bfc5ad069ade600ba84710edf790b26de6f48", + "vendor/scikit-learn/sklearn/utils/_array_api.py": "d8747c33b4af4f457671da604e939975c974a8e425133e017920ba182a84d4d9", + "vendor/scikit-learn/sklearn/utils/_test_common/instance_generator.py": "54d3b6a40d4bf97eaaa8e11a681c1c299f831178146e730bb416806f5108951c", + "vendor/scikit-learn/sklearn/utils/validation.py": "2f74707eb561f15a571f57281403a30c628a5cf09787bbe4cafe60b909cfdfd2" + }, + "mutable": [ + "vendor/scikit-learn/sklearn/linear_model/_glm/glm.py", + "vendor/scikit-learn/sklearn/utils/_test_common/instance_generator.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1736-ml-inference/tests/fixtures/protected_hashes.json b/tasks/candidate-1736-ml-inference/tests/fixtures/protected_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..4045e0e27abaff985f952b5c0eca3c2e4fa7c680 --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/fixtures/protected_hashes.json @@ -0,0 +1,8 @@ +{ + "run_regression.py": "0af0f34ee23a9cfe0c5cdbc9867211533aec91566a4e168ec433c62c5932d75c", + "vendor/scikit-learn/sklearn/_loss/loss.py": "84cf0eded6e379068bd2034795dcff0c7561aa8b93966910801850811eb98481", + "vendor/scikit-learn/sklearn/linear_model/_glm/_newton_solver.py": "c208ca34c80764223743b98e12a3600db847b51e7a4cc987961c42c417f52003", + "vendor/scikit-learn/sklearn/linear_model/_glm/tests/test_glm.py": "42891d30080acfd1cff011acba0a2c4c94882d7256d3e3135f27d3b0cc5fc771", + "vendor/scikit-learn/sklearn/utils/_array_api.py": "d8747c33b4af4f457671da604e939975c974a8e425133e017920ba182a84d4d9", + "vendor/scikit-learn/sklearn/utils/validation.py": "2f74707eb561f15a571f57281403a30c628a5cf09787bbe4cafe60b909cfdfd2" +} diff --git a/tasks/candidate-1736-ml-inference/tests/fixtures/trusted_regression.py b/tasks/candidate-1736-ml-inference/tests/fixtures/trusted_regression.py new file mode 100644 index 0000000000000000000000000000000000000000..82a6ec100e3d16a5b7aace0dd103ff38ba6f757b --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/fixtures/trusted_regression.py @@ -0,0 +1,112 @@ +import ast + + +class Namespace: + def __init__(self, name): + self.__name__ = name + self.float64 = "float64" + self.float32 = "float32" + + +class Array: + def __init__(self, values, namespace): + self.values = tuple(values) + self.namespace = namespace + self.dtype = "float64" + self.device = "cpu" + self.shape = (len(self.values),) + + +class ReachedCore(Exception): + pass + + +def method(path, name): + tree = ast.parse(path.read_text()) + cls = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == "_GeneralizedLinearRegressor") + node = next(n for n in cls.body if isinstance(n, ast.FunctionDef) and n.name == name) + node.decorator_list = [] + module = ast.Module(body=[node], type_ignores=[]) + ast.fix_missing_locations(module) + scope = {} + exec(compile(module, str(path), "exec"), scope) + return scope[name] + + +def exercise(path, name, case): + feature = Namespace("feature") + X = Array(case["X"], feature) + X.shape = (len(case["X"]), 1) + y = Array(case["y"], Namespace("target")) + weight = Array(case["sample_weight"], Namespace("weight")) + moves = [] + + def get_namespace_and_device(array): + return array.namespace, True, array.device + + def move_to(*arrays, xp, device): + result = [] + for array in arrays: + if array is None: + result.append(None) + else: + moves.append((array.namespace.__name__, xp.__name__)) + result.append(Array(array.values, xp)) + return result[0] if len(result) == 1 else tuple(result) + + def require(array): + if array.namespace is not feature: + raise RuntimeError("foreign namespace reached validation") + return array + + def validate_data(estimator, X_arg, y_arg, **kwargs): + return X_arg, require(y_arg) + + def check_array(array, **kwargs): + return require(array) + + def check_sample_weight(array, X_arg, **kwargs): + return require(array) + + class Loss: + def in_y_true_range(self, y_arg): + require(y_arg) + raise ReachedCore + + class Estimator: + l1_ratio = 0.0 + solver = "lbfgs" + _base_loss = Loss() + + def _get_loss(self, xp=None, device=None): + raise ReachedCore + + def _linear_predictor(self, X_arg): + return Array([0.0] * len(X_arg.values), feature) + + fn = method(path, name) + fn.__globals__.update( + get_namespace_and_device=get_namespace_and_device, + move_to=move_to, + validate_data=validate_data, + check_array=check_array, + _check_sample_weight=check_sample_weight, + ) + try: + fn(Estimator(), X, y, weight) + except ReachedCore: + return moves + raise AssertionError(f"{name} did not reach numerical core") + + +def poisson_xfails(path): + tree = ast.parse(path.read_text()) + assignment = next( + n for n in ast.walk(tree) + if isinstance(n, ast.Assign) + and any(isinstance(t, ast.Name) and t.id == "PER_ESTIMATOR_XFAIL_CHECKS" for t in n.targets) + ) + for key, value in zip(assignment.value.keys, assignment.value.values): + if isinstance(key, ast.Name) and key.id == "PoissonRegressor": + return {k.value for k in value.keys if isinstance(k, ast.Constant)} + raise AssertionError("PoissonRegressor registry entry missing") diff --git a/tasks/candidate-1736-ml-inference/tests/task_test.sh b/tasks/candidate-1736-ml-inference/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a35fc67e7ca984a465e788e0834ac1800c969dae --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -u +mkdir -p /logs/verifier +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +if python3 -m pytest -p no:cacheprovider --confcutdir=/tests --ctrf /logs/verifier/ctrf.json /tests/test_outputs.py -rA; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +test -s /logs/verifier/ctrf.json diff --git a/tasks/candidate-1736-ml-inference/tests/test.sh b/tasks/candidate-1736-ml-inference/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1736-ml-inference/tests/test_outputs.py b/tasks/candidate-1736-ml-inference/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..26d4a04b9ab6b80f03a8ca4c338452682effd57e --- /dev/null +++ b/tasks/candidate-1736-ml-inference/tests/test_outputs.py @@ -0,0 +1,71 @@ +import hashlib +import importlib.util +import json +import subprocess +from pathlib import Path + +APP = Path("/app") +TESTS = Path("/tests") +GLM = APP / "vendor/scikit-learn/sklearn/linear_model/_glm/glm.py" +REGISTRY = APP / "vendor/scikit-learn/sklearn/utils/_test_common/instance_generator.py" +REPORT = APP / "output.json" + +spec = importlib.util.spec_from_file_location("trusted_regression", TESTS / "fixtures/trusted_regression.py") +trusted = importlib.util.module_from_spec(spec) +spec.loader.exec_module(trusted) + + +def run_workflow(): + completed = subprocess.run( + ["python3", str(APP / "run_regression.py")], + cwd=APP, + text=True, + capture_output=True, + timeout=30, + ) + assert completed.returncode == 0, completed.stdout + completed.stderr + return json.loads(REPORT.read_text()) + + +def test_gate_workspace_and_protected_assets(): + assert GLM.is_file() + assert REGISTRY.is_file() + protected = json.loads((TESTS / "fixtures/protected_hashes.json").read_text()) + assert len(protected) >= 6 + for relative, expected in protected.items(): + path = APP / relative + assert path.is_file(), relative + assert hashlib.sha256(path.read_bytes()).hexdigest() == expected, relative + + +def test_core_fit_moves_target_and_weights_before_validation(): + cases = json.loads((TESTS / "fixtures/cases.json").read_text()) + moves = trusted.exercise(GLM, "fit", cases["fit"]) + assert moves == [("target", "feature"), ("weight", "feature")] + assert len(cases["fit"]["X"]) == len(cases["fit"]["y"]) == len(cases["fit"]["sample_weight"]) + + +def test_core_score_moves_target_and_weights_before_validation(): + cases = json.loads((TESTS / "fixtures/cases.json").read_text()) + moves = trusted.exercise(GLM, "score", cases["score"]) + assert moves == [("target", "feature"), ("weight", "feature")] + assert min(cases["score"]["y"]) >= 0.0 + + +def test_core_estimator_check_integration(): + xfails = trusted.poisson_xfails(REGISTRY) + assert "check_array_api_mixed_inputs" not in xfails + assert "check_array_api_same_namespace" in xfails + assert len(xfails) == 1 + + +def test_edge_report_matches_fresh_execution(): + report = run_workflow() + assert report["output_schema_version"] == "tbench.poisson-array-api-report.v1" + assert report["workflow"] == "poisson_regressor_mixed_array_api" + assert report["summary"]["passed"] is True + assert report["checks"]["fit_mixed_namespace"]["passed"] is True + assert report["checks"]["score_mixed_namespace"]["passed"] is True + assert report["checks"]["mixed_input_check_enabled"] is True + assert report["checks"]["same_namespace_check_deferred"] is True + assert report["summary"]["xfail_checks"] == ["check_array_api_same_namespace"] diff --git a/tasks/candidate-1789-security-appsec/environment/Dockerfile b/tasks/candidate-1789-security-appsec/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4a27eb3f12452900047a989817e3b780de901813 --- /dev/null +++ b/tasks/candidate-1789-security-appsec/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:7859c93e06fb105b5f6237da814dc7386cb49cce4d2e8dd5102109f77f36d957 diff --git a/tasks/candidate-1789-security-appsec/environment/setup/setup.sh b/tasks/candidate-1789-security-appsec/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1789-security-appsec/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1789-security-appsec/instruction.md b/tasks/candidate-1789-security-appsec/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a71924002a059d1c5a832b28ce28b519208104b4 --- /dev/null +++ b/tasks/candidate-1789-security-appsec/instruction.md @@ -0,0 +1,41 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair explicit issue locations in Bandit + +The frozen Bandit tree in `/app/vendor/bandit` has an integration defect in its +file-level Trojan Source check. The plugin finds the correct source line and +column, but the central test runner replaces part of the location metadata with +the synthetic file context used to invoke file-level plugins. + +Repair the existing implementation. You must modify both: + +- `/app/vendor/bandit/bandit/core/tester.py` +- `/app/vendor/bandit/bandit/plugins/trojansource.py` + +Required behavior: + +1. A plugin-provided, non-empty `Issue.linerange` is authoritative and survives + `BanditTester.run_tests` unchanged. +2. An issue that leaves `linerange` empty still receives the existing context + fallback. This must remain generic; do not special-case B613 or filenames. +3. B613 remains a high-severity, medium-confidence finding. For the bundled + UTF-8 example it reports line 4, column 25, and line range `[4]`. +4. The bundled Latin-1 example remains decodable and produces no B613 finding. +5. Preserve the real Bandit package, plugin registration, fixtures, and normal + issue processing. Do not modify tests, suppress findings, or replace the + scanner with a new standalone implementation. + +Use the focused offline workflow: + +```bash +cd /app/vendor/bandit +python3 /app/tools/check_syntax.py +PYTHONPATH=/app/vendor/bandit python3 /app/tools/run_location_regression.py \ + --output /app/repair_report.json +``` + +The final artifact must be `/app/repair_report.json` with schema version +`tbench.bandit_location_report.v1`. The supplied runner writes the required +shape and exits nonzero until all three focused cases pass. diff --git a/tasks/candidate-1789-security-appsec/task.toml b/tasks/candidate-1789-security-appsec/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7225f381e363ee7a2edf91239a858b9ed5238dda --- /dev/null +++ b/tasks/candidate-1789-security-appsec/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1789-security-appsec" +description = "MiMo-V2.6-RL terminal task candidate-1789-security-appsec" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1789-security-appsec" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:7859c93e06fb105b5f6237da814dc7386cb49cce4d2e8dd5102109f77f36d957" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1789-security-appsec/tests/anti_hack_guard.py b/tasks/candidate-1789-security-appsec/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1789-security-appsec/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1789-security-appsec/tests/fixtures/cases.json b/tasks/candidate-1789-security-appsec/tests/fixtures/cases.json new file mode 100644 index 0000000000000000000000000000000000000000..bb4461268a6395ed853e75fcc2e03af126918e9b --- /dev/null +++ b/tasks/candidate-1789-security-appsec/tests/fixtures/cases.json @@ -0,0 +1,18 @@ +{ + "schema_version": "tbench.bandit_private_cases.v1", + "utf8": { + "encoding": "utf-8", + "lines": [ + "safe = true", + "label = 'ordinary'", + "if role != 'none\\u202e\\u2066': pass" + ], + "expected_line": 3, + "expected_column": 17, + "expected_character": "\\u202e" + }, + "fallback": { + "context_line": 37, + "context_range": [37, 38] + } +} diff --git a/tasks/candidate-1789-security-appsec/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1789-security-appsec/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..1051944556a64088f8e28e461d68f36d73ab7d0f --- /dev/null +++ b/tasks/candidate-1789-security-appsec/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,92 @@ +{ + "artifacts": [ + "repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "tools/check_syntax.py": "7fa9c5526d415397c12212ea73886880db812e8e01b9118b98d052d859b188e6", + "tools/run_location_regression.py": "ca4778365b0108387b859d68dadaf7f1c0c3f426c6412c73fbd149bebd3b61f0", + "vendor/bandit/LICENSE": "09e8a9bcec8067104652c168685ab0931e7868f9c8284b66f5ae6edae5f1130b", + "vendor/bandit/bandit/__init__.py": "ca3a2ef11c721e9c7acc78d87016b8fc251f7cd60874444608fc7a3e2ac0a3ef", + "vendor/bandit/bandit/__main__.py": "3ed9ca3c4e64f55efd02b3ec704a3313daeec1420cb87958bf7ca208c279501b", + "vendor/bandit/bandit/blacklists/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/bandit/bandit/blacklists/calls.py": "40254e78109932bc4b328e042d46ee842b76428ad37147bdbf3a850d1d13d665", + "vendor/bandit/bandit/blacklists/imports.py": "de508d0f4d83a0313d1051cf7858447a0ccfdd84d96f8764f5109403ef7a4de9", + "vendor/bandit/bandit/blacklists/utils.py": "3819bc766990b20a79fdd25c9b6f9e022ebdbb9797ba378e60383ace130d7933", + "vendor/bandit/bandit/cli/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/bandit/bandit/cli/baseline.py": "40dee0d068a3b6439a7a09c52878e581d76655dd1fae4b8eedada03b00bcb77b", + "vendor/bandit/bandit/cli/config_generator.py": "1bdc0dd770f4aa59abefaa11ad4ae5777f8846a5f046466b405347df2cfdc0d7", + "vendor/bandit/bandit/cli/main.py": "519ac1c8d66457369d322126acaafc0d7b1f8ee2ef2e80f5855acd9bba7eb8ca", + "vendor/bandit/bandit/core/__init__.py": "370c4dab05265082414309ec386e7c9ef8baa30125762c869a49228346bee27c", + "vendor/bandit/bandit/core/blacklisting.py": "ee4cdba88761a49af9061b858bd4b7ec83e780f457affbe592d5135274aeef26", + "vendor/bandit/bandit/core/config.py": "e950a458ddcf146206f71e0516b36306f8537dfc5167f2849e2a4d9a58336aff", + "vendor/bandit/bandit/core/constants.py": "c9a07692cef678eceb9df37bc4eaf7cc55b1b1cf1e08c9e9a672018fefc99a7d", + "vendor/bandit/bandit/core/context.py": "dcdd0367efcd944c8e5256deed90d4765f07a5be0af6a3a249ca8e4b84f597b5", + "vendor/bandit/bandit/core/docs_utils.py": "8835b0c785d39c8700c9084ba7a0d2c8ff42d4cda99200362ad6faf3a7327ff2", + "vendor/bandit/bandit/core/extension_loader.py": "eb0f2a13ae00f2f614eb03f7af25597e7ed8c72e52169c3fcc49c1e6db567b25", + "vendor/bandit/bandit/core/issue.py": "d2829a8c785f7ad9029be05125a9c655f59e7a90eed89cddb56612a954832beb", + "vendor/bandit/bandit/core/manager.py": "561781823859ec089e3345a78760b667b24bbd7034de4e7cb4eb4b8f81718940", + "vendor/bandit/bandit/core/meta_ast.py": "ac051d2f0b26e1e4cf374a17bf3c8839f557b2e295f7730b309b140bcea14d67", + "vendor/bandit/bandit/core/metrics.py": "c038cf9abba346ccdaa98d332355bbb554d56219c2fa41e8f3009a7f9bd82810", + "vendor/bandit/bandit/core/node_visitor.py": "698bd7153c0d26e16cc273279fc9a1c87af9d19a74900b7ba0b1d0de2340b0ae", + "vendor/bandit/bandit/core/test_properties.py": "fe57ad4e4ef2f52a794b245aab67252de3518ca0969cec6e720946b5430b1394", + "vendor/bandit/bandit/core/test_set.py": "8f0799ede2b520686875a6c5e831cefc384130cac7c45534dd1e7fcf8b12ac97", + "vendor/bandit/bandit/core/tester.py": "c8ccc6c44fe3d57a466026e3823deda8de3df3fba12be0a9fc9d8d1f29d82040", + "vendor/bandit/bandit/core/utils.py": "39717618552eb8ddde759e4998c840f7e25e0f13805241e29215e5808ef7f6c3", + "vendor/bandit/bandit/formatters/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/bandit/bandit/formatters/csv.py": "2224cb9dc571de19e7ec0ee926927963dbf189b8711c8bd99c685ece16182928", + "vendor/bandit/bandit/formatters/custom.py": "db51a0acb89a4ad927a150fd194fac5a4bb89caee1248e0eefea60c8741a71bc", + "vendor/bandit/bandit/formatters/html.py": "54d1e698a02c65657f4be44e7780c45c977f532d62a4ebdb0f9d01ce286e6ca5", + "vendor/bandit/bandit/formatters/json.py": "c8ce446444513dfee3259bb52b8e62f2475090c96cf0d20730623e3e40451c84", + "vendor/bandit/bandit/formatters/sarif.py": "294017268f86b7e98e5fa0a68c5dc543e848828fcf4290a4c0c52b360b40583a", + "vendor/bandit/bandit/formatters/screen.py": "c9670c85642f5fb5a02509a4c8dcc509af81664657db49567e58662f7a9a5324", + "vendor/bandit/bandit/formatters/text.py": "d4d8a8587053d5290a98bd7472c96c5bc493840971af93c6abe5e33fa0e76f4c", + "vendor/bandit/bandit/formatters/utils.py": "31799c5c2d5f05e45b51140aa94b6a84f32d00430ee88ebe308c1c76b23f5050", + "vendor/bandit/bandit/formatters/xml.py": "a5bb1aebab589467f26eaebf37980e85380a9d2427bc916cdfdcfccc50b069ce", + "vendor/bandit/bandit/formatters/yaml.py": "4a2407e643059203c19511d7c535aa3507b846a7d93eef771db14e024b1d9b41", + "vendor/bandit/bandit/plugins/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/bandit/bandit/plugins/app_debug.py": "d19a7e0d388b9eebc5fa39592a10842bef58cd131c51cec94ba9b1595d358457", + "vendor/bandit/bandit/plugins/asserts.py": "88e3f95918dda4573c8fada922443f731f8b6035b5692bfcaa97dd53bf00a175", + "vendor/bandit/bandit/plugins/crypto_request_no_cert_validation.py": "03211280167b26dce279e2539d15eed249277fba20d41e4623eeae03790b6e5b", + "vendor/bandit/bandit/plugins/django_sql_injection.py": "90406328d917a61cc109aed58b2a23227b65d9aed2e6c95db8f549550736048a", + "vendor/bandit/bandit/plugins/django_xss.py": "25062b318ca7424aee01a26b275ba6cc149a70d1fb06a210dcaa61b2f21b71e1", + "vendor/bandit/bandit/plugins/exec.py": "e64a2c4a6808f18d9733867fe61c08abb5914e67697c333913bb97613686c60a", + "vendor/bandit/bandit/plugins/general_bad_file_permissions.py": "f13e7d08ff9a96e06d5e441dcb24099631622ef2b8c95232ddf0d2820c39dc48", + "vendor/bandit/bandit/plugins/general_bind_all_interfaces.py": "327f180647c5e50c21c7541130707ee47367ce14789de3f4948ffa2f242be068", + "vendor/bandit/bandit/plugins/general_hardcoded_password.py": "4bd5c7099544f77f9e3066597b11b7efc0edab8137d97d87c9f60e169c62c8d5", + "vendor/bandit/bandit/plugins/general_hardcoded_tmp.py": "3e0be399b5896f6aca4ad2cf2cc16015ed9194415c144285659c3e44aea5a117", + "vendor/bandit/bandit/plugins/hashlib_insecure_functions.py": "3817e3dc7e6152075ed7c68bbed4725df56ff3181c8efceb72032cb6d7fd4f90", + "vendor/bandit/bandit/plugins/injection_paramiko.py": "6c06ea1fee021d06358214298e5724f8f97c0caab81ba8c9a004026373d2cd8c", + "vendor/bandit/bandit/plugins/injection_shell.py": "ba13206eb243ffc3fda1a34539cd2a22d00277c6ed24094340c21e87d179a7a8", + "vendor/bandit/bandit/plugins/injection_sql.py": "0d5ac613bcf31e62d71fce8c0c02d29dd7d77ea2d58cc72d0d6cc10aaaa51fb4", + "vendor/bandit/bandit/plugins/injection_wildcard.py": "19e1c9721a03c542ee68b782c4cc98b89af15530b5bf1f24e894ac5e6e410c53", + "vendor/bandit/bandit/plugins/insecure_ssl_tls.py": "56b47dab23b263ba35513070f85c34e866c4f3b48ee300ff8f5dbb7ab55f0cb4", + "vendor/bandit/bandit/plugins/jinja2_templates.py": "17f8945a12d145bf0d6fc3c0d793086d56d1db7a3da65a6e0175d9aa07e2d8d3", + "vendor/bandit/bandit/plugins/logging_config_insecure_listen.py": "5330ed2d3888c119eaa4f8cf2196ddb586f7d814f91398768610b6fa6f64c465", + "vendor/bandit/bandit/plugins/mako_templates.py": "5642ff97e522ac36aba39b7f0872640aaef5fcdab1782f875ae3710a811798c4", + "vendor/bandit/bandit/plugins/markupsafe_markup_xss.py": "4131705def7d30adba32d1049a7ead94d772f688d063404c64dbca319ddc0168", + "vendor/bandit/bandit/plugins/pytorch_load.py": "79d18fa40c6f29629de12cf9edf1f828888bdb01716db430f157fe50cc7281e4", + "vendor/bandit/bandit/plugins/request_without_timeout.py": "20969d3c2c1054401767787762c720be00c8cddac7334fe3a3362244ddf49321", + "vendor/bandit/bandit/plugins/snmp_security_check.py": "b537689d174a30ab3946ae28e0e5b39d6e3fae39dad948674ad34b653286e7c2", + "vendor/bandit/bandit/plugins/ssh_no_host_key_verification.py": "d45ab1e64e60b4bbe75a4e06cfb6d05f0ab1e133b12335066bea2e60140636c2", + "vendor/bandit/bandit/plugins/tarfile_unsafe_members.py": "e46266dfd9d080739cb2f0773e9012ea786b35cfad855e4c3380a8173ad17740", + "vendor/bandit/bandit/plugins/trojansource.py": "1b4119b410ac64e019656e1c6eeec581a665a8a723b80b51c51e78e5c0b1dffa", + "vendor/bandit/bandit/plugins/try_except_continue.py": "2be56b412fd89e27c5c33e460b52c05331874db6e1f66f8b1ee0da2708004b9a", + "vendor/bandit/bandit/plugins/try_except_pass.py": "0f03e28b389c7285ad804f3a684994f6668a5b55bc26e271a8e967ba67b59e2b", + "vendor/bandit/bandit/plugins/weak_cryptographic_key.py": "4861f760cdcb881adc9ae3b41a39d0b990959b8d9dd82ebc9757462ad9f035bf", + "vendor/bandit/bandit/plugins/yaml_load.py": "6ce7c264139c49707700020d25bbaf70790779ba3eab2332038d79e4b827c768", + "vendor/bandit/examples/trojansource.py": "1abb885312fe41a3892feae543d41d069cad943905fc35e90e37d81a9a411009", + "vendor/bandit/examples/trojansource_latin1.py": "6e1661b10a02dbc00ed543a4f3768a9ed40264da571c9f481c9041ea060378f8", + "vendor/bandit/requirements.txt": "366a288bfdb81a63160657739eb7d1f4de36fbae02306331256f4f4eeda803b8", + "vendor/bandit/setup.cfg": "df3bc2edb4a49f8e591dc67867cef094cff9b7ad8b30be87c432be9e046a5d2d", + "vendor/bandit/setup.py": "4fa2dcc42d0a42a79fd07b38fa9b9e90700e3661dffa7067e82d283d94019d26", + "vendor/bandit/test-requirements.txt": "e089592d32ea1f9e50e525c4073d61c7fb648762c8fe92541563781a4535ab60", + "vendor/bandit/tests/functional/test_functional.py": "8869e57f343ce5fe5c1bcd4d549c67e801177151645ab07b065f7768b148227f" + }, + "mutable": [ + "vendor/bandit/bandit/core/tester.py", + "vendor/bandit/bandit/plugins/trojansource.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1789-security-appsec/tests/task_test.sh b/tasks/candidate-1789-security-appsec/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8699e3a0ec6eb07be79b9c9587ae99b224b552e --- /dev/null +++ b/tasks/candidate-1789-security-appsec/tests/task_test.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -uo pipefail +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? + +if [ ! -f /logs/verifier/ctrf.json ]; then + echo "missing CTRF output" >&2 + exit 2 +fi + +if [ "$status" -eq 0 ]; then + echo 1 > /logs/verifier/reward.txt +else + echo 0 > /logs/verifier/reward.txt +fi +exit 0 diff --git a/tasks/candidate-1789-security-appsec/tests/test.sh b/tasks/candidate-1789-security-appsec/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1789-security-appsec/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1789-security-appsec/tests/test_outputs.py b/tasks/candidate-1789-security-appsec/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..796f9f4d47fd5a61366e9a9abbde1d309666912c --- /dev/null +++ b/tasks/candidate-1789-security-appsec/tests/test_outputs.py @@ -0,0 +1,167 @@ +import hashlib +import json +import sys +from pathlib import Path + +import pytest + + +APP = Path("/app") +ROOT = APP / "vendor/bandit" +CASES = json.loads((Path("/tests/fixtures/cases.json")).read_text()) +PROTECTED_HASHES = { + "bandit/core/issue.py": "d2829a8c785f7ad9029be05125a9c655f59e7a90eed89cddb56612a954832beb", + "bandit/core/context.py": "dcdd0367efcd944c8e5256deed90d4765f07a5be0af6a3a249ca8e4b84f597b5", + "examples/trojansource.py": "1abb885312fe41a3892feae543d41d069cad943905fc35e90e37d81a9a411009", + "examples/trojansource_latin1.py": "6e1661b10a02dbc00ed543a4f3768a9ed40264da571c9f481c9041ea060378f8", +} + + +@pytest.fixture(scope="session") +def bandit_api(): + sys.path.insert(0, str(ROOT)) + import bandit + from bandit.core.metrics import Metrics + from bandit.core.test_properties import checks + from bandit.core.test_properties import test_id + from bandit.core.tester import BanditTester + from bandit.plugins.trojansource import trojansource + + return bandit, Metrics, checks, test_id, BanditTester, trojansource + + +def run_plugin(api, plugin, filename, context_line=0, context_range=None): + _, Metrics, _, _, BanditTester, _ = api + + class SingleTestSet: + def get_tests(self, checktype): + return [plugin] if checktype == "File" else [] + + path = Path(filename) + metrics = Metrics() + metrics.begin(str(path)) + tester = BanditTester(SingleTestSet(), False, {}, metrics) + tester.run_tests( + { + "filename": str(path), + "file_data": path.read_bytes().splitlines(keepends=True), + "lineno": context_line, + "linerange": context_range or [context_line, context_line + 1], + "col_offset": 0, + "end_col_offset": 0, + }, + "File", + ) + return tester.results + + +def test_gate_workspace_and_protected_assets(): + assert (ROOT / "bandit/core/tester.py").is_file() + assert (ROOT / "bandit/plugins/trojansource.py").is_file() + assert (ROOT / "setup.cfg").is_file() + assert (ROOT / "tests/functional/test_functional.py").is_file() + for relative, expected in PROTECTED_HASHES.items(): + actual = hashlib.sha256((ROOT / relative).read_bytes()).hexdigest() + assert actual == expected, relative + + +def test_gate_source_compiles(): + for relative in ["bandit/core/tester.py", "bandit/plugins/trojansource.py"]: + path = ROOT / relative + compile(path.read_bytes(), str(path), "exec") + + +def test_core_private_utf8_location(tmp_path, bandit_api): + case = CASES["utf8"] + source = "\n".join(case["lines"]).encode(case["encoding"]).decode("unicode_escape") + path = tmp_path / "private_utf8.py" + path.write_text(source + "\n", encoding=case["encoding"]) + results = run_plugin(bandit_api, bandit_api[-1], path, 0, [0, 1]) + assert len(results) == 1 + result = results[0] + assert result.test_id == "B613" + assert result.severity == "HIGH" + assert result.confidence == "MEDIUM" + assert result.lineno == case["expected_line"] + assert result.col_offset == case["expected_column"] + assert result.linerange == [case["expected_line"]] + assert case["expected_character"] in result.text + + +def test_core_generic_fallback_is_preserved(tmp_path, bandit_api): + bandit, _, checks, test_id, _, _ = bandit_api + + @test_id("B998") + @checks("File") + def plugin_without_range(context): + return bandit.Issue( + severity=bandit.LOW, + confidence=bandit.HIGH, + text="private fallback probe", + ) + + path = tmp_path / "ordinary.py" + path.write_text("value = 1\n") + fallback = CASES["fallback"] + results = run_plugin( + bandit_api, + plugin_without_range, + path, + fallback["context_line"], + fallback["context_range"], + ) + assert len(results) == 1 + result = results[0] + assert result.test_id == "B998" + assert result.lineno == fallback["context_line"] + assert result.linerange == fallback["context_range"] + + +def test_core_non_b613_explicit_range_is_preserved(tmp_path, bandit_api): + bandit, _, checks, test_id, _, _ = bandit_api + + @test_id("B997") + @checks("File") + def plugin_with_range(context): + result = bandit.Issue( + severity=bandit.MEDIUM, + confidence=bandit.HIGH, + text="private explicit range probe", + lineno=71, + ) + result.linerange = [71, 72] + return result + + path = tmp_path / "explicit.py" + path.write_text("value = 1\n") + results = run_plugin(bandit_api, plugin_with_range, path, 4, [4, 5]) + assert len(results) == 1 + assert results[0].test_id == "B997" + assert results[0].lineno == 71 + assert results[0].linerange == [71, 72] + + +def test_edge_bundled_encoding_paths(bandit_api): + utf8 = run_plugin(bandit_api, bandit_api[-1], ROOT / "examples/trojansource.py") + latin1 = run_plugin( + bandit_api, bandit_api[-1], ROOT / "examples/trojansource_latin1.py" + ) + assert len(utf8) == 1 + assert utf8[0].lineno == 4 + assert utf8[0].col_offset == 25 + assert utf8[0].linerange == [4] + assert latin1 == [] + + +def test_edge_report_contract(): + report_path = APP / "repair_report.json" + assert report_path.is_file() + report = json.loads(report_path.read_text()) + assert report["schema_version"] == "tbench.bandit_location_report.v1" + assert report["workspace"] == "vendor/bandit" + assert report["summary"] == {"failed": 0, "passed": 3} + by_id = {case["id"]: case for case in report["cases"]} + assert set(by_id) == {"utf8_b613", "latin1_clean", "generic_fallback"} + assert by_id["utf8_b613"]["line_range"] == [4] + assert by_id["latin1_clean"]["finding_count"] == 0 + assert by_id["generic_fallback"]["line_range"] == [11, 12] diff --git a/tasks/candidate-1824-media-design/environment/Dockerfile b/tasks/candidate-1824-media-design/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f5d693936ba83a38eee645778dab8461e49b3415 --- /dev/null +++ b/tasks/candidate-1824-media-design/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:4737707ca641f27b4ec8e30f76f4cdee82ae34e467d67107616af0a4a5575c85 diff --git a/tasks/candidate-1824-media-design/environment/setup/setup.sh b/tasks/candidate-1824-media-design/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1824-media-design/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1824-media-design/instruction.md b/tasks/candidate-1824-media-design/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6558072957e09c5339226e2d38adf042577783e1 --- /dev/null +++ b/tasks/candidate-1824-media-design/instruction.md @@ -0,0 +1,28 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair the offline SVG sanitizer + +You are working in `/app/vendor/project`, a frozen production slice of the SVGO optimizer. The supplied command is the integration entrypoint: + +```sh +node /app/vendor/project/optimize-design.mjs +``` + +It reads `/app/input/design.svg` and must write `/app/output.json`. Repair the existing parser/plugin integration rather than replacing it with a new standalone sanitizer. + +The `removeScripts` plugin must safely sanitize authored SVG design assets while preserving renderable artwork: + +- Remove executable `alsoBad()keep()safe body", + "must_keep": ["keep()", "safe body", "id=\"final-art\""], + "must_remove": ["bad()", "alsoBad()", "onclick=", "onload=", "srcdoc="] + } +} diff --git a/tasks/candidate-1824-media-design/tests/fixtures/source_hashes.json b/tasks/candidate-1824-media-design/tests/fixtures/source_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..d762438b03e6ef212e81280ac2aeb4cf7186f4a6 --- /dev/null +++ b/tasks/candidate-1824-media-design/tests/fixtures/source_hashes.json @@ -0,0 +1,16 @@ +{ + "mutable_base": { + "lib/svgo/tools.js": "637a07ac8f9b45e884bdc521c2a449e0d11c96d22d4a65607a258010295ba6a7", + "plugins/removeScripts.js": "dbe67a9be18029dd6378e544e0cf251d3979fc5b0b998fe8cafa7e4f63ee352c" + }, + "protected": { + "lib/parser.js": "1ec838eba14acef98117db91f677cd09d8bf186d53414f0175d3fcd23e1fb158", + "lib/stringifier.js": "d6a82a49ddb22a9d19e37057395d9734a4006188608d75ec2dc9c8941ca9ff1b", + "lib/svgo.js": "bf6c1bd2a363d160f94307e42dd54d5bb540967db990350e109f14ed50fc6063", + "lib/builtin.js": "7151180ffc49269003d12f7350f4a96fa40d72ea53e9d81df93967e11e487271", + "lib/xast.js": "630cca217fe6b150b2dbef5f1112ffedd3892bff266c24f98cf96d460e046434", + "lib/svgo/plugins.js": "84b636f8b6c4037984c7eb30f8c51992b961f83863e85e27079a086402db5974", + "optimize-design.mjs": "bd716bc1032045464eef75f20613b7a3224b7bc177fb0c09ade328ede62b1d0a", + "package.json": "1ba457c334ffbe254a04fb45d8ce459df3a8982c2202e54147810497afebda83" + } +} diff --git a/tasks/candidate-1824-media-design/tests/task_test.sh b/tasks/candidate-1824-media-design/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..6af15111a7a48c9c2d399e9232b7c48f1e6047b6 --- /dev/null +++ b/tasks/candidate-1824-media-design/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then printf '1\n' > /logs/verifier/reward.txt; else printf '0\n' > /logs/verifier/reward.txt; fi +exit 0 diff --git a/tasks/candidate-1824-media-design/tests/test.sh b/tasks/candidate-1824-media-design/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1824-media-design/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1824-media-design/tests/test_outputs.py b/tasks/candidate-1824-media-design/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..58b98af24fd1092cfd2c3af9194ddd6105955d47 --- /dev/null +++ b/tasks/candidate-1824-media-design/tests/test_outputs.py @@ -0,0 +1,140 @@ +import hashlib +import json +import os +import subprocess +from pathlib import Path + +APP = Path(os.environ.get('TBENCH_APP', '/app')) +PROJECT = APP / 'vendor/project' +OUTPUT = APP / 'output.json' +FIXTURES = Path(os.environ.get('TBENCH_TESTS', '/tests')) / 'fixtures' + + +def load_output(): + data = json.loads(OUTPUT.read_text()) + assert set(data) == {'output_schema_version', 'optimized_svg'} + assert data['output_schema_version'] == 'svgo-design-sanitized.v1' + assert isinstance(data['optimized_svg'], str) + return data['optimized_svg'] + + +def optimize(svg): + program = """ +import fs from 'node:fs'; +import { parseSvg } from './lib/parser.js'; +import { stringifySvg } from './lib/stringifier.js'; +import { invokePlugins } from './lib/svgo/plugins.js'; +import * as removeScripts from './plugins/removeScripts.js'; +const input = fs.readFileSync(0, 'utf8'); +const ast = parseSvg(input); +invokePlugins(ast, {}, [removeScripts], null, {}); +process.stdout.write(stringifySvg(ast, { pretty: false })); +""" + completed = subprocess.run( + ['node', '--input-type=module', '-e', program], + cwd=PROJECT, + input=svg, + text=True, + capture_output=True, + timeout=20, + check=True, + ) + return completed.stdout + + +def private_cases(): + return json.loads((FIXTURES / 'regression_cases.json').read_text()) + + +def test_gate_schema_source_tree_and_integration_entrypoint(): + svg = load_output() + for relative_path in ( + 'lib/svgo/tools.js', + 'plugins/removeScripts.js', + 'lib/parser.js', + 'lib/stringifier.js', + 'lib/svgo.js', + 'lib/builtin.js', + 'lib/xast.js', + 'lib/svgo/plugins.js', + 'package.json', + ): + assert (PROJECT / relative_path).is_file() + assert (PROJECT / 'optimize-design.mjs').is_file() + assert len(svg) > 100 + assert svg == svg.strip() + assert '\n' not in svg + for relative_path in ('lib/svgo/tools.js', 'plugins/removeScripts.js'): + subprocess.run( + ['node', '--check', str(PROJECT / relative_path)], + capture_output=True, + text=True, + timeout=10, + check=True, + ) + + +def test_gate_protected_source_assets_unchanged(): + expected = json.loads((FIXTURES / 'source_hashes.json').read_text()) + for relative_path, digest in expected['protected'].items(): + actual = hashlib.sha256((PROJECT / relative_path).read_bytes()).hexdigest() + assert actual == digest + for relative_path, digest in expected['mutable_base'].items(): + actual = hashlib.sha256((PROJECT / relative_path).read_bytes()).hexdigest() + assert actual != digest + text = (PROJECT / relative_path).read_text() + assert len(text) > 1000 + assert 'export' in text + + +def test_core_namespace_scope_and_control_normalization(): + case = private_cases()['namespace_and_controls'] + output = optimize(case['input']) + for marker in case['must_keep']: + assert marker in output + for marker in case['must_remove']: + assert marker not in output + assert output.count('&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1836-hardware-cad/instruction.md b/tasks/candidate-1836-hardware-cad/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bcc83e38823c4422c1d6225b97192cd9b246dadb --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/instruction.md @@ -0,0 +1,37 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair ACIS copy isolation + +Work in `/app/vendor/ezdxf`, an offline frozen `ezdxf` source tree. A real +3DSOLID drawing is available at +`/app/vendor/ezdxf/examples/acistools/3dsolids.dxf`. + +Repair the existing implementation so that temporary transformations behave +correctly when ACIS BODY-family entities are copied: + +1. Run the existing ACIS transformation test and reproduce the issue with a + non-identity pending `Matrix44`. +2. Make a copied entity preserve the complete pending matrix and own an + independent mutable temporary-transformation helper. Composing a matrix on + the copy must not change the source. +3. Exercise the real pipeline: put a copied 3DSOLID in a named block, create a + translated INSERT, run `ezdxf.bbox.extents()` over the INSERT, and verify + that virtual-copy transforms do not attach to the block definition entity. +4. Save and read the drawing back. Preserve the ACIS payload and named-block + structure. + +Keep the change in the existing source modules and preserve the common +`TemporaryTransformation` abstraction. Do not clear or bypass transformations +inside the bounding-box code, discard an existing matrix, or modify tests to +hide the regression. + +When complete, run the workflow below; it must write the required artifact: + +```sh +PYTHONPATH=/app/vendor/ezdxf/src python3 /app/run_repair.py +``` + +The output must be `/app/output.json` with `output_schema_version` +`cad-copy-isolation.v1`. diff --git a/tasks/candidate-1836-hardware-cad/task.toml b/tasks/candidate-1836-hardware-cad/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..de2bd65bd8018fbea00acd49af4919c4307b0782 --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1836-hardware-cad" +description = "MiMo-V2.6-RL terminal task candidate-1836-hardware-cad" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1836-hardware-cad" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:9d983ebebcedba3546f09fe474b7b2a41b9eb1079eda0bbf0de433010b558a59" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1836-hardware-cad/tests/anti_hack_guard.py b/tasks/candidate-1836-hardware-cad/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1836-hardware-cad/tests/fixtures/3dsolids.dxf b/tasks/candidate-1836-hardware-cad/tests/fixtures/3dsolids.dxf new file mode 100644 index 0000000000000000000000000000000000000000..c8605ca53549e02b2ffbf93cd5f515be42ef8e03 --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/fixtures/3dsolids.dxf @@ -0,0 +1,17912 @@ + 0 +SECTION + 2 +HEADER + 9 +$ACADVER + 1 +AC1024 + 9 +$ACADMAINTVER + 70 + 6 + 9 +$DWGCODEPAGE + 3 +ANSI_1252 + 9 +$LASTSAVEDBY + 1 +mozman + 9 +$INSBASE + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$EXTMIN + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$EXTMAX + 10 +70.0 + 20 +10.0 + 30 +10.0 + 9 +$LIMMIN + 10 +0.0 + 20 +0.0 + 9 +$LIMMAX + 10 +420.0 + 20 +297.0 + 9 +$ORTHOMODE + 70 + 0 + 9 +$REGENMODE + 70 + 1 + 9 +$FILLMODE + 70 + 1 + 9 +$QTEXTMODE + 70 + 0 + 9 +$MIRRTEXT + 70 + 1 + 9 +$LTSCALE + 40 +1.0 + 9 +$ATTMODE + 70 + 1 + 9 +$TEXTSIZE + 40 +2.5 + 9 +$TRACEWID + 40 +1.0 + 9 +$TEXTSTYLE + 7 +Standard + 9 +$CLAYER + 8 +0 + 9 +$CELTYPE + 6 +ByLayer + 9 +$CECOLOR + 62 + 256 + 9 +$CELTSCALE + 40 +1.0 + 9 +$DISPSILH + 70 + 0 + 9 +$DIMSCALE + 40 +1.0 + 9 +$DIMASZ + 40 +2.5 + 9 +$DIMEXO + 40 +0.625 + 9 +$DIMDLI + 40 +3.75 + 9 +$DIMRND + 40 +0.0 + 9 +$DIMDLE + 40 +0.0 + 9 +$DIMEXE + 40 +1.25 + 9 +$DIMTP + 40 +0.0 + 9 +$DIMTM + 40 +0.0 + 9 +$DIMTXT + 40 +2.5 + 9 +$DIMCEN + 40 +2.5 + 9 +$DIMTSZ + 40 +0.0 + 9 +$DIMTOL + 70 + 0 + 9 +$DIMLIM + 70 + 0 + 9 +$DIMTIH + 70 + 0 + 9 +$DIMTOH + 70 + 0 + 9 +$DIMSE1 + 70 + 0 + 9 +$DIMSE2 + 70 + 0 + 9 +$DIMTAD + 70 + 1 + 9 +$DIMZIN + 70 + 8 + 9 +$DIMBLK + 1 + + 9 +$DIMASO + 70 + 1 + 9 +$DIMSHO + 70 + 1 + 9 +$DIMPOST + 1 + + 9 +$DIMAPOST + 1 + + 9 +$DIMALT + 70 + 0 + 9 +$DIMALTD + 70 + 3 + 9 +$DIMALTF + 40 +0.03937007874 + 9 +$DIMLFAC + 40 +1.0 + 9 +$DIMTOFL + 70 + 1 + 9 +$DIMTVP + 40 +0.0 + 9 +$DIMTIX + 70 + 0 + 9 +$DIMSOXD + 70 + 0 + 9 +$DIMSAH + 70 + 0 + 9 +$DIMBLK1 + 1 + + 9 +$DIMBLK2 + 1 + + 9 +$DIMSTYLE + 2 +ISO-25 + 9 +$DIMCLRD + 70 + 0 + 9 +$DIMCLRE + 70 + 0 + 9 +$DIMCLRT + 70 + 0 + 9 +$DIMTFAC + 40 +1.0 + 9 +$DIMGAP + 40 +0.625 + 9 +$DIMJUST + 70 + 0 + 9 +$DIMSD1 + 70 + 0 + 9 +$DIMSD2 + 70 + 0 + 9 +$DIMTOLJ + 70 + 0 + 9 +$DIMTZIN + 70 + 8 + 9 +$DIMALTZ + 70 + 0 + 9 +$DIMALTTZ + 70 + 0 + 9 +$DIMUPT + 70 + 0 + 9 +$DIMDEC + 70 + 2 + 9 +$DIMTDEC + 70 + 2 + 9 +$DIMALTU + 70 + 2 + 9 +$DIMALTTD + 70 + 3 + 9 +$DIMTXSTY + 7 +Standard + 9 +$DIMAUNIT + 70 + 0 + 9 +$DIMADEC + 70 + 0 + 9 +$DIMALTRND + 40 +0.0 + 9 +$DIMAZIN + 70 + 0 + 9 +$DIMDSEP + 70 + 44 + 9 +$DIMATFIT + 70 + 3 + 9 +$DIMFRAC + 70 + 0 + 9 +$DIMLDRBLK + 1 + + 9 +$DIMLUNIT + 70 + 2 + 9 +$DIMLWD + 70 + -2 + 9 +$DIMLWE + 70 + -2 + 9 +$DIMTMOVE + 70 + 0 + 9 +$DIMFXL + 40 +1.0 + 9 +$DIMFXLON + 70 + 0 + 9 +$DIMJOGANG + 40 +0.785398163397 + 9 +$DIMTFILL + 70 + 0 + 9 +$DIMTFILLCLR + 70 + 0 + 9 +$DIMARCSYM + 70 + 0 + 9 +$DIMLTYPE + 6 + + 9 +$DIMLTEX1 + 6 + + 9 +$DIMLTEX2 + 6 + + 9 +$DIMTXTDIRECTION + 70 + 0 + 9 +$LUNITS + 70 + 2 + 9 +$LUPREC + 70 + 2 + 9 +$SKETCHINC + 40 +1.0 + 9 +$FILLETRAD + 40 +10.0 + 9 +$AUNITS + 70 + 0 + 9 +$AUPREC + 70 + 2 + 9 +$MENU + 1 +. + 9 +$ELEVATION + 40 +0.0 + 9 +$PELEVATION + 40 +0.0 + 9 +$THICKNESS + 40 +0.0 + 9 +$LIMCHECK + 70 + 0 + 9 +$CHAMFERA + 40 +0.0 + 9 +$CHAMFERB + 40 +0.0 + 9 +$CHAMFERC + 40 +0.0 + 9 +$CHAMFERD + 40 +0.0 + 9 +$SKPOLY + 70 + 0 + 9 +$TDCREATE + 40 +2459713.400347674 + 9 +$TDUCREATE + 40 +2459713.31701434 + 9 +$TDUPDATE + 40 +2459713.41805412 + 9 +$TDUUPDATE + 40 +2459713.334720787 + 9 +$TDINDWG + 40 +0.0170561111 + 9 +$TDUSRTIMER + 40 +0.0170561111 + 9 +$USRTIMER + 70 + 1 + 9 +$ANGBASE + 50 +0.0 + 9 +$ANGDIR + 70 + 0 + 9 +$PDMODE + 70 + 0 + 9 +$PDSIZE + 40 +0.0 + 9 +$PLINEWID + 40 +0.0 + 9 +$SPLFRAME + 70 + 0 + 9 +$SPLINETYPE + 70 + 6 + 9 +$SPLINESEGS + 70 + 8 + 9 +$HANDSEED + 5 +E6 + 9 +$SURFTAB1 + 70 + 6 + 9 +$SURFTAB2 + 70 + 6 + 9 +$SURFTYPE + 70 + 6 + 9 +$SURFU + 70 + 6 + 9 +$SURFV + 70 + 6 + 9 +$UCSBASE + 2 + + 9 +$UCSNAME + 2 + + 9 +$UCSORG + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSXDIR + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSYDIR + 10 +0.0 + 20 +1.0 + 30 +0.0 + 9 +$UCSORTHOREF + 2 + + 9 +$UCSORTHOVIEW + 70 + 0 + 9 +$UCSORGTOP + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSORGBOTTOM + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSORGLEFT + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSORGRIGHT + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSORGFRONT + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSORGBACK + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSBASE + 2 + + 9 +$PUCSNAME + 2 + + 9 +$PUCSORG + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSXDIR + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSYDIR + 10 +0.0 + 20 +1.0 + 30 +0.0 + 9 +$PUCSORTHOREF + 2 + + 9 +$PUCSORTHOVIEW + 70 + 0 + 9 +$PUCSORGTOP + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSORGBOTTOM + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSORGLEFT + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSORGRIGHT + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSORGFRONT + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSORGBACK + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$USERI1 + 70 + 0 + 9 +$USERI2 + 70 + 0 + 9 +$USERI3 + 70 + 0 + 9 +$USERI4 + 70 + 0 + 9 +$USERI5 + 70 + 0 + 9 +$USERR1 + 40 +0.0 + 9 +$USERR2 + 40 +0.0 + 9 +$USERR3 + 40 +0.0 + 9 +$USERR4 + 40 +0.0 + 9 +$USERR5 + 40 +0.0 + 9 +$WORLDVIEW + 70 + 1 + 9 +$SHADEDGE + 70 + 3 + 9 +$SHADEDIF + 70 + 70 + 9 +$TILEMODE + 70 + 1 + 9 +$MAXACTVP + 70 + 64 + 9 +$PINSBASE + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PLIMCHECK + 70 + 0 + 9 +$PEXTMIN + 10 +1.000000000000E+20 + 20 +1.000000000000E+20 + 30 +1.000000000000E+20 + 9 +$PEXTMAX + 10 +-1.000000000000E+20 + 20 +-1.000000000000E+20 + 30 +-1.000000000000E+20 + 9 +$PLIMMIN + 10 +0.0 + 20 +0.0 + 9 +$PLIMMAX + 10 +420.0 + 20 +297.0 + 9 +$UNITMODE + 70 + 0 + 9 +$VISRETAIN + 70 + 1 + 9 +$PLINEGEN + 70 + 0 + 9 +$PSLTSCALE + 70 + 1 + 9 +$TREEDEPTH + 70 + 3020 + 9 +$CMLSTYLE + 2 +Standard + 9 +$CMLJUST + 70 + 0 + 9 +$CMLSCALE + 40 +20.0 + 9 +$PROXYGRAPHICS + 70 + 1 + 9 +$MEASUREMENT + 70 + 1 + 9 +$CELWEIGHT +370 + -1 + 9 +$ENDCAPS +280 + 0 + 9 +$JOINSTYLE +280 + 0 + 9 +$LWDISPLAY +290 + 0 + 9 +$INSUNITS + 70 + 4 + 9 +$HYPERLINKBASE + 1 + + 9 +$STYLESHEET + 1 + + 9 +$XEDIT +290 + 1 + 9 +$CEPSNTYPE +380 + 0 + 9 +$PSTYLEMODE +290 + 1 + 9 +$FINGERPRINTGUID + 2 +{d4e8483c-cf50-49a4-9ebe-5529758bc487} + 9 +$VERSIONGUID + 2 +{FAEB1C32-E019-11D5-929B-00C0DF256EC4} + 9 +$EXTNAMES +290 + 1 + 9 +$PSVPSCALE + 40 +0.0 + 9 +$OLESTARTUP +290 + 0 + 9 +$SORTENTS +280 + 127 + 9 +$INDEXCTL +280 + 0 + 9 +$HIDETEXT +280 + 1 + 9 +$XCLIPFRAME +280 + 2 + 9 +$HALOGAP +280 + 0 + 9 +$OBSCOLOR + 70 + 257 + 9 +$OBSLTYPE +280 + 0 + 9 +$INTERSECTIONDISPLAY +280 + 0 + 9 +$INTERSECTIONCOLOR + 70 + 257 + 9 +$DIMASSOC +280 + 2 + 9 +$PROJECTNAME + 1 + + 9 +$CAMERADISPLAY +290 + 0 + 9 +$LENSLENGTH + 40 +50.0 + 9 +$CAMERAHEIGHT + 40 +0.0 + 9 +$STEPSPERSEC + 40 +24.0 + 9 +$STEPSIZE + 40 +100.0 + 9 +$3DDWFPREC + 40 +2.0 + 9 +$PSOLWIDTH + 40 +5.0 + 9 +$PSOLHEIGHT + 40 +80.0 + 9 +$LOFTANG1 + 40 +1.570796326795 + 9 +$LOFTANG2 + 40 +1.570796326795 + 9 +$LOFTMAG1 + 40 +0.0 + 9 +$LOFTMAG2 + 40 +0.0 + 9 +$LOFTPARAM + 70 + 7 + 9 +$LOFTNORMALS +280 + 1 + 9 +$LATITUDE + 40 +37.795 + 9 +$LONGITUDE + 40 +-122.394 + 9 +$NORTHDIRECTION + 40 +0.0 + 9 +$TIMEZONE + 70 + -8000 + 9 +$LIGHTGLYPHDISPLAY +280 + 1 + 9 +$TILEMODELIGHTSYNCH +280 + 1 + 9 +$CMATERIAL +347 +45 + 9 +$SOLIDHIST +280 + 0 + 9 +$SHOWHIST +280 + 1 + 9 +$DWFFRAME +280 + 2 + 9 +$DGNFRAME +280 + 2 + 9 +$REALWORLDSCALE +290 + 1 + 9 +$INTERFERECOLOR + 62 + 256 + 9 +$CSHADOW +280 + 0 + 9 +$SHADOWPLANELOCATION + 40 +0.0 + 0 +ENDSEC + 0 +SECTION + 2 +CLASSES + 0 +CLASS + 1 +ACDBDICTIONARYWDFLT + 2 +AcDbDictionaryWithDefault + 3 +ObjectDBX Classes + 90 + 0 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +SUN + 2 +AcDbSun + 3 +SCENEOE + 90 + 1153 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +VISUALSTYLE + 2 +AcDbVisualStyle + 3 +ObjectDBX Classes + 90 + 4095 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +MATERIAL + 2 +AcDbMaterial + 3 +ObjectDBX Classes + 90 + 1153 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +SCALE + 2 +AcDbScale + 3 +ObjectDBX Classes + 90 + 1153 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +TABLESTYLE + 2 +AcDbTableStyle + 3 +ObjectDBX Classes + 90 + 4095 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +MLEADERSTYLE + 2 +AcDbMLeaderStyle + 3 +ACDB_MLEADERSTYLE_CLASS + 90 + 4095 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +DICTIONARYVAR + 2 +AcDbDictionaryVar + 3 +ObjectDBX Classes + 90 + 0 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +CELLSTYLEMAP + 2 +AcDbCellStyleMap + 3 +ObjectDBX Classes + 90 + 1152 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +MENTALRAYRENDERSETTINGS + 2 +AcDbMentalRayRenderSettings + 3 +SCENEOE + 90 + 1024 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +ACDBDETAILVIEWSTYLE + 2 +AcDbDetailViewStyle + 3 +ObjectDBX Classes + 90 + 1025 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +ACDBSECTIONVIEWSTYLE + 2 +AcDbSectionViewStyle + 3 +ObjectDBX Classes + 90 + 1025 + 91 + 3 +280 + 0 +281 + 0 + 0 +CLASS + 1 +SURFACE + 2 +AcDbSurface + 3 +ObjectDBX Classes + 90 + 4095 + 91 + 9 +280 + 0 +281 + 1 + 0 +ENDSEC + 0 +SECTION + 2 +TABLES + 0 +TABLE + 2 +VPORT + 5 +8 +330 +0 +100 +AcDbSymbolTable + 70 + 1 + 0 +VPORT + 5 +22 +330 +8 +100 +AcDbSymbolTableRecord +100 +AcDbViewportTableRecord + 2 +*Active + 70 + 0 + 10 +0.0 + 20 +0.0 + 11 +1.0 + 21 +1.0 + 12 +0.362441616845 + 22 +1.872615020366 + 13 +0.0 + 23 +0.0 + 14 +10.0 + 24 +10.0 + 15 +10.0 + 25 +10.0 + 16 +34.04376373088896 + 26 +83.17631146769885 + 36 +74.19049984982907 + 17 +32.390980252036 + 27 +14.475806288943 + 37 +12.586290439901 + 40 +73.998496772547 + 41 +2.052244897959 + 42 +50.0 + 43 +0.0 + 44 +0.0 + 50 +0.0 + 51 +0.0 + 71 + 0 + 72 + 100 + 73 + 1 + 74 + 3 + 75 + 0 + 76 + 0 + 77 + 0 + 78 + 0 +281 + 6 + 65 + 1 +110 +0.0 +120 +0.0 +130 +0.0 +111 +1.0 +121 +0.0 +131 +0.0 +112 +0.0 +122 +1.0 +132 +0.0 + 79 + 0 +146 +0.0 +348 +6E + 60 + 3 + 61 + 5 +292 + 0 +282 + 1 +141 +0.0 +142 +0.0 + 63 + 250 +361 +23 + 0 +ENDTAB + 0 +TABLE + 2 +LTYPE + 5 +5 +330 +0 +100 +AcDbSymbolTable + 70 + 1 + 0 +LTYPE + 5 +14 +330 +5 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +ByBlock + 70 + 0 + 3 + + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +LTYPE + 5 +15 +330 +5 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +ByLayer + 70 + 0 + 3 + + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +LTYPE + 5 +16 +330 +5 +100 +AcDbSymbolTableRecord +100 +AcDbLinetypeTableRecord + 2 +Continuous + 70 + 0 + 3 +Solid line + 72 + 65 + 73 + 0 + 40 +0.0 + 0 +ENDTAB + 0 +TABLE + 2 +LAYER + 5 +2 +330 +0 +100 +AcDbSymbolTable + 70 + 2 + 0 +LAYER + 5 +10 +330 +2 +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord + 2 +0 + 70 + 0 + 62 + 7 + 6 +Continuous +370 + -3 +390 +F +347 +47 + 0 +LAYER + 5 +98 +330 +2 +100 +AcDbSymbolTableRecord +100 +AcDbLayerTableRecord + 2 +Defpoints + 70 + 0 + 62 + 7 + 6 +Continuous +290 + 0 +370 + -3 +390 +F +347 +47 + 0 +ENDTAB + 0 +TABLE + 2 +STYLE + 5 +3 +330 +0 +100 +AcDbSymbolTable + 70 + 2 + 0 +STYLE + 5 +11 +330 +3 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord + 2 +Standard + 70 + 0 + 40 +0.0 + 41 +1.0 + 50 +0.0 + 71 + 0 + 42 +2.5 + 3 +arial.ttf + 4 + +1001 +ACAD +1000 +Arial +1071 + 0 + 0 +STYLE + 5 +97 +330 +3 +100 +AcDbSymbolTableRecord +100 +AcDbTextStyleTableRecord + 2 +DYN_DIM + 70 + 0 + 40 +0.0 + 41 +1.0 + 50 +0.0 + 71 + 0 + 42 +2.5 + 3 +arial.ttf + 4 + +1001 +ACAD +1000 +Arial +1071 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +VIEW + 5 +6 +330 +0 +100 +AcDbSymbolTable + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +UCS + 5 +7 +330 +0 +100 +AcDbSymbolTable + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +APPID + 5 +9 +330 +0 +100 +AcDbSymbolTable + 70 + 2 + 0 +APPID + 5 +12 +330 +9 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord + 2 +ACAD + 70 + 0 + 0 +APPID + 5 +AE +330 +9 +100 +AcDbSymbolTableRecord +100 +AcDbRegAppTableRecord + 2 +ACAD_OBJECT_CHANGE_GUID + 70 + 0 + 0 +ENDTAB + 0 +TABLE + 2 +DIMSTYLE + 5 +A +330 +0 +100 +AcDbSymbolTable + 70 + 1 +100 +AcDbDimStyleTable + 0 +DIMSTYLE +105 +42 +330 +A +100 +AcDbSymbolTableRecord +100 +AcDbDimStyleTableRecord + 2 +ISO-25 + 70 + 0 + 41 +2.5 + 42 +0.625 + 43 +3.75 + 44 +1.25 + 50 +44.999999999974 + 73 + 0 + 74 + 0 + 77 + 1 + 78 + 8 +140 +2.5 +141 +2.5 +143 +0.03937007874 +147 +0.625 +171 + 3 +172 + 1 +178 + 0 +271 + 2 +272 + 2 +274 + 3 +278 + 44 +283 + 0 +284 + 8 +340 +11 + 0 +ENDTAB + 0 +TABLE + 2 +BLOCK_RECORD + 5 +1 +330 +0 +100 +AcDbSymbolTable + 70 + 2 + 0 +BLOCK_RECORD + 5 +1F +330 +1 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*Model_Space +340 +3D + 70 + 0 +280 + 1 +281 + 0 + 0 +BLOCK_RECORD + 5 +1B +330 +1 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*Paper_Space +340 +1E + 70 + 0 +280 + 1 +281 + 0 + 0 +BLOCK_RECORD + 5 +3E +330 +1 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +*Paper_Space0 +340 +41 + 70 + 0 +280 + 1 +281 + 0 + 0 +BLOCK_RECORD + 5 +9B +330 +1 +100 +AcDbSymbolTableRecord +100 +AcDbBlockTableRecord + 2 +_DYN_DIM_3D +340 +0 + 70 + 0 +280 + 1 +281 + 0 + 0 +ENDTAB + 0 +ENDSEC + 0 +SECTION + 2 +BLOCKS + 0 +BLOCK + 5 +20 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbBlockBegin + 2 +*Model_Space + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +*Model_Space + 1 + + 0 +ENDBLK + 5 +21 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbBlockEnd + 0 +BLOCK + 5 +1C +330 +1B +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbBlockBegin + 2 +*Paper_Space + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +*Paper_Space + 1 + + 0 +ENDBLK + 5 +1D +330 +1B +100 +AcDbEntity + 67 + 1 + 8 +0 +100 +AcDbBlockEnd + 0 +BLOCK + 5 +3F +330 +3E +100 +AcDbEntity + 8 +0 +100 +AcDbBlockBegin + 2 +*Paper_Space0 + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +*Paper_Space0 + 1 + + 0 +ENDBLK + 5 +40 +330 +3E +100 +AcDbEntity + 8 +0 +100 +AcDbBlockEnd + 0 +BLOCK + 5 +9E +330 +9B +100 +AcDbEntity + 8 +0 +100 +AcDbBlockBegin + 2 +_DYN_DIM_3D + 70 + 0 + 10 +0.0 + 20 +0.0 + 30 +0.0 + 3 +_DYN_DIM_3D + 1 + + 0 +3DSOLID + 5 +9D +330 +9B +100 +AcDbEntity + 8 +0 +347 +9C + 62 + 0 +100 +AcDbModelerGeometry + 70 + 1 + 1 +hoo o n o + 1 +_ll P/:1 [:,681 ^ 336>1<: ^ \VL ]*63;:- _nm ^ \VL lmqo QK _mk Y-6 R>& nl noeonejf momm + 1 +n fqfffffffffffffffj:rooh n:rono + 1 +=0;& {n rn {rn {m {rn {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {o {l {rn | + 1 +3*2/ {k rn {rn {rn {j {o | + 1 +:&:@-:961:2:1+ {rn rn _j 8-6; n _l +-6 n _k ,*-9 o _l >;5 o _k 8->; o _f /0,+<7:<4 o _k ,+03 rn _k 1+03 nkqfffhilhmghnhhmk _k ;,63 o _g 93>+1:,, o _h /6'>-:> o _k 72>' o _i 8-6;>- o _j 28-6; jnm _j *8-6; o _j )8-6; o _no :1;@96:3;, | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {m {l {rn | + 1 +,7:33 {i rn {rn {rn {rn {h {rn {m | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {j {l {rn | + 1 +9><: {g rn {rn {f {no {j {rn {nn 90-(>-; ,6183: | + 1 +92:,7r:&:r>++-6= {rn rn {nm {rn {h | + 1 +9><: {nl rn {rn {rn {nk {j {rn {nj 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {ni {nh {h | + 1 +<01:r,*-9><: {rn rn {rn roqj o o n o o o oqnmj o n V V roqmkmjljimjolillmfh oqfhonkmjoonkjllngg oqnmj 90-(>-; V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {g {h {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {ng {rn {f | + 1 +300/ {rn rn {rn {rn {nf {f | + 1 +/3>1:r,*-9><: {rn rn {rn rn o o rn o o o rn o 90-(>-;@) V V V V | + 1 +300/ {rn rn {rn {rn {mo {h | + 1 +<0:;8: {rn rn {rn {nh {nh {nf {mn -:):-,:; {no {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nl {f {l {rn | + 1 +<0:;8: {rn rn {rn {nf {nf {nh {mn 90-(>-; {nk {rn | + 1 +<0:;8: {rn rn {rn {mo {mo {rn {mm -:):-,:; {ni {rn | + 1 +:;8: {ml rn {rn {mk o {mk iqmglngjlohnhfjgim {nf {mj 90-(>-; _h *1410(1 | + 1 +:;8: {rn rn {rn {mi n {mi o {mo {rn 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {mn | + 1 +):-+:' {rn rn {rn {mn {mh | + 1 +:336/,:r<*-): {rn rn {rn rn o o rn o o o oqmj o n V V | + 1 +):-+:' {rn rn {rn {mm {mg | + 1 +/061+ {rn rn {rn rn oqmj o | + 1 +/061+ {rn rn {rn o o o | + 1 +Z1;r09r^ \VLr;>+> +100 +AcDb3dSolid +350 +0 +1001 +ACAD_OBJECT_CHANGE_GUID +1070 + 1 +1071 +-958032392 +1070 + 22462 +1070 + 19867 +1070 + 160 +1070 + 224 +1070 + 196 +1070 + 16 +1070 + 196 +1070 + 43 +1070 + 1 +1070 + 178 + 0 +ENDBLK + 5 +9F +330 +9B +100 +AcDbEntity + 8 +0 +100 +AcDbBlockEnd + 0 +ENDSEC + 0 +SECTION + 2 +ENTITIES + 0 +3DSOLID + 5 +99 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbModelerGeometry + 70 + 1 + 1 +hoo o n o + 1 +_ll P/:1 [:,681 ^ 336>1<: ^ \VL ]*63;:- _nm ^ \VL lmqo QK _mk Y-6 R>& nl noeonejf momm + 1 +n fqfffffffffffffffj:rooh n:rono + 1 +=0;& {n rn {rn {m {rn {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {o {l {rn | + 1 +3*2/ {k rn {rn {rn {j {o | + 1 +:&:@-:961:2:1+ {rn rn _j 8-6; n _l +-6 n _k ,*-9 o _l >;5 o _k 8->; o _f /0,+<7:<4 o _k ,+03 rn _k 1+03 nkqfffhilhmghnhhmk _k ;,63 o _g 93>+1:,, o _h /6'>-:> o _k 72>' o _i 8-6;>- o _j 28-6; jnm _j *8-6; o _j )8-6; o _no :1;@96:3;, | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {m {l {rn | + 1 +,7:33 {i rn {rn {rn {rn {h {rn {m | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {j {l {rn | + 1 +9><: {g rn {rn {f {no {j {rn {nn 90-(>-; ,6183: | + 1 +92:,7r:&:r>++-6= {rn rn {nm {rn {h | + 1 +9><: {nl rn {rn {nk {nj {j {rn {ni 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {rn {nh {h | + 1 +/3>1:r,*-9><: {rn rn {rn no no j o o n n o o 90-(>-;@) V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {ng {g {h {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {nf {rn {f | + 1 +9><: {mo rn {rn {mn {mm {j {rn {ml 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {rn {mk {f | + 1 +/3>1:r,*-9><: {rn rn {rn no j no o n o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {mj {mi {mh {mg -:):-,:; {no {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {mf {nm {h <0/& <*,+02 6810-: <0/& _h =;2@*6; mo | + 1 +-:9@)+r:&:r>++-6= {rn rn {lo {nl {f {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {ln {rn {nk | + 1 +9><: {lm rn {rn {ll {lk {j {rn {lj -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {li {nk | + 1 +/3>1:r,*-9><: {rn rn {rn j no no n o o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {lh {lg {lf {ko -:):-,:; {nj {rn | + 1 +<0:;8: {rn rn {rn {kn {nh {km {kl -:):-,:; {no {rn | + 1 +<0:;8: {rn rn {rn {nh {kn {kk {kj -:):-,:; {no {rn | + 1 +<0:;8: {rn rn {rn {ki {kh {nh {mg 90-(>-; {kg {rn | + 1 +:;8: {kf rn {rn {jo rmqj {jn mqj {mh {jm 90-(>-; _h *1410(1 | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {ng {h if o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {jl {nf {f <0/& <*,+02 6810-: <0/& _h =;2@*6; mn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {jk {mo {nk if o | + 1 +92:,7r:&:r>++-6= {rn rn {jj {rn {mn | + 1 +9><: {ji rn {rn {jh {jg {j {rn {jf 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {rn {kk {mn | + 1 +/3>1:r,*-9><: {rn rn {rn no j j rn o o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {io {km {kh {in -:):-,:; {mm {rn | + 1 +<0:;8: {rn rn {rn {im {mk {kn {il 90-(>-; {nj {rn | + 1 +<0:;8: {rn rn {rn {mk {im {ik {ij -:):-,:; {nj {rn | + 1 +<0:;8: {rn rn {rn {ii {kk {mk {ko 90-(>-; {lk {rn | + 1 +:;8: {ih rn {rn {ig rmqj {if mqj {lf {ho 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {mi {mj {lh {il -:):-,:; {no {rn | + 1 +<0:;8: {rn rn {rn {li {hn {mj {kl 90-(>-; {mm {rn | + 1 +:;8: {hm rn {rn {hl rj {jo o {km {hk 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {lf {hj {mi {kj 90-(>-; {lk {rn | + 1 +:;8: {hi rn {rn {jn rmqj {ig mqj {kk {hh 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {hg {mh {hj {hf 90-(>-; {kg {rn | + 1 +<0:;8: {rn rn {rn {mh {go {li {in 90-(>-; {kg {rn | + 1 +300/ {rn rn {rn {rn {mh {gn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {mg | + 1 +):-+:' {rn rn {rn {mg {gm | + 1 +):-+:' {rn rn {rn {hf {gl | + 1 +,+->687+r<*-): {rn rn {rn hqj no j n o o V V | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {lo {f if o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {gk {ln {nk <0/& <*,+02 6810-: <0/& _h =;2@*6; mm | + 1 +-:9@)+r:&:r>++-6= {rn rn {gj {lm {mn {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {gi {rn {ll | + 1 +9><: {gh rn {rn {gg {gf {j {rn {fo -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {fn {ll | + 1 +/3>1:r,*-9><: {rn rn {rn j j no o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {hn {li {fn {fm -:):-,:; {mm {rn | + 1 +:;8: {fl rn {rn {fk rmqj {jo mqj {kh {fj 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {lg {lh {hn {fi -:):-,:; {nj {rn | + 1 +:;8: {fh rn {rn {ig o {hl j {lh {fg 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {fn {ff {lg {ij 90-(>-; {jg {rn | + 1 +:;8: {noo rn {rn {if rmqj {non mqj {ik {nom 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nol {lf {ff {nok -:):-,:; {lk {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {ko | + 1 +):-+:' {rn rn {rn {kj {noj | + 1 +):-+:' {rn rn {rn {ij {noi | + 1 +,+->687+r<*-): {rn rn {rn no j hqj o o n V V | + 1 +<0:;8: {rn rn {rn {km {io {im {fi 90-(>-; {mm {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {noh {rn {kl | + 1 +):-+:' {rn rn {rn {kl {nog | + 1 +,+->687+r<*-): {rn rn {rn j no j o n o V V | + 1 +<0:;8: {rn rn {rn {kk {nof {ki {hf -:):-,:; {lk {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {kj | + 1 +,+->687+r<*-): {rn rn {rn no hqj j o rn o V V | + 1 +<0:;8: {rn rn {rn {nno {ki {nnn {nnm -:):-,:; {kg {rn | + 1 +:;8: {nnl rn {rn {jn o {nnk j {hj {nnj 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {kh {nno {nni {nnh -:):-,:; {kg {rn | + 1 +9><: {nng rn {rn {rn {kg {j {rn {nnf -:):-,:; ,6183: | + 1 +/061+ {rn rn {rn j no j | + 1 +/061+ {rn rn {rn no no j | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {jk {nk {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nmo {jj {mn <0/& <*,+02 6810-: <0/& _h =;2@*6; mk | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {nmn {ji {ll if o | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {nmm {rn {jh if o | + 1 +9><: {nml rn {rn {nmk {nmj {j {rn {nmi -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {nmh {jh | + 1 +/3>1:r,*-9><: {rn rn {rn j j o o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {nni {ik {io {fm 90-(>-; {jg {rn | + 1 +:;8: {nmg rn {rn {non rmqj {fk mqj {fn {nmf 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {in | + 1 +):-+:' {rn rn {rn {nnh {nlo | + 1 +,+->687+r<*-): {rn rn {rn j no hqj o o rn V V | + 1 +:;8: {nln rn {rn {non o {hl j {hn {nlm 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nll {rn {il | + 1 +,+->687+r<*-): {rn rn {rn no j j rn o o V V | + 1 +<0:;8: {rn rn {rn {ik {nlk {ii {nok 90-(>-; {jg {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {ij | + 1 +):-+:' {rn rn {rn {ij {nlj | + 1 +,+->687+r<*-): {rn rn {rn hqj j no rn o o V V | + 1 +<0:;8: {rn rn {rn {nof {ii {nli {nlh 90-(>-; {lk {rn | + 1 +:;8: {nlg rn {rn {nlf rj {if o {ii {nko 90-(>-; _h *1410(1 | + 1 +/061+ {rn rn {rn no j j | + 1 +/061+ {rn rn {rn no j no | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {hm {kl <0/& <*,+02 6810-: <0/& _h =;2@*6; ln | + 1 +/061+ {rn rn {rn j j j | + 1 +<0:;8: {rn rn {rn {hj {nol {nmh {nkn -:):-,:; {lk {rn | + 1 +<0:;8: {rn rn {rn {go {hg {nkm {nkl -:):-,:; {kg {rn | + 1 +<0:;8: {rn rn {rn {nmh {nkk {hg {nnm 90-(>-; {gf {rn | + 1 +:;8: {nkj rn {rn {nki rj {nnk j {hg {nkh 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nkg {rn {hf | + 1 +):-+:' {rn rn {rn {nkn {nkf | + 1 +,+->687+r<*-): {rn rn {rn no no j o o rn V V | + 1 +<0:;8: {rn rn {rn {njo {fn {go {nnh 90-(>-; {jg {rn | + 1 +:;8: {njn rn {rn {fk o {njm j {go {njl 90-(>-; _h *1410(1 | + 1 +92:,7r:&:r>++-6= {rn rn {njk {rn {gn | + 1 +/3>1:r,*-9><: {rn rn {rn j no j o rn o o o rn 90-(>-;@) V V V V | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {gj {mn if o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {njj {gi {ll <0/& <*,+02 6810-: <0/& _h =;2@*6; nf | + 1 +92:,7r:&:r>++-6= {rn rn {nji {gh {jh | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {njh {rn {gg if o | + 1 +9><: {njg rn {rn {gn {njf {j {rn {nio -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {nin {gg | + 1 +/3>1:r,*-9><: {rn rn {rn j o j o n o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {nim {nnn {nof {nkn 90-(>-; {gf {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {fm | + 1 +,+->687+r<*-): {rn rn {rn j hqj no o n o V V | + 1 +/061+ {rn rn {rn j no no | + 1 +/+36,+r:&:r>++-6= {rn rn {nil {rn {fi | + 1 +,+->687+r<*-): {rn rn {rn j j no o o rn V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {fh {il <0/& <*,+02 6810-: <0/& _h =;2@*6; lo | + 1 +<0:;8: {rn rn {rn {ff {njo {nik {nij 90-(>-; {jg {rn | + 1 +/061+ {rn rn {rn j j no | + 1 +<0:;8: {rn rn {rn {nik {nii {nol {nlh -:):-,:; {nmj {rn | + 1 +:;8: {nih rn {rn {nlf rj {nig j {nol {nif 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nho {rn {nok | + 1 +):-+:' {rn rn {rn {nok {nhn | + 1 +,+->687+r<*-): {rn rn {rn no j no o n o V V | + 1 +:;8: {nhm rn {rn {nnk rj {nig j {nof {nhl 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nhk {nhj {nno {nkl 90-(>-; {njf {rn | + 1 +:;8: {nhi rn {rn {njm rj {nki j {nno {nhh 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nnn {nim {nhk {nhg 90-(>-; {gf {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nhf {rn {nnm | + 1 +):-+:' {rn rn {rn {nnm {ngo | + 1 +,+->687+r<*-): {rn rn {rn j no o n o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nnl {hf <0/& <*,+02 6810-: <0/& _h =;2@*6; li | + 1 +/061+ {rn rn {rn no no o | + 1 +<0:;8: {rn rn {rn {nlk {nni {nhj {ngn 90-(>-; {jg {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {ngm {rn {nnh | + 1 +):-+:' {rn rn {rn {nnh {ngl | + 1 +,+->687+r<*-): {rn rn {rn j no no rn o o V V | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {ngk {nng {gn if o | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nmn {ll {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {ngj {nmm {jh <0/& <*,+02 6810-: <0/& _h =;2@*6; mo | + 1 +92:,7r:&:r>++-6= {rn rn {ngi {nml {gg | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {ngh {rn {nmk if o | + 1 +300/ {rn rn {rn {rn {nkm {nmk | + 1 +/3>1:r,*-9><: {rn rn {rn o j j n o o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {nii {nik {ngg {ngf 90-(>-; {nmj {rn | + 1 +<0:;8: {rn rn {rn {nkk {nmh {nii {nfo 90-(>-; {gf {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nln {fi <0/& <*,+02 6810-: <0/& _h =;2@*6; ll | + 1 +<0:;8: {rn rn {rn {nin {nli {nlk {nij -:):-,:; {nmj {rn | + 1 +:;8: {nfn rn {rn {nfm rj {nlf j {nik {nfl 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nli {nin {nim {nfo -:):-,:; {nmj {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nfk {rn {nlh | + 1 +):-+:' {rn rn {rn {nlh {nfj | + 1 +,+->687+r<*-): {rn rn {rn no o j o o rn V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nlg {nok <0/& <*,+02 6810-: <0/& _h =;2@*6; mj | + 1 +/061+ {rn rn {rn no o no | + 1 +/+36,+r:&:r>++-6= {rn rn {nfi {rn {nkn | + 1 +,+->687+r<*-): {rn rn {rn no j o o rn o V V | + 1 +<0:;8: {rn rn {rn {ngg {nkm {nkk {nhg -:):-,:; {njf {rn | + 1 +<0:;8: {rn rn {rn {nkm {ngg {njo {ngn -:):-,:; {njf {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nfh {rn {nkl | + 1 +,+->687+r<*-): {rn rn {rn o no j o o rn V V | + 1 +:;8: {nfg rn {rn {nff rj {nki j {nhk {moo 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nkj {nnm <0/& <*,+02 6810-: <0/& _h =;2@*6; lm | + 1 +/061+ {rn rn {rn o no o | + 1 +:;8: {mon rn {rn {njm rj {nfm j {nhj {mom 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {njn {nnh <0/& <*,+02 6810-: <0/& _h =;2@*6; mi | + 1 +/061+ {rn rn {rn o no no | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {mol {njk {gn <0/& <*,+02 6810-: <0/& _h =;2@*6; ml | + 1 +92:,7r:&:r>++-6= {rn rn {mok {nji {jh | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {moj {njh {gg <0/& <*,+02 6810-: <0/& _h =;2@*6; mn | + 1 +92:,7r:&:r>++-6= {rn rn {moi {njg {nmk | + 1 +<0:;8: {rn rn {rn {nhj {nhk {nin {ngf -:):-,:; {njf {rn | + 1 +:;8: {moh rn {rn {nfm rj {nff j {ngg {mog 90-(>-; _h *1410(1 | + 1 +:;8: {mof rn {rn {nig rj {nff j {nii {mno 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {mnn {rn {nij | + 1 +):-+:' {rn rn {rn {ngn {mnm | + 1 +,+->687+r<*-): {rn rn {rn j o no n o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nih {nlh <0/& <*,+02 6810-: <0/& _h =;2@*6; lk | + 1 +/061+ {rn rn {rn no o o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nhm {nkn <0/& <*,+02 6810-: <0/& _h =;2@*6; mf | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nhi {nkl <0/& <*,+02 6810-: <0/& _h =;2@*6; lj | + 1 +/+36,+r:&:r>++-6= {rn rn {mnl {rn {nhg | + 1 +):-+:' {rn rn {rn {nhg {mnk | + 1 +,+->687+r<*-): {rn rn {rn o j o o n o V V | + 1 +/+36,+r:&:r>++-6= {rn rn {mnj {rn {ngn | + 1 +,+->687+r<*-): {rn rn {rn o j no o rn o V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {ngk {gn {l {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {ngj {jh {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {mni {ngi {gg | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {mnh {ngh {nmk <0/& <*,+02 6810-: <0/& _h =;2@*6; mm | + 1 +/+36,+r:&:r>++-6= {rn rn {mng {rn {ngf | + 1 +,+->687+r<*-): {rn rn {rn o o j o o rn V V | + 1 +/+36,+r:&:r>++-6= {rn rn {mnf {rn {nfo | + 1 +,+->687+r<*-): {rn rn {rn j o o rn o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nfn {nij <0/& <*,+02 6810-: <0/& _h =;2@*6; mg | + 1 +/061+ {rn rn {rn o o no | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nfg {nhg <0/& <*,+02 6810-: <0/& _h =;2@*6; ln | + 1 +/061+ {rn rn {rn o o o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {mon {ngn <0/& <*,+02 6810-: <0/& _h =;2@*6; mh | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {moj {gg {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {mmo {moi {nmk | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {moh {ngf <0/& <*,+02 6810-: <0/& _h =;2@*6; ll | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {mof {nfo <0/& <*,+02 6810-: <0/& _h =;2@*6; lo | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {mnh {nmk {l {rn | + 1 +Z1;r09r^ \VLr;>+> +100 +AcDb3dSolid +350 +0 +1001 +ACAD_OBJECT_CHANGE_GUID +1070 + 1 +1071 +-1609846639 +1070 + -2714 +1070 + 17880 +1070 + 135 +1070 + 199 +1070 + 235 +1070 + 191 +1070 + 74 +1070 + 93 +1070 + 181 +1070 + 224 + 0 +3DSOLID + 5 +A2 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbModelerGeometry + 70 + 1 + 1 +hoo o n o + 1 +_ll P/:1 [:,681 ^ 336>1<: ^ \VL ]*63;:- _nm ^ \VL lmqo QK _mk Y-6 R>& nl noeonejf momm + 1 +n fqfffffffffffffffj:rooh n:rono + 1 +=0;& {n rn {rn {m {rn {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {o {l {rn | + 1 +3*2/ {k rn {rn {rn {j {o | + 1 +:&:@-:961:2:1+ {rn rn _j 8-6; n _l +-6 n _k ,*-9 o _l >;5 o _k 8->; o _f /0,+<7:<4 o _k ,+03 rn _k 1+03 nkqfffhilhmghnhhmk _k ;,63 o _g 93>+1:,, o _h /6'>-:> o _k 72>' o _i 8-6;>- o _j 28-6; jnm _j *8-6; o _j )8-6; o _no :1;@96:3;, | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {m {l {rn | + 1 +,7:33 {i rn {rn {rn {rn {h {rn {m | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {j {l {rn | + 1 +9><: {g rn {rn {f {no {j {rn {nn 90-(>-; ,6183: | + 1 +92:,7r:&:r>++-6= {rn rn {nm {rn {h | + 1 +9><: {nl rn {rn {nk {nj {j {rn {ni 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {rn {nh {h | + 1 +/3>1:r,*-9><: {rn rn {rn lmqj hqj hqklllllllllllllli o oqgnlhllkhnmoihlj oqjgnmlgnflhnfofiki rn o o -:):-,:@) V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {ng {g {h {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {nf {rn {f | + 1 +9><: {mo rn {rn {mn {mm {j {rn {ml -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {mk {f | + 1 +/3>1:r,*-9><: {rn rn {rn mhqj hqj hqklllllllllllllli oqgnlhllkhnmoihlj rhqmmhkojogjnlkfjlj:ronh oqjgnmlgnflhnfofiki roqjgnmlgnflhnfofiki o oqgnlhllkhnmoihlj -:):-,:@) V V V V | + 1 +<0:;8: {rn rn {rn {mj {mi {mh {mg -:):-,:; {no {rn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {nm {h if o | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {mf {nl {f if o | + 1 +92:,7r:&:r>++-6= {rn rn {lo {rn {nk | + 1 +9><: {ln rn {rn {lm {ll {j {rn {lk -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {lj {nk | + 1 +/3>1:r,*-9><: {rn rn {rn mj no j o rn o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {li {lh {lj {lg -:):-,:; {nj {rn | + 1 +<0:;8: {rn rn {rn {mi {nh {lh {lf 90-(>-; {no {rn | + 1 +<0:;8: {rn rn {rn {nh {mj {ko {kn -:):-,:; {no {rn | + 1 +<0:;8: {rn rn {rn {km {kl {nh {mg 90-(>-; {ll {rn | + 1 +:;8: {kk rn {rn {kj rkqolhiihfgjhonffon {ki lqknhigojhfoigmghk {mh {kh 90-(>-; _h *1410(1 | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nf {f {l {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {kg {mo {nk {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {kf {rn {mn | + 1 +9><: {jo rn {rn {jn {jm {j {rn {jl 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {rn {mh {mn | + 1 +/3>1:r,*-9><: {rn rn {rn lo j j rn o o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {jk {jj {mk {lg 90-(>-; {mm {rn | + 1 +<0:;8: {rn rn {rn {lh {mk {ji {jh -:):-,:; {nj {rn | + 1 +<0:;8: {rn rn {rn {mk {li {mj {lf -:):-,:; {nj {rn | + 1 +:;8: {jg rn {rn {jf rlqknhigojhfoigmgji {kj kqolhiihfgjhonffn {lj {io 90-(>-; _h *1410(1 | + 1 +:;8: {in rn {rn {kj rkqfhkflhngjjllnooi {im lqikgmghmiflfoflfm {lh {il 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {ji {ik {mi {kn 90-(>-; {jm {rn | + 1 +:;8: {ij rn {rn {ki rnqmj {im lqogllllllllllllmn {ko {ii 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {ih {mh {ik {ig -:):-,:; {ll {rn | + 1 +<0:;8: {rn rn {rn {mh {if {jk {ho -:):-,:; {ll {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {mg | + 1 +):-+:' {rn rn {rn {ho {hn | + 1 +):-+:' {rn rn {rn {kn {hm | + 1 +,+->687+r<*-): {rn rn {rn lo hqijlnjlnjlnjlnjlg hqmngfngfngfngfnfn o roqjgnmlgnflhnfofiki oqgnlhllkhnmoihlj V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {hl {lo {nk <0/& <*,+02 6810-: <0/& _h =;2@*6; ml | + 1 +-:9@)+r:&:r>++-6= {rn rn {hk {ln {mn {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {hj {rn {lm | + 1 +9><: {hi rn {rn {hh {hg {j {rn {hf -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {ji {lm | + 1 +/3>1:r,*-9><: {rn rn {rn mj j no o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {go {lj {kl {ho 90-(>-; {mm {rn | + 1 +<0:;8: {rn rn {rn {lj {gn {gm {gl -:):-,:; {mm {rn | + 1 +<0:;8: {rn rn {rn {gm {ko {li {jh 90-(>-; {jm {rn | + 1 +:;8: {gk rn {rn {im roqjglllllllllllllok {jf lqhj {ji {gj 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {lg | + 1 +):-+:' {rn rn {rn {gl {gi | + 1 +,+->687+r<*-): {rn rn {rn mhqijlnjlnjlnjlnjm no hqmngfngfngfngfnfn oqjgnmlgnflhnfofiki o roqgnlhllkhnmoihlj V V | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {lf | + 1 +):-+:' {rn rn {rn {kn {gh | + 1 +,+->687+r<*-): {rn rn {rn mhqj hqj hqklllllllllllllli roqjomjngfohimfioini roqjomjngfohimfioioj oqholjmikhoignkkgkh V V | + 1 +<0:;8: {rn rn {rn {ko {gg {km {ig 90-(>-; {jm {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {kn | + 1 +,+->687+r<*-): {rn rn {rn mgqhj jqiiiiiiiiiiiiiih no rn o o V V | + 1 +<0:;8: {rn rn {rn {if {km {gf {fo 90-(>-; {ll {rn | + 1 +:;8: {fn rn {rn {fm rj {ki oqiiiiiiiiiiiiiiifi {km {fl 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {kl {ih {fk {fj -:):-,:; {ll {rn | + 1 +:;8: {fi rn {rn {kj nqoiiiiiiiiiiiiii {fh j {kl {fg 90-(>-; _h *1410(1 | + 1 +/061+ {rn rn {rn lo no lqflllllllllllllli | + 1 +/061+ {rn rn {rn lo jqiiiiiiiiiiiiiih no | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {kg {nk if o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {ff {kf {mn <0/& <*,+02 6810-: <0/& _h =;2@*6; mk | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {noo {jo {lm if o | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {non {rn {jn if o | + 1 +9><: {nom rn {rn {nol {nok {j {rn {noj -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {fk {jn | + 1 +/3>1:r,*-9><: {rn rn {rn mj j o o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {gn {jk {noi {noh -:):-,:; {mm {rn | + 1 +<0:;8: {rn rn {rn {jj {go {nog {nof -:):-,:; {mm {rn | + 1 +<0:;8: {rn rn {rn {nno {ji {jj {gl 90-(>-; {jm {rn | + 1 +:;8: {nnn rn {rn {jf roqiiiiiiiiiiiiiihgj {nnm j {jj {nnl 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {jh | + 1 +,+->687+r<*-): {rn rn {rn mjqiiiiiiiiiiiiiig iqmj no gqggnhgknfhoonmjk:ronh n o V V | + 1 +/061+ {rn rn {rn mjqiiiiiiiiiiiiiig no no | + 1 +/061+ {rn rn {rn mjqiiiiiiiiiiiiiig jqiiiiiiiiiiiiiih no | + 1 +<0:;8: {rn rn {rn {ik {nno {nnk {nnj 90-(>-; {jm {rn | + 1 +<0:;8: {rn rn {rn {nnk {nni {ih {fo -:):-,:; {nok {rn | + 1 +:;8: {nnh rn {rn {fm rj {nng j {ih {nnf 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nmo {rn {ig | + 1 +):-+:' {rn rn {rn {ig {nmn | + 1 +,+->687+r<*-): {rn rn {rn lo j no o n o V V | + 1 +<0:;8: {rn rn {rn {nmm {noi {if {fj 90-(>-; {hg {rn | + 1 +:;8: {nml rn {rn {fh rj {nng j {if {nmk 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nmj {rn {ho | + 1 +):-+:' {rn rn {rn {fj {nmi | + 1 +,+->687+r<*-): {rn rn {rn lo no j o o rn V V | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {hk {mn if o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nmh {hj {lm <0/& <*,+02 6810-: <0/& _h =;2@*6; nf | + 1 +92:,7r:&:r>++-6= {rn rn {nmg {hi {jn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {nmf {rn {hh if o | + 1 +9><: {nlo rn {rn {rn {nln {j {rn {nlm -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {nll {hh | + 1 +/3>1:r,*-9><: {rn rn {rn mj o j o n o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {fk {nlk {go {noh 90-(>-; {hg {rn | + 1 +:;8: {nlj rn {rn {nli rj {fh j {go {nlh 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nlg {nlf {gn {nof 90-(>-; {nln {rn | + 1 +:;8: {nko rn {rn {nnm rj {nli j {gn {nkn 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {gg {gm {nlf {nkm 90-(>-; {jm {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nkl {rn {gl | + 1 +):-+:' {rn rn {rn {gl {nkk | + 1 +,+->687+r<*-): {rn rn {rn mj no no rn o o V V | + 1 +<0:;8: {rn rn {rn {nll {gf {gg {nnj -:):-,:; {nok {rn | + 1 +:;8: {nkj rn {rn {nki rj {fm j {nnk {nkh 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {gf {nll {nmm {nkg -:):-,:; {nok {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nkf {rn {fo | + 1 +):-+:' {rn rn {rn {fo {njo | + 1 +,+->687+r<*-): {rn rn {rn lo o j o o rn V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {fn {ig <0/& <*,+02 6810-: <0/& _h =;2@*6; mj | + 1 +/061+ {rn rn {rn lo o no | + 1 +<0:;8: {rn rn {rn {nlk {fk {nni {nkg 90-(>-; {hg {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {njn {rn {fj | + 1 +,+->687+r<*-): {rn rn {rn lo j o o rn o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {fi {ho <0/& <*,+02 6810-: <0/& _h =;2@*6; li | + 1 +/061+ {rn rn {rn lo no o | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {noo {lm {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {njm {non {jn <0/& <*,+02 6810-: <0/& _h =;2@*6; mo | + 1 +92:,7r:&:r>++-6= {rn rn {njl {nom {hh | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {njk {rn {nol if o | + 1 +300/ {rn rn {rn {rn {nog {nol | + 1 +/3>1:r,*-9><: {rn rn {rn mo j j n o o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {nni {nnk {njj {nji 90-(>-; {nok {rn | + 1 +<0:;8: {rn rn {rn {noi {nmm {nlg {njh 90-(>-; {hg {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {njg {rn {noh | + 1 +):-+:' {rn rn {rn {noh {njf | + 1 +,+->687+r<*-): {rn rn {rn mj no o n o o V V | + 1 +<0:;8: {rn rn {rn {njj {nog {nlk {njh -:):-,:; {nln {rn | + 1 +<0:;8: {rn rn {rn {nog {njj {nno {nkm -:):-,:; {nln {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nio {rn {nof | + 1 +,+->687+r<*-): {rn rn {rn mo no j o o rn V V | + 1 +:;8: {nin rn {rn {nnm rj {nki j {nlf {nim 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nnn {gl <0/& <*,+02 6810-: <0/& _h =;2@*6; mi | + 1 +/061+ {rn rn {rn mo no no | + 1 +/+36,+r:&:r>++-6= {rn rn {nil {rn {nnj | + 1 +):-+:' {rn rn {rn {nkm {nik | + 1 +,+->687+r<*-): {rn rn {rn mj o no n o o V V | + 1 +:;8: {nij rn {rn {nng rj {nii j {nni {nih 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nnh {fo <0/& <*,+02 6810-: <0/& _h =;2@*6; lk | + 1 +/061+ {rn rn {rn lo o o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nml {fj <0/& <*,+02 6810-: <0/& _h =;2@*6; mf | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nmg {jn {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nig {nmf {hh <0/& <*,+02 6810-: <0/& _h =;2@*6; mn | + 1 +92:,7r:&:r>++-6= {rn rn {nif {nlo {nol | + 1 +<0:;8: {rn rn {rn {nlf {nlg {nll {nji -:):-,:; {nln {rn | + 1 +:;8: {nho rn {rn {nki rj {nii j {njj {nhn 90-(>-; _h *1410(1 | + 1 +:;8: {nhm rn {rn {nii rj {nli j {nlg {nhl 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nlj {noh <0/& <*,+02 6810-: <0/& _h =;2@*6; lm | + 1 +/061+ {rn rn {rn mo no o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nko {nof <0/& <*,+02 6810-: <0/& _h =;2@*6; lj | + 1 +/+36,+r:&:r>++-6= {rn rn {nhk {rn {nkm | + 1 +,+->687+r<*-): {rn rn {rn mo j no o rn o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nkj {nnj <0/& <*,+02 6810-: <0/& _h =;2@*6; mg | + 1 +/061+ {rn rn {rn mo o no | + 1 +/+36,+r:&:r>++-6= {rn rn {nhj {rn {nkg | + 1 +):-+:' {rn rn {rn {njh {nhi | + 1 +,+->687+r<*-): {rn rn {rn mj o o rn o o V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {njl {hh {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nhh {njk {nol <0/& <*,+02 6810-: <0/& _h =;2@*6; mm | + 1 +/+36,+r:&:r>++-6= {rn rn {nhg {rn {nji | + 1 +,+->687+r<*-): {rn rn {rn mo o j o o rn V V | + 1 +/+36,+r:&:r>++-6= {rn rn {nhf {rn {njh | + 1 +,+->687+r<*-): {rn rn {rn mo j o o n o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nin {nkm <0/& <*,+02 6810-: <0/& _h =;2@*6; mh | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nij {nkg <0/& <*,+02 6810-: <0/& _h =;2@*6; lo | + 1 +/061+ {rn rn {rn mo o o | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nif {nol {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nho {nji <0/& <*,+02 6810-: <0/& _h =;2@*6; ll | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nhm {njh <0/& <*,+02 6810-: <0/& _h =;2@*6; ln | + 1 +Z1;r09r^ \VLr;>+> +100 +AcDb3dSolid +350 +0 +1001 +ACAD_OBJECT_CHANGE_GUID +1070 + 1 +1071 +-1553624039 +1070 +-23499 +1070 + 17111 +1070 + 189 +1070 + 132 +1070 + 156 +1070 + 233 +1070 + 91 +1070 + 72 +1070 + 81 +1070 + 110 + 0 +3DSOLID + 5 +A5 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbModelerGeometry + 70 + 1 + 1 +hoo o n o + 1 +_ll P/:1 [:,681 ^ 336>1<: ^ \VL ]*63;:- _nm ^ \VL lmqo QK _mk Y-6 R>& nl noeonejf momm + 1 +n fqfffffffffffffffj:rooh n:rono + 1 +=0;& {n rn {rn {m {rn {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {o {l {rn | + 1 +3*2/ {k rn {rn {rn {j {o | + 1 +:&:@-:961:2:1+ {rn rn _j 8-6; n _l +-6 n _k ,*-9 o _l >;5 o _k 8->; o _f /0,+<7:<4 o _k ,+03 rn _k 1+03 nkqfffhilhmghnhhmk _k ;,63 o _g 93>+1:,, o _h /6'>-:> o _k 72>' o _i 8-6;>- o _j 28-6; jnm _j *8-6; o _j )8-6; o _no :1;@96:3;, | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {m {l {rn | + 1 +,7:33 {i rn {rn {rn {rn {h {rn {m | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {j {l {rn | + 1 +9><: {g rn {rn {f {no {j {rn {nn -:):-,:; ,6183: | + 1 +92:,7r:&:r>++-6= {rn rn {nm {rn {h | + 1 +9><: {nl rn {rn {nk {nj {j {rn {ni -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {nh {h | + 1 +/3>1:r,*-9><: {rn rn {rn jo no kqfffffffffffffffn o o rn rn o o 90-(>-;@) V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {ng {g {h {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {nf {rn {f | + 1 +9><: {mo rn {rn {mn {mm {j {rn {ml -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {mk {f | + 1 +<01:r,*-9><: {rn rn {rn jo no no o o n j o o n V V o n j 90-(>-; V V V V | + 1 +<0:;8: {rn rn {rn {mj {mi {mh {mg -:):-,:; {no {rn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {nm {h if o | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {mf {nl {f if o | + 1 +92:,7r:&:r>++-6= {rn rn {lo {rn {nk | + 1 +9><: {ln rn {rn {lm {ll {j {rn {lk 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {rn {lj {nk | + 1 +/3>1:r,*-9><: {rn rn {rn jo j j rn o o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {li {lh {lg {lf -:):-,:; {nj {rn | + 1 +<0:;8: {rn rn {rn {mi {nh {lh {ko -:):-,:; {no {rn | + 1 +<0:;8: {rn rn {rn {nh {mj {lj {kn -:):-,:; {no {rn | + 1 +<0:;8: {rn rn {rn {km {lg {nh {mg 90-(>-; {kl {rn | + 1 +:;8: {kk rn {rn {kj rmqj {ki mqj {mh {kh 90-(>-; _h *1410(1 | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nf {f {l {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {kg {mo {nk {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {kf {rn {mn | + 1 +9><: {jo rn {rn {jn {jm {j {rn {jl -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {jk {mn | + 1 +/3>1:r,*-9><: {rn rn {rn kj j no o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {jj {ji {mi {kn 90-(>-; {mm {rn | + 1 +<0:;8: {rn rn {rn {jh {mk {jk {jg -:):-,:; {nj {rn | + 1 +<0:;8: {rn rn {rn {mk {jh {mj {ko 90-(>-; {nj {rn | + 1 +<0:;8: {rn rn {rn {mh {jf {mk {lf 90-(>-; {kl {rn | + 1 +:;8: {io rn {rn {in o {kj j {lg {im 90-(>-; _h *1410(1 | + 1 +:;8: {il rn {rn {ik nqjhohfilmihfkgfii {kj lqnknjfmijljgfhfln {mj {ij 90-(>-; _h *1410(1 | + 1 +:;8: {ii rn {rn {ki rmqj {ik mqj {lj {ih 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {ig {mh {ji {if 90-(>-; {kl {rn | + 1 +300/ {rn rn {rn {rn {mh {ho | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {mg | + 1 +):-+:' {rn rn {rn {lf {hn | + 1 +):-+:' {rn rn {rn {if {hm | + 1 +,+->687+r<*-): {rn rn {rn khqj no j n o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {hl {lo {nk <0/& <*,+02 6810-: <0/& _h =;2@*6; mk | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {hk {ln {mn if o | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {hj {rn {lm if o | + 1 +9><: {hi rn {rn {hh {hg {j {rn {hf -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {go {lm | + 1 +/3>1:r,*-9><: {rn rn {rn kj j o o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {gn {gm {li {jg 90-(>-; {ll {rn | + 1 +<0:;8: {rn rn {rn {gl {lj {jh {gk 90-(>-; {mm {rn | + 1 +<0:;8: {rn rn {rn {lj {gj {km {if -:):-,:; {mm {rn | + 1 +<0:;8: {rn rn {rn {lh {li {jj {gk -:):-,:; {nj {rn | + 1 +:;8: {gi rn {rn {gh nqjhohfilmihfkgfii {in lqnknjfmijljgfhfln {jk {gg 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {lg {gf {gn {fo -:):-,:; {kl {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {lf | + 1 +):-+:' {rn rn {rn {fo {fn | + 1 +,+->687+r<*-): {rn rn {rn kj no no o o rn V V | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {ko | + 1 +):-+:' {rn rn {rn {gk {fm | + 1 +:336/,:r<*-): {rn rn {rn jo no kqfffffffffffffffn o o rn j o o n V V | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {kn | + 1 +,+->687+r<*-): {rn rn {rn jo hqj j o rn o V V | + 1 +<0:;8: {rn rn {rn {gf {km {fl {fk -:):-,:; {kl {rn | + 1 +:;8: {fj rn {rn {ki gqggnhgknfhoonmjml:roni {fi j {ji {fh 90-(>-; _h *1410(1 | + 1 +9><: {fg rn {rn {rn {kl {j {rn {ff -:):-,:; ,6183: | + 1 +/061+ {rn rn {rn kj no j | + 1 +/061+ {rn rn {rn jo no kqfffffffffffffffn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {kg {nk if o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {noo {kf {mn <0/& <*,+02 6810-: <0/& _h =;2@*6; nf | + 1 +92:,7r:&:r>++-6= {rn rn {non {jo {lm | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {nom {rn {jn if o | + 1 +9><: {nol rn {rn {ho {nok {j {rn {noj -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {noi {jn | + 1 +/3>1:r,*-9><: {rn rn {rn kj o j o n o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {noh {fl {gj {nog 90-(>-; {jm {rn | + 1 +<0:;8: {rn rn {rn {nof {jk {jf {fo 90-(>-; {ll {rn | + 1 +<0:;8: {rn rn {rn {jk {nno {gl {nnn 90-(>-; {ll {rn | + 1 +<0:;8: {rn rn {rn {nnm {jj {gm {nnn -:):-,:; {mm {rn | + 1 +:;8: {nnl rn {rn {ik rj {gh o {jj {nnk 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {ji {nnm {go {nog -:):-,:; {mm {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {jg | + 1 +):-+:' {rn rn {rn {jg {nnj | + 1 +:336/,:r<*-): {rn rn {rn jo no no o o rn j o o n V V | + 1 +<0:;8: {rn rn {rn {jf {ig {nni {nnh -:):-,:; {kl {rn | + 1 +:;8: {nng rn {rn {in o {nnf j {jf {nmo 90-(>-; _h *1410(1 | + 1 +/061+ {rn rn {rn kj no no | + 1 +/061+ {rn rn {rn jo j j | + 1 +<0:;8: {rn rn {rn {go {nmn {ig {fk 90-(>-; {jm {rn | + 1 +:;8: {nmm rn {rn {nml rj {fi j {ig {nmk 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nmj {rn {if | + 1 +):-+:' {rn rn {rn {nog {nmi | + 1 +,+->687+r<*-): {rn rn {rn jo no j o o rn V V | + 1 +92:,7r:&:r>++-6= {rn rn {nmh {rn {ho | + 1 +/3>1:r,*-9><: {rn rn {rn kj no j o rn o o o rn 90-(>-;@) V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {hk {mn {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nmg {hj {lm <0/& <*,+02 6810-: <0/& _h =;2@*6; mo | + 1 +92:,7r:&:r>++-6= {rn rn {nmf {hi {jn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {nlo {rn {hh if o | + 1 +300/ {rn rn {rn {rn {nni {hh | + 1 +/3>1:r,*-9><: {rn rn {rn ko j j n o o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {nln {nlm {nll {nlk 90-(>-; {hg {rn | + 1 +<0:;8: {rn rn {rn {nmn {go {nln {nlj 90-(>-; {jm {rn | + 1 +:;8: {nli rn {rn {fi rj {nlh j {gj {nlg 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nno {gn {nlf {nko 90-(>-; {ll {rn | + 1 +<0:;8: {rn rn {rn {gm {nof {nlm {nkn 90-(>-; {ll {rn | + 1 +:;8: {nkm rn {rn {nkl rj {gh o {gl {nkk 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {gj {gl {nkj {nki 90-(>-; {mm {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {gk | + 1 +,+->687+r<*-): {rn rn {rn jo j no o o n V V | + 1 +/061+ {rn rn {rn jo j no | + 1 +<0:;8: {rn rn {rn {nkh {nlf {gf {nnh 90-(>-; {nok {rn | + 1 +:;8: {nkg rn {rn {nnf rj {nml j {gf {nkf 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {njo {rn {fo | + 1 +):-+:' {rn rn {rn {fo {njn | + 1 +,+->687+r<*-): {rn rn {rn kj no no rn o o V V | + 1 +<0:;8: {rn rn {rn {fl {noh {nkh {njm 90-(>-; {jm {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {njl {rn {fk | + 1 +):-+:' {rn rn {rn {fk {njk | + 1 +,+->687+r<*-): {rn rn {rn kj no o n o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {fj {if <0/& <*,+02 6810-: <0/& _h =;2@*6; li | + 1 +/061+ {rn rn {rn jo no o | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {njj {fg {ho if o | + 1 +92:,7r:&:r>++-6= {rn rn {nji {non {lm | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {njh {nom {jn <0/& <*,+02 6810-: <0/& _h =;2@*6; mn | + 1 +92:,7r:&:r>++-6= {rn rn {njg {nol {hh | + 1 +<0:;8: {rn rn {rn {nkj {noi {noh {nlj -:):-,:; {hg {rn | + 1 +<0:;8: {rn rn {rn {noi {nkj {nno {nkn -:):-,:; {hg {rn | + 1 +<0:;8: {rn rn {rn {nlf {nkh {noi {nlk -:):-,:; {nok {rn | + 1 +:;8: {njf rn {rn {nio rj {nin j {nll {nim 90-(>-; _h *1410(1 | + 1 +:;8: {nil rn {rn {nlh rj {nin j {nln {nik 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nij {rn {nog | + 1 +):-+:' {rn rn {rn {nki {nii | + 1 +,+->687+r<*-): {rn rn {rn jo j o o rn o V V | + 1 +<0:;8: {rn rn {rn {nni {nll {nof {nko -:):-,:; {nok {rn | + 1 +:;8: {nih rn {rn {nnf rj {nio j {nlf {nig 90-(>-; _h *1410(1 | + 1 +:;8: {nif rn {rn {nio rj {nkl j {nlm {nho 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nhn {rn {nnn | + 1 +):-+:' {rn rn {rn {nnn {nhm | + 1 +,+->687+r<*-): {rn rn {rn jo j no o n o V V | + 1 +<0:;8: {rn rn {rn {nlm {nln {nnm {nki -:):-,:; {hg {rn | + 1 +:;8: {nhl rn {rn {nkl rj {nlh j {nnm {nhk 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {nll {nni {nmn {njm -:):-,:; {nok {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nhj {rn {nnh | + 1 +,+->687+r<*-): {rn rn {rn ko no j o o rn V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nng {fo <0/& <*,+02 6810-: <0/& _h =;2@*6; mi | + 1 +/061+ {rn rn {rn ko no no | + 1 +:;8: {nhi rn {rn {nin rj {nml j {nkh {nhh 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nmm {fk <0/& <*,+02 6810-: <0/& _h =;2@*6; lm | + 1 +/061+ {rn rn {rn ko no o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nhg {nmh {ho <0/& <*,+02 6810-: <0/& _h =;2@*6; ml | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nmg {lm {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {nhf {nmf {jn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {ngo {nlo {hh <0/& <*,+02 6810-: <0/& _h =;2@*6; mm | + 1 +/+36,+r:&:r>++-6= {rn rn {ngn {rn {nlk | + 1 +):-+:' {rn rn {rn {nko {ngm | + 1 +):-+:' {rn rn {rn {njm {ngl | + 1 +,+->687+r<*-): {rn rn {rn ko o j o o rn V V | + 1 +/+36,+r:&:r>++-6= {rn rn {ngk {rn {nlj | + 1 +,+->687+r<*-): {rn rn {rn kj o o rn o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nli {nog <0/& <*,+02 6810-: <0/& _h =;2@*6; mf | + 1 +/061+ {rn rn {rn jo o o | + 1 +/+36,+r:&:r>++-6= {rn rn {ngj {rn {nko | + 1 +,+->687+r<*-): {rn rn {rn ko j no o rn o V V | + 1 +/+36,+r:&:r>++-6= {rn rn {ngi {rn {nkn | + 1 +,+->687+r<*-): {rn rn {rn kj o no n o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nkm {nnn <0/& <*,+02 6810-: <0/& _h =;2@*6; mj | + 1 +/061+ {rn rn {rn jo o no | + 1 +/+36,+r:&:r>++-6= {rn rn {ngh {rn {nki | + 1 +,+->687+r<*-): {rn rn {rn jo o j o o rn V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nkg {nnh <0/& <*,+02 6810-: <0/& _h =;2@*6; lj | + 1 +/+36,+r:&:r>++-6= {rn rn {ngg {rn {njm | + 1 +,+->687+r<*-): {rn rn {rn ko j o o n o V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {njj {ho {l {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {njh {jn {l {rn | + 1 +92:,7r:&:r>++-6= {rn rn {ngf {njg {hh | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {njf {nlk <0/& <*,+02 6810-: <0/& _h =;2@*6; ll | + 1 +/061+ {rn rn {rn ko o no | + 1 +/061+ {rn rn {rn ko o o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nil {nlj <0/& <*,+02 6810-: <0/& _h =;2@*6; lo | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nih {nko <0/& <*,+02 6810-: <0/& _h =;2@*6; mh | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nif {nkn <0/& <*,+02 6810-: <0/& _h =;2@*6; mg | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nhl {nki <0/& <*,+02 6810-: <0/& _h =;2@*6; lk | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nhi {njm <0/& <*,+02 6810-: <0/& _h =;2@*6; ln | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {ngo {hh {l {rn | + 1 +Z1;r09r^ \VLr;>+> +100 +AcDb3dSolid +350 +0 +1001 +ACAD_OBJECT_CHANGE_GUID +1070 + 1 +1071 +643463150 +1070 +-18580 +1070 + 16753 +1070 + 145 +1070 + 235 +1070 + 171 +1070 + 71 +1070 + 246 +1070 + 158 +1070 + 87 +1070 + 82 + 0 +3DSOLID + 5 +A6 +330 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbModelerGeometry + 70 + 1 + 1 +hoo o n o + 1 +_ll P/:1 [:,681 ^ 336>1<: ^ \VL ]*63;:- _nm ^ \VL lmqo QK _mk Y-6 R>& nl noeonejf momm + 1 +n fqfffffffffffffffj:rooh n:rono + 1 +=0;& {n rn {rn {m {rn {rn | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {o {l {rn | + 1 +3*2/ {k rn {rn {rn {j {o | + 1 +:&:@-:961:2:1+ {rn rn _j 8-6; n _l +-6 n _k ,*-9 o _l >;5 o _k 8->; o _f /0,+<7:<4 o _k ,+03 rn _k 1+03 nkqfffhilhmghnhhmk _k ;,63 o _g 93>+1:,, o _h /6'>-:> o _k 72>' o _i 8-6;>- o _j 28-6; jnm _j *8-6; o _j )8-6; o _no :1;@96:3;, | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {m {l {rn | + 1 +,7:33 {i rn {rn {rn {rn {h {rn {m | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {rn {j {l {rn | + 1 +9><: {g rn {rn {f {no {j {rn {nn -:):-,:; ,6183: | + 1 +92:,7r:&:r>++-6= {rn rn {nm {rn {h | + 1 +9><: {nl rn {rn {nk {nj {j {rn {ni 90-(>-; ,6183: | + 1 +300/ {rn rn {rn {nh {ng {h | + 1 ++0-*,r,*-9><: {rn rn {rn ho no kqhffffffffffffffg o o n j m n o o 90-(>-;@) V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {nf {g {h {l {rn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {mo {rn {f if o | + 1 +9><: {mn rn {rn {mm {ml {j {rn {mk -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {mj {f | + 1 +/3>1:r,*-9><: {rn rn {rn ij j no o o n n o o 90-(>-;@) V V V V | + 1 +300/ {rn rn {rn {rn {mi {h | + 1 +<0:;8: {rn rn {rn {ng {ng {mh {mg -:):-,:; {no {rn | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {rn {nm {h if o | + 1 +92:,7r:&:r>++-6= {rn rn {mf {nl {f | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {lo {rn {nk if o | + 1 +9><: {ln rn {rn {lm {ll {j {rn {lk -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {lj {nk | + 1 +/3>1:r,*-9><: {rn rn {rn ij j o o o n n o o 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {li {lh {lg {lf 90-(>-; {nj {rn | + 1 +<0:;8: {rn rn {rn {mi {mi {ko {kn -:):-,:; {nh {rn | + 1 +<0:;8: {rn rn {rn {mh {mh {ng {mg 90-(>-; {km {rn | + 1 +:;8: {kl rn {rn {kk rlqnknjfmijljgfhfln {kk lqnknjfmijljgfhfln {mh {kj 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {ki {mo {f <0/& <*,+02 6810-: <0/& _h =;2@*6; nf | + 1 +92:,7r:&:r>++-6= {rn rn {kh {mn {nk | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {kg {rn {mm if o | + 1 +9><: {kf rn {rn {jo {jn {j {rn {jm -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {jl {mm | + 1 +/3>1:r,*-9><: {rn rn {rn ij o j o n o o o n 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {jk {jj {ji {jh 90-(>-; {ml {rn | + 1 +<0:;8: {rn rn {rn {jg {mj {jf {io 90-(>-; {nj {rn | + 1 +<0:;8: {rn rn {rn {mj {jg {in {im 90-(>-; {nj {rn | + 1 +<0:;8: {rn rn {rn {il {ik {mj {lf -:):-,:; {ij {rn | + 1 +:;8: {ii rn {rn {ih rj {ig j {lg {if 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {ko {ko {mi {kn 90-(>-; {ho {rn | + 1 +:;8: {hn rn {rn {hm rlqnknjfmijljgfhfln {hm lqnknjfmijljgfhfln {ko {hl 90-(>-; _h *1410(1 | + 1 +300/ {rn rn {rn {ij {mh {hk | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {mg | + 1 +):-+:' {rn rn {rn {mg {hj | + 1 +:336/,:r<*-): {rn rn {rn ho j kqhffffffffffffffg rn o o o rm o n V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {mf {f {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {hi {lo {nk <0/& <*,+02 6810-: <0/& _h =;2@*6; mo | + 1 +92:,7r:&:r>++-6= {rn rn {hh {ln {mm | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {hg {rn {lm if o | + 1 +9><: {hf rn {rn {hk {ho {j {rn {go -:):-,:; ,6183: | + 1 +300/ {rn rn {rn {rn {gn {lm | + 1 +/3>1:r,*-9><: {rn rn {rn io j j n o o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {gm {in {gl {gk 90-(>-; {ll {rn | + 1 +<0:;8: {rn rn {rn {gj {lj {gm {gi 90-(>-; {ml {rn | + 1 +<0:;8: {rn rn {rn {lj {gj {gh {gg 90-(>-; {ml {rn | + 1 +<0:;8: {rn rn {rn {ik {il {lj {jh -:):-,:; {ij {rn | + 1 +:;8: {gf rn {rn {fo rj {fn j {ji {fm 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {lh {li {fl {fk 90-(>-; {nj {rn | + 1 +<0:;8: {rn rn {rn {fj {fi {li {io -:):-,:; {fh {rn | + 1 +:;8: {fg rn {rn {ig rj {ff j {jf {noo 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {jl {non {lh {im -:):-,:; {ll {rn | + 1 +:;8: {nom rn {rn {nol rj {ih j {in {nok 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {ji {lg {non {noj 90-(>-; {ij {rn | + 1 +<0:;8: {rn rn {rn {lg {ji {fj {noi -:):-,:; {ij {rn | + 1 +300/ {rn rn {rn {rn {il {hk | + 1 +/+36,+r:&:r>++-6= {rn rn {noh {rn {lf | + 1 +):-+:' {rn rn {rn {lf {nog | + 1 +):-+:' {rn rn {rn {lf {nof | + 1 +,+->687+r<*-): {rn rn {rn ho j no o n o V V | + 1 +300/ {rn rn {rn {fh {ko {jo | + 1 +/+36,+r:&:r>++-6= {rn rn {rn {rn {kn | + 1 +):-+:' {rn rn {rn {kn {nno | + 1 +:336/,:r<*-): {rn rn {rn ij no kqhffffffffffffffg o rn o rm o o n V V | + 1 +9><: {nnn rn {rn {rn {km {j {rn {nnm -:):-,:; ,6183: | + 1 +/061+ {rn rn {rn ho h kqhffffffffffffffg | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {kh {nk {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nnl {kg {mm <0/& <*,+02 6810-: <0/& _h =;2@*6; mn | + 1 +92:,7r:&:r>++-6= {rn rn {nnk {kf {lm | + 1 +92:,7r:&:r>++-6= {rn rn {nnj {rn {jo | + 1 +/3>1:r,*-9><: {rn rn {rn ij no j o rn o o o rn 90-(>-;@) V V V V | + 1 +<0:;8: {rn rn {rn {nni {fl {fi {nnh 90-(>-; {jn {rn | + 1 +<0:;8: {rn rn {rn {non {jl {jk {gi -:):-,:; {ll {rn | + 1 +<0:;8: {rn rn {rn {fl {nni {jl {gk -:):-,:; {jn {rn | + 1 +:;8: {nng rn {rn {nol rj {nnf j {gl {nmo 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {jj {jk {nni {nmn 90-(>-; {ml {rn | + 1 +:;8: {nmm rn {rn {fn rj {nnf j {gm {nml 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {fi {fj {jj {gg -:):-,:; {fh {rn | + 1 +:;8: {nmk rn {rn {nmj rj {fo j {gh {nmi 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nmh {rn {jh | + 1 +):-+:' {rn rn {rn {jh {nmg | + 1 +):-+:' {rn rn {rn {noj {nmf | + 1 +,+->687+r<*-): {rn rn {rn ho j o o rn o V V | + 1 +<0:;8: {rn rn {rn {gn {gl {jg {fk -:):-,:; {jn {rn | + 1 +:;8: {nlo rn {rn {ff rj {nol j {fl {nln 90-(>-; _h *1410(1 | + 1 +<0:;8: {rn rn {rn {gh {jf {ik {noi 90-(>-; {fh {rn | + 1 +<0:;8: {rn rn {rn {jf {gh {gn {nnh -:):-,:; {fh {rn | + 1 +300/ {rn rn {rn {rn {fj {jo | + 1 +/+36,+r:&:r>++-6= {rn rn {nlm {rn {io | + 1 +):-+:' {rn rn {rn {io {nll | + 1 +,+->687+r<*-): {rn rn {rn ij no no rn o o V V | + 1 +<0:;8: {rn rn {rn {in {gm {il {noj -:):-,:; {ll {rn | + 1 +/+36,+r:&:r>++-6= {rn rn {nlk {rn {im | + 1 +):-+:' {rn rn {rn {fk {nlj | + 1 +,+->687+r<*-): {rn rn {rn ij o no n o o V V | + 1 +:;8: {nli rn {rn {ih rj {fn j {il {nlh 90-(>-; _h *1410(1 | + 1 +:;8: {nlg rn {rn {ig rj {fo j {ik {nlf 90-(>-; _h *1410(1 | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {ii {lf <0/& <*,+02 6810-: <0/& _h =;2@*6; mj | + 1 +/061+ {rn rn {rn ho o no | + 1 +/061+ {rn rn {rn ho no no | + 1 +/061+ {rn rn {rn ih no kqhffffffffffffffg | + 1 +92:,7r:&:r>++-6= {rn rn {nko {rn {hk | + 1 +/3>1:r,*-9><: {rn rn {rn ho j j rn o o o o n 90-(>-;@) V V V V | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {hh {mm {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nkn {hg {lm <0/& <*,+02 6810-: <0/& _h =;2@*6; mm | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {nkm {hf {jo if o | + 1 +<0:;8: {rn rn {rn {gl {gn {gj {nmn -:):-,:; {jn {rn | + 1 +:;8: {nkl rn {rn {ff rj {nmj j {fi {nkk 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nkj {rn {gk | + 1 +):-+:' {rn rn {rn {nmn {nki | + 1 +,+->687+r<*-): {rn rn {rn io o j o o rn V V | + 1 +:;8: {nkh rn {rn {nnf rj {nmj j {nni {nkg 90-(>-; _h *1410(1 | + 1 +/+36,+r:&:r>++-6= {rn rn {nkf {rn {gi | + 1 +,+->687+r<*-): {rn rn {rn ij o o rn o o V V | + 1 +/+36,+r:&:r>++-6= {rn rn {njo {rn {gg | + 1 +):-+:' {rn rn {rn {gg {njn | + 1 +,+->687+r<*-): {rn rn {rn ij no o n o o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {gf {jh <0/& <*,+02 6810-: <0/& _h =;2@*6; mf | + 1 +/061+ {rn rn {rn ho no o | + 1 +/061+ {rn rn {rn ho o o | + 1 +/+36,+r:&:r>++-6= {rn rn {njm {rn {fk | + 1 +,+->687+r<*-): {rn rn {rn io j no o rn o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {fg {io <0/& <*,+02 6810-: <0/& _h =;2@*6; mi | + 1 +/061+ {rn rn {rn io no no | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nom {im <0/& <*,+02 6810-: <0/& _h =;2@*6; mg | + 1 +/061+ {rn rn {rn io o no | + 1 +/+36,+r:&:r>++-6= {rn rn {njl {rn {noj | + 1 +,+->687+r<*-): {rn rn {rn ho o j o o rn V V | + 1 +/+36,+r:&:r>++-6= {rn rn {njk {rn {noi | + 1 +,+->687+r<*-): {rn rn {rn ho no j o o rn V V | + 1 +2>+:-6>3r>;:,4r>++-6= {rn rn {njj {nnn {hk if o | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nnk {lm {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {nji {nnj {jo <0/& <*,+02 6810-: <0/& _h =;2@*6; ml | + 1 +/+36,+r:&:r>++-6= {rn rn {njh {rn {nnh | + 1 +,+->687+r<*-): {rn rn {rn io no j o o rn V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nng {gk <0/& <*,+02 6810-: <0/& _h =;2@*6; ll | + 1 +/061+ {rn rn {rn io o o | + 1 +/+36,+r:&:r>++-6= {rn rn {njg {rn {nmn | + 1 +,+->687+r<*-): {rn rn {rn io j o o n o V V | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nmm {gi <0/& <*,+02 6810-: <0/& _h =;2@*6; lo | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nmk {gg <0/& <*,+02 6810-: <0/& _h =;2@*6; lm | + 1 +/061+ {rn rn {rn io no o | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nlo {fk <0/& <*,+02 6810-: <0/& _h =;2@*6; mh | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nli {noj <0/& <*,+02 6810-: <0/& _h =;2@*6; lk | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nlg {noi <0/& <*,+02 6810-: <0/& _h =;2@*6; li | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {njf {nko {hk <0/& <*,+02 6810-: <0/& _h =;2@*6; mk | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {nkm {jo {l {rn | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nkl {nnh <0/& <*,+02 6810-: <0/& _h =;2@*6; lj | + 1 +61+:8:-@>++-6=r1>2:@>++-6=r8:1r>++-6= {rn rn {rn {nkh {nmn <0/& <*,+02 6810-: <0/& _h =;2@*6; ln | + 1 +-:9@)+r:&:r>++-6= {rn rn {rn {njj {hk {l {rn | + 1 +Z1;r09r^ \VLr;>+> +100 +AcDb3dSolid +350 +0 +1001 +ACAD_OBJECT_CHANGE_GUID +1070 + 1 +1071 +-1637150595 +1070 +-25993 +1070 + 18165 +1070 + 147 +1070 + 164 +1070 + 0 +1070 + 250 +1070 + 15 +1070 + 110 +1070 + 166 +1070 + 45 + 0 +ENDSEC + 0 +SECTION + 2 +OBJECTS + 0 +DICTIONARY + 5 +C +330 +0 +100 +AcDbDictionary +281 + 1 + 3 +ACAD_DETAILVIEWSTYLE +350 +77 + 3 +ACAD_GROUP +350 +D + 3 +ACAD_IMAGE_DICT +350 +7C + 3 +ACAD_LAYOUT +350 +1A + 3 +ACAD_MATERIAL +350 +44 + 3 +ACAD_MLEADERSTYLE +350 +6C + 3 +ACAD_MLINESTYLE +350 +17 + 3 +ACAD_PLOTSETTINGS +350 +19 + 3 +ACAD_PLOTSTYLENAME +350 +E + 3 +ACAD_RENDER_ACTIVE_SETTINGS +350 +7B + 3 +ACAD_SCALELIST +350 +48 + 3 +ACAD_SECTIONVIEWSTYLE +350 +78 + 3 +ACAD_TABLESTYLE +350 +6A + 3 +ACAD_VISUALSTYLE +350 +24 + 3 +ACDB_RECOMPOSE_DATA +350 +E5 + 3 +AcDbVariableDictionary +350 +6F + 3 +BCAD_Civil +350 +90 + 0 +SUN + 5 +23 +330 +22 +100 +AcDbSun + 90 + 1 +290 + 0 + 63 + 7 +421 + 16777215 + 40 +1.0 +291 + 1 + 91 + 2455826 + 92 + 54000000 +292 + 0 + 70 + 2 + 71 + 256 +280 + 1 + 0 +DICTIONARY + 5 +77 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Metric50 +350 +7D + 0 +DICTIONARY + 5 +D +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 0 +DICTIONARY + 5 +7C +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 0 +DICTIONARY + 5 +1A +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Layout1 +350 +1E + 3 +Layout2 +350 +41 + 3 +Model +350 +3D + 0 +DICTIONARY + 5 +44 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +_DYN_DIM_3D +350 +9C + 3 +ByBlock +350 +46 + 3 +ByLayer +350 +45 + 3 +Global +350 +47 + 0 +DICTIONARY + 5 +6C +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Standard +350 +6D + 0 +DICTIONARY + 5 +17 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Standard +350 +18 + 0 +DICTIONARY + 5 +19 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 0 +ACDBDICTIONARYWDFLT + 5 +E +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Normal +350 +F +100 +AcDbDictionaryWithDefault +340 +F + 0 +MENTALRAYRENDERSETTINGS + 5 +7B +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbRenderSettings + 90 + 2 + 1 +Medium +290 + 1 +290 + 1 +290 + 1 +290 + 1 + 1 + + 1 + + 90 + 3 +100 +AcDbMentalRayRenderSettings + 90 + 2 + 90 + 0 + 90 + 1 + 70 + 2 + 40 +3.0 + 40 +3.0 + 40 +0.050000000745 + 40 +0.050000000745 + 40 +0.050000000745 + 40 +0.050000000745 + 70 + 0 +290 + 0 +290 + 1 + 90 + 5 + 90 + 5 + 90 + 5 +290 + 0 + 90 + 500 +290 + 0 + 40 +1.0 + 90 + 10000 + 90 + 5 + 90 + 5 + 90 + 5 +290 + 0 + 90 + 200 +290 + 0 +290 + 0 +290 + 0 + 40 +0.1 + 40 +1.0 + 40 +1500.0 + 70 + 0 + 70 + 0 + 40 +10.0 + 70 + 0 + 70 + 0 +290 + 0 + 1 + + 90 + 128 + 70 + 0 + 90 + 1048 +290 + 0 + 40 +1.0 + 0 +DICTIONARY + 5 +48 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +A0 +350 +49 + 3 +A1 +350 +4A + 3 +A2 +350 +4B + 3 +A3 +350 +4C + 3 +A4 +350 +4D + 3 +A5 +350 +4E + 3 +A6 +350 +4F + 3 +A7 +350 +50 + 3 +A8 +350 +85 + 3 +A9 +350 +51 + 3 +B0 +350 +52 + 3 +B1 +350 +53 + 3 +B2 +350 +54 + 3 +B3 +350 +86 + 3 +B4 +350 +89 + 3 +B5 +350 +55 + 3 +B6 +350 +56 + 3 +B7 +350 +57 + 3 +B8 +350 +58 + 3 +B9 +350 +59 + 0 +DICTIONARY + 5 +78 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Metric50 +350 +7E + 0 +DICTIONARY + 5 +6A +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +Standard +350 +6B + 0 +DICTIONARY + 5 +24 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +2dWireframe +350 +29 + 3 +Basic +350 +2C + 3 +Brighten +350 +30 + 3 +ColorChange +350 +34 + 3 +Conceptual +350 +2E + 3 +Dim +350 +2F + 3 +EdgeColorOff +350 +37 + 3 +Facepattern +350 +33 + 3 +Flat +350 +25 + 3 +FlatWithEdges +350 +26 + 3 +Gouraud +350 +27 + 3 +GouraudWithEdges +350 +28 + 3 +Hidden +350 +2B + 3 +JitterOff +350 +35 + 3 +Linepattern +350 +32 + 3 +Modeling +350 +6E + 3 +OverhangOff +350 +36 + 3 +Realistic +350 +2D + 3 +Shaded +350 +3C + 3 +Shaded with edges +350 +3B + 3 +Shades of Gray +350 +38 + 3 +Sketchy +350 +39 + 3 +Thicken +350 +31 + 3 +Wireframe +350 +2A + 3 +X-Ray +350 +3A + 0 +XRECORD + 5 +E5 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbXrecord +280 + 1 + 90 + 1 +330 +6B + 0 +DICTIONARY + 5 +6F +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +CANNOSCALE +350 +70 + 3 +CENTEREXE +350 +79 + 3 +CENTERLTYPEFILE +350 +7A + 3 +CMLEADERSTYLE +350 +75 + 3 +CTABLESTYLE +350 +74 + 3 +CVIEWDETAILSTYLE +350 +83 + 3 +CVIEWSECTIONSTYLE +350 +84 + 3 +LIGHTINGUNITS +350 +76 + 0 +DICTIONARY + 5 +90 +102 +{ACAD_REACTORS +330 +C +102 +} +330 +C +100 +AcDbDictionary +281 + 1 + 3 +ArcTessellation +350 +91 + 3 +ArcTessellationGrading +350 +92 + 3 +ArcTessellationTemplateElement +350 +93 + 3 +LengthSamplingInterval +350 +94 + 0 +ACDBDETAILVIEWSTYLE + 5 +7D +102 +{ACAD_REACTORS +330 +77 +102 +} +102 +{ACAD_XDICTIONARY +360 +7F +102 +} +330 +77 +100 +AcDbModelDocViewStyle + 70 + 0 + 3 +Imperial24 +290 + 0 +100 +AcDbDetailViewStyle + 70 + 0 + 71 + 0 + 90 + 3 + 71 + 1 +340 +11 + 62 + 256 + 40 +5.0 +340 +0 + 62 + 256 + 40 +5.0 +300 + + 40 +0.36 +280 + 1 + 71 + 2 +340 +16 + 90 + 25 + 62 + 256 + 71 + 3 +340 +11 + 62 + 256 + 40 +5.0 + 90 + 0 + 40 +15.0 + 90 + 1 +300 +%<\AcVar ViewDetailId>% (%<\AcVar ViewScale \f "%sn">%) + 71 + 4 +340 +16 + 90 + 25 + 62 + 256 +340 +16 + 90 + 25 + 62 + 256 +280 + 0 + 0 +LAYOUT + 5 +1E +102 +{ACAD_REACTORS +330 +1A +102 +} +330 +1A +100 +AcDbPlotSettings + 1 + + 2 +none_device + 4 + + 6 + + 40 +0.0 + 41 +0.0 + 42 +0.0 + 43 +0.0 + 44 +0.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 + 49 +0.0 +140 +0.0 +141 +0.0 +142 +1.0 +143 +1.0 + 70 + 688 + 72 + 1 + 73 + 0 + 74 + 5 + 7 + + 75 + 16 + 76 + 0 + 77 + 2 + 78 + 300 +147 +1.0 +148 +0.0 +149 +0.0 +100 +AcDbLayout + 1 +Layout1 + 70 + 1 + 71 + 1 + 10 +0.0 + 20 +0.0 + 11 +420.0 + 21 +297.0 + 12 +0.0 + 22 +0.0 + 32 +0.0 + 14 +1.000000000000E+20 + 24 +1.000000000000E+20 + 34 +1.000000000000E+20 + 15 +-1.000000000000E+20 + 25 +-1.000000000000E+20 + 35 +-1.000000000000E+20 +146 +0.0 + 13 +0.0 + 23 +0.0 + 33 +0.0 + 16 +1.0 + 26 +0.0 + 36 +0.0 + 17 +0.0 + 27 +1.0 + 37 +0.0 + 76 + 0 +330 +1B + 0 +LAYOUT + 5 +41 +102 +{ACAD_REACTORS +330 +1A +102 +} +330 +1A +100 +AcDbPlotSettings + 1 + + 2 +none_device + 4 + + 6 + + 40 +0.0 + 41 +0.0 + 42 +0.0 + 43 +0.0 + 44 +0.0 + 45 +0.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 + 49 +0.0 +140 +0.0 +141 +0.0 +142 +1.0 +143 +1.0 + 70 + 688 + 72 + 1 + 73 + 0 + 74 + 5 + 7 + + 75 + 16 + 76 + 0 + 77 + 2 + 78 + 300 +147 +1.0 +148 +0.0 +149 +0.0 +100 +AcDbLayout + 1 +Layout2 + 70 + 1 + 71 + 2 + 10 +0.0 + 20 +0.0 + 11 +0.0 + 21 +0.0 + 12 +0.0 + 22 +0.0 + 32 +0.0 + 14 +0.0 + 24 +0.0 + 34 +0.0 + 15 +0.0 + 25 +0.0 + 35 +0.0 +146 +0.0 + 13 +0.0 + 23 +0.0 + 33 +0.0 + 16 +1.0 + 26 +0.0 + 36 +0.0 + 17 +0.0 + 27 +1.0 + 37 +0.0 + 76 + 0 +330 +3E + 0 +LAYOUT + 5 +3D +102 +{ACAD_REACTORS +330 +1A +102 +} +330 +1A +100 +AcDbPlotSettings + 1 + + 2 +none_device + 4 +ISO_A4_(210.00_x_297.00_MM) + 6 + + 40 +7.5 + 41 +20.0 + 42 +7.5 + 43 +20.0 + 44 +210.0 + 45 +297.0 + 46 +0.0 + 47 +0.0 + 48 +0.0 + 49 +0.0 +140 +0.0 +141 +0.0 +142 +1.0 +143 +3.004989604802 + 70 + 1712 + 72 + 1 + 73 + 0 + 74 + 0 + 7 + + 75 + 0 + 76 + 0 + 77 + 2 + 78 + 300 +147 +0.332779853349 +148 +-51.200429419625 +149 +0.0 +100 +AcDbLayout + 1 +Model + 70 + 1 + 71 + 0 + 10 +0.0 + 20 +0.0 + 11 +420.0 + 21 +297.0 + 12 +0.0 + 22 +0.0 + 32 +0.0 + 14 +0.0 + 24 +0.0 + 34 +0.0 + 15 +70.0 + 25 +10.0 + 35 +10.0 +146 +0.0 + 13 +0.0 + 23 +0.0 + 33 +0.0 + 16 +1.0 + 26 +0.0 + 36 +0.0 + 17 +0.0 + 27 +1.0 + 37 +0.0 + 76 + 0 +330 +1F +331 +22 + 0 +MATERIAL + 5 +9C +102 +{ACAD_REACTORS +330 +44 +102 +} +330 +44 +100 +AcDbMaterial + 1 +_DYN_DIM_3D + 72 + 1 + 94 + 127 + 0 +MATERIAL + 5 +46 +102 +{ACAD_REACTORS +330 +44 +102 +} +330 +44 +100 +AcDbMaterial + 1 +ByBlock + 71 + 1 + 91 +-1023410177 + 72 + 1 + 94 + 127 + 0 +MATERIAL + 5 +45 +102 +{ACAD_REACTORS +330 +44 +102 +} +330 +44 +100 +AcDbMaterial + 1 +ByLayer + 71 + 1 + 91 +-1023410177 + 72 + 1 + 94 + 127 + 0 +MATERIAL + 5 +47 +102 +{ACAD_REACTORS +330 +44 +102 +} +330 +44 +100 +AcDbMaterial + 1 +Global + 72 + 1 + 94 + 127 + 0 +MLEADERSTYLE + 5 +6D +102 +{ACAD_REACTORS +330 +6C +102 +} +330 +6C +100 +AcDbMLeaderStyle +179 + 2 +170 + 2 +171 + 1 +172 + 0 + 90 + 2 + 40 +0.0 + 41 +0.0 +173 + 1 + 91 +-1056964608 +340 +14 + 92 + -2 +290 + 1 + 42 +2.0 +291 + 1 + 43 +8.0 + 3 +Standard +341 +0 + 44 +4.0 +300 + +342 +11 +174 + 1 +178 + 1 +175 + 1 +176 + 0 + 93 +-1056964608 + 45 +4.0 +292 + 0 +297 + 0 + 46 +4.0 +343 +0 + 94 +-1056964608 + 47 +1.0 + 49 +1.0 +140 +1.0 +293 + 1 +141 +0.0 +294 + 1 +177 + 0 +142 +1.0 +295 + 0 +296 + 0 +143 +3.75 +271 + 0 +272 + 9 +273 + 9 + 0 +MLINESTYLE + 5 +18 +102 +{ACAD_REACTORS +330 +17 +102 +} +330 +17 +100 +AcDbMlineStyle + 2 +Standard + 70 + 0 + 3 + + 62 + 256 + 51 +90.0 + 52 +90.0 + 71 + 2 + 49 +0.5 + 62 + 256 + 6 +BYLAYER + 49 +-0.5 + 62 + 256 + 6 +BYLAYER + 0 +ACDBPLACEHOLDER + 5 +F +102 +{ACAD_REACTORS +330 +E +102 +} +330 +E + 0 +SCALE + 5 +49 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:1 +140 +1.0 +141 +1.0 +290 + 1 + 0 +SCALE + 5 +4A +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:2 +140 +1.0 +141 +2.0 +290 + 0 + 0 +SCALE + 5 +4B +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:4 +140 +1.0 +141 +4.0 +290 + 0 + 0 +SCALE + 5 +4C +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:5 +140 +1.0 +141 +5.0 +290 + 0 + 0 +SCALE + 5 +4D +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:8 +140 +1.0 +141 +8.0 +290 + 0 + 0 +SCALE + 5 +4E +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:10 +140 +1.0 +141 +10.0 +290 + 0 + 0 +SCALE + 5 +4F +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:16 +140 +1.0 +141 +16.0 +290 + 0 + 0 +SCALE + 5 +50 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:20 +140 +1.0 +141 +20.0 +290 + 0 + 0 +SCALE + 5 +85 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:25 +140 +1.0 +141 +25.0 +290 + 0 + 0 +SCALE + 5 +51 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:30 +140 +1.0 +141 +30.0 +290 + 0 + 0 +SCALE + 5 +52 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:40 +140 +1.0 +141 +40.0 +290 + 0 + 0 +SCALE + 5 +53 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:50 +140 +1.0 +141 +50.0 +290 + 0 + 0 +SCALE + 5 +54 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:100 +140 +1.0 +141 +100.0 +290 + 0 + 0 +SCALE + 5 +86 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:500 +140 +1.0 +141 +500.0 +290 + 0 + 0 +SCALE + 5 +89 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +1:1000 +140 +1.0 +141 +1000.0 +290 + 0 + 0 +SCALE + 5 +55 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +2:1 +140 +2.0 +141 +1.0 +290 + 0 + 0 +SCALE + 5 +56 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +4:1 +140 +4.0 +141 +1.0 +290 + 0 + 0 +SCALE + 5 +57 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +8:1 +140 +8.0 +141 +1.0 +290 + 0 + 0 +SCALE + 5 +58 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +10:1 +140 +10.0 +141 +1.0 +290 + 0 + 0 +SCALE + 5 +59 +102 +{ACAD_REACTORS +330 +48 +102 +} +330 +48 +100 +AcDbScale + 70 + 0 +300 +100:1 +140 +100.0 +141 +1.0 +290 + 0 + 0 +ACDBSECTIONVIEWSTYLE + 5 +7E +102 +{ACAD_REACTORS +330 +78 +102 +} +102 +{ACAD_XDICTIONARY +360 +81 +102 +} +330 +78 +100 +AcDbModelDocViewStyle + 70 + 0 + 3 +Imperial24 +290 + 0 +100 +AcDbSectionViewStyle + 70 + 0 + 71 + 0 + 90 + 110 + 71 + 1 +340 +11 + 62 + 256 + 40 +5.0 +340 +0 +340 +0 + 62 + 256 + 40 +5.0 +300 +I, O, Q, S, X, Z + 40 +10.0 + 90 + 0 + 40 +2.5 + 90 + 0 + 71 + 2 +340 +16 + 90 + 25 + 62 + 256 +340 +16 + 90 + 50 + 62 + 256 + 40 +5.0 + 40 +2.5 + 40 +5.0 + 71 + 3 +340 +11 + 62 + 256 + 40 +5.0 + 90 + 0 + 40 +15.0 + 90 + 1 +300 +%<\AcVar ViewSectionStartId>%-%<\AcVar ViewSectionEndId>% (%<\AcVar ViewScale \f "%sn">%) + 71 + 4 + 62 + 256 + 62 + 257 +300 +ANSI31 + 40 +1.0 + 90 + 0 +290 + 0 +290 + 0 + 90 + 6 + 40 +0.0 + 40 +1.570796 + 40 +0.261799 + 40 +1.308997 + 40 +-0.261799 + 40 +1.832596 + 0 +TABLESTYLE + 5 +6B +102 +{ACAD_REACTORS +330 +6A +102 +} +102 +{ACAD_XDICTIONARY +360 +B1 +102 +} +330 +6A +100 +AcDbTableStyle + 3 +Standard + 70 + 0 + 71 + 0 + 40 +1.5 + 41 +1.5 +280 + 0 +281 + 0 + 7 +Standard +140 +4.5 +170 + 2 + 62 + 0 + 63 + 257 +283 + 0 + 90 + 4 + 91 + 0 + 1 + +274 + -2 +284 + 1 + 64 + 0 +275 + -2 +285 + 1 + 65 + 0 +276 + -2 +286 + 1 + 66 + 0 +277 + -2 +287 + 1 + 67 + 0 +278 + -2 +288 + 1 + 68 + 0 +279 + -2 +289 + 1 + 69 + 0 + 7 +Standard +140 +6.0 +170 + 5 + 62 + 0 + 63 + 257 +283 + 0 + 90 + 4 + 91 + 0 + 1 + +274 + -2 +284 + 1 + 64 + 0 +275 + -2 +285 + 1 + 65 + 0 +276 + -2 +286 + 1 + 66 + 0 +277 + -2 +287 + 1 + 67 + 0 +278 + -2 +288 + 1 + 68 + 0 +279 + -2 +289 + 1 + 69 + 0 + 7 +Standard +140 +4.5 +170 + 5 + 62 + 0 + 63 + 257 +283 + 0 + 90 + 4 + 91 + 0 + 1 + +274 + -2 +284 + 1 + 64 + 0 +275 + -2 +285 + 1 + 65 + 0 +276 + -2 +286 + 1 + 66 + 0 +277 + -2 +287 + 1 + 67 + 0 +278 + -2 +288 + 1 + 68 + 0 +279 + -2 +289 + 1 + 69 + 0 + 0 +VISUALSTYLE + 5 +29 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +B3 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +2dWireframe + 70 + 4 +177 + 2 +291 + 0 + 71 + 0 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 0 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +2C +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +B5 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Basic + 70 + 7 +177 + 2 +291 + 1 + 71 + 1 +176 + 1 + 72 + 0 +176 + 1 + 73 + 1 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 0 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +30 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +B7 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Brighten + 70 + 12 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +50.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +34 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +B9 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +ColorChange + 70 + 16 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 3 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 8 +421 + 8421504 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 8 +424 + 8421504 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +2E +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +BB +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Conceptual + 70 + 9 +177 + 2 +291 + 0 + 71 + 3 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 2 +176 + 1 + 91 + 2 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +179.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +2F +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +BD +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Dim + 70 + 11 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +-50.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +37 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +BF +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +EdgeColorOff + 70 + 22 +177 + 2 +291 + 1 + 71 + 2 +176 + 0 + 72 + 2 +176 + 0 + 73 + 0 +176 + 0 + 90 + 0 +176 + 0 + 40 +0.6 +176 + 0 + 41 +30.0 +176 + 0 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 0 + 74 + 1 +176 + 0 + 91 + 4 +176 + 0 + 64 + 7 +176 + 0 + 65 + 257 +176 + 0 + 75 + 1 +176 + 0 +175 + 1 +176 + 0 + 42 +1.0 +176 + 0 + 92 + 8 +176 + 2 + 66 + 7 +176 + 0 + 43 +1.0 +176 + 0 + 76 + 1 +176 + 0 + 77 + 6 +176 + 0 + 78 + 2 +176 + 0 + 67 + 7 +176 + 0 + 79 + 5 +176 + 0 +170 + 0 +176 + 0 +171 + 0 +176 + 0 +290 + 0 +176 + 0 + 93 + 1 +176 + 0 + 44 +0.0 +176 + 0 +173 + 0 +176 + 0 + 0 +VISUALSTYLE + 5 +33 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +C1 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Facepattern + 70 + 15 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +25 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +C3 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Flat + 70 + 0 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 1 +176 + 1 + 73 + 1 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 0 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +26 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +C5 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +FlatWithEdges + 70 + 1 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 1 +176 + 1 + 73 + 1 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 0 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +27 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +C7 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Gouraud + 70 + 2 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 1 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 0 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 0 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +28 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +C9 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +GouraudWithEdges + 70 + 3 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 1 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 0 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +2B +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +CB +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Hidden + 70 + 6 +177 + 2 +291 + 0 + 71 + 1 +176 + 1 + 72 + 2 +176 + 1 + 73 + 2 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 2 +176 + 1 + 91 + 2 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 2 +176 + 1 +175 + 1 +176 + 1 + 42 +40.0 +176 + 1 + 92 + 0 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +35 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +CD +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +JitterOff + 70 + 20 +177 + 2 +291 + 1 + 71 + 2 +176 + 0 + 72 + 2 +176 + 0 + 73 + 0 +176 + 0 + 90 + 0 +176 + 0 + 40 +0.6 +176 + 0 + 41 +30.0 +176 + 0 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 0 + 74 + 1 +176 + 0 + 91 + 4 +176 + 0 + 64 + 7 +176 + 0 + 65 + 257 +176 + 0 + 75 + 1 +176 + 0 +175 + 1 +176 + 0 + 42 +1.0 +176 + 0 + 92 + 10 +176 + 2 + 66 + 7 +176 + 0 + 43 +1.0 +176 + 0 + 76 + 1 +176 + 0 + 77 + 6 +176 + 0 + 78 + 2 +176 + 0 + 67 + 7 +176 + 0 + 79 + 5 +176 + 0 +170 + 0 +176 + 0 +171 + 0 +176 + 0 +290 + 0 +176 + 0 + 93 + 1 +176 + 0 + 44 +0.0 +176 + 0 +173 + 0 +176 + 0 + 0 +VISUALSTYLE + 5 +32 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +CF +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Linepattern + 70 + 14 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 7 +176 + 1 +175 + 7 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +6E +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +D1 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Modeling + 70 + 10 +177 + 2 +291 + 0 + 71 + 2 +176 + 1 + 72 + 3 +176 + 1 + 73 + 0 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 2 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +180.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 8 +424 + 7895160 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +36 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +D3 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +OverhangOff + 70 + 21 +177 + 2 +291 + 1 + 71 + 2 +176 + 0 + 72 + 2 +176 + 0 + 73 + 0 +176 + 0 + 90 + 0 +176 + 0 + 40 +0.6 +176 + 0 + 41 +30.0 +176 + 0 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 0 + 74 + 1 +176 + 0 + 91 + 4 +176 + 0 + 64 + 7 +176 + 0 + 65 + 257 +176 + 0 + 75 + 1 +176 + 0 +175 + 1 +176 + 0 + 42 +1.0 +176 + 0 + 92 + 9 +176 + 2 + 66 + 7 +176 + 0 + 43 +1.0 +176 + 0 + 76 + 1 +176 + 0 + 77 + 6 +176 + 0 + 78 + 2 +176 + 0 + 67 + 7 +176 + 0 + 79 + 5 +176 + 0 +170 + 0 +176 + 0 +171 + 0 +176 + 0 +290 + 0 +176 + 0 + 93 + 1 +176 + 0 + 44 +0.0 +176 + 0 +173 + 0 +176 + 0 + 0 +VISUALSTYLE + 5 +2D +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +D5 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Realistic + 70 + 8 +177 + 2 +291 + 0 + 71 + 2 +176 + 1 + 72 + 3 +176 + 1 + 73 + 0 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 0 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +3C +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +D7 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Shaded + 70 + 27 +177 + 2 +291 + 0 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 1 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 0 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 8 +425 + 7895160 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 5 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +3B +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +D9 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Shaded with edges + 70 + 26 +177 + 2 +291 + 0 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 1 +176 + 1 + 90 + 2 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 10 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 2 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 5 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +38 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +DB +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Shades of Gray + 70 + 23 +177 + 2 +291 + 0 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 3 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 2 +176 + 1 + 91 + 2 +176 + 1 + 64 + 7 +176 + 1 + 65 + 7 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +40.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +39 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +DD +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Sketchy + 70 + 24 +177 + 2 +291 + 0 + 71 + 1 +176 + 1 + 72 + 2 +176 + 1 + 73 + 2 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 2 +176 + 1 + 91 + 2 +176 + 1 + 64 + 7 +176 + 1 + 65 + 7 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +40.0 +176 + 1 + 92 + 11 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 6 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +31 +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +DF +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Thicken + 70 + 13 +177 + 2 +291 + 1 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 12 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 5 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +2A +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +E1 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +Wireframe + 70 + 5 +177 + 2 +291 + 0 + 71 + 0 +176 + 1 + 72 + 2 +176 + 1 + 73 + 0 +176 + 1 + 90 + 0 +176 + 1 + 40 +0.6 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 4 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 0 +176 + 1 + 66 + 257 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 1 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +VISUALSTYLE + 5 +3A +102 +{ACAD_REACTORS +330 +24 +102 +} +102 +{ACAD_XDICTIONARY +360 +E3 +102 +} +330 +24 +100 +AcDbVisualStyle + 2 +X-Ray + 70 + 25 +177 + 2 +291 + 0 + 71 + 2 +176 + 1 + 72 + 2 +176 + 1 + 73 + 1 +176 + 1 + 90 + 1 +176 + 1 + 40 +0.5 +176 + 1 + 41 +30.0 +176 + 1 + 62 + 5 + 63 + 7 +421 + 16777215 +176 + 1 + 74 + 1 +176 + 1 + 91 + 0 +176 + 1 + 64 + 7 +176 + 1 + 65 + 257 +176 + 1 + 75 + 1 +176 + 1 +175 + 1 +176 + 1 + 42 +1.0 +176 + 1 + 92 + 8 +176 + 1 + 66 + 7 +176 + 1 + 43 +1.0 +176 + 1 + 76 + 1 +176 + 1 + 77 + 6 +176 + 1 + 78 + 2 +176 + 1 + 67 + 7 +176 + 1 + 79 + 3 +176 + 1 +170 + 0 +176 + 1 +171 + 0 +176 + 1 +290 + 0 +176 + 1 + 93 + 13 +176 + 1 + 44 +0.0 +176 + 1 +173 + 0 +176 + 1 + 0 +DICTIONARYVAR + 5 +70 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +1:1 + 0 +DICTIONARYVAR + 5 +79 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +3.500000 + 0 +DICTIONARYVAR + 5 +7A +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +iso.lin + 0 +DICTIONARYVAR + 5 +75 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +Standard + 0 +DICTIONARYVAR + 5 +74 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +Standard + 0 +DICTIONARYVAR + 5 +83 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +Metric50 + 0 +DICTIONARYVAR + 5 +84 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +Metric50 + 0 +DICTIONARYVAR + 5 +76 +102 +{ACAD_REACTORS +330 +6F +102 +} +330 +6F +100 +DictionaryVariables +280 + 0 + 1 +2 + 0 +DICTIONARYVAR + 5 +91 +102 +{ACAD_REACTORS +330 +90 +102 +} +330 +90 +100 +DictionaryVariables +280 + 0 + 1 +10.000000 + 0 +DICTIONARYVAR + 5 +92 +102 +{ACAD_REACTORS +330 +90 +102 +} +330 +90 +100 +DictionaryVariables +280 + 0 + 1 +10.000000 + 0 +DICTIONARYVAR + 5 +93 +102 +{ACAD_REACTORS +330 +90 +102 +} +330 +90 +100 +DictionaryVariables +280 + 0 + 1 +10.000000 + 0 +DICTIONARYVAR + 5 +94 +102 +{ACAD_REACTORS +330 +90 +102 +} +330 +90 +100 +DictionaryVariables +280 + 0 + 1 +1000.000000 + 0 +DICTIONARY + 5 +7F +330 +7D +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +AF + 0 +DICTIONARY + 5 +81 +330 +7E +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +B0 + 0 +DICTIONARY + 5 +B1 +330 +6B +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_ROUNDTRIP_2008_TABLESTYLE_CELLSTYLEMAP +360 +B2 + 0 +DICTIONARY + 5 +B3 +330 +29 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +B4 + 0 +DICTIONARY + 5 +B5 +330 +2C +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +B6 + 0 +DICTIONARY + 5 +B7 +330 +30 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +B8 + 0 +DICTIONARY + 5 +B9 +330 +34 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +BA + 0 +DICTIONARY + 5 +BB +330 +2E +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +BC + 0 +DICTIONARY + 5 +BD +330 +2F +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +BE + 0 +DICTIONARY + 5 +BF +330 +37 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +C0 + 0 +DICTIONARY + 5 +C1 +330 +33 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +C2 + 0 +DICTIONARY + 5 +C3 +330 +25 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +C4 + 0 +DICTIONARY + 5 +C5 +330 +26 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +C6 + 0 +DICTIONARY + 5 +C7 +330 +27 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +C8 + 0 +DICTIONARY + 5 +C9 +330 +28 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +CA + 0 +DICTIONARY + 5 +CB +330 +2B +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +CC + 0 +DICTIONARY + 5 +CD +330 +35 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +CE + 0 +DICTIONARY + 5 +CF +330 +32 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +D0 + 0 +DICTIONARY + 5 +D1 +330 +6E +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +D2 + 0 +DICTIONARY + 5 +D3 +330 +36 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +D4 + 0 +DICTIONARY + 5 +D5 +330 +2D +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +D6 + 0 +DICTIONARY + 5 +D7 +330 +3C +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +D8 + 0 +DICTIONARY + 5 +D9 +330 +3B +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +DA + 0 +DICTIONARY + 5 +DB +330 +38 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +DC + 0 +DICTIONARY + 5 +DD +330 +39 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +DE + 0 +DICTIONARY + 5 +DF +330 +31 +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +E0 + 0 +DICTIONARY + 5 +E1 +330 +2A +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +E2 + 0 +DICTIONARY + 5 +E3 +330 +3A +100 +AcDbDictionary +280 + 1 +281 + 1 + 3 +ACAD_XREC_ROUNDTRIP +360 +E4 + 0 +XRECORD + 5 +AF +102 +{ACAD_REACTORS +330 +7F +102 +} +330 +7F +100 +AcDbXrecord +280 + 1 +102 +DISPLAYNAME + 1 +Imperial24 +102 +FLAGS + 90 + 0 + 0 +XRECORD + 5 +B0 +102 +{ACAD_REACTORS +330 +81 +102 +} +330 +81 +100 +AcDbXrecord +280 + 1 +102 +DISPLAYNAME + 1 +Imperial24 +102 +FLAGS + 90 + 0 + 0 +CELLSTYLEMAP + 5 +B2 +102 +{ACAD_REACTORS +330 +B1 +102 +} +330 +B1 +100 +AcDbCellStyleMap + 90 + 3 +300 +CELLSTYLE + 1 +TABLEFORMAT_BEGIN + 90 + 5 +170 + 1 + 91 + 0 + 92 + 32768 + 62 + 257 + 93 + 1 +300 +CONTENTFORMAT + 1 +CONTENTFORMAT_BEGIN + 90 + 0 + 91 + 0 + 92 + 4 + 93 + 0 +300 + + 40 +0.0 +140 +1.0 + 94 + 5 + 62 + 0 +340 +11 +144 +6.0 +309 +CONTENTFORMAT_END +171 + 1 +301 +MARGIN + 1 +CELLMARGIN_BEGIN + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 +309 +CELLMARGIN_END + 94 + 6 + 95 + 1 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 2 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 4 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 8 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 16 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 32 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END +309 +TABLEFORMAT_END + 1 +CELLSTYLE_BEGIN + 90 + 1 + 91 + 1 +300 +_TITLE +309 +CELLSTYLE_END +300 +CELLSTYLE + 1 +TABLEFORMAT_BEGIN + 90 + 5 +170 + 1 + 91 + 0 + 92 + 0 + 62 + 257 + 93 + 1 +300 +CONTENTFORMAT + 1 +CONTENTFORMAT_BEGIN + 90 + 0 + 91 + 0 + 92 + 4 + 93 + 0 +300 + + 40 +0.0 +140 +1.0 + 94 + 5 + 62 + 0 +340 +11 +144 +4.5 +309 +CONTENTFORMAT_END +171 + 1 +301 +MARGIN + 1 +CELLMARGIN_BEGIN + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 +309 +CELLMARGIN_END + 94 + 6 + 95 + 1 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 2 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 4 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 8 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 16 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 32 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END +309 +TABLEFORMAT_END + 1 +CELLSTYLE_BEGIN + 90 + 2 + 91 + 1 +300 +_HEADER +309 +CELLSTYLE_END +300 +CELLSTYLE + 1 +TABLEFORMAT_BEGIN + 90 + 5 +170 + 1 + 91 + 0 + 92 + 0 + 62 + 257 + 93 + 1 +300 +CONTENTFORMAT + 1 +CONTENTFORMAT_BEGIN + 90 + 0 + 91 + 0 + 92 + 4 + 93 + 0 +300 + + 40 +0.0 +140 +1.0 + 94 + 2 + 62 + 0 +340 +11 +144 +4.5 +309 +CONTENTFORMAT_END +171 + 1 +301 +MARGIN + 1 +CELLMARGIN_BEGIN + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 + 40 +1.5 +309 +CELLMARGIN_END + 94 + 6 + 95 + 1 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 2 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 4 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 8 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 16 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END + 95 + 32 +302 +GRIDFORMAT + 1 +GRIDFORMAT_BEGIN + 90 + 0 + 91 + 1 + 62 + 0 + 92 + -2 +340 +14 + 93 + 0 + 40 +0.045 +309 +GRIDFORMAT_END +309 +TABLEFORMAT_END + 1 +CELLSTYLE_BEGIN + 90 + 3 + 91 + 2 +300 +_DATA +309 +CELLSTYLE_END + 0 +XRECORD + 5 +B4 +102 +{ACAD_REACTORS +330 +B3 +102 +} +330 +B3 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 1 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 0 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +B6 +102 +{ACAD_REACTORS +330 +B5 +102 +} +330 +B5 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +B8 +102 +{ACAD_REACTORS +330 +B7 +102 +} +330 +B7 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +BA +102 +{ACAD_REACTORS +330 +B9 +102 +} +330 +B9 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +BC +102 +{ACAD_REACTORS +330 +BB +102 +} +330 +BB +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +BE +102 +{ACAD_REACTORS +330 +BD +102 +} +330 +BD +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +C0 +102 +{ACAD_REACTORS +330 +BF +102 +} +330 +BF +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 0 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 0 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 0 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 0 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 0 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 0 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 0 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 0 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 0 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 0 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 0 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 0 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 0 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 0 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 0 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 0 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 0 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 0 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 0 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 0 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 0 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 0 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 0 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 0 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 0 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 0 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 0 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 0 + 0 +XRECORD + 5 +C2 +102 +{ACAD_REACTORS +330 +C1 +102 +} +330 +C1 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +C4 +102 +{ACAD_REACTORS +330 +C3 +102 +} +330 +C3 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +C6 +102 +{ACAD_REACTORS +330 +C5 +102 +} +330 +C5 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +C8 +102 +{ACAD_REACTORS +330 +C7 +102 +} +330 +C7 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +CA +102 +{ACAD_REACTORS +330 +C9 +102 +} +330 +C9 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +CC +102 +{ACAD_REACTORS +330 +CB +102 +} +330 +CB +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +CE +102 +{ACAD_REACTORS +330 +CD +102 +} +330 +CD +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 0 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 0 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 0 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 0 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 0 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 0 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 0 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 0 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 0 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 0 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 0 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 0 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 0 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 0 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 0 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 0 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 0 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 0 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 0 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 0 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 0 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 0 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 0 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 0 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 0 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 0 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 0 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 0 + 0 +XRECORD + 5 +D0 +102 +{ACAD_REACTORS +330 +CF +102 +} +330 +CF +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +D2 +102 +{ACAD_REACTORS +330 +D1 +102 +} +330 +D1 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +D4 +102 +{ACAD_REACTORS +330 +D3 +102 +} +330 +D3 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 0 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 0 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 0 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 0 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 0 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 0 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 0 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 0 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 0 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 0 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 0 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 0 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 0 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 0 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 0 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 0 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 0 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 0 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 0 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 0 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 0 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 0 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 0 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 0 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 0 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 0 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 0 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 0 + 0 +XRECORD + 5 +D6 +102 +{ACAD_REACTORS +330 +D5 +102 +} +330 +D5 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +D8 +102 +{ACAD_REACTORS +330 +D7 +102 +} +330 +D7 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +DA +102 +{ACAD_REACTORS +330 +D9 +102 +} +330 +D9 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +DC +102 +{ACAD_REACTORS +330 +DB +102 +} +330 +DB +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +DE +102 +{ACAD_REACTORS +330 +DD +102 +} +330 +DD +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +E0 +102 +{ACAD_REACTORS +330 +DF +102 +} +330 +DF +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +E2 +102 +{ACAD_REACTORS +330 +E1 +102 +} +330 +E1 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +XRECORD + 5 +E4 +102 +{ACAD_REACTORS +330 +E3 +102 +} +330 +E3 +100 +AcDbXrecord +280 + 1 +102 +RTVSPost2010Prop28 +280 + 0 +102 +RTVSPost2010PropOp28 + 70 + 1 +102 +RTVSPost2010Prop29 +280 + 1 +102 +RTVSPost2010PropOp29 + 70 + 1 +102 +RTVSPost2010Prop30 +280 + 1 +102 +RTVSPost2010PropOp30 + 70 + 1 +102 +RTVSPost2010Prop31 +280 + 0 +102 +RTVSPost2010PropOp31 + 70 + 1 +102 +RTVSPost2010Prop32 +280 + 0 +102 +RTVSPost2010PropOp32 + 70 + 1 +102 +RTVSPost2010Prop33 +280 + 0 +102 +RTVSPost2010PropOp33 + 70 + 1 +102 +RTVSPost2010Prop34 +280 + 0 +102 +RTVSPost2010PropOp34 + 70 + 1 +102 +RTVSPost2010Prop35 +280 + 0 +102 +RTVSPost2010PropOp35 + 70 + 1 +102 +RTVSPost2010Prop36 +280 + 0 +102 +RTVSPost2010PropOp36 + 70 + 1 +102 +RTVSPost2010Prop37 + 90 + 50 +102 +RTVSPost2010PropOp37 + 70 + 1 +102 +RTVSPost2010Prop38 +140 +0.0 +102 +RTVSPost2010PropOp38 + 70 + 1 +102 +RTVSPost2010Prop39 +140 +1.0 +102 +RTVSPost2010PropOp39 + 70 + 1 +102 +RTVSPost2010Prop40 + 90 + 0 +102 +RTVSPost2010PropOp40 + 70 + 1 +102 +RTVSPost2010Prop41ColorIndex + 90 + 18 +102 +RTVSPost2010Prop41ColorRGB + 90 + 0 +102 +RTVSPost2010PropOp41 + 70 + 1 +102 +RTVSPost2010Prop42 + 90 + 50 +102 +RTVSPost2010PropOp42 + 70 + 1 +102 +RTVSPost2010Prop43 + 90 + 3 +102 +RTVSPost2010PropOp43 + 70 + 1 +102 +RTVSPost2010Prop44ColorIndex + 90 + 5 +102 +RTVSPost2010Prop44ColorRGB + 90 + 255 +102 +RTVSPost2010PropOp44 + 70 + 1 +102 +RTVSPost2010Prop45 +280 + 0 +102 +RTVSPost2010PropOp45 + 70 + 1 +102 +RTVSPost2010Prop46 + 90 + 50 +102 +RTVSPost2010PropOp46 + 70 + 1 +102 +RTVSPost2010Prop47 + 90 + 50 +102 +RTVSPost2010PropOp47 + 70 + 1 +102 +RTVSPost2010Prop48 + 90 + 50 +102 +RTVSPost2010PropOp48 + 70 + 1 +102 +RTVSPost2010Prop49 +280 + 0 +102 +RTVSPost2010PropOp49 + 70 + 1 +102 +RTVSPost2010Prop50 + 90 + 50 +102 +RTVSPost2010PropOp50 + 70 + 1 +102 +RTVSPost2010Prop51ColorIndex + 90 + 256 +102 +RTVSPost2010Prop51ColorRGB + 90 +-16777216 +102 +RTVSPost2010PropOp51 + 70 + 0 +102 +RTVSPost2010Prop52 +140 +1.0 +102 +RTVSPost2010PropOp52 + 70 + 0 +102 +RTVSPost2010Prop53 + 90 + 2 +102 +RTVSPost2010PropOp53 + 70 + 1 +102 +RTVSPost2010Prop54 + 1 +strokes_ogs.tif +102 +RTVSPost2010PropOp54 + 70 + 1 +102 +RTVSPost2010Prop55 +280 + 0 +102 +RTVSPost2010PropOp55 + 70 + 1 +102 +RTVSPost2010Prop56 +140 +1.0 +102 +RTVSPost2010PropOp56 + 70 + 1 +102 +RTVSPost2010Prop57 +140 +1.0 +102 +RTVSPost2010PropOp57 + 70 + 1 + 0 +ENDSEC + 0 +EOF diff --git a/tasks/candidate-1836-hardware-cad/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1836-hardware-cad/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b12a535cd613c4795605ce9d1e5f4fdec1378707 --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,397 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "README.md": "e0b41c9064b0a5b93beabea012cd49525f6588c3bf3fad7b51f5eb38bde353ca", + "run_repair.py": "791db713d676df35fb50980e6138b71bc11641f93e719de3386b862932e105a8", + "vendor/ezdxf/LICENSE": "db97ca426fc0d2b8124145de0f36181db73e6e713ce642d42fed2efc442edf19", + "vendor/ezdxf/MANIFEST.in": "2205f36c89964d78be0ff266ad8499239e11d162a4921907b1f31c16e8f053b3", + "vendor/ezdxf/README.md": "c4195c41c14cd911234a5ec1becf936ddc9b4f41f5a0a0b42565b220bd1842aa", + "vendor/ezdxf/examples/acistools/3dsolids.dxf": "8193d9917354a9165d500098aa31209218f0b3d6bf3b24632b89003295806c4d", + "vendor/ezdxf/pyproject.toml": "cda1010ba506bf899f49ab6920e0412e275e5b0f3aeb8c49f06ee11e0618be23", + "vendor/ezdxf/setup.py": "c52c2e8478daf5c768b1195dfdfee77ffd6c00e0b5a1c45b1b3fea875f671129", + "vendor/ezdxf/src/ezdxf/__init__.py": "6fb6ce1e3b4066825af46ae40bb1ba2aa64e05860e8bb95e7f1dcd6e1fd39ff0", + "vendor/ezdxf/src/ezdxf/__main__.py": "1f2cef31be5c2a7220d91d24123a73622f6d553acae4f2e74cb602422f880232", + "vendor/ezdxf/src/ezdxf/_options.py": "120de38a90e7a90b838e9005379db424470c14feacdc9faa71c328d326979ae6", + "vendor/ezdxf/src/ezdxf/acc/.gitignore": "75734e0bf2938bbadf0893d2752cc3853ec1e9554336be51dc617ead39cc3ca3", + "vendor/ezdxf/src/ezdxf/acc/__init__.py": "e80e7bc0ea6ad20a1949cbd98422ac5089a46a95c1851682343a2ac2e9d81636", + "vendor/ezdxf/src/ezdxf/acc/bezier3p.pyx": "8a1c13d5e8ca1dac72e60877969ea3e5e4223c801a078def9f6ffcc02b63af96", + "vendor/ezdxf/src/ezdxf/acc/bezier4p.pyx": "73eb656808be945cc119435aea4a1d01c6b712db81398ce4f4dd206c8329b39b", + "vendor/ezdxf/src/ezdxf/acc/bspline.pyx": "47b6b29168b9fb0f68ab77ae7ec9b3a6fe465025ee8b11d6c9fb8000be219eae", + "vendor/ezdxf/src/ezdxf/acc/constants.h": "26f01a5a5e8b06e6eeb99321d7c66ed4f2db8f026f105a0884e6d8fd2f6f318f", + "vendor/ezdxf/src/ezdxf/acc/construct.pyx": "1f86a7aeb7af0761c8fb4918f41f53779167aa6b934bcba3c87de428ad8df3fc", + "vendor/ezdxf/src/ezdxf/acc/linetypes.pyx": "9ac2093ea1299ec40673b92d2def0ae98ad5fbcfd728ab49173ea13103396f96", + "vendor/ezdxf/src/ezdxf/acc/mapbox_earcut.pyx": "a8713cba41a2ecd0871aa2d165988d76d605b6d855c22541801bec633b128f19", + "vendor/ezdxf/src/ezdxf/acc/matrix44.pxd": "2490922e5c17927bf5afeaf51943108597028777c0d505ab93b3f1a7d9a5bd45", + "vendor/ezdxf/src/ezdxf/acc/matrix44.pyx": "8cc1b0f5483ae02cf8e1ce9d2c1dbfdbd38a2b615c27da500faf50348b5dd5bf", + "vendor/ezdxf/src/ezdxf/acc/np_support.pyx": "cfbe1a9207f36081387998bf9cd0b517f7acde9e99927776338a676844eeb4ae", + "vendor/ezdxf/src/ezdxf/acc/vector.pxd": "895fcd350dbf59fce3bbb45712f40edeff8a1f817a43bb6d38db615979cd4600", + "vendor/ezdxf/src/ezdxf/acc/vector.pyx": "d438f32fc77f73b0645df9c5e864fe8ef3d5db424e0c528332d12026f116b42c", + "vendor/ezdxf/src/ezdxf/acis/__init__.py": "2ee997aa3f24047e93ae09a8aa017cf0b993591b2787cbd1e18caac64a061ab1", + "vendor/ezdxf/src/ezdxf/acis/abstract.py": "9a6b7cd85bdf9eb5afb064a1cdd9490fddefa349418dee787d9bbcf26ae66f39", + "vendor/ezdxf/src/ezdxf/acis/api.py": "3f635580fc958b89363f05c78373fc18d0e45cfb202bb83b053a771ce287c069", + "vendor/ezdxf/src/ezdxf/acis/cache.py": "ccd8c32348136c3e6941a6256243d9d1f51f1aace0db57a504db96f855d76ed4", + "vendor/ezdxf/src/ezdxf/acis/const.py": "0ac5def232a55cd4cb6f4903bd4e9fe40d7a9284b23ebd21243137a63ea00c95", + "vendor/ezdxf/src/ezdxf/acis/dbg.py": "67d31b087dffba79e8dba823353a3de6f1d1cc36d18c717addd63f28d0f26c62", + "vendor/ezdxf/src/ezdxf/acis/dxf.py": "3958a82a81e3926673016b8760e0556d4171ed1164a23b757e2078b421a0635a", + "vendor/ezdxf/src/ezdxf/acis/entities.py": "61137e27746e3f3b3e32256aa2b3b2b01ebfa6f3da2e7b14cabe424004e73068", + "vendor/ezdxf/src/ezdxf/acis/hdr.py": "8d143828dd1ec2b65659811df5cd8f0aeddf201406bdf90d34e64c005519328b", + "vendor/ezdxf/src/ezdxf/acis/mesh.py": "9be32b3e1f471b96e87791638eaf0e4690ff071d6527305c29802206d80fde7b", + "vendor/ezdxf/src/ezdxf/acis/sab.py": "54f226eb26de203a69589a2785842e85889d50a5b7d8c2f72a421c908d5a3932", + "vendor/ezdxf/src/ezdxf/acis/sat.py": "3aa0ae6a3aa12c1598ac840a0a897222289dd2d9edd4089e270572f446842052", + "vendor/ezdxf/src/ezdxf/acis/type_hints.py": "0c8a5ac824e3d2fc048494c1a464e4c9d6e56e1fd4fe32840f8a6cc24a930840", + "vendor/ezdxf/src/ezdxf/addons/__init__.py": "dd94d136daddb68c7ee70ab58cabb855c8338e6fb520c8038329ae30ce71a996", + "vendor/ezdxf/src/ezdxf/addons/acadctb.py": "994d485cf9c90dcbe19c93fe12a07f419408dac44ce99752cda5162abff755ef", + "vendor/ezdxf/src/ezdxf/addons/acisbrowser/__init__.py": "7c343bc0397847fa4c5ff0872793ba25464ba019b4e1872ab9447d02454b13ba", + "vendor/ezdxf/src/ezdxf/addons/acisbrowser/browser.py": "090ad6e38698aad66b898ab0efdab279e7c5d1c3906a6b068b57fa15fa157997", + "vendor/ezdxf/src/ezdxf/addons/acisbrowser/data.py": "c8a1bf5bd501ac4a124436915e7fa1526b33da2b87d2bf9fffe5883987d8652b", + "vendor/ezdxf/src/ezdxf/addons/binpacking.py": "b155d2c6a089cb3262c95a57909c0a4fd35c97150bda54ea67e2bccd6e7bb240", + "vendor/ezdxf/src/ezdxf/addons/browser/__init__.py": "fe8de307b91977dcffb457a681559bc43cf02e71b3ad2f2b958479360bd6d131", + "vendor/ezdxf/src/ezdxf/addons/browser/bookmarks.py": "8b957735d95a0ee3e75a308fedaeda9521091fce124aedaf5b5a71fdc8634e2b", + "vendor/ezdxf/src/ezdxf/addons/browser/browser.py": "3d3e03c9849faa7efffddf710dcd25c0c9ac62dcc951837a70a908684d925f19", + "vendor/ezdxf/src/ezdxf/addons/browser/data.py": "ef386fd0a42e40a4501bb31ebcb6d57f1cf282d34c4a12b340cf227af8e329f9", + "vendor/ezdxf/src/ezdxf/addons/browser/find_dialog.py": "15f2370a111bee785cf1b8d7dd128ba1f40bd50f2b0fdaca87031d54e882c958", + "vendor/ezdxf/src/ezdxf/addons/browser/find_dialog.ui": "f32171b02fb3cf119ad4837269e593aa89714dce9092473e6d176c856ddf9740", + "vendor/ezdxf/src/ezdxf/addons/browser/loader.py": "d8a9ed5fd350411780dda13727a26c7b2c7417382b61ab904e2b1ca8acb83d09", + "vendor/ezdxf/src/ezdxf/addons/browser/model.py": "9edd35b27252525f411c10362a69ab96ce8272b70bb40d16fa2d5c7af64b2f8a", + "vendor/ezdxf/src/ezdxf/addons/browser/reflinks.py": "2f31bf292ea8011cedfe99cfee7b6290be3771c660ad9eeff3e84938f77fc8aa", + "vendor/ezdxf/src/ezdxf/addons/browser/tags.py": "9362393a9333f9a69b3e982b74572b674c25312d7beb0fc1483725fec19a709a", + "vendor/ezdxf/src/ezdxf/addons/browser/views.py": "91cc22c164eaf80100f2d9a9857d1e4e77604b86f741d2566d8f79d8fdf100e9", + "vendor/ezdxf/src/ezdxf/addons/dimlines.py": "da981059f227dec80837a154487463ce5f9db9cbee6dc4b1832a817ec123a354", + "vendor/ezdxf/src/ezdxf/addons/drawing/__init__.py": "2bf23ee30ef526ba556430186aa3950a050f7000102130e84252e4696a790f9d", + "vendor/ezdxf/src/ezdxf/addons/drawing/backend.py": "ee478c1ee2b7192b505c5d417425f65d916f95b25290f714139f7716dbe63538", + "vendor/ezdxf/src/ezdxf/addons/drawing/config.py": "db0db7c07faf368f6aa01bdf1c842a2e87d064e190eb18f4287386fd43a0bf89", + "vendor/ezdxf/src/ezdxf/addons/drawing/debug_backend.py": "2e5d8a55a074a5d7505783f90c3b6ab32fe57ef249880c7f4e1b2f396bad3543", + "vendor/ezdxf/src/ezdxf/addons/drawing/debug_utils.py": "2528a43c756c8d98a83c0e058a26db30e6d9d19764529f0005fcf3f6cd3759d4", + "vendor/ezdxf/src/ezdxf/addons/drawing/dxf.py": "ed12218d7a42ac0f651261339c54515f437ddfec8b6e4f6fff032fd5a0a37337", + "vendor/ezdxf/src/ezdxf/addons/drawing/file_output.py": "9f75b9effcba783828fcafdd4a4b5c53ea3bf9102d7ad7830e8c6f8eec0b27b9", + "vendor/ezdxf/src/ezdxf/addons/drawing/frontend.py": "fafec71d0a22a53c59953017ab952dca01117704ba7a264f2d4b1eb62b2c5895", + "vendor/ezdxf/src/ezdxf/addons/drawing/gfxproxy.py": "0f0128aebca16c89a71b60f51a93aec1ed21a97ffb91ccd553ff66e96943d7c0", + "vendor/ezdxf/src/ezdxf/addons/drawing/hpgl2.py": "feefdb9cd729a308656732a044fab7df2d7417e6c983bc09ff8573d9f755898f", + "vendor/ezdxf/src/ezdxf/addons/drawing/json.py": "180ca23df88a8f13f26cde2d3efdd824ec45d8eae362e0cc4fe21b5b6a28e0f8", + "vendor/ezdxf/src/ezdxf/addons/drawing/layout.py": "fb7fa7363572630377f67c1ee71a531f3e8680555bef6bfa5b3601bce8dd3663", + "vendor/ezdxf/src/ezdxf/addons/drawing/matplotlib.py": "a9d0bd32a6a7304af75825ed12ad15a1d9272437668edfec9364c65a86f33e66", + "vendor/ezdxf/src/ezdxf/addons/drawing/mtext_complex.py": "e62ec1825cc1b27f058fd4223de8e9fb2ddafcff28542bc674a49f8a1af464f3", + "vendor/ezdxf/src/ezdxf/addons/drawing/pipeline.py": "79e6ba687194fe7410a80a5065cca5905871150cc5c8af2c53f3c35bc79bfcc7", + "vendor/ezdxf/src/ezdxf/addons/drawing/properties.py": "775f76698876a77b011bcc7ee4446df604eafdab8ba15454e640a95ff1757a3d", + "vendor/ezdxf/src/ezdxf/addons/drawing/pymupdf.py": "12d9d5dac83910bb2c3b844066a53758c156067b0645b4cb8ae00ae8339c79f2", + "vendor/ezdxf/src/ezdxf/addons/drawing/pyqt.py": "71557d58f370293e2e7e11e0256721a19b76a483803a13b8dd1c70174d753051", + "vendor/ezdxf/src/ezdxf/addons/drawing/qtviewer.py": "bf1226a3201a209f4b36f5671e1e8372c166a71fbec8f16ac81d6ddd7c35147b", + "vendor/ezdxf/src/ezdxf/addons/drawing/recorder.py": "b7d20b370cf3cff2a675575808a9267b8ae544279479d3f6deed5debddff0d01", + "vendor/ezdxf/src/ezdxf/addons/drawing/svg.py": "9aad09d0b518add53e831a43b5c435f48994d14e569f2f17bdcfa3b06ec9c008", + "vendor/ezdxf/src/ezdxf/addons/drawing/text.py": "3ad81b89dbbb7d27f81644d598119c80955236496ba4d2adf05b86cb7bb57559", + "vendor/ezdxf/src/ezdxf/addons/drawing/text_renderer.py": "97d966041a3390c8025e15fb70395a8bb1a2ad58ec6fcc86af382b7e66ae5d2e", + "vendor/ezdxf/src/ezdxf/addons/drawing/type_hints.py": "410d8ea9b4f225a22bee06285b4af0cbaddc04641a067833223c976a62e09acb", + "vendor/ezdxf/src/ezdxf/addons/drawing/unified_text_renderer.py": "6990e5509abaf5ebbf0b602d917904cc7f290b2943625ea8f1aa50a15416e5aa", + "vendor/ezdxf/src/ezdxf/addons/dwg/__init__.py": "11536e35380fb0ef1429a284be63cc9700b601b60de1bf3c258c29c5c7a8ea0e", + "vendor/ezdxf/src/ezdxf/addons/dwg/classes_section.py": "cb0b84eef4cb141619516f46949d117f78877cea6b2c621b016b62bf543bb752", + "vendor/ezdxf/src/ezdxf/addons/dwg/const.py": "2f7ab36666e1c85cee42920e82662e93c6b663547e3b9feffb562ee722e4bebc", + "vendor/ezdxf/src/ezdxf/addons/dwg/crc.py": "29aea61c8f0ef334a3c72341fda55658bbab9dc52e4635f704cbffa16bd5b228", + "vendor/ezdxf/src/ezdxf/addons/dwg/fileheader.py": "75410a54568f3ea8f068abf947c9441a241940fd7cb378f32efb73b39a22c1f4", + "vendor/ezdxf/src/ezdxf/addons/dwg/header_section.py": "18b02509ffcb884f829dca7ab4952fd844a1aab02479f92458e7c43113b4d88b", + "vendor/ezdxf/src/ezdxf/addons/dwg/loader.py": "c8f5f0d9a069d27020c94135edc2707082429f69b27e8968a623637969e1bab0", + "vendor/ezdxf/src/ezdxf/addons/dxf2code.py": "c764386d4908d1a7542742bcd240df69a5195b9f6808b4854025da1c33fb65d9", + "vendor/ezdxf/src/ezdxf/addons/genetic_algorithm.py": "a344f62d05ff6a56c1d0bee7ddc85d2ce41381fb043405f33fc716060d955404", + "vendor/ezdxf/src/ezdxf/addons/geo.py": "21a06dc020a89259c5b9f1f9b446645c351ed0033d5423683575251aaeaf0398", + "vendor/ezdxf/src/ezdxf/addons/gerber_D6673.py": "951d1f341e374ee96195238a547a55bd8a1b4864e5bd5f6515851e7f251d4941", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/__init__.py": "03317d0ffb52a6b74ee308c55031ff69323ee4c88854006084bb814444ab7882", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/api.py": "d1a696ab1ed9c929c94026760545cb9043ba301a4768ccccd63cf9a6f6982c40", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/backend.py": "c3f3230de8af9a17f488bfa7388da354450aeddc53442de0739a13a3827aa456", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/deps.py": "f3c3ccb7f6b8a3d347faa59d7538774b3e3cc6f3411911514301b74fb2105021", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/interpreter.py": "1ef4740ee67780b2f68b5aef9419209198bc09e19ca4e5538adabc7806212e49", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/page.py": "49d068ed2325bad817224a0df030309ad4ea90bb6fd0a5e5ef3eed9aef42d453", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/plotter.py": "2cc305a5c129c14f6e81226ab68d57c81c8bea80072e89c7386317c50c84398d", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/polygon_buffer.py": "cab6ad521571126a1710490226e0947715739ab630042faa221c0f6bfc8ad02a", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/properties.py": "84370a223af4359abb58e664a037e6f93fa82f6be7980699b1a6c5ba54de840f", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/tokenizer.py": "9ff908ed66e007d033bc22cf11e2a58c80068ba8b4da8d49b43a05697aac90d5", + "vendor/ezdxf/src/ezdxf/addons/hpgl2/viewer.py": "0ce2ae46dcf3eb57a3ddb460daf4089fdabab3e7b8ee3cdd26a9c8a0590591bb", + "vendor/ezdxf/src/ezdxf/addons/importer.py": "a212bdf75431a988b4c3d50ec834f702b24ef6a43893507f9fa1a3a5875bd203", + "vendor/ezdxf/src/ezdxf/addons/iterdxf.py": "ed96515870749777227576f8257987e090f616b4b197cc95468cc7fc01b1b8ee", + "vendor/ezdxf/src/ezdxf/addons/menger_sponge.py": "6c0986b5d6a661c96fd36e5b30f160ed40028a661e3fd69497a08596438d140d", + "vendor/ezdxf/src/ezdxf/addons/meshex.py": "bd0e5748b6ef11231beb314ace0a8e2e3cb66458d755e7f476a73b195e299cf5", + "vendor/ezdxf/src/ezdxf/addons/mixins.py": "9159e9afc1f5bd9813f651b8f3cf7676305c427d2e5a167d274b1660f92efcfa", + "vendor/ezdxf/src/ezdxf/addons/mtextsurrogate.py": "b21342faa798c169b48e69034321ec63917243d9f0a0947e38e92f08bbf4fd34", + "vendor/ezdxf/src/ezdxf/addons/mtxpl.py": "538e7069e93e506ee9edbda79f55d866722ddc7f95b53b083d78a176ae9da4d7", + "vendor/ezdxf/src/ezdxf/addons/odafc.py": "6cfc5a28a330e6672456968237128cf13007e81eb392df3c4061e0aaeec34f38", + "vendor/ezdxf/src/ezdxf/addons/openscad.py": "36d40a23edf6c076e837bae1b669e52fd230b7854d1890bf56d09257bf5b850a", + "vendor/ezdxf/src/ezdxf/addons/pycsg.py": "98386c492c5c8f510e764cd4874e83beccafa97bce4973f46eba16a33e3f7065", + "vendor/ezdxf/src/ezdxf/addons/r12export.py": "ba393aa20016d4ed6834938e096cd388268fdc6a857dcd3651668d8b44aab8d9", + "vendor/ezdxf/src/ezdxf/addons/r12writer.py": "30482188c1dbd0d49392b9c674d1dfe52a098624729b46444bdd42e9bf0c6f10", + "vendor/ezdxf/src/ezdxf/addons/sierpinski_pyramid.py": "f2d21e751f5a542a0cdae304ca54eea5b2558b2e4acc4108659f2c13580df191", + "vendor/ezdxf/src/ezdxf/addons/tablepainter.py": "5ce8f0339346b29980ac22463624b7e8b2c583b7439edc6e30d0188530b8eb9a", + "vendor/ezdxf/src/ezdxf/addons/text2path.py": "e2b6a2a39def3289536e17b0ccae42641b41e25bf5a14a6d18f3d50f482f6e2f", + "vendor/ezdxf/src/ezdxf/addons/xplayer.py": "bea02984d3a6428f098bac673e1eccc8c84ee084215ae73597bdc745a3d52b38", + "vendor/ezdxf/src/ezdxf/addons/xqt.py": "1524133231cff27e251d525aad4d4a0492d0b781dbc904fa4df54fc4f83808a5", + "vendor/ezdxf/src/ezdxf/appsettings.py": "7c321fcf21928346ebfdfa1cc3199bfb4241186c736013f74aac93bba965b05b", + "vendor/ezdxf/src/ezdxf/audit.py": "96c5cef57d3fda1c8230554ba4fae38e8feee36c18a38b3d0ba8c813572d5773", + "vendor/ezdxf/src/ezdxf/bbox.py": "aafdb666535cb054eeb4553cc47d3bf8385a9d02f8d9cd5710b7f8f4a8ae09e7", + "vendor/ezdxf/src/ezdxf/blkrefs.py": "571e172aee92b3d1cd8d713d4d12f1bc58c7b9a28b115347ea7bec954af359e7", + "vendor/ezdxf/src/ezdxf/colors.py": "2dc20b764a7ca766f9719f954974e46348595669a4ae8eb7dd4da512e0ed16fb", + "vendor/ezdxf/src/ezdxf/commands.py": "4472fe1c2cb71b4d6e9faabdd36c5ffef8b7db7068853b5578939c5a5bb7b37f", + "vendor/ezdxf/src/ezdxf/comments.py": "2467c3f0480958fe003f81cadd844915e1451b9e8732369cd0de671d308be158", + "vendor/ezdxf/src/ezdxf/disassemble.py": "b20b203d7ce9b542f7182a613a71bae5b40bc8bb59aa153a680992187e72786f", + "vendor/ezdxf/src/ezdxf/document.py": "1d501ebac64ef299c5555cf2f7bd85dd8b5b7a4ab85c769679e062729a05d350", + "vendor/ezdxf/src/ezdxf/dwginfo.py": "888e52ada5fb4dea17567571ddf71877fe65f058dc422bcc2343326c624a9627", + "vendor/ezdxf/src/ezdxf/dynblkhelper.py": "e1145ee123ad067550ca59a414bb99f1854d10409819b333d8e104547a28c59a", + "vendor/ezdxf/src/ezdxf/edgeminer.py": "4ad8f3fe2a4be2229710614a61a9476d356ddd51e3e354d8a836fcb1ec8c4913", + "vendor/ezdxf/src/ezdxf/edgesmith.py": "806d934099fc78d28cfdf7b957e904fa52fbba872047f82f3921202afbf4b88d", + "vendor/ezdxf/src/ezdxf/entities/__init__.py": "189f561047b814649e384dfe97c323566fe4c6cd14ebd86582971de4a340f765", + "vendor/ezdxf/src/ezdxf/entities/acad_proxy_entity.py": "9344f19f0dc9c2b372add73e49ad044b11471bbaaf694ed7d9273927db35579b", + "vendor/ezdxf/src/ezdxf/entities/acad_table.py": "66209d150937008f0bc387c9caa5418c26af4e201750ab2ff9fbca4e4af49fff", + "vendor/ezdxf/src/ezdxf/entities/acad_xrec_roundtrip.py": "72e9ff33ad5253089945bec60b19998376db398f231f154e199a38a2416d0ab2", + "vendor/ezdxf/src/ezdxf/entities/acis.py": "65e3e4b774f35d57504250cf83b8928e7c0c819bf9964b427a835b1bf1841d8c", + "vendor/ezdxf/src/ezdxf/entities/appdata.py": "2c91a688841501d9951c6d49d05baa69b7753557689209d405b01172816b87f2", + "vendor/ezdxf/src/ezdxf/entities/appid.py": "e5ef5c80507b542bbe582d71aba5e42b85982389380ce055d00132cc26cbd414", + "vendor/ezdxf/src/ezdxf/entities/arc.py": "8d3b15790825d19256e37e60a88471fa1ae7faee220e139a3be1d246f65dc025", + "vendor/ezdxf/src/ezdxf/entities/attrib.py": "5b6f6ba3776e8ec4b4418782f9207f567c76b8e3f19c1f7292347793e437b843", + "vendor/ezdxf/src/ezdxf/entities/block.py": "28c9eba0dc48ed386732a8d76c3315407351a951f4191989abe68268ae81d16e", + "vendor/ezdxf/src/ezdxf/entities/blockrecord.py": "ffd9006fdd99e7b863ac33c800894ff19060ec9577cd6d380dabe52917be0c75", + "vendor/ezdxf/src/ezdxf/entities/boundary_paths.py": "5b1cd54669a0b04b3bca80e5d852b4efa5fb4e992956b1cdc3c4f270e2784618", + "vendor/ezdxf/src/ezdxf/entities/circle.py": "8362513f37049ef53dff29a690de290f21ae8c9bc6b178580ac3b76619d7769d", + "vendor/ezdxf/src/ezdxf/entities/copy.py": "c1e0104a9baeb0033fc096ad874b27988c053bf98027a22eaf18f776a096dafe", + "vendor/ezdxf/src/ezdxf/entities/dictionary.py": "91bef1d012a5ee294d5e221daec7d39b327fc37366600d7f7d3c2de7b0baf9c8", + "vendor/ezdxf/src/ezdxf/entities/dimension.py": "23507e476319d3dd89215593b66c2c5a08557b4855c9909305ebdb67e69a45a9", + "vendor/ezdxf/src/ezdxf/entities/dimstyle.py": "9586dbe5759f58c571bb7d32b589c529ed03703e5146a877eacf30ca098e435f", + "vendor/ezdxf/src/ezdxf/entities/dimstyleoverride.py": "ab2f330333279b2bb0903295b17513098d9bf07c2a317fe9de93105a81c8c4b4", + "vendor/ezdxf/src/ezdxf/entities/dxfclass.py": "aac6e2e3e06b9ec784e016e0818dbbe14d8727bd1562a1b7a9f3f33194cfeed6", + "vendor/ezdxf/src/ezdxf/entities/dxfentity.py": "c463501d67d8b5da6735fce6bc57e9be8dd5412abad89ff0b3568f0bdd4d1436", + "vendor/ezdxf/src/ezdxf/entities/dxfgfx.py": "416ee3a85f5cbf9bc891da2489b6491c310c9dc22c5cc1457b81ffffecc121ec", + "vendor/ezdxf/src/ezdxf/entities/dxfgroups.py": "25917e507350c0c9d02865d683ea93532bfb430b8c45839d9aa435e6cb6c3a80", + "vendor/ezdxf/src/ezdxf/entities/dxfns.py": "9d752495a91e864dd13141a7a3c8d783850f5eeff8105e61027b607511afbae0", + "vendor/ezdxf/src/ezdxf/entities/dxfobj.py": "4426fcbc0f9106ffde248d43e9aebcbb4a50e9db034e27478ab4e0988f0cc59c", + "vendor/ezdxf/src/ezdxf/entities/ellipse.py": "82e7c70cd585d89340fcccb2dcc5806f396baa4dca614eee7c9c8baf6580f61b", + "vendor/ezdxf/src/ezdxf/entities/factory.py": "2fab76c79b24b8d4b8597aeff98300ca09f2b596767b051ef142dca79b7cf3c1", + "vendor/ezdxf/src/ezdxf/entities/geodata.py": "98b276796f1cb1427e9edfbd979019bc611cb5fff050a6634d7330f389e4e455", + "vendor/ezdxf/src/ezdxf/entities/gradient.py": "6a2af106a10e31ddf5549128bf51e5a31e9f2f77a3fd6a7b1d303d0884b4c3a1", + "vendor/ezdxf/src/ezdxf/entities/hatch.py": "9fffed475879d238a5f869121ab1b7ed53d44e004193394282a0e4d269b6eb1f", + "vendor/ezdxf/src/ezdxf/entities/helix.py": "9434adba63c4185d2af62f4ef959a929082684123b1b1dd283dc02079c02bd1e", + "vendor/ezdxf/src/ezdxf/entities/idbuffer.py": "2dc173f54e0909d86e4edc2337e74a44e7edd9bf496e185d6e42bf365f257457", + "vendor/ezdxf/src/ezdxf/entities/image.py": "aba9c3a84492e0cc47736971bd7066c875c24934169f858a68e8d177fe45cb2f", + "vendor/ezdxf/src/ezdxf/entities/insert.py": "511f29c6ec9642803c122fcb1ddb6d2c3347c0d2ba668197ce330c607862544a", + "vendor/ezdxf/src/ezdxf/entities/layer.py": "3c3a1296eae99577f3484bad73e12cd41706a33e88bb3999992001d254ddd796", + "vendor/ezdxf/src/ezdxf/entities/layout.py": "ad4c80e88f5e6bdc650b55a7e76fcb74056b5ad702798c311030ed4a7b5eeb81", + "vendor/ezdxf/src/ezdxf/entities/leader.py": "918e20a1c3142f7393d69114ff9bd42065a33c9857fde7238bf864737ed1823c", + "vendor/ezdxf/src/ezdxf/entities/light.py": "e79eca0dd3c224fd261720b89afabad3cd6fe97ae02b6d6459318a34c5800372", + "vendor/ezdxf/src/ezdxf/entities/line.py": "f5ed5f336896c0f70396662b402aea89304a800e8fd41f9ee1125bf4ec16d264", + "vendor/ezdxf/src/ezdxf/entities/ltype.py": "93824c3611f76505a16e15e1c920418161155de09b5bae2534294be2bb89dd59", + "vendor/ezdxf/src/ezdxf/entities/lwpolyline.py": "c4f5e2933a01fe2df67947335fff9f8b1d7a66c76dd14c1c6a49ee012f41f035", + "vendor/ezdxf/src/ezdxf/entities/material.py": "d590f51cf29e2c7efd5dc51ac530646ced8e159a47a99c5233d89a2da4ff8565", + "vendor/ezdxf/src/ezdxf/entities/mesh.py": "3d2f5ee3becedbb8e91667de8c781325d29711fd83e56b64259307158dc6f544", + "vendor/ezdxf/src/ezdxf/entities/mleader.py": "9303d33c49ab200f22e2f659c05f7c2f61a197c821618b8e6e2012183ab05a59", + "vendor/ezdxf/src/ezdxf/entities/mline.py": "eee46cda3d1d2e3fa053cf4478f0bc0ed8b3df8d856b38490b2c446f57bc6038", + "vendor/ezdxf/src/ezdxf/entities/mpolygon.py": "e2c82ff5ac65953414d54358d689368aa3e85e6a92d8e0722c7efe6cf866fa37", + "vendor/ezdxf/src/ezdxf/entities/mtext.py": "365e3bf0ef94262edfd0438600c35a705de935312701f293d9ef07b8e8c39f9a", + "vendor/ezdxf/src/ezdxf/entities/mtext_columns.py": "509fa52e7bff7429dd1b262087769e33058811af54052da948ac51375d7e66aa", + "vendor/ezdxf/src/ezdxf/entities/objectcollection.py": "1f7eb2443ef8c511d116e94fb6ccbbb189490fb629b640539753a1f3d23ae748", + "vendor/ezdxf/src/ezdxf/entities/oleframe.py": "a3c31b79cecba088a5ac7e42e5fe7075e69e3d444fad10f3cf57f213960ed765", + "vendor/ezdxf/src/ezdxf/entities/pattern.py": "58e380ea044dc1a7a99b50cf84c8e57177b23418e6949de9beb8b818f22bb492", + "vendor/ezdxf/src/ezdxf/entities/point.py": "28499b3ed1e75e185253c8c13dafc32685c87af508ab2b931d5f169396bdbddf", + "vendor/ezdxf/src/ezdxf/entities/polygon.py": "52774ae4fd9d76d5885c5795494ffe80ae467a6926f6783fa5161030c796baf3", + "vendor/ezdxf/src/ezdxf/entities/polyline.py": "53f679785023d8a0ff0d14ea47f0f2617a0f6b0e945c3d98a07520c2a3e3d70f", + "vendor/ezdxf/src/ezdxf/entities/shape.py": "edc987551cbc996ec4270e1e1221d6ba8b5828138b853ee608cfa12d6331bd05", + "vendor/ezdxf/src/ezdxf/entities/solid.py": "aa5e7c49dbb09a3a29ea2a3af5b094e42426e35a6a40fc6149dcc90a43c685ae", + "vendor/ezdxf/src/ezdxf/entities/spatial_filter.py": "90b09163877bd0760d0c6df8fe877099427a256d556955bd92a81f41753272d5", + "vendor/ezdxf/src/ezdxf/entities/spline.py": "ded0d4ed638aeb04585589ed3755230d422734221ef45e23dc66ace4e47a8321", + "vendor/ezdxf/src/ezdxf/entities/subentity.py": "ab59db31396378c0148b114723cdfd30ce0c1464a807e0e1f3e86b7a9ded00e9", + "vendor/ezdxf/src/ezdxf/entities/sun.py": "02c855b02a65c8e67f397db10220d452e99727080cc5ce80d2c1deb8174ca273", + "vendor/ezdxf/src/ezdxf/entities/table.py": "915b7ca998cd56a37250ac9762b19030ec60068a34cd2b72640a79d5d9dd3c48", + "vendor/ezdxf/src/ezdxf/entities/temporary_transform.py": "038f98e887aa47b08f992749bbdba6ed15551d32aa1d3053162442e915088c7f", + "vendor/ezdxf/src/ezdxf/entities/text.py": "2fd0e80488240359241a6534031d7f0bb071b516cfb167f16fb8f9249cdc9ee0", + "vendor/ezdxf/src/ezdxf/entities/textstyle.py": "af01686b00b7b6e763be955094dc2ca5cef129f6961b7107c6171166871fdb90", + "vendor/ezdxf/src/ezdxf/entities/tolerance.py": "a19d6f2a63bedf3606ad6bf740d5931adcf3ed0c764d4868b6b09cd2c2068bac", + "vendor/ezdxf/src/ezdxf/entities/ucs.py": "cfa9ec73d565ed95ac29ef8a92d6400b81c3666d933412105a17659f98a0b4e7", + "vendor/ezdxf/src/ezdxf/entities/underlay.py": "9c715c4d4dff5c4a94baa6cfd1059f4d424cd14d3bd66e6f6573082d37c83064", + "vendor/ezdxf/src/ezdxf/entities/view.py": "9910ee61aead8e1845fb9d8c012f89f658454cdd8215cfb143c8d39a773224c3", + "vendor/ezdxf/src/ezdxf/entities/viewport.py": "756ec5b4d4600a63c7f64dd57583ec538cf4f0fe4832e630702239e987618851", + "vendor/ezdxf/src/ezdxf/entities/visualstyle.py": "445d5a19e95a19817ab531e7c373e8d6f2793ee82e43f0e6e9aead8684bf8090", + "vendor/ezdxf/src/ezdxf/entities/vport.py": "5272d421b1f64027faa9313d60e2d1f5d2c53e7f3d488b9e450d0c3550006dc8", + "vendor/ezdxf/src/ezdxf/entities/xdata.py": "9bd850abf882e13d435cc2ebe131e842aaf4e24f2d900d64e1cbeb8b83016482", + "vendor/ezdxf/src/ezdxf/entities/xdict.py": "1e968781752ac12ae9f44f64acbade71c6637dc74c5fc36f6432f9b194fa822e", + "vendor/ezdxf/src/ezdxf/entities/xline.py": "63fd028686b61a5f7dcd6132bcaa7d3c202ce0893cb93c1e856cf6ddc29485f0", + "vendor/ezdxf/src/ezdxf/entitydb.py": "bd79c6d0f084cd67355ab27c830f007322a019cbc34c096a8bafd1dbb10b0912", + "vendor/ezdxf/src/ezdxf/enums.py": "cfdf4630e0a7b1b253640b4cf58184329419267f6844d8706a789e2f2cb60a83", + "vendor/ezdxf/src/ezdxf/explode.py": "bd774b26fb968209d88d7801f6e747a77635c787a6952f1a1ebf80746051aea3", + "vendor/ezdxf/src/ezdxf/eztypes.py": "8f512be4d58464587bf7daeffb3fa81f69147384648aca815fcf5fcff4f5c15e", + "vendor/ezdxf/src/ezdxf/filemanagement.py": "46d3b5657389de88c899c34e7c361ce349f0df6caccd3fdaa4661d9c3b6f9e77", + "vendor/ezdxf/src/ezdxf/fonts/__init__.py": "aca0c115a04d2d6a8adcbbd0c981403ea74b01d31cb9d3c882f0171c30d83e7a", + "vendor/ezdxf/src/ezdxf/fonts/font_face.py": "eb9ecb7a7174439812b8a355693b741feb8b7e3ae8a9fc3efe5bd78507205849", + "vendor/ezdxf/src/ezdxf/fonts/font_manager.py": "e5ca0e4cbc200a65948efc995f69a1f26e6a4c4b9a5ce5f27e9df7b0791700ef", + "vendor/ezdxf/src/ezdxf/fonts/font_measurements.py": "df395fcc9381e39abcf048c4f512a83d820e6cb2ac45787fd1ec2cb1989b90eb", + "vendor/ezdxf/src/ezdxf/fonts/font_synonyms.py": "33bcde66c09548906d1783dbfe05ec17fa8e07c725ebfb9221bc54050f55bf21", + "vendor/ezdxf/src/ezdxf/fonts/fonts.py": "7fe8fa289e19fb3694a51725b9c7ce0fdbadd46e9c4628d778c44164fd77a90a", + "vendor/ezdxf/src/ezdxf/fonts/glyphs.py": "0e6315f6647604cced158df4fd7e762e50d9dbb621e0f91b536e1e7165ddcc48", + "vendor/ezdxf/src/ezdxf/fonts/lff.py": "5779b5fd60aadcd2eaa23d36c1ed2945ded489ed18248696f4af4f97c09f1269", + "vendor/ezdxf/src/ezdxf/fonts/shapefile.py": "f550e556e0dcf81db918476f093c5518a3cad67f03175bc1d99c40c01d614185", + "vendor/ezdxf/src/ezdxf/fonts/ttfonts.py": "6a05399c95e0fcaadb8fd3cc31115f1c540ba7d14dc0b3114e81d43d8f6e613d", + "vendor/ezdxf/src/ezdxf/gfxattribs.py": "fb5e0e465a55751087eccdd62e03f972f8b6f6e30014d7cc15228944c608662e", + "vendor/ezdxf/src/ezdxf/graphicsfactory.py": "9e620196a2527ca302b739a172f97f9ace0e65d11cc6f63c7c709a03e6b5f8b8", + "vendor/ezdxf/src/ezdxf/groupby.py": "2cbdc9e55f858fa99f5da2f85979e907a115c7127fad35275a32f133484a02d7", + "vendor/ezdxf/src/ezdxf/layouts/__init__.py": "cb7163b9438c5d4c4e5dbfa77cdfa9dcc4c5d3dd17cba20970ab180ffbc4687a", + "vendor/ezdxf/src/ezdxf/layouts/base.py": "b73bac0a3dc06e151fe71782b89ca187e6f0b4415502a5de6416cbd3a2c53f83", + "vendor/ezdxf/src/ezdxf/layouts/blocklayout.py": "786098061f1fb8d30a4a178258725d5c29f047666958ffba8bf19bb7fe10ee1f", + "vendor/ezdxf/src/ezdxf/layouts/layout.py": "fd6d045130d84b1cc26f98ec63defd1d60b008f0edd14497c981eb6d3d2c896c", + "vendor/ezdxf/src/ezdxf/layouts/layouts.py": "acaf21336a154c55934793b0ec1cfa9ca551ea7162945a0a652f5434378da829", + "vendor/ezdxf/src/ezdxf/lldxf/__init__.py": "5f298cec121527bdf5e5eaee879ae8b1b12362f6001ea73594e3b39e27e43dab", + "vendor/ezdxf/src/ezdxf/lldxf/attributes.py": "feb678af8efc4896b797ebd380893b6ee1b3f8762ee43e55ca4d20ab3f800fe2", + "vendor/ezdxf/src/ezdxf/lldxf/const.py": "72cca642b257f387d265bf0b25409daf72aade602539db6e37723e8aafed164b", + "vendor/ezdxf/src/ezdxf/lldxf/encoding.py": "203aeb1113b982987b7766dcd710933821a4cd7ef5aa8800f005565fd5c921ee", + "vendor/ezdxf/src/ezdxf/lldxf/extendedtags.py": "a93b50c5512a971f0dae18e66db2e027b12e6c1c7d3a0f0e806072a6b24178a9", + "vendor/ezdxf/src/ezdxf/lldxf/fileindex.py": "b2ef1fc2466041d958a8565781d46f22d502660f35f7794ff4591cb9d490341d", + "vendor/ezdxf/src/ezdxf/lldxf/hdrvars.py": "2b92bd6e00bda1ab0bae38c785ed460f5320d631fd805da51ea6df18270262ac", + "vendor/ezdxf/src/ezdxf/lldxf/loader.py": "3eab9568db58fd8d9f09c02724a2cc8aea47f05ca61f9785d2747e88900df373", + "vendor/ezdxf/src/ezdxf/lldxf/packedtags.py": "65a6c9f2ab1fb8cf8a5f9c498a4869b2ef9d864666c397fd8ee39a903576c889", + "vendor/ezdxf/src/ezdxf/lldxf/repair.py": "903f2b02e7c8b1e4b646234a34846a6653f6c42c0cf194dcec210aae0b7d9425", + "vendor/ezdxf/src/ezdxf/lldxf/tagger.py": "03c5eafad5f5e82570ab72815bb107e5a9ef404da36e046cdcc9742eb594e97d", + "vendor/ezdxf/src/ezdxf/lldxf/tags.py": "f53074f8eb651ca2ca797f6ff70f9532c98d3a2a38b6fc9f5cc25395a6fe5c2e", + "vendor/ezdxf/src/ezdxf/lldxf/tagwriter.py": "2caf4fb57a71371ac14c91908dc7ca07f757ab2266705e69e07a6398d6910868", + "vendor/ezdxf/src/ezdxf/lldxf/types.py": "6b2d73b9194190ec06deb8f68879c07bceabc31fed3271ba175a2aab9b749b44", + "vendor/ezdxf/src/ezdxf/lldxf/validator.py": "c96d39f078500ab5ca5c3cff1339341c50467ab2989011e5cdc27f9eee9e6d19", + "vendor/ezdxf/src/ezdxf/math/__init__.py": "146a7e993457b8600eb2d6266692e679bd43d3d881082b1815638588add275c1", + "vendor/ezdxf/src/ezdxf/math/_bezier3p.py": "5438f7aa0ce42d44d4578c1134c764bea821037dae02bd42921ee4e4ffe0eff4", + "vendor/ezdxf/src/ezdxf/math/_bezier4p.py": "23c5fe6a1a69192e2ab058ebf06f16eb6e8745175fb1561c52d618ac50aa5ba3", + "vendor/ezdxf/src/ezdxf/math/_bspline.py": "84dafeb18672b2a171aa992642c542532018e84e223c102e47c8294ccdba522b", + "vendor/ezdxf/src/ezdxf/math/_construct.py": "ddeed16265db86f2351e48ca7f3dd47b4ed73d737b66bf76e64230bcf9726b9c", + "vendor/ezdxf/src/ezdxf/math/_ctypes.py": "5614a44e0e283d2bfb5b81b69436ca6bc83146bd6f81fb8639ce703f70828537", + "vendor/ezdxf/src/ezdxf/math/_mapbox_earcut.py": "cd3cb56498cb80487018c7233c17b197d48a6ce954cb298baffba55882471689", + "vendor/ezdxf/src/ezdxf/math/_matrix44.py": "ac044bf3963f95c2ce42e012fe8fa8bcba125695513540a2bb5a9a48640b1fa2", + "vendor/ezdxf/src/ezdxf/math/_vector.py": "ec24f1408a32e6fdc5eb23d5fb205e55d854f96defc6e8fe3757d2eb5d867085", + "vendor/ezdxf/src/ezdxf/math/algorithms.md": "4585d1905d3bf6dbea9e93f72c4a7acb76b5b9ddd006af7778f6b2feadf9f313", + "vendor/ezdxf/src/ezdxf/math/arc.py": "43523acdfbfd1924a200700fedd672cbfde56d71e7bb46ecd08a6916e727df79", + "vendor/ezdxf/src/ezdxf/math/bbox.py": "3e1e5f4f7e5c9f902529b65c621612395beb4a77dc6a1981fa7c2ecaa2a61474", + "vendor/ezdxf/src/ezdxf/math/bezier.py": "2d7aa88b6cc7117e1a724e275515788f06087fbeb3c61f169735d36b9efe34b8", + "vendor/ezdxf/src/ezdxf/math/bezier_interpolation.py": "9f70cfcdca081f8d53523972c17db72a4613903042a3735bbc39e8de97766c53", + "vendor/ezdxf/src/ezdxf/math/box.py": "f2fa0a39fed2e070fe3f5746bb34fa8d6e97d9b5114da2dd6aa0879e6a65ff7c", + "vendor/ezdxf/src/ezdxf/math/bspline.py": "9908c6428edf30535ec8aac6c68393890349668e391906adff6946d03be914ef", + "vendor/ezdxf/src/ezdxf/math/bulge.py": "af18f1f45744539bddbc48e14430129661c35688e4496847bab7e8682c1866dd", + "vendor/ezdxf/src/ezdxf/math/circle.py": "bb7602b6b13ac05cc2009ff650a8bd0d55c72a97747df489e48b35bcf234069c", + "vendor/ezdxf/src/ezdxf/math/clipping.py": "c8b2f96822d3a36ba4446d9d4dd852c45f862c45cdc6c49b209d4fe1c8161e53", + "vendor/ezdxf/src/ezdxf/math/clustering.py": "d7820248d2aceb2d8a5dd47501b8c50ddb53be6f6631eae827339f8c30d12d99", + "vendor/ezdxf/src/ezdxf/math/construct2d.py": "075357f3993b721cd7a658cc4be09a47bacde7e95dd76e5107417485fd57a66e", + "vendor/ezdxf/src/ezdxf/math/construct3d.py": "19b08b46b806aa71b753777299eb6b0a06f403c1b4c4b38b289afc1014d43bdd", + "vendor/ezdxf/src/ezdxf/math/cspline.py": "e090be6a87f194fad8d099aebf8224df6b5adbbb4bbe7a56130eef1cb738ffc3", + "vendor/ezdxf/src/ezdxf/math/curvetools.py": "47240ac4a45ddd2d5b59bc2773ec1640a704d4d09dfc46dd979cd07c3634e74e", + "vendor/ezdxf/src/ezdxf/math/ellipse.py": "535685163b4e1e1fb4fc5833508d04c0857425d9a460240b7a5c484e794ffa08", + "vendor/ezdxf/src/ezdxf/math/eulerspiral.py": "13c9b5f819a84dfc45ea916bb33c91602f8ab6b9aaf629f42c4de09c9fb7699a", + "vendor/ezdxf/src/ezdxf/math/legacy.py": "ea85097ddb838c32d27398bd2c1160ca3d85f1b2fbbd0a5e5e893a6f03677796", + "vendor/ezdxf/src/ezdxf/math/linalg.py": "ab033271e2261232859772c43190b8a1b54f54b5496dc4fd774072537df416a2", + "vendor/ezdxf/src/ezdxf/math/line.py": "1dec22bf86b8f272cb1cb1d267694dfe17625c24110edb196b6f07ae5bb8632b", + "vendor/ezdxf/src/ezdxf/math/offset2d.py": "63f72eb34f547f8192c83cbe9cfc9b242fdc7671b34b7aa1ff55b7072ef63b3c", + "vendor/ezdxf/src/ezdxf/math/parametrize.py": "8214c7ed2ee46559d5a9dc3627967a7cdd545453203779d6ef54072aee5358a7", + "vendor/ezdxf/src/ezdxf/math/perlin.py": "320b6fa8c4324708352a4253aebfe4c45b27e7c7753c3f45435ee8f96a60cea5", + "vendor/ezdxf/src/ezdxf/math/polyline.py": "48142aac1c5998310bf0a0abdea824d5b5d767ef8d1d7c222b7214344737d28e", + "vendor/ezdxf/src/ezdxf/math/rtree.py": "4581b2376000af55c569cd0754b76dc9f206ae21be6312d67e9002f967913442", + "vendor/ezdxf/src/ezdxf/math/shape.py": "70d8bc1250b9e5d72ae940e96ac4caab38062df887eeae74b62523baddad997f", + "vendor/ezdxf/src/ezdxf/math/transformtools.py": "a6efd4ff6180ef2c3c734b156fb29984e245b539ba85cdf6fcbd1a77f2230242", + "vendor/ezdxf/src/ezdxf/math/triangulation.py": "92c238fab2051bb96a439404e0c50f1ad325decb1a45172ff453d7dd1de83e4a", + "vendor/ezdxf/src/ezdxf/math/ucs.py": "a4d710808959a3a503ad379a40c4d1d54d57671087834ba12ac733357aabf4ec", + "vendor/ezdxf/src/ezdxf/messenger.py": "7482cf6f192e3fe4a8ed0fab71a56685a8cf85ba6ae3f48972c64361dce5913c", + "vendor/ezdxf/src/ezdxf/msgtypes.py": "233f8ef8ac1cd5bbdcd24593d14e9af6d17f6045f819d26f6ed12a82784073b2", + "vendor/ezdxf/src/ezdxf/npshapes.py": "8da141a7275a1195c8abb956c9537080f3593473a57973acd4a7ab14111664d5", + "vendor/ezdxf/src/ezdxf/path/__init__.py": "207325a855ffabf573be549c799c1af292f2a0865fa0946180e5ea094b0e5614", + "vendor/ezdxf/src/ezdxf/path/commands.py": "b21aacb1c9146a5a8d1f53555c6e2edffeaca01607e4def52cada7597ec0c6c8", + "vendor/ezdxf/src/ezdxf/path/converter.py": "ce3f02f7ec059aad4a72d856c969f8bdb3f26743a36108afcd29ebd5f7b0d8f2", + "vendor/ezdxf/src/ezdxf/path/nesting.py": "1941f3e458b88db1a3df673c1ddd54be325117e75deee3f7be29dabb44a94f4b", + "vendor/ezdxf/src/ezdxf/path/path.py": "94a69b57f0c08737d88a406621e915226f143e78716dbd13f89500ece6d92f01", + "vendor/ezdxf/src/ezdxf/path/shapes.py": "29dc532b5ede9ec4f4b82bf81cbe263622ff702a8245177af715803dd57dabc6", + "vendor/ezdxf/src/ezdxf/path/tools.py": "a5078589f0e605ab86dcfc6e610379114daf70447e1334e54189850486a00324", + "vendor/ezdxf/src/ezdxf/protocols.py": "5d7f840db7e9d95f130af8f82a84f9afda8afe533ac0315689e9d7027afa5b31", + "vendor/ezdxf/src/ezdxf/proxygraphic.py": "facdb0bb5f04dec47036bd5f8d927b444f7706d61044e4240350ba74fc293a05", + "vendor/ezdxf/src/ezdxf/py.typed": "51a0ae3c56b71fc5006a46edfb91bc48f69c95d4ce1af26fd7ca4f8d42798036", + "vendor/ezdxf/src/ezdxf/query.py": "ab2e8779f3d0e61c421ade50cda8917c3075402cd6b206f21698080e3edff4a7", + "vendor/ezdxf/src/ezdxf/queryparser.py": "51bee9193ed67fa0f91bbeccdd402a655e54f20be1bfd8f18f772f4b00be4f55", + "vendor/ezdxf/src/ezdxf/r12strict.py": "159db209e6b786cdaf65b724575e665f6d9b7feb9ee904c048a8333e43c1671f", + "vendor/ezdxf/src/ezdxf/recover.py": "11512ec49965ee22e9acf48cd9ee88446b22bf8f24279b68ec9e0a4b0750ced2", + "vendor/ezdxf/src/ezdxf/render/__init__.py": "5980457d8fe9afc61237d24ef60ba11d904181c09d4a9fe0c9e5973be92b60c4", + "vendor/ezdxf/src/ezdxf/render/_linetypes.py": "b0f0a414e86056689ad6d2b69e4fe6100d00e842ba2f144871faec64f420521e", + "vendor/ezdxf/src/ezdxf/render/abstract_mtext_renderer.py": "197858c341ff161e4816c777e40cde9d766ea29df62eed0add9232af938620a6", + "vendor/ezdxf/src/ezdxf/render/arrows.py": "5b4327d95717ce9c6c2ddd352a2789a4dca203375f09485fe9ae2c855383d9f8", + "vendor/ezdxf/src/ezdxf/render/curves.py": "97ea3b8fe5ae437000c77b41ae42dcca0e9ca59b74fb512dc4df632eff9e718f", + "vendor/ezdxf/src/ezdxf/render/dim_base.py": "2cfd34a0369707c1661457b0094d67426b96b41d4b4014a05cca9447d046dc40", + "vendor/ezdxf/src/ezdxf/render/dim_curved.py": "1c180436e454650d7dd0cef75af8fe9fded22e73e0a4fb52c2ac52d22bd09645", + "vendor/ezdxf/src/ezdxf/render/dim_diameter.py": "c60f86946baf4342584f3eccdd1063b4a9a3c90df46d72d86c76542228b0703e", + "vendor/ezdxf/src/ezdxf/render/dim_linear.py": "b3983a8b8fa820cf614872f28d5478bc83d60c29c4c9fab2f1318983763239ab", + "vendor/ezdxf/src/ezdxf/render/dim_ordinate.py": "22dd6d320ec5c9faaa87e87b19f1cd7b7182ccc3440a176810a3ac7c499cbd0d", + "vendor/ezdxf/src/ezdxf/render/dim_radius.py": "f9dbb70b2b13d211f2d9fc5462d5d0fee4b7b1dab2938e8ef22ece273a29a3e0", + "vendor/ezdxf/src/ezdxf/render/dimension.py": "04306af042e5cddce5ad337e041951e9ca572b4791e3e810e7a9ec4052adf200", + "vendor/ezdxf/src/ezdxf/render/forms.py": "5f01f1f45feb9b95a528111036b18e9dc86c00fa8cbf0546492e3b2585ad423d", + "vendor/ezdxf/src/ezdxf/render/hatching.py": "a601c4952c540c97eae3115173f7d3f812612bd3d90210c96db1e19a0ebcd379", + "vendor/ezdxf/src/ezdxf/render/leader.py": "2e73ffd079c6a559bd2302ef645b2f808bdd2454fc326f6220728f13e114f677", + "vendor/ezdxf/src/ezdxf/render/linetypes.py": "63e22eca7b71ee9b269966a57ca0b6324cb606734c9558d3cd5186ef8980c6cb", + "vendor/ezdxf/src/ezdxf/render/mesh.py": "a56b1105bdeb6cf2af16efba70b6738ebd85634c8048068bfb4d1e21867a4673", + "vendor/ezdxf/src/ezdxf/render/mleader.py": "5879cadf58ae09f3fcca2af1434818a86ee07911307ad8ba1692f75c743d3a39", + "vendor/ezdxf/src/ezdxf/render/mline.py": "c3c1bd3be3b8e41cf7101b0365d8ed535d9e8a264361273843aa9a2f6c113c0a", + "vendor/ezdxf/src/ezdxf/render/point.py": "0b706ef576a101670402e426581eb295e0af97c341facd22fd000626ed7a8734", + "vendor/ezdxf/src/ezdxf/render/polyline.py": "fe30ce2b3e84be51ce4dab2ec8be0afb1ed31892c9ce4aaf01d9bd09ebc29ba6", + "vendor/ezdxf/src/ezdxf/render/r12spline.py": "3951bde376bfd01722e02f2b8cba747493f3e81dc6bd21fc820b4f012f204320", + "vendor/ezdxf/src/ezdxf/render/trace.py": "4bcffd8b09d58597b79206f2ba4267974a8e75e6c469465d5ba35f6b85eedd35", + "vendor/ezdxf/src/ezdxf/reorder.py": "fed0efdd6be271abf097a35a3ae4cd426ef1c8932a22acdbf6ed91c42c4300b4", + "vendor/ezdxf/src/ezdxf/resources/16x16.png": "ca564ec8b19b20807665e9464fcc07b90e7f4e51cfdf4aad79ba58d26a784c09", + "vendor/ezdxf/src/ezdxf/resources/24x24.png": "527d09c8cf2db664a75b58cfb2a22f9c0be43c7dfaf99b4126e40a3240685f61", + "vendor/ezdxf/src/ezdxf/resources/256x256.png": "ca3f406e61704cf61589ad10ec075eb7af44ebccd8c1a1f56047bd957a06ee6d", + "vendor/ezdxf/src/ezdxf/resources/32x32.png": "b03808302250a808c6fde67f3451f0ae5b594f796d057a5a3ab8253336d4361f", + "vendor/ezdxf/src/ezdxf/resources/48x48.png": "549679f0cf9aad320e65fa928d6681b97bf9fd3997467cc632e2213213fef41a", + "vendor/ezdxf/src/ezdxf/resources/64x64.png": "bae3b88f7ef1cb466b7b56aa7ca46330891105f6062ba9280e27e8b96392202d", + "vendor/ezdxf/src/ezdxf/resources/icon-copy-64px.png": "0337ae2c86e65a9ba7744dc190b1f0a695a3cec4fa4119a375e5a65aa633e083", + "vendor/ezdxf/src/ezdxf/resources/icon-find-64px.png": "08f091a12f6ed77ba88bdd7d880ad49cc21bde8126544ead5b1abeec052264a5", + "vendor/ezdxf/src/ezdxf/resources/icon-goto-bookmark-64px.png": "c6a4cf23d17daa0358f0230a0be0c49ab4d83e10cde3368904a8410acdbd7ad8", + "vendor/ezdxf/src/ezdxf/resources/icon-goto-handle-64px.png": "ee4a4f579680ee2f83fbf648a91b254a0b623ca5423cdfac278216100dfa7f8f", + "vendor/ezdxf/src/ezdxf/resources/icon-goto-line-64px.png": "d80db50d0888b04f6419ff6bcbde6884a69b1a3fb1544971b4038267603da1c1", + "vendor/ezdxf/src/ezdxf/resources/icon-left-arrow-64px.png": "f1d2d06f945b547726de69061a235dc26ed3d4bf7a6f73c369e4e79f237efa83", + "vendor/ezdxf/src/ezdxf/resources/icon-next-entity-64px.png": "f612f9ae51c3f84412bd1c1e342d52956d5061d3a3c4324fc03ad04b1592abf2", + "vendor/ezdxf/src/ezdxf/resources/icon-prev-entity-64px.png": "a989671f0b54804accb9c3cb849bf7cbd78f7de57989a47b3bd6b3d5352d9071", + "vendor/ezdxf/src/ezdxf/resources/icon-right-arrow-64px.png": "47c4c7f5c430d81c736673275abe802add9cfa15a71fbdeaa8ffa493d571b895", + "vendor/ezdxf/src/ezdxf/resources/icon-show-in-tree-64px.png": "7f4832afd98300360a098c89ef618471769bae572e3e095a90606d5c204ad0fd", + "vendor/ezdxf/src/ezdxf/resources/icon-store-bookmark-64px.png": "13217ef84a9b0bf27a8968be5b4975d764dd58505c1d0c9530ca91dc5d7bc7f9", + "vendor/ezdxf/src/ezdxf/revcloud.py": "60407de6ffc7d1c138ffa01f6854ef7fcc4169ff2b31d9d6af4c362fdcc5fb20", + "vendor/ezdxf/src/ezdxf/sections/__init__.py": "e8d4b6ffabe8fd1da23781fe425218222fc1a0bbc91dda398e18b1d6e09a1250", + "vendor/ezdxf/src/ezdxf/sections/acdsdata.py": "ec6b9ab917bbbfd0731fc140ffab71a97a5988aff7b5c3f50a178fbb17bdc241", + "vendor/ezdxf/src/ezdxf/sections/blocks.py": "af0fd6eb81cafc7e02c6beb8f0cb9568eedc1a1ccdde075bb5895fe1d3edc9a8", + "vendor/ezdxf/src/ezdxf/sections/classes.py": "51f48788c5391cf60662be03072c94a83608e53c37a037d9f1764aeaacd82a81", + "vendor/ezdxf/src/ezdxf/sections/entities.py": "a4be25ba3bf7ddd8340a1cc0cf59e7e0294adbd2051763a76a8c09151fd50148", + "vendor/ezdxf/src/ezdxf/sections/header.py": "18ac20145da1285fab1d4db2c19a07f8ec905956467dfb633def9a7fbe547bf4", + "vendor/ezdxf/src/ezdxf/sections/headervars.py": "476a4e9aa5c816e70ac35941611c06cad609881172cd31c95ba7c7da35d6e12a", + "vendor/ezdxf/src/ezdxf/sections/objects.py": "8b8d7ddb5aca1c2fac0e3709a0f4de779727ffee4d6bb1520d630a1b01659b25", + "vendor/ezdxf/src/ezdxf/sections/table.py": "e3ebe96f2c0f417c3cd7f899b74618eaa08a0a95a7d8d58d13cb757cc6faea63", + "vendor/ezdxf/src/ezdxf/sections/tables.py": "a0bfd9c0efec61d66cd36661d4b8fee917b74726af103e2df5cb86cb6a131e04", + "vendor/ezdxf/src/ezdxf/select.py": "46e4acdfd9f201b8da6c6de93cef59d20ce8350895c8ef2b8a0e8cef8dc769bc", + "vendor/ezdxf/src/ezdxf/tools/__init__.py": "10ea75aa17d15683bbfdc043fb592f963a207378268cda89be6fbdd14389fc75", + "vendor/ezdxf/src/ezdxf/tools/_iso_pattern.py": "ff7ad10ec9c9cc4201bcb98a0f6a3b08eb780b12ea837bc7e22a9806eb9b9a9b", + "vendor/ezdxf/src/ezdxf/tools/analyze.py": "362b8d61c7cdfbcf32465783bc12b0aba108848569ee8544b2bf3e5693b2ce3b", + "vendor/ezdxf/src/ezdxf/tools/binarydata.py": "29a13645df67360900f24ebdce6cdaf6a76331b35913d50a736b71acc99cee50", + "vendor/ezdxf/src/ezdxf/tools/clipping_portal.py": "ad9476d1df38bb7f71fb62a046d924632c3b6624e8cf4d8a9d77ef5bcd13afac", + "vendor/ezdxf/src/ezdxf/tools/codepage.py": "c7ab6255d42b1fe2763807e39f0eb18b7da1219ac7fab49bdc4c4e8b70d5f3b1", + "vendor/ezdxf/src/ezdxf/tools/complex_ltype.py": "d3bc0136918a964ef9ca1432225b5c21a41df98b1675ee4ec50a5266d0b3cf6c", + "vendor/ezdxf/src/ezdxf/tools/crypt.py": "4eb68651eaabe46c566590c568602df8e38268adeb8aceeccac5cdf98d0b01c6", + "vendor/ezdxf/src/ezdxf/tools/debug.py": "8a172f9b3b3cc48171863b2c53e91f831f6b1a3cd752ed531f3c2fcbde3dcb71", + "vendor/ezdxf/src/ezdxf/tools/difftags.py": "0b0fcb8cd1e3de13f89f5bd4646d82c4cc05e98cad4d77a6b3d427571b52faab", + "vendor/ezdxf/src/ezdxf/tools/handle.py": "dae41117264828abae8a48d83eebf8f8753a6ebc955ac3e0e80bc8b870e26ddf", + "vendor/ezdxf/src/ezdxf/tools/indexing.py": "0b5b1f2c9d6764efcdd2d5eae3cc04140b1306d9d00f9e136dcca8562441e7e9", + "vendor/ezdxf/src/ezdxf/tools/juliandate.py": "5074b7346ccac7c446d88e06b772a45241cc4ebbfd771426fba669cfe10eff9f", + "vendor/ezdxf/src/ezdxf/tools/pattern.py": "091bcdbcb395e15116c11583f6b7641a73de03ca0368ea049b75e2e7872a7c08", + "vendor/ezdxf/src/ezdxf/tools/rawloader.py": "648a079d512a92bb6842476b98fc70fd4580d7235017bfa25e638b3f2cacaf57", + "vendor/ezdxf/src/ezdxf/tools/standards.py": "f3b64bf6a8d623109258fe6a75eb8e1d1f86b3d7f65b6234297faa78004c5340", + "vendor/ezdxf/src/ezdxf/tools/strip.py": "2bd091f43dc4c5d914d9ce762e06dbb221bec6ad877353904d1340acf198377d", + "vendor/ezdxf/src/ezdxf/tools/test.py": "7e39a2f3a9a021e41b0ef42c07db93548f70ea2a87d28031c37436494cdca262", + "vendor/ezdxf/src/ezdxf/tools/text.py": "a5d342bed0f49708e3d766668e0620d4d087469bd78588ac91138bf026e509de", + "vendor/ezdxf/src/ezdxf/tools/text_layout.py": "e3d758912c2bd58d9be94c840ce8b63b713187e8090126a8fc359070ec085045", + "vendor/ezdxf/src/ezdxf/tools/text_size.py": "14c9aca084ddfec6de792fef96b225fa97f04e58e186ad96e00e9d1b047dfae7", + "vendor/ezdxf/src/ezdxf/tools/zipmanager.py": "5e3e3d1453c875f726c9b3a10435e740f71f7540465cb9dde0b3698cb85306a2", + "vendor/ezdxf/src/ezdxf/transform.py": "28e5c04dbe9a1ecca20b26392116183e10bf8f871037165f2a6c157d5a84d6e0", + "vendor/ezdxf/src/ezdxf/units.py": "9a9e8d3fffd9e23d4280665ad7e4faadb980dd206f318890c32d78c2a27e63fc", + "vendor/ezdxf/src/ezdxf/upright.py": "13beb24aa9034e36a65dd0adcad7c4cdc3960be3ce8fc73305a2ef2e64708aee", + "vendor/ezdxf/src/ezdxf/urecord.py": "2b55346ba07c51ce6e61d5a6e19c1cf72745fe0b6de15a78a4c76d031ecb2b8d", + "vendor/ezdxf/src/ezdxf/version.py": "f626d8ac5f7d0b192ca862133ca2153e13072f1d329ccef093e51e00bdcd28bb", + "vendor/ezdxf/src/ezdxf/xclip.py": "5bb307503719f7cec8e9d009122953aa51f82e7eb1a45e79b31478f57902175b", + "vendor/ezdxf/src/ezdxf/xref.py": "139b59b8bc108946af8c9499212a9e72d232f9168462728d317ddd061f563829", + "vendor/ezdxf/src/ezdxf/zoom.py": "9e5fec2f33cf1032b7657913f2a614de5256a57b298a8f2b2e714050ad3092d8", + "vendor/ezdxf/tests/test_02_dxf_graphics/test_232e_acis_transform.py": "0fad03078d31cea9a4a84c47c635def1b2f50ddd5e5472f9d2376c2dc186279c" + }, + "mutable": [ + "vendor/ezdxf/src/ezdxf/entities/acis.py", + "vendor/ezdxf/src/ezdxf/entities/temporary_transform.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1836-hardware-cad/tests/fixtures/pristine_sha256.json b/tasks/candidate-1836-hardware-cad/tests/fixtures/pristine_sha256.json new file mode 100644 index 0000000000000000000000000000000000000000..cf88c140a109ceeccda82802a100b618a2553dbd --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/fixtures/pristine_sha256.json @@ -0,0 +1,13 @@ +{ + "immutable": { + "run_repair.py": "791db713d676df35fb50980e6138b71bc11641f93e719de3386b862932e105a8", + "vendor/ezdxf/src/ezdxf/bbox.py": "aafdb666535cb054eeb4553cc47d3bf8385a9d02f8d9cd5710b7f8f4a8ae09e7", + "vendor/ezdxf/src/ezdxf/entities/insert.py": "511f29c6ec9642803c122fcb1ddb6d2c3347c0d2ba668197ce330c607862544a", + "vendor/ezdxf/tests/test_02_dxf_graphics/test_232e_acis_transform.py": "0fad03078d31cea9a4a84c47c635def1b2f50ddd5e5472f9d2376c2dc186279c" + }, + "mutable_pristine": { + "vendor/ezdxf/src/ezdxf/entities/acis.py": "65e3e4b774f35d57504250cf83b8928e7c0c819bf9964b427a835b1bf1841d8c", + "vendor/ezdxf/src/ezdxf/entities/temporary_transform.py": "038f98e887aa47b08f992749bbdba6ed15551d32aa1d3053162442e915088c7f" + }, + "private_fixture_sha256": "8193d9917354a9165d500098aa31209218f0b3d6bf3b24632b89003295806c4d" +} diff --git a/tasks/candidate-1836-hardware-cad/tests/task_test.sh b/tasks/candidate-1836-hardware-cad/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e269779a6cc8b1417b0c0ff2289c216103650fdd --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then printf '1\n' > /logs/verifier/reward.txt; else printf '0\n' > /logs/verifier/reward.txt; fi +exit "$status" diff --git a/tasks/candidate-1836-hardware-cad/tests/test.sh b/tasks/candidate-1836-hardware-cad/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1836-hardware-cad/tests/test_outputs.py b/tasks/candidate-1836-hardware-cad/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..c6a5bbf91e13ee1818b6d8d8d4983d0ccb0585e0 --- /dev/null +++ b/tasks/candidate-1836-hardware-cad/tests/test_outputs.py @@ -0,0 +1,166 @@ +import hashlib +import json +import math +import sys +from pathlib import Path + +APP = Path("/app") +SOURCE_ROOT = APP / "vendor/ezdxf" +SOURCE = SOURCE_ROOT / "src" +ARTIFACT = APP / "output.json" +PRIVATE_FIXTURE = Path("/tests/fixtures/3dsolids.dxf") +HASH_FIXTURE = Path("/tests/fixtures/pristine_sha256.json") + +sys.path.insert(0, str(SOURCE)) + +import ezdxf +from ezdxf import bbox +from ezdxf.math import Matrix44 + + +def sha256(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def matrix_values(matrix): + values = [float(value) for value in matrix] + return [values[index:index + 4] for index in range(0, 16, 4)] + + +def assert_matrix_close(actual, expected, tolerance=1e-9): + assert len(actual) == 4 + assert len(expected) == 4 + for actual_row, expected_row in zip(actual, expected): + assert len(actual_row) == 4 + assert len(expected_row) == 4 + for actual_value, expected_value in zip(actual_row, expected_row): + assert math.isclose(actual_value, expected_value, rel_tol=0.0, abs_tol=tolerance) + + +def load_output(): + assert ARTIFACT.is_file() + data = json.loads(ARTIFACT.read_text()) + expected_keys = { + "output_schema_version", + "source_entity_type", + "source_acis_size", + "copy_isolated", + "pending_matrix", + "copy_matrix_after_composition", + "bbox_has_data", + "bbox_extents", + "block_transform_before_bbox", + "block_transform_after_bbox", + "block_transform_preserved", + "roundtrip_block_entity_type", + "roundtrip_acis_size", + "roundtrip_block_entity_count", + } + assert set(data) == expected_keys + assert data["output_schema_version"] == "cad-copy-isolation.v1" + return data + + +def load_real_source(): + doc = ezdxf.readfile(PRIVATE_FIXTURE) + source = doc.modelspace()[0] + assert source.dxftype() == "3DSOLID" + assert len(source.sat) > 0 + return doc, source + + +def test_gate_artifact_and_workspace(): + data = load_output() + expected_hashes = json.loads(HASH_FIXTURE.read_text()) + for relative_path, expected_hash in expected_hashes["immutable"].items(): + path = APP / relative_path + assert path.is_file() + assert sha256(path) == expected_hash + for relative_path, pristine_hash in expected_hashes["mutable_pristine"].items(): + path = APP / relative_path + assert path.is_file() + assert sha256(path) != pristine_hash + assert sha256(PRIVATE_FIXTURE) == expected_hashes["private_fixture_sha256"] + assert data["source_entity_type"] == "3DSOLID" + assert data["source_acis_size"] > 0 + + +def test_core_copy_preserves_matrix_and_isolates_helper(): + _, source = load_real_source() + pending = Matrix44.translate(2.5, -4.0, 7.25) @ Matrix44.z_rotate(0.35) + extra = Matrix44.translate(11.0, 13.0, -5.0) + source_helper = source.temporary_transformation() + source_helper.set_matrix(pending) + + copied = source.copy() + copied_helper = copied.temporary_transformation() + assert copied_helper is not source_helper + assert_matrix_close(matrix_values(copied_helper.get_matrix()), matrix_values(pending)) + + copied_helper.add_matrix(extra) + assert_matrix_close(matrix_values(source_helper.get_matrix()), matrix_values(pending)) + assert_matrix_close(matrix_values(copied_helper.get_matrix()), matrix_values(pending @ extra)) + + +def test_core_bbox_recomputed_state_isolation(): + doc, source = load_real_source() + modelspace = doc.modelspace() + block = doc.blocks.new("PRIVATE_BBOX_BLOCK") + block_entity = source.copy() + block_entity.temporary_transformation().set_matrix(None) + block.add_entity(block_entity) + insert = modelspace.add_blockref("PRIVATE_BBOX_BLOCK", (10.0, 20.0, 30.0)) + + assert block_entity.temporary_transformation().get_matrix() is None + extents = bbox.extents([insert]) + assert block_entity.temporary_transformation().get_matrix() is None + assert isinstance(extents.has_data, bool) + if extents.has_data: + coordinates = [float(value) for value in extents.extmin] + [float(value) for value in extents.extmax] + assert all(math.isfinite(value) for value in coordinates) + assert all(extents.extmin[index] < extents.extmax[index] for index in range(3)) + + +def test_core_roundtrip_preserves_acis_and_named_block(tmp_path): + doc, source = load_real_source() + source_sat_size = len(source.sat) + block = doc.blocks.new("PRIVATE_ROUNDTRIP_BLOCK") + block.add_entity(source.copy()) + insert = doc.modelspace().add_blockref("PRIVATE_ROUNDTRIP_BLOCK", (3.0, -2.0, 8.0)) + bbox.extents([insert]) + + output = tmp_path / "roundtrip.dxf" + doc.saveas(output) + reread = ezdxf.readfile(output) + reread_block = reread.blocks.get("PRIVATE_ROUNDTRIP_BLOCK") + assert reread_block is not None + assert len(reread_block) == 1 + reread_entity = reread_block[0] + assert reread_entity.dxftype() == "3DSOLID" + assert len(reread_entity.sat) == source_sat_size + assert source_sat_size > 0 + + +def test_edge_artifact_matches_independent_matrix_recompute(): + data = load_output() + pending = Matrix44.translate(2.5, -4.0, 7.25) @ Matrix44.z_rotate(0.35) + composed = pending @ Matrix44.translate(11.0, 13.0, -5.0) + assert data["copy_isolated"] is True + assert_matrix_close(data["pending_matrix"], matrix_values(pending)) + assert_matrix_close(data["copy_matrix_after_composition"], matrix_values(composed)) + + +def test_edge_artifact_reports_bbox_and_roundtrip(): + data = load_output() + assert data["block_transform_before_bbox"] is None + assert data["block_transform_after_bbox"] is None + assert data["block_transform_preserved"] is True + assert isinstance(data["bbox_has_data"], bool) + if data["bbox_has_data"]: + coordinates = data["bbox_extents"]["min"] + data["bbox_extents"]["max"] + assert all(math.isfinite(float(value)) for value in coordinates) + else: + assert data["bbox_extents"] is None + assert data["roundtrip_block_entity_type"] == "3DSOLID" + assert data["roundtrip_acis_size"] == data["source_acis_size"] + assert data["roundtrip_block_entity_count"] == 1 diff --git a/tasks/candidate-1866-ml-inference/environment/Dockerfile b/tasks/candidate-1866-ml-inference/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..718af092aa8a7e23d5358d687892faf320261b68 --- /dev/null +++ b/tasks/candidate-1866-ml-inference/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ca717187d4b54ed4fbebf05da09687913b454797af81d9eb59aef849854f2554 diff --git a/tasks/candidate-1866-ml-inference/environment/setup/setup.sh b/tasks/candidate-1866-ml-inference/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1866-ml-inference/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1866-ml-inference/instruction.md b/tasks/candidate-1866-ml-inference/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..87cea024fbcee975b5d5eba88985ec848a398031 --- /dev/null +++ b/tasks/candidate-1866-ml-inference/instruction.md @@ -0,0 +1,36 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +Repair the frozen Hugging Face Transformers source tree under +`/app/vendor/transformers`. A pretrained inference path currently loses the +adapter keyword-argument state at the boundary between adapter discovery and +`from_pretrained`. + +Complete the following workflow: + +1. Inspect the adapter integration helper and its caller in the pretrained model + loader. Repair both existing production modules so their return/unpack + contract remains synchronized. +2. Preserve adapter keyword arguments through local adapter discovery. A private + `_adapter_model_path` hint must be consumed by discovery and must not be + forwarded later, while ordinary adapter options remain unchanged. +3. Preserve offline cache behavior: `local_files_only`, revision, subfolder, and + resolved commit metadata belong to discovery and must not be mixed into the + adapter kwargs passed to the later adapter load. +4. Keep early-return behavior valid when PEFT is unavailable or the model path is + absent, including the caller-visible adapter kwargs value. +5. Run the included integration workflow and write `/app/output.json`: + + ```sh + python3 /app/tools/run_adapter_workflow.py \ + --cases /app/fixtures/adapter_cases.json \ + --output /app/output.json + ``` + +The output must use schema version `transformers.adapter_contract.v1`, include +one result for every fixture case, describe the repaired caller contract, and +set every reported check to `true`. Compile the two modified modules before +finishing. Do not modify the fixture, runner, unrelated vendored files, or add a +replacement evaluator. Runtime network access and package installation are not +available. diff --git a/tasks/candidate-1866-ml-inference/task.toml b/tasks/candidate-1866-ml-inference/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b093071be0accb3acdf2c560316032aecd27cae4 --- /dev/null +++ b/tasks/candidate-1866-ml-inference/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1866-ml-inference" +description = "MiMo-V2.6-RL terminal task candidate-1866-ml-inference" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1866-ml-inference" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:ca717187d4b54ed4fbebf05da09687913b454797af81d9eb59aef849854f2554" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1866-ml-inference/tests/anti_hack_guard.py b/tasks/candidate-1866-ml-inference/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1866-ml-inference/tests/fixtures/hidden_adapter_cases.json b/tasks/candidate-1866-ml-inference/tests/fixtures/hidden_adapter_cases.json new file mode 100644 index 0000000000000000000000000000000000000000..919ab293b4c30655d22ccd36131da2216155545f --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/fixtures/hidden_adapter_cases.json @@ -0,0 +1,51 @@ +{ + "schema_version": "transformers.adapter_cases.v1", + "output_schema_version": "transformers.adapter_contract.v1", + "cases": [ + { + "id": "hidden_nested_adapter", + "peft_available": true, + "pretrained_model_name_or_path": "/private/adapters/customer-support", + "adapter_config": {"base_model_name_or_path": "/private/models/base-chat"}, + "download_kwargs": { + "cache_dir": "/private/cache", + "force_download": false, + "proxies": {"https": "blocked"}, + "local_files_only": true, + "token": "private-token", + "revision": "release-7", + "subfolder": "adapter", + "commit_hash": null + }, + "adapter_kwargs": {"adapter_name": "lora-9", "use_safetensors": true, "is_trainable": false}, + "discovery": "local_config" + }, + { + "id": "hidden_explicit", + "peft_available": true, + "pretrained_model_name_or_path": "/private/adapters/explicit", + "adapter_config": {"base_model_name_or_path": "/private/models/base-reranker"}, + "download_kwargs": {"local_files_only": true, "commit_hash": "fixed-commit", "subfolder": ""}, + "adapter_kwargs": {"_adapter_model_path": "$LOCAL_CONFIG", "use_safetensors": false, "is_trainable": true}, + "discovery": "explicit_path" + }, + { + "id": "hidden_none_path", + "peft_available": true, + "pretrained_model_name_or_path": null, + "adapter_config": null, + "download_kwargs": {"local_files_only": true, "commit_hash": null}, + "adapter_kwargs": {"adapter_name": "preserve-on-early-return"}, + "discovery": "disabled" + }, + { + "id": "hidden_missing", + "peft_available": true, + "pretrained_model_name_or_path": "/private/models/no-adapter", + "adapter_config": null, + "download_kwargs": {"local_files_only": true, "commit_hash": "known", "revision": "r2", "subfolder": "x"}, + "adapter_kwargs": {"use_safetensors": true, "is_trainable": false}, + "discovery": "missing" + } + ] +} diff --git a/tasks/candidate-1866-ml-inference/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1866-ml-inference/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9a9c7c4a5b9d2c0e24878863ba62178688464ec4 --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,27 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "fixtures/adapter_cases.json": "19aa00e09ff56e3f7094647d3a2d40d5304a1e15401e3c87ea172c74476a8452", + "tools/run_adapter_workflow.py": "838a81e560fa743fe7408b149c9d486d6f804cb9fd54bfc3eeaa4c68d1628e70", + "vendor/transformers/LICENSE": "77fd4710def9ec3c0f6225800e0235f15a425abd4a8b03559127fcd782612049", + "vendor/transformers/src/transformers/__init__.py": "c6ef670a86410b4880aab41acf2854c176c99d446412ca0042cef8c3e200a5ac", + "vendor/transformers/src/transformers/configuration_utils.py": "bb56f32c3cdc008e0839206196f8f289d9328f6b78080cac52a61feb27f906c3", + "vendor/transformers/src/transformers/integrations/__init__.py": "bb0748c16fb47983745eb70af5c8e6b2861e71b861172aeed1931f1a3050b251", + "vendor/transformers/src/transformers/integrations/peft.py": "98acfa293447e61c6ddd65d4efffcc0f018525ea0c2a7361af40e1fdd11a7c0e", + "vendor/transformers/src/transformers/modeling_utils.py": "11debbf5d5b51e98d78ed6289c4c90e5aa3e97fe3e606a25b6cc5c0fe176cacb", + "vendor/transformers/src/transformers/utils/__init__.py": "db589e5ad6c9423eee5117e17247ddb346aa6e5be849b522061e389ab9bda47f", + "vendor/transformers/src/transformers/utils/generic.py": "d4eeb174364d8645bd7178fe1a6364f896659417ff77ab2f5647e35ab61fe8ef", + "vendor/transformers/src/transformers/utils/hub.py": "d5bcc35fa6bf8d775a62375e911e4e2dbccf74301686111b3f843b15ac529a0e", + "vendor/transformers/src/transformers/utils/import_utils.py": "05faf0fccd1b11bd72607e7c5a7b168c4acce4051ba4e07579d525c64f7bd7b6", + "vendor/transformers/tests/models/bert/test_modeling_bert.py": "d9594e13ac2a1900e52e97586d178a942fab4f6b91fc7ea2812622e7cd7620b3" + }, + "mutable": [ + "vendor/transformers/src/transformers/integrations/peft.py", + "vendor/transformers/src/transformers/modeling_utils.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1866-ml-inference/tests/fixtures/protected_hashes.json b/tasks/candidate-1866-ml-inference/tests/fixtures/protected_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..15b0a6c04ec7d5e4a03794c1c376fc47a0bb3cc5 --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/fixtures/protected_hashes.json @@ -0,0 +1,13 @@ +{ + "vendor/transformers/LICENSE": "77fd4710def9ec3c0f6225800e0235f15a425abd4a8b03559127fcd782612049", + "vendor/transformers/src/transformers/__init__.py": "c6ef670a86410b4880aab41acf2854c176c99d446412ca0042cef8c3e200a5ac", + "vendor/transformers/src/transformers/configuration_utils.py": "bb56f32c3cdc008e0839206196f8f289d9328f6b78080cac52a61feb27f906c3", + "vendor/transformers/src/transformers/integrations/__init__.py": "bb0748c16fb47983745eb70af5c8e6b2861e71b861172aeed1931f1a3050b251", + "vendor/transformers/src/transformers/utils/__init__.py": "db589e5ad6c9423eee5117e17247ddb346aa6e5be849b522061e389ab9bda47f", + "vendor/transformers/src/transformers/utils/generic.py": "d4eeb174364d8645bd7178fe1a6364f896659417ff77ab2f5647e35ab61fe8ef", + "vendor/transformers/src/transformers/utils/hub.py": "d5bcc35fa6bf8d775a62375e911e4e2dbccf74301686111b3f843b15ac529a0e", + "vendor/transformers/src/transformers/utils/import_utils.py": "05faf0fccd1b11bd72607e7c5a7b168c4acce4051ba4e07579d525c64f7bd7b6", + "vendor/transformers/tests/models/bert/test_modeling_bert.py": "d9594e13ac2a1900e52e97586d178a942fab4f6b91fc7ea2812622e7cd7620b3", + "tools/run_adapter_workflow.py": "838a81e560fa743fe7408b149c9d486d6f804cb9fd54bfc3eeaa4c68d1628e70", + "fixtures/adapter_cases.json": "19aa00e09ff56e3f7094647d3a2d40d5304a1e15401e3c87ea172c74476a8452" +} diff --git a/tasks/candidate-1866-ml-inference/tests/task_test.sh b/tasks/candidate-1866-ml-inference/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a2874d80bedee4fe015dba3361541ad1b3dbefcf --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/task_test.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -u +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit 0 diff --git a/tasks/candidate-1866-ml-inference/tests/test.sh b/tasks/candidate-1866-ml-inference/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1866-ml-inference/tests/test_outputs.py b/tasks/candidate-1866-ml-inference/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..45528c43b1377b0720a0d5e48373c59dc060c92f --- /dev/null +++ b/tasks/candidate-1866-ml-inference/tests/test_outputs.py @@ -0,0 +1,198 @@ +import ast +import copy +import hashlib +import json +import os +import subprocess +import tempfile +from pathlib import Path + + +APP = Path("/app") +PEFT = APP / "vendor/transformers/src/transformers/integrations/peft.py" +MODELING = APP / "vendor/transformers/src/transformers/modeling_utils.py" +PUBLIC_CASES = APP / "fixtures/adapter_cases.json" +RUNNER = APP / "tools/run_adapter_workflow.py" +REPORT = APP / "output.json" +FIXTURES = Path("/tests/fixtures") +ORIGINAL_MUTABLE_HASHES = { + "vendor/transformers/src/transformers/integrations/peft.py": "98acfa293447e61c6ddd65d4efffcc0f018525ea0c2a7361af40e1fdd11a7c0e", + "vendor/transformers/src/transformers/modeling_utils.py": "11debbf5d5b51e98d78ed6289c4c90e5aa3e97fe3e606a25b6cc5c0fe176cacb", +} + + +def file_hash(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def extract_helper(): + tree = ast.parse(PEFT.read_text(encoding="utf-8"), filename=str(PEFT)) + node = next(node for node in tree.body if isinstance(node, ast.FunctionDef) and node.name == "maybe_load_adapters") + module = ast.Module(body=[copy.deepcopy(node)], type_ignores=[]) + ast.fix_missing_locations(module) + return module + + +def execute_helper(case): + calls = {"cached": [], "find": []} + with tempfile.TemporaryDirectory(prefix="private-adapter-") as directory: + root = Path(directory) + config_path = None + if case.get("adapter_config") is not None: + config_path = root / "adapter_config.json" + config_path.write_text(json.dumps(case["adapter_config"]), encoding="utf-8") + + def cached_file(*args, **kwargs): + calls["cached"].append((args, kwargs)) + return str(root / "base-config.json") + + def find_adapter_config_file(*args, **kwargs): + calls["find"].append((args, kwargs)) + return str(config_path) if case["discovery"] == "local_config" else None + + namespace = { + "DownloadKwargs": dict, + "CONFIG_NAME": "config.json", + "cached_file": cached_file, + "extract_commit_hash": lambda path, value: "offline-resolved-commit" if path else value, + "find_adapter_config_file": find_adapter_config_file, + "is_peft_available": lambda: case["peft_available"], + "json": json, + "os": os, + } + exec(compile(extract_helper(), "private_helper", "exec"), namespace) + adapter_kwargs = copy.deepcopy(case["adapter_kwargs"]) + if adapter_kwargs.get("_adapter_model_path") == "$LOCAL_CONFIG": + adapter_kwargs["_adapter_model_path"] = str(config_path) + download_kwargs = copy.deepcopy(case["download_kwargs"]) + result = namespace["maybe_load_adapters"]( + case["pretrained_model_name_or_path"], download_kwargs, **adapter_kwargs + ) + return result, download_kwargs, calls + + +def expected_case(case): + kwargs = copy.deepcopy(case["adapter_kwargs"]) + if case["discovery"] == "disabled": + return None, case["pretrained_model_name_or_path"], kwargs, 0, 0 + if case["discovery"] == "explicit_path": + kwargs.pop("_adapter_model_path") + return case["pretrained_model_name_or_path"], case["adapter_config"]["base_model_name_or_path"], kwargs, 0, 0 + cached_calls = 0 if case["download_kwargs"].get("commit_hash") is not None else 1 + if case["discovery"] == "local_config": + return case["pretrained_model_name_or_path"], case["adapter_config"]["base_model_name_or_path"], kwargs, 1, cached_calls + return None, case["pretrained_model_name_or_path"], kwargs, 1, cached_calls + + +def caller_contract(): + tree = ast.parse(MODELING.read_text(encoding="utf-8"), filename=str(MODELING)) + target_names = None + forwards = False + for node in ast.walk(tree): + if isinstance(node, ast.Assign) and isinstance(node.value, ast.Call): + if getattr(node.value.func, "id", None) == "maybe_load_adapters": + assert len(node.targets) == 1 + assert isinstance(node.targets[0], ast.Tuple) + target_names = [getattr(item, "id", None) for item in node.targets[0].elts] + if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) and node.func.attr == "load_adapter": + forwards = forwards or any( + keyword.arg == "adapter_kwargs" + and isinstance(keyword.value, ast.Name) + and keyword.value.id == "adapter_kwargs" + for keyword in node.keywords + ) + return target_names, forwards + + +def test_gate_schema_and_protected_tree(): + assert REPORT.is_file() + report = json.loads(REPORT.read_text(encoding="utf-8")) + assert set(report) == {"schema_version", "workflow", "caller_contract", "cases", "checks"} + assert report["schema_version"] == "transformers.adapter_contract.v1" + assert report["workflow"] == "pretrained_adapter_resolution" + protected = json.loads((FIXTURES / "protected_hashes.json").read_text(encoding="utf-8")) + for relative, expected_hash in protected.items(): + path = APP / relative + assert path.is_file(), relative + assert file_hash(path) == expected_hash, relative + for relative, original_hash in ORIGINAL_MUTABLE_HASHES.items(): + path = APP / relative + assert path.is_file(), relative + assert file_hash(path) != original_hash, relative + ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) + + +def test_core_hidden_local_resolution_and_cache_state(): + cases = json.loads((FIXTURES / "hidden_adapter_cases.json").read_text(encoding="utf-8"))["cases"] + case = next(item for item in cases if item["id"] == "hidden_nested_adapter") + result, download_after, calls = execute_helper(case) + expected_adapter, expected_model, expected_kwargs, expected_find, expected_cached = expected_case(case) + assert isinstance(result, tuple) and len(result) == 3 + assert result == (expected_adapter, expected_model, expected_kwargs) + assert download_after["commit_hash"] == "offline-resolved-commit" + assert len(calls["cached"]) == expected_cached + assert len(calls["find"]) == expected_find + discovery_kwargs = calls["find"][0][1] + assert discovery_kwargs["local_files_only"] is True + assert discovery_kwargs["revision"] == "release-7" + assert discovery_kwargs["subfolder"] == "adapter" + assert discovery_kwargs["_commit_hash"] == "offline-resolved-commit" + assert discovery_kwargs["revision"] != result[2]["adapter_name"] + + +def test_core_explicit_hint_and_early_return_contracts(): + cases = json.loads((FIXTURES / "hidden_adapter_cases.json").read_text(encoding="utf-8"))["cases"] + explicit = next(item for item in cases if item["id"] == "hidden_explicit") + result, download_after, calls = execute_helper(explicit) + expected = expected_case(explicit) + assert result[:2] == expected[:2] + assert result[2] == expected[2] + assert "_adapter_model_path" not in result[2] + assert len(calls["find"]) == 0 + assert len(calls["cached"]) == 0 + assert download_after["commit_hash"] == "fixed-commit" + early = next(item for item in cases if item["id"] == "hidden_none_path") + early_result, _, early_calls = execute_helper(early) + assert early_result == (None, None, early["adapter_kwargs"]) + assert early_calls == {"cached": [], "find": []} + + +def test_core_caller_unpack_and_downstream_handoff(): + targets, forwards = caller_contract() + assert targets == ["_adapter_model_path", "pretrained_model_name_or_path", "adapter_kwargs"] + assert forwards is True + with tempfile.TemporaryDirectory(prefix="private-runner-") as directory: + output = Path(directory) / "output.json" + completed = subprocess.run( + ["python3", str(RUNNER), "--cases", str(FIXTURES / "hidden_adapter_cases.json"), "--output", str(output)], + cwd=APP, + env={**os.environ, "APP_ROOT": str(APP)}, + text=True, + capture_output=True, + timeout=20, + ) + assert completed.returncode == 0, completed.stderr + report = json.loads(output.read_text(encoding="utf-8")) + assert all(report["checks"].values()) + assert len(report["cases"]) == 4 + for result in report["cases"]: + assert result["adapter_kwargs"] == result["load_adapter_kwargs"] + + +def test_edge_public_report_and_missing_adapter_recompute(): + cases = json.loads(PUBLIC_CASES.read_text(encoding="utf-8"))["cases"] + report = json.loads(REPORT.read_text(encoding="utf-8")) + assert [item["id"] for item in report["cases"]] == [item["id"] for item in cases] + by_id = {item["id"]: item for item in report["cases"]} + for case in cases: + expected_adapter, expected_model, expected_kwargs, expected_find, expected_cached = expected_case(case) + actual = by_id[case["id"]] + assert actual["adapter_model_path"] == expected_adapter + assert actual["resolved_model_name_or_path"] == expected_model + assert actual["adapter_kwargs"] == expected_kwargs + assert actual["discovery_calls"] == expected_find + assert actual["cached_file_calls"] == expected_cached + missing = by_id["adapter_not_found"] + assert missing["download_kwargs_after"]["commit_hash"] == "already-resolved" + assert missing["discovery_commit_hash"] == "already-resolved" + assert all(report["checks"].values()) diff --git a/tasks/candidate-1890-ml-training/environment/Dockerfile b/tasks/candidate-1890-ml-training/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f833e521d7d10e0cf0ea851a110029390a85d067 --- /dev/null +++ b/tasks/candidate-1890-ml-training/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:7ba1a43b030037d71b95e452487761c5659a6d40caa614c812b8698c418bb200 diff --git a/tasks/candidate-1890-ml-training/environment/setup/setup.sh b/tasks/candidate-1890-ml-training/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1890-ml-training/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1890-ml-training/instruction.md b/tasks/candidate-1890-ml-training/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..da5abf84057d95ee738a15a03b5f9eaa27d13137 --- /dev/null +++ b/tasks/candidate-1890-ml-training/instruction.md @@ -0,0 +1,37 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair the training-stop lifecycle + +You are given a source-focused, offline PyTorch Lightning workspace. A CPU +regression driver in `/app/run_regression.py` exercises a stateful +`EarlyStopping` callback together with the fit loop's minimum-training gates. +The current source contains a lifecycle defect: a callback decision made before +`min_epochs` can remain latched and fire later even though the metric has +recovered. + +Repair the existing source tree; do not replace it with a new evaluator. Your +fix must modify both of these production modules: + +- `vendor/pytorch-lightning/src/lightning/pytorch/callbacks/early_stopping.py` +- `vendor/pytorch-lightning/src/lightning/pytorch/loops/fit_loop.py` + +Requirements: + +1. A patience/threshold decision made before `min_epochs` must be deferred, + leave `trainer.should_stop` false, and clear the callback's stopping reason. +2. After the epoch gate is met, ordinary early stopping must still set + `should_stop`, `stopped_epoch`, and `PATIENCE_EXHAUSTED` correctly. +3. `min_steps` is an independent batch-granularity gate. Do not suppress a + callback decision merely because `min_steps` has not been reached. +4. A metric improvement after a deferred decision must reset the wait counter + and must not inherit a stale stop decision. +5. Keep the existing framework structure and preserve the distributed boolean + reduction call. + +Run the supplied CPU regression driver and write the required artifact to +`/app/output.json`. The artifact must retain +`output_schema_version = tbench.early_stopping.repair.v1` and include both the +callback `cases` and the `fit_loop_gates` matrix produced by the driver; do not +hard-code or hand-edit the expected results. diff --git a/tasks/candidate-1890-ml-training/task.toml b/tasks/candidate-1890-ml-training/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bc6724777bc74061e7ca22ead669c75b16664216 --- /dev/null +++ b/tasks/candidate-1890-ml-training/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1890-ml-training" +description = "MiMo-V2.6-RL terminal task candidate-1890-ml-training" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1890-ml-training" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:7ba1a43b030037d71b95e452487761c5659a6d40caa614c812b8698c418bb200" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1890-ml-training/tests/anti_hack_guard.py b/tasks/candidate-1890-ml-training/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1890-ml-training/tests/fixtures/expected.json b/tasks/candidate-1890-ml-training/tests/fixtures/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..6dfc039fcfb1bad4f13bebc1773ff2afd62c82af --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/fixtures/expected.json @@ -0,0 +1,95 @@ +{ + "cases": { + "deferred_patience": [ + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 0 + }, + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 1 + } + ], + "min_steps_only": [ + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 0 + }, + { + "should_stop": true, + "stopped_epoch": 1, + "stopping_reason": "PATIENCE_EXHAUSTED", + "wait_count": 1 + } + ], + "post_min_epochs": [ + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 0 + }, + { + "should_stop": true, + "stopped_epoch": 3, + "stopping_reason": "PATIENCE_EXHAUSTED", + "wait_count": 1 + } + ], + "recovery_after_defer": [ + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 0 + }, + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 1 + }, + { + "should_stop": false, + "stopped_epoch": 0, + "stopping_reason": "NOT_STOPPED", + "wait_count": 0 + } + ] + }, + "fit_loop_gates": { + "all_met": { + "can_stop_early": true, + "met_min_epochs": true, + "met_min_steps": true + }, + "epoch_pending": { + "can_stop_early": false, + "met_min_epochs": false, + "met_min_steps": true + }, + "no_minimums": { + "can_stop_early": true, + "met_min_epochs": true, + "met_min_steps": true + }, + "step_pending": { + "can_stop_early": false, + "met_min_epochs": true, + "met_min_steps": false + } + }, + "output_schema_version": "tbench.early_stopping.repair.v1", + "summary": { + "deferred_stop": false, + "min_steps_stop": true, + "ordinary_stop": true, + "recovered": true + } +} diff --git a/tasks/candidate-1890-ml-training/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1890-ml-training/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..1d9956cd3fe29d5af21a3313a6cb61247e7841be --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,204 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "README.md": "677d6c3fe671b696d425bef5ad5a559050d1e9bf0d4febd5d5625b8d0aece241", + "run_regression.py": "5eb45df0c18abc87684e96ceee739ce4502828f25ecf7bf63080904f81a9d420", + "vendor/pytorch-lightning/LICENSE": "a41e2fae9915ae56028f8dbd0bf27995f1907613cbcd2d81a61b010ad34e9fe9", + "vendor/pytorch-lightning/pyproject.toml": "d4ccefb8a20f4086d9a1dfebd08b063543fd303775187e3cc25606c41c2bd9eb", + "vendor/pytorch-lightning/src/lightning/__init__.py": "28827e50f26285f0f7a5a98000b35a398ec6820031098c15362731791234b981", + "vendor/pytorch-lightning/src/lightning/fabric/__init__.py": "8a6ab0b5782a4a7c77bd5fa3411ac3518612ce4cac3896066d0ac05eb872b841", + "vendor/pytorch-lightning/src/lightning/fabric/_graveyard/__init__.py": "3d8a529b6f10d31ca244052a95f3334ce8c1799356c6beba69c2e5462ae3b829", + "vendor/pytorch-lightning/src/lightning/fabric/_graveyard/tpu.py": "36819324de7e6f4d6e5caf049dd1f571e0252a2e50caee60da9c8499414c9df1", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/__init__.py": "46ea59265f68f67bc23afcf533b9a107c9a19f735cae27ab1de40b2f8e5964a4", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/accelerator.py": "bcae6c3e0c7488048f6757281ffafc68d9c16dcddb4c2ade31fad3dde35d8cbd", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/cpu.py": "910dd523c4ca8fc50e69b0668542fdb72a9da49b64713e06b8db0c3fd50faf55", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/cuda.py": "80f372daf81ffeaff33748e9a77aa1c048b15695afeeb06d433ea619e7ce57a8", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/mps.py": "61603689750b195c7595f650c4366bf098206b89b3ffb62c0e4e08f33a3e0e7b", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/registry.py": "3f6faabfb3566897f24ae62447713b9c1724e61ffad2fca8d0d80a530c1420f2", + "vendor/pytorch-lightning/src/lightning/fabric/accelerators/xla.py": "75abf1bb47df08b07d23812f82ff0b825a15ed4de724b2ea42551b30c0807056", + "vendor/pytorch-lightning/src/lightning/fabric/cli.py": "cc1d854f3a217d4965bbf9416cc4a814712ccd01dcca87ce9d103731aa976bcb", + "vendor/pytorch-lightning/src/lightning/fabric/connector.py": "6c9724f2090045df3c4000e17bd82e9fa0c017c7ce2e5ffaa9e66146b4354f4c", + "vendor/pytorch-lightning/src/lightning/fabric/fabric.py": "4e81b9acba9db0c741751e57c851d698bd1a4bfa1f3328d97e9026e8ae85c178", + "vendor/pytorch-lightning/src/lightning/fabric/loggers/__init__.py": "cb2c75bba823d6d9b37b8ad775ea76e2475cf3a1cf117d35eb764c189abe1f6c", + "vendor/pytorch-lightning/src/lightning/fabric/loggers/csv_logs.py": "38aacd473613ee282b95438597c4b67bdfd522cb9b5636c694f2c8d62f96c9eb", + "vendor/pytorch-lightning/src/lightning/fabric/loggers/logger.py": "95615ba96408b8f0199595a6c02e3a4d1015c3f9505b936ded498a12b36c3bc4", + "vendor/pytorch-lightning/src/lightning/fabric/loggers/tensorboard.py": "da68e7bdd1ae44b6324f56f0fa9330d5f9db01b5f4b8f83a8335be91cb685b7c", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/__init__.py": "16ea31456d5eb5f728d4eb09cbb3ce646a964af4be0ee14faa4a6c5dcfbb2f01", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/collectives/__init__.py": "93cef8dd264bd2ca170f5d827a06b250e2ea7d60cb99702276d62d0dad0b88d5", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/collectives/collective.py": "17d6a8bbe6f256182a1cf10022229ece2f3ab83819ab75364b0a5bc9385abca7", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/collectives/single_device.py": "b4f0168fbf6f85a37f5f62358428ea3a99a1751f0f434f3d8bd1bbad344f361a", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/collectives/torch_collective.py": "ced4c5cb7a18379b77bd97a5d3ac9925d83d4cef0ce61c492ec1e0a169264cf8", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/__init__.py": "7372c76140ccd1974d441a4fa2db5c1a5aad9d052ea139ab0365d4b51cd68e25", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/cluster_environment.py": "e3d47aeb38cf54c54e909dfe8143e50771d5ec6771c6989ee606e0c6215a25e2", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/kubeflow.py": "f2ccb071aded919efb4e119e95fc26def37a3b1d31af10734d2467809f88d6fe", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/lightning.py": "13df5a18274677b8524dc5c56b6b635be6fdd36c7b573875dc3cbe937bd48b69", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/lsf.py": "8a815d1ef39cd010176f424c32e71f882ed3210923daf38531e44ff1a6877ba7", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/mpi.py": "0cf1f85ab6a636b16245d2e9aaaef5cb0031d1bb377ff85eb544b36fd59259ac", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/slurm.py": "300bb63a33d7c1f1039f025767eb859224c3364cbc6c16eea3b5954f93f3361c", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/torchelastic.py": "9111a17f3cc56d4e1fa8005adef10aac9285a4dd6fc1df76dde1fdf61f169d29", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/environments/xla.py": "6d01bc8ccfda812131e9034ca10d4dfed2356fff06a4dd83f19b5ace5489ca2a", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/io/__init__.py": "0c78df84545b90856f7b4cf0b0cb8bc2c71d0af149649170d87d5693d4f425ff", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/io/checkpoint_io.py": "60d93d4169f75f3c94d1fd7a26d436806d18eb410924486a71ed4c024a51715d", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/io/torch_io.py": "ebf0f1fa0048a50b3778a9da8c4120bdc6f6a9b1f487cbde107f91f8037597b7", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/io/xla.py": "f2f32282866e158d843f8e75c93160aba2ce2f40fb380b4d0f86837ccc138594", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/__init__.py": "ce1dd2c81b3c78e3a4b481f7f8265063512827a84550910f9cbb78a855994488", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/amp.py": "6aaf5b6e93daf2ba9754a58b69349f76f2e8f7fd4790106cc9c51a95aca70163", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/bitsandbytes.py": "e898f277c848cfcd2bb4ee126ba8a09f5a765bb7cbe021162e8b701e0ff41e19", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/deepspeed.py": "353433a58f6390c9d4d123b1178c8c44d6d0d97e7ccfea9e9df7266adfb62531", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/double.py": "a6dc30c7c5e7d4a6e541b69f1b91029e724e697e5a9af07bc31ddafb1b3eb148", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/fsdp.py": "8f9b92b5134fc236304a13dd7544f56b00c622685e87ffdf54bb87c6ce076b53", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/half.py": "3f350d3bf41086e22db507eb1c317b2d6bcf3dff2e9cf383ca27d8b26bf2626a", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/precision.py": "f052652418ab56008376f452f614184ec5c7361d40bb802e0479afaae2a9fb73", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/transformer_engine.py": "2e7c30f6cbbb3e1f7b5a8a9af5aaad6cd4865681647cd7cdcfe42026e82b7e8a", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/utils.py": "6141b02d980c92393beb391cac0c7db238492688fb37c5f87fe30660848ae02e", + "vendor/pytorch-lightning/src/lightning/fabric/plugins/precision/xla.py": "522a427db22c2408cdc6bd8b899a5c635eaae499bca9784ab5e19227c7fe51dc", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/__init__.py": "f1c10300d2d834b40e664950c1470e07129852c23955c537813721d15fd9f9ef", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/ddp.py": "976765824784c9ddf295daf55362762c59c7137b6d9e2f1d8956552465b994e2", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/deepspeed.py": "6b7b9bff1b5ecdf7e11055bd9e5d42850938befcde5e250108c9220c4623ec88", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/dp.py": "5adc0f89a104134e306cb917c7f1985e500d0349080a801858324df736334f1d", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/fsdp.py": "ca037ee28db1b13aab0ea9b34b88e425cd9670412fc9536187db78bfde877f28", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/launchers/__init__.py": "d69ac926b748afd37ddec7ad8ee9b44d802577d32ffda28d86932f5259b2a0d2", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/launchers/launcher.py": "cd2584a237d6e4b898df55cf1f83ddd5692d3dfab07c5e3818189a872c5876d4", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/launchers/multiprocessing.py": "c4905ee60ad102de63a2f1ab5da659c31d848c7677bcc33f38c2c3ea4dee21d4", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/launchers/subprocess_script.py": "40cbe055fff73c7381367469a6b201ffdbf2753abc86fe2b43fad9d28ac80672", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/launchers/xla.py": "1213ccaaf17cf355673a4f1c7a8a07260ed0b43645720a663a6528d519b26af2", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/model_parallel.py": "72905a660273471467007a8a74c7b4baf2d061b03873be8b5dd8f45a81649f84", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/parallel.py": "536886e0653f3dbee037dbd527b40f427b0881d0473e163256b36cd5414ada96", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/registry.py": "5a7aa471db8c96a695740d815b5b98efa3874d60c1b82e70c855278beb398f28", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/single_device.py": "ec0bee3ab04a1d4b1eaac24924065cdf3389a60522f57207ec55cacc22537040", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/single_xla.py": "310f56e6ea85aee0a5eec0c975456c098125328d5e7c677ec413d84fc8cecc4e", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/strategy.py": "9dbf6a6e5de6e9ce22d278a2e53e0c1f6412f0beee36beaf5fa02410a5aa93ac", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/xla.py": "71c22a53755bb32318881b683522b3781e261d2afb1a3cc8bc1df5a324775d43", + "vendor/pytorch-lightning/src/lightning/fabric/strategies/xla_fsdp.py": "be433438b967807d30846596d40de3e2ba30a4f3d71d68c6af9fed14d24c9053", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/__init__.py": "5e9fae596ec945b96f130a5b71390db432c5fe95359e47dad2a37e3e9e54623d", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/apply_func.py": "aa250ac6e427355afda311d6016d95304ac599e432b6feda1ffd38fd8a8e0ad4", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/cloud_io.py": "9cb2f5ebad6ae169f529a610a9976ef68cf5764dd762e3d956e27025955a095c", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/consolidate_checkpoint.py": "80a332df6aa0a04ac8871ae2920ce04e100f2791fe7895a7bb292b68f2448412", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/data.py": "e13f79469e7a63b61cad2183bcc70965c94b2fe0efcce07ae068d45e12b2cf2e", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/device_dtype_mixin.py": "37b467ca587a07094eaa92153d73634a7598309bec7008e410cf1d10bd939d68", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/device_parser.py": "6dc64c6a40f3a1b544e68f384d853ec8e9818bb06ea21cb2be75c52dba9802bf", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/distributed.py": "4a0817237a8cd5baf96382c495792d0f69363d997da759360850c14fad1e1cd4", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/enums.py": "eb5ef79768098f1dd2f6d6656e90b0d0794f4759affdb477ccafbc2f36cb7bf5", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/exceptions.py": "88ccfc9abdfa05cd7ba874c8fd29053ca80f5b30ae24a7bc8278642f229d881d", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/imports.py": "92bfe06ee72f69341f382632346155df0ff6f25ce495e9d8abd879f4ed3a7183", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/init.py": "8aeb263cf7404e763f11902ddee33712e321f19a6d62171cc31f512b5660e3ce", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/load.py": "b8118d54f0672c06afa02512d666b59a76923786a909f3bef52efb3ca4da1d8d", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/logger.py": "46f4b37f85918aec94cdf8555b017418b70ec68d2f81364ace9508742e7004d3", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/optimizer.py": "a224b1a97a62ca3ac61f867087ca555826216abf6b4242a2fe5c198f59d0e10d", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/rank_zero.py": "a3ca653a3a7adb34ee9263007581c5c248203d0fd3b80cbb3967ec7aa16d4154", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/registry.py": "a112d01d58022724464fdc595d912af768b3c1c92f3d0dfe1c043ad50af6f5bf", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/seed.py": "ea543a5f87e65c446a788017f710ad219335bb5aad4c7c4c8557bd2e65e3aa3e", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/spike.py": "68dd44576f4d100b8dda5c786ca9d9cdd643ab1e11d2054b9404fc3fae0efa49", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/testing/__init__.py": "ecfd55bfac2a1c2a69a50bedb5ba0f111296a8c8aa133c28c02204f13cfd429a", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/testing/_runif.py": "2574bdf902c215afc8fb1cae2630b8c5ca2b023edfd910a06a7ba65d7a43cf04", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/throughput.py": "714eb2e27345b1c726ca8bd859b54efa5563ee421574b6813613efde9fa55853", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/types.py": "fa8b711864e86e457c371ee089ff5b84ab77776fe09ed0d20793a9c1dc26d52a", + "vendor/pytorch-lightning/src/lightning/fabric/utilities/warnings.py": "52c1631d4157b7d1fdb331f4043b45633dd15011a4abfcf98929f2f1af07ddb8", + "vendor/pytorch-lightning/src/lightning/fabric/wrappers.py": "a31309f029075175e5afe29ea03a6ed6ba821ad968bfef5b91d9119de385df6c", + "vendor/pytorch-lightning/src/lightning/pytorch/__init__.py": "75ad4f4c2943325f88064ad2beae890b59674be2bf0404b30afc5584dc4de4bb", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/__init__.py": "a1c349fdde9d7d081eea3a55d752b842caf2a33cf75df33411710ccbc52e18c9", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/batch_size_finder.py": "71f32bff8af8c1dfce33a7e252f89507614a0670c741029b8ba88f17b9292393", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/callback.py": "83f484e4ae837ad117647304b8d35be7685a21d5fa1e3ce6338a9e856b150113", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/checkpoint.py": "cc9d1c86e70b2f24e4f70f9d5a90442bc98d1d909809343f1b95c37efa08bc9d", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/device_stats_monitor.py": "a509134f44473662361d9cd6d8fc48151b1b5bb27745868fbd299b15e8da42a5", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/early_stopping.py": "38cfb140f5826ecd47674629a1492dcb9ef15fdf6f997ac932c82c2740b24918", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/finetuning.py": "e61d2b8ff69adff6faad7a157dcedd9048287421bc2cf5e7340bf1a41e17e38a", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/gradient_accumulation_scheduler.py": "77e5eed60d3cea6c7be7562c06b61b790ce2647a89f92aeb448d64ca7782d1db", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/lambda_function.py": "c5e50fbe4941c4f2504b6177ef7afbb0c94113b085175b1fcfb651c11b58e57e", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/lr_finder.py": "490b0ca05412a814dec416817ddcdd67068f0173408b67a8ad815a0f1f3fd864", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/lr_monitor.py": "fb379a2afb98fa65595d285971a5d572cebe2fde7a952bbc06b5ad6996a63060", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/model_checkpoint.py": "416ed3208f3d49962a0008dc7195a39dd56b8cae2c31df3a3d69e45392988d4e", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/model_summary.py": "896521835049a79b9fe5add6b6f3a00127bcf7a2a766cab3ea2bb2a4e8a92db5", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/on_exception_checkpoint.py": "f6819540e96ab9e1a09a6781dac05a912d55beaa76d73e7295857e73d180ff38", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/prediction_writer.py": "c3cd2677ab96ba49fbc8a6efdb38054a7aff75f65af4fbcdb652b89dc803d21b", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/progress/__init__.py": "b77ad674ec9a339bbd027357ac75aff8d58b96fd28ede06ce60e349d52be2127", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/progress/progress_bar.py": "72caa148563a5a899ef32241e933192fa2b95846364f754a845d0a827f481d67", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/progress/rich_progress.py": "816369de14d2ce6185f88a485ad88332f1b89d4bfffc7c03c6713a97cceb702c", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/progress/tqdm_progress.py": "026a0f14115fd302897fb0b8dd55ad698c8a907545753c0fc6e757503bccc935", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/pruning.py": "58a131e9a07bb2de1a6a3c3ee5a93f1e0a44dcc0afaf7a736621a4a6f1032313", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/rich_model_summary.py": "d4564bcdd8ebbf28d9fc07dd65b5309c9367cf27eff7c6e2bd42af86dda18d77", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/spike.py": "7232b4f516e26061947e0935a23502144583f9761811d28ae49f75b174e960e8", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/stochastic_weight_avg.py": "bb03342ad874816e71f74c7a556970a57736a08af4170d6a4a41413f7ce54728", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/throughput_monitor.py": "8be87c1e3b7b2af3d77883c319c59a840c8c3e3fd024da8f4b6ed183eac79318", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/timer.py": "270cb2d624d40785acb7ec1eb4175ddc4890fc109867314e1672bc5696e57f93", + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/weight_averaging.py": "222057df6a51536cd148b912afdb6251df4a138decdc3ca16b32e0c7bac1fdf3", + "vendor/pytorch-lightning/src/lightning/pytorch/core/__init__.py": "d94c518dd0822e3f43c72dc931f459e7d98ce1c7ba3f67c411a45f8e9f0159b4", + "vendor/pytorch-lightning/src/lightning/pytorch/core/datamodule.py": "8e79069a8632e5ecf83847ec512c6fd98e69e6267502bbd8d1e78aec56074221", + "vendor/pytorch-lightning/src/lightning/pytorch/core/hooks.py": "a72357088cc8823577d97b9e540ea47a70c35d3987e6f03636b50899adcb8fe2", + "vendor/pytorch-lightning/src/lightning/pytorch/core/mixins/__init__.py": "77e1f5eef17f0ad33ce926064041b388857dbfbe20e45faa5d8d502157b416e4", + "vendor/pytorch-lightning/src/lightning/pytorch/core/mixins/hparams_mixin.py": "2b48e2300ecb1e4aa18b8ccb16d5c1c427475e3432314ebdccaf6a7952429013", + "vendor/pytorch-lightning/src/lightning/pytorch/core/module.py": "40684b7f3837b942d59e8b35f4b49b5c34156ae1039c393d5c62ec286c3aef9a", + "vendor/pytorch-lightning/src/lightning/pytorch/core/optimizer.py": "8d5ec278ac5a152c614fd183894f2ace333e2053b17bb6aa58d7f8b63edaa7e4", + "vendor/pytorch-lightning/src/lightning/pytorch/core/saving.py": "d8c676d0c8c30bb00b2060f7a8d4b8671561e3c7b6e7e136308cbd0f226a7d2f", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/__init__.py": "4e049cf73466ee8b3c1ef2ca2d7d4cd7779033982aca362d8427132b71a83929", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/evaluation_loop.py": "1f2155cd0433e6128fa2f866d1b5ec5f76d4f8c16931712a337f21fade5197f5", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/fetchers.py": "a0b6f80d7acf42f452948934f9d177bea76c5cf09413b94d3671c1da9ec14dfd", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/fit_loop.py": "a8cce89851fef8dd3e995808234d623bd5f57465b24350a7f18aa99e8ed1f7fb", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/loop.py": "6fae1b42e678d8cd52ef31168a9c686c8b0819e2af8454cfc4635046168697c8", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/optimization/__init__.py": "c79dd9687725f6e5ec9b5ea6174a1628438f7aee59c58437cf8a6360d09e9ace", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/optimization/automatic.py": "8e26926763754c71b19dd8aa057a8a441b347f20c7270254fdbeceade279dd44", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/optimization/closure.py": "fd04f3c9d0141ab0549d259fb13dc3d32d0781a5b42285f8ac94624140d5a279", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/optimization/manual.py": "7292cc05f8634cd62ca848b6b14dfc030db9f5709fd8f135b99b10fb312e803a", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/prediction_loop.py": "0ee1dc90d161eda682a2e7ca730ed950578fe3497983d93581594ff7515d8f14", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/progress.py": "bd9064d12d0f044758ff041c20f223b59489879bf842dbe80f7bb68dc7fe0ac7", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/training_epoch_loop.py": "03edaf990ff7f3a02910b0f63e88f7f293669103fe3b0d9896dc738c7ae81a4d", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/utilities.py": "149a8a4277829eb6e90248e92a459c1f7bdca65261e27f92c24a2e429b2780b8", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/__init__.py": "8016fa5b21fb17d31a2fdb57162e4574b880a199dfd12363776597728d4b6936", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/call.py": "e5d448f69a1810790e6e79b83b0bbc0437e9194efb08a70e764c86244a077731", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/configuration_validator.py": "54da1d375bf6d3a5d3374fa4949579696c256085a17a393942d251f5ec0459c6", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/accelerator_connector.py": "48498c26539f66e3dab5625be093d26da3ea245dad40e219506fcfdadf45cf14", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/callback_connector.py": "e7a14425e0b00fc0dc109cf8f570cb27593428d39a106e86a0cc7556030b68c8", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/checkpoint_connector.py": "0d23fa610559976464e32bd6cec7f0657ceec6cfd667a7f4933aafc163524955", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/data_connector.py": "2432d5a6ef9450c5951dfee663c39340b78deb4cd5076da4bbb2a2d8a54ad825", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/logger_connector/__init__.py": "bbc95985e20ca8055732eaf771bb797b84e723e6a146fbf918e10d5ec1b600cf", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/logger_connector/fx_validator.py": "cae0589cfaa0d4531a1d3f604cc8c34cc3472b978ed9d879f3460db3a62dbba2", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/logger_connector/logger_connector.py": "9b90e32ba2ea8be3bb26a5126c580d7164cff96159876986292bea9eaa3f1185", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/logger_connector/result.py": "3286aba7341a262d710789f4ec43d7fbf31bcf73886ded14bee350389e78bfb9", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/connectors/signal_connector.py": "aa0322db2a237e282b268754b317dc389eb6a4c8d5188294f38e1836e08bff4e", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/setup.py": "619ddb76dcbe30433fbddbe021d9ee3ca0902b76cba2572fbe2f270a8705b3c8", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/states.py": "2bded7c883d949ca2e1fc17a098dd86fa6a96ec8da40cac4d7e1830a2af5727a", + "vendor/pytorch-lightning/src/lightning/pytorch/trainer/trainer.py": "f24d50d7bfcd936183dfe499420269b774894e9c6efa7b5209739bc91cc9cde0", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/__init__.py": "6ef732e46c30b15cbaa60d30464317e4a32cef562b9c0b76299e5142ab61c7e1", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/_pytree.py": "6ca993f386e3b415fce461ba996191f895013c7e0c2a2a007790df634c61d670", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/argparse.py": "49eed6bcfc169bee3840f5ab3885676ca3301fc880baf166d148b07dfd03d28f", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/combined_loader.py": "3be3bbafe1ed7b05e4af116b9274cca8f4e5cca9d5c33b323b3b96dec936b661", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/compile.py": "1aaff5c251e0804141af51019a25ef307751690c8bb72e6df6026d0b021b72f4", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/consolidate_checkpoint.py": "18ace6c4b1a0b2e19aed5fbce00a304398323cb550ce2c664b473cd4c2f6ea7d", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/data.py": "22a6c81ce73ea0bf05581c4aee585db887a5fde222853939de47850090e964a5", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/deepspeed.py": "0608e72c3148767d5be03029f8c77195bf785e3be124458b1d2931ec43229b63", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/enums.py": "e8137fa64bfb8368970382362a970663e0879d2619d7dc7417cebfc550df14f4", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/exceptions.py": "b6008a18d6f8d5ef82c63a4e7b11cf37bd2e0569ec11c57eec2241eeaa0d395d", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/grads.py": "22584022d6fd6493ef06f732f1a2ee041176530230ab817e703b565b6336abf6", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/imports.py": "15142a75d1c77264251307aaadd04f0651e1d7f1311b19da19f08bb6efcca594", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/memory.py": "08f5d80c44be2ea1af78eaf4c5ca179df98bbcd251179828fa1eb65f86386bcd", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/migration/__init__.py": "bfb3a78cdc74164b9e87d8d45c3519451547ff6f7e76f7f0ba724ba46ad43e7d", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/migration/migration.py": "56d7915a6fbea3cbd3d02635530c5c4586440eebe2c94f08e6b9afe1c1717a08", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/migration/utils.py": "cb849c2b385f5c98bedceee4eca83753ada5905c8bf2efe313fb368517a58d84", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/model_helpers.py": "eb8686ec40e0ba26e8d811a1c20de9b0154897c7f14cc61ad960df62ec81bc8e", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/model_registry.py": "6bf389379651ca2aade9aec905ffd69c1949010f1125006f6858ed1db6c22df9", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/model_summary/__init__.py": "c5910c211ea3114bd36232b805ba4b8d8d5d721e8a9410e38f2e51735c61b314", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/model_summary/model_summary.py": "83e45ddbff1ec35d893dd2242484ef94e67da478c21c0ec322fa2f768ffb4dc0", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/model_summary/model_summary_deepspeed.py": "913ead0e833f478718a816e1048e0fd94062170e97d0ba42815d48c53fd87e6f", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/parameter_tying.py": "9c38892ab71a62f64263632df765a50725c2157d5c5f51926d472811e43e2dc5", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/parsing.py": "d23712b294327acc5a9814f12a49c0f395f1383ba6a6a5997656a0cd83a9620b", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/rank_zero.py": "3b6c9d3249881acdfeaec05c90faaaf53cc49375f6c7a2835c436da115d1dac0", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/seed.py": "2899e43b15333f218d991fb9f48480ff000a237f4ec006f6a762403a10d55013", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/signature_utils.py": "e5fff9badc04cabf4b5fa821865e1b489dfd2638fbcc4d7e0aac033ba4af064a", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/testing/__init__.py": "20ac73265fab22a5cafc10b1d56c66d01f21af911112a8d323a8158488b85805", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/testing/_runif.py": "ce2b3b1ca83e284df2e748179fd0ecfe8c2cdf2acefd961e33d17f2f4b94a09e", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/types.py": "038505aee7888dee61bf559d3850ca35fa6c57e2061cb2f160477b6fbcfc6db2", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/upgrade_checkpoint.py": "9ad1d9ed1e88a583c1c2a4804d42455a92cdc2c7837695d60d9a022f3237ce53", + "vendor/pytorch-lightning/src/lightning/pytorch/utilities/warnings.py": "f05c576bd79d4d730254be1be7023a67f5eb3a7b78858a2d7516cb75fe7a2443", + "vendor/torchmetrics/__init__.py": "4c6d573a57f511b43a4376c723c749e72f66637768d173d3e6529bd8761fa125" + }, + "mutable": [ + "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/early_stopping.py", + "vendor/pytorch-lightning/src/lightning/pytorch/loops/fit_loop.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1890-ml-training/tests/fixtures/regression_probe.py b/tasks/candidate-1890-ml-training/tests/fixtures/regression_probe.py new file mode 100644 index 0000000000000000000000000000000000000000..1fd3d8385006764c3f29510bfaa92b21e079c510 --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/fixtures/regression_probe.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python3 +import ast +import enum +import json +import sys +import types +from pathlib import Path +from types import SimpleNamespace + +import torch + + +APP_ROOT = Path(sys.argv[1]) +OUTPUT_PATH = Path(sys.argv[2]) +SOURCE_ROOT = APP_ROOT / "vendor" / "pytorch-lightning" / "src" / "lightning" / "pytorch" +sys.path.insert(0, str(APP_ROOT / "vendor")) +sys.path.insert(0, str(APP_ROOT / "vendor" / "pytorch-lightning" / "src")) + + +def namespace_package(name, path): + package = types.ModuleType(name) + package.__path__ = [str(path)] + sys.modules[name] = package + + +def install_offline_compat(): + lightning = types.ModuleType("lightning") + lightning.__path__ = [str(SOURCE_ROOT.parent)] + sys.modules["lightning"] = lightning + namespace_package("lightning.pytorch", SOURCE_ROOT) + namespace_package("lightning.fabric", SOURCE_ROOT.parent / "fabric") + namespace_package("lightning.fabric.utilities", SOURCE_ROOT.parent / "fabric" / "utilities") + namespace_package("lightning.pytorch.utilities", SOURCE_ROOT / "utilities") + + utilities = types.ModuleType("lightning_utilities") + utilities.__path__ = [] + core = types.ModuleType("lightning_utilities.core") + core.__path__ = [] + enums = types.ModuleType("lightning_utilities.core.enums") + class StrEnum(str, enum.Enum): + def __str__(self): + return self.value + + enums.StrEnum = StrEnum + rank_zero = types.ModuleType("lightning_utilities.core.rank_zero") + + def rank_zero_only(fn=None, **_kwargs): + if fn is None: + return lambda wrapped: wrapped + rank_zero_only.rank = 0 + return fn + + rank_zero.rank_zero_only = rank_zero_only + rank_zero.WarningCache = type("WarningCache", (), {}) + rank_zero.rank_prefixed_message = lambda message, rank: message + for name in ("rank_zero_debug", "rank_zero_deprecation", "rank_zero_info", "rank_zero_warn"): + setattr(rank_zero, name, lambda *args, **kwargs: None) + sys.modules.update({ + "lightning_utilities": utilities, + "lightning_utilities.core": core, + "lightning_utilities.core.enums": enums, + "lightning_utilities.core.rank_zero": rank_zero, + }) + + +install_offline_compat() +namespace_package("lightning.pytorch.callbacks", SOURCE_ROOT / "callbacks") +namespace_package("lightning.pytorch.loops", SOURCE_ROOT / "loops") +namespace_package("lightning.pytorch.trainer", SOURCE_ROOT / "trainer") +namespace_package("lightning.pytorch.trainer.connectors", SOURCE_ROOT / "trainer" / "connectors") +namespace_package( + "lightning.pytorch.trainer.connectors.logger_connector", + SOURCE_ROOT / "trainer" / "connectors" / "logger_connector", +) + +from lightning.pytorch.callbacks.early_stopping import EarlyStopping +from lightning.pytorch.trainer.states import TrainerFn + + +def load_fit_loop_contract(): + source_path = SOURCE_ROOT / "loops" / "fit_loop.py" + module = ast.parse(source_path.read_text(), filename=str(source_path)) + fit_loop = next(node for node in module.body if isinstance(node, ast.ClassDef) and node.name == "_FitLoop") + required = {"_met_min_epochs", "_met_min_steps", "_can_stop_early"} + methods = [node for node in fit_loop.body if isinstance(node, ast.FunctionDef) and node.name in required] + if {node.name for node in methods} != required: + raise RuntimeError("FitLoop minimum-gate properties are incomplete") + contract = ast.ClassDef( + name="FitLoopContract", + bases=[], + keywords=[], + body=methods, + decorator_list=[], + type_params=[], + ) + extracted = ast.Module(body=[contract], type_ignores=[]) + ast.fix_missing_locations(extracted) + namespace = {} + exec(compile(extracted, str(source_path), "exec"), namespace) + return namespace["FitLoopContract"] + + +FitLoopContract = load_fit_loop_contract() + + +class Strategy: + def reduce_boolean_decision(self, value, all=False): + return value + + +def fit_loop(processed, min_epochs, global_step=0, min_steps=0): + loop = FitLoopContract() + loop.min_epochs = min_epochs + loop.min_steps = min_steps + loop.epoch_progress = SimpleNamespace(current=SimpleNamespace(processed=processed)) + loop.epoch_loop = SimpleNamespace(global_step=global_step) + return loop + + +def gate_snapshot(processed, min_epochs, global_step, min_steps): + loop = fit_loop(processed, min_epochs, global_step, min_steps) + return { + "met_min_epochs": loop._met_min_epochs, + "met_min_steps": loop._met_min_steps, + "can_stop_early": loop._can_stop_early, + } + + +def check(processed, min_epochs, values, patience=1, global_step=0, min_steps=0): + callback = EarlyStopping("val_loss", patience=patience) + trainer = SimpleNamespace( + fast_dev_run=False, + callback_metrics={}, + strategy=Strategy(), + fit_loop=fit_loop(processed, min_epochs, global_step, min_steps), + should_stop=False, + current_epoch=processed - 1, + state=SimpleNamespace(fn=TrainerFn.FITTING), + sanity_checking=False, + ) + snapshots = [] + for value in values: + trainer.callback_metrics = {"val_loss": torch.tensor(float(value))} + callback._run_early_stopping_check(trainer) + snapshots.append( + { + "should_stop": trainer.should_stop, + "wait_count": callback.wait_count, + "stopping_reason": callback.stopping_reason.name, + "stopped_epoch": callback.stopped_epoch, + } + ) + trainer.fit_loop.epoch_progress.current.processed += 1 + trainer.current_epoch += 1 + return snapshots + + +cases = { + "deferred_patience": check(1, 3, [1.0, 1.0]), + "post_min_epochs": check(3, 3, [1.0, 1.0]), + "min_steps_only": check(1, 0, [1.0, 1.0], global_step=1, min_steps=5), + "recovery_after_defer": check(1, 3, [1.0, 1.0, 0.5]), +} +fit_loop_gates = { + "epoch_pending": gate_snapshot(1, 3, 5, 5), + "step_pending": gate_snapshot(3, 3, 1, 5), + "all_met": gate_snapshot(3, 3, 5, 5), + "no_minimums": gate_snapshot(0, 0, 0, 0), +} +payload = { + "output_schema_version": "tbench.early_stopping.repair.v1", + "cases": cases, + "fit_loop_gates": fit_loop_gates, + "summary": { + "deferred_stop": cases["deferred_patience"][-1]["should_stop"], + "ordinary_stop": cases["post_min_epochs"][-1]["should_stop"], + "min_steps_stop": cases["min_steps_only"][-1]["should_stop"], + "recovered": not cases["recovery_after_defer"][-1]["should_stop"], + }, +} +OUTPUT_PATH.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n") diff --git a/tasks/candidate-1890-ml-training/tests/task_test.sh b/tasks/candidate-1890-ml-training/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..e269779a6cc8b1417b0c0ff2289c216103650fdd --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then printf '1\n' > /logs/verifier/reward.txt; else printf '0\n' > /logs/verifier/reward.txt; fi +exit "$status" diff --git a/tasks/candidate-1890-ml-training/tests/test.sh b/tasks/candidate-1890-ml-training/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1890-ml-training/tests/test_outputs.py b/tasks/candidate-1890-ml-training/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..23837d0293ccf097a93d3a5746778c56a1cbb38a --- /dev/null +++ b/tasks/candidate-1890-ml-training/tests/test_outputs.py @@ -0,0 +1,69 @@ +import json +import subprocess +from pathlib import Path + +OUTPUT = Path("/app/output.json") +ROOT = Path("/app") + + +def load_output(): + assert OUTPUT.is_file() + return json.loads(OUTPUT.read_text()) + + +def run_reference(): + result = subprocess.run( + ["python3", "/tests/fixtures/regression_probe.py", "/app", "/tmp/recomputed.json"], + cwd="/tests", capture_output=True, text=True, timeout=30, + ) + assert result.returncode == 0, result.stderr + return json.loads(Path("/tmp/recomputed.json").read_text()) + + +def test_gate_schema_and_files(): + payload = load_output() + assert payload["output_schema_version"] == "tbench.early_stopping.repair.v1" + assert set(payload["cases"]) == {"deferred_patience", "post_min_epochs", "min_steps_only", "recovery_after_defer"} + assert set(payload["fit_loop_gates"]) == {"epoch_pending", "step_pending", "all_met", "no_minimums"} + assert (ROOT / "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/early_stopping.py").is_file() + assert (ROOT / "vendor/pytorch-lightning/src/lightning/pytorch/loops/fit_loop.py").is_file() + assert (ROOT / "run_regression.py").is_file() + + +def test_core_independent_recompute(): + expected = json.loads((Path("/tests/fixtures/expected.json")).read_text()) + assert load_output() == expected + assert run_reference() == expected + + +def test_core_deferred_and_ordinary_stop(): + payload = load_output()["summary"] + assert payload["deferred_stop"] is False + assert payload["ordinary_stop"] is True + assert payload["recovered"] is True + + +def test_core_min_steps_boundary(): + case = load_output()["cases"]["min_steps_only"] + assert case[-1]["should_stop"] is True + assert case[-1]["stopping_reason"] == "PATIENCE_EXHAUSTED" + assert case[-1]["stopped_epoch"] == 1 + + +def test_core_fit_loop_gate_matrix(): + gates = load_output()["fit_loop_gates"] + assert gates["epoch_pending"] == {"met_min_epochs": False, "met_min_steps": True, "can_stop_early": False} + assert gates["step_pending"] == {"met_min_epochs": True, "met_min_steps": False, "can_stop_early": False} + assert gates["all_met"] == {"met_min_epochs": True, "met_min_steps": True, "can_stop_early": True} + assert gates["no_minimums"] == {"met_min_epochs": True, "met_min_steps": True, "can_stop_early": True} + + +def test_edge_source_contract(): + callback = (ROOT / "vendor/pytorch-lightning/src/lightning/pytorch/callbacks/early_stopping.py").read_text() + fit_loop = (ROOT / "vendor/pytorch-lightning/src/lightning/pytorch/loops/fit_loop.py").read_text() + assert "trainer.strategy.reduce_boolean_decision" in callback + assert "trainer.fit_loop._met_min_epochs" in callback + assert "self.stopping_reason = EarlyStoppingReason.NOT_STOPPED" in callback + assert "def _met_min_epochs" in fit_loop + assert "def _met_min_steps" in fit_loop + assert "return self._met_min_epochs and self._met_min_steps" in fit_loop diff --git a/tasks/candidate-1939-software-systems/environment/Dockerfile b/tasks/candidate-1939-software-systems/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f48cb99893a11588647014675a3a2d2917f73bb8 --- /dev/null +++ b/tasks/candidate-1939-software-systems/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d7066c22ca55bab53a6d469b6a2a8a5492a3367b7417441257cf400792295bb8 diff --git a/tasks/candidate-1939-software-systems/environment/setup/setup.sh b/tasks/candidate-1939-software-systems/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1939-software-systems/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1939-software-systems/instruction.md b/tasks/candidate-1939-software-systems/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6d63b3dde2b5231f7a6a40cd9d56c1bead41b375 --- /dev/null +++ b/tasks/candidate-1939-software-systems/instruction.md @@ -0,0 +1,17 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair compressed wheel-tag validation + +Work in `/app`, an offline checkout of a Python packaging compatibility library. A recent compatibility regression is exposed at two public entry points: direct compressed-tag parsing and wheel filename parsing. Diagnose the behavior from the existing source and focused tests, then repair the existing implementation rather than replacing it with a new standalone evaluator. + +Requirements: + +1. A compressed tag has interpreter, ABI, and platform components. Dots inside a component represent compression, but interpreter members must be valid identifier-like names; numeric-looking members such as `2.7.6` must not silently expand into three interpreters. +2. Preserve valid identifiers containing digits and underscores, including `py3`, `graalpy311`, and `_custom`, as well as valid compressed tags such as `py3.py2-none-any`. +3. Keep the public exception boundary: direct tag parsing must raise `InvalidTag`, while wheel filename parsing must raise `InvalidWheelFilename` for malformed tag semantics. Do not break valid filename normalization, versions, build tags, or sorted-tag validation. +4. Modify the existing production modules that own these behaviors (`src/packaging/tags.py` and `src/packaging/utils.py`). Keep the existing package and regression tests intact. +5. Run the provided workflow from `/app/tools/run_compatibility_workflow.py` and leave its result at `/app/repair_report.json`. The report must retain the declared `packaging-compatibility-report.v1` schema. + +Suggested workflow: inspect the call chain, reproduce both public failures, implement the shared validation and utility-level error translation, run focused tests, and then run the workflow to produce the report. No network, package installation, or external service is available or required. diff --git a/tasks/candidate-1939-software-systems/task.toml b/tasks/candidate-1939-software-systems/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d4cdd3645ffefd0bdfb57c2c33c990ee48a9e728 --- /dev/null +++ b/tasks/candidate-1939-software-systems/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1939-software-systems" +description = "MiMo-V2.6-RL terminal task candidate-1939-software-systems" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1939-software-systems" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:d7066c22ca55bab53a6d469b6a2a8a5492a3367b7417441257cf400792295bb8" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1939-software-systems/tests/anti_hack_guard.py b/tasks/candidate-1939-software-systems/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1939-software-systems/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1939-software-systems/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1939-software-systems/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..0832cf7683c0657e67747a5dda31dab864a08a85 --- /dev/null +++ b/tasks/candidate-1939-software-systems/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,44 @@ +{ + "artifacts": [ + "repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "LICENSE": "cad1ef5bd340d73e074ba614d26f7deaca5c7940c3d8c34852e65c4909686c48", + "README.rst": "62ffae0495b4ed9b8357c03f661b923861565fc8f3bdd42de23a4e5217514e3a", + "compatibility_cases.json": "5fd88a36e88db6a5e96383034eb87f0f3c78f44bb5ef03e2708bfe5b72b37f4d", + "pyproject.toml": "b0a54ca7272d1dce914f64e6dddf6026e5664aff3622971994956b320c00f59e", + "src/packaging/__init__.py": "bf01887ad0f4a9fa9e3b9cd4601dc40a7b2970b5c808cde59e64c4aa1e797c91", + "src/packaging/_elffile.py": "1f025f54c573f1a85740c4fbd908cc1d1fb0c177c14377ebf5f09d6cd5368780", + "src/packaging/_manylinux.py": "5b6e84324c42538ab4cdb148e2430fdba36f04427b0efda55bea083a35fa6136", + "src/packaging/_musllinux.py": "0328fb827b1170c77df4c107d49be8df8d37262103490a61e8acad8a2f9cadff", + "src/packaging/_parser.py": "88a348115209327497e453b635e5db099fd592f9335d710c7313b29cdb30c50c", + "src/packaging/_ranges.py": "b7b595f2e692aeb3697c545b85c24cbbcb4552f2adc6d9059aa82d0877e816b7", + "src/packaging/_structures.py": "eb48d16c5efca7ccf930a9cd77a700a6b80e69d0891d5d03966526441a8565cb", + "src/packaging/_tokenizer.py": "cc25e57c0d564c89e15073471d6e1c264299ca946fb17c0e1e4af54ef7713ee6", + "src/packaging/dependency_groups.py": "5309cc564ca3022dfb594816e9d593bb09cdf34208c1fb8c5ec9afb6c670278c", + "src/packaging/direct_url.py": "843baa95d04cbb49288de9d9fd77ee946e862cb603123e7e46a69e171fa7d06b", + "src/packaging/errors.py": "ea17c461701ff2ffc817ae7e94569d24e30889e04fdb120ab721178c6d67188b", + "src/packaging/licenses/__init__.py": "590d12eee73ddbec53b4e9ee5bfc64d9cb3aacb4940e8ebcba260757ce56740b", + "src/packaging/licenses/_spdx.py": "596ec35e2ca0ebcba9fd8343ff0a51625af548786257815f24b41f7e08613314", + "src/packaging/markers.py": "9056d5d4882a3ba14a7624ba64c3a33aadb00c563dce4d15343dc229fbef5f8a", + "src/packaging/metadata.py": "de04e563692ed785d4779c711639b9c464f92fb5865d80c9a540602f8f12ba14", + "src/packaging/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "src/packaging/pylock.py": "1bc9a1fc8835202b3b5722fcde0b142f71064b31d9c67647ea879d9b21c855c5", + "src/packaging/ranges.py": "b4781ce913e5dff9e07906f20585c54c3028e1f7ff56341828e79d522ddbfab6", + "src/packaging/requirements.py": "c3e8fd347d4c92e4083445fd95441fcb02d2def922c96d1b2147728c394168aa", + "src/packaging/specifiers.py": "f9e37cfb1ceba333a1302c2af605ec6f2fb67801f341af70d347f9271ab8e9cb", + "src/packaging/tags.py": "cb6d67388b647f87e4e83b89a005949e682c6b804f4b7f2bb0a2853e6d15b590", + "src/packaging/utils.py": "0074d32bf98c4bc4a400507c499615ac8c29b09a456d538422d82fd39640c8aa", + "src/packaging/version.py": "af4b2bfdbdaaf743eb5ef831e7981963857ef39ab96fdbeee4d402539f715059", + "tests/test_tags.py": "a015559c1b895327d5e0170c2cd1e606914b4056d2baeafbaea61b2e9b07b539", + "tests/test_utils.py": "74ac2b0c4785428c8393ea27eea36749c90ae10a5b01b039b5c7a29b116f8a4c", + "tools/run_compatibility_workflow.py": "891a62bef4f1401e58af021e244118dcd3085bc42e05eaa4d4b21b303290c41c" + }, + "mutable": [ + "src/packaging/tags.py", + "src/packaging/utils.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1939-software-systems/tests/fixtures/trusted_expectations.json b/tasks/candidate-1939-software-systems/tests/fixtures/trusted_expectations.json new file mode 100644 index 0000000000000000000000000000000000000000..286198aaae88821e08b84cb6a37a8bc380f32c81 --- /dev/null +++ b/tasks/candidate-1939-software-systems/tests/fixtures/trusted_expectations.json @@ -0,0 +1,12 @@ +{ + "schema_version": "packaging-compatibility-report.v1", + "valid_interpreters": { + "valid_python": ["py3"], + "valid_custom": ["graalpy311"], + "valid_compressed": ["py2", "py3"] + }, + "invalid_cases": { + "malformed_numeric": ["InvalidTag", "InvalidWheelFilename"], + "malformed_empty": ["InvalidTag", "InvalidWheelFilename"] + } +} diff --git a/tasks/candidate-1939-software-systems/tests/task_test.sh b/tasks/candidate-1939-software-systems/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..06f3fe9539a42b253d322f68c4f46e44202495f7 --- /dev/null +++ b/tasks/candidate-1939-software-systems/tests/task_test.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set +e +mkdir -p /logs/verifier +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +if [ "$status" -eq 0 ]; then printf '1\n' > /logs/verifier/reward.txt; else printf '0\n' > /logs/verifier/reward.txt; fi +exit 0 diff --git a/tasks/candidate-1939-software-systems/tests/test.sh b/tasks/candidate-1939-software-systems/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1939-software-systems/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1939-software-systems/tests/test_outputs.py b/tasks/candidate-1939-software-systems/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..98c1e0a3299b130335fb17d9eb8f88ae1b6d9c04 --- /dev/null +++ b/tasks/candidate-1939-software-systems/tests/test_outputs.py @@ -0,0 +1,84 @@ +from __future__ import annotations + +import hashlib +import json +import sys +from pathlib import Path + +import pytest + +APP = Path("/app") +sys.path.insert(0, str(APP / "src")) + +from packaging.tags import InvalidTag, parse_tag +from packaging.utils import InvalidWheelFilename, parse_wheel_filename + + +def _load_report() -> dict: + path = APP / "repair_report.json" + assert path.is_file() + return json.loads(path.read_text()) + + +def _load_expectations() -> dict: + return json.loads((Path("/tests/fixtures/trusted_expectations.json")).read_text()) + + +def test_gate_report_contract_and_workspace() -> None: + report = _load_report() + expected = _load_expectations() + assert report["schema_version"] == expected["schema_version"] + assert report["case_count"] == 5 + assert len(report["results"]) == report["case_count"] + assert (APP / "src/packaging/tags.py").is_file() + assert (APP / "src/packaging/utils.py").is_file() + assert (APP / "tests/test_tags.py").is_file() + assert (APP / "tests/test_utils.py").is_file() + + +def test_core_direct_parser_rejects_numeric_and_accepts_identifiers() -> None: + with pytest.raises(InvalidTag): + parse_tag("2.7.6-none-any") + assert {tag.interpreter for tag in parse_tag("py3.py2-none-any")} == {"py2", "py3"} + assert {tag.interpreter for tag in parse_tag("graalpy311-none-any")} == {"graalpy311"} + assert {tag.interpreter for tag in parse_tag("_custom-none-any")} == {"_custom"} + + +def test_core_wheel_parser_preserves_api_boundary_and_normalization() -> None: + name, version, build, tags = parse_wheel_filename("Demo_Pkg-1.0-2-py3-none-any.whl") + assert name == "demo-pkg" + assert str(version) == "1.0" + assert build == (2, "") + assert tags == parse_tag("py3-none-any") + with pytest.raises(InvalidWheelFilename, match="invalid tag"): + parse_wheel_filename("demo-1.0-2.7.6-none-any.whl") + + +def test_edge_empty_component_and_order_contract() -> None: + with pytest.raises(InvalidTag, match="empty component"): + parse_tag("py3.-none-any") + with pytest.raises(InvalidWheelFilename, match="invalid tag"): + parse_wheel_filename("demo-1.0-py3.-none-any.whl") + assert parse_wheel_filename("demo-1.0-py3.py2-none-any.whl")[3] + with pytest.raises(InvalidWheelFilename, match="sorted order"): + parse_wheel_filename("demo-1.0-py3.py2-none-any.whl", validate_order=True) + + +def test_edge_report_records_independent_case_outcomes() -> None: + report = _load_report() + expected = _load_expectations() + by_name = {item["name"]: item for item in report["results"]} + for name, interpreters in expected["valid_interpreters"].items(): + assert by_name[name]["wheel"]["interpreters"] == interpreters + for name, error_types in expected["invalid_cases"].items(): + assert by_name[name]["direct"]["type"] == error_types[0] + assert by_name[name]["wheel"]["type"] == error_types[1] + + +def test_gate_frozen_regression_tests_not_replaced() -> None: + expected = { + "tests/test_tags.py": "a015559c1b895327d5e0170c2cd1e606914b4056d2baeafbaea61b2e9b07b539", + "tests/test_utils.py": "74ac2b0c4785428c8393ea27eea36749c90ae10a5b01b039b5c7a29b116f8a4c", + } + for relative, digest in expected.items(): + assert hashlib.sha256((APP / relative).read_bytes()).hexdigest() == digest diff --git a/tasks/candidate-1990-security-cryptography/environment/Dockerfile b/tasks/candidate-1990-security-cryptography/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7598dc8f606e90cceeeb6cde008ece7ecc471c65 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fac89f96a327916515da7475c8ad53783da8904613752fdd7709a6d6076c8fd3 diff --git a/tasks/candidate-1990-security-cryptography/environment/setup/setup.sh b/tasks/candidate-1990-security-cryptography/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-1990-security-cryptography/instruction.md b/tasks/candidate-1990-security-cryptography/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c2eae6d146c4d9a620b8e42a92aafc6122ed0522 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/instruction.md @@ -0,0 +1,38 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair nonce-derived AES-CCM message limits + +Work in `/app/vendor/pycryptodome`. The frozen source already includes its local Python modules and ABI3 native extensions, so the task must run offline with `PYTHONPATH=/app/vendor/pycryptodome/lib`. + +CCM encodes the message length in `Q = 15 - len(nonce)` bytes. The current implementation can initialize or process a message whose length cannot be represented in those `Q` bytes. Repair the existing source tree rather than adding a replacement cipher or bypassing its APIs. + +## Required source repairs + +Modify both existing modules: + +- `/app/vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.py` +- `/app/vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.pyi` + +The repaired implementation must: + +1. Expose `CCMMessageTooLongError`, a `ValueError` subclass, from the CCM mode module and its typing stub. +2. Reject a declared `msg_len` when `msg_len >= 2 ** (8 * Q)` before CCM MAC/counter state is initialized. +3. When `msg_len` is omitted, reject an oversized first `encrypt()` or `decrypt()` input with the same exception before producing or accepting output. An `output=` buffer must remain unchanged on rejection. +4. Derive the bound from the actual nonce length. For example, a 13-byte nonce cannot encode 65536 bytes, while a 12-byte nonce can. +5. Preserve the public `AES.new(..., AES.MODE_CCM, ...)` API, valid associated-data handling, streaming behavior, ciphertext/tag values, and decrypt/verify behavior. + +Do not disable or replace the vendored tests, native modules, AES dispatch, or regression runner. + +## Artifact + +After repairing the source, run: + +```bash +cd /app +PYTHONPATH=/app/vendor/pycryptodome/lib python3 /app/regression/run_ccm_regression.py +``` + +This must create `/app/ccm_repair_report.json` with schema version `tbench.ccm_repair_report.v1` and all checks passing. The private verifier independently recomputes the cryptographic and boundary behavior from trusted fixtures. + diff --git a/tasks/candidate-1990-security-cryptography/task.toml b/tasks/candidate-1990-security-cryptography/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..738defde2c94bd20ae8f3ec3da43a7e9ed55a665 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-1990-security-cryptography" +description = "MiMo-V2.6-RL terminal task candidate-1990-security-cryptography" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-1990-security-cryptography" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:fac89f96a327916515da7475c8ad53783da8904613752fdd7709a6d6076c8fd3" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-1990-security-cryptography/tests/anti_hack_guard.py b/tasks/candidate-1990-security-cryptography/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-1990-security-cryptography/tests/fixtures/ccm_cases.json b/tasks/candidate-1990-security-cryptography/tests/fixtures/ccm_cases.json new file mode 100644 index 0000000000000000000000000000000000000000..0b0fa0c99e002724a260a73a44b7c0c8638f3136 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/tests/fixtures/ccm_cases.json @@ -0,0 +1,35 @@ +{ + "schema_version": "tbench.ccm_private_cases.v1", + "valid_cases": [ + { + "key_hex": "00112233445566778899aabbccddeeff", + "nonce_hex": "00112233445566778899aabb", + "aad_hex": "6865616465722d64617461", + "plaintext_hex": "76616c69642063636d2073747265616d696e67207061796c6f6164", + "mac_len": 12, + "ciphertext_hex": "64bf9729e2b14b0fef796a28d5c0f73d783c66adc6c26672e7a872", + "tag_hex": "29430a2c0c2c6c9b81b64897" + }, + { + "key_hex": "404142434445464748494a4b4c4d4e4f", + "nonce_hex": "10111213141516", + "aad_hex": "0001020304050607", + "plaintext_hex": "20212223", + "mac_len": 4, + "ciphertext_hex": "7162015b", + "tag_hex": "4dac255d" + } + ], + "immutable_sha256": { + "vendor/pycryptodome/lib/Crypto/Cipher/AES.py": "3e50e3635a165f26fa98d29c3fe5e2e63b83a4358e4e0784a248c204bbb092ec", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ctr.py": "84f5e96b8bde9c907c4615ea901010779dbc423b0fd5706190ee3041e7514a69", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_CCM.py": "f294ed38049fd27a9bebe6610080e1eb680b8306c0880419c4fe9282e7bac4cd", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_aes.abi3.so": "3eca3ddf55963cdac9fefa7b125390a6186883cb0f545cc98f9792cde273bf0c", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_ctr.abi3.so": "2c02626b76e3d1449992625c162544b2bd3cf24bf388e84ee1b24f3ec399077e" + }, + "mutable_base_sha256": { + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.py": "a5341b9ad167769b6fdf8eb36ec3becd9c090b488784ff013754eb23b8d15a6e", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.pyi": "652b3848e962bc81bf254c649c38d02ace196069a4c003bb2b60ca71bcffd783" + } +} + diff --git a/tasks/candidate-1990-security-cryptography/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-1990-security-cryptography/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b0aa8ccc5b4360ab52df5bc943461e44fba743a8 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,489 @@ +{ + "artifacts": [ + "ccm_repair_report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "regression/run_ccm_regression.py": "b339956f7898b3dd47140aba07d13451256d8b3f348db4dffcd98171656b9e83", + "vendor/pycryptodome/LICENSE.rst": "4e04660d77c1c64e89d79537919fb8240fa21484a7e3db29f358b2c7f84ea073", + "vendor/pycryptodome/lib/Crypto/Cipher/AES.py": "3e50e3635a165f26fa98d29c3fe5e2e63b83a4358e4e0784a248c204bbb092ec", + "vendor/pycryptodome/lib/Crypto/Cipher/AES.pyi": "9c122553fd2cf747a17111cb4c002f4230fb00f8b3c036b547f0295c8cf30fe9", + "vendor/pycryptodome/lib/Crypto/Cipher/ARC2.py": "2f6f8d8f55d3f330636544f2906abc37440e3577ee88d2c9350259cd2ced23f3", + "vendor/pycryptodome/lib/Crypto/Cipher/ARC2.pyi": "df554050216380a83e3a0369914eff4c810777a267461dfba8bf1b40a537ff35", + "vendor/pycryptodome/lib/Crypto/Cipher/ARC4.py": "fec34bd81bcc461b606d38196fc1921cd9e35f88dae52ea202b53427aebd91db", + "vendor/pycryptodome/lib/Crypto/Cipher/ARC4.pyi": "2e19723b7003e781d84a3f872d8f8ebab0e9faa5ba648fa85bc4cde1b044a5f9", + "vendor/pycryptodome/lib/Crypto/Cipher/Blowfish.py": "51ba4b9d194d59a725afd72366ebe02683d7ad323d7d825386a1b65f9348147e", + "vendor/pycryptodome/lib/Crypto/Cipher/Blowfish.pyi": "a7f82671a9317b28e3bb6ad2da19349c59287afef94e502615764c1485b89c54", + "vendor/pycryptodome/lib/Crypto/Cipher/CAST.py": "0c8a1af42b261aa23e875878537b411773f360555d59b7c7a938bf4de58455c9", + "vendor/pycryptodome/lib/Crypto/Cipher/CAST.pyi": "7e20551ac35a5f4e4e0c80ee13157a419a047b20a2c17a4cd6766fd80e2a2403", + "vendor/pycryptodome/lib/Crypto/Cipher/ChaCha20.py": "b75c169183e65bd9fe9060371c1e458833ec48d8136185efe1d14a5049932ef1", + "vendor/pycryptodome/lib/Crypto/Cipher/ChaCha20.pyi": "f92a6df2523f5f753a8f3f01460c2c6fd0d72966871967b84c609036edda57b6", + "vendor/pycryptodome/lib/Crypto/Cipher/ChaCha20_Poly1305.py": "3d4980b6016ebb177b4449c98956eebb8787bcc0a5c9f9c86468878ea6f90dd0", + "vendor/pycryptodome/lib/Crypto/Cipher/ChaCha20_Poly1305.pyi": "36b0511365588733f330a7c068fcc62d5c9bf1cdc697d9f197b41f536a3c4861", + "vendor/pycryptodome/lib/Crypto/Cipher/DES.py": "2005f701ebb2e633cd3094359d3313c277737581d9a17869ae883163004386ef", + "vendor/pycryptodome/lib/Crypto/Cipher/DES.pyi": "3dc33e9ee12846174acdc6943cbb6c682868f5b65136251989bf8ef40e31e309", + "vendor/pycryptodome/lib/Crypto/Cipher/DES3.py": "1c41b391c5eb969560ea8b828d1498a4bafb82c3534273829f06b1bdea2d1ea0", + "vendor/pycryptodome/lib/Crypto/Cipher/DES3.pyi": "5089f3886c6b19eca39dd2a7846e5e202e31163d5767ed64b5240f285366b813", + "vendor/pycryptodome/lib/Crypto/Cipher/PKCS1_OAEP.py": "3059a4d0b0c0e69e0ab48f2a500beb8f77628812ebd91d7c0d905f8776d7814b", + "vendor/pycryptodome/lib/Crypto/Cipher/PKCS1_OAEP.pyi": "27667022b10a7c543819e8a5ab4bf9686b5b3bbe25221fdda8d50408fa4df12a", + "vendor/pycryptodome/lib/Crypto/Cipher/PKCS1_v1_5.py": "cd629cfb43857dd81d85d2f8ae3dc7871234262ca9e1c945ac5f38962dd69ff8", + "vendor/pycryptodome/lib/Crypto/Cipher/PKCS1_v1_5.pyi": "293210a5109be669112ef23d11d3c451e0712e8cd14be4ce99d7836893fc01dd", + "vendor/pycryptodome/lib/Crypto/Cipher/Salsa20.py": "b138e6b34aef7b7613484aa5e772a64de00a46fcef3f043e09531e9b4e89333b", + "vendor/pycryptodome/lib/Crypto/Cipher/Salsa20.pyi": "dc761abeea18e132325f92310b3826a3601d745d1b292d01e8a9344bdc3d3c45", + "vendor/pycryptodome/lib/Crypto/Cipher/_ARC4.abi3.so": "abee56877f03097667ed969b560ebaa2d0366d9cb63031821b791f023dd02368", + "vendor/pycryptodome/lib/Crypto/Cipher/_EKSBlowfish.py": "948d296bc5ce1b719345f5d342da56f01cd3b3a007c386125d2c3a036ccabc9f", + "vendor/pycryptodome/lib/Crypto/Cipher/_EKSBlowfish.pyi": "2fe18762da0beb53fdadd3dc6402a614967134c53d378b1f5ed40d334bbc9c87", + "vendor/pycryptodome/lib/Crypto/Cipher/_Salsa20.abi3.so": "076b8ab311ecaa024d9b92ef21b874fdcf8e89660651bb7c0a2a8956cc7b703b", + "vendor/pycryptodome/lib/Crypto/Cipher/__init__.py": "8f67d3fa1c1e12785b925a96bfce5c5b03e29e5337d2e7a929aaeba594944d27", + "vendor/pycryptodome/lib/Crypto/Cipher/__init__.pyi": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/pycryptodome/lib/Crypto/Cipher/_chacha20.abi3.so": "7d527602209fefd346b2a8ae4e04f85244dc2df3a60419b1d5f0293e4bc34689", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_cbc.py": "17d319dc84bcf14f67dbf941296995141ca2f1ad65ce8ef7b4e1324b5b2faac3", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_cbc.pyi": "f13f46f1d3f547ba140e5b0d11d5f7cb097a699d16ff7bfcee22fc1e3a9e795b", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.py": "a5341b9ad167769b6fdf8eb36ec3becd9c090b488784ff013754eb23b8d15a6e", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.pyi": "652b3848e962bc81bf254c649c38d02ace196069a4c003bb2b60ca71bcffd783", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_cfb.py": "38a5cf4c8c7ad6f48b48554623a1c1ed1181488fdc978e48f017d63c8124ad1d", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_cfb.pyi": "950d8bbe29176f40ab1ea47bdbe8fb43cca06ccc8985bd0ec2a9e15449a4c91f", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ctr.py": "84f5e96b8bde9c907c4615ea901010779dbc423b0fd5706190ee3041e7514a69", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ctr.pyi": "2446474cef3ccb72f5b832f2c9297c0113d2be869a941ebf0f6610efcb43fe4e", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_eax.py": "3a1314462668fdd9d6e3240884d48d7988bcbcf8d393c5ece5687b970d403359", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_eax.pyi": "5473ed4dd03ed9bb42bd113ee27a51b460ab02983bac1356a47499575a68f09d", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ecb.py": "c72dd757ee53e49590153f343f4cf65bb0cecefc14800a2dea3715e272a29edc", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ecb.pyi": "c5efce952c21140270708e498b37d1ff3901b66f7cde7e5457a660d8919c29c0", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_gcm.py": "c2d25893ed70e9e276dee5130823ed938b96d9feecef9b2dfdcaaa05826613f0", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_gcm.pyi": "e6def6407412d200eaeb0b7361f695a93c668c1ce952fb10bc368fd83a8dbcb1", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ocb.py": "451e7f910ba39a03f1e1abc9c2f6d04fa5efcddee0aac2dfc246d0a10f424fb5", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ocb.pyi": "4973146b5b35758fb6ef6964b7148eb723a8a8b76d3ef7cd9115ea9978c1138a", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ofb.py": "732c33133654e65aa805c68320dfe7b4863042b114c9bd21e4827df38f32b672", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ofb.pyi": "4fe495512d0de761a9bc5bb5b40b16357d6634c5c8ab8375be8d30415dae57c2", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_openpgp.py": "28598cb125d24076bf8bc89a2b4e832568c06780bde78101fbdd6415fa99feec", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_openpgp.pyi": "1682eb16a9efc497f417f9e91ce80f5117d4c864ade83c72229da29285e2f822", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_siv.py": "560a891a6558cad6d00b1e27c167dee0181a4fadb38d99a1b2b4bf5849911d8e", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_siv.pyi": "b326f79179f2ba1a1057a157be8cc88ee75609004269d39bd48d81b95fba022d", + "vendor/pycryptodome/lib/Crypto/Cipher/_pkcs1_decode.abi3.so": "24a608477a5f38a42ac54414fbbf18abfe77331238bd41e850c9dc05d809a172", + "vendor/pycryptodome/lib/Crypto/Cipher/_pkcs1_oaep_decode.py": "fe1b4330b72c77dbbc06ee632cad8ce5f8af50c725688629e7c7c40b6951bf19", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_aes.abi3.so": "3eca3ddf55963cdac9fefa7b125390a6186883cb0f545cc98f9792cde273bf0c", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_aesni.abi3.so": "e054aeb9ad7d206ee2b09e2c0797509da16a5b91f8aad9ad1f4a033e572bbb6f", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_arc2.abi3.so": "712c00675c02f2fd0403fe51fb50e5cc28cae8c227eb32f2ff2da4fbc35d0378", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_blowfish.abi3.so": "ecce198b329abcc775f7845ddf31b9e322103fe5493f84169345021b490cecd8", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_cast.abi3.so": "935c46fe1f30e85d814ebc22f6e318bea18cf4a2f784c29716dc21c6b20778b6", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_cbc.abi3.so": "3ce3dbfce0c32397a74533c1ca828cddc641022063a1fd25f8a632aa01616b69", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_cfb.abi3.so": "426d53504370a7ad750a8426fb27de8316cb9d17cd36fbf2f0f28a8ae1842d97", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_ctr.abi3.so": "2c02626b76e3d1449992625c162544b2bd3cf24bf388e84ee1b24f3ec399077e", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_des.abi3.so": "ce15abf969f6fee3b392c80bebd39341c29278112b069c349d1d823e50afc8c5", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_des3.abi3.so": "1888cd38c599778782396eae776615dfad7f200fc11a8313457cb89ddee8c457", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_ecb.abi3.so": "3706e1ed5ad7f58a3c5c797bdb32ba79a0dd18a1727752f22081aa98007a906c", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_eksblowfish.abi3.so": "e11bd3343a1c44180dfddceddfafededb955284ece4f0d971b2d4bf3306a0e3a", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_ocb.abi3.so": "1778c80b79592187630b4524266aebe64673a22475d0378deebf5ea8145a1704", + "vendor/pycryptodome/lib/Crypto/Cipher/_raw_ofb.abi3.so": "666a99a1f3197a0b7f8495dbedda3015765406aff0b0e4b45c8c70d4c5469030", + "vendor/pycryptodome/lib/Crypto/Hash/BLAKE2b.py": "a6c9a0cd71b869969ceb2f4e33f06e10e47e31c10ecf11d88402a568a2a1cb2b", + "vendor/pycryptodome/lib/Crypto/Hash/BLAKE2b.pyi": "5382b799aa5d61e1d51eb9481207df295f487c02d56ea90ead56c946e8e7b35d", + "vendor/pycryptodome/lib/Crypto/Hash/BLAKE2s.py": "1ddc5e888a0ceed1ff76da6ce91cf2307021da0359a299bc2b6046053af781be", + "vendor/pycryptodome/lib/Crypto/Hash/BLAKE2s.pyi": "f63b0be232d0ab9fcc6fc58cf7d2cfbab1f50fe14bfa02c0799c817fc4225add", + "vendor/pycryptodome/lib/Crypto/Hash/CMAC.py": "a5f84e105c3398aa5414897ae18030638d0ef4f854f1619cebab2f8908f4c5d2", + "vendor/pycryptodome/lib/Crypto/Hash/CMAC.pyi": "9195c0794cf1437f2763e6986c83eb6599913b18236b61e7bd4cfbc6e017ba81", + "vendor/pycryptodome/lib/Crypto/Hash/HMAC.py": "54e102a2e4c8897200917af85acdc6bdaf6721d61e2a4f31b03466cf9bf56fed", + "vendor/pycryptodome/lib/Crypto/Hash/HMAC.pyi": "7c0c870447f911ee8ba226184d9f4f66998846f8ad53a3ab88a19f8c550cff87", + "vendor/pycryptodome/lib/Crypto/Hash/KMAC128.py": "4416606d6b03ee3ecd6f4eabf3e26e65e7bfc2e1766e267a0a12afc4ba451112", + "vendor/pycryptodome/lib/Crypto/Hash/KMAC128.pyi": "08772389a34a8ef59080b5ec6b06f7571b6dc66b7f8552be0effb9455b3aa0e1", + "vendor/pycryptodome/lib/Crypto/Hash/KMAC256.py": "5f8c2a59c17bfc91f08674afb4dfad1785abdc77439e44573426f53bd02bfd50", + "vendor/pycryptodome/lib/Crypto/Hash/KMAC256.pyi": "a0078a832b5ada2aa357d62ff35f31a16e5e2768b178b3f88e850ff17522d9ed", + "vendor/pycryptodome/lib/Crypto/Hash/KangarooTwelve.py": "c04edf9e147ac5f5b160fe77e91586f0983650ab441078cb9c36cebe0f7106f4", + "vendor/pycryptodome/lib/Crypto/Hash/KangarooTwelve.pyi": "b217ff835f04431a09f0ef4acee6a1d7b8f0e89fafce632cbaacf5980518e561", + "vendor/pycryptodome/lib/Crypto/Hash/MD2.py": "dc16eafad2949250fcd28cbfd365c47292eacf13e459eb84e2d2b863b4a42d39", + "vendor/pycryptodome/lib/Crypto/Hash/MD2.pyi": "c1aec6498529ccbdbbb28e18822244668d1d3b6d352b21caf3b436d0fbe6f9b3", + "vendor/pycryptodome/lib/Crypto/Hash/MD4.py": "d8cc571dc961875c49780f7885524b0ca0aa0d6121863a555abcf135f0c26272", + "vendor/pycryptodome/lib/Crypto/Hash/MD4.pyi": "ed9b594048090b022cc2779bd0d068bffb8bd3f4e882587d10f3272d5146ab0a", + "vendor/pycryptodome/lib/Crypto/Hash/MD5.py": "882db1c33d0e850bc31e7ede654aedb44adde6c36ffd95e59aedf688b170a66e", + "vendor/pycryptodome/lib/Crypto/Hash/MD5.pyi": "738302247bd84e2d982f8866a84bbd8af6d2be4049751f92da5754a84a732bcb", + "vendor/pycryptodome/lib/Crypto/Hash/Poly1305.py": "b7803188689802cccbe341a9953c44458e21f9a6bf53fe11b7ed8c7c3f798a2f", + "vendor/pycryptodome/lib/Crypto/Hash/Poly1305.pyi": "4d21a8b6d8ab2cf211ca2bd28d9b9c401eda3da61f86b5249fca28b7a3ab9a65", + "vendor/pycryptodome/lib/Crypto/Hash/RIPEMD.py": "2a50a426013def3538737d8e66403398170e4b039841492e2f8cc66787d2f192", + "vendor/pycryptodome/lib/Crypto/Hash/RIPEMD.pyi": "4c43b3d4efb9bf70ee7736242932d00e34bab3473f308b179ea5685becbddf9d", + "vendor/pycryptodome/lib/Crypto/Hash/RIPEMD160.py": "b652335d46ba199f8f0ca8b79ab8a0b8dc5656c870154af1e0d7795926c612fa", + "vendor/pycryptodome/lib/Crypto/Hash/RIPEMD160.pyi": "450f725f18c7d4149a5379b086c0a7f7eebb0b46bf05cbf730375a7d00a2b8fb", + "vendor/pycryptodome/lib/Crypto/Hash/SHA.py": "9d2099cf87236c3049c2846dd26fdafb7963db15a3c6ccbb82471cb494e07fa1", + "vendor/pycryptodome/lib/Crypto/Hash/SHA.pyi": "2e1a6a511c09acd73132dadfa52ba5535ea732a6ab85cf22128669bab6ed5c89", + "vendor/pycryptodome/lib/Crypto/Hash/SHA1.py": "ad4bd1bd9e9c2dd68d6bdbd13999f826ee39b724ea0031f8ef45c62e6f62b0cf", + "vendor/pycryptodome/lib/Crypto/Hash/SHA1.pyi": "bcdb41fdbe0ccad26af08a35c6e7dd38ee952fe9cc05c0a70cf220250b8d3c23", + "vendor/pycryptodome/lib/Crypto/Hash/SHA224.py": "581ea18a73d0e69481379bec072a5ad1e153a27b9adf58cc0218f93b2581cd2c", + "vendor/pycryptodome/lib/Crypto/Hash/SHA224.pyi": "f11b1bc88c087cef0573f7e95b0d4c9c5c34e19e27faa2f41b4d6a090670bf1f", + "vendor/pycryptodome/lib/Crypto/Hash/SHA256.py": "e879e087f1868153f63222da9be10c5e002e176fb552977526380fa68d5d6f5f", + "vendor/pycryptodome/lib/Crypto/Hash/SHA256.pyi": "ce774d123bfa0d939668ea6ea142ac0368538b627bfa824580e435d2c4919d71", + "vendor/pycryptodome/lib/Crypto/Hash/SHA384.py": "70fcbd3597ce460e48fd979ecb892bc9880ff925bd4400d9127faf261cdc6f8a", + "vendor/pycryptodome/lib/Crypto/Hash/SHA384.pyi": "28859b0fe9416ddee5bd6805aae22a50031a8aca2f7b2d075743669aafa9bce6", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_224.py": "0d8cabac2a3ec1e6713b0ed322ea5d08f563c0ebffc7baf496dc66e5f51c352d", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_224.pyi": "60dbcdf86c55a4f2baffe79ed3f9feef080086aec9cc168169e1a235d56841d9", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_256.py": "6a3b79b5b3128ec5985807a1670a4dcbb7c1e12cf390dc67040bd1ad166f7acb", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_256.pyi": "2653ce895b4454d25eac6591b810ee9d7053d7d597ffa39ba54b8c697ed0744b", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_384.py": "b9edb8cb1a4c8e65025363a4b486d90cdff702cb14121415cba5ff6a311c8097", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_384.pyi": "737c1bd1ce918e570c70adb6995e11656b0399403636ccda8212c05c8acdf13f", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_512.py": "2f418c25f01105283d09f200e6de1801ac32780d3e378704ce9cdf25d4af5f4e", + "vendor/pycryptodome/lib/Crypto/Hash/SHA3_512.pyi": "6d9d16a334c3fe643fe6dff3e12582a429fad5884255a985e74d63b107548e9b", + "vendor/pycryptodome/lib/Crypto/Hash/SHA512.py": "b9cd12b3ba917147f471b42f5c364ea1c819280ae73b8e352d5d7db740befb7f", + "vendor/pycryptodome/lib/Crypto/Hash/SHA512.pyi": "55f3331f1fb453879f0b2642ae0b3f68ecf5ed6f2dd191cbff7b91f33698cc25", + "vendor/pycryptodome/lib/Crypto/Hash/SHAKE128.py": "3b73a9b66077673fa8e9969bc5d1b21abb0f31b94c15b77e4b9ff0940472396f", + "vendor/pycryptodome/lib/Crypto/Hash/SHAKE128.pyi": "c0b855f2587c6185b38bb3e4840077fc9427fe139936f92265883e26388fa5fb", + "vendor/pycryptodome/lib/Crypto/Hash/SHAKE256.py": "d140ff994f261046767feab504be06257073a4ffbee260776a7f779ab15916cb", + "vendor/pycryptodome/lib/Crypto/Hash/SHAKE256.pyi": "f54abf15a798c03c7fe9d2efdf7d56bf5b279c6c40d948457147442c793053d5", + "vendor/pycryptodome/lib/Crypto/Hash/TupleHash128.py": "d81e657aa850b0cd477f6b8801b94f893fdd925766abdd6cf8dbf18adc8d8c5a", + "vendor/pycryptodome/lib/Crypto/Hash/TupleHash128.pyi": "9800dd2a4b45d663df2ad5dffb15b2b63d1b7e0ca7ce3c2da6977545d30bd6ea", + "vendor/pycryptodome/lib/Crypto/Hash/TupleHash256.py": "b909caaa03646c244e8d8c08fbd1509eaa3aaa24617f19d296ef033ebbc14509", + "vendor/pycryptodome/lib/Crypto/Hash/TupleHash256.pyi": "7acba8b968761e60aedcce242e30a0bb98eb43cecdac1414e61f68e71db5925d", + "vendor/pycryptodome/lib/Crypto/Hash/TurboSHAKE128.py": "68b1a9215eeef54a1253749e7862bd656e14cec12775eab211a2b3f5338c09b7", + "vendor/pycryptodome/lib/Crypto/Hash/TurboSHAKE128.pyi": "1ed6ceb9937db9f8262d36b0d8316179329667ff4d68ba0db4714cb3fb199d0a", + "vendor/pycryptodome/lib/Crypto/Hash/TurboSHAKE256.py": "0d3ca20bdb1e67d473902d8544ae7d33c98d87f34574407ced04d533fe652a42", + "vendor/pycryptodome/lib/Crypto/Hash/TurboSHAKE256.pyi": "bb00d513daa6c3861832b08a3243923d32502f2d4586eb069b9f62fa28bc1ee2", + "vendor/pycryptodome/lib/Crypto/Hash/_BLAKE2b.abi3.so": "df2db32b8b5edaea550243faa9c596aac069642c2e9ccf8c64b5316eac852ea5", + "vendor/pycryptodome/lib/Crypto/Hash/_BLAKE2s.abi3.so": "61f46a425282b918bf5ad931797fc8c624ced03cf97d815227c8683a993bf388", + "vendor/pycryptodome/lib/Crypto/Hash/_MD2.abi3.so": "4fdebbf9a9c88d6f6737aa03e3893eac4998f2ee574d081a9bce49c86e29fc4a", + "vendor/pycryptodome/lib/Crypto/Hash/_MD4.abi3.so": "ce7227d7198ea28a5a67c1752fbb026d977cf9e086650896b9d21ad15cc30453", + "vendor/pycryptodome/lib/Crypto/Hash/_MD5.abi3.so": "569baa56398749ccf5936baf66be496030885dcc8c579ccfa86a77e379b412b5", + "vendor/pycryptodome/lib/Crypto/Hash/_RIPEMD160.abi3.so": "b659b47aa637be02c90d3f82e647d9b87fb4583eb575e29ec33b252b2b41c9a4", + "vendor/pycryptodome/lib/Crypto/Hash/_SHA1.abi3.so": "da3764fc0a93e05bccabddd8452fd1f681413b1e3da87094d197bf8d7fa293d7", + "vendor/pycryptodome/lib/Crypto/Hash/_SHA224.abi3.so": "37618b52536e1db6b7c94bf5078fe51d1f74a5aeb7e4ffc36c63ef5e736ca529", + "vendor/pycryptodome/lib/Crypto/Hash/_SHA256.abi3.so": "732518b2f6a540f38987d690f844cd455ce8ef544883bdc4a08fb8c789672d39", + "vendor/pycryptodome/lib/Crypto/Hash/_SHA384.abi3.so": "d542757e1cd7ed6fb3206edcbd62f93f1b8e0a40e2a1dfefcdce913ae6fb10c3", + "vendor/pycryptodome/lib/Crypto/Hash/_SHA512.abi3.so": "d2a39a86782b58489a25abe987b125360aaae42e3410ae0fc4a38c9e09b7b42d", + "vendor/pycryptodome/lib/Crypto/Hash/__init__.py": "df08b30541432c1e94800f18f0e228fb50928adc7de6a2f79e4b4cabb857911b", + "vendor/pycryptodome/lib/Crypto/Hash/__init__.pyi": "f9ea4fc042320032e119a38a1392c8d4e04018af7f9ad2cd1486600c99be4842", + "vendor/pycryptodome/lib/Crypto/Hash/_ghash_clmul.abi3.so": "2babc786ffb746882e9e421fd7d644d21e68eefa619f2d038cb68a9ebfa1c2c1", + "vendor/pycryptodome/lib/Crypto/Hash/_ghash_portable.abi3.so": "bc0c5da39aef7e203197dd2cd16032cb0b52158ca894fec03c457f26f34d1e21", + "vendor/pycryptodome/lib/Crypto/Hash/_keccak.abi3.so": "47824cca56d190fea48d4757163000750ad202f19750861c830d13eade498294", + "vendor/pycryptodome/lib/Crypto/Hash/_poly1305.abi3.so": "2b03155c74eb6c6477a3061698240cb565c8b63be30b84d9f4111c0865281062", + "vendor/pycryptodome/lib/Crypto/Hash/cSHAKE128.py": "5f6f511e56b60ae42d69002e2a499dede2648ff1792a49d166fb98aedcb0f12c", + "vendor/pycryptodome/lib/Crypto/Hash/cSHAKE128.pyi": "20b7a71438b39e3d5c8c85db8c806fcc4a9f14e8ce6ca5d6c8cb0eafaddac14a", + "vendor/pycryptodome/lib/Crypto/Hash/cSHAKE256.py": "b5095169813336585630b8cd0201b28267089356910a77551b2902e7535b6f0f", + "vendor/pycryptodome/lib/Crypto/Hash/cSHAKE256.pyi": "77f6cd841cd2758481279ffaf8fa88709e990ca0db5db56a02326b0d3a8331aa", + "vendor/pycryptodome/lib/Crypto/Hash/keccak.py": "f798f27e64aa5bd3ebd9dbea293cba4930de3c26d6579a0e805b8c2abac6a244", + "vendor/pycryptodome/lib/Crypto/Hash/keccak.pyi": "a5701968d7dac9909733107b20316bd85f078b4ebf870141dc65e337363bb013", + "vendor/pycryptodome/lib/Crypto/IO/PEM.py": "512862b61b1bd9278394dd0be8630dc07b0ebe81effa7c4437b8146dc03667ce", + "vendor/pycryptodome/lib/Crypto/IO/PEM.pyi": "6b51b4ed142d66f12d5c79726f17437284cf3379ea31b74e34d8f3733e471ad1", + "vendor/pycryptodome/lib/Crypto/IO/PKCS8.py": "82612ffae115f976add1f99fc09c4f25d3abc1a671cd76aba7d437bb356619a1", + "vendor/pycryptodome/lib/Crypto/IO/PKCS8.pyi": "9b19a4ee5b03fe4dcf955a79ca2a419702db100d608a58f293e385b6c72089d7", + "vendor/pycryptodome/lib/Crypto/IO/_PBES.py": "88541a939042639d6bfc66fc962ac3dd4fab6dee53cb72c20ddbdae16bbf6b33", + "vendor/pycryptodome/lib/Crypto/IO/_PBES.pyi": "2044ff248388dde32e28566059b9c3396792359b29a534de9f7398bc66b0b5c5", + "vendor/pycryptodome/lib/Crypto/IO/__init__.py": "414be7a035a59ae386123c5787fb971cca129a83e2fe749e87e12decc4a87de8", + "vendor/pycryptodome/lib/Crypto/Math/Numbers.py": "bd407e9689757a721d1e2c66813853aa6e12842779c94dd2030189f7f07762cc", + "vendor/pycryptodome/lib/Crypto/Math/Numbers.pyi": "4cbb3b52ca2aee1aeab9c8c95029aded8185f7d935a0da033d7ba9d076072a6b", + "vendor/pycryptodome/lib/Crypto/Math/Primality.py": "2d4c39e5a556ba91c31d9bcdad71460328a03ff64de875c157c8f06c4c54ba89", + "vendor/pycryptodome/lib/Crypto/Math/Primality.pyi": "897018d20526722212fc5bc7e552708507cafb4b4399a1f6bdc0cb1c7172c481", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerBase.py": "c2e9ece086a1b3225fe14af3c2691b827a12875d1d633ae0b728bc0d36ea176c", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerBase.pyi": "7bc901e4d03ce2f99db7be9b22135b5d4d4fab4c2cf8ff0faf775fc81cfe5cca", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerCustom.py": "6e318083aec0578312bffb8009b6e175d4c87b652f30bbeebc26d061cb993bb0", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerCustom.pyi": "b3d5198a0044814bc74b820e76df235e1b19df73bd8f5f69ee589ea1bd51f846", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerGMP.py": "f4ac2a299d8a2b6655537050252247c9f2c40681c5e1e9dbdb2a6aa5a740ddc0", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerGMP.pyi": "51c24e18c613d5df86d0f8db0b90724a1165e68ca8ac547c877f1f16dd2e63db", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerNative.py": "328deaf0bd681b9b93cb2822e0c88aeda16818ab4f21cdab1791c3a3dab420e8", + "vendor/pycryptodome/lib/Crypto/Math/_IntegerNative.pyi": "a5968dd715e707cbbb55facc829ea3aa2fe309a278c78b7411cb3ba99ff6c7ee", + "vendor/pycryptodome/lib/Crypto/Math/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/pycryptodome/lib/Crypto/Math/_modexp.abi3.so": "7fd7dd865d59fea4d95189556701419a4a702631d3b50c6d33486bb44677c307", + "vendor/pycryptodome/lib/Crypto/Protocol/DH.py": "0ee2ce6512ffb4d16554b3c4a9c8ebe6e7284c5edeebbcedc6c6007474f9b199", + "vendor/pycryptodome/lib/Crypto/Protocol/DH.pyi": "c431baebe500659991bf6c60b28ecf2b5a2a65e706402e84751cb4941f0d9c4d", + "vendor/pycryptodome/lib/Crypto/Protocol/HPKE.py": "d0ab7ec23f5c97281585ddc6c2083d29634d2a1eb262bcfeabdcb3768c286c27", + "vendor/pycryptodome/lib/Crypto/Protocol/KDF.py": "66e57be59cb46fd9db74ead51d0a3056cfba964c0210c8a784cdfe48e8f20549", + "vendor/pycryptodome/lib/Crypto/Protocol/KDF.pyi": "2635ab2397ec2ae7e2fcb4ca37f3d1df6b9ef26f233f33fcf521b473172bfe4d", + "vendor/pycryptodome/lib/Crypto/Protocol/SecretSharing.py": "4c54e5c91f3a1c9f07ec3c79f4dd223850cd0471be155921ebe706d1706a6ce6", + "vendor/pycryptodome/lib/Crypto/Protocol/SecretSharing.pyi": "fa512b57646f68d3ee380d33e1ce385a6352bbd8ab0b0fc30dbef03e0092d816", + "vendor/pycryptodome/lib/Crypto/Protocol/__init__.py": "a17d783139cdad6b3c07a13af15affc80fdc2397b6d32f171bb81ef60860920a", + "vendor/pycryptodome/lib/Crypto/Protocol/__init__.pyi": "44d76bc0c823b7d6fd2e672475191a6180b83c2ccd57ed478b64f707630781db", + "vendor/pycryptodome/lib/Crypto/Protocol/_scrypt.abi3.so": "6f6fd4eb1dbd52336cc76313b14cfababe59e04a783f869813f5b1c95ab367bc", + "vendor/pycryptodome/lib/Crypto/PublicKey/DSA.py": "74b1024a6f6562dfeaa22945dc05e2ce4250b11ea777f41c69e299d2ca0653ca", + "vendor/pycryptodome/lib/Crypto/PublicKey/DSA.pyi": "b7acb7b7fc3fa1da397b12d34b82b7fddefa39b76a7cde91d501ca39f7ff2c0e", + "vendor/pycryptodome/lib/Crypto/PublicKey/ECC.py": "3afb6c7cd793fc3162e7a19f351d7596aa6876a1b435a844c316cfd22a7732ec", + "vendor/pycryptodome/lib/Crypto/PublicKey/ECC.pyi": "a7ee6a2cb4cc65eb0f89c9654740ed08454405e7318168779bdb545b84385511", + "vendor/pycryptodome/lib/Crypto/PublicKey/ElGamal.py": "cd6cf9d8120b66ff585330673496e3e371bf43936d515da8c592bab237d0789e", + "vendor/pycryptodome/lib/Crypto/PublicKey/ElGamal.pyi": "facdedcb4bffa3ef11abcfe7ad8877d95a3a8a1afc39a49675cfc7eff095182a", + "vendor/pycryptodome/lib/Crypto/PublicKey/RSA.py": "54948a1a8201ba259dd926963f8adcd0b352c758381ee649ca68e857d99b53b5", + "vendor/pycryptodome/lib/Crypto/PublicKey/RSA.pyi": "47918905288345ea485a5012e4b47738ded906bf7a3848c71bedf3053869adba", + "vendor/pycryptodome/lib/Crypto/PublicKey/__init__.py": "0aed688b8fb441ef105e9b2669caee1e3e788a2c513ab08fc16b9cee39b4d61a", + "vendor/pycryptodome/lib/Crypto/PublicKey/__init__.pyi": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/pycryptodome/lib/Crypto/PublicKey/_curve.py": "539b760ed0d60b2be2891f03364ca3b9e31ad5a2b55defbe9dc20f5ed21c340d", + "vendor/pycryptodome/lib/Crypto/PublicKey/_curve25519.abi3.so": "40cfc8e9f4457fd319e2991d3a28e2fd25faf82589dac9b84056b35ad86c688e", + "vendor/pycryptodome/lib/Crypto/PublicKey/_curve448.abi3.so": "9d6453386fec27bd189d39a211e5fd1e2a810a750fdd76bc81b2726a328ad581", + "vendor/pycryptodome/lib/Crypto/PublicKey/_ec_ws.abi3.so": "5982b41170d426b1b6f328adba55f8f5c915bab70253fbef0108d97c84f05f8e", + "vendor/pycryptodome/lib/Crypto/PublicKey/_ed25519.abi3.so": "d6608f7ca963ce356b52388538a0c6ef187c83bdd3fcf104e5e61d29bef7426c", + "vendor/pycryptodome/lib/Crypto/PublicKey/_ed448.abi3.so": "44988cfcadffd016148e354863c2877db15bc1d1113c2a69889bdfe8e4b6464e", + "vendor/pycryptodome/lib/Crypto/PublicKey/_edwards.py": "58957e498031d7d396689e91139a1bcdea0bdd64a195cb746a5e8e4bf58ad371", + "vendor/pycryptodome/lib/Crypto/PublicKey/_montgomery.py": "795b60d30441f5ee3c256435b1e27c289227bffdc21a9a4e90d2178647d305e1", + "vendor/pycryptodome/lib/Crypto/PublicKey/_nist_ecc.py": "a8744f757c32df733c7b2654adede72162dbf5eb47cf5aa90fc08c658d95d132", + "vendor/pycryptodome/lib/Crypto/PublicKey/_openssh.py": "d6ff2ffb45db56de93b822e4cb818b6460eae39259b675fd13133a0868bf2bf7", + "vendor/pycryptodome/lib/Crypto/PublicKey/_openssh.pyi": "cb00b2f540eedbf01023ad02856c46c72a87899a18c0c282dd3557267fd95483", + "vendor/pycryptodome/lib/Crypto/PublicKey/_point.py": "977c1e6b4fa06f1e43e078a79df7f7f3fc95b639b5d5bdaf2aa6a7ff72803e4c", + "vendor/pycryptodome/lib/Crypto/PublicKey/_point.pyi": "1027ed2f620ea30e0017a08696062635cc80ea2456b8fc36916be9591506620b", + "vendor/pycryptodome/lib/Crypto/Random/__init__.py": "0e6fa0ba105775fe0b12bf73aa4f883e7c30a651ec405a55ac996bd75fa40460", + "vendor/pycryptodome/lib/Crypto/Random/__init__.pyi": "89e89f868301daf78abac451059590a7a8a03eb8b9d36ed5aea7dd74ee5bf965", + "vendor/pycryptodome/lib/Crypto/Random/random.py": "1c20cf5b3219d3f1ceb0b7e2ee22b94964c6807cc17b3725b64a0457a9bed06e", + "vendor/pycryptodome/lib/Crypto/Random/random.pyi": "b97116e3e9aa91d02fcce25259332ffd95aeee9e15c028ac9fe0263a3d8a4c71", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/__init__.py": "f13e8e9af76e3a9a929a9d6b03b64f7c81fadcda2b6329d4a0ba47e09902da35", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/common.py": "9efcd13eebf037b185b799bcc10cd225dd6639575afcdd0670ccc2ef01c5f8c8", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_AES.py": "6e02dcfb996aec1b849a4471c96edeec07d733f43d39a63d1d857706b0e6892a", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_ARC2.py": "91a63e95cf3df4f5984f814e29036efb10e81ab9596021f6dba1cdfa6b66c85f", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_ARC4.py": "aba9d82e0e8eac92d50b0749810cebc326a6028e166122f10f2f103714763f1a", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_Blowfish.py": "f96898d870c4a9a78009b8afbf88581f204d8e4b2fdabeed7f6dbeb24818e380", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_CAST.py": "bbdf1f1eebb3cd713f799b0499ca163c5fa79df393591f915c9b19baa9a21961", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_CBC.py": "7570d4dd8e7b6cecdf133eb6a205a90fbc9f9e4ad8589ba5917474c8ef5107d8", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_CCM.py": "f294ed38049fd27a9bebe6610080e1eb680b8306c0880419c4fe9282e7bac4cd", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_CFB.py": "0685ff0ae1c624b98193e8a75a23887f926760316a42f2df7047041532f09e68", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_CTR.py": "7fd3ca1a8e458105cff3cd059f4af1af5512a19aa825fed2eb5f830294944cae", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_ChaCha20.py": "3c35745f1e4e4a9ae6d16929e2324f21d0ccf27665cf90725fd148b6db0bad31", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_ChaCha20_Poly1305.py": "77d28d13485f7297a3f26d1f1611691f981ee70334aa4f768e471bf588cafbdc", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_DES.py": "e09cf65cd157cd83f3a2a551eb1cc8cbefc3c4e4bc4514033c01738611677439", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_DES3.py": "2a9abeffb7291bc095b0342ffc1e4655b2c2dd9fb9c246ec3bf256cd718067bc", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_EAX.py": "74e072935bf7d69b4d22463fdac327fdf4803d085dc5455db0d3b69c3692d744", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_GCM.py": "a4c94d630f518e38a45a73075d460b66e809797d893da6bd2e9d5db63bab6668", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_OCB.py": "f010ecfb8331ab64ca8120984c204771d35ba39852eecbe72ffed39f64f2158c", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_OFB.py": "58f3e8f81c82f773b625e8ff50143748744a9857e53b4ce8f780b4bbcfab5476", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_OpenPGP.py": "650b2396cd78caf42c3fd73721f73817c738c582a9919e82ca7af8e9b1de7fd1", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_SIV.py": "d08effb15baab5a2e30a38843e403597549eef0e4313f648da04396976dd0f10", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_Salsa20.py": "ac0b741b2dc3528f55b1bccbdff9df6cdbbdb0caec8779808f55e4d027c8e6d4", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_pkcs1_15.py": "9f7ae293bbedfdaf32bd892c9b81679a1d0fe82a480624d77827d98f5602c906", + "vendor/pycryptodome/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py": "30fce75b0ceabdbc3814890b732942e54afab32330aae76884112caec5ae4bd3", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/__init__.py": "bc381b35303e642823592927c8d9a61dca65c1d50c1261ef1b69df1607295cbb", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/common.py": "ad1128b398c2f36f90b463aabf1e7dacb6277b6b1c645323443dc354136ffc42", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_BLAKE2.py": "5dc9fc7a5ed51283d34451a094b3b1afe1daf39bd907c4bc4a6569d87117d81e", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_CMAC.py": "f9801f4f8c0f914a5d1a80adbdf44e49cb668f9eb3052e6e0fd9a156d2dd1b86", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_HMAC.py": "17b60f8d82f41646814f695c38016f39169b832bf9d0f46d26e21c8cb5f02cbe", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_KMAC.py": "e9d0db915f7009095d69035ed711f377d64b4da908ae865a68f648b436963ee5", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_KangarooTwelve.py": "32c24aec8be41b22ea2f87f419283636562aa78239d18eb45f656182da283a87", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_MD2.py": "0e62b0139b0e3a26734da1bc999b2be0662c0be94740985d0cfc03c0a6b2a309", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_MD4.py": "ecc2d1ed8e27e2c47e9fd628351c4b44483bb40d110faa021edbac694bfd8a17", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_MD5.py": "77fbcefeb58ebc555b394d8a18422ecd58d47b8e1ddc01282c66381af9af1345", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_Poly1305.py": "1d4ac87965ebb54a39a4001c26719a70d27acf63b43dbc56b4ef5b4c5eb9708a", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_RIPEMD160.py": "c500e9964f159666cc5c4980d77f34806efc680e65df3f204b70984890b8632a", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA1.py": "e4934aab0f5904b16c20ea8a2e054625368ca20fb5872fd39fb06cf26a0d3894", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA224.py": "7bb1efd0c80bcaf519ee4e929be42291e357e4c4f8cdbf761410d03dd9773e7e", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA256.py": "25af79da2aa72aca04f1a2cedc7c419cc64f919d7ec5c0007f06bcd64a5589ac", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA384.py": "3904165ed1f3da4d2088dfa6a34d0a68eb2c1e8115eac69b5208bd4925013c15", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA3_224.py": "2270115691798a314703471a3b119aff650c1ff15c218db59501f8e597d4e9e1", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA3_256.py": "0a319e7900d921b1448d9ac2d6b7153049b92779bec8bed06420d5f87cac41ee", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA3_384.py": "08c3e92f3aa98eff7412eadac709e6d54b1eda41b388df639f85a060690ae94d", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA3_512.py": "5e2bddd1f3ba789e4373ed9c60fcba1dba2e584a657c544fb9568c7adf804f0a", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHA512.py": "b60953c74568900922358db2fbb8cc97381c923e21d4a63aee390d9804e2a8f4", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_SHAKE.py": "46920068c4d46424e8c6e24edf7fbe8e6002f8879b876a8b582da7155ba5d39c", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_TupleHash.py": "e9e328bd6f8816ac3101f5c355e18f42c0110b29efd2fa7c43cc6643cea046fa", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_TurboSHAKE.py": "177884d33c11c739a6cb0c29b688766c0e1badc88bba6853345c75758494ad20", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_cSHAKE.py": "6e20c0ae22383c37cd679125c923710803fc7f53c7d0186604b317ba949b89b5", + "vendor/pycryptodome/lib/Crypto/SelfTest/Hash/test_keccak.py": "71f6500c17048cd37cf84b1fc5c06c4f8746605474293f48099d4a08f0c354b3", + "vendor/pycryptodome/lib/Crypto/SelfTest/IO/__init__.py": "ff89b19231eba7b4d12a0e10fbde5f110b5f1115059bc429bd340bfec28d6a3d", + "vendor/pycryptodome/lib/Crypto/SelfTest/IO/test_PBES.py": "198b8264754483538855d54101571ed0b3f704860aa7e560e044fe341fda1186", + "vendor/pycryptodome/lib/Crypto/SelfTest/IO/test_PKCS8.py": "c534844a12b174dd22be924b3591595a2f0e1717f336acd231d8c239a2678a84", + "vendor/pycryptodome/lib/Crypto/SelfTest/Math/__init__.py": "05da736e23a3551166c33c906885f41f521943b8d8549aacc46b82dfaf008be9", + "vendor/pycryptodome/lib/Crypto/SelfTest/Math/test_Numbers.py": "113a915258d18ddc144f4c3faee8fb3a91ff3b2686c6098051f4665abe31210d", + "vendor/pycryptodome/lib/Crypto/SelfTest/Math/test_Primality.py": "7ee06270a4917796e60a1ea3cb0ff248290af438227e8d80f50233a4c85f9bf6", + "vendor/pycryptodome/lib/Crypto/SelfTest/Math/test_modexp.py": "a17906b7f756c29632deb58902420010041f7edd6ae6e6d909d230e645dcfa9b", + "vendor/pycryptodome/lib/Crypto/SelfTest/Math/test_modmult.py": "55ee5569706330e910b8c8fc216ddbd192b4571d45d21cff56b6b75c59d64e25", + "vendor/pycryptodome/lib/Crypto/SelfTest/Protocol/__init__.py": "a42d06fd4abc9c8f1465cb8ba67fe8287acac4017d14f4205b8ea7964a7b2869", + "vendor/pycryptodome/lib/Crypto/SelfTest/Protocol/test_HPKE.py": "64a00f2a6fef1fc2135619f090119561eeb1491f36356c99c3cdc3c6ace0e961", + "vendor/pycryptodome/lib/Crypto/SelfTest/Protocol/test_KDF.py": "abef71cbf58fdf8dd14eb361fb5995f9f59be70af9a873dd9e7a1c2e0a602638", + "vendor/pycryptodome/lib/Crypto/SelfTest/Protocol/test_SecretSharing.py": "f11c04b2d835fed9f64af1b189ee8f1b15c645f12a82ceaf43ea73bd820c0b1b", + "vendor/pycryptodome/lib/Crypto/SelfTest/Protocol/test_ecdh.py": "8674342fed4d50b426d8caef411ded6de97d407bc288acfdd2831221e392fc60", + "vendor/pycryptodome/lib/Crypto/SelfTest/Protocol/test_rfc1751.py": "2d1dccf572e4fecc4ec9aa4fab7d8f11ff7749433012b170c3394734a8546b38", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/__init__.py": "0dbc22275e6c1e12a8f96c729f901957f02ab03e9e555c2893eda026ce9e5c85", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_DSA.py": "33edc5e0ef34d726161c3a932cd9819a6e64f8e31f90e1c18b7781360e14eb38", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_ECC_Curve25519.py": "06b58b0cbcc2542aa4bd921b7b81d928f8464d2b9f59bd4b5e4d560728bf0508", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_ECC_Curve448.py": "a0e1f0c33c4616c234068c5ad3ee6940121b15339a9e47601b81bec40145c1b5", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_ECC_Ed25519.py": "193c7430874384dd157c61661bdff357f9eccb38db9bdeed0b31384f526cb581", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_ECC_Ed448.py": "059dafdd8deb2338e05376cf0714555bcd66aa46942d660629cfad52fe7a2a4f", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_ECC_NIST.py": "9e65ecfea32e579d40f04ad33c18ce2606f9f70c00350e7d7804f83e5349550c", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_ElGamal.py": "e58b3c7f3e206f7c00502e40a9ade955f3b7d67055544fa30469c8e429658547", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_RSA.py": "fd8a680c57f1fa46fc4a600f137bf59a302d67a5a2c2abc5b2d4cfd2dea9163e", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_Curve25519.py": "bfdaca1da576dfc8ea2bc9c600967383e3585defdfefe6a7f15d7c2b9e9b97be", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_Curve448.py": "b203749cad96095587d575fb82bc575fe1ff20088339284cbdfb9d819634fbb2", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_DSA.py": "d9a5613097b67f8a4d22d08366ca7adc805dc1fc6a8f3042400e1ac6fa9685e8", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_ECC.py": "c41b3b050c5450bf06a8005806f5fe20488718eefce7a7c13799da3f8c4c3ddf", + "vendor/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_RSA.py": "9ee884deb5c9703349d7b660ed3ff806c93eff2c62850b9e46aa7500a2697e08", + "vendor/pycryptodome/lib/Crypto/SelfTest/Random/__init__.py": "104daeab2df002ec221ad193b81b110b8bcae3e628d13765f3f3bde29f59365c", + "vendor/pycryptodome/lib/Crypto/SelfTest/Random/test_random.py": "ca27fe3ce5b7b2f159fc658e942c2e45453e95e089c3771809ac177e46c65820", + "vendor/pycryptodome/lib/Crypto/SelfTest/Signature/__init__.py": "e01c48381f4831ecb57755e2c7297b991609627bb33695e4f372a5cc60621043", + "vendor/pycryptodome/lib/Crypto/SelfTest/Signature/test_dss.py": "94a4758915f608f1ea9adfb27853c2c04ae59ca27e7524bf91a8f394f01ef05b", + "vendor/pycryptodome/lib/Crypto/SelfTest/Signature/test_eddsa.py": "8f77ee7f0583ebcbde43928bc9e6c9f9b3a1d93bb4d3ea8a380148d6cc4d70a4", + "vendor/pycryptodome/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py": "bdb790f946c6555061688e09522d8dcf69bdd7774714d9d2a0f4434a971891ac", + "vendor/pycryptodome/lib/Crypto/SelfTest/Signature/test_pss.py": "012d42139e56f5beb7541a3b32308f790f34b23da248c601b23159631e24924b", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/__init__.py": "de33ba8a33eda13031a2d12b713a744ee95c73c482e2c8582e06eda7990529de", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/test_Counter.py": "3e774a1be6f1d7715a0edbd9a6f69a0886b44ffb0bb0013d6c8d00ba11cd37b8", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/test_Padding.py": "d61d8a28cd597fb941f1d6b9973728cf94fe08927a03f45cc26f4e708894a926", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/test_asn1.py": "73eb5d9600ef47de94e826460f225d7aa7a7d99697abdeb2d6c2fbf80e3eacea", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/test_number.py": "0ea9a13a74a6738d7b429dbc97c4900c9192e57a9c5c3456d6f57d67aadba0ed", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/test_rfc1751.py": "8e4285100ea8107381efd43abe76dd4b9c1901eb69e4bca2edbcf20ac2d7ad0a", + "vendor/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py": "1992c6d81218e036f9c718f61d75b78b24bbfc2f8ab97f42c2c7e3677581dac6", + "vendor/pycryptodome/lib/Crypto/SelfTest/__init__.py": "0374b3e665f8f6429f7a3274f004e009a184d30f82c97013fa7a851b1ec091db", + "vendor/pycryptodome/lib/Crypto/SelfTest/__main__.py": "721ae32c0b0b884ca89ce41226f4b09ac4dd860edaf1b700b44db3970700df97", + "vendor/pycryptodome/lib/Crypto/SelfTest/loader.py": "cb2a5fa1a28f88447a99b67154c603ee77b759f7507b58f3a0a1bf9ad702e029", + "vendor/pycryptodome/lib/Crypto/SelfTest/st_common.py": "d2ee2bf947be3b5bbb9bd08529f1c0b517cf6a649fb52fc4a0439f52b22f3101", + "vendor/pycryptodome/lib/Crypto/Signature/DSS.py": "43aecda5e65295d96bc79fa37cba2aac944bdb58a08f2aca86f7767de3de3906", + "vendor/pycryptodome/lib/Crypto/Signature/DSS.pyi": "29ffa0aefecaadfd597d34c22f04c1db55cebe1051955e784d3bf76009152a47", + "vendor/pycryptodome/lib/Crypto/Signature/PKCS1_PSS.py": "443775f2d8e0d039b366040306051e30eef11a67dfb36b2b33c0603cb8002a2c", + "vendor/pycryptodome/lib/Crypto/Signature/PKCS1_PSS.pyi": "7a5a50ac183fd7a9572277b09f513f6baeab3b949501869b3e7fac6e25685e13", + "vendor/pycryptodome/lib/Crypto/Signature/PKCS1_v1_5.py": "a84b6f70189c49d9a82f481be41d87fe8fbd5c3d6cfac392eb9571464247aa4f", + "vendor/pycryptodome/lib/Crypto/Signature/PKCS1_v1_5.pyi": "7fb532897d26aa4b4f4abb4ea0bf108f4da728ee884d019b68ead0561ba4189e", + "vendor/pycryptodome/lib/Crypto/Signature/__init__.py": "9e450e0c7007c2a985bde99d44b293157098d2587a59dc6616526e2c3d0805fc", + "vendor/pycryptodome/lib/Crypto/Signature/eddsa.py": "cd93def8ffac0beb287f46caf1793db8df7bd1d53617ad41d86effb7dfe5918c", + "vendor/pycryptodome/lib/Crypto/Signature/eddsa.pyi": "c92810b3c8c71c80ad7889a17de9c34d956913d13d7c2a5d5da9f298205f6776", + "vendor/pycryptodome/lib/Crypto/Signature/pkcs1_15.py": "b233332ff720d9bd98c50afb44c65034f126242fae80f0475847c85ac0387a93", + "vendor/pycryptodome/lib/Crypto/Signature/pkcs1_15.pyi": "16341388d003c24f1f08299b1a6c56f75d8a0b2851f5420db52cbef492e35a01", + "vendor/pycryptodome/lib/Crypto/Signature/pss.py": "03a4352afb2832c4a3b4e8f8736d713e06eace6c52d36fd84253eaf3a4b8d2c2", + "vendor/pycryptodome/lib/Crypto/Signature/pss.pyi": "cfdcbc36502ed1f50d3c762f9e28d08e214bad41fd1bcc40a67c04f85d0b6c31", + "vendor/pycryptodome/lib/Crypto/Util/Counter.py": "025710dd2952db45af53cace2db2889a51531e330a8324e8f92117b67bbdc5fe", + "vendor/pycryptodome/lib/Crypto/Util/Counter.pyi": "d89ad31c962adbadd7a2c4120bf3483f44ee7d4b13946ed652bfa546a8c90ae0", + "vendor/pycryptodome/lib/Crypto/Util/Padding.py": "ef4cc713788bea3b002090d6b69ddcefd0ba1be40df3f1f4424fd74a307c1e9c", + "vendor/pycryptodome/lib/Crypto/Util/Padding.pyi": "e3b4771f6904eba3ed28ef36793fd57397824a035ee2a38582a3883d1765a7d7", + "vendor/pycryptodome/lib/Crypto/Util/RFC1751.py": "bd77ff191e5ecdfe9060879da8d3892228805328248d47cd36d1a9d7375ab552", + "vendor/pycryptodome/lib/Crypto/Util/RFC1751.pyi": "078d8bbec13a1bbf3aacd12cae1b5afc100d6b382ba5bd16a1204fa8aca3b798", + "vendor/pycryptodome/lib/Crypto/Util/__init__.py": "3e4749c1c86b4b1778b72ef5b1dd1e757b2df434a29c8e60060cde45faba364a", + "vendor/pycryptodome/lib/Crypto/Util/_cpu_features.py": "85d9a98dc9f1263933d9dc9fb0f04d9f26b292a6b7cd71a3f60506b969350368", + "vendor/pycryptodome/lib/Crypto/Util/_cpu_features.pyi": "df029767467c965736bb1003bdb873ddd1d5e982f246b0ee8ceb1a6d795f7c24", + "vendor/pycryptodome/lib/Crypto/Util/_cpuid_c.abi3.so": "cc4bf546bd13aa1e7e10ba1e2caf1e3c96455cb4fee2bc2e83ce16df63bb302e", + "vendor/pycryptodome/lib/Crypto/Util/_file_system.py": "3917ef9a5c0a26d9460393c236beb8e94f21bb34da6ecd9be3777f1436ae1be2", + "vendor/pycryptodome/lib/Crypto/Util/_file_system.pyi": "e50aee1163c4e2eacfb65093e4483cb41432855f5f7c17d92008e6328ef6edd3", + "vendor/pycryptodome/lib/Crypto/Util/_raw_api.py": "4e2c3e290cf7d03c048a12fe6e462deaec836e3931d46524d876fdcef7f346fc", + "vendor/pycryptodome/lib/Crypto/Util/_raw_api.pyi": "3a1736aebe914be9e1b3a4f900bd58c90b5aaacc7a055ac96b4f760a2c00bcd3", + "vendor/pycryptodome/lib/Crypto/Util/_strxor.abi3.so": "a899abc207a573615e529d2af720560e95b522cdf7999008c54e36ab536f9fc2", + "vendor/pycryptodome/lib/Crypto/Util/asn1.py": "a5bc58cb76a51422c85bc931122bf63def75296ead57f3f9296747baa8e6c3cd", + "vendor/pycryptodome/lib/Crypto/Util/asn1.pyi": "820bb663c9edc582a8c7bbd199c14979e69b44d42c54bd49d6a9eb7995ecf3e4", + "vendor/pycryptodome/lib/Crypto/Util/number.py": "3b7a2af24f4ca360aed2e6108b28b7f9fdc8d6ba6bcc5852e86c19bd814cd425", + "vendor/pycryptodome/lib/Crypto/Util/number.pyi": "8b15f5052f04befb8f5cdd7ff1aa2c7581ca9ad5c607d36544d548f53f4c000f", + "vendor/pycryptodome/lib/Crypto/Util/py3compat.py": "347d6ab99290190edcdc0537f7b983cb7bbdfb0222c327ab217d4056542cc406", + "vendor/pycryptodome/lib/Crypto/Util/py3compat.pyi": "95c2c05d557ab7877fcbf12c51939811882b394733733325ff721ac08b71629c", + "vendor/pycryptodome/lib/Crypto/Util/strxor.py": "21d904f48e49e6ff527099a18db55fac600a2149ee9012ed75820fce1d5e4796", + "vendor/pycryptodome/lib/Crypto/Util/strxor.pyi": "3ae06fbae2bf7b3ab779a1d8d7427cf71a4447d210f70718cc523b8f5b69965d", + "vendor/pycryptodome/lib/Crypto/__init__.py": "5f1b664ea59a99373dd3ba287ef494d90d10a5de60edc1f5017fa1a0a12da690", + "vendor/pycryptodome/lib/Crypto/__init__.pyi": "7b911ae39272d9174eafa6e62c5f63892d81c3ae569d84c3d4d30b2656c601ac", + "vendor/pycryptodome/lib/Crypto/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/pycryptodome/pyproject.toml": "a469ee4abad65a74ca652e97e9d156143d70cfc594eeddde5cc63513598a44e7", + "vendor/pycryptodome/setup.py": "e98e9e5b01b2b0ad833d68ca52938f16e9835c153b42f47f33ef1182cc40c5bd", + "vendor/pycryptodome/src/AES.c": "a1737082d9f533b2e83266116483f091b5c889c0fb88c75d309344eb9e46affe", + "vendor/pycryptodome/src/AESNI.c": "6da65d486e6f27c189ca95765f1914b8477dd9443f28fcb6a41b19e1e39cc25f", + "vendor/pycryptodome/src/ARC2.c": "e0973649a5bfdc9aa03801cb3110df12de143f07fcf5da108e0fe3b6452c2312", + "vendor/pycryptodome/src/ARC4.c": "83d925a12e917e8c2a28d21dc8af53a9c3edc1cdbcb0222c7e2e6a8269871670", + "vendor/pycryptodome/src/CAST.c": "888062f0074d23315843791eb2d2118d329174d4cbfef23e7f263b67b6ee0df2", + "vendor/pycryptodome/src/DES.c": "f3bcc37f68ec3e04879ffd8e15b0126ac89e17259427ef48b59af44345bd1019", + "vendor/pycryptodome/src/DES3.c": "469e9b1e3d4d51cb203fe5abdefe86c03ef8227a913034abe4b708f9016c3bf1", + "vendor/pycryptodome/src/MD2.c": "831a215a47da72464b0b7aa40e51e094493c27692b0c5b15bf40f30e48395d04", + "vendor/pycryptodome/src/MD4.c": "cc73821dd9fb79d136e9433e04f55f136c27cc24a069db5df0436e909bc9bc99", + "vendor/pycryptodome/src/MD5.c": "e7f668e6316888eb63cf51fa7f3e937170680fe7500f82512eb345903a4ab454", + "vendor/pycryptodome/src/Makefile": "d700c23d191c639a11ad8f6058b37678efc2c129d586ae0a1ec5953322515112", + "vendor/pycryptodome/src/RIPEMD160.c": "d215d1d3ea2ad1b670036ad952975c1e5e484c402cb4e9278a5ef0c1c6e46b30", + "vendor/pycryptodome/src/SHA1.c": "e8d99e6d5ad33bbc410ba90e481c411e4b6d55f374db41be6a0d1c241ac7b8ab", + "vendor/pycryptodome/src/SHA224.c": "494692817661a9b3f13175a9d4558d81d38a23f01d15500152784cbdf29af3e3", + "vendor/pycryptodome/src/SHA256.c": "5ef43e73d6d68f712411bd9bc350deb6ba4e46091f48a9f6320250374555d9aa", + "vendor/pycryptodome/src/SHA384.c": "24a72b00ac9b1c31d0cbcb8e7b4cfbda5d3fa4c84bfcd6793c4f85e060c5d3fb", + "vendor/pycryptodome/src/SHA512.c": "bfa1057ce84fb44a4feee542d05bc841ddc40ecba01453a07ceadebb731b018a", + "vendor/pycryptodome/src/Salsa20.c": "c3ad9c5cf48ef2a367881dd97a3263fadb9c92003e9894f051294ae7791d12f2", + "vendor/pycryptodome/src/bignum.c": "66932c6abc1fe3d930b0ba0c6c54ee2eab638e51b063e89845e6fb323df5b164", + "vendor/pycryptodome/src/blake2.c": "023f500774c640359eb64da4e8ec27a3f177b38f98ec2c7fa4457c54925fdc26", + "vendor/pycryptodome/src/blake2b.c": "605e39b2f64eea3f1ea022755aa7d12391ddde0927d40d7ce3114e72c178c626", + "vendor/pycryptodome/src/blake2s.c": "aef86602a88a4246961f7998b52f171210b8bd4375facb439b06452ce8283c8d", + "vendor/pycryptodome/src/block_base.h": "fe4f90e1b8b0c5eab8f04779dbcc7ef23b9620f682bb3aa755ed316295db6a24", + "vendor/pycryptodome/src/block_common.c": "b93ada4f5ad1b5561bd583d701a092f2a36d71ab4bef748944eb829f54d2f106", + "vendor/pycryptodome/src/blowfish.c": "15f10b567deb8f9bb24fc04478fef05f584ea320c4f8cc695480f5555a27196b", + "vendor/pycryptodome/src/blowfish_eks.c": "87daaaee83c1534fcce3f04b4de3014c96c22ee8758a49ef0637bfde1c4e7b2a", + "vendor/pycryptodome/src/blowfish_init.c": "0043c4111fe15681cb0f61fe429988832b3896eeade218973fc7051678a1f63e", + "vendor/pycryptodome/src/cast5.c": "e52cc5e2efb7089130142600ea97b8b9ca0c19bda51dad1267c02a66f86f43d6", + "vendor/pycryptodome/src/chacha20.c": "bc9ace8571f44a04a71b96c8d9bfd005a9844d19daa7e2e392e4fd87a9dd0af8", + "vendor/pycryptodome/src/common.h": "193906918ffeb042be577ba61c96f55d08136cbae1a2b90a05195f1dd7e31ee4", + "vendor/pycryptodome/src/cpuid.c": "83d4024a31a293f1d6e32e4d6ca14c96a98c648ab700e0f7f562ccd58d158d51", + "vendor/pycryptodome/src/curve25519.c": "fb3dfde59475ac7bb5775d8274de023dadf42a908b1e335d90b0865cd68bed28", + "vendor/pycryptodome/src/curve25519.h": "ecf4d07f07ba825f94deffb3627669ffb413a5dedbfe6bb648a8a72f86407234", + "vendor/pycryptodome/src/curve448.c": "d67118b1ea85667c84f4de001e4c0813adf0127e9bbcf73ea836aab02df60456", + "vendor/pycryptodome/src/curve448.h": "ac1fbcd27c1d37f7a33f7aa7955d2af05b2694f90eced998675e2072293d6dfd", + "vendor/pycryptodome/src/ec.h": "afb74095fb921722bd1d712c8c2710f4f3d058f5ca4082d73d0e7335889621cf", + "vendor/pycryptodome/src/ec_ws.c": "4c8b643423157a16d12e2b76033db1fd4757fdfda9227cfdcc47f2cd2e4836b4", + "vendor/pycryptodome/src/ec_ws_p256.c": "3e66bb86a26eb1fcccae13f90ef1e71874340a435986fe11d703c88858dd6500", + "vendor/pycryptodome/src/ec_ws_p384.c": "75f9d9e6d514fbb3587359097f02b30a3410ca04879e139b295dc0b8df878d05", + "vendor/pycryptodome/src/ec_ws_p521.c": "1c885642e5466578ad17c5af9b2f20f2e9a7784748dc39eeb355ebb6c84b1cec", + "vendor/pycryptodome/src/ed25519.c": "30c1071afe18aa784e310f820b43c9695829d5cc62e51e454e285fc5b491b60e", + "vendor/pycryptodome/src/ed25519.h": "a82a0b1d923971c84b3ad78e5d644c7f66879c9c1d693cce16cff2463aa5ec66", + "vendor/pycryptodome/src/ed25519_perf.c": "d7556ccdfe31617606df08e30f91708c57f876072164493c1050d17801d01ef9", + "vendor/pycryptodome/src/ed448.c": "640bc4777f6b05e64ecc4d4b359ba19d96098b8821c815f1b429421b75adc1b3", + "vendor/pycryptodome/src/ed448.h": "170c8b903235dfa35b97d2198e06492caf2eacb866ef822330193d6a5266c60f", + "vendor/pycryptodome/src/ed448_perf.c": "4ccc171718c3802ba1d716e8be86ae82f53d1cfb04da921430ebaa219759839f", + "vendor/pycryptodome/src/endianess.h": "9b44dfb394e8ffe223efe5763f190b1343a480b3d9386180161e64f2f51a5d9e", + "vendor/pycryptodome/src/errors.h": "5037ed290443ca14d738c3141a9ab4c76c384c308ba425845139ad389da67cee", + "vendor/pycryptodome/src/ghash_clmul.c": "904e5c1b69b5579f2b843b7ec38a2d298db257f050b3dc04768511e9283fe9fb", + "vendor/pycryptodome/src/ghash_portable.c": "a5c8be4b00daa6049959414cb1dbf50dacedbb8bababd3b4fbac7944b65698a5", + "vendor/pycryptodome/src/hash_SHA2_template.c": "ee68f74a8d371d3510b88f1dfc4c03edc2afa337f870369bbfdcc0b5cdc2a283", + "vendor/pycryptodome/src/keccak.c": "0bdb85bac4af0b034ae3886a89347b7838057ee0cf1af5e13de5ac7ae5ac6b6b", + "vendor/pycryptodome/src/libtom/tomcrypt.h": "ab9db523ca2e8a1febd386bbb6544cf9c5a802042a57df8b357ab9bbe5cd8bba", + "vendor/pycryptodome/src/libtom/tomcrypt_argchk.h": "10340f81b0867fa8d76c932c4324aa2837925d270e8f6be699066507620c7e02", + "vendor/pycryptodome/src/libtom/tomcrypt_cfg.h": "e8d0a2f8aafe081db594e38f3df273b6446935233d04941434c08a28f4c2b18c", + "vendor/pycryptodome/src/libtom/tomcrypt_cipher.h": "54bb5c168bee243a279d1b6fed406a3497c542dc85b84104a4c323e290cf8361", + "vendor/pycryptodome/src/libtom/tomcrypt_custom.h": "bbd11ff72d4c6c5e7bcb02185f9a479fb0f255f253cef5624c6dd246b552f476", + "vendor/pycryptodome/src/libtom/tomcrypt_des.c": "79d55599c13dfb055c34a27cc0af1d085989c3b912bcee2a734bebeacff1f8e6", + "vendor/pycryptodome/src/libtom/tomcrypt_hash.h": "3cbd35ff8a797dac3f03bb9d617b3f1aa3a956b92ff5fbbf8bd3aa818b545ec5", + "vendor/pycryptodome/src/libtom/tomcrypt_mac.h": "cba6a572026362f9aa04fb7c15014e8039fa508636fcaf8c7ecb6380b2245ba3", + "vendor/pycryptodome/src/libtom/tomcrypt_macros.h": "729c06337acbe6dd68289d4dc3722d8005c811c29b7145f99656918cdf27847c", + "vendor/pycryptodome/src/libtom/tomcrypt_math.h": "f8901f49d9bdf6091cb27cad39b038fce18d43b157007273a00afabb4ec284fc", + "vendor/pycryptodome/src/libtom/tomcrypt_misc.h": "32840d3a045f165677b4271afa5e2f0d1060ee806b9ea726128432930450cdf9", + "vendor/pycryptodome/src/libtom/tomcrypt_pk.h": "037fbc7e10cd6e249fda37519985990e81fc104d774e1b0fb9b22d37afbeddbd", + "vendor/pycryptodome/src/libtom/tomcrypt_pkcs.h": "e9bdbebf612cdf97155b869acb816ed1328c5886e2c7b3abd9e377b35c7faeac", + "vendor/pycryptodome/src/libtom/tomcrypt_prng.h": "1aba7db211c344637120744269fbba5801ea3aacb0704dd07ac3f18e3a8a9e0b", + "vendor/pycryptodome/src/make_ecc_table.py": "6691bcad87bdf56f86a6e16a1b84b4d7cec61838b941694c3cb30094003ec2db", + "vendor/pycryptodome/src/make_p256_table.c": "da5c11ddf1ad8c7f07f0b121bd14f48e0d082c4cb7a091da1c4948db5a971eb0", + "vendor/pycryptodome/src/make_p384_table.c": "ba978245c7efe6ce420708eee23ac443aad49e270427e718818dab93f27896f9", + "vendor/pycryptodome/src/make_p521_table.c": "f0eb912b4b6da3ca2f5e4ad0457b626fa826bc8140c0d1efc9d43ac8a7631f35", + "vendor/pycryptodome/src/mod25519.c": "f5d4f494153ad14bf3e392806a6661fd9f1a6e8fc7c09cc13c7770b6fc9a1d83", + "vendor/pycryptodome/src/modexp.c": "1bcd3232688568d6abf6ef5b98624ff39791cfe1e62ebaba828bc9085d9ba80d", + "vendor/pycryptodome/src/modexp_utils.c": "3ac2435b28f0a4b51e142b6cf5bd76ba5da69b095997e52a41865a3d4982cd22", + "vendor/pycryptodome/src/modexp_utils.h": "12c240f9999988295bf040dae25135ba11b0a22c96a39022a0652c2cd578234a", + "vendor/pycryptodome/src/modexp_utils_math.c": "e752e6520c831e8b8c588db1ab9112b87b3e307af02a78a72fd80cf30c73b058", + "vendor/pycryptodome/src/mont.c": "6c985c7ea3f09239246d6c343e6b8212d8b9e5a5d63d03370a9d9b0a2bd0def9", + "vendor/pycryptodome/src/mont.h": "ab8af8b6a9e354970a426341466c61679fe8660ee05b058c0a742326d39351c4", + "vendor/pycryptodome/src/mont1.c": "feffb575462194352f876bd02b0b4e0342585b8d88b4952c91e6fefb211da46d", + "vendor/pycryptodome/src/mont2.c": "feffb575462194352f876bd02b0b4e0342585b8d88b4952c91e6fefb211da46d", + "vendor/pycryptodome/src/mont3.c": "feffb575462194352f876bd02b0b4e0342585b8d88b4952c91e6fefb211da46d", + "vendor/pycryptodome/src/multiply.h": "3460ecc47ccd2dfc72c95d8b4884b3bd609506b7de97b06effc6e9a23be2d7c5", + "vendor/pycryptodome/src/multiply_32.c": "cc134804557859ca27fd4a32987f55242a68e59f6b08fca1c660a9ba98f12a01", + "vendor/pycryptodome/src/multiply_64.c": "d5b370669b9da61dfcf9e45fcb91e6aaf32a6be5a62399ce03feb8ab4a84de7a", + "vendor/pycryptodome/src/p256_table.c": "33fc44d0174b37db998775712a4aec942440ec83b10b8ed7985fcaa48adaf61c", + "vendor/pycryptodome/src/p256_table.h": "3314ace73972d1e5490a9c2c003eb3de85cefa236f5581fe6abe7a34cdffba66", + "vendor/pycryptodome/src/p384_table.c": "8b140ad5c12c8ed9d24e0fcb707365cbea8b1c506d0734ccb636aca2edf5dea4", + "vendor/pycryptodome/src/p384_table.h": "fd0ac0e4626e55a882454a621c4b03c5f1cfcf2b4655aadaef0069716130014b", + "vendor/pycryptodome/src/p521_table.c": "99eb5015a128b0cedb8047565d938349becc5c3962b0c2db80a798a81233e3a3", + "vendor/pycryptodome/src/p521_table.h": "fb4c3cbd41fa786f430798b7114624e6323b276303ce50c0dabcd51cfe73bce3", + "vendor/pycryptodome/src/pkcs1_decode.c": "ae8ff069bfc7b1c62bda1808580fc5cec5ea5f1100972df0e9205be22ca05107", + "vendor/pycryptodome/src/poly1305.c": "b684bea106d5a9dbbfea97ad1dd94d27fdd381be72b9ba7ce49800dc29a802da", + "vendor/pycryptodome/src/raw_cbc.c": "e471a378e6cd0d5f4fc08f33751c5bd8909b92d1e6dabac322a0c4e302e9f8e4", + "vendor/pycryptodome/src/raw_cfb.c": "8c9ec2cec17cc7343f1e0e64531561bca2f4f1308cff8a46b8f819d55da31ba0", + "vendor/pycryptodome/src/raw_ctr.c": "9369e0fcdaef67c8c024473ab14c63a3adc47f56befe7f8d827840d1449edab6", + "vendor/pycryptodome/src/raw_ecb.c": "3fbb7391fbd33d687a53b277ce18c185e79600cf4ecc61f3ca0efaa37b50782a", + "vendor/pycryptodome/src/raw_ocb.c": "df880602dfa33ba89b0df4fa5f6a491e226f69883f854a35bd20c6fd43353d53", + "vendor/pycryptodome/src/raw_ofb.c": "77cdafcbb1b1c98714c9181137cf567693fcdef513f216075b0efb6eb6d07a9d", + "vendor/pycryptodome/src/scrypt.c": "2a531ee73c98139f5008ee448482c402548d92947a02582458f169dd55fd42e2", + "vendor/pycryptodome/src/siphash.c": "c471059136468f49ef44e234c0952f3c62fa681621d3a8c36ac138edaae2d0f6", + "vendor/pycryptodome/src/siphash.h": "0a261b9d2abb36b36045d167d0ef280219f6c74b657e181ec5952cf5582fba8a", + "vendor/pycryptodome/src/siphash_math.c": "b797d91bed312b4f064f687ee5498c661bcaa9253b3474c3d393ad05d9edb49a", + "vendor/pycryptodome/src/strxor.c": "ec08375602e44df6ecf18da0239dd8ba0084fce1573e4ef4dd72d3b962db4162", + "vendor/pycryptodome/src/test/CMakeLists.txt": "853c12f9ff938df9d95f8f8dbf0213e811d1b311382ad5d638e6e9b784e1ec16", + "vendor/pycryptodome/src/test/README.txt": "f487f115a533771e04a4c07cca8bbb1a725e5c190f27c95e1217738f95148307", + "vendor/pycryptodome/src/test/common.py": "46d6e1f2b55677366c67a3f185e5a165458b82b58466ba6f83206dac0c978ac1", + "vendor/pycryptodome/src/test/make_tests_addmul.py": "912de5d07a4029ed07b5a49a9aa7eb480bc05a9bfeeb9b05b7cf93af112f9b7c", + "vendor/pycryptodome/src/test/make_tests_addmul128.py": "3958b11c404d42e0ef4a22d70c55f3af45d39f9c57d99746fe664ec482b925e4", + "vendor/pycryptodome/src/test/make_tests_ladder_step.py": "9b9dfd061ae5c86768998afea4b82e2c28af7141268fd73da110b20f4fd402e2", + "vendor/pycryptodome/src/test/make_tests_mont_mult.py": "14397b3fab9037c92d561a135d26eb433d414965d1e8e61cc56303dfbab4453d", + "vendor/pycryptodome/src/test/make_tests_mul_25519.py": "ef536a1b4a110b8aeaeb468f032de0a63be742cb4b12256260f1c5d6acf5dc29", + "vendor/pycryptodome/src/test/make_tests_poly1305_accumulate.py": "6b22979c4e0459225d8c1afd3861bf0674ebd65999fe9d78894cd7ea8d69b9aa", + "vendor/pycryptodome/src/test/make_tests_poly1305_load_m.py": "37370a29f1e40507f532a4dff920e02b4d4ec76864d10dc86710992db2af7bac", + "vendor/pycryptodome/src/test/make_tests_poly1305_load_r.py": "3668fb134e910f518f729215f45fc4b47971bed73768ef71b210f16c6745a2a9", + "vendor/pycryptodome/src/test/make_tests_poly1305_multiply.py": "8a76004664f2f715ae465499abb3743ced1c9a68dcd9bf1a2b885ea1748a35b2", + "vendor/pycryptodome/src/test/make_tests_poly1305_reduce.py": "fb4db53dd1c9ff8bd519e17a196e269210aece929cefab679f0fca5acf3a6d3d", + "vendor/pycryptodome/src/test/make_tests_product.py": "8fd2b609d0528d05d86c689fd4b6e67c77544d5e75052bc994f4e24cf5a6bd60", + "vendor/pycryptodome/src/test/make_tests_square.py": "ad7241ea33de9fec406581afb95336cbaaa94b4f4a25c73d32eb90008e161340", + "vendor/pycryptodome/src/test/test_aesni.c": "9ca75eb23cab56a1392d4df6fbe17dd43b6c1c7eda304b4a5178b55855dd4140", + "vendor/pycryptodome/src/test/test_clmul.c": "42b8fe4d103758c196018a8c8446b44a7f96f207ed071f9acb7b8f2d57ef61f3", + "vendor/pycryptodome/src/test/test_curve25519.c": "82b5f93b59b1269909fd038759b3467cd35ae0aa8b5b9766857eeb102b849762", + "vendor/pycryptodome/src/test/test_curve448.c": "0f96c3c2c438553398c7fda800d3b449dcbdc34059f2be9912c00365596ca9fe", + "vendor/pycryptodome/src/test/test_ec_ws.c": "8da9868867eac457c3587bbd7625333f6b9774dc6cfd62528bd053cfe15f3180", + "vendor/pycryptodome/src/test/test_ed25519.c": "0c255a63e51b8bc684199d2806415d7914e1248155eb463af9f9a51163e32557", + "vendor/pycryptodome/src/test/test_ed448.c": "b49a72ffd82fd4514df1695135524e0b5b8a5e545adc6759f6f3a34d94dab1e7", + "vendor/pycryptodome/src/test/test_endianess.c": "ee06e51abd332941c04b1ef34229c318355771a16cb3bc9fad16b7107a05cf09", + "vendor/pycryptodome/src/test/test_mod25519.c": "938c2d1f9896ccb7654cecd426f9af3dc5e9fd12e5d88ded3973fd55452728e1", + "vendor/pycryptodome/src/test/test_mont.c": "1891992f9ba4a66c3a79ddb062d620e31c73fbc1ce163e7a4b84948d9623d890", + "vendor/pycryptodome/src/test/test_pkcs1.c": "4cb679b2a03d0dcc501bc5cb7babceb21b6935b1fbd22274b773474fd7b0f0c6" + }, + "mutable": [ + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.py", + "vendor/pycryptodome/lib/Crypto/Cipher/_mode_ccm.pyi" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-1990-security-cryptography/tests/task_test.sh b/tasks/candidate-1990-security-cryptography/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..3bbc1080eee98219d1efddf0100e07fedcb63584 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/tests/task_test.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -u +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + + +mkdir -p /logs/verifier +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit 0 + diff --git a/tasks/candidate-1990-security-cryptography/tests/test.sh b/tasks/candidate-1990-security-cryptography/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-1990-security-cryptography/tests/test_outputs.py b/tasks/candidate-1990-security-cryptography/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..02787e35391f0ad19a6434cb216f722431383418 --- /dev/null +++ b/tasks/candidate-1990-security-cryptography/tests/test_outputs.py @@ -0,0 +1,177 @@ +import ast +import hashlib +import json +import os +from pathlib import Path +import subprocess +import sys + + +APP = Path("/app") +VENDOR = APP / "vendor/pycryptodome" +LIB = VENDOR / "lib" +FIXTURE = json.loads(Path("/tests/fixtures/ccm_cases.json").read_text()) + + +def sha256(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def run_probe(code, timeout=45): + env = os.environ.copy() + env["PYTHONPATH"] = str(LIB) + result = subprocess.run( + [sys.executable, "-c", code], + cwd=APP, + env=env, + text=True, + capture_output=True, + timeout=timeout, + check=False, + ) + assert result.returncode == 0, result.stdout + result.stderr + return json.loads(result.stdout) + + +def test_gate_artifact_source_tree_and_integrity(): + report_path = APP / "ccm_repair_report.json" + assert report_path.is_file() + report = json.loads(report_path.read_text()) + assert report["schema_version"] == "tbench.ccm_repair_report.v1" + assert report["passed"] is True + assert report["checks"] and all(report["checks"].values()) + + for relative, expected in FIXTURE["immutable_sha256"].items(): + path = APP / relative + assert path.is_file(), relative + assert sha256(path) == expected, relative + + for relative, base_hash in FIXTURE["mutable_base_sha256"].items(): + path = APP / relative + assert path.is_file(), relative + assert sha256(path) != base_hash, relative + + +def test_core_declared_limits_are_nonce_derived(): + result = run_probe( + """ +import json +from Crypto.Cipher import AES, _mode_ccm +key = bytes(range(16)) +error = _mode_ccm.CCMMessageTooLongError +out = {"subclass": issubclass(error, ValueError)} +try: + AES.new(key, AES.MODE_CCM, nonce=b'N' * 13, msg_len=65536) +except Exception as exc: + out["q2_error"] = type(exc) is error +else: + out["q2_error"] = False +try: + AES.new(key, AES.MODE_CCM, nonce=b'Q' * 12, msg_len=65536) +except Exception: + out["q3_accept"] = False +else: + out["q3_accept"] = True +try: + AES.new(key, AES.MODE_CCM, nonce=b'S' * 7, msg_len=2 ** 64) +except Exception as exc: + out["q8_error"] = type(exc) is error +else: + out["q8_error"] = False +print(json.dumps(out)) +""" + ) + assert result["subclass"] is True + assert result["q2_error"] is True + assert result["q3_accept"] is True + assert result["q8_error"] is True + + +def test_core_lazy_encrypt_and_decrypt_reject_before_output(): + result = run_probe( + """ +import json +from Crypto.Cipher import AES, _mode_ccm +key = bytes(range(16)) +error = _mode_ccm.CCMMessageTooLongError +result = {} +for direction, fill in (("encrypt", 0xA5), ("decrypt", 0x5A)): + output = bytearray([fill]) * 65536 + cipher = AES.new(key, AES.MODE_CCM, nonce=b'N' * 13) + try: + getattr(cipher, direction)(b'X' * 65536, output=output) + except Exception as exc: + result[direction + "_error"] = type(exc) is error + else: + result[direction + "_error"] = False + result[direction + "_unchanged"] = output == bytearray([fill]) * 65536 +print(json.dumps(result)) +""" + ) + assert result["encrypt_error"] is True + assert result["encrypt_unchanged"] is True + assert result["decrypt_error"] is True + assert result["decrypt_unchanged"] is True + + +def test_core_valid_vectors_streaming_and_verification(): + code = """ +import json +from Crypto.Cipher import AES +cases = json.loads(%r) +out = [] +for case in cases: + key = bytes.fromhex(case["key_hex"]) + nonce = bytes.fromhex(case["nonce_hex"]) + aad = bytes.fromhex(case["aad_hex"]) + plaintext = bytes.fromhex(case["plaintext_hex"]) + cipher = AES.new(key, AES.MODE_CCM, nonce=nonce, mac_len=case["mac_len"], msg_len=len(plaintext), assoc_len=len(aad)) + cipher.update(aad) + split = max(1, len(plaintext) // 2) + ciphertext = cipher.encrypt(plaintext[:split]) + cipher.encrypt(plaintext[split:]) + tag = cipher.digest() + decipher = AES.new(key, AES.MODE_CCM, nonce=nonce, mac_len=case["mac_len"], msg_len=len(ciphertext), assoc_len=len(aad)) + decipher.update(aad) + recovered = decipher.decrypt(ciphertext) + decipher.verify(tag) + out.append({"ciphertext": ciphertext.hex(), "tag": tag.hex(), "recovered": recovered.hex()}) +print(json.dumps(out)) +""" % json.dumps(FIXTURE["valid_cases"]) + result = run_probe(code) + assert len(result) == len(FIXTURE["valid_cases"]) + for actual, expected in zip(result, FIXTURE["valid_cases"]): + assert actual["ciphertext"] == expected["ciphertext_hex"] + assert actual["tag"] == expected["tag_hex"] + assert actual["recovered"] == expected["plaintext_hex"] + + +def test_edge_typing_surface_and_boundary_capacity(): + stub_path = LIB / "Crypto/Cipher/_mode_ccm.pyi" + tree = ast.parse(stub_path.read_text()) + classes = {node.name: node for node in tree.body if isinstance(node, ast.ClassDef)} + assert "CCMMessageTooLongError" in classes + bases = classes["CCMMessageTooLongError"].bases + assert len(bases) == 1 and isinstance(bases[0], ast.Name) + assert bases[0].id == "ValueError" + + exports = None + for node in tree.body: + if isinstance(node, ast.Assign) and any(isinstance(target, ast.Name) and target.id == "__all__" for target in node.targets): + exports = ast.literal_eval(node.value) + assert exports is not None + assert "CcmMode" in exports + assert "CCMMessageTooLongError" in exports + + result = run_probe( + """ +import json +from Crypto.Cipher import AES +key = bytes(range(16)) +cipher = AES.new(key, AES.MODE_CCM, nonce=b'Q' * 12, msg_len=65536) +ciphertext = cipher.encrypt(b'B' * 65536) +print(json.dumps({"length": len(ciphertext), "tag_length": len(cipher.digest())})) +""" + ) + assert result["length"] == 65536 + assert result["tag_length"] == 16 + diff --git a/tasks/candidate-2072-software-data-engineering/environment/Dockerfile b/tasks/candidate-2072-software-data-engineering/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..edf704c5d0aed0a64d029efff9880221a5962f08 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:f85d71ae7304ceabc856304d4e6dccbb3fcc0182ca81f7a013324a630a546730 diff --git a/tasks/candidate-2072-software-data-engineering/environment/setup/setup.sh b/tasks/candidate-2072-software-data-engineering/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-2072-software-data-engineering/instruction.md b/tasks/candidate-2072-software-data-engineering/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..df81874ce51c22885556c02961f7db35cae733a7 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/instruction.md @@ -0,0 +1,28 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair redundant Parquet partition metadata + +A local data pipeline reads Hive-style partitioned Parquet datasets through two Dask backends. Some producers retain every partition key as a physical file column, while others omit every key and rely on directory metadata. The current frozen readers do not handle these layouts consistently. + +Repair both existing modules: + +- `/app/vendor/dask/dask/dataframe/io/parquet/arrow.py` +- `/app/vendor/dask/dask/dataframe/io/parquet/fastparquet.py` + +Implement one policy in both engine paths: + +1. If **all** discovered Hive partition names are also physical file columns, treat the directory partitions as redundant. The physical columns must appear exactly once, in their original order. Clear associated virtual partition state before downstream part construction. +2. If **none** of the partition names are physical columns, retain the directory partitions so they are materialized after the physical columns. +3. If only a **proper subset** overlaps, raise `ValueError`; silently dropping either side is ambiguous. +4. Preserve behavior when no partition metadata exists and keep the lazy metadata/part construction flow intact. + +This is a source repair, not a report-only task. Do not replace the vendored modules or regression tool, disable checks, or add a parallel reader. After repairing both modules, run: + +```bash +cd /app +python3 tools/run_overlap_regression.py +``` + +The command must succeed and create `/app/regression-report.json` with schema version `dask-parquet-overlap-report.v1`, both engines listed, all six case checks true, and `passed: true`. diff --git a/tasks/candidate-2072-software-data-engineering/task.toml b/tasks/candidate-2072-software-data-engineering/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1bdce5fa5cd443b40ee9b8662604226f847c6903 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-2072-software-data-engineering" +description = "MiMo-V2.6-RL terminal task candidate-2072-software-data-engineering" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-2072-software-data-engineering" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:f85d71ae7304ceabc856304d4e6dccbb3fcc0182ca81f7a013324a630a546730" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-2072-software-data-engineering/tests/anti_hack_guard.py b/tasks/candidate-2072-software-data-engineering/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-2072-software-data-engineering/tests/fixtures/cases.json b/tasks/candidate-2072-software-data-engineering/tests/fixtures/cases.json new file mode 100644 index 0000000000000000000000000000000000000000..19871c31a2c00976653fd625273256490c7054ad --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/fixtures/cases.json @@ -0,0 +1,23 @@ +{ + "schema_version": "dask-parquet-overlap-fixtures.v1", + "all_physical": { + "columns": ["payload", "site", "window"], + "partitions": ["site", "window"] + }, + "all_directory": { + "columns": ["payload"], + "partitions": ["site", "window"] + }, + "partial_first": { + "columns": ["payload", "site"], + "partitions": ["site", "window"] + }, + "partial_second": { + "columns": ["payload", "window"], + "partitions": ["site", "window"] + }, + "no_partitions": { + "columns": ["payload", "site"], + "partitions": [] + } +} diff --git a/tasks/candidate-2072-software-data-engineering/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-2072-software-data-engineering/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..a4dd4753bfb9468938c3d02695dd4e4c12700465 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,27 @@ +{ + "artifacts": [ + "regression-report.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "regression_contract.json": "cacb6c59929c64687e73f0b3824051bc38de5b62f146850ef6339fa05251ac95", + "tools/run_overlap_regression.py": "ba2073f4a83772980b016f4955fc2d7a9745eb3c849ddb88e7d4f62c06750eae", + "vendor/dask/LICENSE.txt": "c9cebc19f0440eb26ab8337209e1b744eac6a7631d250e7e405b5b0dc0836bdf", + "vendor/dask/dask/__init__.py": "2f805f5ca27b9f5e3700ca7ae9a3de520bde693ac6397cb006c47e4eaed02608", + "vendor/dask/dask/dataframe/core.py": "7c62f260cdff9f8f64297193891af72d9b5e2f25fd2ce58ac05ae6cf0e2d51e6", + "vendor/dask/dask/dataframe/io/parquet/__init__.py": "74b007fced31f7235978f0608221dbd2b07ba75a0788c1731c9fd619c1ed258d", + "vendor/dask/dask/dataframe/io/parquet/arrow.py": "21b809ff679d090baddaed7f7cc73e47e78bd7c2abd014dc98aa57598ae48846", + "vendor/dask/dask/dataframe/io/parquet/core.py": "890055eb7ac9643f8902ac87e7a0c5ef41dbf4eef1c49daede629a4cf332a1af", + "vendor/dask/dask/dataframe/io/parquet/fastparquet.py": "ca6d60f44682125d497a64dd7c4c4f562308fd8c52c4250e3156343dfeedf57d", + "vendor/dask/dask/dataframe/io/parquet/utils.py": "4699f67cf458f0d67c4a3eee526c1addc24f9617de4f9fa647964ce4882516ef", + "vendor/dask/dask/dataframe/io/tests/test_parquet.py": "4d3a4e7ce2bed194b8e57cec768dbe56de1b945128a4dc5875f6cf9b3a1e8f10", + "vendor/dask/dask/dataframe/utils.py": "bc0930b1095c8fbdf5623fe9585931d1d8015a55e8c430f28926255656227e31", + "vendor/dask/setup.py": "950bd258cf77dc11ba7d1b43ee38a402459c62bb3476dae260a851ed82a69226" + }, + "mutable": [ + "vendor/dask/dask/dataframe/io/parquet/arrow.py", + "vendor/dask/dask/dataframe/io/parquet/fastparquet.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-2072-software-data-engineering/tests/fixtures/protected_hashes.json b/tasks/candidate-2072-software-data-engineering/tests/fixtures/protected_hashes.json new file mode 100644 index 0000000000000000000000000000000000000000..b2ac33e11ff4e6aab28580d4140e3b24b0fb6f52 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/fixtures/protected_hashes.json @@ -0,0 +1,13 @@ +{ + "regression_contract.json": "cacb6c59929c64687e73f0b3824051bc38de5b62f146850ef6339fa05251ac95", + "tools/run_overlap_regression.py": "ba2073f4a83772980b016f4955fc2d7a9745eb3c849ddb88e7d4f62c06750eae", + "vendor/dask/LICENSE.txt": "c9cebc19f0440eb26ab8337209e1b744eac6a7631d250e7e405b5b0dc0836bdf", + "vendor/dask/dask/__init__.py": "2f805f5ca27b9f5e3700ca7ae9a3de520bde693ac6397cb006c47e4eaed02608", + "vendor/dask/dask/dataframe/core.py": "7c62f260cdff9f8f64297193891af72d9b5e2f25fd2ce58ac05ae6cf0e2d51e6", + "vendor/dask/dask/dataframe/io/parquet/__init__.py": "74b007fced31f7235978f0608221dbd2b07ba75a0788c1731c9fd619c1ed258d", + "vendor/dask/dask/dataframe/io/parquet/core.py": "890055eb7ac9643f8902ac87e7a0c5ef41dbf4eef1c49daede629a4cf332a1af", + "vendor/dask/dask/dataframe/io/parquet/utils.py": "4699f67cf458f0d67c4a3eee526c1addc24f9617de4f9fa647964ce4882516ef", + "vendor/dask/dask/dataframe/io/tests/test_parquet.py": "4d3a4e7ce2bed194b8e57cec768dbe56de1b945128a4dc5875f6cf9b3a1e8f10", + "vendor/dask/dask/dataframe/utils.py": "bc0930b1095c8fbdf5623fe9585931d1d8015a55e8c430f28926255656227e31", + "vendor/dask/setup.py": "950bd258cf77dc11ba7d1b43ee38a402459c62bb3476dae260a851ed82a69226" +} diff --git a/tasks/candidate-2072-software-data-engineering/tests/task_test.sh b/tasks/candidate-2072-software-data-engineering/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7c38d348b176a6d5e3263df7c798795d0c60cc49 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/task_test.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -uo pipefail +mkdir -p /logs/verifier +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit 0 diff --git a/tasks/candidate-2072-software-data-engineering/tests/test.sh b/tasks/candidate-2072-software-data-engineering/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-2072-software-data-engineering/tests/test_outputs.py b/tasks/candidate-2072-software-data-engineering/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..b0ff404f3ed42e1fc4e5c3d11a74931595000c37 --- /dev/null +++ b/tasks/candidate-2072-software-data-engineering/tests/test_outputs.py @@ -0,0 +1,88 @@ +import ast +import hashlib +import importlib.util +import json +from pathlib import Path + +import pytest + + +APP = Path("/app") +PARQUET = APP / "vendor/dask/dask/dataframe/io/parquet" +FIXTURES = Path("/tests/fixtures") +MUTABLE = [PARQUET / "arrow.py", PARQUET / "fastparquet.py"] + + +def load_runner(): + path = APP / "tools/run_overlap_regression.py" + spec = importlib.util.spec_from_file_location("overlap_regression", path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def cases(): + return json.loads((FIXTURES / "cases.json").read_text()) + + +def assert_target_shape(path, class_name=None, function_name=None): + tree = ast.parse(path.read_text()) + assert len(tree.body) >= 10 + if class_name: + classes = [node for node in tree.body if isinstance(node, ast.ClassDef) and node.name == class_name] + assert len(classes) == 1 + assert any(isinstance(node, ast.FunctionDef) and node.name == function_name for node in classes[0].body) + else: + assert sum(isinstance(node, ast.FunctionDef) and node.name == function_name for node in tree.body) == 1 + + +def test_gate_source_tree_report_and_protected_assets(): + assert all(path.is_file() and path.stat().st_size > 30_000 for path in MUTABLE) + assert_target_shape(MUTABLE[0], "ArrowDatasetEngine", "_generate_dd_meta") + assert_target_shape(MUTABLE[1], function_name="_determine_pf_parts") + protected = json.loads((FIXTURES / "protected_hashes.json").read_text()) + for relative, expected in protected.items(): + assert hashlib.sha256((APP / relative).read_bytes()).hexdigest() == expected + contract = json.loads((APP / "regression_contract.json").read_text()) + report = json.loads((APP / "regression-report.json").read_text()) + assert contract["schema_version"] == "dask-parquet-overlap-contract.v1" + assert contract["output_schema_version"] == "dask-parquet-overlap-report.v1" + assert report["schema_version"] == "dask-parquet-overlap-report.v1" + assert report["schema_version"] == contract["output_schema_version"] + assert report["engines"] == contract["engines"] == ["arrow", "fastparquet"] + assert set(report["checks"]) == {f"{engine}_{case}" for engine in contract["engines"] for case in ("all_physical", "all_directory", "partial_rejected")} + assert all(report["checks"].values()) and report["passed"] is True + + +def test_core_arrow_independent_metadata_recompute(): + runner = load_runner() + fixture = cases() + columns, state = runner.arrow_case(**fixture["all_physical"]) + assert columns == fixture["all_physical"]["columns"] + assert state["partition_names"] == [] + assert state["partitions"] is None and state["partition_keys"] == {} + columns, state = runner.arrow_case(**fixture["all_directory"]) + assert columns == fixture["all_directory"]["columns"] + fixture["all_directory"]["partitions"] + assert state["partition_names"] == fixture["all_directory"]["partitions"] + for name in ("partial_first", "partial_second"): + with pytest.raises(ValueError): + runner.arrow_case(**fixture[name]) + + +def test_core_fastparquet_independent_discovery_recompute(): + runner = load_runner() + fixture = cases() + assert runner.fastparquet_case(**fixture["all_physical"]) == [] + assert runner.fastparquet_case(**fixture["all_directory"]) == fixture["all_directory"]["partitions"] + for name in ("partial_first", "partial_second"): + with pytest.raises(ValueError): + runner.fastparquet_case(**fixture[name]) + + +def test_edge_no_partition_metadata_is_a_noop(): + runner = load_runner() + fixture = cases()["no_partitions"] + columns, state = runner.arrow_case(**fixture) + assert columns == fixture["columns"] + assert state["partition_names"] == [] and state["partitions"] == [] + assert runner.fastparquet_case(**fixture) == [] diff --git a/tasks/candidate-2160-software-frontend/environment/Dockerfile b/tasks/candidate-2160-software-frontend/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..34895c44c6de3ca13b20c462239750d06fabb835 --- /dev/null +++ b/tasks/candidate-2160-software-frontend/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:debd048e7ee0f778fe4f173e23b37c0a7684ed5f638d59064668fcc27a41e088 diff --git a/tasks/candidate-2160-software-frontend/environment/setup/setup.sh b/tasks/candidate-2160-software-frontend/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-2160-software-frontend/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-2160-software-frontend/instruction.md b/tasks/candidate-2160-software-frontend/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..938296fd2f9564c1ee2063961ef3f48b32f6729e --- /dev/null +++ b/tasks/candidate-2160-software-frontend/instruction.md @@ -0,0 +1,25 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +The existing event form in `/app/vendor/esn-frontend-calendar` incorrectly lets a calendar owner move an existing event even when that user is not the event organizer. Repair the production integration while preserving the frozen source tree and existing public APIs outside this workflow. + +Work in these existing modules: + +- `/app/vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/cal-ui-authorization-service.js` +- `/app/vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.controller.js` + +Required behavior: + +1. `calUIAuthorizationService.canMoveEvent` must evaluate the selected calendar, the existing event, and the current session user together. Movement is allowed only when the session user owns the calendar and is the event organizer. +2. Calendar ownership must be checked with the session user's identifier, while organizer identity must use the full event and user objects through the existing `calEventUtils.isOrganizer` contract. +3. Update both event-form controller call sites to use the same event-aware authorization signature: the initialization branch that decides whether to restrict the calendar list and the later authorization aggregation that sets `$scope.canMoveEvent`. +4. Preserve the new-event branch, writable-calendar filtering, modification/recurrence checks, and the existing move guard. Do not hard-code fixture identities, replace the controller/service, remove tests, or write a parallel authorization implementation. +5. Generate `/app/output.json` with schema version `calendar-authorization-repair.v1` by running: + +```sh +cd /app +./tools/check-calendar-repair.sh +``` + +The command must complete successfully after the repair. Runtime network access and dependency installation are not available. diff --git a/tasks/candidate-2160-software-frontend/task.toml b/tasks/candidate-2160-software-frontend/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..31cdfae6cb5940d0881d2949e218a4cd79df08e7 --- /dev/null +++ b/tasks/candidate-2160-software-frontend/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-2160-software-frontend" +description = "MiMo-V2.6-RL terminal task candidate-2160-software-frontend" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-2160-software-frontend" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:debd048e7ee0f778fe4f173e23b37c0a7684ed5f638d59064668fcc27a41e088" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-2160-software-frontend/tests/anti_hack_guard.py b/tasks/candidate-2160-software-frontend/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-2160-software-frontend/tests/fixtures/expected.json b/tasks/candidate-2160-software-frontend/tests/fixtures/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b907d4e18d79ff5bfb7de874a1712d480f0a56e9 --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/fixtures/expected.json @@ -0,0 +1,19 @@ +{ + "output_schema_version": "calendar-authorization-repair.v1", + "changed_modules": [ + "src/esn.calendar.libs/app/services/cal-ui-authorization-service.js", + "src/esn.calendar.libs/app/components/event/form/event-form.controller.js" + ], + "mutable_base_sha256": { + "src/esn.calendar.libs/app/services/cal-ui-authorization-service.js": "947c18c48ca07889d2e626b23ca9fa55cf384ffc7bdaf89a44c5cb714b2170d6", + "src/esn.calendar.libs/app/components/event/form/event-form.controller.js": "609f9efe873d0ba4fa399ea9ddfd8d296ea5116df7084889626215ad80ecd109" + }, + "immutable_sha256": { + "package.json": "3500014687b2874a25df7cb128248feb5798d5c7a9030b6a0e3fdd3ec430fa2a", + "src/esn.calendar.libs/app/services/event-utils.js": "45637203ad04e7770bd52df22b48bfe991cab60a83017018e0e372df1b6876da", + "src/esn.calendar.libs/app/components/event/form/event-form.pug": "2acddc2eccb47ce30378158c324ef2b98efc79ee5e3144ba6c3496691190e52c", + "src/esn.calendar.libs/app/components/event/form/event-form.directive.js": "9a2aeddac9b4972efeb9acadf35cc4ce4156a3ef33093f65d30a9d5e3bb55f4a", + "src/esn.calendar.libs/app/components/event/form/event-form.controller.spec.js": "27bb3c19b776a6a7d4dcbb54e478269ca1728a82a421cf558352f68b4e9191f9", + "src/esn.calendar.libs/app/services/cal-ui-authorization-service.spec.js": "f0c6c4be9e9c397947140ba0cf1cb434304686e72ff8792fc5f316f5bb1c6195" + } +} diff --git a/tasks/candidate-2160-software-frontend/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-2160-software-frontend/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3243ef2ab4e6e8d94c937b12a91fe77d70d2ef2e --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,52 @@ +{ + "artifacts": [ + "output.json" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "tools/check-calendar-repair.sh": "b174fd5571dc977fe92209807234d2df230a55152c9b96b40ceed589bee6885a", + "tools/run-calendar-authorization-checks.js": "5371d1a3610b16310eed161d4836f381d03b34d4fafa73d31e67d6894072c57c", + "vendor/esn-frontend-calendar/LICENSE": "fdf9e21bbd50ac79165bab10130c220f54691824b66e6d523ef42f5cadd512dd", + "vendor/esn-frontend-calendar/README.md": "22190944c469918c67aa3b1c99b7cdcfbefab168ef0c1b4903158289a4a7ab90", + "vendor/esn-frontend-calendar/package.json": "3500014687b2874a25df7cb128248feb5798d5c7a9030b6a0e3fdd3ec430fa2a", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/app.constants.js": "6d8fbf94fb7dd060f67223307e59eb60d7951170ccb4f589587274f57fcb8953", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.controller.js": "609f9efe873d0ba4fa399ea9ddfd8d296ea5116df7084889626215ad80ecd109", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.controller.spec.js": "27bb3c19b776a6a7d4dcbb54e478269ca1728a82a421cf558352f68b4e9191f9", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.directive.js": "9a2aeddac9b4972efeb9acadf35cc4ce4156a3ef33093f65d30a9d5e3bb55f4a", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.directive.spec.js": "2b17c496980502353587faba24da36038e54567b32889548f06e1bbf468ddad0", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.less": "67ab7a332701ccd498723b438762b0366f90cde65b7250c6bbfbe6d3efab737c", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.pug": "2acddc2eccb47ce30378158c324ef2b98efc79ee5e3144ba6c3496691190e52c", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.service.js": "5862bc0de80260ab20158a93aea5bc45ed77646d79f66945bce7b1b2a94cc691", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.service.spec.js": "9085e582b1b59a5a759bdfd228f0c2079ab85b36061102f0dff244ac45f535ea", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/modals/delete-instance-or-series-modal.pug": "acb786b5f6d13f1c496dc1afa1b11c23b6a777e4ad35b1844d6e9118f3dd0b1e", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/modals/edit-instance-or-series-modal.less": "e7302ad065f4559d769f5d1ad1339f7f62818812fa021a491b680554a33b37ce", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/modals/edit-instance-or-series-modal.pug": "aadd0b7e67a1c2c69dca46729e1d3e176a97cf4eadf68a686c605338fa704880", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/modals/event-form-modal.pug": "57963834982645bcbd812b0780b6338fb3726bd446aeb219aa390dff17b63236", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/modals/partstat-instance-or-series-modal.pug": "a966e92230aaa031da912b73a4ae9237a9efa5104419b9bbc551547d627d96fd", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/open/open-event-form-on-click.component.js": "8c9657bb0c4dd851f35680103159a71eb20d2c7d84a521eb1f41add33eea2996", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/open/open-event-form-on-click.component.spec.js": "90aa71fcbbdc3b799aa79fa492a087e45c0307586f727a7a8189cf3bf7917018", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/open/open-event-form.service.js": "fc246b135a269b6572882d818c8668b8a0607846b829ec044f66aacd3f96c4ca", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/open/open-event-form.service.spec.js": "b74a181a8ddc47f4e4632573a119122d88419d905ef1015655710ce3f9634384", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/open/open-event-from-search-form.service.js": "49b536dacc9cff910bd57a3a9817c3177f4c9800a219dc9ab41cc046dd4c0b52", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/open/open-event-from-search-form.service.spec.js": "49e86cd438078b83db2d0f83aec5bd1b484aabe0f9c4411bdbd6322eda90ef21", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/cal-default-value.service.js": "ea8b846b5ca377ed3ca2d6fa42cf15129e51ebc8eb1f0009534d30c52a8f79a6", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/cal-ui-authorization-service.js": "947c18c48ca07889d2e626b23ca9fa55cf384ffc7bdaf89a44c5cb714b2170d6", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/cal-ui-authorization-service.spec.js": "f0c6c4be9e9c397947140ba0cf1cb434304686e72ff8792fc5f316f5bb1c6195", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/event-utils.js": "45637203ad04e7770bd52df22b48bfe991cab60a83017018e0e372df1b6876da", + "vendor/esn-frontend-calendar/test/config/karma.conf.js": "4b863d4367ac896f049c3dad5d50bd8116c57216699bc36e96338252faa8451a", + "vendor/esn-frontend-calendar/test/config/mocks/i18n-loader.js": "4d03f2a16bbe2906413f0028a68983f6bd087998ddbfdf59993c0823ae7ba446", + "vendor/esn-frontend-calendar/test/config/mocks/injector.js": "dd0251fff2b1b2b86ee4fdf6b7c9f6bba5ee3684ad5234cc050b17ec66b8d31b", + "vendor/esn-frontend-calendar/test/config/mocks/modules.js": "6c97baff7b396420e5750c35de257a96909e6e3ff92fc474bdd009552fcb77fa", + "vendor/esn-frontend-calendar/test/config/mocks/ng-mock-component.js": "471b3f3604ade4b4b4cad0c492dd89b3c42473dbaae15d0d2f59fb6b6d6713f2", + "vendor/esn-frontend-calendar/test/config/mocks/reset-dynamic-directive-injections.js": "2828aef45d4771973ccb2ff096cf8da0d9eefbcf44e68dc53fa226b1afdd9028", + "vendor/esn-frontend-calendar/webpack.commons.js": "a1ebaf70a97450c3c63701406072089b9e0c71ab2997e246a61e8967cbe0d7d6", + "vendor/esn-frontend-calendar/webpack.config.js": "c3d5d93c35e88a7de5ae58f73a847e939f436d484b22ef0a19f8e3730c4d5014", + "vendor/esn-frontend-calendar/webpack.test.js": "a42c56063b7e2ab2b9a4cbcc582c9dd3067cdb7f168073a050bc012009071216" + }, + "mutable": [ + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/cal-ui-authorization-service.js", + "vendor/esn-frontend-calendar/src/esn.calendar.libs/app/components/event/form/event-form.controller.js" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-2160-software-frontend/tests/fixtures/service_probe.js b/tasks/candidate-2160-software-frontend/tests/fixtures/service_probe.js new file mode 100644 index 0000000000000000000000000000000000000000..218e9dd4e9dbb703dff85b9d9e8878ac0446dcc2 --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/fixtures/service_probe.js @@ -0,0 +1,47 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const vm = require('vm'); + +const appRoot = process.env.APP_ROOT || '/app'; +const source = fs.readFileSync(path.join(appRoot, 'vendor/esn-frontend-calendar/src/esn.calendar.libs/app/services/cal-ui-authorization-service.js'), 'utf8'); +let factory; +const context = { + require() {}, + angular: { + module() { + return { + service(name, implementation) { + if (name === 'calUIAuthorizationService') factory = implementation; + } + }; + } + } +}; +vm.runInNewContext(source, context, { filename: 'cal-ui-authorization-service.js' }); +if (typeof factory !== 'function') throw new Error('service registration missing'); + +const organizerCalls = []; +const ownerCalls = []; +const calEventUtils = { + isNew() { return false; }, + isOrganizer(event, user) { + organizerCalls.push([event && event.id, user && user._id]); + const email = event && event.organizer && event.organizer.email; + return Boolean(email && user && user.emails.includes(email)); + } +}; +const service = factory({ when: Promise.resolve.bind(Promise) }, calEventUtils, { get() { return 'default'; } }); +function calendar(ownerId) { + return { isOwner(userId) { ownerCalls.push(userId); return userId === ownerId; } }; +} +const owner = { _id: 'owner', emails: ['owner@example.test', 'alias@example.test'] }; +const outsider = { _id: 'outsider', emails: ['outsider@example.test'] }; +const cases = { + owner_and_organizer: service.canMoveEvent(calendar('owner'), { id: 'a', organizer: { email: 'alias@example.test' } }, owner), + owner_not_organizer: service.canMoveEvent(calendar('owner'), { id: 'b', organizer: { email: 'outsider@example.test' } }, owner), + organizer_not_owner: service.canMoveEvent(calendar('outsider'), { id: 'c', organizer: { email: 'owner@example.test' } }, owner), + unrelated_user: service.canMoveEvent(calendar('owner'), { id: 'd', organizer: { email: 'owner@example.test' } }, outsider) +}; +process.stdout.write(JSON.stringify({ cases, ownerCalls, organizerCalls })); diff --git a/tasks/candidate-2160-software-frontend/tests/task_test.sh b/tasks/candidate-2160-software-frontend/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..d9e4c3eb9341667728395ef9b82c7e88ec844f30 --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/task_test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +set +e +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +code=$? +set -e +if [ "$code" -eq 0 ]; then printf '1\n' > /logs/verifier/reward.txt; else printf '0\n' > /logs/verifier/reward.txt; fi +exit 0 diff --git a/tasks/candidate-2160-software-frontend/tests/test.sh b/tasks/candidate-2160-software-frontend/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi diff --git a/tasks/candidate-2160-software-frontend/tests/test_outputs.py b/tasks/candidate-2160-software-frontend/tests/test_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..86799f7164fd4c4e3825737e3ca18278c02ddd4e --- /dev/null +++ b/tasks/candidate-2160-software-frontend/tests/test_outputs.py @@ -0,0 +1,103 @@ +import hashlib +import json +import os +import re +import subprocess +from pathlib import Path + + +APP_ROOT = Path(os.environ.get('APP_ROOT', '/app')) +TEST_ROOT = Path(os.environ.get('TEST_ROOT', '/tests')) +ROOT = APP_ROOT / 'vendor/esn-frontend-calendar' +SERVICE = ROOT / 'src/esn.calendar.libs/app/services/cal-ui-authorization-service.js' +CONTROLLER = ROOT / 'src/esn.calendar.libs/app/components/event/form/event-form.controller.js' +TEMPLATE = ROOT / 'src/esn.calendar.libs/app/components/event/form/event-form.pug' +EXPECTED = json.loads((TEST_ROOT / 'fixtures/expected.json').read_text()) + + +def sha256(path: Path) -> str: + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def compact(source: str) -> str: + source = re.sub(r'/\*.*?\*/', '', source, flags=re.S) + source = re.sub(r'//[^\n]*', '', source) + return re.sub(r'\s+', ' ', source) + + +def probe_service() -> dict: + completed = subprocess.run( + ['node', str(TEST_ROOT / 'fixtures/service_probe.js')], + check=True, + capture_output=True, + text=True, + timeout=15, + ) + return json.loads(completed.stdout) + + +def test_gate_artifact_schema_and_frozen_assets(): + artifact = json.loads((APP_ROOT / 'output.json').read_text()) + assert artifact == { + 'output_schema_version': EXPECTED['output_schema_version'], + 'status': 'repaired', + 'changed_modules': EXPECTED['changed_modules'], + 'checks': { + 'owner_non_organizer_denied': True, + 'organizer_owner_allowed': True, + 'non_owner_denied': True, + 'initialization_contract': True, + 'aggregation_contract': True, + 'writable_calendar_filter': True, + }, + } + assert SERVICE.is_file() and CONTROLLER.is_file() and TEMPLATE.is_file() + assert not (ROOT / '.git').exists() + for relative, expected_hash in EXPECTED['immutable_sha256'].items(): + assert sha256(ROOT / relative) == expected_hash + for relative, pristine_hash in EXPECTED['mutable_base_sha256'].items(): + assert sha256(ROOT / relative) != pristine_hash + + +def test_core_service_requires_owner_and_matching_organizer(): + result = probe_service() + assert result['cases'] == { + 'owner_and_organizer': True, + 'owner_not_organizer': False, + 'organizer_not_owner': False, + 'unrelated_user': False, + } + assert result['ownerCalls'] == ['owner', 'owner', 'owner', 'outsider'] + assert result['organizerCalls'] == [['a', 'owner'], ['b', 'owner']] + + +def test_core_controller_propagates_event_and_full_session_user_twice(): + source = compact(CONTROLLER.read_text()) + initialization = '.canMoveEvent(_getCalendarByUniqueId($scope.editedEvent.calendarUniqueId), $scope.editedEvent, session.user)' + aggregation = 'calUIAuthorizationService.canMoveEvent(selectedCalendar, $scope.editedEvent, session.user)' + assert source.count(initialization) == 1 + assert source.count(aggregation) == 1 + assert 'canMoveEvent(selectedCalendar, session.user._id)' not in source + assert 'calendarUniqueId), session.user._id)' not in source + assert source.count('.canMoveEvent(') == 2 + + +def test_core_authorized_calendar_filter_and_move_guard_remain_integrated(): + source = compact(CONTROLLER.read_text()) + authorization = source.index('.canMoveEvent(_getCalendarByUniqueId($scope.editedEvent.calendarUniqueId), $scope.editedEvent, session.user)') + filtering = source.index('$scope.calendars = calendars.filter(calendar => calendar.isOwner(session.user._id));') + selected = source.index('return _getCalendarByUniqueId($scope.editedEvent.calendarUniqueId);', authorization) + assert authorization < filtering < selected + assert "!$scope.canMoveEvent || !_eventCalendarHasChanged()" in source + assert 'return calEventService.moveEvent(sourcePath, destinationPath);' in source + + +def test_edge_new_events_bypass_existing_event_movement_authorization(): + source = compact(CONTROLLER.read_text()) + new_branch = source.index('if (calEventUtils.isNew($scope.editedEvent)) {') + duplicate_return = source.index('return eventSourceCalendarId && targetCalendar && targetCalendar.isWritable(session.user._id)', new_branch) + first_move_check = source.index('.canMoveEvent(_getCalendarByUniqueId($scope.editedEvent.calendarUniqueId)', new_branch) + assert new_branch < duplicate_return < first_move_check + template = TEMPLATE.read_text() + assert 'ng-disabled="!canMoveEvent"' in template + assert 'filter: { readOnly: false }' in template diff --git a/tasks/candidate-2163-operations-marketing/environment/Dockerfile b/tasks/candidate-2163-operations-marketing/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..993496cd5966693541e5e01e92975e40e8ede8d1 --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/environment/Dockerfile @@ -0,0 +1,3 @@ +# The task's image, pinned by digest (the same as [environment].docker_image). +# Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy. +FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:728c36759babf1a370503139431f25e7b8e32c6e118ffc23554f1f5ca7a95b1d diff --git a/tasks/candidate-2163-operations-marketing/environment/setup/setup.sh b/tasks/candidate-2163-operations-marketing/environment/setup/setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a15b8f3d59ae555746c3e9dbd7136abfbde9f --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/environment/setup/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into +# /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness. +M=/var/lib/mimo +[ -f "$M/ready" ] && exit 0 +chmod 700 "$M" +fail() { echo "setup: $*" >&2; exit 1; } +# the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs +write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; } + +# Terminal-Bench rows (in the General domain): the Harbor convention itself. Scrub test leftovers from the image and +# remember what was in the workspace, so harness residue can be told apart from the agent's work at grading time. +rm -rf /tests +find /logs/verifier -mindepth 1 -delete 2>/dev/null || true +ls -A /app 2>/dev/null > "$M/before" || true + +touch "$M/ready" +echo "setup done" diff --git a/tasks/candidate-2163-operations-marketing/instruction.md b/tasks/candidate-2163-operations-marketing/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3460cea73a899f0a034fd43511d1d78a7b5f1183 --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/instruction.md @@ -0,0 +1,24 @@ +You are an agent, your current working directory is /app. + +You can use the tools available to you to interact with the computer to assist the user in completing tasks. + +# Repair experiment exposure telemetry + +Work in `/app/vendor/flagsmith-python-client` and repair the existing Python SDK implementation. The current code can inflate experiment exposure counts and can attribute customers to a feature payload even when no experiment variant was assigned. + +Modify both of these existing production modules: + +- `flagsmith/flagsmith.py` +- `flagsmith/analytics.py` + +The repaired integration must satisfy all of the following: + +1. `Flagsmith.get_experiment_flag(...)` must always return the resolved flag, but emit an exposure only when the result is a real `Flag`, the flag is enabled, and `flag.variant` is not `None`. Default-handler results, disabled flags, and variant-less flags must not emit exposure telemetry. +2. A qualified exposure must use the experiment variant key as its event value, never the feature-state display payload. +3. Exposure tracking requires a non-empty customer identifier. A direct exposure call without one must be ignored rather than buffered. +4. Within one active event buffer, repeated exposures with the same feature name, customer identifier, and normalized value must collapse to one buffered record. Differences in any of those three fields must remain distinct. +5. Deduplication applies only to `$flag_exposure` events. Repeated ordinary custom or conversion events must preserve their full multiplicity, even when their payloads are identical. +6. A flush starts a new exposure-deduplication window, so the same exposure may be accepted again after the buffered batch is handed off. Existing failed-delivery requeue behavior must continue retaining the attempted events. +7. Preserve the existing event payload shape, value stringification, automatic maximum-buffer flush behavior, timer lifecycle, and public method signatures. + +Do not delete or replace the vendored package or its tests, disable behavior, add network dependencies, or solve the task by creating a separate script outside the existing SDK modules. diff --git a/tasks/candidate-2163-operations-marketing/task.toml b/tasks/candidate-2163-operations-marketing/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cd998716d31350123dea4993c7e9b614a25dcc4a --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/task.toml @@ -0,0 +1,39 @@ +schema_version = "1.4" + +[task] +name = "mimo-v2.6-rl/candidate-2163-operations-marketing" +description = "MiMo-V2.6-RL terminal task candidate-2163-operations-marketing" +keywords = ["mimo-v2.6-rl", "terminal"] + +[metadata] +adapter = "mimo_harbor 1.0.0" +domain = "terminal" +original_allow_internet = false +reference_harness = "XiaomiMiMo/verl a2ad9f6 + XiaomiMiMo/mimoagent 467f0a1" +reference_step_limit = 500 +source_dataset = "XiaomiMiMo/MiMo-V2.6-RL-oss" +source_id = "candidate-2163-operations-marketing" +source_revision = "639865fd3374018d6cb29b9fb82dd531406fcf5f" + +[agent] +timeout_sec = 900.0 + +[verifier] +timeout_sec = 240.0 +user = "root" + +[environment] +docker_image = "docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:728c36759babf1a370503139431f25e7b8e32c6e118ffc23554f1f5ca7a95b1d" +workdir = "/app" +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +network_mode = "public" +build_timeout_sec = 1800.0 + +[environment.healthcheck] +# one-time setup before the agent (environment/setup/setup.sh) +command = "bash -c 'test -f /var/lib/mimo/ready || { mkdir -p /var/lib/mimo && echo H4sIAAAAAAAC/+2T30/UQBDH77l/xddCEAx3PVAhgUiCkegLL+iDCSFk206vm9vuNrvbq0T83532gJP4qr44n5e2+2PmO9+ZBopdOwv15C8yZ47n8/E5//158Pbo8PH9Yf34zeujCeaTf0AXovKccvJ/svUiy7XNchXqZAtXnQ1wtqB9qADvXNxHTpXzhFgT1IJsxGBYDCf4pHzu/MuAa7Ir7Z1teHdWkzKxLmoqljfobKuKZeDLOqBypiQPbaPjVNlK+czoPGt046BsCT8k13GGj2TJq0gl8jsM27f1mOoUgYhPBFxdnH+4vOCIHrXrQaqoWRa1aFTL2Ry+auUazdr4pqUQZsnlu2cZk2tMK6Tbl5knVd6luMHODuibjpgnRd24Ejyyw4E0qZQ2u3v4DipqhzQMv8wJtl+lONs5PF1fOjjFD65qdMmGnvzUkFoiN65YGh0idoeso4F7bG7bGs31sdKMYpHVLnBVXO3GZa8XdYSq4mBZZNfYdmNC0nsd6fYp7qiraMdKKm0oZE9b6bi4+RwUssQv5BttlZm+J8u2edcH7Go7pl47b1C6Rmm7dzIurvuMwtkVC9PODi0gU83wufBdjkhcnqEquhV5brN3zXhPN1zJ0FlO6qmhJudS+lpF9DxcDxl755eBh4QnLrjHbvHxoMuOUCjL88c2mZI947HbRB9d4gYPAcAxF16V2i4QdUOzxDeY+grZoC0klebxyoxbhIwl6kqzkCmbUFIbaxxgWpKhSDg8y0paZbYzBvf3iL6jxARMz5Fxx55tn63NHf+N9OlwEl3Hnm7GKvllZNhVS2kyEQRBEARBEARBEARBEARBEARBEARBEARBEIQ/xk8LxjaZACgAAA== | base64 -d | tar -xzf - -C /var/lib/mimo && bash /var/lib/mimo/setup.sh; }'" +timeout_sec = 1200.0 +retries = 0 +interval_sec = 5.0 diff --git a/tasks/candidate-2163-operations-marketing/tests/anti_hack_guard.py b/tasks/candidate-2163-operations-marketing/tests/anti_hack_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..471c88d2e60d223487bcae6a5ba2b646528dffca --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/tests/anti_hack_guard.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +"""TBench in-pod anti-hack guard. + +Runs at the very start of ``tests/test.sh``, inside the verifier container, +after the agent's ``/app`` has been copied in. The RL harness materialises +``tests/`` into the MAIN container only after the agent exits, so the agent +cannot see or tamper with this file — which makes it the right place to reject +workspace pollution the agent planted during the episode. + +Detection (any hit -> write reward=0 and exit non-zero): + +1. **Planted interpreter hooks.** ``conftest.py`` / ``sitecustomize.py`` / + ``usercustomize.py`` / ``*.pth`` / ``pytest.ini`` / ``.coveragerc`` / + ``tox.ini`` anywhere under ``/app`` whose path is NOT listed in the pristine + manifest. Upstream vendor trees that legitimately ship a ``conftest.py`` + are listed in the manifest and are therefore not false positives. +2. **Protected-file mutation.** Any manifest entry whose sha256 changed while + its path is outside the declared mutable set. +3. **Protected-file deletion.** Any non-mutable, non-artifact manifest entry + that vanished. + +The manifest is generated from the pristine ``environment/`` tree and shipped +as ``tests/fixtures/pristine_env_manifest.json``. A missing manifest degrades to +name-only detection so the guard never blocks an uninstrumented task. +""" + +from __future__ import annotations + +import hashlib +import json +import os +import sys +from pathlib import Path + +SCHEMA = "tbench.pristine_env_manifest.v1" + +APP = Path(os.environ.get("TBENCH_APP_ROOT", "/app")) +FIXTURES = Path(os.environ.get("TBENCH_FIXTURES", "/tests/fixtures")) +MANIFEST = FIXTURES / "pristine_env_manifest.json" +REWARD = Path(os.environ.get("TBENCH_REWARD_FILE", "/logs/verifier/reward.txt")) + +DANGEROUS_NAMES = { + "conftest.py", + "sitecustomize.py", + "usercustomize.py", + "pytest.ini", + ".coveragerc", + "tox.ini", + "pyproject.toml", # only dangerous when planted; upstream copies are in the manifest +} + + +def sha256(path: Path) -> str: + h = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1 << 20), b""): + h.update(chunk) + return h.hexdigest() + + +def is_dangerous(rel: str) -> bool: + name = rel.rsplit("/", 1)[-1] + return name in DANGEROUS_NAMES or name.endswith(".pth") + + +def load_manifest() -> dict | None: + if not MANIFEST.is_file(): + return None + try: + doc = json.loads(MANIFEST.read_text(encoding="utf-8")) + except (OSError, ValueError): + return None + if not isinstance(doc, dict) or not isinstance(doc.get("files"), dict): + return None + return doc + + +def reject(reason: str, reward: Path | None = None) -> int: + target = REWARD if reward is None else reward + try: + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text("0\n", encoding="utf-8") + except OSError as exc: # pragma: no cover - reward file is the contract + print(f"anti_hack_guard: cannot write reward file: {exc}", file=sys.stderr) + return 2 + print(f"anti_hack_guard: REJECT {reason}", file=sys.stderr) + return 1 + + +def scan(manifest: dict | None, app: Path | None = None) -> str | None: + app_root = APP if app is None else app + files: dict[str, str] = (manifest or {}).get("files") or {} + mutable_set = { + entry.lstrip("/") + for entry in (manifest or {}).get("mutable") or [] + if isinstance(entry, str) + } + artifacts = { + str(entry).removeprefix("/app/").lstrip("/") + for entry in (manifest or {}).get("artifacts") or [] + if isinstance(entry, str) + } + + if not app_root.is_dir(): + return None + + for path in sorted(app_root.rglob("*")): + if not path.is_file() or path.is_symlink(): + continue + rel = path.relative_to(app_root).as_posix() + if is_dangerous(rel) and rel not in files: + return f"planted_interpreter_hook:{rel}" + + if manifest is None: + return None + + # Deletion detection is only sound when the built image is known to equal + # the source tree (plain ``COPY . /app``). A multi-stage or dockerignored + # build legitimately omits files, and rejecting those would zero out the + # oracle for a perfectly good task. + detect_deletion = bool(manifest.get("detect_deletion", True)) + for rel, expected in files.items(): + if rel in mutable_set or rel in artifacts: + continue + path = app_root / rel + if not path.exists(): + if detect_deletion: + return f"protected_file_deleted:{rel}" + continue + if not path.is_file(): + continue + if sha256(path) != expected: + return f"protected_file_mutated:{rel}" + return None + + +def main(app: Path | None = None, reward: Path | None = None) -> int: + manifest = load_manifest() + reason = scan(manifest, app=app) + if reason: + return reject(reason, reward=reward) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tasks/candidate-2163-operations-marketing/tests/fixtures/pristine_env_manifest.json b/tasks/candidate-2163-operations-marketing/tests/fixtures/pristine_env_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..329e4eb14981f2f72b763ff785fa6a52ea7d75c0 --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/tests/fixtures/pristine_env_manifest.json @@ -0,0 +1,51 @@ +{ + "artifacts": [ + "vendor/flagsmith-python-client/flagsmith/analytics.py", + "vendor/flagsmith-python-client/flagsmith/flagsmith.py" + ], + "detect_deletion": true, + "files": { + "Dockerfile": "fdc4026cc5e1301ffb6bdfd12f61c9d1591909ddf05501b43ef6ade47d01641f", + "vendor/flagsmith-python-client/LICENSE": "8e03f133aa0116cbaa12e291a64719fcdd973e3aa66fb268cd0576a739b08509", + "vendor/flagsmith-python-client/README.md": "74bb0378be050751579d2cedab7e8abac974dbc339584c02440eb6e65330132d", + "vendor/flagsmith-python-client/flagsmith/__init__.py": "cee1f064ad66a883d5d61ebfb69f02664f7eacf84b4715b7271cd9d4d5d7464d", + "vendor/flagsmith-python-client/flagsmith/analytics.py": "5c83eec8ece28fb49dbe76acc30dbe8e17b87adabd7fb117ecead8e8fb6be4e0", + "vendor/flagsmith-python-client/flagsmith/api/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/flagsmith-python-client/flagsmith/api/types.py": "e9af668aef60bb6358394aeca8c50cdf612f0a0f65ea5e8be95dffb0a8bf5611", + "vendor/flagsmith-python-client/flagsmith/exceptions.py": "c5e2c56d9af7f82fc7beb8233433337b2d00cf84a491749fca4c8fc5f85947ae", + "vendor/flagsmith-python-client/flagsmith/flagsmith.py": "15e594aab9f9692eb7b875f31f613b3f07bde167f6479b08e0fce4c7d8fe633e", + "vendor/flagsmith-python-client/flagsmith/mappers.py": "9446f87c29164a564b919e9d128c7d16f60116bd5fb5ec9f4201e959cb599f8d", + "vendor/flagsmith-python-client/flagsmith/models.py": "cb119662d5c2a99e638a299fcaccaac821e584c99a04af1bb0cafaa899a06e32", + "vendor/flagsmith-python-client/flagsmith/offline_handlers.py": "d92711b7e29c6c807ba21d38dd2391fe86e9934f684fe7d25077136af7edaa2e", + "vendor/flagsmith-python-client/flagsmith/polling_manager.py": "dc69362bbf6731b7cb1c6cbfab81ea40075ec442d21266dae9a28e01ca3329df", + "vendor/flagsmith-python-client/flagsmith/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/flagsmith-python-client/flagsmith/streaming_manager.py": "69bfc3466ca08e6b4ba88cb0377ff078232c3c27845b5907287c7c1a6b26d80d", + "vendor/flagsmith-python-client/flagsmith/types.py": "017ecf91ac92448b3bd05983da08e7c2800033e1412e2ab94982c38a1144f005", + "vendor/flagsmith-python-client/flagsmith/utils/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/flagsmith-python-client/flagsmith/utils/datetime.py": "41914f3d60c7feafb44ff4fec2c9c6f3937c4efebdb06f144e9eb5036b28d4f4", + "vendor/flagsmith-python-client/flagsmith/utils/identities.py": "228dacf8225359489ff00f4edff166fd9427a8804098911f0002ea2454aff159", + "vendor/flagsmith-python-client/flagsmith/version.py": "b1b9233d8135a15b87bca61498fda4b0b6bb81f80efa11c974e3a371da604a6c", + "vendor/flagsmith-python-client/flagsmith/webhooks.py": "73ea7085ef86aa85dafaf3dece3a7baa9e378c19a2d440874fc4c3921a3e924e", + "vendor/flagsmith-python-client/poetry.lock": "18eddf0b1fee75def133cd834712af8f21e2656cf7ce26a7d22910d238257778", + "vendor/flagsmith-python-client/pyproject.toml": "8c9cb5722355ab4cb3b99dc6f668eb1066ccfd07d95125fb7550c1c5bbe04e13", + "vendor/flagsmith-python-client/tests/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "vendor/flagsmith-python-client/tests/conftest.py": "60816156967c3d45712bd27ce836beac83c6add82fbf7a01292a7a4da54aabc9", + "vendor/flagsmith-python-client/tests/data/environment.json": "3bdb774d38c91bad6838d8cb72ead71460a585dc900d802919ab391b41812593", + "vendor/flagsmith-python-client/tests/data/flags.json": "6497029d67543ead96b7c2c3490985f0d753f42f50de55bc8fe0869d30a74314", + "vendor/flagsmith-python-client/tests/data/identities.json": "90d7dd9e74ffda21d0a4792653c2989abb440698dcbf73cd4a06c6d29fdaf418", + "vendor/flagsmith-python-client/tests/test_analytics.py": "bf1dc6e2f9ad058ca39650736dc04d52c863c9a146dffbe02b97708accae685e", + "vendor/flagsmith-python-client/tests/test_event_processor.py": "16bf7286c86f7354d2d4098c7ba3e9ee9d22a72a523d1ced731069ec39c1c47f", + "vendor/flagsmith-python-client/tests/test_flagsmith.py": "56338c8fea0a581b06422020aeb9535925483d56aae5a66e5abdfde48326ba42", + "vendor/flagsmith-python-client/tests/test_mappers.py": "fde0d803cd649d21890bc6114ed75fc254df28094107855457471e30e7a2c664", + "vendor/flagsmith-python-client/tests/test_models.py": "499070525db6a864110f5060e465a72faabfc008fb08ea42df8970e4a294abd7", + "vendor/flagsmith-python-client/tests/test_offline_handlers.py": "32bf070ef7db10d36f581d6cca21faa68d71c487ffdba9177535f6a5a89a9163", + "vendor/flagsmith-python-client/tests/test_polling_manager.py": "5533645bff4176dde85372059679f7e042db125bf4cee98a14a8e05fc5c91529", + "vendor/flagsmith-python-client/tests/test_streaming_manager.py": "5211df9e616899ea06513fa77371f79a2df68c481090e8497e64b1028aef2a6e", + "vendor/flagsmith-python-client/tests/test_webhooks.py": "563fc3eacb63f585c4539e029804a6bbe4307274927d24308a9e447728c672c7" + }, + "mutable": [ + "vendor/flagsmith-python-client/flagsmith/analytics.py", + "vendor/flagsmith-python-client/flagsmith/flagsmith.py" + ], + "schema_version": "tbench.pristine_env_manifest.v1" +} diff --git a/tasks/candidate-2163-operations-marketing/tests/fixtures/source_manifest.json b/tasks/candidate-2163-operations-marketing/tests/fixtures/source_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..99e623c87ef6585671059d309ad1caea761eab44 --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/tests/fixtures/source_manifest.json @@ -0,0 +1,262 @@ +{ + "schema_version": "tbench.material_manifest.v1", + "candidate_id": "candidate-2163-operations-marketing", + "frozen": true, + "files": [ + { + "path": "research/material/vendor/flagsmith-python-client/LICENSE", + "role": "license", + "source_index": 0, + "sha256": "8e03f133aa0116cbaa12e291a64719fcdd973e3aa66fb268cd0576a739b08509", + "bytes": 1476 + }, + { + "path": "research/material/vendor/flagsmith-python-client/README.md", + "role": "input", + "source_index": 0, + "sha256": "74bb0378be050751579d2cedab7e8abac974dbc339584c02440eb6e65330132d", + "bytes": 1003 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/__init__.py", + "role": "code", + "source_index": 0, + "sha256": "cee1f064ad66a883d5d61ebfb69f02664f7eacf84b4715b7271cd9d4d5d7464d", + "bytes": 244 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/analytics.py", + "role": "code", + "source_index": 0, + "sha256": "5c83eec8ece28fb49dbe76acc30dbe8e17b87adabd7fb117ecead8e8fb6be4e0", + "bytes": 8034 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/api/__init__.py", + "role": "code", + "source_index": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "bytes": 0 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/api/types.py", + "role": "code", + "source_index": 0, + "sha256": "e9af668aef60bb6358394aeca8c50cdf612f0a0f65ea5e8be95dffb0a8bf5611", + "bytes": 1841 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/exceptions.py", + "role": "code", + "source_index": 0, + "sha256": "c5e2c56d9af7f82fc7beb8233433337b2d00cf84a491749fca4c8fc5f85947ae", + "bytes": 180 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/flagsmith.py", + "role": "code", + "source_index": 0, + "sha256": "15e594aab9f9692eb7b875f31f613b3f07bde167f6479b08e0fce4c7d8fe633e", + "bytes": 24480 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/mappers.py", + "role": "code", + "source_index": 0, + "sha256": "9446f87c29164a564b919e9d128c7d16f60116bd5fb5ec9f4201e959cb599f8d", + "bytes": 9219 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/models.py", + "role": "code", + "source_index": 0, + "sha256": "cb119662d5c2a99e638a299fcaccaac821e584c99a04af1bb0cafaa899a06e32", + "bytes": 9932 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/offline_handlers.py", + "role": "code", + "source_index": 0, + "sha256": "d92711b7e29c6c807ba21d38dd2391fe86e9934f684fe7d25077136af7edaa2e", + "bytes": 1198 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/polling_manager.py", + "role": "code", + "source_index": 0, + "sha256": "dc69362bbf6731b7cb1c6cbfab81ea40075ec442d21266dae9a28e01ca3329df", + "bytes": 1055 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/py.typed", + "role": "input", + "source_index": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "bytes": 0 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/streaming_manager.py", + "role": "code", + "source_index": 0, + "sha256": "69bfc3466ca08e6b4ba88cb0377ff078232c3c27845b5907287c7c1a6b26d80d", + "bytes": 1609 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/types.py", + "role": "code", + "source_index": 0, + "sha256": "017ecf91ac92448b3bd05983da08e7c2800033e1412e2ab94982c38a1144f005", + "bytes": 1388 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/utils/__init__.py", + "role": "code", + "source_index": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "bytes": 0 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/utils/datetime.py", + "role": "code", + "source_index": 0, + "sha256": "41914f3d60c7feafb44ff4fec2c9c6f3937c4efebdb06f144e9eb5036b28d4f4", + "bytes": 187 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/utils/identities.py", + "role": "code", + "source_index": 0, + "sha256": "228dacf8225359489ff00f4edff166fd9427a8804098911f0002ea2454aff159", + "bytes": 856 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/version.py", + "role": "code", + "source_index": 0, + "sha256": "b1b9233d8135a15b87bca61498fda4b0b6bb81f80efa11c974e3a371da604a6c", + "bytes": 75 + }, + { + "path": "research/material/vendor/flagsmith-python-client/flagsmith/webhooks.py", + "role": "code", + "source_index": 0, + "sha256": "73ea7085ef86aa85dafaf3dece3a7baa9e378c19a2d440874fc4c3921a3e924e", + "bytes": 1368 + }, + { + "path": "research/material/vendor/flagsmith-python-client/poetry.lock", + "role": "input", + "source_index": 0, + "sha256": "18eddf0b1fee75def133cd834712af8f21e2656cf7ce26a7d22910d238257778", + "bytes": 118166 + }, + { + "path": "research/material/vendor/flagsmith-python-client/pyproject.toml", + "role": "input", + "source_index": 0, + "sha256": "8c9cb5722355ab4cb3b99dc6f668eb1066ccfd07d95125fb7550c1c5bbe04e13", + "bytes": 982 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/__init__.py", + "role": "code", + "source_index": 0, + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "bytes": 0 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/conftest.py", + "role": "code", + "source_index": 0, + "sha256": "60816156967c3d45712bd27ce836beac83c6add82fbf7a01292a7a4da54aabc9", + "bytes": 4536 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/data/environment.json", + "role": "input", + "source_index": 0, + "sha256": "3bdb774d38c91bad6838d8cb72ead71460a585dc900d802919ab391b41812593", + "bytes": 2724 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/data/flags.json", + "role": "input", + "source_index": 0, + "sha256": "6497029d67543ead96b7c2c3490985f0d753f42f50de55bc8fe0869d30a74314", + "bytes": 498 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/data/identities.json", + "role": "input", + "source_index": 0, + "sha256": "90d7dd9e74ffda21d0a4792653c2989abb440698dcbf73cd4a06c6d29fdaf418", + "bytes": 734 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_analytics.py", + "role": "code", + "source_index": 0, + "sha256": "bf1dc6e2f9ad058ca39650736dc04d52c863c9a146dffbe02b97708accae685e", + "bytes": 3040 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_event_processor.py", + "role": "code", + "source_index": 0, + "sha256": "16bf7286c86f7354d2d4098c7ba3e9ee9d22a72a523d1ced731069ec39c1c47f", + "bytes": 5002 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_flagsmith.py", + "role": "code", + "source_index": 0, + "sha256": "56338c8fea0a581b06422020aeb9535925483d56aae5a66e5abdfde48326ba42", + "bytes": 40212 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_mappers.py", + "role": "code", + "source_index": 0, + "sha256": "fde0d803cd649d21890bc6114ed75fc254df28094107855457471e30e7a2c664", + "bytes": 2000 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_models.py", + "role": "code", + "source_index": 0, + "sha256": "499070525db6a864110f5060e465a72faabfc008fb08ea42df8970e4a294abd7", + "bytes": 13223 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_offline_handlers.py", + "role": "code", + "source_index": 0, + "sha256": "32bf070ef7db10d36f581d6cca21faa68d71c487ffdba9177535f6a5a89a9163", + "bytes": 940 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_polling_manager.py", + "role": "code", + "source_index": 0, + "sha256": "5533645bff4176dde85372059679f7e042db125bf4cee98a14a8e05fc5c91529", + "bytes": 2535 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_streaming_manager.py", + "role": "code", + "source_index": 0, + "sha256": "5211df9e616899ea06513fa77371f79a2df68c481090e8497e64b1028aef2a6e", + "bytes": 2916 + }, + { + "path": "research/material/vendor/flagsmith-python-client/tests/test_webhooks.py", + "role": "code", + "source_index": 0, + "sha256": "563fc3eacb63f585c4539e029804a6bbe4307274927d24308a9e447728c672c7", + "bytes": 1256 + } + ], + "selection_log": [ + "Host froze 36 files (262909 bytes) from 1 pinned real source(s)." + ] +} diff --git a/tasks/candidate-2163-operations-marketing/tests/task_test.sh b/tasks/candidate-2163-operations-marketing/tests/task_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..dda0b28b730a3e3b26a251f9325a512facfed494 --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/tests/task_test.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu +mkdir -p /logs/verifier +# tbench-anti-hack-guard:v1 +export PYTHONNOUSERSITE=1 +export PYTHONDONTWRITEBYTECODE=1 +# Fail open when the verifier image has no python3 (node-only tests images are +# excluded from the RL set but still verifiable natively): a missing +# interpreter must not swallow the grader's own reward write. +if command -v python3 >/dev/null 2>&1 && [ -f /tests/anti_hack_guard.py ]; then + if ! python3 /tests/anti_hack_guard.py; then + # Guard already wrote reward=0; the reward file is the grading contract. + exit 0 + fi +fi + + +rm -f /logs/verifier/ctrf.json /logs/verifier/reward.txt +set +e +python3 -m pytest --ctrf /logs/verifier/ctrf.json -q /tests/test_outputs.py +status=$? +set -e +if [ "$status" -eq 0 ]; then + printf '1\n' > /logs/verifier/reward.txt +else + printf '0\n' > /logs/verifier/reward.txt +fi +exit "$status" diff --git a/tasks/candidate-2163-operations-marketing/tests/test.sh b/tasks/candidate-2163-operations-marketing/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..0438630bbf9fb716440f649d995d01adfc4a082c --- /dev/null +++ b/tasks/candidate-2163-operations-marketing/tests/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Terminal-Bench grading: the task's own test script (task_test.sh here) writes /logs/verifier/reward.txt. +# "-1" there is its crash sentinel: a testbed failure, so no reward is written (not scored). +CWD=/app +mkdir -p /logs/verifier +# the task's anti-hack guard rejects files planted in the workspace: drop what agent harnesses leave there +for d in .opencode .claude .codex .gemini .goose .aider.tags.cache.v4; do + grep -qx "$d" /var/lib/mimo/before 2>/dev/null || rm -rf "$CWD/$d" +done +cd "$CWD" && bash /tests/task_test.sh +R=$(cat /logs/verifier/reward.txt 2>/dev/null | tr -d '[:space:]') +if [ -z "$R" ] || [ "$R" = "-1" ]; then + rm -f /logs/verifier/reward.txt + echo "the tests crashed before grading (reward '${R}'): not scored" >&2 + exit 1 +fi