2626}
2727'''
2828
29+ NON_KERNEL_CONTRACT = '''
30+ attempt wave6_measured_cognition {
31+ purpose "Test measured correction"
32+ non_goal "Do not claim AGI"
33+ claim_boundary "Research candidate only"
34+ require human_approval reason "Human review required"
35+ handoff_contract OtherKernel schema ix.cognition.contract.v1
36+
37+ obligation prediction_before_trial {
38+ evidence_required prediction_record
39+ falsify_if prediction_missing
40+ }
41+ }
42+ '''
43+
2944
3045class TestIXCognitionEvidenceBundle (unittest .TestCase ):
3146 def test_evidence_writer_exports_cognition_contract_artifacts (self ):
@@ -46,19 +61,23 @@ def test_evidence_writer_exports_cognition_contract_artifacts(self):
4661 self .assertIn ("obligations.json" , relative_files )
4762 self .assertIn ("falsification-gates.json" , relative_files )
4863 self .assertIn ("claim-boundaries.json" , relative_files )
64+ self .assertIn ("kernel-handoff.json" , relative_files )
4965
5066 manifest = json .loads ((output_dir / "manifest.json" ).read_text (encoding = "utf-8" ))
5167 summary = json .loads ((output_dir / "summary.json" ).read_text (encoding = "utf-8" ))
5268 contract = json .loads ((output_dir / "contract.json" ).read_text (encoding = "utf-8" ))
5369 obligations = json .loads ((output_dir / "obligations.json" ).read_text (encoding = "utf-8" ))
5470 gates = json .loads ((output_dir / "falsification-gates.json" ).read_text (encoding = "utf-8" ))
5571 boundaries = json .loads ((output_dir / "claim-boundaries.json" ).read_text (encoding = "utf-8" ))
72+ kernel_handoff = json .loads ((output_dir / "kernel-handoff.json" ).read_text (encoding = "utf-8" ))
5673
5774 self .assertIn ("contract.json" , manifest ["artifact_files" ])
75+ self .assertIn ("kernel-handoff.json" , manifest ["artifact_files" ])
5876 self .assertEqual (summary ["counts" ]["contract_attempts" ], 1 )
5977 self .assertEqual (summary ["counts" ]["contract_obligations" ], 1 )
6078 self .assertEqual (summary ["counts" ]["contract_evidence_requirements" ], 1 )
6179 self .assertEqual (summary ["counts" ]["contract_falsification_gates" ], 1 )
80+ self .assertEqual (summary ["counts" ]["kernel_handoff_packages" ], 1 )
6281 self .assertEqual (contract ["runtime_semantics" ], "metadata_only_not_executed" )
6382 self .assertEqual (contract ["attempts" ][0 ]["name" ], "wave6_measured_cognition" )
6483 self .assertEqual (obligations ["obligations" ][0 ]["id" ], "prediction_before_trial" )
@@ -82,11 +101,46 @@ def test_evidence_writer_exports_cognition_contract_artifacts(self):
82101 boundaries ["attempts" ][0 ]["claim_boundaries" ],
83102 ["Research candidate only" ],
84103 )
104+ self .assertEqual (kernel_handoff ["handoff_type" ], "ix.cognitionkernel.handoff" )
105+ self .assertEqual (len (kernel_handoff ["packages" ]), 1 )
106+ self .assertEqual (kernel_handoff ["packages" ][0 ]["target" ], "IX-CognitionKernel" )
107+ self .assertEqual (kernel_handoff ["packages" ][0 ]["schema" ], "ix.cognition.contract.v1" )
108+ self .assertEqual (kernel_handoff ["packages" ][0 ]["execution_authority" ], "none" )
109+ self .assertFalse (kernel_handoff ["packages" ][0 ]["self_certification_allowed" ])
110+ self .assertTrue (kernel_handoff ["packages" ][0 ]["human_authority_required" ])
111+ self .assertEqual (
112+ kernel_handoff ["packages" ][0 ]["obligations" ][0 ]["id" ],
113+ "prediction_before_trial" ,
114+ )
115+ self .assertTrue (kernel_handoff ["packages" ][0 ]["obligations" ][0 ]["canonical" ])
116+ self .assertEqual (
117+ kernel_handoff ["packages" ][0 ]["obligations" ][0 ]["canonical_definition" ]["id" ],
118+ "prediction_before_trial" ,
119+ )
85120 self .assertIn (
86- "does not certify AGI " ,
121+ "IX-CognitionKernel handoff packages captured: 1 " ,
87122 (output_dir / "assurance-claims.md" ).read_text (encoding = "utf-8" ),
88123 )
89124
125+ def test_kernel_handoff_payload_is_empty_without_kernel_target (self ):
126+ source_file = self ._write_ix (NON_KERNEL_CONTRACT )
127+ program = parse_ix (source_file .read_text (encoding = "utf-8" ), filename = str (source_file ))
128+ result = run_ix (program )
129+ output_dir = Path (self ._tempdir .name ) / "non-kernel-bundle"
130+
131+ EvidenceBundleWriter ().write_bundle (
132+ result ,
133+ source_file = source_file ,
134+ output_dir = output_dir ,
135+ command = "unit-test" ,
136+ )
137+
138+ summary = json .loads ((output_dir / "summary.json" ).read_text (encoding = "utf-8" ))
139+ kernel_handoff = json .loads ((output_dir / "kernel-handoff.json" ).read_text (encoding = "utf-8" ))
140+
141+ self .assertEqual (summary ["counts" ]["kernel_handoff_packages" ], 0 )
142+ self .assertEqual (kernel_handoff ["packages" ], [])
143+
90144 def test_plain_ix_bundle_exports_empty_cognition_contract_artifacts (self ):
91145 source_file = self ._write_ix ('reply "Plain IX"' )
92146 program = parse_ix (source_file .read_text (encoding = "utf-8" ), filename = str (source_file ))
@@ -105,13 +159,16 @@ def test_plain_ix_bundle_exports_empty_cognition_contract_artifacts(self):
105159 obligations = json .loads ((output_dir / "obligations.json" ).read_text (encoding = "utf-8" ))
106160 gates = json .loads ((output_dir / "falsification-gates.json" ).read_text (encoding = "utf-8" ))
107161 boundaries = json .loads ((output_dir / "claim-boundaries.json" ).read_text (encoding = "utf-8" ))
162+ kernel_handoff = json .loads ((output_dir / "kernel-handoff.json" ).read_text (encoding = "utf-8" ))
108163
109164 self .assertEqual (summary ["counts" ]["contract_attempts" ], 0 )
110165 self .assertEqual (summary ["counts" ]["contract_obligations" ], 0 )
166+ self .assertEqual (summary ["counts" ]["kernel_handoff_packages" ], 0 )
111167 self .assertEqual (contract ["attempts" ], [])
112168 self .assertEqual (obligations ["obligations" ], [])
113169 self .assertEqual (gates ["falsification_gates" ], [])
114170 self .assertEqual (boundaries ["attempts" ], [])
171+ self .assertEqual (kernel_handoff ["packages" ], [])
115172
116173 def test_cli_evidence_command_lists_cognition_artifacts (self ):
117174 source_file = self ._write_ix (COGNITION_CONTRACT )
@@ -127,7 +184,8 @@ def test_cli_evidence_command_lists_cognition_artifacts(self):
127184 self .assertIn ("- obligations.json" , output )
128185 self .assertIn ("- falsification-gates.json" , output )
129186 self .assertIn ("- claim-boundaries.json" , output )
130- self .assertTrue ((output_dir / "contract.json" ).exists ())
187+ self .assertIn ("- kernel-handoff.json" , output )
188+ self .assertTrue ((output_dir / "kernel-handoff.json" ).exists ())
131189
132190 def setUp (self ):
133191 self ._tempdir = tempfile .TemporaryDirectory ()
0 commit comments