Dashboard › institutional-transition-lab › Distillation
0410f2a8-3ab2-4674-9285-fde68afec036["lore_tm_v1_SwjTZWI0pnEIZbVM8-8uOdG5h0RzzZa76O-T1Zks7l0","lore_tm_v1_p1-UyqpCdu50qUPmSiA0TMl7KqJzgj21KmAW10D_7Mc","lore_tm_v1_OLixdwwgObkB49vTduezYHppK5pFNWO_TJaHc7N6ctI"]
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py defines REQUIRED_INPUT_PINS with exactly 9 fields: workflow_run_id, artifact_id, artifact_sha256, documents_sha256, documents_file_sha256, coding_package_file_sha256, protocol_sha256, coding_schema_sha256, and adjudication_schema_sha256.FROZEN_INPUT_PINS in src/institution_lab/governance_adjudication.py pins 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".src/institution_lab/governance_adjudication.py are 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.VerifiedInputBundle is a frozen dataclass with pins, documents, coding_package, and adjudication_schema, each typed as dict[str, Any].canonical_sha256(value) serializes JSON with sort_keys=True, separators=(",", ":"), and allow_nan=False, encodes the result, and returns its SHA-256 hex digest; _bytes_sha256(payload) hashes bytes directly._read_regular_file(path, max_bytes=MAX_INPUT_BYTES) opens with os.O_RDONLY | os.O_NONBLOCK | getattr(os, "O_NOFOLLOW", 0), rejects open failures and non-regular files, checks st_size, reads at most max_bytes + 1, and rejects oversized input with input file exceeds {max_bytes} bytes: {path}.src/institution_lab/governance_adjudication.py uses _reject_duplicate_keys() to raise ValueError("duplicate JSON key: {key}"), _reject_non_finite_number() to raise ValueError("non-finite JSON number: {value}"), and _parse_json_object() to reject invalid JSON and non-object top-level values._validate_manifest_identity(manifest) requires a dictionary whose key set exactly equals REQUIRED_INPUT_PINS; requires positive exact-type integers for workflow_run_id and artifact_id; and compares every field against FROZEN_INPUT_PINS, raising input manifest does not identify frozen issue #4 input: {field} on mismatch._verify_input_payloads() computes byte-level SHA-256 values for the artifact, documents, coding package, protocol, coding schema, and adjudication schema, comparing them to artifact_sha256, documents_file_sha256, coding_package_file_sha256, protocol_sha256, coding_schema_sha256, and adjudication_schema_sha256; mismatches raise input manifest mismatch: {field}._verify_input_payloads() rejects more than MAX_ARCHIVE_MEMBERS, duplicate member names, total declared expanded size above MAX_ARCHIVE_EXPANDED_BYTES, missing or oversized required members, and invalid ZIP archives. Required byte-identical members are documents.json and v1.2-adjudication-package.json; malformed archives raise artifact is not a valid ZIP archive._verify_input_payloads() strictly parses documents, compares canonical_sha256(documents_value) with documents_sha256, and returns VerifiedInputBundle containing copied pins plus parsed documents, coding package, and adjudication schema.verify_input_manifest() validates manifest identity before reading all six input paths as regular files; the artifact uses MAX_ARTIFACT_BYTES, while documents, coding package, protocol, coding schema, and adjudication schema use the default MAX_INPUT_BYTES.tests/test_governance_adjudication.py sets 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; its artifact contains documents.json and v1.2-adjudication-package.json, and it monkeypatches governance_adjudication.FROZEN_INPUT_PINS to the generated manifest._run_cli() builds sys.argv beginning with institution-lab-governance-adjudication, then supplies --adjudication, --input-manifest, --documents, --coding-package, --artifact, --protocol, --coding-schema, --adjudication-schema, --summary-json, and --summary-markdown before calling governance_adjudication.main()._stub_cli_validation() replaces validate_against_schema with a function returning [], replaces validate_adjudication with one returning ([], {"canonicalization_gate": "open"}), and replaces render_markdown with one returning "gate: open\n".test_adjudication_schema_matches_validator_ontology checks schema/governance-adjudication-v1.schema.json against DECISIONS, REVIEWER_TYPES, REVIEWER_ROLES, RECORD_CLASSES, EVENT_KINDS | {None}, BODY_PATCH_RELATIONS, RIGHT_KINDS, DIRECTIONS, and CHANGE_STATUSES.test_schema_enforces_uri_and_date_formats parameterizes invalid values ("source_url", "not a URI") and ("announced_on", "2024-02-30"), requiring schema errors under records.0.source_url or records.0.final_coding, respectively._coding(record_class="no_event") returns event_kind=None, title=None, announced_on=None, effective_on=None, affected_scope=None, body_patch_relation="not_applicable", power_changes=[], confidence=1.0, and ambiguity=None._documents() describes record example-1 at https://github.com/acme/example/issues/1, with source body of kind github_body containing "The council may approve releases."; evidence bounds are source_text_truncated=False, files_listing_complete=None, patch_selection_truncated=False, and patch_unavailable_count=0._documents() also sets schema_version=1, coding_id="oss-governance-enriched-coding-v1", coding_schema_sha256="coding-schema-hash", design_status="performance_blinded_model_informed_development", transition_dates_excluded=True, outcome_data_used=False, and model_input_fields=[]._source_audit() requires inspected_before_codings=True, source_ids=["body"], and the same four evidence-bound values as _documents()._coding_package() starts with schema_version=1, summary {"documents_sha256": "filled-by-test"}, and record example-1 whose luna_a and luna_b entries both contain the same _coding() response with schema_valid=True; route_reasons=[].test_frozen_input_identifiers_are_reverified parameterizes workflow_run_id and artifact_id, increments the selected adjudication input by 1, and requires both input pin mismatch: {field} and summary["canonicalization_gate"] == "closed".test_input_manifest_rejects_changed_file_bytes computes a self-consistent manifest, monkeypatches FROZEN_INPUT_PINS, changes documents.json to "changed", and expects verify_input_manifest() to raise an error matching documents_file_sha256.test_input_manifest_rejects_files_not_from_pinned_artifact places b"different documents" in the artifact while the durable documents.json contains "documents", then expects artifact member mismatch: documents.json.test_cli_validates_the_same_bytes_it_verifies introduces forged documents {"documents": [{"record_id": "forged"}]}, monkeypatches verify_input_manifest with swap_before_verification() to rewrite the file to {"documents": []}, and expects input manifest mismatch: documents_file_sha256.test_cli_rejects_output_aliases_to_frozen_inputs covers 8 input namesβadjudication, input_manifest, documents, coding_package, artifact, protocol, coding_schema, and adjudication_schemaβacross 3 alias kinds: direct, symlink, and hardlink. It expects output path aliases an input and verifies the aliased input bytes remain unchanged.test_cli_rejects_aliased_outputs points summary_markdown to the same path as summary_json and expects output paths alias each other.test_cli_rejects_duplicate_manifest_keys injects a forged duplicate artifact_sha256 key, expects duplicate JSON key: artifact_sha256, and confirms an existing summary.json ends with canonicalization_gate == "closed".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 entry, updates artifact_sha256, monkeypatches FROZEN_INPUT_PINS, and expects artifact member is not unique: documents.json.