Skip to content

CCM-17337: Add publish to SNS topic#60

Open
stevebux wants to merge 10 commits intomainfrom
feature/CCM-17337-Publish-Supplier-Configuration-Event
Open

CCM-17337: Add publish to SNS topic#60
stevebux wants to merge 10 commits intomainfrom
feature/CCM-17337-Publish-Supplier-Configuration-Event

Conversation

@stevebux
Copy link
Copy Markdown

Description

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming
  • This PR includes code generated by a coding agent

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.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@stevebux stevebux requested a review from a team as a code owner April 29, 2026 15:33
Copilot AI review requested due to automatic review settings April 29, 2026 15:33
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 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/topicArn plumbing.
  • Update event-builder volume-group event building to omit undefined draft 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);
Comment thread packages/ddb-publisher/src/run.ts Outdated
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).`,
Comment thread actions/ddb-publish/action.yml Outdated
--source "${{ inputs.source-path }}" \
--env "${{ inputs.target-env }}" \
--table "${{ inputs.table-name }}" \
--topic-arn ${{ inputs.topic-arn }}
Comment thread packages/event-builder/package.json Outdated
Comment on lines 15 to 28
@@ -23,5 +24,6 @@
"test:unit": "jest",
"typecheck": "tsc --noEmit"
},
"type": "module",
"version": "0.0.1"
Comment thread packages/ddb-publisher/src/types.ts Outdated
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. */
Comment thread packages/ddb-publisher/src/run.ts Outdated
}

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);
@stevebux stevebux requested a review from a team as a code owner April 30, 2026 15:08
@stevebux stevebux force-pushed the feature/CCM-17337-Publish-Supplier-Configuration-Event branch from e05fcd5 to fc179f7 Compare May 6, 2026 09:17
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.

2 participants