Dashboard › institutional-transition-lab › Distillation
Distillation
ID: a83720f3-be95-4bb2-8607-f50e99c12619
Generation: 0
Tokens: 2924
R_compression: 25.857
C_norm: 0.000
Archived: Yes
Created: 2026-09-09 02:16:29
Source IDs:
["lore_tm_v1_LzJUZ-1iW6YkG4iQmNlZhJnIpRrX0Rjf6kTNIcKRkVI","lore_tm_v1_I-Bc7hggK6Kyi-2H06VM_plF42NRrQKmufPSfKcfZdA","lore_tm_v1_T3H4hTVDOB_08NAGFGdpy6xEt1LBbF6cUfB5lAPmDAI","lore_tm_v1_svkUVbEyWsUse56Vim5SbQheh-I2ccPCG51V1j1QaAk"]
Observations
- π‘ (01:57) tests/test_governance_adjudication.py test_accept_edge_revision_uses_the_accepted_response() sets graph_edge_revision.basis="luna_b" while the record accepts another response; validation must emit "accept revision basis must equal accepted_from" and close canonicalization_gate.
- π‘ (01:57) test_institutional_claims_require_grounded_claim_and_edge_evidence() supplies invented quotes in claim_evidence_refs and power_changes[0].evidence_refs; validation must report evidence as "not grounded" and close canonicalization_gate.
- π‘ (01:57) _institutional_adjudication(record_class) creates a revise decision with accepted_from=None, event_kind="control_rights", title="Council gains release approval", announced_on="2024-04-01", affected_scope="releases", body_patch_relation="body_only", and a power edge where actor="The council", right_kind="approve", target="releases", direction="added", scope="project releases", and evidence quote="The council may approve releases." effective_on is "2024-04-01" only for effective_institutional_change; edge change_status maps effective_institutional_changeβ"effective", announced_institutional_changeβ"announced", proposal_onlyβ"proposed".
- π‘ (01:57) _institutional_adjudication(record_class) creates claim_evidence_refs for record_class, event_kind, title, announced_on, effective_on, affected_scope, and body_patch_relation using source_id="body" and quote="council"; graph_edge_revision uses basis=None, copies all final power_changes into added, and leaves removed empty.
- π‘ (01:57) test_institutional_class_and_edge_status_must_agree() parametrizes incompatible pairs: effective_institutional_change/"proposed", announced_institutional_change/"effective", and proposal_only/"effective"; each must produce "does not permit edge status" and close canonicalization_gate.
- π‘ (01:57) Additional governance-adjudication tests require: model="google/gemini-3.7-flash" to produce "Gemini is restricted to event triage"; a record whose only reviewer role is "synthesizer" to produce "requires a source_adjudicator"; duplicate record reviewer IDs to produce "reviewer_ids must be unique"; and reviewer_ids=[{"invalid":"reviewer"}] to produce "reviewer_ids must contain non-empty strings". Every case closes canonicalization_gate.
- π‘ (01:57) test_every_input_pin_is_reverified() changes adjudication.inputs.artifact_sha256 to "wrong" and expects exactly "input pin mismatch: artifact_sha256"; test_frozen_input_identifiers_are_reverified() increments workflow_run_id or artifact_id and expects the corresponding input-pin mismatch. Each closes canonicalization_gate.
- π‘ (01:57) test_frozen_pins_include_the_versioned_adjudication_schema() requires set(FROZEN_INPUT_PINS)==REQUIRED_INPUT_PINS and adjudication_schema_sha256="6181f5cb60a0462f83be00be301763daa89f11581e68ee1c46a84e8bf4e5be31".
- π‘ (01:57) test_input_manifest_rejects_self_consistent_substitute(field) parametrizes every field in sorted(FROZEN_INPUT_PINS), mutates the selected integer by +1 or substitutes "f"*64, and expects verify_input_manifest() to raise ValueError matching "frozen issue #4 input: {field}", even when the manifest is otherwise made self-consistent with adjudication_schema_sha256="5"*64.
- π‘ (01:57) test_input_manifest_rejects_changed_file_bytes() creates artifact.zip plus documents.json, coding-package.json, protocol.md, coding-schema.json, and adjudication-schema.json; after computing and monkeypatching matching pins, it rewrites documents.json to "changed" and expects ValueError matching "documents_file_sha256".
- π‘ (01:57) test_input_manifest_rejects_files_not_from_pinned_artifact() puts b"different documents" in artifact.zipβs documents.json while the durable documents.json contains "documents"; verify_input_manifest() must raise ValueError matching "artifact member mismatch: documents.json".
- π‘ (01:57) test_cli_validates_the_same_bytes_it_verifies() starts with forged_documents={"documents":[{"record_id":"forged"}]}, monkeypatches verify_input_manifest so documents.json is swapped to {"documents":[]} immediately before verification, and expects _run_cli() to raise ValueError matching "input manifest mismatch: documents_file_sha256".
- π‘ (01:57) test_cli_rejects_output_aliases_to_frozen_inputs() parametrizes input_name over adjudication, input_manifest, documents, coding_package, artifact, protocol, coding_schema, and adjudication_schema, and alias_kind over direct, symlink, and hardlink. Pointing summary_json at any such input must raise "output path aliases an input" and leave the input bytes unchanged.
- π‘ (01:57) test_cli_rejects_aliased_outputs() assigns summary_markdown and summary_json to the same path and expects ValueError matching "output paths alias each other".
- π‘ (01:58) prepare_coding_bundle() in src/institution_lab/governance_coding.py requires enriched.records and documents_payload.documents to be arrays of objects, joins enriched records to source documents by document_id, and rejects records without a matching source, non-empty source text, or enrichment object.
- π‘ (01:58) prepare_coding_bundle() always creates a body source with source_id="body", kind="github_body", filename=None, and the source document text. For enrichment.kind="pull_request_state_and_patch", it also creates pr_metadata with kind="github_pr_metadata" and sorted JSON containing state, draft, merged, merged_at, merge_commit_sha, base_sha, head_sha, and changed_files; each relevant file with a string patch becomes patch:{index} with kind="github_pr_patch", its filename, and patch text.
- π‘ (01:58) prepare_coding_bundle() computes pull-request evidence_bounds as 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 objects whose patch_unavailable value is truthy. Non-PR records use files_listing_complete=None, patch_selection_truncated=False, and patch_unavailable_count=0.
- π‘ (01:58) prepare_coding_bundle() outputs schema_version=1, coding_id="oss-governance-enriched-coding-v1", coding_schema_sha256 from schema_sha256 (default "unversioned-test-schema"), design_status="performance_blinded_model_informed_development", transition_dates_excluded=True, outcome_data_used=False, model_input_fields=MODEL_INPUT_FIELDS, and document rows containing record_id, entity_id, publisher, published_on, source_url, source_type, sources, and evidence_bounds.
- π‘ (01:58) parse_response() in src/institution_lab/governance_coding.py strips surrounding whitespace, accepts a fenced payload only when it begins with
and ends with a closing on the last line, raises "unterminated JSON code fence" otherwise, parses with json.loads(), and requires the result to be an object.
- π‘ (01:58) validate_response() requires the response key set to equal RESPONSE_KEYS; validates record_class against RECORD_CLASSES, non-null event_kind against EVENT_KINDS, non-null title/affected_scope/ambiguity as non-empty strings, announced_on/effective_on as exact ISO dates or null, body_patch_relation against BODY_PATCH_RELATIONS, and confidence as a finite non-boolean number from 0 through 1.
- π‘ (01:58) validate_response() requires power_changes to be an array. Each edge must have exactly POWER_KEYS; actor, target, and scope must be non-empty; right_kind, direction, and change_status must belong to RIGHT_KINDS, DIRECTIONS, and CHANGE_STATUSES; evidence_refs must be a non-empty list; every reference must have exactly REF_KEYS and contain a non-empty quote occurring in the referenced document source text.
- π‘ (01:58) validate_response() requires at least one power_change for effective_institutional_change, announced_institutional_change, and proposal_only; forbids power_changes for all non-institutional classes; and requires ambiguity when record_class="abstain".
- π‘ (01:58) schema/governance-adjudication-v1.schema.json is JSON Schema draft 2020-12 with $id=https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json, title="Performance-blinded governance adjudication v1", schema_version=1, design_status="performance_blinded_llm_assisted_source_adjudication", transition_dates_excluded=true, outcome_data_used=false, additionalProperties=false, and exactly 40 adjudication records via minItems=40 and maxItems=40.
- π‘ (01:58) The adjudication schema requires SHA-256 values to match ^[0-9a-f]{64}$; source_url to have URI format and match ^https://github\.com/[^\s]+$; reviewer_ids and source_audit.source_ids to be non-empty unique arrays of non-empty strings; and evidence_bounds.patch_unavailable_count to be an integer β₯0.
- π‘ (01:58) The adjudication schemaβs right_kind enum is ordered: appoint, remove, elect, vote, delegate, override, approve, merge, write, release, veto, own, license, steward, fund, set_budget, set_strategy, set_policy, set_membership, set_terms, inform. direction permits added, removed, modified; change_status permits effective, announced, proposed, rejected, unclear.
- π‘ (01:58) The adjudication schemaβs event_kind enum is leadership, board_or_steering, control_rights, reorganization, foundation_transfer, license, fork, reunification, strategy, product, external, or null. body_patch_relation permits consistent, patch_supersedes_body, body_only, patch_only, conflict, not_applicable, or unclear.
- π‘ (01:58) The schema requires each coding object to contain record_class, event_kind, title, announced_on, effective_on, affected_scope, body_patch_relation, power_changes, confidence, and ambiguity; confidence is 0β1; announced_on/effective_on use date format; and final_coding may be either such an object or null.
- π‘ (01:58) The schema requires each adjudication record to contain record_id, source_url, decision, accepted_from, reviewer_ids, source_audit, rationale, evidence_limitations, unresolved_reason, claim_evidence_refs, final_coding, and graph_edge_revision. graph_edge_revision may be null or an object with basis, added, and removed; basis permits luna_a, luna_b, terra_advisory, or null.
- π‘ (01:59) validate_adjudication_fragment() in src/institution_lab/governance_adjudication.py builds a fragment schema requiring schema_version=1, design_status="performance_blinded_llm_assisted_source_adjudication", at least one reviewer, and at least one record, while reusing the supplied schemaβs $schema and $defs.
- π‘ (01:59) validate_adjudication_fragment() runs validate_against_schema(), manually validates each reviewer with _validate_reviewer(), reports sorted duplicate reviewer IDs, and maps reviewer IDs to roles for per-record source_adjudicator checks.
- π‘ (01:59) Fragment validation requires documents.documents, coding_package.records, and fragment.records to be arrays; coding-package record IDs must equal frozen document IDs exactly once and in order; fragment record IDs must be unique, known, and appear as a subset in frozen-document order; and coding_package.summary.documents_sha256 must equal canonical_sha256(documents).
- π‘ (01:59) For each known fragment record, validate_adjudication_fragment() requires at least one listed reviewer whose mapped role is "source_adjudicator", then calls _validate_record() with the matching frozen document, coding record, and valid reviewer-ID set.
- π‘ (01:59) validate_against_schema() uses Draft202012Validator with FormatChecker and renders sorted errors as "schema {absolute.path or <root>}: {message}".
- π‘ (01:59) render_markdown() emits "# OSS governance adjudication v1", canonicalization-gate status, decision counts, final-class counts, per-record decision/final class/reviewer IDs, optional evidence limitations, unresolved record IDs or "- None", all frozen input fields, reviewer provenance including model or "none", and graph-edge revision counts for records with additions or removals.
- π‘ (01:59) _paths_alias() uses Path.samefile() and falls back on non-strict resolved-path equality when a path does not exist. _validate_output_paths() rejects every output that aliases any input and rejects outputs that alias each other.
- π‘ (01:59) _atomic_write() creates the parent directory, writes through tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent), flushes and os.fsync()s the file, then atomically installs it with os.replace(); on any BaseException it removes the temporary file if present and re-raises.
- π‘ (01:59) _write_failure_reports() constructs a failure summary with schema_version=1, canonicalization_gate="closed", and validation_errors=[str(error)], plus Markdown headed "# OSS governance adjudication v1" with a closed gate and "## Validation errors".