mixle.reproduction module

Installed, fail-closed reproduction receipt for Mixle’s release claims.

installed_content_provenance()[source]

Digest the installed distribution’s RECORD identities and verify hashed files.

Return type:

dict[str, Any]

wheel_provenance(path, *, expected_commit=None, expected_content_sha256=None)[source]

Verify a Mixle wheel’s identity, RECORD self-consistency, and provenance record shape.

VERIFIED, fail-closed. A wheel that cannot be identified at all raises ValueError (unreadable archive, wrong METADATA/provenance member count, name/version differing from the installed distribution, ill-shaped or dirty provenance record). Every check past identification lands in the returned problems list instead, and any entry makes verified False – a tampered-but-identifiable wheel gets a receipt naming the tampering rather than no receipt:

  • RECORD self-consistency: every hashed RECORD claim is recomputed from the archived member it names, every member must be claimed, duplicate and root-escaping names are refused, and exactly one unhashed self-referencing RECORD row is allowed. This is _wheel_record_hashes, the same check subject_binding builds on.

  • expected_commit= / expected_content_sha256=, when given, are compared against the record’s source_commit / source_content_sha256 (case-insensitively).

NOT verified, stated so this record cannot be presented as more than it is:

  • Provenance field VALUES are shape-validated only: a well-formed but false source_commit/source_tree/source_content_sha256 – 40 zeros is a valid shape – passes unless the caller supplies the matching expected_* argument.

  • RECORD self-consistency proves the archive matches its own manifest, not that the manifest is the released one: a wheel rebuilt with an internally consistent RECORD, including an extra module listed with a correct hash, still self-verifies here. Binding to the bytes that actually execute is subject_binding’s job, and build_receipt ANDs the two verdicts.

  • The reported wheel sha256 is an identity for external comparison, not a check.

source_content_sha256 is one key name over two populations (T3-05). The digest covers whatever tree the build ran from, and the sibling fields source_content_file_count / source_content_universe declare that population: a wheel built from a git checkout – and an sdist’s embedded copy of this record – digest the full checkout (~2,000 files), while a wheel built from an unpacked sdist digests only the packaged subset (~800 files). Two records disagreeing on this key while their file counts differ is therefore a POPULATION difference, not tampering. The cross-artifact check is the sdist record’s sdist_content_sha256: the digest of the packaged subset, present in every sdist-embedded record (and carried into wheels whose record was adopted through the sdist, beside source_content_carried_through_sdist), which equals the source_content_sha256 a wheel built from that sdist derives for itself. expected_content_sha256 is compared against THIS record’s declared population, so draw the expectation from the same universe the record names.

Parameters:
  • path (Path)

  • expected_commit (str | None)

  • expected_content_sha256 (str | None)

Return type:

dict[str, Any]

subject_binding(path, build)[source]

Bind the receipt’s SUBJECT wheel to the distribution that is actually executing.

Name/version equality is not identity: any clean mixle==X wheel matches the installed version string, so the adversarial review presented an older 0.8.0 wheel as the subject while a newer 0.8.0 build executed, and the receipt reported passed for bytes that never ran (SYS-RR7-3). Two comparisons close that: the installed package’s embedded build provenance must equal the subject wheel’s (source commit, tree, and content digest), and every hashed entry in the subject wheel’s RECORD must appear in the installed RECORD with the same digest. The installed RECORD may carry extra installer-written files (INSTALLER, direct_url.json); the wheel’s own entries are the code, and those are what must match.

Parameters:
Return type:

dict[str, Any]

source_tree_provenance()[source]

Identify an explicitly requested development checkout by its own repository root.

Return type:

dict[str, Any]

claim_checks()[source]

Run deterministic, seeded measurements backing the release claims.

Return type:

dict[str, Any]

evaluate_claims(observed)[source]

Bind every observed measurement to a required value/tolerance and pass state.

Parameters:

observed (object)

Return type:

dict[str, dict[str, Any]]

build_receipt(*, wheel, allow_source_tree)[source]

Build a versioned receipt and its overall fail-closed verdict.

Parameters:
  • wheel (Path | None)

  • allow_source_tree (bool)

Return type:

tuple[dict[str, Any], bool]