Skip to content

Official Codebase of 3DCodeVerse

Python

tests: the offline suite goes parallel, and loses its 30-second floor

gaoypenge4f4ed1d2eb1
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.md
index 476c5051..b0178a4b 100644
--- a/harness/CLAUDE.md
+++ b/harness/CLAUDE.md
@@ -28,7 +28,9 @@ score-vs-complexity corpus study) before changing anything.
3. Deterministic gates/measurements run by the harness; VLM only for perception.
Score is computed in code from rubric weights; caps/floors are explicit.
4. Typed everything; no regex-on-id control flow; a file may be long but not a god file —
- hard cap **1 500 lines** per file (owner's rule, 2026-08-26; the old ~400-line guideline is gone).
+ cap **2 000 lines** per file, **3 000** absolute (owner, 2026-08-28; was 1 500, and the old
+ ~400-line guideline is long gone). Merging is NOT a goal in itself — a merge must DELETE
+ code, not just move it between files.
5. Cheap first: lint → build → gates → montaged views → VLM. Budgets are hard.
6. Every round = a git commit of `src/`; every call = a `Usage`; every run = `record.json`.
7. No wrapper re-centres or grounds the object: export **as authored**, warn in the
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index 1f63ec1f..efc0df2b 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -51,7 +51,8 @@ the flywheel unit.
5. **Evidence-based acceptance.** Every plan carries an acceptance checklist;
items are proved by measurements/probes/judge votes, not prose.
6. **Typed everything.** One contracts package; no regex-on-id control flow, no
- stringly-typed dicts, no god files (hard cap 1 500 lines per file; owner's rule 2026-08-26).
+ stringly-typed dicts, no god files (cap 2 000 lines per file, 3 000 absolute; owner 2026-08-28).
+ A merge must delete code, not merely move it.
7. **Cheap first.** Lint → build → deterministic gates → montaged views → VLM.
8. **Separate generator from judge.** The judge sees spec + renders +
measurements + acceptance list; never the generator's reasoning.
@@ -439,7 +440,7 @@ $0.02–0.03 (flash) / ~$0.2 (pro); api-agent generation 3–6 min per object ro
* Gemini flash 503 storms happen; dead keys and 429s rotate freely now, but a
sustained outage can still fail a round (`3dcv resume` re-uses cached stages).
* `ffmpeg` absent here → turntables fall back to GIF. A few single-file wrappers
- were once over the old ~400-line guideline; the rule is now a 1 500-line cap.
+ were once over the old ~400-line guideline; the rule is now a 2 000-line cap (3 000 absolute).
## 11. Flywheel
diff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.md
index 52d3b0f6..b5b886f1 100644
--- a/harness/docs/DECISIONS.md
+++ b/harness/docs/DECISIONS.md
@@ -16,7 +16,7 @@ written) that were accepted because the code works that way and the tests pin it
`check_contract` converts to the GLB frame (Y-up) using `LANGUAGE_FRAME`.
* **L3 Deterministic first, VLM for perception only.** Score is computed in code
from rubric weights; floors and caps are explicit; degraded verdicts are glitches.
-* **L4 Typed, no regex-on-id, no god files.** Files ≤ 1 500 lines (owner, 2026-08-26 — was ~400); two wrappers
+* **L4 Typed, no regex-on-id, no god files.** Files ≤ 2 000 lines, 3 000 absolute (owner, 2026-08-28 — was 1 500, before that ~400); two wrappers
exceed it by design (`run_bpy.py` 418, `scene_host.mjs` 426).
* **L5 Cheap first.** Lint → build → gates → montaged views → VLM. `build` tool
skips the build when lint has ERRORs.
diff --git a/harness/pyproject.toml b/harness/pyproject.toml
index 29639481..365a5776 100644
--- a/harness/pyproject.toml
+++ b/harness/pyproject.toml
@@ -45,7 +45,7 @@ mesh = ["shapely>=2.0", "networkx>=3.2", "manifold3d>=2.3"] # cross_section are
mcp = ["mcp>=1.0"] # `3dcv mcp` spatial-tool server for the agentic CLIs
flywheel = ["pyarrow>=15"] # `3dcv flywheel export --pack` (parquet)
all = ["3dcodeverse[cad,urdf,graphics,mesh,mcp,flywheel]"]
-dev = ["pytest>=8", "pytest-timeout>=2.3", "ruff>=0.5", "pyarrow>=15",
+dev = ["pytest>=8", "pytest-timeout>=2.3", "pytest-xdist>=3.6", "ruff>=0.5", "pyarrow>=15",
# the Agent Skills reference validator (CLI: `agentskills`). Pure python,
# click + strictyaml. tests/skills/test_spec_compliance.py runs it over every
# bundle and skips cleanly when it is absent, so it is dev-only on purpose:
@@ -89,7 +89,10 @@ timeout = 600
# that happens to have API keys configured fires real requests, and during a provider
# outage it hangs instead of failing — which is exactly what happened on 2026-08-24.
# Everyone's default run is the offline suite (run locally before every push; there is no CI).
-addopts = ["-m", "not live"]
+# -n auto: the offline suite is ~2 800 mostly-independent tests and this box has 24
+# cores — serial it is ~3 min, parallel ~15 s. -p no:randomly is NOT set: xdist
+# distributes by file, and every test that touches shared state already uses tmp_path.
+addopts = ["-m", "not live", "-n", "auto", "--dist", "loadfile"]
markers = [
"live: needs network + API keys (deselect with -m 'not live')",
"blender: needs a Blender binary",
diff --git a/harness/tests/core/test_file_length.py b/harness/tests/core/test_file_length.py
index 6f3c77be..cff49ece 100644
--- a/harness/tests/core/test_file_length.py
+++ b/harness/tests/core/test_file_length.py
@@ -1,9 +1,11 @@
-"""The 1 500-line hard cap (law 4, owner's rule 2026-08-26).
-
-A file may be long, but not a god file: every tracked hand-written source file
-stays under 1 500 lines. There is no soft threshold and no ~400-line guideline
-— the owner rejected both; this single automated cap is the whole rule.
-Largest file when this landed: bench/ab_plan.py at 781 lines.
+"""The 2 000-line cap (law 4, owner 2026-08-28; 3 000 is the absolute ceiling).
+
+A file may be long, but not a god file. There is no soft threshold and no
+~400-line guideline — the owner rejected both; this single automated cap is the
+whole rule, and it was raised from 1 500 to 2 000 on 2026-08-28 along with the
+other half of the rule, which no test can check: merging files is not a goal in
+itself, so a merge has to DELETE code rather than move it.
+Largest file when the cap was raised: codeverse/orchestrator.py at 1 132 lines.
"""
from __future__ import annotations
@@ -11,7 +13,7 @@ from __future__ import annotations
import subprocess
from pathlib import Path
-HARD_CAP = 1500
+HARD_CAP = 2000
SUFFIXES = {".py", ".js", ".mjs", ".cjs"}
EXCLUDE_PARTS = {"node_modules", "vendor"}
diff --git a/harness/tests/install/test_hermetic.py b/harness/tests/install/test_hermetic.py
index 45669328..cd036e0b 100644
--- a/harness/tests/install/test_hermetic.py
+++ b/harness/tests/install/test_hermetic.py
@@ -35,7 +35,8 @@ def test_passes_with_no_api_keys_in_the_environment(nodeid: str, tmp_path: Path)
env["HOME"] = str(tmp_path) # no ~/.config/astra3d/gemini_keys.env either
env["PYTHONPATH"] = str(HARNESS)
- r = subprocess.run([sys.executable, "-m", "pytest", nodeid, "-q", "-p", "no:cacheprovider"],
+ # -n0: the suite's addopts turn xdist ON, and a nested run must not fork 24 more workers
+ r = subprocess.run([sys.executable, "-m", "pytest", nodeid, "-q", "-n0", "-p", "no:cacheprovider"],
cwd=HARNESS, env=env, capture_output=True, text=True, timeout=300)
assert r.returncode == 0, f"{nodeid} needs credentials:\n{r.stdout[-3000:]}\n{r.stderr[-2000:]}"
@@ -49,7 +50,7 @@ _COUNT = re.compile(r"(\d{3,6})\s+(?:passed|selected)|out of the (\d{3,6})")
def _collected() -> int:
"""How many tests the suite actually has (the ceiling for any quoted count)."""
- r = subprocess.run([sys.executable, "-m", "pytest", "tests", "--collect-only", "-q",
+ r = subprocess.run([sys.executable, "-m", "pytest", "tests", "--collect-only", "-q", "-n0",
"-p", "no:cacheprovider"], cwd=HARNESS, capture_output=True, text=True, timeout=300)
m = re.search(r"(\d+)\s*/\s*(\d+) tests collected", r.stdout) or re.search(r"(\d+) tests collected", r.stdout)
assert m, r.stdout[-2000:]
diff --git a/harness/tests/models/test_gemini_scheduling.py b/harness/tests/models/test_gemini_scheduling.py
index 49033c2d..5c12ab52 100644
--- a/harness/tests/models/test_gemini_scheduling.py
+++ b/harness/tests/models/test_gemini_scheduling.py
@@ -101,7 +101,10 @@ def test_shared_pool_takes_its_defaults_from_settings():
# ----------------------------------------------------------------- storm gate
def test_a_503_closes_the_shared_gate_and_the_call_still_succeeds():
- gate = StormGate("test", base_delay=0.0, max_wait_s=0.0)
+ # probe_lease_s=0: the free rotation re-enters the gate, so this thread takes the
+ # probe slot and would then park on its OWN 30 s lease until the retry deadline —
+ # 30 s of wall clock for a test about whether the call survives the storm.
+ gate = StormGate("test", base_delay=0.0, max_wait_s=0.0, probe_lease_s=0.0)
pool = KeyPool(["k1", "k2"], cooldown_s=0.0)
# a 503 is per key at any instant (retry.py docstring, measured 2026-08-26): the first
# one rotates to k2 for free; only k2's 503 — no untried key left in this 2-key pool —