Skip to content
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

fix(cli): notices for ranged alpha modules are not showing up correctly #163

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/notices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export abstract class NoticesFilter {
// component can match more than one actual component
for (const ands of ors) {
const matched = ands.map(affected => actualComponents.filter(actual =>
NoticesFilter.componentNameMatches(affected, actual) && semver.satisfies(actual.version, affected.version)));
NoticesFilter.componentNameMatches(affected, actual) && semver.satisfies(actual.version, affected.version, { includePrerelease: true })));

// For every clause in the filter we matched one or more components
if (matched.every(xs => xs.length > 0)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "tree-0.1",
"tree": {
"id": "App",
"path": "",
"children": {
"integ-idp": {
"id": "integ-idp",
"path": "integ-idp",
"children": {
"identitypool": {
"id": "identitypool",
"path": "integ-idp/identitypool",
"constructInfo": {
"fqn": "@aws-cdk/aws-cognito-identitypool-alpha.IdentityPool",
"version": "2.175.0-alpha.0",
"metadata": ["*", "*"]
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/integ-tests-alpha.IntegTest",
"version": "0.0.0"
}
},
"Tree": {
"id": "Tree",
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.4.2"
}
}
},
"constructInfo": {
"fqn": "aws-cdk-lib.App",
"version": "0.0.0"
}
}
}
21 changes: 21 additions & 0 deletions packages/aws-cdk/test/notices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ const NOTICE_FOR_APIGATEWAYV2 = {
schemaVersion: '1',
};

const NOTICES_FOR_IDENTITY_POOL = {
title: 'Regression on module foobar',
issueNumber: 1234,
overview: 'Some bug description',
components: [
{
name: "@aws-cdk/aws-cognito-identitypool-alpha.IdentityPool",
version: ">=2.74.0-alpha.0 <2.179.0-alpha.0"
}
],
schemaVersion: '1',
}

const NOTICE_FOR_APIGATEWAY = {
title: 'Regression on module foobar',
issueNumber: 1234,
Expand Down Expand Up @@ -247,6 +260,14 @@ describe(NoticesFilter, () => {
expect(NoticesFilter.filter({ data: [NOTICE_FOR_APIGATEWAYV2_CFN_STAGE], cliVersion, bootstrappedEnvironments: [], outDir: path.join(__dirname, 'cloud-assembly-trees', 'experimental-module') }).map(f => f.notice)).toEqual([NOTICE_FOR_APIGATEWAYV2_CFN_STAGE]);
});

test('module with pre-release version', () => {
// doesn't matter for this test because our data only has framework notices
const cliVersion = '1.0.0';

// module-level match
expect(NoticesFilter.filter({ data: [NOTICES_FOR_IDENTITY_POOL], cliVersion, bootstrappedEnvironments: [], outDir: path.join(__dirname, 'cloud-assembly-trees', 'experimental-module-pre-release-semver')}).map(f => f.notice)).toEqual([NOTICES_FOR_IDENTITY_POOL]);
});

test('bootstrap', () => {
// doesn't matter for this test because our data only has bootstrap notices
const outDir = path.join(__dirname, 'cloud-assembly-trees', 'built-with-2_12_0');
Expand Down