Orchestrata Ultimate › Tests › Reference › scripts › test_affected_tests
Tests reference — tests/scripts/test_affected_tests.py
Module of tests/scripts, split out because the directory page would be too large.
Prose pending.
tests/scripts/test_affected_tests.py
source · 122 tests · 2988 lines
Tests for scripts/affected_tests.py — the Phase 3 (workflow-improvements-
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_build_module_file_map |
130 | |
| function | test_build_module_file_map_normalizes_absolute_file_paths |
136 | Regression (observed live 2026-07-26): an --incremental regen of |
| function | test_build_reverse_dep_graph_inverts_internal_edges_only |
155 | |
| function | test_build_test_import_map_strips_prefix |
163 | |
| function | test_transitive_dependents_respects_max_depth |
170 | |
| function | test_resolve_src_file_reaches_transitive_test_2_hops_away |
189 | |
| function | test_resolve_src_file_unknown_module_returns_empty |
207 | |
| function | test_load_manifest_missing_file_returns_empty |
227 | |
| function | test_load_manifest_reads_rules |
231 | |
| function | test_manifest_tests_prolog_pattern_matches_nested_path |
242 | |
| function | test_manifest_tests_scripts_stem_placeholder |
250 | |
| function | test_manifest_tests_no_match_returns_empty |
256 | |
| function | test_build_test_import_map_registers_from_pkg_import_submodule |
309 | 72-occurrence defect (2026-08-14): ``from orchestrata_ultimate.pkg |
| function | test_build_test_import_map_registers_extra_root_modules |
348 | An extra-root module is admitted on its own name, not by prefix. |
| function | test_build_test_import_map_still_ignores_unknown_external_modules |
373 | Admitting extra roots must not admit third-party imports. |
| function | test_build_test_import_map_ignores_names_that_are_not_internal_modules |
386 | from orchestrata_ultimate.pkg import SomeClass (an ordinary |
| function | test_compute_affected_resolves_from_pkg_import_submodule |
397 | The fixture end-to-end pin: a change to pkg/submod.py must select the |
| function | test_real_repo_ast_pipeline_change_resolves_its_test |
417 | Fix 3 real-repo pin. src/orchestrata_ultimate/tools/ast_pipeline.py |
| function | test_is_in_scope |
434 | |
| function | test_compute_affected_direct_and_transitive_hit |
447 | |
| function | test_compute_affected_package_src_resolves_to_parity_tree |
476 | ADR-0105: a changed file under a landed package maps to the whole |
| function | test_compute_affected_package_test_file_maps_to_itself |
495 | ADR-0105: a changed test file inside a package test tree maps to |
| function | test_compute_affected_package_without_tests_stays_untested |
513 | ADR-0105: a package WITHOUT a tests tree is manifest territory — the |
| function | test_compute_affected_package_source_union_with_manifest |
534 | ADR-0105 union semantics: a manifest rule and the package parity |
| function | test_compute_affected_no_dependents_is_untested_not_escalated |
568 | Finding 3 (2026-08-14) closed a silent fall-through here by |
| function | test_compute_affected_init_py_with_no_dependents_is_untested_too |
599 | Bug B (2026-09-21): the zero-import-coverage reclassification applies |
| function | test_real_repo_signal_extraction_zero_coverage_is_untested |
644 | Bug B, real-repo pin: src/orchestrata_ultimate/knowledge_graph/ |
| function | test_compute_affected_escalates_outside_src_and_tests |
662 | |
| function | test_reference_edge_resolves_hook_to_its_test_without_escalation |
690 | The 2026-08-11 case: a hook change selects exactly its |
| function | test_reference_edge_prefix_target_covers_directory_changes |
718 | A CONST_DIR / <computed> read edge (target ends in /) binds |
| function | test_reference_edge_bdd_resolves_feature_to_binding_module |
744 | pytest-bdd scenario paths are base-dir relative — the resolver |
| function | test_documentation_with_zero_reference_edges_is_inert |
770 | Docs with no edges are certified inert: smoke floor, no escalation. |
| function | test_runtime_input_artifacts_are_never_inert |
786 | Generated-but-CONSUMED files escalate; snapshots stay inert. |
| function | test_glob_registry_artifacts_resolve_through_is_doc_inert |
806 | The plugin mirror is certified through its GLOB registry entry. |
| function | test_unreferenced_feature_file_escalates_fail_closed |
820 | A .feature with NO binding edge is code-adjacent, not documentation — |
| function | test_src_referrer_routes_through_import_closure |
841 | An artifact referenced by a SRC module resolves to the tests of that |
| function | test_compute_affected_manifest_coverage_resolves_without_escalation |
869 | Manifest-DECLAREd coverage resolves an outside file WITHOUT |
| function | test_compute_affected_test_file_change_includes_itself |
898 | |
| function | test_compute_affected_multiple_changed_files_union |
911 | |
| function | test_compute_affected_never_loads_ast_when_no_python_src_changed |
927 | A non-.py src change (e.g. a .pl rule file) must not trigger an AST |
| function | test_is_stale_missing_file |
954 | |
| function | test_is_stale_fresh_file |
958 | |
| function | test_is_stale_old_file |
964 | |
| function | test_load_ast_regenerates_when_stale |
975 | _load_ast calls the injected regenerate seam exactly once when |
| function | test_load_ast_skips_regeneration_when_fresh |
995 | |
| function | test_regenerate_ast_real_subprocess_invocation |
1006 | Exercises the REAL (non-injected) regenerate_ast -- a genuine |
| function | test_build_module_file_map_absolute_path_outside_repo_root_is_rebased |
1032 | An absolute file_path that isn't under repo_root is REBASED onto it. |
| function | test_build_module_file_map_unrebaseable_absolute_path_left_as_is |
1056 | A foreign absolute path with NO recognizable repo anchor is left alone. |
| function | test_build_test_import_map_skips_entries_without_file_path |
1073 | |
| function | test_build_test_import_map_skips_bare_package_import |
1078 | An import of exactly orchestrata_ultimate. (nothing after the |
| function | test_main_text_output_shows_escalation_reason |
1093 | |
| function | test_main_default_since_head_when_neither_flag_given |
1109 | No --since/--files -> falls back to changed_files_since("HEAD", ...) |
| function | test_main_files_json_output |
1121 | |
| function | test_main_files_json_hook_resolves_via_reference_edges |
1133 | The headline behavior: a hook change resolves to its covering tests |
| function | test_main_files_text_output_smoke_floor |
1146 | A src/ .py path with NO node in the serialized closure (nonexistent |
| function | test_main_real_gateway_audit_change_hits_real_test |
1165 | Against the REAL project AST maps: the plan's own verification example. |
| function | test_changed_files_since_head_returns_list |
1177 | A real git diff --name-only HEAD against this repo -- content is |
| function | test_main_subprocess_entrypoint_smoke |
1185 | A genuine subprocess invocation of the CLI (not just calling main() |
| function | test_module_file_map_rebases_paths_from_a_foreign_checkout |
1206 | A committed index serialized in ANOTHER checkout still maps correctly. |
| function | test_module_file_map_keeps_local_and_relative_paths_unchanged |
1227 | Rebasing must not disturb the paths that already resolve correctly. |
| function | test_drop_absent_tests_removes_a_phantom_and_escalates |
1243 | A convention rule may name a module that was never written. |
| function | test_drop_absent_tests_is_a_no_op_when_every_path_exists |
1272 | It must not manufacture an escalation out of a healthy answer. |
| function | test_drop_absent_tests_accepts_a_directory |
1288 | The smoke floor is directories, not modules -- tests/infrastructure. |
| function | test_the_irc_producer_trio_resolves_to_its_real_module |
1300 | The manifest reaches the module that actually covers the IRC producer. |
| function | test_drop_absent_tests_never_escalates_over_the_smoke_floor |
1318 | The smoke floor is a constant, not a claim resolved from the diff. |
| function | test_drop_absent_tests_still_catches_a_phantom_beside_the_smoke_floor |
1341 | Exempting the floor must not blind the check to a real phantom. |
| function | test_reference_edges_json_covers_every_hook_on_disk |
1368 | Every .claude/hooks/*.sh must be reachable in the committed |
| function | test_phantom_stem_does_not_veto_real_reference_coverage |
1398 | The 2026-08-11 serialize case: a file resolved by reference edges |
| function | test_phantom_stem_without_any_coverage_still_escalates |
1439 | The suppression is coverage-gated: a phantom stem with NO reference |
| function | test_load_ast_never_rewrites_the_canonical_artifact |
1468 | The 2026-08-11 drift: a stale-mtime regen rewrote plans/ast-ultimate.json |
| function | test_gitignore_resolves_to_smoke_floor_via_manifest |
1500 | Config that nothing executes at test time (.gitignore — collection- |
| function | test_drop_absent_tests_distinguishes_a_deletion_from_a_phantom |
1512 | Same symptom, opposite remedies — so the reason must name the right cause. |
| function | test_drop_absent_tests_drops_a_test_transferred_to_codetools_without_refusing |
1563 | A deleted test whose coverage MOVED to codetools (MOVE-109) is neither a |
| function | test_drop_absent_tests_drops_a_transferred_path_beside_a_refused_phantom |
1602 | With a phantom in the same selection the result refuses, and the |
| function | test_drop_absent_tests_without_changed_reports_every_absence_as_a_phantom |
1622 | The default keeps the original behaviour: with no diff to consult, an absent |
| function | test_claude_basename_reference_edge_resolves_without_escalation |
1646 | (a) A claude/hooks file whose basename is a string literal in a |
| function | test_claude_directory_convention_bounds_uncovered_hook |
1675 | (b) A claude/ file with NO more-specific resolution (no stem test, no |
| function | test_non_claude_unresolved_file_still_escalates |
1703 | (c) Fail-closed pin: the claude/ directory-convention fallback is |
| function | test_untested_names_the_test_to_write |
1736 | The report has to be actionable, not just correct. |
| function | test_a_script_with_a_stem_test_resolves_instead_of_being_untested |
1753 | The regression this whole change came from, against the REAL repo. |
| function | test_untested_survives_drop_absent_tests |
1769 | _drop_absent_tests rebuilds the result; the finding must not fall out. |
| function | test_real_repo_intercept_bash_change_resolves_without_escalation |
1781 | (d) The exact measured 2026-08-14 defect, pinned against the REAL |
| function | test_partial_reference_edge_and_stem_convention_both_selected |
1803 | DEFECT 1 fix: a changed file with ONE (partial/unrelated) reference |
| function | test_real_repo_ship_sh_selects_both_referenced_and_stem_test |
1840 | DEFECT 1 fix, real-repo pin: deploy/ship.sh's one reference edge |
| function | test_claude_file_with_wrong_referrer_still_gets_claude_fallback |
1852 | DEFECT 2 fix (b): a WRONG synthetic reference edge for a claude/ file |
| function | test_referrer_derived_phantom_stem_does_not_escalate |
1891 | DEFECT 4 fix: a REFERRER's own stem-expansion being a phantom must |
| function | test_real_repo_graph_test_preflight_referrer_phantom_does_not_escalate |
1965 | DEFECT 4 fix, real-repo pin — drives the CLI layer via |
| function | test_real_repo_graph_test_preflight_via_cli_main |
1984 | DEFECT 4 fix, real-repo pin via the actual main() argparse path |
| function | test_real_repo_test_isolation_audit_referrer_phantom_does_not_escalate |
2000 | DEFECT 4 fix, real-repo pin — the second file bound by the same |
| function | test_phantom_only_referrer_with_no_other_source_escalates |
2031 | Reproduces the verifier's synthetic probe: scripts/probe_tool.py |
| function | test_phantom_referrer_with_surviving_expansion_does_not_escalate |
2079 | Same referrer shape as above, but this time |
| function | test_gitignore_still_escalate_false_after_finding2_fix |
2123 | Pin: .gitignore's OWN manifest rule (a direct, human-declared |
| function | test_manifest_self_change_resolves_its_guard_test |
2137 | DEFECT 3 fix, real-repo pin: changing the manifest itself must select |
| function | test_env_endpoint_config_resolves_via_keys_not_escalation |
2159 | RUL-032 (2026-09-22): env/*.env no longer escalates -- it resolves to |
| function | test_env_key_named_by_nothing_reports_and_stays_smoke_floor_only |
2192 | |
| function | test_env_file_with_no_keys_changed_is_smoke_floor_only |
2212 | |
| function | test_env_key_resolves_to_modules_that_name_it |
2228 | RUL-032 worked example: a changed env key (the shape |
| function | test_env_key_matches_whole_names_never_substrings |
2259 | A key is NAMED only where it stands as a whole identifier. |
| function | test_env_key_diff_against_base_rev_resolves_only_changed_keys |
2300 | RUL-032, real diff path: only the KEY that actually changed between |
| function | test_env_test_env_never_escalates_real_repo |
2336 | RUL-032, real-repo pin: env/test.env no longer triggers the blanket |
| function | test_env_dev_and_prod_env_also_resolve_not_escalate |
2347 | The rule is env/*.env, not a test.env special case. |
| function | test_undiffable_root_conftest_bounds_widest_which_is_the_suite |
2355 | Fix 2 (2026-08-14) made EVERY conftest escalate — that pinned the |
| function | test_undiffable_nested_conftest_bounds_to_its_subtree |
2383 | The 2026-09-21 refinement: EVERY conftest escalating was MVP scope |
| function | test_tests_conftest_py_undiffable_bounds_widest_real_repo |
2401 | Real-repo pin: compute_affected without a base_rev cannot diff the |
| function | test_stem_convention_ignores_non_code_suffix |
2412 | Fix 4, fixture pin: a .md file whose stem happens to collide with a |
| function | test_stem_convention_allows_sh_and_pl_suffixes |
2425 | The restriction is a suffix ALLOWLIST (.py/.sh/.pl), not a .py-only |
| function | test_claude_commands_session_md_is_doc_inert_not_stem_matched |
2438 | Fix 4, real-repo pin: claude/commands/session.md used to stem-match |
| function | test_fail_closed_repin_still_escalates_after_all_four_fixes |
2449 | Confirms builder B/C's fail-closed guard survives these changes |
| function | test_deleted_src_module_resolves_to_former_importers_at_base |
2592 | Bug A, measured 2026-09-21 on the real push range: |
| function | test_deleted_src_module_without_base_rev_escalates |
2613 | Conservative direction: --files mode has no range base, so a deleted |
| function | test_deleted_src_module_absent_from_base_snapshot_escalates |
2627 | A deleted module the range-base snapshot never serialized (e.g. it |
| function | test_conftest_import_only_edit_selects_nothing_extra |
2720 | Bug C, class 1 — the measured case: all three conftest changes in the |
| function | test_conftest_fixture_body_change_selects_consumers |
2740 | Bug C, class 2: a non-import line inside a fixture-decorated def's |
| function | test_nested_conftest_fixture_body_change_stays_in_subtree |
2763 | Bug C, class 2 with a DIRECTORY conftest: consumers are searched in |
| function | test_conftest_module_level_change_bounds_to_scope_subtree |
2785 | Bug C, class 3, NESTED conftest: module-level non-import code |
| function | test_root_conftest_module_level_change_is_honestly_the_suite |
2802 | Bug C, class 3, ROOT conftest: the root conftest's scope subtree IS |
| function | test_is_stale_index_content_age_beats_checkout_age |
2821 | A committed index whose mtime is the checkout's (fresh by wall-clock) |
| function | test_plan_affected_run_bounded_runs_the_subset |
2866 | |
| function | test_plan_affected_run_named_full_records_the_names |
2875 | |
| function | test_plan_affected_run_refused_aborts_naming_the_missing_fact |
2900 | |
| function | test_plan_affected_run_refused_with_decision_proceeds |
2925 | |
| function | test_plan_affected_run_refused_with_decision_surfaces_named_full |
2953 | RUL-040: a refused resolution that ALSO carries named_full verdicts (a |