{"record":{"id":"8d1106dfac7f3041","repo":"Hmbown/CodeWhale","slug":"exact-library-measurement-test-test-name-ran-zer","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":64,"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":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/measure-persistence-backlog.py#L46-L82","documentation":"measure-persistence-backlog.py runs exactly one ignored cargo test ('cargo test --locked -p codewhale-tui --lib <TEST_NAME> -- --exact --ignored --test-threads=1') and scans combined stdout/stderr for libtest's 'running 0 tests'. Zero executed tests means the receipt cannot be trusted, so the script aborts before reading it. Typical causes: the test was renamed or moved, its #[ignore] attribute was removed (so the --ignored filter excludes it), or it is feature/cfg-gated off.","triggerScenarios":"TEST_NAME 'tui::persistence_actor::backlog_measurement_tests::write_paused_persistence_backlog_measurement_receipt' no longer matches a test path (module renamed persistence_actor -> persistence); #[ignore] removed so --ignored filters the test out; backlog_measurement_tests moved behind a non-default cfg.","commonSituations":"Renaming tui::persistence_actor during refactors; well-meaning removal of #[ignore] to run it with the suite; feature reorganization in codewhale-tui.","solutions":["Keep the test at tui::persistence_actor::backlog_measurement_tests::write_paused_persistence_backlog_measurement_receipt with #[ignore] - the script opts in via --ignored","If renamed, update TEST_NAME in scripts/measure-persistence-backlog.py:21-24 in the same commit","Reproduce the selection and confirm 'running 1 test': 'cargo test --locked -p codewhale-tui --lib <TEST_NAME> -- --exact --ignored --test-threads=1'"],"exampleFix":"// before (crates/tui/src/persistence_actor.rs)\n#[test]\nfn write_paused_persistence_backlog_measurement_receipt() { /* #[ignore] removed */ }\n\n// after\n#[test]\n#[ignore = \"measurement: run via scripts/measure-persistence-backlog.py\"]\nfn write_paused_persistence_backlog_measurement_receipt() { /* ... */ }","handlingStrategy":"validation","validationCode":"import re, subprocess\nout = subprocess.run([\"cargo\", \"test\", \"--locked\", \"-p\", \"codewhale-tui\", \"--lib\", TEST_NAME, \"--\", \"--exact\", \"--ignored\", \"--list\"], capture_output=True, text=True)\nassert TEST_NAME.split(\"::\")[-1] in out.stdout, \"measurement test not selected - renamed or un-ignored?\"","typeGuard":"def is_backlog_measurement_error(exc: BaseException) -> bool:\n    return isinstance(exc, RuntimeError) and type(exc).__name__ == \"PersistenceBacklogMeasurementError\"","tryCatchPattern":"try:\n    receipt = run_measurement(receipt_path, env)\nexcept PersistenceBacklogMeasurementError as error:\n    sys.stderr.write(f\"invalid persistence backlog receipt: {error}\\n\")\n    return 1","preventionTips":["Keep the measurement test's module path and name stable; update TEST_NAME in the script in the same commit","Keep #[ignore] on the test - the script opts in with --ignored","Run 'cargo test -p codewhale-tui --lib <name> -- --exact --ignored' after any persistence_actor refactor and expect 'running 1 test'"],"tags":["python","ci","rust","cargo-test","measurement"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}