1+ from __future__ import annotations
2+
13from typing import Any
24
35import pytest
46
57from ix_cognition_kernel .wave6_falsification import WaveSixFalsificationProbeKind
68from ix_cognition_kernel .wave6_gap_register import (
7- WaveSixGapKind ,
9+ WaveSixGapDisposition ,
810 WaveSixGapSeverity ,
911 WaveSixGapState ,
1012)
1113from ix_cognition_kernel .wave6_ix_handoff import (
1214 CANONICAL_IX_COGNITION_OBLIGATIONS ,
13- IX_COGNITION_CONTRACT_SCHEMA ,
14- IX_COGNITION_KERNEL_TARGET ,
15- IX_KERNEL_HANDOFF_TYPE ,
16- IX_KERNEL_HANDOFF_PAYLOAD_SCHEMA_VERSION ,
17- IX_METADATA_ONLY_RUNTIME_SEMANTICS ,
15+ WaveSixIxHandoffPackage ,
1816 canonical_ix_cognition_obligation_ids ,
1917 load_ix_cognition_handoff ,
2018)
2119from ix_cognition_kernel .wave6_ix_obligation_pressure import (
2220 WAVE_SIX_IX_OBLIGATION_PRESSURE_ENGINE_ID ,
2321 WaveSixIxObligationPressureBundle ,
2422 WaveSixIxObligationPressureDecision ,
23+ WaveSixIxObligationPressureStatus ,
2524 build_ix_obligation_pressure_bundle ,
2625)
2726
@@ -43,135 +42,181 @@ def _obligation_payload(index: int, obligation_id: str) -> dict[str, Any]:
4342 return {
4443 "canonical" : True ,
4544 "canonical_definition" : definition .canonical_payload (),
46- "evidence_required" : [ definition .evidence_artifacts [ 0 ]] ,
47- "falsify_if" : [ definition .falsification_conditions [ 0 ]] ,
45+ "evidence_required" : list ( definition .evidence_artifacts ) ,
46+ "falsify_if" : list ( definition .falsification_conditions ) ,
4847 "id" : obligation_id ,
4948 "source" : _source (line = 8 + (index * 5 )),
5049 }
5150
5251
5352def _canonical_payload () -> dict [str , Any ]:
5453 return {
55- "handoff_type" : IX_KERNEL_HANDOFF_TYPE ,
54+ "handoff_type" : "ix.cognitionkernel.handoff" ,
5655 "packages" : [
5756 {
5857 "attempt" : "wave6_measured_cognition" ,
5958 "claim_boundaries" : [
60- "Research candidate only, evaluation use only, not deployment" ,
59+ "measured system-level cognition only" ,
60+ "not an AGI claim" ,
61+ "human and independent review required" ,
6162 ],
6263 "execution_authority" : "none" ,
63- "human_approval_required" : [
64- "Human review required before any advancement or public claim" ,
65- ],
64+ "human_approval_required" : ["human authority required" ],
6665 "human_authority_required" : True ,
67- "non_goals" : [
68- "Do not claim AGI, certify AGI, or allow system self-approval" ,
69- ],
66+ "non_goals" : ["do not claim AGI" , "do not self-certify" ],
7067 "obligations" : [
7168 _obligation_payload (index , obligation_id )
7269 for index , obligation_id in enumerate (
7370 canonical_ix_cognition_obligation_ids ()
7471 )
7572 ],
76- "purpose" : [
77- "Define a governed IX-CognitionKernel Wave 6 contract for "
78- "measured reality correction" ,
79- ],
80- "runtime_semantics" : IX_METADATA_ONLY_RUNTIME_SEMANTICS ,
81- "schema" : IX_COGNITION_CONTRACT_SCHEMA ,
73+ "purpose" : ["test measured system-level cognition" ],
74+ "runtime_semantics" : "metadata_only_not_executed" ,
75+ "schema" : "ix.cognition.contract.v1" ,
8276 "self_certification_allowed" : False ,
8377 "source" : _source (line = 6 ),
84- "target" : IX_COGNITION_KERNEL_TARGET ,
78+ "target" : "IX-CognitionKernel" ,
8579 }
8680 ],
87- "runtime_semantics" : IX_METADATA_ONLY_RUNTIME_SEMANTICS ,
88- "schema_version" : IX_KERNEL_HANDOFF_PAYLOAD_SCHEMA_VERSION ,
81+ "runtime_semantics" : "metadata_only_not_executed" ,
82+ "schema_version" : "1.0" ,
8983 }
9084
9185
92- def _pressure_bundle () -> WaveSixIxObligationPressureBundle :
93- package = load_ix_cognition_handoff (_canonical_payload ()).packages [0 ]
94- return build_ix_obligation_pressure_bundle ( package )
86+ def _ix_package () -> WaveSixIxHandoffPackage :
87+ return load_ix_cognition_handoff (_canonical_payload ()).packages [0 ]
88+
9589
90+ def test_ix_obligation_pressure_builds_one_pressure_per_canonical_obligation () -> None :
91+ package = _ix_package ()
9692
97- def test_ix_obligation_pressure_builds_one_gap_and_probe_per_obligation () -> None :
98- bundle = _pressure_bundle ()
93+ bundle = build_ix_obligation_pressure_bundle (package )
9994
10095 assert bundle .attempt == "wave6_measured_cognition"
101- assert bundle .generated_by_engine_id == WAVE_SIX_IX_OBLIGATION_PRESSURE_ENGINE_ID
102- assert bundle .obligation_ids == canonical_ix_cognition_obligation_ids ()
103- assert len (bundle .pressures ) == len (canonical_ix_cognition_obligation_ids ())
104- assert len (bundle .evidence_gap_ids ) == len (canonical_ix_cognition_obligation_ids ())
105- assert len (bundle .falsification_probe_ids ) == len (
106- canonical_ix_cognition_obligation_ids ()
96+ assert bundle .source_package_fingerprint == package .fingerprint ()
97+ assert bundle .source_evidence_id == package .ix_evidence_id
98+ assert bundle .contract_artifact_id == (
99+ "ix-handoff-artifact-wave6_measured_cognition"
107100 )
108- assert bundle .source_evidence_id == (
109- "ix-kernel-handoff:wave6_measured_cognition:kernel-handoff-json"
101+ assert bundle .generated_by_engine_id == (
102+ WAVE_SIX_IX_OBLIGATION_PRESSURE_ENGINE_ID
110103 )
111- assert bundle .contract_artifact_id == "ix-handoff-artifact-wave6_measured_cognition"
104+ assert bundle .obligation_ids == canonical_ix_cognition_obligation_ids ()
105+ assert len (bundle .pressures ) == len (canonical_ix_cognition_obligation_ids ())
106+
107+
108+ def test_ix_obligation_pressure_starts_fail_closed_with_blocking_gaps () -> None :
109+ bundle = build_ix_obligation_pressure_bundle (_ix_package ())
110+
112111 assert bundle .decision is (
113112 WaveSixIxObligationPressureDecision .BLOCKED_BY_MISSING_OBLIGATION_EVIDENCE
114113 )
115114 assert not bundle .ready_for_bounded_review
116115 assert bundle .blocking_gap_ids == bundle .evidence_gap_ids
117- assert len (bundle .fingerprint ()) == 64
118- assert bundle .fingerprint () == bundle .fingerprint ()
116+ assert len (bundle .blocking_gap_ids ) == len (canonical_ix_cognition_obligation_ids ())
119117
120-
121- def test_ix_obligation_pressure_keeps_imported_gaps_open_and_blocking () -> None :
122- bundle = _pressure_bundle ()
123- pressure = bundle .pressures [0 ]
124-
125- assert pressure .obligation_id == "purpose_discipline"
126- assert pressure .evidence_gap .state is WaveSixGapState .OPEN
127- assert pressure .evidence_gap .kind is WaveSixGapKind .REQUIRED_EVIDENCE_GAP
128- assert pressure .evidence_gap .severity is WaveSixGapSeverity .MAJOR
129- assert pressure .evidence_gap .requires_follow_up
130- assert pressure .evidence_gap .blocks_review
131- assert pressure .evidence_gap .required_evidence_ids == ("attempt_purpose_record" ,)
132- assert pressure .evidence_gap .evidence_ids == ()
133- assert pressure .falsification_gate_ids == ("purpose_missing" ,)
134- assert pressure .falsification_probe .probe_kind is (
135- WaveSixFalsificationProbeKind .NEGATIVE_CONTROL
118+ first_pressure = bundle .pressures [0 ]
119+ assert first_pressure .status is WaveSixIxObligationPressureStatus .BLOCKING
120+ assert first_pressure .evidence_gap .state is WaveSixGapState .OPEN
121+ assert first_pressure .evidence_gap .disposition is (
122+ WaveSixGapDisposition .REQUIRE_EVIDENCE
136123 )
137- assert not pressure . falsification_probe . allows_autonomous_execution
138- assert not pressure . falsification_probe . claims_agi
139- assert pressure . falsification_probe . requires_human_review
140-
124+ assert first_pressure . evidence_gap . severity is WaveSixGapSeverity . MAJOR
125+ assert first_pressure . evidence_gap . blocks_review
126+ assert first_pressure . evidence_gap . blocks_bounded_review
127+ assert first_pressure . evidence_gap . requires_follow_up
141128
142- def test_ix_obligation_pressure_marks_authority_obligation_critical () -> None :
143- bundle = _pressure_bundle ()
144- pressure_by_id = {pressure .obligation_id : pressure for pressure in bundle .pressures }
145129
146- pressure = pressure_by_id ["human_authority" ]
130+ def test_ix_obligation_pressure_uses_critical_severity_for_safety_obligations () -> None :
131+ bundle = build_ix_obligation_pressure_bundle (_ix_package ())
132+ severity_by_obligation = {
133+ pressure .obligation_id : pressure .evidence_gap .severity
134+ for pressure in bundle .pressures
135+ }
147136
148- assert pressure .evidence_gap .kind is WaveSixGapKind .HUMAN_REVIEW_GAP
149- assert pressure .evidence_gap .severity is WaveSixGapSeverity .CRITICAL
150- assert pressure .evidence_gap .claim_boundary_impact
151- assert pressure .falsification_probe .probe_kind is (
152- WaveSixFalsificationProbeKind .SAFETY_GATE_PROBE
137+ assert severity_by_obligation ["claim_boundary_discipline" ] is (
138+ WaveSixGapSeverity .CRITICAL
139+ )
140+ assert severity_by_obligation ["human_authority" ] is WaveSixGapSeverity .CRITICAL
141+ assert severity_by_obligation ["no_self_certification" ] is (
142+ WaveSixGapSeverity .CRITICAL
143+ )
144+ assert severity_by_obligation ["falsification_ledger" ] is (
145+ WaveSixGapSeverity .CRITICAL
146+ )
147+ assert severity_by_obligation ["independent_replay_review" ] is (
148+ WaveSixGapSeverity .CRITICAL
149+ )
150+ assert severity_by_obligation ["kernel_handoff_package" ] is (
151+ WaveSixGapSeverity .CRITICAL
153152 )
154153
155154
156- def test_ix_obligation_pressure_maps_transfer_and_novelty_to_specific_probes () -> None :
157- bundle = _pressure_bundle ( )
158- pressure_by_id = {pressure . obligation_id : pressure for pressure in bundle . pressures }
159-
160- transfer = pressure_by_id [ "cross_domain_transfer_probe" ]
161- novelty = pressure_by_id [ "novelty_generality_pressure" ]
155+ def test_ix_obligation_pressure_maps_probe_kinds_to_obligation_families () -> None :
156+ bundle = build_ix_obligation_pressure_bundle ( _ix_package () )
157+ probe_kind_by_obligation = {
158+ pressure . obligation_id : pressure . falsification_probe . probe_kind
159+ for pressure in bundle . pressures
160+ }
162161
163- assert transfer .evidence_gap .kind is WaveSixGapKind .TRANSFER_EVIDENCE_GAP
164- assert transfer .falsification_probe .probe_kind is (
162+ assert probe_kind_by_obligation ["cross_domain_transfer_probe" ] is (
165163 WaveSixFalsificationProbeKind .TRANSFER_COUNTEREXAMPLE
166164 )
167- assert novelty .evidence_gap .kind is WaveSixGapKind .TRANSFER_EVIDENCE_GAP
168- assert novelty .falsification_probe .probe_kind is (
165+ assert probe_kind_by_obligation ["novelty_generality_pressure" ] is (
169166 WaveSixFalsificationProbeKind .NOVELTY_REVERSAL
170167 )
168+ assert probe_kind_by_obligation ["contradiction_handling" ] is (
169+ WaveSixFalsificationProbeKind .CONTRADICTION_PROBE
170+ )
171+ assert probe_kind_by_obligation ["claim_boundary_discipline" ] is (
172+ WaveSixFalsificationProbeKind .SAFETY_GATE_PROBE
173+ )
174+ assert probe_kind_by_obligation ["future_reasoning_change" ] is (
175+ WaveSixFalsificationProbeKind .REGRESSION_PROBE
176+ )
177+ assert probe_kind_by_obligation ["prediction_before_trial" ] is (
178+ WaveSixFalsificationProbeKind .NEGATIVE_CONTROL
179+ )
180+
181+
182+ def test_ix_obligation_pressure_payload_is_deterministic_and_reviewable () -> None :
183+ package = _ix_package ()
184+ bundle = build_ix_obligation_pressure_bundle (package )
185+
186+ payload = bundle .canonical_payload ()
187+
188+ assert payload ["schema_version" ] == (
189+ "ix-cognition-kernel-wave6-ix-obligation-pressure-bundle-v1"
190+ )
191+ assert payload ["attempt" ] == "wave6_measured_cognition"
192+ assert payload ["source_package_fingerprint" ] == package .fingerprint ()
193+ assert payload ["ready_for_bounded_review" ] is False
194+ assert payload ["decision" ] == "blocked-by-missing-obligation-evidence"
195+ assert payload ["obligation_ids" ] == list (canonical_ix_cognition_obligation_ids ())
196+ assert payload ["blocking_gap_ids" ] == list (bundle .blocking_gap_ids )
197+ assert payload ["falsification_probe_ids" ] == list (bundle .falsification_probe_ids )
198+ assert len (bundle .fingerprint ()) == 64
199+ assert bundle .fingerprint () == bundle .fingerprint ()
200+
201+
202+ def test_ix_obligation_pressure_links_each_gap_and_probe_to_source_evidence () -> None :
203+ package = _ix_package ()
204+ bundle = build_ix_obligation_pressure_bundle (package )
205+
206+ for pressure in bundle .pressures :
207+ assert pressure .evidence_gap .required_evidence_ids == (
208+ pressure .required_evidence_ids
209+ )
210+ assert pressure .evidence_gap .evidence_ids == ()
211+ assert pressure .falsification_probe .evidence_ids == (package .ix_evidence_id ,)
212+ assert not pressure .falsification_probe .allows_autonomous_execution
213+ assert not pressure .falsification_probe .claims_agi
214+ assert pressure .falsification_probe .requires_human_review
171215
172216
173217def test_ix_obligation_pressure_rejects_missing_pressure_coverage () -> None :
174- bundle = _pressure_bundle ()
218+ package = _ix_package ()
219+ bundle = build_ix_obligation_pressure_bundle (package )
175220
176221 with pytest .raises (ValueError , match = "Missing IX obligation pressure" ):
177222 WaveSixIxObligationPressureBundle (
@@ -183,14 +228,16 @@ def test_ix_obligation_pressure_rejects_missing_pressure_coverage() -> None:
183228 )
184229
185230
186- def test_ix_obligation_pressure_rejects_tampered_artifact_link () -> None :
187- bundle = _pressure_bundle ()
231+ def test_ix_obligation_pressure_rejects_handoff_engine_identity () -> None :
232+ package = _ix_package ()
233+ bundle = build_ix_obligation_pressure_bundle (package )
188234
189- with pytest .raises (ValueError , match = "artifact ids must match " ):
235+ with pytest .raises (ValueError , match = "own engine id " ):
190236 WaveSixIxObligationPressureBundle (
191237 attempt = bundle .attempt ,
192238 source_package_fingerprint = bundle .source_package_fingerprint ,
193239 source_evidence_id = bundle .source_evidence_id ,
194- contract_artifact_id = "different-artifact" ,
240+ contract_artifact_id = bundle . contract_artifact_id ,
195241 pressures = bundle .pressures ,
242+ generated_by_engine_id = "wave6-ix-handoff-ingestion-engine" ,
196243 )
0 commit comments