Skip to content

Conversation

Copy link

Copilot AI commented Dec 1, 2025

Decomposes the monolithic PythonResultResolver class into focused, testable components following the design spec in resultHandlerRefactor.md.

Changes

New Components

  • TestItemIndex - Stateful per-workspace component managing ID mappings between Python test IDs and VS Code TestItems. Provides O(1) lookups with validation and tree-search fallback.
  • TestDiscoveryHandler - Stateless handler for discovery payload processing and test tree population
  • TestExecutionHandler - Stateless handler for execution results (pass/fail/skip/error/subtest)
  • TestCoverageHandler - Stateless handler for coverage payload processing

Architecture

  • PythonResultResolver becomes a pure facade delegating to static singleton handlers
  • Only TestItemIndex maintains state (per workspace)
  • Handlers are stateless and safely shared across workspaces
// Before: monolithic class with mixed concerns
class PythonResultResolver {
    public runIdToTestItem: Map<string, TestItem>;
    public _resolveDiscovery(...) { /* 50+ lines */ }
    public _resolveExecution(...) { /* 100+ lines */ }
    public _resolveCoverage(...) { /* 50+ lines */ }
}

// After: facade with delegated handlers
class PythonResultResolver {
    private testItemIndex: TestItemIndex;
    private static discoveryHandler = new TestDiscoveryHandler();
    private static executionHandler = new TestExecutionHandler();
    private static coverageHandler = new TestCoverageHandler();
    
    public _resolveDiscovery(payload, token) {
        PythonResultResolver.discoveryHandler.processDiscovery(
            payload, this.testController, this.testItemIndex, ...
        );
    }
}

Tests

  • Added 16 unit tests for TestItemIndex covering registration, lookup, validation, and cleanup
  • All 10 existing PythonResultResolver tests pass unchanged
Original prompt

execute the plan described in this markdown file

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits December 1, 2025 03:08
- Created TestItemIndex class to manage ID mappings between Python test IDs and VS Code TestItems
- Updated PythonResultResolver to use TestItemIndex internally
- Maintained backward compatibility via getters that expose internal maps
- Added comprehensive unit tests for TestItemIndex (16 tests)
- All existing Result Resolver tests still pass

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Created TestDiscoveryHandler class for stateless discovery processing
- Handler processes discovery payloads and updates test tree
- Delegates to existing populateTestTree function for backward compatibility
- PythonResultResolver now uses static discoveryHandler instance
- All existing tests pass (10 Result Resolver tests, 16 TestItemIndex tests)

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Created TestExecutionHandler class for stateless execution processing
- Handler processes execution payloads and returns subtest statistics
- Removed old handler methods from PythonResultResolver
- PythonResultResolver now uses static executionHandler instance
- All existing tests pass (10 Result Resolver tests, 16 TestItemIndex tests)

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Created TestCoverageHandler class for stateless coverage processing
- Handler processes coverage payloads and returns detailed coverage data
- PythonResultResolver now uses static coverageHandler instance
- Simplified imports in resultResolver.ts
- All existing tests pass (10 Result Resolver tests, 16 TestItemIndex tests)

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Fixed logic error in collectAllTestCases to properly recurse through children
- Fixed getTestItem to have proper recursive tree search
- Added findTestItemById helper for recursive tree traversal
- All 26 tests pass (16 TestItemIndex + 10 Result Resolver)

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
Copilot AI changed the title [WIP] Execute plan described in markdown file Refactor PythonResultResolver into modular components Dec 1, 2025
Copilot AI requested a review from eleanorjboyd December 1, 2025 03:30
Copilot finished work on behalf of eleanorjboyd December 1, 2025 03:30
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.

2 participants