informed-decision/informed_decision/__main__.py

32 lines
848 B
Python
Raw Permalink Normal View History

Promote schema and canonicalizer out of history; add EvidenceModel (T06) Verified the three published hashes reproduce byte for byte before promoting anything, then moved the schema, canonicalizer and vectors into governed assets. history/20260909-initial-exploration/ is untouched and stays the provenance record. - schemas/, informed_decision/, tests/vectors/ populated; the reference canonicalizer's ad-hoc __main__ block replaced by a real `python -m informed_decision` entry point. - tests/test_canonicalize.py — 20 tests, all green. Published vectors, all four isolation properties, canonical-form round-trip, key sorting, and a provenance test asserting the governed fixtures have not drifted from history/. - docs/specs/EvidenceModel.md — the two hashes, the split and why it exists, the four isolation properties, the presentation record, the bundle, and the relationship to audit-core. - pyproject.toml, Makefile. One test of mine was wrong on first run: it scanned for ", " to assert no insignificant whitespace, which fires on prose inside a brief. Replaced with a canonical round-trip comparison, which is the property actually meant. The canonicalizer was correct. EvidenceModel leads with what the model does NOT claim — no proof of comprehension, no proof of reading (deliberately, since the alternative is surveillance), no survival of a compromised surface, and audit-core's inherited bound that a hash chain cannot prove a record was never sent. T06 stays progress: the SCOPE.md rewrite is gated on the T02 ruling. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3W1dQG7GFFM9d94jFx7iR Assistant: claude-code Assistant-Model: opus Assistant-Process: 1565372@bnt-lap001 Assistant-Session: 16bb2f25-b34c-49ef-8e94-5fec3567a568
2026-09-09 14:16:28 +02:00
"""CLI: compute a view_hash or awareness_hash over a document.
python -m informed_decision <path.json> [view|awareness]
"""
from __future__ import annotations
import json
import pathlib
import sys
from .canonicalize import awareness_hash, view_hash
def main(argv: list[str]) -> int:
if not argv:
print(__doc__, file=sys.stderr)
return 2
data = json.loads(pathlib.Path(argv[0]).read_text(encoding="utf-8"))
kind = argv[1] if len(argv) > 1 else "view"
if kind not in ("view", "awareness"):
print(f"unknown kind {kind!r}; expected 'view' or 'awareness'", file=sys.stderr)
return 2
result = view_hash(data) if kind == "view" else awareness_hash(data)
print(result["canonical"])
print(result["hex"])
return 0
if __name__ == "__main__":
raise SystemExit(main(sys.argv[1:]))