Skip to content

Official Codebase of 3DCodeVerse

Python

probes: a harness_failure finding IS a driver failure, for every caller

ziyao5ed5a35bacc3
diff --git a/harness/codeverse/spatial/probes.py b/harness/codeverse/spatial/probes.py
index 1b6d69d8..2ce2b3f7 100644
--- a/harness/codeverse/spatial/probes.py
+++ b/harness/codeverse/spatial/probes.py
@@ -51,10 +51,18 @@ class SceneProbeResult(BaseModel):
def _result(gate: GateReport, census: dict[str, Any], *, driver_failure: str = "") -> SceneProbeResult:
+ """A ``harness_failure`` finding IS a driver failure, wherever it was raised.
+
+ ``ok`` is "the tool could run" (``registry.Observation.failed = not ok``) and the
+ agent-facing ``findings`` deliberately exclude harness failures — so a report that
+ carries one and nothing else used to come back ok, with no errors and no findings: a
+ probe that reads healthy and measured nothing. Deriving it here means every caller
+ gets the rule, not only the one that remembers to pass ``driver_failure``."""
+ harness = [f.message for f in gate.findings if f.data.get("harness_failure")]
lines = [f"[{f.severity.value}] {f.target or ''}: {f.message}" for f in gate.findings
if f.severity != Severity.INFO and not f.data.get("harness_failure")]
- return SceneProbeResult(gate=gate, census=census, ok=not driver_failure,
- errors=[driver_failure] if driver_failure else [], findings=lines)
+ errors = [driver_failure] if driver_failure else harness
+ return SceneProbeResult(gate=gate, census=census, ok=not errors, errors=errors, findings=lines)
def _f(gate: str, sev: Severity, msg: str, *, target: str | None = None, hint: str = "", **data: Any) -> GateFinding:
diff --git a/harness/tests/scene_gates/test_software_fps.py b/harness/tests/scene_gates/test_software_fps.py
index 20a57fef..206c19cc 100644
--- a/harness/tests/scene_gates/test_software_fps.py
+++ b/harness/tests/scene_gates/test_software_fps.py
@@ -100,3 +100,28 @@ def test_a_probe_with_no_boot_record_is_a_harness_failure_not_a_verdict() -> Non
# a REAL boot failure still reads as one, with its stage
real, _ = probe_report({"boot": {"ok": False, "stage": "createScene", "error": "TypeError: x"}})
assert not real.passed and "[createScene] TypeError: x" in real.findings[0].message
+
+
+def test_a_harness_failure_finding_makes_the_probe_result_not_ok() -> None:
+ """`SceneProbeResult.ok` is "the tool could run" (`Observation.failed = not ok`), and
+ the agent-facing `findings` deliberately exclude harness failures. A report carrying
+ one and nothing else therefore used to come back ok / no errors / no findings — a probe
+ that reads healthy and measured nothing, the exact shape that let desert_canyon's lost
+ output pass as a verdict about the scene."""
+ from codeverse.contracts.artifacts import GateFinding, GateReport, Severity
+ from codeverse.spatial.probes import _result
+
+ harness = GateReport(gate="scene_probe", passed=False, findings=[GateFinding(
+ gate="scene_probe", severity=Severity.ERROR, target="src/scene.js",
+ message="scene probe produced no result (driver output lost)",
+ fix_hint="retry or report", data={"harness_failure": True})])
+ r = _result(harness, {})
+ assert r.ok is False
+ assert r.errors == ["scene probe produced no result (driver output lost)"]
+ assert r.findings == [], "a harness failure is never handed to the agent as a defect"
+
+ real = GateReport(gate="scene_probe", passed=False, findings=[GateFinding(
+ gate="scene_probe", severity=Severity.ERROR, target="src/scene.js",
+ message="[createScene] TypeError: x is not a function", fix_hint="fix it")])
+ r2 = _result(real, {"totals": {}})
+ assert r2.ok is True and r2.errors == [] and len(r2.findings) == 1