Skip to content

Conversation

Copy link

Copilot AI commented Dec 1, 2025

Separates stateful ID mappings from stateless payload processing in PythonResultResolver to improve maintainability and testability.

Architecture

PythonResultResolver (facade, per-workspace)
├── TestItemIndex (stateful, per-workspace)
│   └── runId ↔ vsId ↔ TestItem mappings
├── TestDiscoveryHandler (stateless singleton)
├── TestExecutionHandler (stateless singleton)
└── TestCoverageHandler (stateless singleton)

Changes

New components:

  • testItemIndex.ts — Manages persistent ID mappings with validation and cleanup
  • testDiscoveryHandler.ts — Processes discovery payloads, builds test tree
  • testExecutionHandler.ts — Processes execution payloads, handles all outcome types
  • testCoverageHandler.ts — Processes coverage payloads, creates FileCoverage objects

Interface changes:

  • Added ITestIdMaps interface extracted from ITestResultResolver for cleaner handler signatures
  • populateTestTree now takes ITestIdMaps instead of full resolver

PythonResultResolver updates:

  • Now pure facade delegating to singleton handlers
  • Exposes maps via getters for backward compatibility
  • State limited to: testItemIndex, subTestStats, detailedCoverageMap

Usage

// Before: All logic in PythonResultResolver
resolver._resolveDiscovery(payload, token);

// After: Delegates to stateless handler
TestDiscoveryHandler.processDiscovery(
    payload,
    testController,
    testItemIndex,  // stateful component passed in
    workspaceUri,
    testProvider,
    token
);

Tests

  • 32 new unit tests covering all extracted components
  • All existing ResultResolver tests pass
Original prompt

execute this plan as described

Created from VS Code via the GitHub Pull Request extension.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Execute project plan as outlined Refactor PythonResultResolver: Extract stateless handlers Dec 1, 2025
Copilot AI requested a review from eleanorjboyd December 1, 2025 03:44
Copilot finished work on behalf of eleanorjboyd December 1, 2025 03:44
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