Skip to content

Add compatibility checks for Copilot Chat extension in release build script#287807

Merged
joaomoreno merged 3 commits intomainfrom
joao/olive-minnow
Jan 15, 2026
Merged

Add compatibility checks for Copilot Chat extension in release build script#287807
joaomoreno merged 3 commits intomainfrom
joao/olive-minnow

Conversation

@joaomoreno
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings January 14, 2026 16:22
@joaomoreno joaomoreno self-assigned this Jan 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds compatibility checks for the GitHub Copilot Chat extension in the VS Code release build script. The checks run before releasing insider builds to ensure the latest published version of the extension is compatible with the VS Code version being released.

Changes:

  • Added version validation logic to check engine compatibility between VS Code and extensions
  • Added API proposal parsing and validation to ensure proposal versions match
  • Integrated compatibility check into the release pipeline for insider builds only
Comments suppressed due to low confidence (2)

build/azure-pipelines/common/releaseBuild.ts:87

  • This version validation logic is a simplified reimplementation of the production validation code in src/vs/platform/extensions/common/extensionValidator.ts. The production code uses a more sophisticated approach with parseVersion, normalizeVersion, and isValidVersion that handles edge cases like pre-release versions (e.g., 1.95.0-20241201), 'x' wildcards, and date-based version constraints. This simplified version may produce different results than the production validation, creating inconsistencies. Consider reusing or closely matching the production validation logic to ensure consistency.
function isEngineCompatible(productVersion: string, engineVersion: string): { compatible: boolean; error?: string } {
	if (engineVersion === '*') {
		return { compatible: true };
	}

	const versionMatch = engineVersion.match(/^(\^|>=)?(\d+)\.(\d+)\.(\d+)/);
	if (!versionMatch) {
		return { compatible: false, error: `Could not parse engines.vscode value: ${engineVersion}` };
	}

	const [, prefix, major, minor, patch] = versionMatch;
	const productMatch = productVersion.match(/^(\d+)\.(\d+)\.(\d+)/);
	if (!productMatch) {
		return { compatible: false, error: `Could not parse product version: ${productVersion}` };
	}

	const [, prodMajor, prodMinor, prodPatch] = productMatch;

	const reqMajor = parseInt(major);
	const reqMinor = parseInt(minor);
	const reqPatch = parseInt(patch);
	const pMajor = parseInt(prodMajor);
	const pMinor = parseInt(prodMinor);
	const pPatch = parseInt(prodPatch);

	if (prefix === '>=') {
		// Minimum version check
		if (pMajor > reqMajor) { return { compatible: true }; }
		if (pMajor < reqMajor) { return { compatible: false, error: `Extension requires VS Code >=${engineVersion}, but product version is ${productVersion}` }; }
		if (pMinor > reqMinor) { return { compatible: true }; }
		if (pMinor < reqMinor) { return { compatible: false, error: `Extension requires VS Code >=${engineVersion}, but product version is ${productVersion}` }; }
		if (pPatch >= reqPatch) { return { compatible: true }; }
		return { compatible: false, error: `Extension requires VS Code >=${engineVersion}, but product version is ${productVersion}` };
	}

	// Caret or exact version check
	if (pMajor !== reqMajor) {
		return { compatible: false, error: `Extension requires VS Code ${engineVersion}, but product version is ${productVersion} (major version mismatch)` };
	}

	if (prefix === '^') {
		// Caret: same major, minor and patch must be >= required
		if (pMinor > reqMinor) { return { compatible: true }; }
		if (pMinor < reqMinor) { return { compatible: false, error: `Extension requires VS Code ${engineVersion}, but product version is ${productVersion}` }; }
		if (pPatch >= reqPatch) { return { compatible: true }; }
		return { compatible: false, error: `Extension requires VS Code ${engineVersion}, but product version is ${productVersion}` };
	}

	// Exact or default behavior
	if (pMinor < reqMinor) { return { compatible: false, error: `Extension requires VS Code ${engineVersion}, but product version is ${productVersion}` }; }
	if (pMinor > reqMinor) { return { compatible: true }; }
	if (pPatch >= reqPatch) { return { compatible: true }; }
	return { compatible: false, error: `Extension requires VS Code ${engineVersion}, but product version is ${productVersion}` };
}

build/azure-pipelines/common/releaseBuild.ts:170

  • The regex pattern /\t(\w+):\s*\{([^}]+)\}/g is fragile and depends on specific formatting of the generated TypeScript file. If the file's formatting changes (e.g., different indentation, spaces vs tabs, multi-line property definitions), the regex will fail to match, potentially resulting in zero API proposals being loaded. This would cause false positives in compatibility checks. Consider either importing the actual TypeScript module (if the build environment supports it) or using a more robust parsing approach that's less sensitive to formatting.
	const proposalBlockRegex = /\t(\w+):\s*\{([^}]+)\}/g;
	const versionRegex = /version:\s*(\d+)/;

	let match;
	while ((match = proposalBlockRegex.exec(apiProposalsContent)) !== null) {
		const [, name, block] = match;
		const versionMatch = versionRegex.exec(block);
		allApiProposals[name] = {
			proposal: '',
			version: versionMatch ? parseInt(versionMatch[1]) : undefined
		};
	}

Comment thread build/azure-pipelines/common/releaseBuild.ts Outdated
Comment thread build/azure-pipelines/common/releaseBuild.ts
Comment thread build/azure-pipelines/common/releaseBuild.ts Outdated
@joaomoreno joaomoreno marked this pull request as ready for review January 15, 2026 16:56
@joaomoreno joaomoreno enabled auto-merge (squash) January 15, 2026 16:57
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • build/azure-pipelines/common/releaseBuild.ts
  • build/azure-pipelines/common/versionCompatibility.ts

@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 15, 2026
@joaomoreno joaomoreno merged commit 3ecb8e8 into main Jan 15, 2026
22 checks passed
@joaomoreno joaomoreno deleted the joao/olive-minnow branch January 15, 2026 17:16
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Mar 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants