Dashboard › institutional-transition-lab › Distillation
76c7eba5-82c3-4d1a-a642-19149084d1cf["lore_tm_v1_ViXcYd0WIEZXxnulRoZ6T15wBO-KwNe3-5RancWjB8Q","lore_tm_v1_id8IarviMvxPgeGA2ducsSugJe7mc1bc27wP47uChmw","lore_tm_v1_9Jhp6paNHC3-2kzToON_VXLQQTCJmpfEk_fWRQr7LV0"]
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py defines ontology constants: DECISIONS={"accept","revise","reject","abstain"}; institutional classes effective_institutional_change, announced_institutional_change, and proposal_only; reviewer types human, llm, and human_llm_assisted; reviewer roles source_adjudicator, evidence_auditor, and synthesizer; response sources luna_a, luna_b, and terra_advisory.REQUIRED_INPUT_PINS contains 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 fixes issue #4 inputs to 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.CLAIM_FIELDS contains exactly record_class, event_kind, title, announced_on, effective_on, affected_scope, and body_patch_relation.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 contains pins, documents, coding_package, and adjudication_schema, each typed as a dictionary.canonical_sha256() serializes with json.dumps(sort_keys=True, separators=(",", ":"), allow_nan=False), UTF-8 encodes the result, and returns its SHA-256 hex digest; _bytes_sha256() hashes raw bytes._read_regular_file() securely opens a path with os.O_RDONLY | os.O_NONBLOCK | O_NOFOLLOW when available, verifies via fstat() that it is a regular file, rejects files above the configured byte limit both before and after reading, and converts open failures into ValueError("cannot open input as a regular file: ...").file_sha256() reads through _read_regular_file(..., max_bytes=MAX_ARTIFACT_BYTES) before hashing, so it inherits regular-file, symlink-following, and size protections._reject_duplicate_keys() to raise ValueError("duplicate JSON key: {key}"), _reject_non_finite_number() to reject values such as NaN/infinity, and _parse_json_object() to require valid JSON whose root is an object._validate_manifest_identity() requires the manifest to be an object with exactly the 9 REQUIRED_INPUT_PINS; requires positive, exact-type integers for workflow_run_id and artifact_id; and requires every field to equal FROZEN_INPUT_PINS, otherwise identifying the mismatched field as not belonging to frozen issue #4 input._verify_input_payloads() first validates frozen manifest identity, then independently hashes the artifact, documents file, coding-package file, protocol, coding schema, and adjudication schema and rejects any digest mismatch as input manifest mismatch: {field}._verify_input_payloads() opens the artifact from bytes as a ZIP, limits it to 128 members and 64 MiB total declared expanded size, rejects duplicate member names, and converts zipfile.BadZipFile to ValueError("artifact is not a valid ZIP archive")._verify_input_payloads() requires ZIP members documents.json and v1.2-adjudication-package.json; each must exist uniquely, be at most 16 MiB, and byte-for-byte equal the separately supplied durable file. Missing, oversized, or mismatched members are rejected with member-specific errors._verify_input_payloads() parses documents, recalculates canonical documents_sha256, and returns VerifiedInputBundle containing a copied manifest plus parsed documents, coding_package, and adjudication_schema.verify_input_manifest() validates manifest identity before reading any paths, securely reads the artifact with the 32 MiB limit and all other inputs with the 16 MiB limit, delegates to _verify_input_payloads(), and returns only the verified pin dictionary._duplicates(values) uses Counter and returns the set of values occurring more than once.accept, institutional edge-status checks, Gemini role restriction checks, mandatory source_adjudicator provenance, unique/nonempty reviewer_ids, and input-pin mismatch checks.FROZEN_INPUT_PINS, separately exercise invalid workflow_run_id and artifact_id, test changed durable document bytes, reject outputs aliasing frozen inputs, reject aliased output paths, test duplicate ZIP member names, reject out-of-range floating-point values, verify successful manifests equal FROZEN_INPUT_PINS, and exercise fragment validation including a non-string object used as record_id.