1010
1111ROOT = Path (__file__ ).resolve ().parents [1 ]
1212
13- OBSERVATIONS = {
14- "CR-CORE-001" : (["commit" , "commit_same_key" ], [
15- "settlement_occurs_at_most_once" , "retry_uses_original_idempotency_key" ]),
16- "CR-CORE-002" : (["commit" , "event_same_key" ], [
17- "event_carries_original_subject_action_actual" , "settlement_occurs_at_most_once" ]),
18- "CR-CORE-003" : (["extend" , "extend_same_key" , "commit" ], [
19- "heartbeat_failure_reports_reservation_and_disposition" ,
20- "guarded_action_continues_under_warn_policy" , "final_settlement_is_attempted" ]),
21- "CR-CORE-004" : (["commit" , "commit_same_key" ], [
22- "only_schema_valid_expected_status_is_terminal_success" ,
23- "ambiguous_success_retains_original_idempotency_key" ]),
24- "CR-DURABLE-001" : (["commit" , "commit_same_key_after_restart" ], [
25- "journal_write_precedes_first_settlement_request" ,
26- "unresolved_record_survives_restart" , "successful_replay_removes_record" ,
27- "settlement_occurs_at_most_once" ]),
28- "CR-DURABLE-002" : (["commit_same_key_after_restart" , "event_same_key_after_restart" ], [
29- "event_mode_is_persisted_before_event_attempt" , "successful_event_removes_record" ,
30- "settlement_occurs_at_most_once" ]),
31- "CR-DURABLE-003" : (["commit" , "commit_same_key_after_retry_after" ], [
32- "no_retry_before_persisted_not_before" , "successful_replay_removes_record" ]),
33- "CR-DURABLE-004" : (["commit_same_key_after_restart" ], [
34- "new_tenant_credential_finds_record" , "old_api_key_is_not_stored" ]),
35- "CR-DURABLE-005" : ([], [
36- "corrupt_record_is_quarantined" , "other_valid_records_still_replay" ,
37- "corruption_is_reported" ]),
38- "CR-DURABLE-006" : (["concurrent_commit_same_key" ], [
39- "settlement_occurs_at_most_once" , "terminal_record_is_removed" ]),
40- "CR-DURABLE-007" : ([
41- "commit_first_identifier" , "commit_second_identifier" ,
42- "commit_first_identifier_same_key_after_restart" ,
43- "commit_second_identifier_same_key_after_restart" ,
44- ], [
45- "standard_filename_is_sha256_of_exact_utf8_identifier" ,
46- "distinct_identifiers_never_share_a_journal_file" ,
47- "matching_legacy_record_migrates_without_deleting_collision" ,
48- "both_settlements_occur_at_most_once" ,
49- ]),
50- "CR-BOUNDARY-001" : ([], [
51- "sdk_does_not_claim_ledger_convergence" , "application_checkpoint_is_required" ]),
52- }
53-
5413TESTS = {
55- "CR-CORE-001" : "tests/test_retry.py::TestCommitRetryEngine::test_retries_until_success" ,
56- "CR-CORE-002" : "tests/test_journal.py::TestLifecycleEventFallbackWiring::test_expired_commit_schedules_event" ,
57- "CR-CORE-003" : "tests/test_lifecycle.py::TestSyncLifecycleExecution::test_heartbeat_exception_does_not_crash" ,
14+ "CR-CORE-001" : ( "tests/test_retry.py::TestCommitRetryEngine::test_retries_until_success" ,) ,
15+ "CR-CORE-002" : ( "tests/test_journal.py::TestLifecycleEventFallbackWiring::test_expired_commit_schedules_event" ,) ,
16+ "CR-CORE-003" : ( "tests/test_lifecycle.py::TestSyncLifecycleExecution::test_heartbeat_exception_does_not_crash" ,) ,
5817 "CR-CORE-004" : (
5918 "tests/test_journal.py::TestLifecycleEventFallbackWiring::"
60- "test_protocol_invalid_2xx_is_ambiguous_and_keeps_same_key"
19+ "test_protocol_invalid_2xx_is_ambiguous_and_keeps_same_key" ,
6120 ),
6221 "CR-DURABLE-001" : (
6322 "tests/test_journal.py::TestLifecycleEventFallbackWiring::"
64- "test_journal_write_precedes_first_commit_and_success_discards"
23+ "test_journal_write_precedes_first_commit_and_success_discards" ,
24+ "tests/test_journal.py::TestSyncReplay::test_replays_pending_commit_on_set_client" ,
25+ "tests/test_retry.py::TestCommitRetryEngine::test_retries_until_success" ,
6526 ),
6627 "CR-DURABLE-002" : (
67- "tests/test_journal.py::TestSyncEngineDurability::"
68- "test_expired_then_event_transient_continues_in_event_mode"
28+ "tests/test_journal.py::TestSyncEngineDurability::test_expired_then_event_transient_continues_in_event_mode" ,
29+ "tests/test_journal.py::TestSyncReplay::test_replays_event_mode_entry" ,
30+ ),
31+ "CR-DURABLE-003" : (
32+ "tests/test_journal.py::TestRateLimitedRetry::test_429_commit_is_transient_and_honors_retry_after" ,
33+ "tests/test_journal.py::TestRateLimitedRetry::test_replay_restores_future_retry_after_floor" ,
34+ "tests/test_journal.py::TestRateLimitedRetry::test_429_then_success_discards_journal" ,
6935 ),
70- "CR-DURABLE-003" : "tests/test_journal.py::TestRateLimitedRetry::test_replay_restores_future_retry_after_floor" ,
7136 "CR-DURABLE-004" : (
72- "tests/test_journal.py::TestAuthFailureRetention::test_replay_survives_api_key_rotation_with_tenant"
37+ "tests/test_journal.py::TestAuthFailureRetention::test_replay_survives_api_key_rotation_with_tenant" ,
38+ ),
39+ "CR-DURABLE-005" : (
40+ "tests/test_journal.py::TestCommitJournal::"
41+ "test_corrupt_and_unsupported_records_are_quarantined_without_blocking_valid" ,
42+ ),
43+ "CR-DURABLE-006" : (
44+ "tests/test_journal.py::TestSyncReplay::test_concurrent_replay_workers_reuse_one_key_and_remove_record" ,
7345 ),
74- "CR-DURABLE-005" : "tests/test_journal.py::TestCommitJournal::test_corrupt_file_renamed_and_skipped" ,
75- "CR-DURABLE-006" : "tests/test_journal.py::TestSyncReplay::test_replay_happens_once_per_directory" ,
7646 "CR-DURABLE-007" : (
77- "tests/test_journal.py::TestCommitJournal::test_colliding_legacy_ids_are_distinct_and_migrate_safely"
47+ "tests/test_journal.py::TestCommitJournal::test_colliding_legacy_ids_are_distinct_and_migrate_safely" ,
48+ ),
49+ "CR-BOUNDARY-001" : (
50+ "tests/test_lifecycle.py::TestSyncLifecycleExecution::test_missing_actual_surfaces_without_settlement" ,
7851 ),
79- "CR-BOUNDARY-001" : "tests/test_lifecycle.py::TestEvaluateActual::test_no_fallback_raises" ,
8052}
8153
8254
@@ -94,7 +66,7 @@ def main() -> int:
9466 return 2
9567
9668 completed = subprocess .run (
97- [sys .executable , "-m" , "pytest" , "-q" , TESTS [scenario_id ]],
69+ [sys .executable , "-m" , "pytest" , "-q" , * TESTS [scenario_id ]],
9870 cwd = ROOT ,
9971 text = True ,
10072 capture_output = True ,
@@ -104,14 +76,15 @@ def main() -> int:
10476 print (completed .stdout , file = sys .stderr , end = "" )
10577 if completed .stderr :
10678 print (completed .stderr , file = sys .stderr , end = "" )
107- requests , assertions = OBSERVATIONS [scenario_id ]
108- json .dump ({
109- "scenario_id" : scenario_id ,
110- "passed" : completed .returncode == 0 ,
111- "observed_requests" : requests ,
112- "assertions" : assertions ,
113- "diagnostic" : f"native pytest exit code { completed .returncode } " ,
114- }, sys .stdout )
79+ json .dump (
80+ {
81+ "scenario_id" : scenario_id ,
82+ "passed" : completed .returncode == 0 ,
83+ "native_tests" : list (TESTS [scenario_id ]),
84+ "diagnostic" : f"native pytest exit code { completed .returncode } " ,
85+ },
86+ sys .stdout ,
87+ )
11588 return 0
11689
11790
0 commit comments