Implement project-based testing architecture for multi-project workspaces#37
Closed
Implement project-based testing architecture for multi-project workspaces#37
Conversation
Copilot
AI
changed the title
[WIP] Implement feature for multiple projects per workspace
Implement project-based testing architecture for multi-project workspaces
Jan 7, 2026
- Created ProjectAdapter and WorkspaceDiscoveryState interfaces - Added project utility functions (ID generation, scoping, nested project detection) - Updated PythonResultResolver to support optional projectId parameter - Modified populateTestTree to create project-scoped test IDs - Updated TestDiscoveryHandler to handle project-scoped error nodes Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Added project-based state maps (workspaceProjects, vsIdToProject, fileUriToProject, projectToVsIds) - Implemented discoverWorkspaceProjects() to query Python Environment API - Created createProjectAdapter() to build ProjectAdapter from PythonProject - Added createDefaultProject() for backward compatibility - Imported necessary types from environment API - Added flag to enable/disable project-based testing Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Modified activate() to check useProjectBasedTesting flag - Calls discoverWorkspaceProjects() for each workspace when enabled - Populates workspaceProjects map with discovered projects - Created activateLegacyWorkspace() for backward compatibility - Falls back to legacy mode if project discovery fails - Maintains full backward compatibility with flag disabled Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
0eecfd3 to
b670e8e
Compare
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.
Adds infrastructure to support multiple Python projects (each with distinct Python executables and test configurations) within a single VS Code workspace. Currently behind a feature flag (
useProjectBasedTesting = false) for safe deployment.Core Infrastructure
{projectId}::{testPath}prevents ID collisions between projectsResult Resolver Updates
projectIdparameter toPythonResultResolverconstructorpopulateTestTree()andTestDiscoveryHandlerto propagate project scopingProject Discovery Integration
discoverWorkspaceProjects(): Queries Python Environment API for projects, filters to workspace, createsProjectAdapterinstancescreateProjectAdapter(): Resolves Python environment, creates project-scoped resolver and provider-specific adapterscreateDefaultProject(): Fallback that mimics single-workspace behavior using workspace interpreterworkspaceProjects: Project registry by workspace URIvsIdToProject: O(1) test-to-project lookup for executionfileUriToProject: File-to-project mapping for file watchingprojectToVsIds: Project-to-tests mapping for cleanupActivation Flow
Graceful degradation: Any failure in project discovery automatically falls back to legacy single-workspace mode. All new code paths are disabled by default until Phases 3-4 (discovery with overlap resolution, test execution) are implemented.
Files Changed
New:
testController/common/projectAdapter.ts- Type definitionstestController/common/projectUtils.ts- UtilitiesModified:
testController/controller.ts- Project discovery and state managementtestController/common/resultResolver.ts- Project scoping supporttestController/common/testDiscoveryHandler.ts- Scoped error nodestestController/common/utils.ts- Scoped test ID creationOriginal prompt
ok great! now.... do this and implement it please! you got this
[Chronological Review: The conversation began with the user asking about how control keeps different workspaces separate during creation and discovery. This led to a deeper investigation into how results from adapters appear in the UI. The user then proposed implementing a new feature allowing multiple projects per workspace, detailing the hierarchy of workspaces, projects, and tests. The user explored the implications of using the resultResolver and discussed the structure of project objects and their connection to workspaces. The conversation evolved to address potential issues with multiple resultResolvers, the use of a comprehensive API for mapping URIs to executables, and a complex discovery scenario involving overlapping projects. The user requested a markdown document summarizing the design, which was created and subsequently updated based on user feedback. The user then posed several questions and directives regarding error handling, settings, and project management, leading to a final request for implementation.][Intent Mapping: The user explicitly requested explanations of workspace separation, project organization, and the role of resultResolvers. They sought to clarify the structure of project objects and how to manage state across multiple layers. The user also aimed to create a design document to guide future implementation and requested updates based on specific notes and questions.]
[Technical Inventory: Key technologies discussed include the VSCode API for managing workspaces and projects, Python executables for project execution, and the resultResolver for handling test results. The conversation also touched on the use of absolute paths and cancellation tokens for managing test runs.]
[Code Archaeology: The user referenced the file
/Users/eleanorboyd/vscode-python/src/client/testing/testController/controller.tsfor ongoing modifications. They also mentioned the markdown document located at/Users/eleanorboyd/vscode-python/docs/project-based-testing-design.md, which was created to summarize the design discussions.][Progress Assessment: The user has successfully outlined the project structure and its relationship to workspaces, discussed the handling of overlapping test results, and created a design document. They have also provided specific directives for error handling and project settings.]
[Context Validation: All critical information for continuation is captured, including the structure of projects, the role of resultResolvers, and the handling of settings and errors.]
[Recent Commands Analysis: The last agent commands involved updating the markdown document based on user notes and questions. The user provided a series of directives regarding error handling, project settings, and implementation details. The immediate pre-summarization state involved preparing to implement the discussed features based on the updated design document.]
1. Conversation Overview: - Primary Objectives: The user requested explanations on workspace separation, project organization, and the role of resultResolvers. They aimed to create a design document to guide future implementation. - Session Context: The conversation flowed from initial inquiries about workspace management to detailed discussions on project structures, error handling, and the creation of a design document. - User Intent Evolution: The user's needs evolved from understanding existing structures to defining new features and implementation strategies.- Technical Foundation:
- VSCode API: Used for managing workspaces and projects.
- Python Executables: Associated with each project for execution.
- ResultResolver: Handles test results and overlaps.
- Codebase Status:
- File Name:
- Purpose: Central controller for managing test execution and results.
- Current State: Ongoing modifications to implement project-based testing features.
- Key Code Segments: Discussions around managing state and handling results.
- Dependencies: Relies on the VSCode API and Python executables.
- Problem Resolution:
- Issues Encountered: Managing overlapping test results and ensuring proper project associations.
- Solutions Implemented: Defined structures for projects and their relationships to workspaces.
- Debugging Context: Ongoing discussions about error handling and settings management.
- Lessons Learned: Importance of clear project structures and effective error messaging.
- Progress Tracking:
- Completed Tasks: Defined project structures and created a design document.
- Partially Complete Work: Implementation of discussed features is pending.
- Validated Outcomes: Clear understanding of workspace and project relationships.
- Active Work State:
- Current Focus: Preparing to implement features based on the updated design document.
- Recent Context: User provide...
/Users/eleanorboyd/vscode-python/src/client/testing/testController/controller.tsCreated from VS Code.
💡 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.