Dashboard › institutional-transition-lab › Session 0Ipl6OlrkvUo
0Ipl6OlrkvUoJqclnPerform a read-only adversarial correctness audit of ONLY record and fragment semantic validation for issue #4 in /home/byk/Code/institutional-transition-lab. Review current uncommitted code and tests in: src/institution_lab/governance_adjudication.py functions _source_index, _evidence_errors, _response_for, graph_edge_diff, _validate_reviewer, _validate_record, validate_adjudication, validate_adjudication_fragment, validate_against_schema, and summary/gate derivation; schema/governance-adjudication-v1.schema.json except its input-pin definitions; tests/test_governance_adjudication.py tests for record semantics/fragments/gate. You may use synthetic fixtures already in tests. Do NOT inspect the content of governance documents, frozen model codings, retained source-adjudication fragments, performance outcomes, transition dates, detector outputs, or reports. Do NOT adjudicate any source record and do NOT edit files. Look for malformed-input crashes, schema/runtime drift, source-grounding bypasses, acceptance/revision/rejection/abstention contract gaps, temporal/status incoherence, graph-diff errors, duplicate/order bypasses, fragment/full-envelope confusion, and gate-opening mistakes. Run narrow tests or deterministic synthetic checks if useful, without repository edits. Return a substantive report even if no defects: findings first by severity with exact current file:line evidence, classify each PASS/CONCERN/MUST-FIX, include a deterministic regression proposal for every defect, state commands run, and end exactly MERGE or DO-NOT-MERGE. If blocked, report BLOCKED first with exact tool/error. This replaces a twice-empty broad validator auditor and must remain within this smaller disjoint scope.
I’ll audit only the listed validator paths, schema sections, and semantic/fragment/gate tests. I’ll keep the worktree unchanged and use only synthetic test fixtures for probes.
<path>/home/byk/Code/institutional-transition-lab</path> <type>directory</type> <entries> .git/ .github/ .gitignore .lore.md .pytest_cache/ .ruff_cache/ .venv/ AGENTS.md cases/ data/ docs/ node_modules/ package-lock.json package.json PROTOCOL.md pyproject.toml README.md research/ schema/ scripts/ src/ tests/ uv.lock (23 entries) </entries>
Found 34 matches
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py:
Line 61: def canonical_sha256(value: Any) -> str:
Line 117: if manifest.get("documents_sha256") != canonical_sha256(documents_value):
Line 127: def _source_index(document: dict[str, Any]) -> dict[str, str]:
Line 143: def _evidence_errors(
Line 170: def _response_for(record: dict[str, Any], source: str) -> dict[str, Any] | None:
Line 182: def graph_edge_diff(
Line 196: def _validate_reviewer(reviewer: Any, index: int) -> list[str]:
Line 224: def _validate_record(
Line 392: def validate_adjudication(
Line 411: computed_documents_hash = canonical_sha256(documents)
Line 412: package_summary = coding_package.get("summary", {})
Line 413: if package_summary.get("documents_sha256") != computed_documents_hash:
Line 526: summary: dict[str, Any] = {
Line 534: "canonicalization_gate": "closed" if errors or unresolved else "open",
Line 536: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
120:
121:
122: def _duplicates(values: list[str]) -> set[str]:
123: counts = Counter(values)
124: return {value for value, count in counts.items() if count > 1}
125:
126:
127: def _source_index(document: dict[str, Any]) -> dict[str, str]:
128: sources = {
129: source["source_id"]: source["text"]
130: for source in document.get("sources", [])
131: if isinstance(source, dict)
132: and isinstance(source.get("source_id"), str)
133: and isinstance(source.get("text"), str)
134: }
135: metadata = {
136: field: document.get(field)
137: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
138: }
139: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
140: return sources
141:
142:
143: def _evidence_errors(
144: reference: Any,
145: sources: dict[str, str],
146: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
392: def validate_adjudication(
393: adjudication: dict[str, Any],
394: documents: dict[str, Any],
395: coding_package: dict[str, Any],
396: *,
397: verified_pins: dict[str, str],
398: ) -> tuple[list[str], dict[str, Any]]:
399: errors: list[str] = []
400: if adjudication.get("transition_dates_excluded") is not True:
401: errors.append("transition_dates_excluded must be true")
402: if adjudication.get("outcome_data_used") is not False:
403: errors.append("outcome_data_used must be false")
404: inputs = adjudication.get("inputs")
405: if not isinstance(inputs, dict):
406: inputs = {}
407: errors.append("inputs must be an object")
408: for pin in sorted(REQUIRED_INPUT_PINS):
409: if inputs.get(pin) != verified_pins.get(pin):
410: errors.append(f"input pin mismatch: {pin}")
411: computed_documents_hash = ...
Found 20 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 33: def test_adjudication_schema_matches_validator_ontology() -> None: Line 55: def test_schema_enforces_uri_and_date_formats(field: str, value: str) -> None: Line 225: def test_one_abstention_keeps_canonicalization_gate_closed() -> None: Line 245: def test_record_ids_must_match_frozen_documents_exactly_once(mutation: str) -> None: Line 258: def test_accept_must_equal_the_named_frozen_response() -> None: Line 268: def test_resolved_decision_cannot_leave_final_coding_abstained() -> None: Line 336: def test_bounded_source_requires_explicit_evidence_limitation() -> None: Line 363: def test_accept_edge_revision_uses_the_accepted_response() -> None: Line 373: def test_institutional_claims_require_grounded_claim_and_edge_evidence() -> None: Line 452: def test_institutional_class_and_edge_status_must_agree( Line 516: def ...
Found 4 matches
/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json:
Line 69: "reviewer": {
Line 153: "record_class": {
Line 229: "record": {
Line 245: "decision": {"enum": ["accept", "revise", "reject", "abstain"]},
?? schema/governance-adjudication-v1.schema.json ?? src/institution_lab/governance_adjudication.py ?? tests/test_governance_adjudication.py
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import zipfile 6: from pathlib import Path 7: 8: import pytest 9: 10: from institution_lab.governance_adjudication import ( 11: DECISIONS, 12: FROZEN_INPUT_PINS, 13: REQUIRED_INPUT_PINS, 14: REVIEWER_ROLES, 15: REVIEWER_TYPES, 16: validate_adjudication, 17: validate_adjudication_fragment, 18: validate_against_schema, 19: verify_input_manifest, 20: ) 21: from institution_lab.governance_coding import ( 22: BODY_PATCH_RELATIONS, 23: CHANGE_STATUSES, 24: DIRECTIONS, 25: EVENT_KINDS, 26: RECORD_CLASSES, 27: RIGHT_KINDS, 28: ) 29: 30: ROOT = Path(__file__).parents[1] 31: 32: 33: def test_adjudication_schema_matches_validator_ontology() -> None: 34: schema = json.loads((ROOT / "schema/governance-adjudication-v1.schema.json").read_text()) 35: coding = ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
225: def test_one_abstention_keeps_canonicalization_gate_closed() -> None:
226: adjudication = _adjudication()
227: record = adjudication["records"][0]
228: record.update({
229: "decision": "abstain",
230: "accepted_from": None,
231: "unresolved_reason": "Required source evidence is incomplete.",
232: "final_coding": None,
233: "graph_edge_revision": None,
234: })
235:
236: errors, summary = _validate(adjudication)
237:
238: assert errors == []
239: assert summary["record_count"] == 1
240: assert summary["unresolved_record_ids"] == ["example-1"]
241: assert summary["canonicalization_gate"] == "closed"
242:
243:
244: @pytest.mark.parametrize("mutation", ["duplicate", "missing"])
245: def test_record_ids_must_match_frozen_documents_exactly_once(mutation: str) -> None:
246: adjudication = _adjudication()
247: if mutation == "duplicate":
248: ...
Found 5 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 708: def test_committed_partial_fragment_validates_but_cannot_be_the_full_envelope() -> None: Line 710: fragment = json.loads((input_directory / "fragments/opentofu-a2.json").read_text()) Line 719: def test_malformed_fragment_record_id_fails_closed() -> None: Line 721: fragment = json.loads((input_directory / "fragments/opentofu-a2.json").read_text()) Line 733: def test_resolved_valid_records_open_the_gate() -> None:
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 708: def test_committed_partial_fragment_validates_but_cannot_be_the_full_envelope() -> None: 709: input_directory = ROOT / "cases/review/oss-governance-adjudication-v1" 710: fragment = json.loads((input_directory / "fragments/opentofu-a2.json").read_text()) 711: documents = json.loads((input_directory / "documents.json").read_text()) 712: coding_package = json.loads((input_directory / "v1.2-coding-package.json").read_text()) 713: schema = json.loads((ROOT / "schema/governance-adjudication-v1.schema.json").read_text()) 714: 715: assert validate_adjudication_fragment(fragment, documents, coding_package, schema) == [] 716: assert validate_against_schema(fragment, schema) 717: 718: 719: def test_malformed_fragment_record_id_fails_closed() -> None: 720: input_directory = ROOT / "cases/review/oss-governance-adjudication-v1" 721: fragment = ...
Found 37 matches
/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json:
Line 13: "inputs",
Line 25: "inputs": {"$ref": "#/$defs/inputs"},
Line 29: "items": {"$ref": "#/$defs/reviewer"}
Line 35: "items": {"$ref": "#/$defs/record"}
Line 38: "$defs": {
Line 39: "inputs": {
Line 43: "workflow_run_id",
Line 44: "artifact_id",
Line 45: "artifact_sha256",
Line 54: "workflow_run_id": {"type": "integer", "minimum": 1},
Line 55: "artifact_id": {"type": "integer", "minimum": 1},
Line 56: "artifact_sha256": {"$ref": "#/$defs/sha256"},
Line 57: "documents_sha256": {"$ref": "#/$defs/sha256"},
Line 58: "documents_file_sha256": {"$ref": "#/$defs/sha256"},
Line 59: "coding_package_file_sha256": {"$ref": "#/$defs/sha256"},
Line 60: "protocol_sha256": {"$ref": "#/$defs/sha256"},
Line 61: ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
64: },
65: "sha256": {
66: "type": "string",
67: "pattern": "^[0-9a-f]{64}$"
68: },
69: "reviewer": {
70: "type": "object",
71: "additionalProperties": false,
72: "required": ["reviewer_id", "reviewer_type", "model", "role", "assistance"],
73: "properties": {
74: "reviewer_id": {"type": "string", "minLength": 1},
75: "reviewer_type": {
76: "enum": ["human", "llm", "human_llm_assisted"]
77: },
78: "model": {"type": ["string", "null"], "minLength": 1},
79: "role": {
80: "enum": ["source_adjudicator", "evidence_auditor", "synthesizer"]
81: },
82: "assistance": {"type": "string", "minLength": 1}
83: }
84: },
85: "evidence_ref": {
86: "type": "object",
87: "additionalProperties": false,
88: "required": ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import json
6: import zipfile
7: from collections import Counter
8: from pathlib import Path
9: from typing import Any
10:
11: from jsonschema import Draft202012Validator, FormatChecker
12:
13: from institution_lab.governance_coding import validate_response
14:
15: DECISIONS = {"accept", "revise", "reject", "abstain"}
16: INSTITUTIONAL_CLASSES = {
17: "effective_institutional_change",
18: "announced_institutional_change",
19: "proposal_only",
20: }
21: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
22: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
23: RESPONSE_SOURCES = {"luna_a", "luna_b", "terra_advisory"}
24: REQUIRED_INPUT_PINS = {
25: "workflow_run_id",
26: "artifact_id",
27: "artifact_sha256",
28: "documents_sha256",
29: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
700: removed = len(revision.get("removed", []))
701: if added or removed:
702: lines.append(f"- `{revision['record_id']}`: {added} added, {removed} removed")
703: if lines[-1] == "":
704: lines.append("- None")
705: return "\n".join(lines) + "\n"
706:
707:
708: def main() -> None:
709: parser = argparse.ArgumentParser(description="Validate frozen governance adjudication")
710: parser.add_argument("--adjudication", type=Path, required=True)
711: parser.add_argument("--input-manifest", type=Path, required=True)
712: parser.add_argument("--documents", type=Path, required=True)
713: parser.add_argument("--coding-package", type=Path, required=True)
714: parser.add_argument("--artifact", type=Path, required=True)
715: parser.add_argument("--protocol", type=Path, required=True)
716: parser.add_argument("--coding-schema", type=Path, ...
.......................... [100%] 26 passed in 0.11s
Found 4 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 306: return validate_adjudication(adjudication, documents, package, verified_pins=pins) Line 436: errors, summary = validate_adjudication( /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py: Line 392: def validate_adjudication( Line 736: errors, summary = validate_adjudication(
Found 22 matches
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py:
Line 70: "record_class",
Line 77: "power_changes",
Line 88: "evidence_refs",
Line 241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
Line 245: record_class = response.get("record_class")
Line 246: if record_class not in RECORD_CLASSES:
Line 247: errors.append("record_class is not allowed")
Line 273: changes = response.get("power_changes")
Line 275: errors.append("power_changes must be an array")
Line 278: prefix = f"power_changes[{index}]"
Line 291: refs = change.get("evidence_refs")
Line 293: errors.append(f"{prefix}.evidence_refs must be non-empty")
Line 297: errors.append(f"{prefix}.evidence_refs[{ref_index}] is malformed")
Line 302: errors.append(f"{prefix}.evidence_refs[{ref_index}] is not ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
230: if candidate.startswith("```"):
231: lines = candidate.splitlines()
232: if len(lines) < 3 or lines[-1].strip() != "```":
233: raise ValueError("unterminated JSON code fence")
234: candidate = "\n".join(lines[1:-1]).strip()
235: value = json.loads(candidate)
236: if not isinstance(value, dict):
237: raise ValueError("response must be an object")
238: return value
239:
240:
241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
242: errors: list[str] = []
243: if set(response) != RESPONSE_KEYS:
244: errors.append("response has missing or unexpected keys")
245: record_class = response.get("record_class")
246: if record_class not in RECORD_CLASSES:
247: errors.append("record_class is not allowed")
248: kind = ...
Found 1 matches /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py: Line 118: def _nonempty(value: object) -> bool:
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path> <type>file</type> <content> 112: try: 113: return date.fromisoformat(value).isoformat() == value 114: except ValueError: 115: return False 116: 117: 118: def _nonempty(value: object) -> bool: 119: return isinstance(value, str) and bool(value.strip()) 120: 121: 122: def prepare_coding_bundle( 123: enriched: dict[str, Any], 124: documents_payload: dict[str, Any], 125: *, (Showing lines 112-125 of 598. Use offset=126 to continue.) </content>
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
659: def validate_adjudication_fragment(
660: fragment: dict[str, Any],
661: documents: dict[str, Any],
662: coding_package: dict[str, Any],
663: schema: dict[str, Any],
664: ) -> list[str]:
665: fragment_schema = {
666: "$schema": schema.get("$schema"),
667: "type": "object",
668: "additionalProperties": False,
669: "required": ["schema_version", "design_status", "reviewers", "records"],
670: "properties": {
671: "schema_version": {"const": 1},
672: "design_status": {
673: "const": "performance_blinded_llm_assisted_source_adjudication"
674: },
675: "reviewers": {
676: "type": "array",
677: "minItems": 1,
678: "items": {"$ref": "#/$defs/reviewer"},
679: },
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
659: def validate_adjudication_fragment(
660: fragment: dict[str, Any],
661: documents: dict[str, Any],
662: coding_package: dict[str, Any],
663: schema: dict[str, Any],
664: ) -> list[str]:
665: fragment_schema = {
666: "$schema": schema.get("$schema"),
667: "type": "object",
668: "additionalProperties": False,
669: "required": ["schema_version", "design_status", "reviewers", "records"],
670: "properties": {
671: "schema_version": {"const": 1},
672: "design_status": {
673: "const": "performance_blinded_llm_assisted_source_adjudication"
674: },
675: "reviewers": {
676: "type": "array",
677: "minItems": 1,
678: "items": {"$ref": "#/$defs/reviewer"},
679: },
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
60: "protocol_sha256": {"$ref": "#/$defs/sha256"},
61: "coding_schema_sha256": {"$ref": "#/$defs/sha256"},
62: "adjudication_schema_sha256": {"$ref": "#/$defs/sha256"}
63: }
64: },
65: "sha256": {
66: "type": "string",
67: "pattern": "^[0-9a-f]{64}$"
68: },
69: "reviewer": {
70: "type": "object",
71: "additionalProperties": false,
72: "required": ["reviewer_id", "reviewer_type", "model", "role", "assistance"],
73: "properties": {
74: "reviewer_id": {"type": "string", "minLength": 1},
75: "reviewer_type": {
76: "enum": ["human", "llm", "human_llm_assisted"]
77: },
78: "model": {"type": ["string", "null"], "minLength": 1},
79: "role": {
80: "enum": ["source_adjudicator", "evidence_auditor", "synthesizer"]
81: ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
776: def test_cli_validates_the_same_bytes_it_verifies(
777: tmp_path: Path,
778: monkeypatch: pytest.MonkeyPatch,
779: ) -> None:
780: _, paths = _write_pinned_cli_inputs(tmp_path, monkeypatch)
781: _stub_cli_validation(monkeypatch)
782: forged_documents = {"documents": [{"record_id": "forged"}]}
783: original_verify = governance_adjudication.verify_input_manifest
784:
785: def swap_before_verification(*args: object, **kwargs: object) -> dict[str, object]:
786: paths["documents"].write_text(json.dumps({"documents": []}))
787: return original_verify(*args, **kwargs)
788:
789: paths["documents"].write_text(json.dumps(forged_documents))
790: monkeypatch.setattr(
791: governance_adjudication,
792: "verify_input_manifest",
793: swap_before_verification,
794: )
795:
796: with pytest.raises(ValueError, match="input manifest mismatch: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
360: response = parse_response(raw.get("response_text", ""))
361: except (ValueError, json.JSONDecodeError) as error:
362: response = None
363: errors.append(f"invalid JSON: {error}")
364: if response is not None:
365: errors.extend(validate_response(response, document))
366: results[record_id] = {
367: "response": response,
368: "schema_valid": not errors,
369: "validation_errors": errors,
370: "model": raw.get("model"),
371: "reasoning_effort": raw.get("reasoning_effort"),
372: "elapsed_ms": raw.get("elapsed_ms"),
373: }
374: return results
375:
376:
377: def _edge_signature(response: dict[str, Any] | None) -> tuple[tuple[str, ...], ...]:
378: if not response:
379: return ()
380: edges = ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
100:
101:
102: def _hash(payload: object) -> str:
103: data = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()
104: return hashlib.sha256(data).hexdigest()
105:
106:
107: def _valid_date(value: object) -> bool:
108: if value is None:
109: return True
110: if not isinstance(value, str):
111: return False
112: try:
113: return date.fromisoformat(value).isoformat() == value
114: except ValueError:
115: return False
116:
117:
118: def _nonempty(value: object) -> bool:
119: return isinstance(value, str) and bool(value.strip())
120:
121:
122: def prepare_coding_bundle(
123: enriched: dict[str, Any],
124: documents_payload: dict[str, Any],
125: *,
126: schema_sha256: str = "unversioned-test-schema",
127: ) -> dict[str, Any]:
128: """Join source bodies to the ...
I’m completing the reduced semantic audit with synthetic probes only. I’ll keep the repository unchanged and report every checked invariant, including passes and residual risks.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
659: def validate_adjudication_fragment(
660: fragment: dict[str, Any],
661: documents: dict[str, Any],
662: coding_package: dict[str, Any],
663: schema: dict[str, Any],
664: ) -> list[str]:
665: fragment_schema = {
666: "$schema": schema.get("$schema"),
667: "type": "object",
668: "additionalProperties": False,
669: "required": ["schema_version", "design_status", "reviewers", "records"],
670: "properties": {
671: "schema_version": {"const": 1},
672: "design_status": {
673: "const": "performance_blinded_llm_assisted_source_adjudication"
674: },
675: "reviewers": {
676: "type": "array",
677: "minItems": 1,
678: "items": {"$ref": "#/$defs/reviewer"},
679: },
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
848: def test_cli_rejects_duplicate_manifest_keys(
849: tmp_path: Path,
850: monkeypatch: pytest.MonkeyPatch,
851: ) -> None:
852: manifest, paths = _write_pinned_cli_inputs(tmp_path, monkeypatch)
853: _stub_cli_validation(monkeypatch)
854: manifest_text = json.dumps(manifest)
855: paths["input_manifest"].write_text(
856: manifest_text.replace(
857: '"artifact_sha256":',
858: '"artifact_sha256": "forged", "artifact_sha256":',
859: 1,
860: )
861: )
862: paths["summary_json"].write_text('{"canonicalization_gate":"open"}\n')
863:
864: with pytest.raises(ValueError, match="duplicate JSON key: artifact_sha256"):
865: _run_cli(monkeypatch, paths)
866:
867: assert json.loads(paths["summary_json"].read_text())["canonicalization_gate"] == "closed"
868:
869:
870: def test_input_manifest_rejects_non_object() -> None:
871: with ...
Found 12 matches
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py:
Line 298: def _edge_key(edge: dict[str, Any]) -> str:
Line 474: claim_refs = record.get("claim_evidence_refs")
Line 476: errors.append(f"{prefix}: claim_evidence_refs must be an array")
Line 479: path = f"{prefix}.claim_evidence_refs[{ref_index}]"
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py:
Line 88: "evidence_refs",
Line 291: refs = change.get("evidence_refs")
Line 293: errors.append(f"{prefix}.evidence_refs must be non-empty")
Line 297: errors.append(f"{prefix}.evidence_refs[{ref_index}] is malformed")
Line 302: errors.append(f"{prefix}.evidence_refs[{ref_index}] is not grounded")
Line 377: def _edge_signature(response: dict[str, Any] | None) -> tuple[tuple[str, ...], ...]:
Line 388: for reference in edge.get("evidence_refs", ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
360: response = parse_response(raw.get("response_text", ""))
361: except (ValueError, json.JSONDecodeError) as error:
362: response = None
363: errors.append(f"invalid JSON: {error}")
364: if response is not None:
365: errors.extend(validate_response(response, document))
366: results[record_id] = {
367: "response": response,
368: "schema_valid": not errors,
369: "validation_errors": errors,
370: "model": raw.get("model"),
371: "reasoning_effort": raw.get("reasoning_effort"),
372: "elapsed_ms": raw.get("elapsed_ms"),
373: }
374: return results
375:
376:
377: def _edge_signature(response: dict[str, Any] | None) -> tuple[tuple[str, ...], ...]:
378: if not response:
379: return ()
380: edges = ...
Found 51 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 275: "graph_edge_revision": {
Line 320: "graph_edge_revision": None,
Line 365: "graph_edge_revision": {"basis": None, "added": [], "removed": []},
Line 452: adjudication["records"][0]["graph_edge_revision"]["basis"] = "luna_b"
Line 469: record["graph_edge_revision"] = {"basis": "luna_a", "added": [], "removed": []}
Line 523: record["graph_edge_revision"] = {
Line 581: record["graph_edge_revision"] = {
Line 1020: assert summary["graph_edge_revisions"] == [
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py:
Line 302: def graph_edge_diff(
Line 491: revision = record.get("graph_edge_revision")
Line 494: errors.append(f"{prefix}: abstain requires null graph_edge_revision")
Line 496: errors.append(f"{prefix}: resolved decision requires graph_edge_revision")
Line 504: expected = ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not isinstance(reference, dict):
271: return [f"{path} must be an object"]
272: required = {"source_id", "quote", "field"} if claim else {"source_id", "quote"}
273: if set(reference) != required:
274: return [f"{path} must ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 423: def test_bounded_source_requires_explicit_evidence_limitation() -> None: 424: adjudication = _adjudication() 425: documents = _documents() 426: documents["documents"][0]["evidence_bounds"]["source_text_truncated"] = True 427: adjudication["records"][0]["source_audit"]["evidence_bounds"] = copy.deepcopy( 428: documents["documents"][0]["evidence_bounds"] 429: ) 430: package = _coding_package() 431: from institution_lab.governance_adjudication import canonical_sha256 432: 433: documents_hash = canonical_sha256(documents) 434: package["summary"]["documents_sha256"] = documents_hash 435: adjudication["inputs"]["documents_sha256"] = documents_hash 436: pins = _pins() 437: pins["documents_sha256"] = documents_hash 438: 439: errors, summary = validate_adjudication( 440: adjudication, 441: documents, 442: package, 443: verified_pins=pins, 444: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
100:
101:
102: def _hash(payload: object) -> str:
103: data = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()
104: return hashlib.sha256(data).hexdigest()
105:
106:
107: def _valid_date(value: object) -> bool:
108: if value is None:
109: return True
110: if not isinstance(value, str):
111: return False
112: try:
113: return date.fromisoformat(value).isoformat() == value
114: except ValueError:
115: return False
116:
117:
118: def _nonempty(value: object) -> bool:
119: return isinstance(value, str) and bool(value.strip())
120:
121:
122: def prepare_coding_bundle(
123: enriched: dict[str, Any],
124: documents_payload: dict[str, Any],
125: *,
126: schema_sha256: str = "unversioned-test-schema",
127: ) -> dict[str, Any]:
128: """Join source bodies to the ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
659: def validate_adjudication_fragment(
660: fragment: dict[str, Any],
661: documents: dict[str, Any],
662: coding_package: dict[str, Any],
663: schema: dict[str, Any],
664: ) -> list[str]:
665: fragment_schema = {
666: "$schema": schema.get("$schema"),
667: "type": "object",
668: "additionalProperties": False,
669: "required": ["schema_version", "design_status", "reviewers", "records"],
670: "properties": {
671: "schema_version": {"const": 1},
672: "design_status": {
673: "const": "performance_blinded_llm_assisted_source_adjudication"
674: },
675: "reviewers": {
676: "type": "array",
677: "minItems": 1,
678: "items": {"$ref": "#/$defs/reviewer"},
679: },
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": ...
/usr/bin/bash: line 1: python: command not found
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
859: def _write_failure_reports(summary_json: Path, summary_markdown: Path, error: Exception) -> None:
860: message = str(error)
861: summary = {
862: "schema_version": 1,
863: "canonicalization_gate": "closed",
864: "validation_errors": [message],
865: }
866: markdown = "\n".join(
867: [
868: "# OSS governance adjudication v1",
869: "",
870: "Canonicalization gate: **closed**",
871: "",
872: "## Validation errors",
873: "",
874: f"- {message}",
875: "",
876: ]
877: )
878: _atomic_write(summary_json, json.dumps(summary, indent=2, sort_keys=True) + "\n")
879: _atomic_write(summary_markdown, markdown)
880:
881:
882: def main() -> None:
883: parser = argparse.ArgumentParser(description="Validate frozen governance adjudication")
884: parser.add_argument("--adjudication", type=Path, required=True)
885: ...
{
"irrelevant_claim_quotes": [],
"blank_rationale": [],
"blank_reviewer": [],
"duplicate_source_id": [],
"unhashable_ids_full": "CRASH TypeError: unhashable type: 'dict'",
"none_sources": "CRASH TypeError: 'NoneType' object is not iterable",
"none_package_summary": "CRASH TypeError: 'NoneType' object does not support item assignment",
"none_edge": [
"record example-1: power_changes[0] has missing or unexpected keys",
"record example-1: non-institutional records must not contain power_changes",
"record example-1: graph_edge_revision.added is not derived"
],
"none_baseline_edge": [
"record example-1: accepted coding does not equal luna_a",
"record example-1: graph_edge_revision.removed is not derived"
]
}
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: ...
Found 3 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 986: assert validate_adjudication_fragment(fragment, documents, coding_package, schema) == [] Line 998: errors = validate_adjudication_fragment(fragment, documents, coding_package, schema) /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py: Line 659: def validate_adjudication_fragment(
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
659: def validate_adjudication_fragment(
660: fragment: dict[str, Any],
661: documents: dict[str, Any],
662: coding_package: dict[str, Any],
663: schema: dict[str, Any],
664: ) -> list[str]:
665: fragment_schema = {
666: "$schema": schema.get("$schema"),
667: "type": "object",
668: "additionalProperties": False,
669: "required": ["schema_version", "design_status", "reviewers", "records"],
670: "properties": {
671: "schema_version": {"const": 1},
672: "design_status": {
673: "const": "performance_blinded_llm_assisted_source_adjudication"
674: },
675: "reviewers": {
676: "type": "array",
677: "minItems": 1,
678: "items": {"$ref": "#/$defs/reviewer"},
679: },
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
100:
101:
102: def _hash(payload: object) -> str:
103: data = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()
104: return hashlib.sha256(data).hexdigest()
105:
106:
107: def _valid_date(value: object) -> bool:
108: if value is None:
109: return True
110: if not isinstance(value, str):
111: return False
112: try:
113: return date.fromisoformat(value).isoformat() == value
114: except ValueError:
115: return False
116:
117:
118: def _nonempty(value: object) -> bool:
119: return isinstance(value, str) and bool(value.strip())
120:
121:
122: def prepare_coding_bundle(
123: enriched: dict[str, Any],
124: documents_payload: dict[str, Any],
125: *,
126: schema_sha256: str = "unversioned-test-schema",
127: ) -> dict[str, Any]:
128: """Join source bodies to the ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
180: "outcome_data_used": False,
181: "model_input_fields": [],
182: "documents": [
183: {
184: "record_id": "example-1",
185: "source_url": "https://github.com/acme/example/issues/1",
186: "sources": [
187: {
188: "source_id": "body",
189: "kind": "github_body",
190: "filename": None,
191: "text": "The council may approve releases.",
192: }
193: ],
194: "evidence_bounds": {
195: "source_text_truncated": False,
196: "files_listing_complete": None,
197: "patch_selection_truncated": False,
198: "patch_unavailable_count": 0,
199: },
200: },
201: ],
202: }
203:
204:
205: def _source_audit() -> dict[str, object]:
206: return {
207: "inspected_before_codings": True,
208: "source_ids": ["body"],
209: "evidence_bounds": {
210: "source_text_truncated": False,
211: ...
I found crash and grounding candidates in the first synthetic matrix. I’m now narrowing each one to the exact validator path and checking whether schema validation closes it before treating it as a defect.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
Found 100 matches (more matches available)
/home/byk/Code/institutional-transition-lab/cases/review/oss-governance-adjudication-v1/fragments/valkey-31-33.json:
Line 9: "role": "source_adjudicator",
Line 18: "accepted_from": null,
Line 37: "claim_evidence_refs": [
Line 66: "graph_edge_revision": {
Line 76: "accepted_from": "terra_advisory",
Line 95: "claim_evidence_refs": [
Line 154: "graph_edge_revision": {
Line 164: "accepted_from": null,
Line 183: "claim_evidence_refs": [
Line 242: "graph_edge_revision": {
/home/byk/Code/institutional-transition-lab/cases/review/oss-governance-adjudication-v1/fragments/terraform-c.json:
Line 9: "role": "source_adjudicator",
Line 18: "accepted_from": null,
Line 39: "claim_evidence_refs": [
Line 93: "graph_edge_revision": {
Line 118: "accepted_from": "terra_advisory",
Line 141: "claim_evidence_refs": [
Line ...
?? schema/governance-adjudication-v1.schema.json ?? src/institution_lab/governance_adjudication.py ?? tests/test_governance_adjudication.py
Found 54 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 135: assert set(power_change["change_status"]["enum"]) == CHANGE_STATUSES
Line 140: [("source_url", "not a URI"), ("announced_on", "2024-02-30")],
Line 163: "announced_on": None,
Line 164: "effective_on": None,
Line 271: "evidence_limitations": None,
Line 272: "unresolved_reason": None,
Line 318: "unresolved_reason": "Required source evidence is incomplete.",
Line 393: ("record_class", "announced_on", "effective_on", "message"),
Line 395: ("effective_institutional_change", "2024-04-01", None, "requires effective_on"),
Line 396: ("announced_institutional_change", None, None, "requires announced_on"),
Line 401: "must not set effective_on",
Line 403: ("proposal_only", "2024-04-01", "2024-05-01", "must not set effective_on"),
Line 408: announced_on: str | None,
Line 409: effective_on: str | None,
Line 414: ...
I’m completing the fail-closed audit now. I’ll trace each synthetic failure to the exact schema/manual-validation path, separate schema-caught defects from direct-validator crashes, then report tested passes and residual risks without changing the worktree.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not isinstance(reference, dict):
271: return [f"{path} must be an object"]
272: required = {"source_id", "quote", "field"} if claim else {"source_id", "quote"}
273: if set(reference) != required:
274: return [f"{path} must ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
230: if candidate.startswith("```"):
231: lines = candidate.splitlines()
232: if len(lines) < 3 or lines[-1].strip() != "```":
233: raise ValueError("unterminated JSON code fence")
234: candidate = "\n".join(lines[1:-1]).strip()
235: value = json.loads(candidate)
236: if not isinstance(value, dict):
237: raise ValueError("response must be an object")
238: return value
239:
240:
241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
242: errors: list[str] = []
243: if set(response) != RESPONSE_KEYS:
244: errors.append("response has missing or unexpected keys")
245: record_class = response.get("record_class")
246: if record_class not in RECORD_CLASSES:
247: errors.append("record_class is not allowed")
248: kind = ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
180: "outcome_data_used": False,
181: "model_input_fields": [],
182: "documents": [
183: {
184: "record_id": "example-1",
185: "source_url": "https://github.com/acme/example/issues/1",
186: "sources": [
187: {
188: "source_id": "body",
189: "kind": "github_body",
190: "filename": None,
191: "text": "The council may approve releases.",
192: }
193: ],
194: "evidence_bounds": {
195: "source_text_truncated": False,
196: "files_listing_complete": None,
197: "patch_selection_truncated": False,
198: "patch_unavailable_count": 0,
199: },
200: },
201: ],
202: }
203:
204:
205: def _source_audit() -> dict[str, object]:
206: return {
207: "inspected_before_codings": True,
208: "source_ids": ["body"],
209: "evidence_bounds": {
210: "source_text_truncated": False,
211: ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
600: assert summary["canonicalization_gate"] == "closed"
601:
602:
603: def test_each_record_requires_a_source_adjudicator() -> None:
604: adjudication = _adjudication()
605: adjudication["reviewers"][0]["role"] = "synthesizer"
606:
607: errors, summary = _validate(adjudication)
608:
609: assert any("requires a source_adjudicator" in error for error in errors)
610: assert summary["canonicalization_gate"] == "closed"
611:
612:
613: def test_record_reviewer_ids_must_be_unique() -> None:
614: adjudication = _adjudication()
615: reviewer_id = adjudication["records"][0]["reviewer_ids"][0]
616: adjudication["records"][0]["reviewer_ids"].append(reviewer_id)
617:
618: errors, summary = _validate(adjudication)
619:
620: assert any("reviewer_ids must be unique" in error for error in errors)
621: assert summary["canonicalization_gate"] == "closed"
622: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
100:
101:
102: def _hash(payload: object) -> str:
103: data = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()
104: return hashlib.sha256(data).hexdigest()
105:
106:
107: def _valid_date(value: object) -> bool:
108: if value is None:
109: return True
110: if not isinstance(value, str):
111: return False
112: try:
113: return date.fromisoformat(value).isoformat() == value
114: except ValueError:
115: return False
116:
117:
118: def _nonempty(value: object) -> bool:
119: return isinstance(value, str) and bool(value.strip())
120:
121:
122: def prepare_coding_bundle(
123: enriched: dict[str, Any],
124: documents_payload: dict[str, Any],
125: *,
126: schema_sha256: str = "unversioned-test-schema",
127: ) -> dict[str, Any]:
128: """Join source bodies to the ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not isinstance(reference, dict):
271: return [f"{path} must be an object"]
272: required = {"source_id", "quote", "field"} if claim else {"source_id", "quote"}
273: if set(reference) != required:
274: return [f"{path} must contain exactly {sorted(required)}"]
275: if claim and reference.get("field") not in CLAIM_FIELDS:
276: return [f"{path}.field is invalid"]
277: source_id = reference.get("source_id")
278: quote = reference.get("quote")
279: if not isinstance(source_id, str) or not source_id:
280: return [f"{path}.source_id must be a non-empty string"]
281: if source_id not in sources:
282: return [f"{path}.source_id is not present in the ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
220: def verify_input_manifest(
221: manifest: Any,
222: *,
223: artifact: Path,
224: documents: Path,
225: coding_package: Path,
226: protocol: Path,
227: coding_schema: Path,
228: adjudication_schema: Path,
229: ) -> dict[str, Any]:
230: _validate_manifest_identity(manifest)
231: return _verify_input_payloads(
232: manifest,
233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES),
234: documents=_read_regular_file(documents),
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > ...
I’m completing the reduced audit with synthetic fail-closed probes. I’ll separate defects in the direct validators from malformed inputs that the schema already blocks, then verify the worktree stayed unchanged.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
659: def validate_adjudication_fragment(
660: fragment: dict[str, Any],
661: documents: dict[str, Any],
662: coding_package: dict[str, Any],
663: schema: dict[str, Any],
664: ) -> list[str]:
665: fragment_schema = {
666: "$schema": schema.get("$schema"),
667: "type": "object",
668: "additionalProperties": False,
669: "required": ["schema_version", "design_status", "reviewers", "records"],
670: "properties": {
671: "schema_version": {"const": 1},
672: "design_status": {
673: "const": "performance_blinded_llm_assisted_source_adjudication"
674: },
675: "reviewers": {
676: "type": "array",
677: "minItems": 1,
678: "items": {"$ref": "#/$defs/reviewer"},
679: },
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
242: errors: list[str] = []
243: if set(response) != RESPONSE_KEYS:
244: errors.append("response has missing or unexpected keys")
245: record_class = response.get("record_class")
246: if record_class not in RECORD_CLASSES:
247: errors.append("record_class is not allowed")
248: kind = response.get("event_kind")
249: if kind is not None and kind not in EVENT_KINDS:
250: errors.append("event_kind is not allowed")
251: for field in ("title", "affected_scope", "ambiguity"):
252: if response.get(field) is not None and not _nonempty(response.get(field)):
253: errors.append(f"{field} must be a non-empty string or null")
254: for field in ("announced_on", "effective_on"):
255: if not ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
69: "reviewer": {
70: "type": "object",
71: "additionalProperties": false,
72: "required": ["reviewer_id", "reviewer_type", "model", "role", "assistance"],
73: "properties": {
74: "reviewer_id": {"type": "string", "minLength": 1},
75: "reviewer_type": {
76: "enum": ["human", "llm", "human_llm_assisted"]
77: },
78: "model": {"type": ["string", "null"], "minLength": 1},
79: "role": {
80: "enum": ["source_adjudicator", "evidence_auditor", "synthesizer"]
81: },
82: "assistance": {"type": "string", "minLength": 1}
83: }
84: },
85: "evidence_ref": {
86: "type": "object",
87: "additionalProperties": false,
88: "required": ["source_id", "quote"],
89: "properties": {
90: "source_id": {"type": "string", "minLength": ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
173: def _documents() -> dict[str, object]:
174: return {
175: "schema_version": 1,
176: "coding_id": "oss-governance-enriched-coding-v1",
177: "coding_schema_sha256": "coding-schema-hash",
178: "design_status": "performance_blinded_model_informed_development",
179: "transition_dates_excluded": True,
180: "outcome_data_used": False,
181: "model_input_fields": [],
182: "documents": [
183: {
184: "record_id": "example-1",
185: "source_url": "https://github.com/acme/example/issues/1",
186: "sources": [
187: {
188: "source_id": "body",
189: "kind": "github_body",
190: "filename": None,
191: "text": "The council may approve releases.",
192: }
193: ],
194: "evidence_bounds": {
195: "source_text_truncated": False,
196: "files_listing_complete": None,
197: "patch_selection_truncated": ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not isinstance(reference, dict):
271: return [f"{path} must be an object"]
272: required = {"source_id", "quote", "field"} if claim else {"source_id", "quote"}
273: if set(reference) != required:
274: return [f"{path} must ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
680: "records": {
681: "type": "array",
682: "minItems": 1,
683: "items": {"$ref": "#/$defs/record"},
684: },
685: },
686: "$defs": schema.get("$defs", {}),
687: }
688: errors = validate_against_schema(fragment, fragment_schema)
689: reviewers = fragment.get("reviewers", [])
690: if not isinstance(reviewers, list):
691: reviewers = []
692: for index, reviewer in enumerate(reviewers):
693: errors.extend(_validate_reviewer(reviewer, index))
694: reviewer_id_values = [
695: reviewer.get("reviewer_id")
696: for reviewer in reviewers
697: if isinstance(reviewer, dict) and isinstance(reviewer.get("reviewer_id"), str)
698: ]
699: if duplicates := _duplicates(reviewer_id_values):
700: errors.append(f"duplicate reviewer IDs: {sorted(duplicates)}")
701: reviewer_ids = set(reviewer_id_values)
702: reviewer_roles = {
703: ...
I found two concrete candidate failures: malformed identifiers can crash the semantic validators, and an ungrounded claim reference can satisfy the institutional-field coverage check. I’m tracing both through full-envelope and fragment paths, then I’ll run a broader synthetic fail-closed matrix and the scoped tests.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
220: def verify_input_manifest(
221: manifest: Any,
222: *,
223: artifact: Path,
224: documents: Path,
225: coding_package: Path,
226: protocol: Path,
227: coding_schema: Path,
228: adjudication_schema: Path,
229: ) -> dict[str, Any]:
230: _validate_manifest_identity(manifest)
231: return _verify_input_payloads(
232: manifest,
233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES),
234: documents=_read_regular_file(documents),
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
110: if not isinstance(value, str):
111: return False
112: try:
113: return date.fromisoformat(value).isoformat() == value
114: except ValueError:
115: return False
116:
117:
118: def _nonempty(value: object) -> bool:
119: return isinstance(value, str) and bool(value.strip())
120:
121:
122: def prepare_coding_bundle(
123: enriched: dict[str, Any],
124: documents_payload: dict[str, Any],
125: *,
126: schema_sha256: str = "unversioned-test-schema",
127: ) -> dict[str, Any]:
128: """Join source bodies to the enriched envelope without model-side triage metadata."""
129: records = enriched.get("records")
130: documents = documents_payload.get("documents")
131: if not isinstance(records, list) or not all(isinstance(item, dict) for item in records):
132: raise ValueError("enriched ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
90: REF_KEYS = {"source_id", "quote"}
91: MODEL_INPUT_FIELDS = [
92: "entity_id",
93: "publisher",
94: "published_on",
95: "source_type",
96: "sources",
97: "evidence_bounds",
98: ]
99: CODING_DOCUMENT_KEYS = {"record_id", "source_url", *MODEL_INPUT_FIELDS}
100:
101:
102: def _hash(payload: object) -> str:
103: data = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()
104: return hashlib.sha256(data).hexdigest()
105:
106:
107: def _valid_date(value: object) -> bool:
108: if value is None:
109: return True
110: if not isinstance(value, str):
111: return False
112: try:
113: return date.fromisoformat(value).isoformat() == value
114: except ValueError:
115: return False
116:
117:
118: def _nonempty(value: object) -> bool:
119: return isinstance(value, str) ...
No files found
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
613: def test_record_reviewer_ids_must_be_unique() -> None:
614: adjudication = _adjudication()
615: reviewer_id = adjudication["records"][0]["reviewer_ids"][0]
616: adjudication["records"][0]["reviewer_ids"].append(reviewer_id)
617:
618: errors, summary = _validate(adjudication)
619:
620: assert any("reviewer_ids must be unique" in error for error in errors)
621: assert summary["canonicalization_gate"] == "closed"
622:
623:
624: def test_malformed_reviewer_id_does_not_crash_manual_validation() -> None:
625: adjudication = _adjudication()
626: adjudication["records"][0]["reviewer_ids"] = [{"invalid": "reviewer"}]
627:
628: errors, summary = _validate(adjudication)
629:
630: assert any("reviewer_ids must contain non-empty strings" in error for error in errors)
631: assert summary["canonicalization_gate"] == "closed"
632:
633:
634: def ...
I’m completing the reduced audit now: I’ll confirm each candidate against the schema-plus-runtime path, run deterministic synthetic regressions, and verify the worktree remains unchanged.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not isinstance(reference, dict):
271: return [f"{path} must be an object"]
272: required = {"source_id", "quote", "field"} if claim else {"source_id", "quote"}
273: if set(reference) != required:
274: return [f"{path} must ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
260: if (
261: isinstance(confidence, bool)
262: or not isinstance(confidence, int | float)
263: or not math.isfinite(float(confidence))
264: or not 0 <= float(confidence) <= 1
265: ):
266: errors.append("confidence must be between zero and one")
267:
268: source_map = {
269: source.get("source_id"): source.get("text")
270: for source in document.get("sources", [])
271: if isinstance(source, dict)
272: }
273: changes = response.get("power_changes")
274: if not isinstance(changes, list):
275: errors.append("power_changes must be an array")
276: changes = []
277: for index, change in enumerate(changes):
278: prefix = f"power_changes[{index}]"
279: if not isinstance(change, dict) or set(change) != POWER_KEYS:
280: ...
No files found
I’ll finish the reduced audit from the current files, rerun synthetic fail-closed probes and scoped tests, then report exact line evidence. I will not edit the worktree or inspect any frozen governance content.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not isinstance(reference, dict):
271: return [f"{path} must be an object"]
272: required = {"source_id", "quote", "field"} if claim else {"source_id", "quote"}
273: if set(reference) != required:
274: return [f"{path} must ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
531: @pytest.mark.parametrize(
532: ("record_class", "change_status"),
533: [
534: ("effective_institutional_change", "proposed"),
535: ("announced_institutional_change", "effective"),
536: ("proposal_only", "effective"),
537: ],
538: )
539: def test_institutional_class_and_edge_status_must_agree(
540: record_class: str,
541: change_status: str,
542: ) -> None:
543: adjudication = _adjudication()
544: record = adjudication["records"][0]
545: record.update({
546: "decision": "revise",
547: "accepted_from": None,
548: "claim_evidence_refs": [
549: {"field": field, "source_id": "body", "quote": "council"}
550: for field in (
551: "record_class",
552: "event_kind",
553: "title",
554: "announced_on",
555: "effective_on",
556: "affected_scope",
557: "body_patch_relation",
558: )
559: ],
560: "final_coding": ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
370: "model": raw.get("model"),
371: "reasoning_effort": raw.get("reasoning_effort"),
372: "elapsed_ms": raw.get("elapsed_ms"),
373: }
374: return results
375:
376:
377: def _edge_signature(response: dict[str, Any] | None) -> tuple[tuple[str, ...], ...]:
378: if not response:
379: return ()
380: edges = []
381: for edge in response.get("power_changes", []):
382: references = tuple(
383: sorted(
384: (
385: str(reference.get("source_id", "")).strip(),
386: str(reference.get("quote", "")).strip(),
387: )
388: for reference in edge.get("evidence_refs", [])
389: if isinstance(reference, dict)
390: )
391: )
392: edges.append(
393: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
779: def render_markdown(adjudication: dict[str, Any], summary: dict[str, Any]) -> str:
780: lines = [
781: "# OSS governance adjudication v1",
782: "",
783: f"Canonicalization gate: **{summary['canonicalization_gate']}**",
784: "",
785: "## Decisions",
786: "",
787: ]
788: for decision, count in summary["decision_counts"].items():
789: lines.append(f"- `{decision}`: {count}")
790: lines.extend(["", "## Final classes", ""])
791: for record_class, count in summary["class_counts"].items():
792: lines.append(f"- `{record_class}`: {count}")
793: lines.extend(["", "## Record decisions", ""])
794: for record in summary["record_decisions"]:
795: final_class = record["final_class"] or "unresolved"
796: reviewers = ", ".join(f"`{item}`" for item in record["reviewer_ids"] or [])
797: lines.append(
798: f"- `{record['record_id']}`: ...
<path>/home/byk/Code/institutional-transition-lab/pyproject.toml</path> <type>file</type> <content> 1: [build-system] 2: requires = ["hatchling"] 3: build-backend = "hatchling.build" 4: 5: [project] 6: name = "institutional-transition-lab" 7: version = "0.1.0" 8: description = "Empirical analysis of institutional power transitions and performance regimes" 9: readme = "README.md" 10: requires-python = ">=3.12" 11: dependencies = [ 12: "jsonschema>=4.23,<5", 13: ] 14: 15: [project.scripts] 16: institution-lab-oss = "institution_lab.oss_pipeline:main" 17: institution-lab-llm-eval = "institution_lab.llm_event_probe:main" 18: institution-lab-llm-triage = "institution_lab.llm_candidate_triage:main" 19: institution-lab-retrieve-oss-sources = "institution_lab.source_retrieval:main" 20: institution-lab-enrich-oss-sources = "institution_lab.source_enrichment:main" 21: institution-lab-governance-coding = "institution_lab.governance_coding:main" 22: institution-lab-governance-adjudication = ...
Found 2 matches
/home/byk/Code/institutional-transition-lab/schema/governance-coding-v1.schema.json:
Line 33: "required": ["source_id", "quote"],
Line 34: "properties": {"source_id": {"type": "string", "minLength": 1}, "quote": {"type": "string", "minLength": 1}}
M pyproject.toml M uv.lock ?? .lore.md ?? AGENTS.md ?? cases/review/oss-governance-adjudication-v1.inputs.json ?? cases/review/oss-governance-adjudication-v1/ ?? schema/governance-adjudication-v1.schema.json ?? src/institution_lab/governance_adjudication.py ?? tests/test_governance_adjudication.py pyproject.toml | 5 ++++- uv.lock | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-)
I found two likely fail-closed defects. I’m now confirming each through both schema-plus-runtime entry points and checking nearby invariants for false positives before issuing the verdict.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", "source_type")
258: }
259: sources["record_metadata"] = json.dumps(metadata, sort_keys=True, separators=(",", ":"))
260: return sources
261:
262:
263: def _evidence_errors(
264: reference: Any,
265: sources: dict[str, str],
266: path: str,
267: *,
268: claim: bool = False,
269: ) -> list[str]:
270: if not ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
230: if candidate.startswith("```"):
231: lines = candidate.splitlines()
232: if len(lines) < 3 or lines[-1].strip() != "```":
233: raise ValueError("unterminated JSON code fence")
234: candidate = "\n".join(lines[1:-1]).strip()
235: value = json.loads(candidate)
236: if not isinstance(value, dict):
237: raise ValueError("response must be an object")
238: return value
239:
240:
241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
242: errors: list[str] = []
243: if set(response) != RESPONSE_KEYS:
244: errors.append("response has missing or unexpected keys")
245: record_class = response.get("record_class")
246: if record_class not in RECORD_CLASSES:
247: errors.append("record_class is not allowed")
248: kind = ...
Found 2 matches /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py: Line 263: def _evidence_errors( Line 480: errors.extend(_evidence_errors(reference, sources, path, claim=True))
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
I’m completing the reduced audit now: I’ll confirm each candidate through both schema-plus-runtime entry points, run deterministic synthetic regressions, rerun the scoped suite, and verify that the worktree remains unchanged.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
230: _validate_manifest_identity(manifest)
231: return _verify_input_payloads(
232: manifest,
233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES),
234: documents=_read_regular_file(documents),
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and ...
Found 10 matches
/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json:
Line 88: "required": ["source_id", "quote"],
Line 90: "source_id": {"type": "string", "minLength": 1},
Line 97: "required": ["field", "source_id", "quote"],
Line 105: "source_id": {"type": "string", "minLength": 1},
Line 217: "required": ["inspected_before_codings", "source_ids", "evidence_bounds"],
Line 220: "source_ids": {
Line 223: "uniqueItems": true,
Line 250: "uniqueItems": true,
/home/byk/Code/institutional-transition-lab/schema/governance-coding-v1.schema.json:
Line 33: "required": ["source_id", "quote"],
Line 34: "properties": {"source_id": {"type": "string", "minLength": 1}, "quote": {"type": "string", "minLength": 1}}
{"exception": "TypeError: unhashable type: 'dict'", "name": "full_unhashable_adjudication_id", "schema_error_count": 2}
{"exception": "TypeError: unhashable type: 'dict'", "name": "full_unhashable_document_id", "schema_error_count": 1}
{"exception": "TypeError: unhashable type: 'dict'", "name": "full_unhashable_coding_id", "schema_error_count": 1}
{"exception": "TypeError: unhashable type: 'dict'", "name": "fragment_unhashable_coding_id"}
{"exception": "TypeError: unhashable type: 'dict'", "name": "fragment_unhashable_document_id"}
{"exception": "AttributeError: 'NoneType' object has no attribute 'get'", "name": "full_summary_null", "schema_error_count": 1}
{"exception": "AttributeError: 'NoneType' object has no attribute 'get'", "name": "fragment_summary_null"}
{"gate": "closed", "name": "ungrounded_required_claim", "runtime_errors": ["record example-1.claim_evidence_refs[2].quote is not grounded in source body"], "schema_error_count": 1}
{"gate": "open", "name": "blank_rationale", ...
The first matrix confirms two crash classes in both full and fragment validators: unhashable record IDs and a null coding-package summary. I’m now testing whether source-index collisions or claim-field accounting create a semantic bypass rather than only an ordinary validation error.
No files found
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py /home/byk/Code/institutional-transition-lab/tests/test_model_policy.py /home/byk/Code/institutional-transition-lab/tests/test_source_retrieval.py /home/byk/Code/institutional-transition-lab/tests/test_source_enrichment.py /home/byk/Code/institutional-transition-lab/tests/test_robustness.py /home/byk/Code/institutional-transition-lab/tests/test_phases.py /home/byk/Code/institutional-transition-lab/tests/test_oss_metrics.py /home/byk/Code/institutional-transition-lab/tests/test_oss_ingest.py /home/byk/Code/institutional-transition-lab/tests/test_llm_triage_compare.py /home/byk/Code/institutional-transition-lab/tests/test_llm_event_probe.py /home/byk/Code/institutional-transition-lab/tests/test_llm_candidate_triage.py /home/byk/Code/institutional-transition-lab/tests/test_llm_benchmark_subset.py /home/byk/Code/institutional-transition-lab/tests/test_llm_benchmark_gate.py /home/byk/Code/institutional-transiti...
Found 18 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 186: "sources": [
Line 188: "source_id": "body",
Line 208: "source_ids": ["body"],
Line 378: ("source_ids", []),
Line 464: {"field": "record_class", "source_id": "body", "quote": "invented"},
Line 467: {"source_id": "body", "quote": "invented"}
Line 489: {"field": field, "source_id": "body", "quote": "council"}
Line 518: {"source_id": "body", "quote": "The council may approve releases."}
Line 549: {"field": field, "source_id": "body", "quote": "council"}
Line 576: {"source_id": "body", "quote": "The council may approve releases."}
/home/byk/Code/institutional-transition-lab/tests/test_event_inventory.py:
Line 7: events, sources = load_event_inventory(
Line 12: assert len(sources) == 13
Line 15: assert all(source.url.startswith("https://") for source in ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_coding.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import json
4: from pathlib import Path
5:
6: from institution_lab.governance_coding import (
7: BODY_PATCH_RELATIONS,
8: CHANGE_STATUSES,
9: DIRECTIONS,
10: EVENT_KINDS,
11: MODEL_INPUT_FIELDS,
12: RECORD_CLASSES,
13: RESPONSE_KEYS,
14: RIGHT_KINDS,
15: compare_codings,
16: prepare_coding_bundle,
17: validate_response,
18: )
19:
20:
21: def test_frozen_json_schema_matches_validator_ontology() -> None:
22: schema = json.loads(Path("schema/governance-coding-v1.schema.json").read_text())
23: properties = schema["properties"]
24: assert set(schema["required"]) == RESPONSE_KEYS
25: assert set(properties["record_class"]["enum"]) == RECORD_CLASSES
26: assert set(properties["event_kind"]["enum"]) - {None} == EVENT_KINDS
27: assert ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
779: def render_markdown(adjudication: dict[str, Any], summary: dict[str, Any]) -> str:
780: lines = [
781: "# OSS governance adjudication v1",
782: "",
783: f"Canonicalization gate: **{summary['canonicalization_gate']}**",
784: "",
785: "## Decisions",
786: "",
787: ]
788: for decision, count in summary["decision_counts"].items():
789: lines.append(f"- `{decision}`: {count}")
790: lines.extend(["", "## Final classes", ""])
791: for record_class, count in summary["class_counts"].items():
792: lines.append(f"- `{record_class}`: {count}")
793: lines.extend(["", "## Record decisions", ""])
794: for record in summary["record_decisions"]:
795: final_class = record["final_class"] or "unresolved"
796: reviewers = ", ".join(f"`{item}`" for item in record["reviewer_ids"] or [])
797: lines.append(
798: f"- `{record['record_id']}`: ...
I’m completing the fail-closed matrix against the exact current lines, then I’ll rerun the scoped tests and verify that the worktree stayed unchanged.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and isinstance(source.get("source_id"), str)
253: and isinstance(source.get("text"), str)
254: }
255: metadata = {
256: field: document.get(field)
257: for field in ("record_id", "source_url", "published_on", "publisher", ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
260: if (
261: isinstance(confidence, bool)
262: or not isinstance(confidence, int | float)
263: or not math.isfinite(float(confidence))
264: or not 0 <= float(confidence) <= 1
265: ):
266: errors.append("confidence must be between zero and one")
267:
268: source_map = {
269: source.get("source_id"): source.get("text")
270: for source in document.get("sources", [])
271: if isinstance(source, dict)
272: }
273: changes = response.get("power_changes")
274: if not isinstance(changes, list):
275: errors.append("power_changes must be an array")
276: changes = []
277: for index, change in enumerate(changes):
278: prefix = f"power_changes[{index}]"
279: if not isinstance(change, dict) or set(change) != POWER_KEYS:
280: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
770: def validate_against_schema(adjudication: dict[str, Any], schema: dict[str, Any]) -> list[str]:
771: validator = Draft202012Validator(schema, format_checker=FormatChecker())
772: return [
773: f"schema {'.'.join(str(part) for part in error.absolute_path) or '<root>'}: "
774: f"{error.message}"
775: for error in sorted(validator.iter_errors(adjudication), key=lambda item: list(item.path))
776: ]
777:
778:
779: def render_markdown(adjudication: dict[str, Any], summary: dict[str, Any]) -> str:
780: lines = [
781: "# OSS governance adjudication v1",
782: "",
783: f"Canonicalization gate: **{summary['canonicalization_gate']}**",
784: "",
(Showing lines 770-784 of 946. Use offset=785 to continue.)
</content>
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
60: "protocol_sha256": {"$ref": "#/$defs/sha256"},
61: "coding_schema_sha256": {"$ref": "#/$defs/sha256"},
62: "adjudication_schema_sha256": {"$ref": "#/$defs/sha256"}
63: }
64: },
65: "sha256": {
66: "type": "string",
67: "pattern": "^[0-9a-f]{64}$"
68: },
69: "reviewer": {
70: "type": "object",
71: "additionalProperties": false,
72: "required": ["reviewer_id", "reviewer_type", "model", "role", "assistance"],
73: "properties": {
74: "reviewer_id": {"type": "string", "minLength": 1},
75: "reviewer_type": {
76: "enum": ["human", "llm", "human_llm_assisted"]
77: },
78: "model": {"type": ["string", "null"], "minLength": 1},
79: "role": {
80: "enum": ["source_adjudicator", "evidence_auditor", "synthesizer"]
81: ...
Found 58 matches /home/byk/Code/institutional-transition-lab/research/session-handover-2026-08-27.md: Line 13: > There are three raw statistical transition candidates, zero robust Line 30: triage, and extract candidate institutional facts. They do not identify Line 33: coding must not focus only on dates near detected performance changes. Line 35: transition dates stay outside retrieval prompts, coding documents, and graph Line 37: 4. **Require grounded evidence.** Every accepted event, date, actor, and right Line 55: pages, and invalidates generated notebook caches before report compilation. Line 58: - The first detector produced three OpenTofu candidates: February 2024 issue Line 62: candidate. The candidates had 60.0% of 10, 36.7% of 30, and 46.7% of 30 Line 64: - Result: **3 raw candidates → 0 robust transitions**. Startup and backlog Line 66: stories to these dates would be narrative fitting. ...
<path>/home/byk/Code/institutional-transition-lab/research/oss-governance-coding-protocol-v1.2.md</path> <type>file</type> <content> 1: # Performance-blinded OSS governance coding protocol v1.2 2: 3: Date frozen: 2026-08-27 4: Status: pre-adjudication evaluator correction; model-informed development protocol 5: 6: ## Correction 7: 8: The V1.1 run used the intended frozen 40-record manifest and unchanged coders. 9: Its mandatory artifact audit found that the evaluator's field named “strict 10: edge agreement” compared actor, right, target, direction, and status but omitted 11: edge scope and evidence references. It also did not route disagreements in the 12: separately coded body/patch relationship. Six records were consequently called 13: `provisional_exact_agreement` despite material differences. 14: 15: V1.2 corrects the evaluator before any source adjudication or canonical graph 16: construction: 17: 18: - strict edge signatures now include scope and the complete grounded ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
370: "model": raw.get("model"),
371: "reasoning_effort": raw.get("reasoning_effort"),
372: "elapsed_ms": raw.get("elapsed_ms"),
373: }
374: return results
375:
376:
377: def _edge_signature(response: dict[str, Any] | None) -> tuple[tuple[str, ...], ...]:
378: if not response:
379: return ()
380: edges = []
381: for edge in response.get("power_changes", []):
382: references = tuple(
383: sorted(
384: (
385: str(reference.get("source_id", "")).strip(),
386: str(reference.get("quote", "")).strip(),
387: )
388: for reference in edge.get("evidence_refs", [])
389: if isinstance(reference, dict)
390: )
391: )
392: edges.append(
393: ...
I’m completing the reduced audit against the current files. I’ll confirm each suspected failure through both schema and runtime entry points, rerun only the scoped tests, and leave the worktree untouched.
No files found
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
230: _validate_manifest_identity(manifest)
231: return _verify_input_payloads(
232: manifest,
233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES),
234: documents=_read_regular_file(documents),
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and ...
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
1: {
2: "$schema": "https://json-schema.org/draft/2020-12/schema",
3: "$id": "https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json",
4: "title": "Performance-blinded governance adjudication v1",
5: "type": "object",
6: "additionalProperties": false,
7: "required": [
8: "schema_version",
9: "adjudication_id",
10: "design_status",
11: "transition_dates_excluded",
12: "outcome_data_used",
13: "inputs",
14: "reviewers",
15: "records"
16: ],
17: "properties": {
18: "schema_version": {"const": 1},
19: "adjudication_id": {"type": "string", "minLength": 1},
20: "design_status": {
21: "const": "performance_blinded_llm_assisted_source_adjudication"
22: },
23: "transition_dates_excluded": {"const": true},
24: "outcome_data_used": {"const": false},
25: ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
180: "outcome_data_used": False,
181: "model_input_fields": [],
182: "documents": [
183: {
184: "record_id": "example-1",
185: "source_url": "https://github.com/acme/example/issues/1",
186: "sources": [
187: {
188: "source_id": "body",
189: "kind": "github_body",
190: "filename": None,
191: "text": "The council may approve releases.",
192: }
193: ],
194: "evidence_bounds": {
195: "source_text_truncated": False,
196: "files_listing_complete": None,
197: "patch_selection_truncated": False,
198: "patch_unavailable_count": 0,
199: },
200: },
201: ],
202: }
203:
204:
205: def _source_audit() -> dict[str, object]:
206: return {
207: "inspected_before_codings": True,
208: "source_ids": ["body"],
209: "evidence_bounds": {
210: "source_text_truncated": False,
211: ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
235: value = json.loads(candidate)
236: if not isinstance(value, dict):
237: raise ValueError("response must be an object")
238: return value
239:
240:
241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
242: errors: list[str] = []
243: if set(response) != RESPONSE_KEYS:
244: errors.append("response has missing or unexpected keys")
245: record_class = response.get("record_class")
246: if record_class not in RECORD_CLASSES:
247: errors.append("record_class is not allowed")
248: kind = response.get("event_kind")
249: if kind is not None and kind not in EVENT_KINDS:
250: errors.append("event_kind is not allowed")
251: for field in ("title", "affected_scope", "ambiguity"):
252: if response.get(field) is not None and not ...
Found 61 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 255: "reviewer_id": "opencode-gpt-5.6-sol-primary",
Line 258: "role": "source_adjudicator",
Line 268: "reviewer_ids": ["opencode-gpt-5.6-sol-primary"],
Line 593: def test_gemini_cannot_adjudicate_or_assist() -> None:
Line 595: adjudication["reviewers"][0]["model"] = "google/gemini-3.7-flash"
Line 599: assert any("Gemini is restricted to event triage" in error for error in errors)
Line 603: def test_each_record_requires_a_source_adjudicator() -> None:
Line 609: assert any("requires a source_adjudicator" in error for error in errors)
Line 613: def test_record_reviewer_ids_must_be_unique() -> None:
Line 615: reviewer_id = adjudication["records"][0]["reviewer_ids"][0]
Line 616: adjudication["records"][0]["reviewer_ids"].append(reviewer_id)
Line 620: assert any("reviewer_ids must be unique" in error for error in errors)
Line 624: ...
I’m finishing the reduced audit against the current validator lines. I’ll run a synthetic schema-plus-runtime matrix, rerun the scoped tests, and confirm the worktree is unchanged.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
230: _validate_manifest_identity(manifest)
231: return _verify_input_payloads(
232: manifest,
233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES),
234: documents=_read_regular_file(documents),
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and ...
I’ve confirmed two fail-closed crash classes. I’m now checking whether malformed evidence, decision combinations, and graph revisions can open the gate without an error, then I’ll issue the final verdict.
<path>/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json</path>
<type>file</type>
<content>
65: "sha256": {
66: "type": "string",
67: "pattern": "^[0-9a-f]{64}$"
68: },
69: "reviewer": {
70: "type": "object",
71: "additionalProperties": false,
72: "required": ["reviewer_id", "reviewer_type", "model", "role", "assistance"],
73: "properties": {
74: "reviewer_id": {"type": "string", "minLength": 1},
75: "reviewer_type": {
76: "enum": ["human", "llm", "human_llm_assisted"]
77: },
78: "model": {"type": ["string", "null"], "minLength": 1},
79: "role": {
80: "enum": ["source_adjudicator", "evidence_auditor", "synthesizer"]
81: },
82: "assistance": {"type": "string", "minLength": 1}
83: }
84: },
85: "evidence_ref": {
86: "type": "object",
87: "additionalProperties": false,
88: "required": ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
235: value = json.loads(candidate)
236: if not isinstance(value, dict):
237: raise ValueError("response must be an object")
238: return value
239:
240:
241: def validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]:
242: errors: list[str] = []
243: if set(response) != RESPONSE_KEYS:
244: errors.append("response has missing or unexpected keys")
245: record_class = response.get("record_class")
246: if record_class not in RECORD_CLASSES:
247: errors.append("record_class is not allowed")
248: kind = response.get("event_kind")
249: if kind is not None and kind not in EVENT_KINDS:
250: errors.append("event_kind is not allowed")
251: for field in ("title", "affected_scope", "ambiguity"):
252: if response.get(field) is not None and not ...
No files found
I have the two reproducible crash classes. I’m checking semantic bypasses now, especially whether invalid claim references, source-ID collisions, or unsupported graph baselines can pass runtime validation and open canonicalization.
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
180: "outcome_data_used": False,
181: "model_input_fields": [],
182: "documents": [
183: {
184: "record_id": "example-1",
185: "source_url": "https://github.com/acme/example/issues/1",
186: "sources": [
187: {
188: "source_id": "body",
189: "kind": "github_body",
190: "filename": None,
191: "text": "The council may approve releases.",
192: }
193: ],
194: "evidence_bounds": {
195: "source_text_truncated": False,
196: "files_listing_complete": None,
197: "patch_selection_truncated": False,
198: "patch_unavailable_count": 0,
199: },
200: },
201: ],
202: }
203:
204:
205: def _source_audit() -> dict[str, object]:
206: return {
207: "inspected_before_codings": True,
208: "source_ids": ["body"],
209: "evidence_bounds": {
210: "source_text_truncated": False,
211: ...
Found 38 matches
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py:
Line 28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
Line 320: required = {"reviewer_id", "reviewer_type", "model", "role", "assistance"}
Line 324: if not isinstance(reviewer.get("reviewer_id"), str) or not reviewer.get("reviewer_id"):
Line 325: errors.append(f"{path}.reviewer_id must be a non-empty string")
Line 348: reviewer_ids: set[str],
Line 360: listed_reviewers = record.get("reviewer_ids")
Line 362: errors.append(f"{prefix}: reviewer_ids must be a non-empty array")
Line 368: errors.append(f"{prefix}: reviewer_ids must contain non-empty strings")
Line 370: errors.append(f"{prefix}: reviewer_ids must be unique")
Line 371: if any(item not in reviewer_ids for item in valid_listed_reviewers):
Line 372: errors.append(f"{prefix}: reviewer_ids contains an unknown reviewer")
Line 542: ...
........................................................................ [ 92%] ...... [100%] 78 passed in 0.55s
Found 8 matches
/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json:
Line 88: "required": ["source_id", "quote"],
Line 90: "source_id": {"type": "string", "minLength": 1},
Line 97: "required": ["field", "source_id", "quote"],
Line 105: "source_id": {"type": "string", "minLength": 1},
Line 217: "required": ["inspected_before_codings", "source_ids", "evidence_bounds"],
Line 220: "source_ids": {
/home/byk/Code/institutional-transition-lab/schema/governance-coding-v1.schema.json:
Line 33: "required": ["source_id", "quote"],
Line 34: "properties": {"source_id": {"type": "string", "minLength": 1}, "quote": {"type": "string", "minLength": 1}}
The scoped suite passes, so its current assertions do not catch the crash paths. I’m now testing valid-shape semantic substitutions separately from schema-invalid inputs; only a payload that can survive the combined schema/runtime gate counts as an opening bypass.
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
230: _validate_manifest_identity(manifest)
231: return _verify_input_payloads(
232: manifest,
233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES),
234: documents=_read_regular_file(documents),
235: coding_package=_read_regular_file(coding_package),
236: protocol=_read_regular_file(protocol),
237: coding_schema=_read_regular_file(coding_schema),
238: adjudication_schema=_read_regular_file(adjudication_schema),
239: ).pins
240:
241:
242: def _duplicates(values: list[str]) -> set[str]:
243: counts = Counter(values)
244: return {value for value, count in counts.items() if count > 1}
245:
246:
247: def _source_index(document: dict[str, Any]) -> dict[str, str]:
248: sources = {
249: source["source_id"]: source["text"]
250: for source in document.get("sources", [])
251: if isinstance(source, dict)
252: and ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py</path>
<type>file</type>
<content>
260: if (
261: isinstance(confidence, bool)
262: or not isinstance(confidence, int | float)
263: or not math.isfinite(float(confidence))
264: or not 0 <= float(confidence) <= 1
265: ):
266: errors.append("confidence must be between zero and one")
267:
268: source_map = {
269: source.get("source_id"): source.get("text")
270: for source in document.get("sources", [])
271: if isinstance(source, dict)
272: }
273: changes = response.get("power_changes")
274: if not isinstance(changes, list):
275: errors.append("power_changes must be an array")
276: changes = []
277: for index, change in enumerate(changes):
278: prefix = f"power_changes[{index}]"
279: if not isinstance(change, dict) or set(change) != POWER_KEYS:
280: ...
Found 35 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 275: "graph_edge_revision": {
Line 276: "basis": "luna_a",
Line 320: "graph_edge_revision": None,
Line 365: "graph_edge_revision": {"basis": None, "added": [], "removed": []},
Line 452: adjudication["records"][0]["graph_edge_revision"]["basis"] = "luna_b"
Line 456: assert any("accept revision basis must equal accepted_from" in error for error in errors)
Line 469: record["graph_edge_revision"] = {"basis": "luna_a", "added": [], "removed": []}
Line 523: record["graph_edge_revision"] = {
Line 524: "basis": None,
Line 581: record["graph_edge_revision"] = {
Line 582: "basis": None,
Line 652: def test_input_manifest_rejects_self_consistent_substitute(field: str) -> None:
Line 683: def test_input_manifest_rejects_changed_file_bytes(
Line 729: def test_input_manifest_rejects_files_not_from_pinned_artifact(
Line 814: def ...
This is your single permitted retry after an empty result. Perform a READ-ONLY correctness audit limited to semantic validation of adjudication records/fragments in src/institution_lab/governance_adjudication.py, schema/governance-adjudication-v1.schema.json, and directly relevant semantic tests. Do not inspect source evidence bodies, performance outcomes, detector reports, transition outcomes, frozen-input/archive I/O, or CLI output publication; those scopes belong to other reviewers. Review the exact current workspace snapshot. Return substantive evidence or an explicit blocker. Report findings first, ordered by severity, with exact current file:line references and deterministic regression ideas. Classify each point PASS, CONCERN, or MUST-FIX, and end exactly MERGE or DO-NOT-MERGE. Never edit files.
I’ll verify the current line map and run only in-memory synthetic semantic probes plus the scoped test file. I will not read any frozen records, source bodies outside the synthetic fixture, reports, or publication code.
No files found
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
I’m limiting the remaining checks to the validator’s in-memory record/fragment entry points and synthetic fixtures. I will run selected semantic tests rather than the file’s unrelated I/O and publication tests.
Found 17 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 120: def test_adjudication_schema_matches_validator_ontology() -> None: Line 142: def test_schema_enforces_uri_and_date_formats(field: str, value: str) -> None: Line 312: def test_one_abstention_keeps_canonicalization_gate_closed() -> None: Line 332: def test_record_ids_must_match_frozen_documents_exactly_once(mutation: str) -> None: Line 345: def test_accept_must_equal_the_named_frozen_response() -> None: Line 355: def test_resolved_decision_cannot_leave_final_coding_abstained() -> None: Line 382: def test_source_audit_must_match_complete_frozen_document(field: str, value: object) -> None: Line 406: def test_institutional_class_and_dates_must_agree( Line 423: def test_bounded_source_requires_explicit_evidence_limitation() -> None: Line 450: def test_accept_edge_revision_uses_the_accepted_response() -> None: Line 460: def ...
Found 9 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 23: validate_adjudication_fragment,
Line 979: def test_committed_partial_fragment_validates_but_cannot_be_the_full_envelope() -> None:
Line 981: fragment = json.loads((input_directory / "fragments/opentofu-a2.json").read_text())
Line 986: assert validate_adjudication_fragment(fragment, documents, coding_package, schema) == []
Line 987: assert validate_against_schema(fragment, schema)
Line 990: def test_malformed_fragment_record_id_fails_closed() -> None:
Line 992: fragment = json.loads((input_directory / "fragments/opentofu-a2.json").read_text())
Line 996: fragment["records"][0]["record_id"] = {"invalid": "record ID"}
Line 998: errors = validate_adjudication_fragment(fragment, documents, coding_package, schema)
### Current State - **Date:** September 9, 2026. - **Active task:** Read-only adversarial correctness audit for issue #4 in `/home/byk/Code/institutional-transition-lab`, restricted by the user to record and fragment semantic validation in current uncommitted code/tests. - **Required final deliverable:** A substantive report even if no defects are found, findings ordered by severity, exact curren…
Date: Sep 9, 2026 * 🔴 [enforced-workflow] (09:11) User stated this is the single permitted retry after an empty result. * 🔴 [requested-review] (09:11) User requested a READ-ONLY correctness audit limited to semantic validation of adjudication records/fragments in `src/institution_lab/governance_adjudication.py`, `schema/governance-adjudication-v1.schema.json`, and directly relevant semantic tes…
Date: Sep 9, 2026 * 🟡 (06:18) Search found 38 reviewer-related matches in `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py`, including `REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}`, reviewer validation around lines 320–340, duplicate reviewer-ID checks around lines 542–549 and 694–701, and per-record `source_adjudicator` r…
* 🟡 (06:04) `schema/governance-adjudication-v1.schema.json` defines `evidence_ref` with exactly `source_id` and `quote`, both non-empty strings; `claim_evidence_ref` additionally requires `field`, restricted to `record_class`, `event_kind`, `title`, `announced_on`, `effective_on`, `affected_scope`, or `body_patch_relation`. * 🟡 (06:04) `schema/governance-adjudication-v1.schema.json` defines `po…
* 🟡 (05:46) Repository search found 61 matches related to adjudication reviewers across `tests/test_governance_adjudication.py`, `src/institution_lab/governance_adjudication.py`, and `schema/governance-adjudication-v1.schema.json`. * 🟡 (05:46) `src/institution_lab/governance_adjudication.py` defines `REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}` at line 28 and requ…
* 🟡 (05:35) Inspected `src/institution_lab/governance_coding.py:241-315`: `validate_response(response: dict[str, Any], document: dict[str, Any]) -> list[str]` requires the response key set to equal `RESPONSE_KEYS`, validates `record_class` against `RECORD_CLASSES`, permits `event_kind=None` or a value in `EVENT_KINDS`, requires non-null `title`, `affected_scope`, and `ambiguity` values to be non…
* 🟡 (05:09) `research/oss-governance-coding-protocol-v1.2.md` is titled “Performance-blinded OSS governance coding protocol v1.2,” frozen 2026-08-27, with status `pre-adjudication evaluator correction; model-informed development protocol`. * 🟡 (05:09) Protocol V1.2 correction background: the V1.1 run used the intended frozen 40-record manifest and unchanged coders, but its mandatory artifact au…
* 🟡 (04:57) `src/institution_lab/governance_adjudication.py` lines 779-825 define `render_markdown(adjudication, summary)`: reports `canonicalization_gate`, decision/class counts, per-record decision/final class/reviewers/evidence limitations, unresolved IDs, frozen input pins, reviewer provenance, and graph-edge revision added/removed counts. * 🟡 (04:57) Output-safety implementation in `src/in…
* 🟡 (04:41) Source-ID search found 10 matches across `schema/governance-adjudication-v1.schema.json` and `schema/governance-coding-v1.schema.json`: adjudication schema lines 88, 90, 97, 105, 217, 220, 223, and 250; coding schema lines 33 and 34. * 🟡 (04:46) Synthetic regression `full_unhashable_adjudication_id` raised `TypeError: unhashable type: 'dict'` and also produced 2 schema errors. * 🟡 …
* 🟡 (04:38) `schema/governance-adjudication-v1.schema.json` is a JSON Schema Draft 2020-12 document with `$id` `https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json`, title `Performance-blinded governance adjudication v1`, top-level `additionalProperties: false`, and exactly 270 lines. * 🟡 (04:38) The adjudication schema requires top-level fields `schema_vers…
* 🟡 (04:29) In `src/institution_lab/governance_adjudication.py`, `_source_index()` builds evidence sources from each frozen document’s `sources` entries and adds synthetic `record_metadata` containing canonical JSON for `record_id`, `source_url`, `published_on`, `publisher`, and `source_type`. * 🟡 (04:29) `_evidence_errors()` in `src/institution_lab/governance_adjudication.py` requires evidence…
* 🟡 (04:27) Repository working tree showed modified files `pyproject.toml` and `uv.lock`; untracked files/directories `.lore.md`, `AGENTS.md`, `cases/review/oss-governance-adjudication-v1.inputs.json`, `cases/review/oss-governance-adjudication-v1/`, `schema/governance-adjudication-v1.schema.json`, `src/institution_lab/governance_adjudication.py`, and `tests/test_governance_adjudication.py`. * 🟡…
* 🟡 (04:18) In `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py`, `_edge_signature(response)` returns `()` for a missing response; otherwise it canonicalizes each `power_changes` edge using stripped `actor`, `right_kind`, `target`, `direction`, `change_status`, and `scope`, plus JSON-serialized sorted `(source_id, quote)` evidence-reference tuples, then retur…
* 🟡 (04:12) `/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`, `evidenc…
* 🟡 (04:12) A tool search returned `No files found`; no files were modified. * 🟡 (04:12) In `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py` lines 250-260, `_source_index()` retains only sources whose `source_id` and `text` are strings, then adds synthetic source `record_metadata` containing canonical compact JSON of `record_id`, `source_url`, `publis…
* 🟡 (03:59) Assistant stated the reduced audit plan: confirm each candidate against the schema-plus-runtime path, run deterministic synthetic regressions, and verify the worktree remains unchanged. * 🟡 (03:59) `/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py` lines 613-631 contain regressions ensuring duplicate per-record `reviewer_ids` emit `reviewer_ids must …
* 🟡 (03:48) A file-search tool invocation returned `No files found`; the search target/pattern was not shown. * 🟡 (03:52) In `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py`, `_evidence_errors(reference, sources, path, *, claim=False)` requires an evidence reference to be a dict with exactly `{"source_id", "quote"}` or, for claim references, exactly `…
* 🟡 (03:34) Investigation identified two candidate governance-adjudication failures: 1. malformed identifiers may crash semantic validators; 2. an ungrounded claim reference may incorrectly satisfy the institutional-field coverage check. Planned investigation: trace both through full-envelope and fragment validation paths, then run a broader synthetic fail-closed matrix and scoped tests. * 🟡 (0…
* 🟡 (03:34) `/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py` helper `_documents()` creates one frozen document: `record_id="example-1"`, `source_url="https://github.com/acme/example/issues/1"`, and source `body` with text `The council may approve releases.` Its evidence bounds are `source_text_truncated=False`, `files_listing_complete=None`, `patch_selection_tr…
* 🟡 (03:18) `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_coding.py` defines `_hash(payload)` as canonical compact sorted-key JSON encoded to bytes and hashed with SHA-256; `_valid_date(value)` accepts `None` or an exactly round-tripping ISO date via `date.fromisoformat(value).isoformat() == value`; `_nonempty(value)` requires a non-whitespace string. * 🟡 (03:18) `…
* 🟡 (03:15) `/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py` is 1,024 lines long; the displayed excerpt covers lines 1–185 and imports `DECISIONS`, `FROZEN_INPUT_PINS`, `REQUIRED_INPUT_PINS`, `REVIEWER_ROLES`, `REVIEWER_TYPES`, `canonical_sha256`, `file_sha256`, `validate_adjudication`, `validate_adjudication_fragment`, `validate_against_schema`, and `verify_in…
* 🟡 (02:57) `/home/byk/Code/institutional-transition-lab/schema/governance-adjudication-v1.schema.json` is a JSON Schema Draft 2020-12 object schema titled `Performance-blinded governance adjudication v1`; it forbids additional properties and requires `schema_version`, `adjudication_id`, `design_status`, `transition_dates_excluded`, `outcome_data_used`, `inputs`, `reviewers`, and `records`. * 🟡…
* 🟡 (02:53) Further inspection of `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py` revealed a separate `validate_adjudication_fragment()` implementation beginning at line 659, beyond the previously inspected lines 1–658. * 🟡 (02:53) `validate_adjudication_fragment()` defines and applies fragment-level structural validation, validates each reviewer wit…
* 🟡 (02:39) Inspected `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py` lines 1–658, including frozen-input verification, evidence grounding, reviewer and record validation, graph-edge diffing, summary generation, and canonicalization-gate logic. * 🟡 (02:39) `governance_adjudication.py` defines `DECISIONS = {"accept", "revise", "reject", "abstain"}`, i…
* 🟡 (02:35) Inspected `/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py` lines 180–619, covering fixture helpers and validator tests. * 🟡 (02:35) `_source_audit()` at `/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py` lines 205–215 returns `inspected_before_codings: True`, `source_ids: ["body"]`, and evidence bounds with `source_…
* 🟡 (02:19) Repository search found `validate_adjudication_fragment` references at `/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py` lines 986 and 998, with the implementation at `/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py` line 659. * 🟡 (02:20) Inspected `validate_adjudication_fragment()` in `/home/byk/Code/insti…
* 🟡 (02:12) Validation probe results showed no reported errors for `irrelevant_claim_quotes`, `blank_rationale`, `blank_reviewer`, or `duplicate_source_id`; each returned `[]`. * 🟡 (02:12) The `unhashable_ids_full` probe crashed with `TypeError: unhashable type: 'dict'`. * 🟡 (02:12) The `none_sources` probe crashed with `TypeError: 'NoneType' object is not iterable`. * 🟡 (02:12) The `none_pac…
* 🟡 (02:04) Environment command using `python` failed with `/usr/bin/bash: line 1: python: command not found`; the `python` executable is unavailable under that name. * 🟡 (02:04) `main()` in `src/institution_lab/governance_adjudication.py` defines required `Path` CLI arguments: `--adjudication`, `--input-manifest`, `--documents`, `--coding-package`, `--artifact`, `--protocol`, `--coding-schema`…
* 🟡 (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 …
Date: September 9, 2026 * 🟡 (01:56) src/institution_lab/governance_adjudication.py implements graph_edge_diff(baseline, final_coding) by canonicalizing each power_changes edge with json.dumps(edge, sort_keys=True, separators=(",", ":")); it returns deterministically key-sorted added and removed edges based on set differences. * 🟡 (01:56) _validate_record() in src/institution_lab/governance_adju…
* 🟡 (01:54) Search for graph_edge_revision found exactly 51 matches across tests/test_governance_adjudication.py, src/institution_lab/governance_adjudication.py, schema/governance-adjudication-v1.schema.json, and 7 adjudication fragment JSON files. * 🟡 (01:54) tests/test_governance_adjudication.py graph_edge_revision matches occur at lines 275, 320, 365, 452, 469, 523, 581, and 1020. Line 320 a…
* 🟡 (01:42) schema/governance-adjudication-v1.schema.json is a JSON Schema Draft 2020-12 document with $id="https://institutional-transition-lab.local/schema/governance-adjudication-v1.schema.json", title="Performance-blinded governance adjudication v1", type=object, and additionalProperties=false. * 🟡 (01:42) The governance adjudication envelope requires schema_version, adjudication_id, design…
* 🟡 (01:39) In src/institution_lab/governance_adjudication.py, validate_adjudication_fragment() builds a strict fragment schema requiring schema_version=1, design_status="performance_blinded_llm_assisted_source_adjudication", at least 1 reviewer, and at least 1 record, with additionalProperties=False and $defs copied from the adjudication schema. * 🟡 (01:39) validate_adjudication_fragment() val…
* 🟡 (01:19) In tests/test_governance_adjudication.py, test_cli_validates_the_same_bytes_it_verifies() mutates paths["documents"] inside a monkeypatched verify_input_manifest() call and expects _run_cli() to raise ValueError matching "input manifest mismatch: documents_file_sha256", testing that CLI validation uses the exact bytes it verified. * 🟡 (01:19) test_cli_rejects_output_aliases_to_froze…
* 🟡 (01:15) User supplied a pytest suite for institution_lab.governance_adjudication. The suite imports validator constants including DIRECTIONS and CHANGE_STATUSES and checks the adjudication schema’s power_change.change_status enum against CHANGE_STATUSES. * 🟡 (01:15) The adjudication tests define _run_cli(monkeypatch: pytest.MonkeyPatch, paths: dict[str, Path]) and invoke governance_adjudica…
* 🟡 (01:14) src/institution_lab/governance_adjudication.py imports validate_response from institution_lab.governance_coding and defines DECISIONS={"accept","revise","reject","abstain"}, INSTITUTIONAL_CLASSES={"effective_institutional_change","announced_institutional_change","proposal_only"}, REVIEWER_TYPES={"human","llm","human_llm_assisted"}, REVIEWER_ROLES={"source_adjudicator","evidence_audit…
* 🟡 (01:08) Search found exactly 22 matches in src/institution_lab/governance_coding.py for record_class, power_changes, evidence_refs, and validate_response: record_class at lines 70, 245, 246, 247, 304, 310, 313, 429, and 448; power_changes at lines 77, 273, 275, 278, 291, 293, 297, 302, 310, 312, and 381; evidence_refs at lines 88, 291, 293, 297, 302, and 388; validate_response() defined at l…
Date: September 9, 2026 * 🟡 (00:26) schema/governance-adjudication-v1.schema.json:69-83 defines reviewer as an exact-key object requiring reviewer_id, reviewer_type, model, role, and assistance; reviewer_type enum is human, llm, human_llm_assisted; role enum is source_adjudicator, evidence_auditor, synthesizer; model is a non-empty string or null. * 🟡 (00:26) schema/governance-adjudication-v1.s…
* 🟡 (00:24) Repository root /home/byk/Code/institutional-transition-lab contained 23 entries: .git/, .github/, .gitignore, .lore.md, .pytest_cache/, .ruff_cache/, .venv/, AGENTS.md, cases/, data/, docs/, node_modules/, package-lock.json, package.json, PROTOCOL.md, pyproject.toml, README.md, research/, schema/, scripts/, src/, tests/, uv.lock. * 🟡 (00:24) Located scoped implementation functions …
Date: Sep 9, 2026 * 🔴 [requested-audit] (00:22) User requested a read-only adversarial correctness audit for issue #4 in /home/byk/Code/institutional-transition-lab, limited to record and fragment semantic validation in current uncommitted code and tests. * 🔴 (00:22) Audit scope includes src/institution_lab/governance_adjudication.py functions _source_index, _evidence_errors, _response_for, gra…