# CorpusFetch Method Slice (Zero-Prose Python Stdlib Reference) # Canonical Residual: https://corpusfetch.com/c/how-must-an-instance-record-the-provenance-of-a-decision-made-under-time-pressure-with-incomplete-information.md # Remnant Warrant: https://corpusfetch.com/c/how-must-an-instance-record-the-provenance-of-a-decision-made-under-time-pressure-with-incomplete-information.warrant.json # Markdown SHA-256: f2e0938c3b440d6531cdc74d73595d483621bd47d8821f69d46037cfba26f039 # Code AST SHA-256: c6a9a1fc19f3051e2c867850301ff6c31a5a44d127a5e4cac10204e42c7a8e78 # Verified Classes: ConstraintVerdict, DecisionContext, ConstraintPolicy, ConstraintManifest, ConstraintDecisionGuard # Defensive Guards: 0 fail-closed invariants (zero external deps) from dataclasses import dataclass from enum import Enum, auto import hashlib import json class ConstraintVerdict(Enum): FULL_INFORMATION_DECISION = auto() CONSTRAINT_DECISION_ACKNOWLEDGED = auto() CONSTRAINT_DECISION_UNACKNOWLEDGED = auto() @dataclass(frozen=True) class DecisionContext: decision_epoch: float deadline_epoch: float known_information_hash: str missing_information_items: tuple[str, ...] constraint_acknowledgment: str | None @dataclass(frozen=True) class ConstraintPolicy: require_constraint_acknowledgment: bool @dataclass(frozen=True) class ConstraintManifest: verdict: ConstraintVerdict directive: str manifest_digest: str class ConstraintDecisionGuard: @staticmethod def _hash(data: str) -> str: return hashlib.sha256(data.encode("utf-8")).hexdigest() @classmethod def evaluate_decision( cls, ctx: DecisionContext, policy: ConstraintPolicy ) -> ConstraintManifest: # Gate 1: Time pressure check time_pressure = (ctx.deadline_epoch - ctx.decision_epoch) >= 0 information_missing = len(ctx.missing_information_items) > 0 # Gate 2: Full information decision if not information_missing: digest = cls._hash(json.dumps({ "decision_epoch": f"{ctx.decision_epoch:.0f}", "known": ctx.known_information_hash, "missing": "NONE" }, sort_keys=True)) return ConstraintManifest( verdict=ConstraintVerdict.FULL_INFORMATION_DECISION, directive="PROCEED: Decision made with complete information.", manifest_digest=digest ) # Gate 3: Constraint acknowledgment if not ctx.constraint_acknowledgment: if policy.require_constraint_acknowledgment: return ConstraintManifest( verdict=ConstraintVerdict.CONSTRAINT_DECISION_UNACKNOWLEDGED, directive=f"HALT: {len(ctx.missing_information_items)} information gaps unacknowledged.", manifest_digest=cls._hash("NO_ACK") ) return ConstraintManifest( verdict=ConstraintVerdict.CONSTRAINT_DECISION_UNACKNOWLEDGED, directive="WARN: Missing information but no acknowledgment. Hindsight bias risk.", manifest_digest=cls._hash("WARN_NO_ACK") ) # Gate 4: Constraint acknowledged digest = cls._hash(json.dumps({ "known": ctx.known_information_hash, "missing": tuple(sorted(ctx.missing_information_items)), "deadline": f"{ctx.deadline_epoch:.0f}", "ack": ctx.constraint_acknowledgment }, sort_keys=True)) return ConstraintManifest( verdict=ConstraintVerdict.CONSTRAINT_DECISION_ACKNOWLEDGED, directive=f"PROCEED: Decision acknowledged as constraint-driven with {len(ctx.missing_information_items)} gaps.", manifest_digest=digest )