Skip to content

Fix path-only Python project manager defaults - #1667

Merged
Eleanor Boyd (eleanorjboyd) merged 3 commits into
microsoft:mainfrom
atomiechen:fix-optional-python-project-managers
Sep 24, 2026
Merged

Eleanor Boyd (eleanorjboyd) merged 3 commits into
microsoft:mainfrom
atomiechen:fix-optional-python-project-managers

Conversation

@atomiechen

@atomiechen Atomie CHEN (atomiechen) commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1666.

Path-only entries are valid according to the python-envs.pythonProjects setting schema:

{
    "python-envs.pythonProjects": [
        {
            "path": "backend"
        }
    ]
}

However, the manager-setting helpers called .length on the omitted envManager and packageManager properties. This caused repeated TypeError failures during post-initialization telemetry and environment lookup.

Fix

  • Treat omitted or empty project-level manager values as requests to use the corresponding default setting.
  • Mark PythonProjectSettings.envManager and .packageManager optional so the internal type matches the contributed JSON schema.
  • Add a unit test covering a path-only nested project entry and both default-manager fallbacks.

Validation

  • Reproduced with VS Code 1.130.0 and the latest stable extensions in an empty --user-data-dir / --extensions-dir profile.
  • Installed the patched 1.37.0 VSIX in a second empty profile and verified that the same workspace starts without TypeError or post-initialization failure.
  • npm run compile-tests
  • npm run lint
  • npm run unittest — 1,429 passing, 6 pending

AI disclosure: Prepared with assistance from OpenAI Codex.

@atomiechen
Atomie CHEN (atomiechen) force-pushed the fix-optional-python-project-managers branch from d7702f7 to 8a98b2f Compare July 27, 2026 10:55
@atomiechen

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@heejaechang

Heejae Chang (heejaechang) commented Aug 19, 2026 •

Copy link
Copy Markdown

🔒 Automated review in progress — Heejae Chang (@heejaechang) is auto-reviewing this PR.

test('uses default managers when a pythonProjects entry only specifies path', () => {
sinon.stub(workspaceApis, 'getConfiguration').returns(createPathOnlyProjectConfig());
sinon.stub(workspaceApis, 'getWorkspaceFolder').returns(workspaceFolder);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info · Optional note

The fallback test covers omitted manager values but not explicitly empty strings, despite the PR claiming both cases. Consider adding empty-string assertions to preserve that behavior explicitly.

[verified]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved via Review Center.

@heejaechang Heejae Chang (heejaechang) added the review-auto:approved Automated review: no blocking findings (approval posted). label Aug 19, 2026
@heejaechang

Copy link
Copy Markdown

Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.

@eleanorjboyd Eleanor Boyd (eleanorjboyd) added the bug Issue identified by VS Code Team member as probable bug label Sep 23, 2026
@eleanorjboyd

Copy link
Copy Markdown
Member

Thanks Atomie CHEN (@atomiechen) ! Sorry this has become stale, if you update it for the merge conflict I can approve and we can get this merged!

Resolve the project settings type move and cover empty manager values.

AI-Assisted-By: OpenAI Codex
@atomiechen

Atomie CHEN (atomiechen) commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Eleanor Boyd (@eleanorjboyd) The merge conflict is resolved and the PR is ready for another look when you have time. Thanks for offering to review it.

Updated this PR with the latest upstream main and resolved the conflict caused by the project settings type move. The fix now marks the manager fields optional in src/features/projectManager.ts. I also added coverage for explicitly empty manager values, as suggested in review.

Local validation: npm run compile-tests, npm run lint, npm run compile, and npm run unittest (2,413 passing, 11 pending). GitHub now reports the PR as mergeable. The new CI workflows are awaiting maintainer approval before they can run.

AI disclosure: OpenAI Codex assisted with the conflict resolution and the additional regression test. The merge commit records this with an AI-Assisted-By trailer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Re-reviewed the updated PR. The manager fields are now optional in the project settings type, both lookup helpers fall back correctly for omitted or empty values, and the added unit tests cover both cases. I found no blocking issue in the changes. CI is still pending; this approval does not replace a green run.

@eleanorjboyd
Eleanor Boyd (eleanorjboyd) merged commit b893232 into microsoft:main Sep 24, 2026
125 of 126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug review-auto:approved Automated review: no blocking findings (approval posted).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path-only pythonProjects entries crash manager initialization

6 participants