{"record":{"id":"cc99b37b5b3903dc","repo":"headroomlabs-ai/headroom","slug":"wheel-name-metadata-missing-expected-line-r","errorCode":null,"errorMessage":"{wheel.name} metadata missing {expected_line!r}","messagePattern":"(.+?) metadata missing (.+?)","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"scripts/build_python_release_smoke.py","lineNumber":115,"sourceCode":"        native_members = [\n            name\n            for name in names\n            if name.startswith(\"headroom/_core\") and Path(name).suffix.lower() in {\".pyd\", \".so\"}\n        ]\n        if not native_members:\n            raise SystemExit(f\"{wheel.name} does not contain headroom/_core native extension\")\n\n        metadata_members = [name for name in names if name.endswith(\".dist-info/METADATA\")]\n        if len(metadata_members) != 1:\n            raise SystemExit(\n                f\"{wheel.name} should contain exactly one dist-info/METADATA, \"\n                f\"found {len(metadata_members)}\"\n            )\n        metadata = archive.read(metadata_members[0]).decode(\"utf-8\")\n\n    expected_line = f\"Version: {expected_version}\"\n    if expected_line not in metadata.splitlines():\n        raise SystemExit(f\"{wheel.name} metadata missing {expected_line!r}\")\n\n    print(f\"wheel metadata OK: {wheel.name} contains {native_members[0]}\")\n\n\ndef verify_sdist_license_files(sdist: Path) -> None:\n    with tarfile.open(sdist, \"r:gz\") as archive:\n        names = set(archive.getnames())\n        roots = {name.split(\"/\", 1)[0] for name in names if \"/\" in name}\n        if len(roots) != 1:\n            raise SystemExit(f\"expected one sdist root directory, found {sorted(roots)}\")\n        root = roots.pop()\n\n        pkg_info_path = f\"{root}/PKG-INFO\"\n        member = archive.getmember(pkg_info_path)\n        fh = archive.extractfile(member)\n        if fh is None:\n            raise SystemExit(f\"could not read {pkg_info_path} from {sdist.name}\")\n        pkg_info = fh.read().decode(\"utf-8\")","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/scripts/build_python_release_smoke.py#L97-L133","documentation":"verify_wheel() reads the wheel's METADATA and requires a `Version: <expected_version>` line matching the version the smoke test was invoked with. A mismatch means the wheel being verified was built from a different version of the source than the one being released.","triggerScenarios":"Bumping the version in pyproject.toml after the wheel was built (stale wheel in out_dir); passing a different version argument to the smoke script than the one maturin stamped; dynamic version from Cargo.toml diverging from the expected version.","commonSituations":"See trigger scenarios.","solutions":["Check the actual version: `unzip -p file.whl '*/METADATA' | grep ^Version`.","Re-run the version bump (or verify-versions.py) and rebuild into a fresh out_dir so the wheel carries the current version.","If the version is dynamic from Cargo.toml, make sure Cargo.toml `version` and pyproject/Cargo `version` agree before building."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import zipfile\n\ndef wheel_version(wheel_path: str) -> str | None:\n    with zipfile.ZipFile(wheel_path) as z:\n        meta = next(n for n in z.namelist() if n.endswith(\".dist-info/METADATA\"))\n        for line in z.read(meta).decode().splitlines():\n            if line.startswith(\"Version:\"):\n                return line.split(\":\", 1)[1].strip()\n    return None\n# assert wheel_version(w) == expected_version before running the smoke","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run verify-versions.py before building so every input agrees on the version.","Bump the version once, then build once, then verify — never interleave.","Keep dynamic version sources (Cargo.toml) in sync with pyproject."],"tags":["python","wheel","version","release"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}