feat: add allowlist compatibility check for API proposals in extensions#289923
feat: add allowlist compatibility check for API proposals in extensions#289923joaomoreno merged 1 commit intomainfrom
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new validation step to check that API proposals declared in an extension's package.json are properly allowlisted in VS Code's product.json. This ensures consistency between what extensions use and what VS Code explicitly allows.
Changes:
- Added
areAllowlistedApiProposalsMatchingfunction to validate API proposal allowlist consistency - Integrated the new validation into the Copilot Chat compatibility check in release builds
- Added comprehensive test coverage for the new validation logic
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| build/azure-pipelines/common/versionCompatibility.ts | Added new areAllowlistedApiProposalsMatching function with logic to validate that all API proposals declared in an extension's package.json are allowlisted in product.json, handling versioned proposals by stripping version suffixes. Includes comprehensive unit tests covering various scenarios. |
| build/azure-pipelines/common/releaseBuild.ts | Integrated the new allowlist validation into the Copilot Chat compatibility check, loading product.json and calling the validation function with appropriate error handling and console output. |
Comments suppressed due to low confidence (2)
build/azure-pipelines/common/versionCompatibility.ts:431
- Trailing whitespace found at the end of the line. This should be removed to maintain code cleanliness.
build/azure-pipelines/common/versionCompatibility.ts:164 - The error message is inconsistent with VS Code's capitalization conventions. In the codebase, "product.json" is typically capitalized as "Product.json" when referring to it in user-facing messages (see line 89 in releaseBuild.ts and line 121 in the same file). For consistency with the user-facing message on line 121 of releaseBuild.ts, consider using "Product.json" instead of "product.json".
errors.push(`API proposal '${proposal}' is declared in extension '${extensionId}' package.json but is not allowlisted in product.json`);
|
|
||
| // Versioned proposal not in allowlist - incompatible | ||
| assert.strictEqual(areAllowlistedApiProposalsMatching('test.ext', ['proposalA'], ['proposalB@2']).compatible, false); | ||
|
|
There was a problem hiding this comment.
Trailing whitespace found at the end of the line. This should be removed to maintain code cleanliness.
This issue also appears in the following locations of the same file:
- line 431
| // Versioned proposal not in allowlist - incompatible | |
| assert.strictEqual(areAllowlistedApiProposalsMatching('test.ext', ['proposalA'], ['proposalB@2']).compatible, false); | |
| // Versioned proposal not in allowlist - incompatible | |
| assert.strictEqual(areAllowlistedApiProposalsMatching('test.ext', ['proposalA'], ['proposalB@2']).compatible, false); |
| compatible: false, | ||
| errors: [ | ||
| `Extension '${extensionId}' declares API proposals in package.json (${manifestProposals.join(', ')}) ` + | ||
| `but product.json does not allowlist any API proposals for this extension` |
There was a problem hiding this comment.
The error message is inconsistent with VS Code's capitalization conventions. In the codebase, "product.json" is typically capitalized as "Product.json" when referring to it in user-facing messages (see line 89 in releaseBuild.ts and line 121 in the same file). However, when used in technical contexts or inline in sentences, it's kept lowercase. For consistency with the user-facing message on line 121 of releaseBuild.ts, consider using "Product.json" at the start of error messages.
This issue also appears in the following locations of the same file:
- line 164
No description provided.