{"record":{"id":"8d1106dfac7f3041","repo":"Hmbown/CodeWhale","slug":"exact-library-measurement-test-test-name-ran-zero-tests","errorCode":null,"errorMessage":"exact library measurement test {TEST_NAME} ran zero tests","messagePattern":"exact library measurement test (.+?) ran zero tests","errorType":"exception","errorClass":"PersistenceBacklogMeasurementError","httpStatus":null,"severity":"error","filePath":"scripts/measure-persistence-backlog.py","lineNumber":71,"sourceCode":"\ndef run_measurement(receipt_path: Path, env: dict[str, str]) -> dict:\n    result = subprocess.run(\n        measurement_command(),\n        cwd=ROOT,\n        env=env,\n        text=True,\n        capture_output=True,\n        check=False,\n    )\n    sys.stderr.write(result.stderr)\n    if result.returncode != 0:\n        sys.stdout.write(result.stdout)\n        result.check_returncode()\n\n    combined = \"\\n\".join(result.stdout.splitlines() + result.stderr.splitlines())\n    if re.search(r\"\\brunning\\s+0\\s+tests?\\b\", combined):\n        sys.stdout.write(result.stdout)\n        raise PersistenceBacklogMeasurementError(\n            f\"exact library measurement test {TEST_NAME} ran zero tests\"\n        )\n    try:\n        return json.loads(receipt_path.read_text(encoding=\"utf-8\"))\n    except (OSError, json.JSONDecodeError) as error:\n        raise PersistenceBacklogMeasurementError(\n            f\"exact library measurement test {TEST_NAME} emitted no valid receipt: {error}\"\n        ) from error\n\n\ndef main() -> int:\n    source_sha = subprocess.run(\n        [\"git\", \"rev-parse\", \"HEAD\"],\n        cwd=ROOT,\n        text=True,\n        capture_output=True,\n        check=True,\n    ).stdout.strip()","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/measure-persistence-backlog.py#L53-L89","documentation":"measure-persistence-backlog.py runs an exact cargo test filter to produce a measurement receipt and refuses to accept a run in which zero tests executed (cargo exits 0 with a filter matching nothing). This guards against silently publishing an empty measurement.","triggerScenarios":"Running the script when TEST_NAME no longer matches any test — the test was renamed, moved, feature-gated off, or the filter string drifted.","commonSituations":"Refactors renaming the measurement test without updating the script; running with a toolchain or features that compile the test away; typo in the test path in the script.","solutions":["Verify the test exists: cargo test <TEST_NAME> -- --list and confirm it appears","Update TEST_NAME in scripts/measure-persistence-backlog.py to the current test path","Check the test is not behind a cfg/feature flag excluded from the default build"],"exampleFix":"// before (script)\nTEST_NAME = \"persistence::backlog_exact\"\n// after\nTEST_NAME = \"persistence::tests::backlog_exact\"","handlingStrategy":"validation","validationCode":"import subprocess\nout = subprocess.run([\"cargo\", \"test\", TEST_NAME, \"--\", \"--list\"], capture_output=True, text=True)\nassert out.stdout.strip(), \"test filter matches nothing; check TEST_NAME\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update TEST_NAME when renaming the measurement test","Run --list to confirm the filter before measuring","Watch for feature flags that exclude the test from the default build"],"tags":["python","testing","measurement"],"backgroundTag":"empty-result-set","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}