{"record":{"id":"8e3b872bf2d98fdb","repo":"Hmbown/CodeWhale","slug":"exact-library-measurement-test-test-name-emitted-no-valid","errorCode":null,"errorMessage":"exact library measurement test {TEST_NAME} emitted no valid receipt: {error}","messagePattern":"exact library measurement test (.+?) emitted no valid receipt: (.+?)","errorType":"exception","errorClass":"PersistenceBacklogMeasurementError","httpStatus":null,"severity":"error","filePath":"scripts/measure-persistence-backlog.py","lineNumber":77,"sourceCode":"        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()\n    source_dirty = bool(\n        subprocess.run(\n            [\"git\", \"status\", \"--porcelain\", \"--untracked-files=normal\"],\n            cwd=ROOT,\n            text=True,\n            capture_output=True,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/measure-persistence-backlog.py#L59-L95","documentation":"After the test run, the script reads the receipt JSON file the test is supposed to write and wraps any failure to find or parse it into PersistenceBacklogMeasurementError, chaining the underlying OSError or JSONDecodeError. It means the test ran but produced no readable, valid receipt.","triggerScenarios":"The receipt file was not written (test didn't reach the write, wrong cwd, no permission), the path is stale, or the file contains invalid/truncated JSON.","commonSituations":"Test failed mid-run after the harness reported started; running the script from a different working directory than the receipt path expects; a previous crash left a corrupt receipt; disk-full or permission issues.","solutions":["Run the exact test (cargo test <TEST_NAME>) directly and check whether it writes the receipt and where","Delete the stale/corrupt receipt and re-run so the test writes it fresh","Fix filesystem issues: correct working directory, write permissions, free disk space","If the JSON is malformed, fix the test's receipt-serialization code"],"exampleFix":"// before (read)\nreceipt_path = Path(\"receipt.json\")  # stale from previous run\n// after\nreceipt_path.unlink(missing_ok=True)  # then re-run so the test writes a fresh receipt","handlingStrategy":"try-catch","validationCode":"receipt = Path(\"receipt.json\")\nreceipt.unlink(missing_ok=True)\n# after running the test:\nassert receipt.exists() and receipt.stat().st_size > 0\njson.loads(receipt.read_text(encoding=\"utf-8\"))","typeGuard":null,"tryCatchPattern":"try:\n    receipt = run_measurement()\nexcept PersistenceBacklogMeasurementError as e:\n    log.error(\"measurement receipt missing/invalid: %s\", e)","preventionTips":["Delete stale receipts before each measurement run","Run the script from its expected working directory","Validate the receipt JSON schema in the test itself before writing"],"tags":["python","testing","json"],"backgroundTag":"invalid-json-response","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"}