Hmbown/CodeWhale · error · PersistenceBacklogMeasurementError

exact library measurement test

Error message

exact library measurement test {TEST_NAME} ran zero tests

What it means

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.

Solutions

  1. Verify the test exists: cargo test <TEST_NAME> -- --list and confirm it appears
  2. Update TEST_NAME in scripts/measure-persistence-backlog.py to the current test path
  3. Check the test is not behind a cfg/feature flag excluded from the default build

Example fix

// before (script)
TEST_NAME = "persistence::backlog_exact"
// after
TEST_NAME = "persistence::tests::backlog_exact"
Defensive patterns

Strategy: validation

Validate before calling

import subprocess
out = subprocess.run(["cargo", "test", TEST_NAME, "--", "--list"], capture_output=True, text=True)
assert out.stdout.strip(), "test filter matches nothing; check TEST_NAME"

Prevention

When it happens

Trigger: Running the script when TEST_NAME no longer matches any test — the test was renamed, moved, feature-gated off, or the filter string drifted.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/8d1106dfac7f3041. Report an issue: GitHub.

Appendix: source

Thrown at scripts/measure-persistence-backlog.py:71

def run_measurement(receipt_path: Path, env: dict[str, str]) -> dict:
    result = subprocess.run(
        measurement_command(),
        cwd=ROOT,
        env=env,
        text=True,
        capture_output=True,
        check=False,
    )
    sys.stderr.write(result.stderr)
    if result.returncode != 0:
        sys.stdout.write(result.stdout)
        result.check_returncode()

    combined = "\n".join(result.stdout.splitlines() + result.stderr.splitlines())
    if re.search(r"\brunning\s+0\s+tests?\b", combined):
        sys.stdout.write(result.stdout)
        raise PersistenceBacklogMeasurementError(
            f"exact library measurement test {TEST_NAME} ran zero tests"
        )
    try:
        return json.loads(receipt_path.read_text(encoding="utf-8"))
    except (OSError, json.JSONDecodeError) as error:
        raise PersistenceBacklogMeasurementError(
            f"exact library measurement test {TEST_NAME} emitted no valid receipt: {error}"
        ) from error


def main() -> int:
    source_sha = subprocess.run(
        ["git", "rev-parse", "HEAD"],
        cwd=ROOT,
        text=True,
        capture_output=True,
        check=True,
    ).stdout.strip()

View on GitHub (pinned to 433685b202)