Dashboard › institutional-transition-lab › Distillation
09106716-98bb-4241-9ceb-d9812e83efa5["lore_tm_v1_VZvsimgTByvHWglgqZWcyPmcMQjHmDh4SH_nYe5fVpU","lore_tm_v1_pc0-cVNbqAPiq-ckxhEoHa8PDesgNm_n38BXMUnZWhw"]
prepare_coding_bundle() in /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py:122-225 joins enriched records to source documents, omits model-side triage metadata, and defaults schema_sha256 to "unversioned-test-schema".prepare_coding_bundle() requires enriched["records"] and documents_payload["documents"] to be lists containing only dictionaries; otherwise it raises ValueError("enriched payload requires records") or ValueError("documents payload requires documents").prepare_coding_bundle() indexes documents using str(item.get("document_id")), then requires each enriched document_id to be a string with a matching source document and each source body text to be a nonempty string. Missing matches and text raise ValueError(f"enriched record has no source document: {record_id}") and ValueError(f"source document has no text: {record_id}").{"source_id": "body", "kind": "github_body", "filename": None, "text": body} and requires a dictionary enrichment; otherwise prepare_coding_bundle() raises ValueError(f"record has no enrichment: {record_id}").pull_request_state_and_patch, prepare_coding_bundle() adds pr_metadata as github_pr_metadata containing sorted JSON for state, draft, merged, merged_at, merge_commit_sha, base_sha, head_sha, and changed_files.relevant_files having a string patch becomes a source with ID patch:<index>, kind github_pr_patch, its filename, and patch text; malformed entries or entries without string patches are skipped.source_text_truncated=bool(record.get("text_truncated")), files_listing_complete=bool(enrichment.get("files_listing_complete")), patch_selection_truncated=bool(enrichment.get("patch_selection_truncated")), and patch_unavailable_count equal to the count of dictionary relevant_files entries with truthy patch_unavailable.source_text_truncated=bool(record.get("text_truncated")), files_listing_complete=None, patch_selection_truncated=False, and patch_unavailable_count=0.prepare_coding_bundle() contains record_id, entity_id, publisher, published_on, source_url, source_type, sources, and evidence_bounds.prepare_coding_bundle() returns schema_version: 1, coding_id: "oss-governance-enriched-coding-v1", the supplied coding_schema_sha256, design_status: "performance_blinded_model_informed_development", transition_dates_excluded: True, outcome_data_used: False, model_input_fields: MODEL_INPUT_FIELDS, and the prepared documents._hash(payload) in /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py:102-104 computes SHA-256 over UTF-8 JSON serialized with sort_keys=True and separators=(",", ":")._valid_date(value) at governance_coding.py:107-115 accepts None or a string whose date.fromisoformat(value).isoformat() exactly equals the original value; it rejects nonstrings and invalid dates._nonempty(value) at governance_coding.py:118-119 returns true only for strings containing non-whitespace content.parse_response(text: str) begins at /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py:228 by assigning candidate = text.strip().tests/test_governance_adjudication.py includes exact-identity tests parameterized by mutations "duplicate" and "missing"; either must produce an error containing record IDs must match frozen documents exactly once and close the canonicalization gate.test_accept_must_equal_the_named_frozen_response() changes accepted final_coding["confidence"] to 0.5 and expects an error containing accepted coding does not equal luna_a.test_resolved_decision_cannot_leave_final_coding_abstained() changes the decision to revise, clears accepted_from, uses final class abstain with ambiguity The available source cannot resolve the event., and expects resolved decision cannot use abstain final class.test_source_audit_must_match_complete_frozen_document() tests mutations inspected_before_codings=False, source_ids=[], and evidence_bounds={"source_text_truncated": True}; each must yield a source_audit error and close the canonicalization gate.effective_institutional_change with announced_on="2024-04-01" and no effective_on expecting requires effective_on; announced_institutional_change with both dates null expecting requires announced_on; announced change with announced_on="2024-04-01" and effective_on="2024-05-01" expecting must not set effective_on; and proposal_only with those same dates expecting must not set effective_on.test_bounded_source_requires_explicit_evidence_limitation() sets source_text_truncated=True, propagates the changed evidence bounds and canonical document hash through the coding package, adjudication inputs, and pins, then expects bounded evidence requires evidence_limitations and a closed gate.test_accept_edge_revision_uses_the_accepted_response() changes graph_edge_revision["basis"] to "luna_b" and expects accept revision basis must equal accepted_from.test_institutional_claims_require_grounded_claim_and_edge_evidence() replaces claim and power-change evidence quotes with "invented", sets graph_edge_revision to {"basis": "luna_a", "added": [], "removed": []}, and expects an error containing not grounded._institutional_adjudication(record_class) maps effective_institutional_change β effective, announced_institutional_change β announced, and proposal_only β proposed; it constructs a revise decision titled Council gains release approval, with event kind control_rights, announced date 2024-04-01, affected scope releases, body/patch relation body_only, and a power change granting The council the approve right over releases for project releases._institutional_adjudication() uses claim evidence for fields, in order: record_class, event_kind, title, announced_on, effective_on, affected_scope, and body_patch_relation; each references source body and quote council._institutional_adjudication() grounds its power change with source body and exact quote The council may approve releases., sets direction added, and copies the final codingβs power_changes into graph_edge_revision["added"] with basis=None and no removed edges.effective_institutional_change with proposed, announced_institutional_change with effective, and proposal_only with effective; each expects an error containing does not permit edge status.test_gemini_cannot_adjudicate_or_assist() changes the reviewer model to google/gemini-3.7-flash and expects Gemini is restricted to event triage.test_each_record_requires_a_source_adjudicator() changes the only reviewer role to synthesizer and expects an error containing requires a source_adjudicator.test_record_reviewer_ids_must_be_unique() appends the existing reviewer ID a second time and expects reviewer_ids must be unique.test_malformed_reviewer_id_does_not_crash_manual_validation() sets reviewer_ids to [{"invalid": "reviewer"}] and expects a validation error containing reviewer_ids must contain non-empty strings with the canonicalization gate closed.test_every_input_pin_is_reverified() changes adjudication["inputs"]["artifact_sha256"] to "wrong" and expects the exact error input pin mismatch: artifact_sha256.test_frozen_pins_include_the_versioned_adjudication_schema() requires set(FROZEN_INPUT_PINS) == REQUIRED_INPUT_PINS and exact adjudication_schema_sha256 value 6181f5cb60a0462f83be00be301763daa89f11581e68ee1c46a84e8bf4e5be31.test_input_manifest_rejects_self_consistent_substitute() is parameterized over every sorted field in FROZEN_INPUT_PINS and builds a manifest from the frozen pins while substituting adjudication_schema_sha256 with "5" * 64.