← Về thư mục
scripts/test_check_audit_artifact_consistency.py
- make_valid_verdict_file_minor · function · L74-L90 — def make_valid_verdict_file_minor() -> dict[str, Any]
- make_valid_verdict_file_pass · function · L93-L104 — def make_valid_verdict_file_pass() -> dict[str, Any]
- make_valid_verdict_file_audit_failed · function · L107-L119 — def make_valid_verdict_file_audit_failed() -> dict[str, Any]
- make_valid_persisted_entry_minor · function · L122-L144 — def make_valid_persisted_entry_minor() -> dict[str, Any]
- make_valid_proposal_entry_pass · function · L147-L167 — def make_valid_proposal_entry_pass() -> dict[str, Any]
- make_valid_sidecar · function · L170-L206 — def make_valid_sidecar(template_sha: str = "1" * 64) -> dict[str, Any]
- make_valid_jsonl_events_no_tool · function · L209-L219 — def make_valid_jsonl_events_no_tool() -> list[dict[str, Any]]
- make_valid_jsonl_events_tool_using · function · L222-L234 — def make_valid_jsonl_events_tool_using() -> list[dict[str, Any]]
- TestA1 · class · L242-L303 — class TestA1
- test_pass_with_zero_counts_passes · method · L245-L247 — def test_pass_with_zero_counts_passes(self)
- test_pass_with_nonzero_p1_fails · method · L249-L253 — def test_pass_with_nonzero_p1_fails(self)
- test_minor_with_p3_le_3_passes · method · L255-L257 — def test_minor_with_p3_le_3_passes(self)
- test_minor_with_p3_4_fails · method · L259-L263 — def test_minor_with_p3_4_fails(self)
- test_minor_with_zero_counts_fails · method · L265-L276 — def test_minor_with_zero_counts_fails(self): # Codex round 10 P2: MINOR with p1=p2=p3=0 is malformed because the # wrapper classifies zero findings as PASS, not MINOR. A hand-edited # verdict file claiming zero-count MINOR would otherwise pass A1 # and send the orchestrator down the MINOR escalation path with # no findings to act on.
- test_material_with_p1_gt_0_passes · method · L278-L282 — def test_material_with_p1_gt_0_passes(self)
- test_material_all_zero_fails · method · L284-L287 — def test_material_all_zero_fails(self)
- test_audit_failed_with_failure_reason_passes · method · L289-L291 — def test_audit_failed_with_failure_reason_passes(self)
- test_audit_failed_missing_failure_reason_fails · method · L293-L297 — def test_audit_failed_missing_failure_reason_fails(self)
- test_pass_with_failure_reason_fails · method · L299-L303 — def test_pass_with_failure_reason_fails(self)
- TestA2 · class · L306-L323 — class TestA2
- test_audit_failed_with_reason_passes · method · L309-L311 — def test_audit_failed_with_reason_passes(self)
- test_audit_failed_without_reason_fails · method · L313-L317 — def test_audit_failed_without_reason_fails(self)
- test_minor_with_reason_fails · method · L319-L323 — def test_minor_with_reason_fails(self)
- TestA3 · class · L326-L337 — class TestA3
- test_round_le_target_passes · method · L329-L331 — def test_round_le_target_passes(self)
- test_round_gt_target_fails · method · L333-L337 — def test_round_gt_target_fails(self)
- TestA4 · class · L340-L370 — class TestA4
- test_persisted_material_with_ack_passes · method · L343-L352 — def test_persisted_material_with_ack_passes(self)
- test_proposal_with_ack_fails · method · L354-L360 — def test_proposal_with_ack_fails(self)
- test_persisted_pass_with_ack_fails · method · L362-L370 — def test_persisted_pass_with_ack_fails(self)
- TestA5 · class · L373-L384 — class TestA5
- test_counts_agree_passes · method · L376-L378 — def test_counts_agree_passes(self)
- test_count_disagrees_fails · method · L380-L384 — def test_count_disagrees_fails(self)
- TestA6 · class · L387-L399 — class TestA6
- test_audit_failed_empty_findings_passes · method · L390-L392 — def test_audit_failed_empty_findings_passes(self)
- test_audit_failed_with_findings_fails · method · L394-L399 — def test_audit_failed_with_findings_fails(self)
- TestA7 · class · L402-L463 — class TestA7
- test_no_tool_events_passes · method · L405-L407 — def test_no_tool_events_passes(self)
- test_tool_using_events_pass · method · L409-L411 — def test_tool_using_events_pass(self)
- test_orphan_tool_completion_fails · method · L413-L424 — def test_orphan_tool_completion_fails(self)
- test_unmatched_tool_start_fails · method · L426-L435 — def test_unmatched_tool_start_fails(self)
- test_duplicate_started_fails · method · L437-L448 — def test_duplicate_started_fails(self)
- test_completed_before_started_fails · method · L450-L463 — def test_completed_before_started_fails(self): # An item.completed appearing before its item.started would be classified # as orphan because we scan top-down. Either error covers the violation.
- TestB1 · class · L471-L493 — class TestB1
- test_matching_thread_id_passes · method · L474-L478 — def test_matching_thread_id_passes(self)
- test_mismatched_thread_id_fails · method · L480-L486 — def test_mismatched_thread_id_fails(self)
- test_audit_failed_suspends_b1 · method · L488-L493 — def test_audit_failed_suspends_b1(self)
- TestB2 · class · L496-L522 — class TestB2
- test_matching_shas_passes · method · L499-L503 — def test_matching_shas_passes(self, tmp_path: Path)
- test_entry_sidecar_sha_disagree_fails · method · L505-L510 — def test_entry_sidecar_sha_disagree_fails(self)
- test_disk_sha_mismatch_fails · method · L512-L522 — def test_disk_sha_mismatch_fails(self, tmp_path: Path)
- TestB3 · class · L525-L553 — class TestB3
- test_matching_manifest_passes · method · L528-L532 — def test_matching_manifest_passes(self)
- test_mismatched_manifest_fails · method · L534-L538 — def test_mismatched_manifest_fails(self)
- test_missing_bundle_file_fails · method · L540-L553 — def test_missing_bundle_file_fails(self, tmp_path: Path): # Codex round 2 P2: when a bundle file is missing on disk, B3 must # NOT fall back to the sidecar-declared SHA — that would let a # deleted/moved file silently pass. With a real .git/ marker, B3 # Step 2 is required to flag the missing file as stale/unverifiable. # Synthesize a tmp repo with a real .git marker but missing bundle # files; the sidecar's declared paths are intentionally absent.
- TestB4 · class · L556-L580 — class TestB4
- test_real_git_sha_passes · method · L559-L568 — def test_real_git_sha_passes(self): # Use the actual repo HEAD
- test_fake_git_sha_fails · method · L570-L574 — def test_fake_git_sha_fails(self)
- test_outside_git_repo_skipped · method · L576-L580 — def test_outside_git_repo_skipped(self, tmp_path: Path): # tmp_path has no .git/, so B4 is skipped (no false positive on synthetic fixtures)
- TestB5 · class · L583-L594 — class TestB5
- test_consistent_timing_passes · method · L586-L588 — def test_consistent_timing_passes(self)
- test_inconsistent_timing_fails · method · L590-L594 — def test_inconsistent_timing_fails(self)
- TestB6 · class · L597-L616 — class TestB6
- test_zero_exit_minor_passes · method · L600-L603 — def test_zero_exit_minor_passes(self)
- test_nonzero_exit_minor_fails · method · L605-L610 — def test_nonzero_exit_minor_fails(self)
- test_nonzero_exit_audit_failed_passes · method · L612-L616 — def test_nonzero_exit_audit_failed_passes(self)
- TestB7 · class · L619-L646 — class TestB7
- test_matching_run_ids_pass · method · L622-L629 — def test_matching_run_ids_pass(self, tmp_path: Path)
- test_entry_sidecar_run_id_mismatch_fails · method · L631-L638 — def test_entry_sidecar_run_id_mismatch_fails(self, tmp_path: Path)
- test_basename_mismatch_fails · method · L640-L646 — def test_basename_mismatch_fails(self, tmp_path: Path)
- TestB8 · class · L649-L673 — class TestB8
- test_matching_timestamps_pass · method · L652-L661 — def test_matching_timestamps_pass(self)
- test_mismatched_timestamps_fail · method · L663-L673 — def test_mismatched_timestamps_fail(self)
- TestB9 · class · L676-L695 — class TestB9
- test_matching_bundle_id_passes · method · L679-L682 — def test_matching_bundle_id_passes(self)
- test_no_bundle_id_skipped · method · L684-L688 — def test_no_bundle_id_skipped(self)
- test_mismatched_bundle_id_fails · method · L690-L695 — def test_mismatched_bundle_id_fails(self)
- TestB10 · class · L698-L768 — class TestB10
- test_full_coverage_passes · method · L701-L716 — def test_full_coverage_passes(self)
- test_unknown_finding_id_fails · method · L718-L734 — def test_unknown_finding_id_fails(self)
- test_partial_coverage_fails · method · L736-L755 — def test_partial_coverage_fails(self)
- test_empty_finding_ids_fails · method · L757-L768 — def test_empty_finding_ids_fails(self)
- TestC1 · class · L776-L796 — class TestC1
- test_matching_mirror_passes · method · L779-L782 — def test_matching_mirror_passes(self)
- test_status_drift_fails · method · L784-L789 — def test_status_drift_fails(self)
- test_finding_counts_drift_fails · method · L791-L796 — def test_finding_counts_drift_fails(self)
- TestC2 · class · L799-L813 — class TestC2
- test_matching_sha_passes · method · L802-L806 — def test_matching_sha_passes(self)
- test_drift_fails · method · L808-L813 — def test_drift_fails(self)
- TestC3 · class · L816-L844 — class TestC3
- test_byte_for_byte_copy_passes · method · L819-L830 — def test_byte_for_byte_copy_passes(self)
- test_drift_in_copied_field_fails · method · L832-L838 — def test_drift_in_copied_field_fails(self)
- test_same_verified_at_fails · method · L840-L844 — def test_same_verified_at_fails(self)
- TestC4 · class · L847-L860 — class TestC4
- test_matching_passes · method · L850-L853 — def test_matching_passes(self)
- test_drift_fails · method · L855-L860 — def test_drift_fails(self)
- TestD1 · class · L868-L883 — class TestD1
- test_unique_verified_at_passes · method · L871-L876 — def test_unique_verified_at_passes(self)
- test_duplicate_verified_at_fails · method · L878-L883 — def test_duplicate_verified_at_fails(self)
- TestD2 · class · L886-L906 — class TestD2
- test_distinct_started_at_passes · method · L889-L896 — def test_distinct_started_at_passes(self)
- test_shared_started_at_warns · method · L898-L906 — def test_shared_started_at_warns(self)
- TestD3 · class · L909-L925 — class TestD3
- test_monotonic_ledger_passes · method · L912-L917 — def test_monotonic_ledger_passes(self)
- test_non_monotonic_fails · method · L919-L925 — def test_non_monotonic_fails(self)
- TestD4 · class · L928-L947 — class TestD4
- test_higher_round_fires_supersession · method · L932-L938 — def test_higher_round_fires_supersession(self): # The lint should SURFACE the supersession (proposal preempts # persisted Path A) so the caller sees it before the orchestrator # processes the artifacts.
- test_equal_round_no_supersession · method · L940-L942 — def test_equal_round_no_supersession(self): # Same round — no supersession required; D4 is silent.
- test_lower_round_no_supersession · method · L944-L947 — def test_lower_round_no_supersession(self): # Lower-round proposal — D4 silent (orchestrator should reject the # proposal at B1a as a stale leftover, but that's not D4's surface).
- TestE1E2E6 · class · L955-L972 — class TestE1E2E6
- test_orchestrator_emitted_passes · method · L958-L960 — def test_orchestrator_emitted_passes(self)
- test_missing_verified_by_fails · method · L962-L966 — def test_missing_verified_by_fails(self)
- test_wrong_verified_by_fails · method · L968-L972 — def test_wrong_verified_by_fails(self)
- TestE3E4 · class · L975-L992 — class TestE3E4
- test_clean_proposal_passes · method · L978-L980 — def test_clean_proposal_passes(self)
- test_proposal_with_verified_at_fails · method · L982-L986 — def test_proposal_with_verified_at_fails(self)
- test_proposal_with_verified_by_fails · method · L988-L992 — def test_proposal_with_verified_by_fails(self)
- TestE5 · class · L995-L1006 — class TestE5
- test_minor_persisted_passes · method · L998-L1000 — def test_minor_persisted_passes(self)
- test_audit_failed_persisted_fails · method · L1002-L1006 — def test_audit_failed_persisted_fails(self)
- TestE7 · class · L1009-L1031 — class TestE7
- test_material_with_ack_passes · method · L1012-L1020 — def test_material_with_ack_passes(self)
- test_synthetic_status_with_ack_fails · method · L1022-L1031 — def test_synthetic_status_with_ack_fails(self)
- TestF1 · class · L1039-L1051 — class TestF1
- test_canonical_run_id_passes · method · L1042-L1043 — def test_canonical_run_id_passes(self)
- test_wrong_format_fails · method · L1045-L1047 — def test_wrong_format_fails(self)
- test_missing_run_id_fails · method · L1049-L1051 — def test_missing_run_id_fails(self)
- TestF2 · class · L1054-L1072 — class TestF2
- test_canonical_filenames_pass · method · L1057-L1062 — def test_canonical_filenames_pass(self, tmp_path: Path)
- test_stage_prefix_fails · method · L1064-L1067 — def test_stage_prefix_fails(self, tmp_path: Path)
- test_wrong_extension_fails · method · L1069-L1072 — def test_wrong_extension_fails(self, tmp_path: Path)
- TestF3 · class · L1075-L1088 — class TestF3
- test_matching_passes · method · L1078-L1081 — def test_matching_passes(self, tmp_path: Path)
- test_drift_fails · method · L1083-L1088 — def test_drift_fails(self, tmp_path: Path)
- TestSchemaSelfValidation · class · L1096-L1112 — class TestSchemaSelfValidation
- test_schema_meta_valid · method · L1105-L1112 — def test_schema_meta_valid(self, schema_name)
- TestAggregator · class · L1120-L1194 — class TestAggregator
- test_clean_persisted_bundle_zero_findings · method · L1123-L1148 — def test_clean_persisted_bundle_zero_findings(self, tmp_path: Path)
- test_clean_proposal_bundle_zero_findings · method · L1150-L1170 — def test_clean_proposal_bundle_zero_findings(self, tmp_path: Path)
- test_jsonl_stream_mode_clean · method · L1172-L1179 — def test_jsonl_stream_mode_clean(self, tmp_path: Path)
- test_jsonl_stream_mode_orphan_fails · method · L1181-L1194 — def test_jsonl_stream_mode_orphan_fails(self, tmp_path: Path)
- TestCLI · class · L1197-L2039 — class TestCLI
- test_jsonl_stream_clean_returns_0 · method · L1200-L1205 — def test_jsonl_stream_clean_returns_0(self, tmp_path: Path, capsys)
- test_jsonl_stream_orphan_returns_1 · method · L1207-L1216 — def test_jsonl_stream_orphan_returns_1(self, tmp_path: Path)
- test_persisted_clean_via_files · method · L1218-L1240 — def test_persisted_clean_via_files(self, tmp_path: Path): # Write all four artifact files
- test_persisted_missing_sidecar_returns_1 · method · L1242-L1263 — def test_persisted_missing_sidecar_returns_1(self, tmp_path: Path, capsys): # Codex round 1 P1: missing companion artifacts must be rejected, not # silently ignored. Write entry + verdict + jsonl but NOT sidecar.
- test_persisted_mode_rejects_proposal_shape · method · L1265-L1293 — def test_persisted_mode_rejects_proposal_shape(self, tmp_path: Path, capsys): # Codex round 2 P1: --mode persisted must enforce persisted arm. A # proposal-shaped entry (no verified_at/verified_by) was silently # passing oneOf validation as the proposal arm.
- test_persisted_mode_rejects_audit_failed · method · L1295-L1321 — def test_persisted_mode_rejects_audit_failed(self, tmp_path: Path, capsys): # AUDIT_FAILED is proposal-only per §3.2 lifecycle-conditional table.
- test_persisted_truncated_jsonl_rejected · method · L1323-L1352 — def test_persisted_truncated_jsonl_rejected(self, tmp_path: Path, capsys): # Codex round 3 P1: JSONL with only thread.started + turn.started # has no A7 pairing violation but is incomplete evidence. Phase 6.1's # parse_audit_verdict.validate_stream_shape must run before A7 in # full mode (non-AUDIT_FAILED bundles).
- test_passport_scan_rejects_audit_failed · method · L1354-L1410 — def test_passport_scan_rejects_audit_failed(self, tmp_path: Path, capsys): # Codex round 3 P2: hand-edited passport entry with AUDIT_FAILED status # plus valid verified_at + verified_by must be flagged as forbidden.
- test_persisted_forged_artifact_paths_in_entry · method · L1412-L1444 — def test_persisted_forged_artifact_paths_in_entry(self, tmp_path: Path, capsys): # Codex round 4 P2: hand-edited entry.artifact_paths pointing at a # different run_id must be flagged as forgery seam, even when the # CLI is invoked with canonical --output-dir + --run-id and the # actual on-disk files have the canonical basename.
- test_argparse_invalid_mode_returns_64 · method · L1446-L1456 — def test_argparse_invalid_mode_returns_64(self): # Codex round 4 P3: argparse-level failures must exit 64, not 2.
- test_argparse_unknown_flag_returns_64 · method · L1458-L1467 — def test_argparse_unknown_flag_returns_64(self)
- test_persisted_ack_without_prior_rejected · method · L1469-L1513 — def test_persisted_ack_without_prior_rejected(self, tmp_path: Path, capsys): # Codex round 5 P1: a persisted ack entry whose copied fields don't # match any prior MATERIAL entry must be rejected, not silently # skipped. Previously
prior is None skipped check_c3 entirely.
- test_non_dict_entry_returns_2 · method · L1515-L1530 — def test_non_dict_entry_returns_2(self, tmp_path: Path, capsys): # Codex round 5 traceback closure: a non-object entry payload (e.g.,
[]) # must surface as a clean error, not an AttributeError traceback.
- test_stream_shape_runs_via_importlib · method · L1532-L1563 — def test_stream_shape_runs_via_importlib(self, tmp_path: Path, capsys): # Codex round 5 P2: stream-shape gate must work via importlib, not # depend on scripts/ being on sys.path. Import this module under a # fresh
scripts package qualifier and run main from there.
- test_audit_failed_skips_a7_pairing · method · L1565-L1611 — def test_audit_failed_skips_a7_pairing(self, tmp_path: Path, capsys): # Codex round 6 P2: AUDIT_FAILED bundles legitimately have truncated # streams. A7 pairing must be suspended for them, mirroring the # round-3 stream-shape suspension and §3.4 Layer 3 suspension.
- test_non_object_sidecar_no_traceback · method · L1613-L1637 — def test_non_object_sidecar_no_traceback(self, tmp_path: Path, capsys): # Codex round 6 P2: a non-object sidecar must surface as SCHEMA # finding without crashing cross-field checks.
- test_non_object_verdict_no_traceback · method · L1639-L1660 — def test_non_object_verdict_no_traceback(self, tmp_path: Path, capsys)
- test_jsonl_lacks_section6_verdict_text_rejected · method · L1662-L1696 — def test_jsonl_lacks_section6_verdict_text_rejected(self, tmp_path: Path, capsys): # Codex round 8 P1: stream-shape passes but verdict text is not a # parseable Section 6 → must be rejected as L2-4 finding.
- test_artifact_path_resolves_to_missing_file_rejected · method · L1698-L1728 — def test_artifact_path_resolves_to_missing_file_rejected(self, tmp_path: Path, capsys): # Codex round 8 P2: entry.artifact_paths recording a path that # resolves under repo_root to a missing file must be flagged.
- test_audit_failed_skips_layer_3_b2_b3_b4_b5_b7 · method · L1730-L1787 — def test_audit_failed_skips_layer_3_b2_b3_b4_b5_b7(self, tmp_path: Path, capsys): # Codex round 9 P2: Layer 3 cross-file rules (B2/B3/B4/B5/B7) are # suspended for AUDIT_FAILED bundles per §3.4 + §5.6 Path B5. A # failed audit caused by bundle mutation legitimately has live # deliverable SHA != recorded SHA; treating that as B2 violation # would reject the failure-signaling artifact.
- test_audit_failed_with_partial_jsonl_no_internal_error · method · L1789-L1834 — def test_audit_failed_with_partial_jsonl_no_internal_error(self, tmp_path: Path, capsys): # Codex round 11 P2: AUDIT_FAILED bundle with partial/non-JSON last # line (codex SIGKILL'd mid-write) must NOT exit 2 internal error. # Round 9 suspended schema validation but _load_jsonl() still raised # before reaching that suspension.
- test_schema_error_short_circuits_no_traceback · method · L1836-L1868 — def test_schema_error_short_circuits_no_traceback(self, tmp_path: Path, capsys): # Codex round 12 P2: schema-valid-as-dict but with a nested field of # the wrong shape (timing: [1] passes top-level isinstance(dict) but # timing.get() crashes in check_b5). Short-circuit on SCHEMA error # so cross-field rules don't crash on input violating their type # presuppositions.
- test_persisted_with_higher_round_proposal_fires_d4 · method · L1870-L1923 — def test_persisted_with_higher_round_proposal_fires_d4(self, tmp_path: Path, capsys): # Codex round 13 P2: when --mode persisted runs and --output-dir # contains a higher-round unmerged proposal for the same (stage, # agent, deliverable_sha) tuple, D4 must fire (the persisted # entry's Path A is supposed to be preempted).
- test_script_is_executable · method · L1925-L1937 — def test_script_is_executable(self): # Codex round 14 P1: spec §5.2 L2-5 invokes the lint as #
scripts/check_audit_artifact_consistency.py --mode jsonl-stream … # without a python prefix. The file must carry the executable # bit (100755) like Phase 6.1's audit_snapshot.py / parse_audit_ # verdict.py / run_codex_audit.sh — direct exec failing with # permission denied (exit 126) would block the orchestrator gate.
- test_script_runs_via_direct_exec · method · L1939-L1951 — def test_script_runs_via_direct_exec(self): # End-to-end smoke: invoke the script directly (no
python prefix) # and confirm it produces the documented harness exit code. Belt # and braces against future chmod 644 regressions.
- test_swap_verdict_file_with_different_run_id_rejected · method · L1953-L1982 — def test_swap_verdict_file_with_different_run_id_rejected(self, tmp_path: Path, capsys): # Codex round 15 P1: swap-one-verdict-file forgery — a verdict.yaml # with all valid schema/cross-field but internal run_id pointing at # a different run, renamed into the canonical .verdict.yaml # slot. C1 mirrors only the nested verdict block; B7 (pre-round-15) # checked sidecar.run_id but not verdict.run_id.
- test_only_entry_flag_resolves_companions_from_artifact_paths · method · L1984-L2010 — def test_only_entry_flag_resolves_companions_from_artifact_paths(self, tmp_path: Path, capsys): # Codex round 16 P2: caller passes only --entry + --repo-root; the # lint must resolve sidecar/verdict/jsonl from # entry.artifact_paths instead of demanding redundant flags.
- test_persisted_schema_invalid_sidecar_returns_1 · method · L2012-L2039 — def test_persisted_schema_invalid_sidecar_returns_1(self, tmp_path: Path, capsys): # Codex round 1 P2: schema-invalid sidecar must be rejected even when # cross-field rules don't cover the malformed field.
- TestExampleHarness · class · L2047-L2059 — class TestExampleHarness
- test_harness_runs · method · L2050-L2059 — def test_harness_runs(self): # Should not raise; may produce findings (known §3.4 hyphen drift)
- TestFixtureSmoke · class · L2070-L2133 — class TestFixtureSmoke
- test_positive_persisted_minor · method · L2081-L2094 — def test_positive_persisted_minor(self)
- test_positive_proposal_pass · method · L2096-L2109 — def test_positive_proposal_pass(self)
- test_negative_a1_pass_with_p1 · method · L2111-L2122 — def test_negative_a1_pass_with_p1(self)
- test_negative_a7_orphan_completion · method · L2124-L2133 — def test_negative_a7_orphan_completion(self)