Skip to content

perf: single-pass two-phase discovery with combined filtering#4677

Merged
thomhurst merged 1 commit intomainfrom
perf/single-pass-two-phase-discovery
Feb 6, 2026
Merged

perf: single-pass two-phase discovery with combined filtering#4677
thomhurst merged 1 commit intomainfrom
perf/single-pass-two-phase-discovery

Conversation

@thomhurst
Copy link
Owner

Summary

  • Merge ExpandSourcesForDependencies into CollectTestsWithTwoPhaseDiscoveryAsync to eliminate double enumeration of test descriptors
  • Previously: descriptors were enumerated once to find dependency class names, then enumerated again for filtering and materialization
  • Now: all sources are enumerated once with type-level and descriptor-level filtering applied during the same pass, while indexing everything for dependency resolution
  • Net result: -140 lines, +60 lines — simpler and faster

Test plan

  • Verify two-phase discovery with filters still works correctly
  • Verify cross-class dependency resolution still includes dependency targets
  • Verify transitive dependency expansion works
  • Run full engine test suite

🤖 Generated with Claude Code

Merge ExpandSourcesForDependencies into CollectTestsWithTwoPhaseDiscoveryAsync
to eliminate double enumeration of test descriptors. Now all sources are
enumerated once with type-level and descriptor-level filtering applied
during the same pass, while indexing everything for dependency resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link
Contributor

claude bot commented Feb 6, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

This is a clean performance optimization that successfully eliminates double enumeration of test descriptors by merging two passes into one. The refactoring:

  • Removes ~80 lines of code while maintaining all functionality
  • Aligns with the "Performance First" principle from CLAUDE.md
  • Properly guards the cast to ITestDescriptorSource with the check on line 51
  • Maintains correct dependency resolution by indexing all descriptors regardless of filter matches
  • Correctly applies both type-level and descriptor-level filtering in a single pass

The logic is sound and the changes improve both performance and code maintainability.

@thomhurst thomhurst enabled auto-merge (squash) February 6, 2026 08:49
@thomhurst thomhurst merged commit 493f6e3 into main Feb 6, 2026
12 of 13 checks passed
@thomhurst thomhurst deleted the perf/single-pass-two-phase-discovery branch February 6, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant