Make standalone script template creation reliable - #1736
Conversation
|
GitHub cannot anchor PR review comments to unchanged lines in the diff. Falling back to a general PR comment for src/features/creators/newScriptProject.ts:L336.
After project registration succeeds, failures from Copilot-instruction management or |
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
Heejae Chang (heejaechang)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
1 similar comment
|
Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. |
7b39699 to
0b95ef8
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract isSameOrParentPath into common/utils/pathUtils and reuse it in newScriptProject and terminal/utils instead of duplicated local copies. Remove the niche fs.realpath/symlink containment preflight and isCopilotInstructionsDestinationContained while keeping input validation, remote-URI identity, logical workspace containment, and registration rollback. Update unit tests accordingly. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1487b95c-ac14-455f-9b7f-9770cf65e11e
Resolve the destination and workspace roots with fs.realpath and reject when the destination physically escapes the workspace (e.g. via a symlink or junction) before fs.copy. Addresses review feedback that the previous containment check was lexical only. Adds back a unit test for the symlink-escape rejection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1487b95c-ac14-455f-9b7f-9770cf65e11e
Wrap the template copy, name substitution, and project registration in a single cleanup boundary so a failure after fs.copy removes the partially created script instead of leaving it behind and blocking a clean retry. Make the test fixture's pathExists fake resolve by the requested path rather than by call order, and add a regression test for the substitution-failure rollback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1487b95c-ac14-455f-9b7f-9770cf65e11e
Move the Windows reserved-device-name test out of the script filename validator and into a shared isWindowsReservedDeviceName helper in common/utils/pathUtils, so the rule lives with the other path utilities and can be reused. newScriptProject now calls the helper and no longer imports isWindows directly. Add focused unit coverage for the helper. Rename the internal template folder new723ScriptTemplate to newInlineScriptTemplate and update all creator and test references. Only the folder name changes; the template content and the user-facing creator, class, and command are untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1487b95c-ac14-455f-9b7f-9770cf65e11e
0b95ef8 to
908f38e
Compare
9e44ce1
into
microsoft:main
Context
The existing Script project template is presented as a PEP 723 standalone script, but its placeholder metadata is not valid TOML. The quick-create path also returns without creating a file, even though external callers provide a script project name and destination.
This change fixes the existing user-facing template and file-creation workflow. It does not create, select, or expose an inline-script environment.
Why this change is needed
hello_world, not necessarily a complete.pyfilename.What changed
requires-python = ">=3.9"metadata and an empty dependency list..py; interactive creation continues requiring an explicit.pyfilename.Behavior and compatibility
Reviewer guide
Validation
npm run compile-tests --silentgit diff --check