Fix orphaned test false positives on behavioral/scenario test names#1121
Merged
Fix orphaned test false positives on behavioral/scenario test names#1121
Conversation
The behavioral heuristic in find_orphaned_test_methods() used first-word matching that was too loose — common verbs like 'apply', 'resolve', 'build' matched source methods with those prefixes, causing scenario tests to be flagged as orphaned and auto-deleted. Replace first-segment matching with direct-prefix matching: 3+ segment test names are only flagged if the full expected source name is itself a prefix of a source method. This prevents false positives like 'apply_replace_text' being flagged because 'apply' matched 'apply_edit_ops'. Fixes #1120
Contributor
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1120 — the orphaned test detector was deleting valid tests via autofix.
Root cause: The behavioral heuristic in
find_orphaned_test_methods()used first-word matching that was too loose. Common verbs likeapply,resolve,buildmatched source methods with those prefixes, causing scenario test names to be incorrectly flagged as orphaned.Example from PR #1119: Test
apply_replace_text(a scenario test forapply_edit_ops_to_content()) was flagged because:test_→apply_replace_textapplymatches source methodapply_edit_ops→ not skippedFix: Replace first-segment matching with direct-prefix matching. 3+ segment test names are now treated as behavioral (skipped) UNLESS the full expected source name is a direct prefix of a source method name. This is more conservative — some real orphans with 3+ segments may not be caught, but we stop deleting valid tests.
Changes
test_coverage.rs: Updated behavioral heuristic infind_orphaned_test_methods()scenario_test_names_not_flagged_as_orphanedcovering the exact PR feat: Add apply logic for EditOp (Phase 1 of #1041) #1119 scenarioTest results
22/22 test_coverage tests pass. Full suite: 1087 tests, 0 failures.