Skip to content

Conversation

@sobolk
Copy link
Contributor

@sobolk sobolk commented Mar 5, 2025

Changes

This PR:

  1. Defines notices manifest schema.
  2. Validator for notices manifest which checks aspects not captured by zod.
    1. The validation is needed in two places: the notices hosting infra and validation of local cache.

Validation

Added tests

Checklist

  • If this PR includes a functional change to the runtime behavior of the code, I have added or updated automated test coverage for this change.
  • If this PR requires a change to the Project Architecture README, I have included that update in this PR.
  • If this PR requires a docs update, I have linked to that docs PR above.
  • If this PR modifies E2E tests, makes changes to resource provisioning, or makes SDK calls, I have run the PR checks with the run-e2e label set.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sobolk sobolk marked this pull request as ready for review March 5, 2025 22:41
@sobolk sobolk requested review from a team as code owners March 5, 2025 22:41
}),
z.object({
type: z.literal('backendComponent'),
backendComponent: z.enum(['data', 'auth', 'function', 'storage']),
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need ai here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can add it.


const noticePredicateSchema = z.discriminatedUnion('type', [
z.object({
type: z.literal('packageVersion'),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the node version will be captured by this, if not, we should add that as a predicate. What about OS as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good ideas, will do.

Comment on lines +21 to +24
z.object({
type: z.literal('frequency'),
frequency: z.enum(['command', 'deployment', 'once', 'daily']),
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't we also want the expiration to be part of the notices?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was on the edge if we should add it now or just "unpublish" a notice.
I guess it won't hurt to include it.

export type Notice = z.infer<typeof noticeSchema>;

export const noticesManifestSchema = z.object({
currentNotices: z.array(noticeSchema),
Copy link
Contributor

Choose a reason for hiding this comment

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

why current not just notices?

Comment on lines 25 to 28
assert.ok(
!ids.has(notice.id),
`Notice ids must be unique. ${notice.id} is duplicated.`
);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we throw AmplifyFault instead?

z.object({
type: z.literal('packageVersion'),
packageName: z.string(),
versionRange: z.string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I have seen some cdk notices with an upper bound and lower bound for the range (EX: Affected versions: cli: >=2.0.0 <=2.1005.0) in these cases, would the version range look like this '>=2.0.0 <=2.1005.0'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2025

🦋 Changeset detected

Latest commit: 2b9bf1b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/cli-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sobolk sobolk merged commit af90a9b into main Mar 7, 2025
54 checks passed
@sobolk sobolk deleted the notices-manifest branch March 7, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants