Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces SNS publishing into the ddb-publisher workflow by mapping validated config records into supplier-config CloudEvents (via @supplier-config/event-builder) and publishing them to an SNS topic in batches. It also adjusts the event-builder behavior to skip draft volume groups cleanly and wires the new SNS topic ARN through the CLI and GitHub Action.
Changes:
- Add record→event mapping and SNS batch publishing (with retry) to
ddb-publisher, and add--topic-arn/topicArnplumbing. - Update
event-buildervolume-group event building to omitundefineddraft events and update tests accordingly. - Update dependencies/lockfile and the composite GitHub Action inputs/command invocation.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/event-builder/src/volume-group-event-builder.ts | Filters out draft (undefined) events in the multi-builder. |
| packages/event-builder/src/tests/volume-group-event-builder.test.ts | Updates expectations to reflect draft events being skipped. |
| packages/event-builder/package.json | Adds main and type metadata for package resolution. |
| packages/ddb-publisher/src/types.ts | Adds topicArn to the publish plan. |
| packages/ddb-publisher/src/run.ts | Instantiates SNS client and calls SNS publish path. |
| packages/ddb-publisher/src/record-mapper.ts | New: groups records by entity and builds CloudEvents via event-builder. |
| packages/ddb-publisher/src/ddb/publish.ts | New SNS PublishBatch-based publisher with retry/backoff. |
| packages/ddb-publisher/src/cli.ts | Adds --topic-arn CLI option and passes it into the plan. |
| packages/ddb-publisher/src/tests/run.test.ts | Updates mocks/expectations for the new publish path. |
| packages/ddb-publisher/src/tests/record-mapper.test.ts | New unit tests for record→event mapping. |
| packages/ddb-publisher/src/tests/publish.test.ts | Adds unit tests for SNS publishing behavior. |
| packages/ddb-publisher/package.json | Adds SNS client + event-builder dependency. |
| package-lock.json | Updates lockfile for new dependencies (currently inconsistent). |
| actions/ddb-publish/action.yml | Adds topic-arn input and passes it to the bundled CLI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+62
to
+65
| jest.requireMock("@aws-sdk/client-sns") as unknown as { | ||
| SnsClient: jest.Mock; | ||
| }; | ||
|
|
Comment on lines
56
to
+60
| const sequenceGenerator = newSequenceGenerator(startingCounter); | ||
|
|
||
| return Object.values(volumeGroups).map((vg) => | ||
| buildVolumeGroupEvent(vg, { sequence: sequenceGenerator }), | ||
| ); | ||
| return Object.values(volumeGroups) | ||
| .map((vg) => buildVolumeGroupEvent(vg, { sequence: sequenceGenerator })) | ||
| .filter((e): e is VolumeGroupEvent => e !== undefined); |
| logStep("Blocking records found but --force enabled; continuing."); | ||
| } | ||
|
|
||
| const snsClient = new SNSClient(clientConfig); |
Comment on lines
+92
to
+96
| export async function publishRecords2(params: { | ||
| sns: SNSClient; | ||
| topicArn: string; | ||
| records: ConfigRecord[]; | ||
| }): Promise<void> { |
Comment on lines
+126
to
+127
| throw new Error( | ||
| `Failed to write ${unprocessed.length} items after retries (BatchWrite unprocessed).`, |
| --source "${{ inputs.source-path }}" \ | ||
| --env "${{ inputs.target-env }}" \ | ||
| --table "${{ inputs.table-name }}" \ | ||
| --topic-arn ${{ inputs.topic-arn }} |
Comment on lines
15
to
28
| @@ -23,5 +24,6 @@ | |||
| "test:unit": "jest", | |||
| "typecheck": "tsc --noEmit" | |||
| }, | |||
| "type": "module", | |||
| "version": "0.0.1" | |||
Comment on lines
6
to
10
| /** The name of the DynamoDB table to which records will be published. */ | ||
| tableName: string; | ||
| /** The name of the */ | ||
| topicArn: string; | ||
| /** If true, do not write to DynamoDB and do not require AWS credentials. */ |
| } | ||
|
|
||
| const snsClient = new SNSClient(clientConfig); | ||
| logStep(`Publishing ${store.records.length} record(s) to DynamoDB...`); |
| }; | ||
|
|
||
| export function mapToEvents(records: ConfigRecord[]) { | ||
| const recordsByEntity = Map.groupBy(records, (record) => record.entity); |
e05fcd5 to
fc179f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.