Dashboard › institutional-transition-lab › Distillation
a62f199d-a2bb-4d60-adde-bd5d6b001442["lore_tm_v1_z8VpJJvrwVNPSMVRxathRsgDnVzeipxdeF2T694r04Q","lore_tm_v1_Mo9D1dhQo-VSENdaxtJR1GqBgAAETOskVLirudKx2Oc","lore_tm_v1_-1hN-r_f17UOFysJ7hhYUQ9MlZxvHJum8pdlEoQWHHQ","lore_tm_v1_s4D0bgkNmqdPNssHmN_eEn9Hzrjf-IS2YbqPxvrXY6Y","lore_tm_v1_yu4OBOIzSuX4hAzhhAn_iRRjzzzaVzFVfvqRUSB0RwA","lore_tm_v1_BNeOUEJMMo-HYAj826NJYt0IK66yZtu9TSGb_lw7mUk"]
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py, fragment validation builds a schema requiring records to be an array with minItems: 1, validates via validate_against_schema(), then independently calls _validate_reviewer(reviewer, index) for each reviewer.reviewer_id values, reports duplicate reviewer IDs: [...] via _duplicates(), builds reviewer_ids and reviewer_roles, and requires every fragment recordβs reviewer_ids to include at least one reviewer whose role is source_adjudicator; otherwise it emits record {record_id}: requires a source_adjudicator./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py requires coding-package record IDs to match frozen-document IDs exactly once and in order, requires fragment IDs to be unique, and requires fragment IDs to form a known subset in frozen-document order.coding package record IDs must match frozen documents exactly once and in order, fragment record IDs must be unique, fragment record IDs must be a known subset in frozen document order, frozen coding package documents_sha256 mismatch, and adjudication record must be an object.coding_package["summary"]["documents_sha256"] against canonical_sha256(documents), indexes documents and coding rows by record_id, skips semantic record validation for non-string or unknown IDs, and otherwise calls _validate_record(record, documents_by_id[record_id], coding_by_id[record_id], reviewer_ids).validate_against_schema(adjudication, schema) uses Draft202012Validator(schema, format_checker=FormatChecker()); errors are sorted by error.path and formatted as schema {absolute path or <root>}: {error.message}./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py function verify_input_manifest() first calls _validate_manifest_identity(manifest), then invokes _verify_input_payloads() with bytes read from artifact, documents, coding_package, protocol, coding_schema, and adjudication_schema; only artifact is explicitly read with max_bytes=MAX_ARTIFACT_BYTES, and the function returns .pins._duplicates(values: list[str]) uses Counter(values) and returns values whose count exceeds 1._source_index(document) indexes source text only when each source is a dict with string source_id and string text; it also adds synthetic source record_metadata, containing compact, sorted JSON for record_id, source_url, published_on, publisher, and source_type./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py, _valid_date(value) accepts None or an exact canonical ISO date where date.fromisoformat(value).isoformat() == value; non-strings and ValueError cases return False. _nonempty(value) requires a string with non-whitespace content.prepare_coding_bundle(enriched, documents_payload, schema_sha256="unversioned-test-schema") requires both enriched["records"] and documents_payload["documents"] to be lists containing only dicts; otherwise it raises ValueError("enriched payload requires records") or ValueError("documents payload requires documents").prepare_coding_bundle() joins enriched records to source documents by converting document document_id values to strings in by_id; each enriched record must itself have a string document_id and a matching source, otherwise it raises ValueError(f"enriched record has no source document: {record_id}").prepare_coding_bundle() requires nonempty string source text, raising ValueError(f"source document has no text: {record_id}") otherwise, and starts each output document with source {source_id: "body", kind: "github_body", filename: None, text: body}.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 sorted JSON containing state, draft, merged, merged_at, merge_commit_sha, base_sha, head_sha, and changed_files; it adds patch sources as patch:{index} with kind github_pr_patch, the fileβs filename, and patch, skipping entries that are not dicts or lack string patches.source_text_truncated=bool(record["text_truncated"]), files_listing_complete=bool(enrichment["files_listing_complete"]), patch_selection_truncated=bool(enrichment["patch_selection_truncated"]), and patch_unavailable_count equal to the number of relevant-file dicts with truthy patch_unavailable.source_text_truncated=bool(record["text_truncated"]), files_listing_complete=None, patch_selection_truncated=False, and patch_unavailable_count=0.prepare_coding_bundle() outputs each document with record_id, entity_id, publisher, published_on, source_url, source_type, sources, and evidence_bounds; the enclosing bundle uses 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 documents=output.parse_response(text) strips whitespace, supports a triple-backtick fenced response only when it has at least 3 lines and ends with exactly a closing ``` line, raises ValueError("unterminated JSON code fence") for an invalid fence, parses with json.loads(), and raises ValueError("response must be an object") unless the parsed value is a dict.validate_response(response, document) requires the response key set to equal RESPONSE_KEYS; checks record_class against RECORD_CLASSES, non-null event_kind against EVENT_KINDS, non-null title, affected_scope, and ambiguity with _nonempty(), dates with _valid_date(), and body_patch_relation against BODY_PATCH_RELATIONS.0β1, emitting confidence must be between zero and one.source_map from every dict sourceβs source_id to text. power_changes must be an array; every change must be a dict whose keys exactly equal POWER_KEYS, with nonempty actor, target, and scope, allowed right_kind, direction, and change_status, and a nonempty array of evidence_refs.REF_KEYS; grounding requires the referenced source text to be a string, the quote to be nonempty, and the quote to occur within that source text. Failures emit power_changes[{index}].evidence_refs[{ref_index}] is malformed or ... is not grounded.record_class is one of effective_institutional_change, announced_institutional_change, or proposal_only; institutional/proposal records require power_changes, non-institutional records must not contain them, and record_class="abstain" requires non-null ambiguity./home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py defines REF_KEYS = {"source_id", "quote"} and ordered MODEL_INPUT_FIELDS as: 1. entity_id, 2. publisher, 3. published_on, 4. source_type, 5. sources, 6. evidence_bounds. CODING_DOCUMENT_KEYS is {"record_id", "source_url", *MODEL_INPUT_FIELDS}._hash(payload) serializes with json.dumps(payload, sort_keys=True, separators=(",", ":")), UTF-8 encodes the result, and returns its SHA-256 hexadecimal digest.