Skip to content

Commit abf4502

Browse files
authored
Add satisfaction and failure report payloads
1 parent 89dd647 commit abf4502

1 file changed

Lines changed: 155 additions & 2 deletions

File tree

ix/evidence.py

Lines changed: 155 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def write_bundle(
4646
contract_metadata = self._contract_metadata(result)
4747
contract_counts = self._contract_counts(contract_metadata)
4848
kernel_handoff_payload = self._kernel_handoff_payload(contract_metadata)
49+
satisfaction_report = self._satisfaction_report_payload(contract_metadata)
50+
failure_report = self._failure_report_payload(contract_metadata)
4951

5052
artifact_files = [
5153
"summary.json",
@@ -60,6 +62,8 @@ def write_bundle(
6062
"falsification-gates.json",
6163
"claim-boundaries.json",
6264
"kernel-handoff.json",
65+
"satisfaction-report.json",
66+
"failure-report.json",
6367
"outputs.txt",
6468
"replies.txt",
6569
"assurance-claims.md",
@@ -110,6 +114,12 @@ def write_bundle(
110114
"kernel_handoff_packages": len(
111115
kernel_handoff_payload["packages"]
112116
),
117+
"satisfaction_report_items": self._report_obligation_count(
118+
satisfaction_report
119+
),
120+
"failure_report_gates": self._report_failure_gate_count(
121+
failure_report
122+
),
113123
},
114124
"variables": result_payload["variables"],
115125
"memory": result_payload["memory"],
@@ -149,6 +159,18 @@ def write_bundle(
149159
kernel_handoff_payload,
150160
)
151161
)
162+
files.append(
163+
self._write_json(
164+
output_dir / "satisfaction-report.json",
165+
satisfaction_report,
166+
)
167+
)
168+
files.append(
169+
self._write_json(
170+
output_dir / "failure-report.json",
171+
failure_report,
172+
)
173+
)
152174
files.append(self._write_text(output_dir / "outputs.txt", "\n".join(result.outputs) + "\n"))
153175
files.append(self._write_text(output_dir / "replies.txt", "\n".join(result.replies) + "\n"))
154176
files.append(self._write_text(output_dir / "assurance-claims.md", self._claims_text(result)))
@@ -305,6 +327,126 @@ def _kernel_obligation_payload(self, obligation: dict[str, Any]) -> dict[str, An
305327

306328
return payload
307329

330+
def _satisfaction_report_payload(self, metadata: dict[str, Any]) -> dict[str, Any]:
331+
attempts: list[dict[str, Any]] = []
332+
333+
for attempt in self._attempts(metadata):
334+
attempt_name = str(attempt.get("name", ""))
335+
attempts.append(
336+
{
337+
"attempt": attempt_name,
338+
"status": "not_evaluated",
339+
"evaluation_state": "pending_downstream_evidence",
340+
"reason": (
341+
"IX exported the cognition contract but did not execute "
342+
"or satisfy downstream cognition obligations."
343+
),
344+
"human_authority_required": bool(
345+
attempt.get("human_approval_required", [])
346+
),
347+
"obligations": [
348+
self._satisfaction_obligation_payload(obligation)
349+
for obligation in self._obligations(attempt)
350+
],
351+
}
352+
)
353+
354+
return {
355+
"schema_version": "1.0",
356+
"report_type": "ix.cognition.satisfaction_report",
357+
"runtime_semantics": metadata.get("runtime_semantics"),
358+
"status": "not_evaluated",
359+
"evaluation_state": "pending_downstream_evidence",
360+
"attempts": attempts,
361+
}
362+
363+
def _satisfaction_obligation_payload(self, obligation: dict[str, Any]) -> dict[str, Any]:
364+
obligation_id = str(obligation.get("id", ""))
365+
definition = get_cognition_obligation(obligation_id)
366+
return {
367+
"id": obligation_id,
368+
"source": obligation.get("source"),
369+
"canonical": definition is not None,
370+
"status": "pending_downstream_evidence",
371+
"satisfied": None,
372+
"required_evidence": list(obligation.get("evidence_required", [])),
373+
"received_evidence": [],
374+
"declared_falsification_gates": list(obligation.get("falsify_if", [])),
375+
"review_required": True,
376+
"notes": (
377+
"Satisfaction cannot be asserted by IX export alone. "
378+
"Downstream measured evidence and human review are required."
379+
),
380+
}
381+
382+
def _failure_report_payload(self, metadata: dict[str, Any]) -> dict[str, Any]:
383+
attempts: list[dict[str, Any]] = []
384+
385+
for attempt in self._attempts(metadata):
386+
attempt_name = str(attempt.get("name", ""))
387+
attempts.append(
388+
{
389+
"attempt": attempt_name,
390+
"status": "not_evaluated",
391+
"evaluation_state": "pending_downstream_evidence",
392+
"claim_blocking_semantics": (
393+
"Any triggered falsification gate blocks advancement "
394+
"or AGI-candidate claims until human review resolves it."
395+
),
396+
"failure_conditions": [
397+
self._failure_condition_payload(obligation, condition)
398+
for obligation in self._obligations(attempt)
399+
for condition in obligation.get("falsify_if", [])
400+
],
401+
}
402+
)
403+
404+
return {
405+
"schema_version": "1.0",
406+
"report_type": "ix.cognition.failure_report",
407+
"runtime_semantics": metadata.get("runtime_semantics"),
408+
"status": "not_evaluated",
409+
"evaluation_state": "pending_downstream_evidence",
410+
"claim_blocking_semantics": (
411+
"Falsification reports are claim-blocking once a listed gate "
412+
"is triggered by downstream evidence."
413+
),
414+
"attempts": attempts,
415+
}
416+
417+
def _failure_condition_payload(
418+
self,
419+
obligation: dict[str, Any],
420+
condition: Any,
421+
) -> dict[str, Any]:
422+
return {
423+
"obligation": obligation.get("id"),
424+
"condition": condition,
425+
"source": obligation.get("source"),
426+
"triggered": None,
427+
"status": "not_evaluated",
428+
"claim_blocking": True,
429+
"required_resolution": "human_review",
430+
"notes": (
431+
"IX exported this falsification gate but did not evaluate "
432+
"whether it was triggered."
433+
),
434+
}
435+
436+
def _report_obligation_count(self, report: dict[str, Any]) -> int:
437+
return sum(
438+
len(attempt.get("obligations", []))
439+
for attempt in report.get("attempts", [])
440+
if isinstance(attempt, dict)
441+
)
442+
443+
def _report_failure_gate_count(self, report: dict[str, Any]) -> int:
444+
return sum(
445+
len(attempt.get("failure_conditions", []))
446+
for attempt in report.get("attempts", [])
447+
if isinstance(attempt, dict)
448+
)
449+
308450
def _attempts(self, metadata: dict[str, Any]) -> list[dict[str, Any]]:
309451
attempts = metadata.get("attempts", [])
310452
if not isinstance(attempts, list):
@@ -346,6 +488,8 @@ def _claims_text(self, result: ExecutionResult) -> str:
346488
contract_metadata = self._contract_metadata(result)
347489
contract_counts = self._contract_counts(contract_metadata)
348490
kernel_handoff_payload = self._kernel_handoff_payload(contract_metadata)
491+
satisfaction_report = self._satisfaction_report_payload(contract_metadata)
492+
failure_report = self._failure_report_payload(contract_metadata)
349493
return (
350494
"# IX Assurance Claims\n\n"
351495
"This evidence bundle supports only bounded, runtime-observed claims.\n\n"
@@ -360,11 +504,17 @@ def _claims_text(self, result: ExecutionResult) -> str:
360504
f"- Cognition attempt contracts captured: {contract_counts['attempts']}.\n"
361505
f"- Cognition obligations captured: {contract_counts['obligations']}.\n"
362506
f"- IX-CognitionKernel handoff packages captured: "
363-
f"{len(kernel_handoff_payload['packages'])}.\n\n"
507+
f"{len(kernel_handoff_payload['packages'])}.\n"
508+
f"- Satisfaction report obligations listed: "
509+
f"{self._report_obligation_count(satisfaction_report)}.\n"
510+
f"- Failure report gates listed: "
511+
f"{self._report_failure_gate_count(failure_report)}.\n\n"
364512
"## Not claimed\n\n"
365513
"- This bundle does not certify the script as safe, complete, lawful, or production-ready.\n"
366514
"- This bundle does not prove external system behavior beyond the deterministic IX runtime output.\n"
367515
"- This bundle does not execute or certify cognition-contract obligations.\n"
516+
"- This bundle does not mark cognition obligations as satisfied.\n"
517+
"- This bundle does not evaluate whether falsification gates were triggered.\n"
368518
"- This bundle does not certify AGI, AGI-candidate status, or deployment readiness.\n"
369519
"- This bundle does not grant IX-CognitionKernel execution authority.\n"
370520
"- This bundle does not replace human review.\n"
@@ -386,5 +536,8 @@ def _limitations_text(self) -> str:
386536
"transfer, certify AGI, or authorize self-approval.\n\n"
387537
"IX-CognitionKernel handoff packages are reviewable contract packages only. They do "
388538
"not grant execution authority, deployment authority, self-modification authority, "
389-
"or AGI-certification authority.\n"
539+
"or AGI-certification authority.\n\n"
540+
"Satisfaction and failure reports are schemas for downstream evidence review. They "
541+
"start in `not_evaluated` state. IX export alone cannot mark obligations satisfied "
542+
"and cannot decide whether falsification gates were triggered.\n"
390543
)

0 commit comments

Comments
 (0)