Orchestrata Ultimate › Tests › Reference › scripts › test_migrate_legacy_story_ids

Tests reference — tests/scripts/test_migrate_legacy_story_ids.py

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

Prose pending.

tests/scripts/test_migrate_legacy_story_ids.py

source · 39 tests · 483 lines

Tests for scripts/migrate_legacy_story_ids.py + the PERMANENT corpus guard.

Kind Name Line Description
class TestCorpusHasNoLegacyStoryIds 40
method TestCorpusHasNoLegacyStoryIds.test_no_legacy_story_id_anywhere_in_the_repository 41 FAILS on any legacy REQ-NNN-USn-MMM id in the real tree.
method TestCorpusHasNoLegacyStoryIds.test_no_legacy_story_heading_in_any_spec 74 Spec headings must read ## US-001, never ## US1.
class TestExclusionScope 95 What the corpus guard DOES and does NOT look at.
method TestExclusionScope.test_reports_are_excluded_so_a_failure_cannot_latch 104 reports/ is the guard's OWN OUTPUT.
method TestExclusionScope.test_the_derived_analysis_register_is_excluded 117 plans/analysis/register.json is generated by build_register.py.
method TestExclusionScope.test_the_generated_plugin_mirror_is_excluded_recursively 127 .claude is excluded at SOURCE; its generated mirror must be too.
method TestExclusionScope.test_real_source_trees_named_plugins_stay_in_scope 144 The narrow scoping, pinned.
method TestExclusionScope.test_a_double_star_pattern_is_matched_recursively_not_inertly 160 ** must mean what it looks like.
method TestExclusionScope.test_the_live_repository_has_no_legacy_ids_left 174 The whole point: after the exclusions above, the tree is clean.
class TestCanonicalStory 199
method TestCanonicalStory.test_all_legacy_widths_normalise_to_three_digits 200
class TestMigrateText 211
method TestMigrateText.test_one_digit_form 212
method TestMigrateText.test_two_digit_form 218 The shape a naive one-digit regex silently leaves behind.
method TestMigrateText.test_three_digit_dashless_form 225
method TestMigrateText.test_already_canonical_is_left_alone 231 US-001 has a dash where legacy has a digit, so it must not match.
method TestMigrateText.test_migration_is_idempotent 238
method TestMigrateText.test_mixed_corpus_line 245
method TestMigrateText.test_spec_heading_is_migrated 257
method TestMigrateText.test_canonical_heading_untouched 263
method TestMigrateText.test_unrelated_us_text_is_not_touched 269 US outside a REQ id must never be rewritten.
class TestScopeExclusions 278
method TestScopeExclusions.test_derived_ast_snapshots_are_excluded 279
method TestScopeExclusions.test_vcs_and_venv_and_worktrees_excluded 284
method TestScopeExclusions.test_source_files_are_in_scope 291
class TestCollisionSafety 298
method TestCollisionSafety.test_two_spellings_onto_one_canonical_id_are_reported 299 US1 and US001 both reach US-001; the tool must SAY so, not merge
method TestCollisionSafety.test_distinct_ids_are_not_reported_as_collisions 313
method TestCollisionSafety.test_unrecognised_collision_refuses_to_apply 320 Exit 2 and write nothing when a NEW collision appears.
class TestCLI 332
method TestCLI.test_dry_run_writes_nothing 333
method TestCLI.test_apply_writes 340
method TestCLI.test_apply_leaves_excluded_files_untouched 347
class TestDefensiveAgainstMangling 367
method TestDefensiveAgainstMangling.test_skeleton_invariant_holds_on_every_sample 368 Nothing outside a story id may change, for ANY input.
method TestDefensiveAgainstMangling.test_never_shortens 392
method TestDefensiveAgainstMangling.test_line_count_preserved_including_crlf 398
method TestDefensiveAgainstMangling.test_no_trailing_newline_preserved 406
method TestDefensiveAgainstMangling.test_trailing_newline_preserved 411
method TestDefensiveAgainstMangling.test_four_digit_sequence_survives 417
method TestDefensiveAgainstMangling.test_run_together_ids_are_left_untouched_not_half_mangled 423 Two ids concatenated with no separator are NOT rewritten.
method TestDefensiveAgainstMangling.test_json_structure_survives_and_still_parses 438
method TestDefensiveAgainstMangling.test_python_source_still_parses_after_migration 447
method TestDefensiveAgainstMangling.test_short_spec_numbers_are_left_alone 457 REQ-1-001 etc. are negative fixtures; the grammar requires 3 digits.
method TestDefensiveAgainstMangling.test_skeleton_detects_collateral_damage 465 The invariant must actually distinguish damaged from clean output.
method TestDefensiveAgainstMangling.test_idempotent_on_adversarial_samples 472