-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(core): support public GitHub extensions with older Git #9680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -144,7 +144,12 @@ async function assertPinnedGitSupported(): Promise<void> { | |||||||||||||||||||||||
| (version.major === MINIMUM_PINNED_GIT_VERSION.major && | ||||||||||||||||||||||||
| version.minor < MINIMUM_PINNED_GIT_VERSION.minor) | ||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||
| throw new Error('Public extension Git installs require Git 2.37 or newer.'); | ||||||||||||||||||||||||
| const detectedVersion = [version.major, version.minor, version.patch] | ||||||||||||||||||||||||
| .filter((component) => component !== undefined) | ||||||||||||||||||||||||
| .join('.'); | ||||||||||||||||||||||||
|
Comment on lines
+147
to
+149
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] When Git is not installed at all, simple-git's
Suggested change
(plus a test mocking 中文说明当完全没有安装 Git 时,simple-git 的 — qwen3.8-max via Qwen Code /review (v0.21.15) |
||||||||||||||||||||||||
| throw new Error( | ||||||||||||||||||||||||
| `Public extension Git installs require Git 2.37 or newer for secure DNS pinning; found Git ${detectedVersion}. Upgrade Git, or install the extension from a local path or archive instead.`, | ||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The minimum version is hardcoded as the literal "2.37" in this message, duplicating
Suggested change
中文说明最低版本在这条消息中被硬编码为字面量 "2.37",与 — qwen3.8-max via Qwen Code /review (v0.21.15) |
||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
|
Comment on lines
+150
to
+152
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The improved message never reaches the second of its two consumers. On the update-check path, class ExtensionGitTooOldError extends Error {}
// assertPinnedGitSupported: throw new ExtensionGitTooOldError(...)
// checkForExtensionUpdate's catch:
if (
error instanceof ExtensionCredentialUnavailableError ||
error instanceof ExtensionGitTooOldError
) {
throw error;
}
// note: checkAllExtensionsForUpdates has its own .catch(() => ERROR)
// (extensionManager.ts:3015-3019) that would need the same rethrow中文说明改进后的消息没有到达它的第二个使用者。在更新检查路径上, — qwen3.8-max via Qwen Code /review (v0.21.15) |
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] Neither new test exercises the
undefined-component branch of.filter((component) => component !== undefined)— both supplymajor,minor, andpatch. A mutation probe confirmed that deleting the filter keeps both new tests green (with inputs{2,34,1}and{2,37,0}the join output is identical either way). The discriminating input is a version result without a patch component, which the filter itself anticipates: without the filter the message degrades tofound Git 2.34..(double dot —joinrendersundefinedas the empty string, observed in the probe), and no test fails. Add a case like:The assertion
found Git 2.34. Upgrade Gitfails against the double-dot output, so it pins the filter's behavior.中文说明
两个新测试都没有覆盖
.filter((component) => component !== undefined)的undefined分量分支——它们都提供了major、minor和patch。变异探针确认:删除该 filter 后两个新测试仍然通过(对于输入{2,34,1}和{2,37,0},join 的输出在两种情况下完全相同)。判定性输入是不含 patch 分量的版本结果——这正是 filter 本身所预期的场景:若没有 filter,消息会退化为found Git 2.34..(双点——join把undefined渲染为空字符串,探针已观察到),且没有任何测试失败。建议补充如上代码块所示的用例;断言found Git 2.34. Upgrade Git在出现双点输出时会失败,从而钉住 filter 的行为。— qwen3.8-max via Qwen Code /review (v0.21.15)