Dashboard › institutional-transition-lab › Distillation
e846fa8e-a381-47d4-8025-30f49cc1f063["lore_tm_v1_9ogGqtflgAm65FoQiEhimVVqlkFHAj_c9LtqzN-mFP4","lore_tm_v1_RMkdUduRKWZz_cH_yp-uLaEWwxbMkPeChKBrNkfihBo","lore_tm_v1_fJmPqibxiKBfBi3k4EfUCD0YaqD8Fl7x9rszOCRO9zY","lore_tm_v1_CaH-ZRxgQKfrN70PVC3zgRn0W8N0y9sBFg1y9tQN4GU","lore_tm_v1_yQqBN2TjaszREl-wunF0GWfwstaelWawSaK2Ot8fTyg","lore_tm_v1__NkAEahNkhAUzyLWQC63ee5huvlmI3EFz2V7wv5EivU","lore_tm_v1_ZzaW7xSz-Ph9qcAmbEb-wWHWRw2mmvv7nK2XJY4iEAo"]
Date: Sep 9, 2026
3 0o600 0 0x0 20 20./home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py, including archive construction, input-pin checks, artifact-member verification, duplicate-member rejection, excessive-member-count rejection, and committed artifact verification.tests/test_governance_adjudication.py defines ROOT = Path(__file__).parents[1] and MAX_TEST_ARCHIVE_MEMBERS = 256._write_pinned_cli_inputs() creates adjudication.json, inputs.json, documents.json, coding-package.json, artifact.zip, protocol.md, coding-schema.json, adjudication-schema.json, summary.json, and summary.md; artifact.zip contains documents.json and v1.2-adjudication-package.json._write_pinned_cli_inputs() uses workflow_run_id=33063470968 and artifact_id=9642983578, computes artifact/document/package/protocol/schema hashes, writes the manifest to inputs.json, monkeypatches governance_adjudication.FROZEN_INPUT_PINS, and returns (manifest, paths)._run_cli() constructs sys.argv for institution-lab-governance-adjudication with required flags --adjudication, --input-manifest, --documents, --coding-package, --artifact, --protocol, --coding-schema, --adjudication-schema, --summary-json, and --summary-markdown, then invokes governance_adjudication.main()._stub_cli_validation() replaces validate_against_schema with a no-error result, validate_adjudication with ([], {"canonicalization_gate": "open"}), and render_markdown with "gate: open\n".test_every_input_pin_is_reverified changes adjudication["inputs"]["artifact_sha256"] to "wrong" and expects "input pin mismatch: artifact_sha256" plus a closed canonicalization gate.test_frozen_pins_include_the_versioned_adjudication_schema requires set(FROZEN_INPUT_PINS) == REQUIRED_INPUT_PINS and pins adjudication_schema_sha256 to 6181f5cb60a0462f83be00be301763daa89f11581e68ee1c46a84e8bf4e5be31.test_input_manifest_rejects_self_consistent_substitute is parameterized over every sorted field in FROZEN_INPUT_PINS; it mutates integer pins by +1 and string pins to "f" * 64, expecting verify_input_manifest() to raise an error matching frozen issue #4 input: {field}.test_frozen_input_identifiers_are_reverified is parameterized over workflow_run_id and artifact_id; incrementing either adjudication input must yield input pin mismatch: {field} and close the canonicalization gate.test_input_manifest_rejects_changed_file_bytes alters documents.json after recording documents_file_sha256 and expects verify_input_manifest() to raise a documents_file_sha256 mismatch.test_input_manifest_rejects_files_not_from_pinned_artifact creates an artifact whose documents.json bytes differ from the durable file and expects ValueError("artifact member mismatch: documents.json").test_cli_validates_the_same_bytes_it_verifies attempts a file-swap around verify_input_manifest; forged documents contain {"documents": [{"record_id": "forged"}]}, and the test expects ValueError("input manifest mismatch: documents_file_sha256").test_cli_rejects_output_aliases_to_frozen_inputs covers 8 inputsβadjudication, input_manifest, documents, coding_package, artifact, protocol, coding_schema, and adjudication_schemaβacross 3 alias types: direct, symlink, and hardlink; each must raise "output path aliases an input" and leave the input bytes unchanged.test_cli_rejects_aliased_outputs points summary_markdown at summary_json and expects "output paths alias each other".test_cli_rejects_duplicate_manifest_keys injects a duplicate artifact_sha256 key with forged value "forged", expects "duplicate JSON key: artifact_sha256", and verifies an existing summary.json is changed from an open to a closed canonicalization gate.test_input_manifest_rejects_non_object passes [] to verify_input_manifest() and expects "input manifest must be an object".test_input_manifest_rejects_duplicate_artifact_members appends a second documents.json, updates artifact_sha256 and patched frozen pins, and expects "artifact member is not unique: documents.json".test_input_manifest_rejects_excessive_artifact_member_count appends exactly 256 empty entries named padding/{index} to an archive already containing 2 required members and expects "artifact member count exceeds limit".test_regular_file_reader_rejects_fifo_without_blocking creates input.fifo, invokes _read_regular_file() in a subprocess with timeout=1, and requires a nonzero return code with "input path is not a regular file" in stderr.test_canonical_sha256_rejects_non_finite_numbers covers float("nan"), float("inf"), and float("-inf"), each expected to raise "Out of range float values".test_committed_frozen_input_manifest_verifies verifies cases/review/oss-governance-adjudication-v1.inputs.json against artifact-9642983578.zip, documents.json, v1.2-coding-package.json, research/oss-governance-coding-protocol-v1.2.md, schema/governance-coding-v1.schema.json, and schema/governance-adjudication-v1.schema.json, then requires the result to equal FROZEN_INPUT_PINS./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py.src/institution_lab/governance_adjudication.py defines limits MAX_INPUT_BYTES = 16 * 1024 * 1024, MAX_ARTIFACT_BYTES = 32 * 1024 * 1024, MAX_ARCHIVE_MEMBERS = 128, MAX_ARCHIVE_MEMBER_BYTES = 16 * 1024 * 1024, and MAX_ARCHIVE_EXPANDED_BYTES = 64 * 1024 * 1024.FROZEN_INPUT_PINS in src/institution_lab/governance_adjudication.py contains workflow_run_id=33063470968, artifact_id=9642983578, artifact_sha256=1f6be91fcd98e43e99d82d5f274536f6c23616e7e6c711e26324a2cc4b06ef06, documents_sha256=d70f7f795847968339a645b6dbd6d4428af6bd6044de44fa2602d4c4343b0ee9, documents_file_sha256=2a62ab05687982c112a29f6126227c26c3ff8defc89ca64662753aaf85c3c0ce, coding_package_file_sha256=14644759f53071adfe1173d4e25bb01931b8c1591fa8a48295dbd0556a754769, protocol_sha256=06d4b3407677fe7fb23046f70164a366db06638e8a29af3daf7661f00d565933, coding_schema_sha256=bfc735a7d8602d1f236a88c2d23b195f0600a8bae86fb8c8936afe7883a41b8e, and adjudication_schema_sha256=6181f5cb60a0462f83be00be301763daa89f11581e68ee1c46a84e8bf4e5be31.VerifiedInputBundle is a frozen dataclass with fields pins, documents, coding_package, and adjudication_schema.canonical_sha256() serializes JSON with sort_keys=True, separators=(",", ":"), and allow_nan=False, encodes it, and returns its SHA-256 digest._read_regular_file() opens inputs with os.O_RDONLY | os.O_NONBLOCK | getattr(os, "O_NOFOLLOW", 0), validates stat.S_ISREG, checks both reported and actually read size against max_bytes, and raises path-specific ValueErrors for open failures, non-regular files, or oversized files._parse_json_object() uses _reject_duplicate_keys via object_pairs_hook and _reject_non_finite_number via parse_constant; it rejects invalid UTF-8/JSON and requires the parsed value to be a dictionary._validate_manifest_identity() requires an exact key set equal to REQUIRED_INPUT_PINS, positive non-boolean integer workflow_run_id and artifact_id values via type(...) is int, and exact equality with every FROZEN_INPUT_PINS value; mismatches raise "input manifest does not identify frozen issue #4 input: {field}"._verify_input_payloads() first hashes artifact, documents, coding package, protocol, coding schema, and adjudication schema bytes and compares them to manifest fields before inspecting ZIP contents._verify_input_payloads() uses Python zipfile.ZipFile(io.BytesIO(artifact)), rejects more than 128 infolist() entries, counts duplicate info.filename values with Counter, and rejects a total declared expanded size above 64 MiB._verify_input_payloads() requires documents.json and v1.2-adjudication-package.json; for each, it uses archive.getinfo(), rejects declared or read content above 16 MiB, and requires extracted bytes to exactly equal the durable documents or coding_package bytes. Only zipfile.BadZipFile is translated to "artifact is not a valid ZIP archive"._verify_input_payloads() parses documents as an object, compares its canonical hash to documents_sha256, parses the coding package and adjudication schema as objects, and returns a VerifiedInputBundle.verify_input_manifest() redundantly calls _validate_manifest_identity() before reading all six inputs through _read_regular_file() and delegating to _verify_input_payloads(), then returns only .pins.No files found.