Orchestrata Ultimate › Tests › Reference › scripts › test_sweep_test_pollution

Tests reference — tests/scripts/test_sweep_test_pollution.py

Module of tests/scripts, split out because the directory page would be too large.

Prose pending.

tests/scripts/test_sweep_test_pollution.py

source · 47 tests · 1764 lines

Tests for scripts/sweep_test_pollution.py — the KG test-pollution sweeper.

Kind Name Line Description
function test_count_sees_marker_scoped_nodes 96
function test_sweep_deletes_marked_and_spares_survivor 101
function test_sweep_is_idempotent 124
function test_unmarked_global_fingerprint_matches_seeded 130 The production (marker-less) fingerprint matches 'test'-id nodes.
function test_qualified_canonical_id_survives_global_fingerprint 140 A project-qualified id containing 'test' is NOT pollution.
function test_audit_husk_matches_and_scoped_entry_survives 178 Legacy AuditEntry husks (literal entry_id, no test_id) match the
function test_rule_file_id_husk_matches_and_real_path_survives 229 Rule pollution keyed by file_id (2026-07-19 audit): tests that
function test_sweep_if_polluted_sweeps_real_pollution_and_reports_breakdown 277 The success path (pollution found -> swept -> breakdown appended) of
function test_sweep_if_polluted_with_no_uris_returns_clean 313 An env with no NEO4J_URI at all -> the per-URI loop never runs ->
function test_main_reports_unreachable_db_and_overall_clean 320 main()'s per-URI except branch (unreachable DB) and the overall
function test_main_apply_sweeps_real_pollution_via_env_seam 336 main(["--apply"], env=...) against a single, real, polluted URI
function test_all_uris_returns_the_single_routing_endpoint 378 Worker isolation is a DATABASE now, not an instance.
function test_all_uris_falls_back_to_kg_uri_and_is_empty_when_unset 393
function test_all_uris_empty_env_yields_nothing 398
function test_leased_elsewhere_false_for_non_worker_database 407
function test_leased_elsewhere_false_when_slot_is_free 412
function test_leased_elsewhere_false_for_own_lease 429
function test_leased_elsewhere_true_for_other_owner 443
function test_all_kg_targets_excludes_a_leased_worker_database 451 The pure target-derivation function itself must skip a leased slot --
function test_all_kg_targets_includes_own_leased_slot 471
function test_all_kg_targets_pinned_databases_are_never_lease_filtered 488 KG_DATABASES is an explicit, deliberate override -- it bypasses the
function test_driver_requires_env 506
function test_sweep_if_polluted_never_raises_on_dead_kg 514
function test_cli_dry_run_is_read_only 523 Dry-run reports without deleting: the seeded nodes survive it.
function test_session_husk_matches_and_real_session_survives 539 Pre-canonicalisation Session husks (test-prefixed bare id, no
function test_workitem_husk_matches_and_linked_or_real_item_survives 586 Orphaned carryover WorkItem husks (isolated, literal text 'do work',
function test_real_project_slug_is_protected_by_construction 669 The exact REAL_PROJECT_SLUG allowlist value can never satisfy the
function test_project_slug_test_marker_matches_and_id_bearing_project_survives 706 Project's canonical merge key is slug, not id — pytest fixtures
function test_project_tmp_root_path_matches 750 A Project synced from an ephemeral /tmp fixture workspace matches,
function test_project_idless_scratch_matches_but_defines_hub_is_exempt 786 An id-less, unmarked Project with no DEFINES edge (an un-cleaned
function test_legacy_file_dir_count_matches_idless_only 882 count_legacy_file_dir_pollution matches exactly the id-less File and
function test_legacy_file_dir_sweep_deletes_idless_and_spares_id_bearing 894 The core B3 acceptance case: seed an id-less File+Directory pair and
function test_legacy_file_dir_sweep_is_idempotent 936
function test_sweep_if_polluted_never_sweeps_legacy_file_dir_on_primary 944 The legacy id-less File/Directory criterion is PRIMARY-EXEMPT: a
function test_sweep_if_polluted_sweeps_legacy_file_dir_on_worker_uri 995 Positive half of the worker-only gate proof: a target that is NOT
function test_deep_marker_lowercase_hex_id_matches_and_nonhex_canonical_survives 1055 Rule 1: a colon-qualified id carrying the lowercase _test_<hex>
function test_deep_marker_uppercase_hex_id_matches 1103 Rule 2: the uppercase _TEST_[0-9a-f]{8,} variant the test_id
function test_deep_marker_test_id_property_matches_and_unmarked_node_survives 1135 Rule 3: n.test_id IS NOT NULL matches directly, independent of
function test_deep_marker_underscore_test_project_namespace_matches 1179 A _test_-prefixed PROJECT namespace is test exhaust and must match.
function test_deep_marker_test_labels_match 1231 Rule 4: nodes carrying a test-only label — a dynamic
function test_deep_marker_session_probe_prefixes 1283 Session probe prefixes: kgtest- (and INTENTPROBE-/POLICYPROBE-/
function test_deep_marker_count_and_sweep_scoped_by_probe 1336 The functional (real DETACH DELETE) proof: ``count_deep_marker_
function test_sweep_if_polluted_deep_false_spares_deep_only_pollution 1385 sweep_if_polluted defaults to deep=False — DEEP-MARKER-only
function test_sweep_if_polluted_deep_true_sweeps_deep_only_pollution_on_primary 1428 sweep_if_polluted(env, deep=True) sweeps DEEP-MARKER-only
function test_main_deep_apply_sweeps_deep_only_pollution_via_env_seam 1471 CLI wiring for --deep: without it, main(["--apply"], ...)
function test_deep_marker_fact_source_test_matches_and_prod_fact_survives 1527 D2 rule (plans/hub-link-plan.md §4.12): a :Fact self-declaring
function test_deep_marker_guarded_conditions_match_the_unguarded_oracle 1699 Old (regex-only) conditions and the new (guarded) conditions select the