Skip to content

CCM-12869: add config -> DynamoDB publisher tooling + release-bundled GitHub Action#50

Open
m-houston wants to merge 26 commits intomainfrom
CCM-12869-dynamodb-publish-action
Open

CCM-12869: add config -> DynamoDB publisher tooling + release-bundled GitHub Action#50
m-houston wants to merge 26 commits intomainfrom
CCM-12869-dynamodb-publish-action

Conversation

@m-houston
Copy link
Contributor

@m-houston m-houston commented Feb 27, 2026

Description

  • Add packages/file-store for loading supplier config from a local directory containing json files
  • Add packages/ddb-publisher CLI to publish config records directly into a single DynamoDB table (no event envelope)
    • supports --dry-run (no AWS calls/creds; schema validation only)
    • pre-load audit scans DDB; blocks upload if non-DISABLED records exist in DDB but not in local config unless --force
    • strict pk/sk handling: invalid/missing keys throw with pk/sk included for debug
  • add a GitHub action that downloads ddb-publish-bundle.tgz from the matching GitHub Release and runs index.cjs (avoids committing multi‑MB dist directory)
  • Add release workflow to bundle and upload the CLI artifact to Releases, and run the bundling + smoke-test in stage-3-build to keep the release build healthy

Context

Provides CLI and actions for publishing supplier config to a dynamodb store.

Example of the action being invoked from the notify-internal repo includes currently up to date supplier config.

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.

… GitHub Action

- Add @supplier-config/file-store loader/validator for local config store layout
store = subdir per domain entity, JSON file per record
zod-based parsing/validation; fail fast on parse errors
- Add @supplier-config/ddb-publisher CLI (supplier-config-publish) to publish config records directly into a single DynamoDB table (no event envelope)
-supports --dry-run (no AWS calls/creds; schema validation only)
pre-load audit scans DDB; blocks upload if non-DISABLED records exist in DDB but not in local config unless --force
- strict pk/sk handling: invalid/missing keys throw with pk/sk included for debug
- add a lightweight composite action that downloads ddb-publish-bundle.tgz from the matching GitHub Release and runs index.cjs (avoids committing multi‑MB dist bundles; action contains no reimplemented logic)
- Add release workflow to bundle and upload the CLI artifact to Releases, and run the bundling + smoke-test in stage-3-build to keep the release build healthy
@m-houston m-houston marked this pull request as ready for review March 3, 2026 14:25
@m-houston m-houston requested review from a team as code owners March 3, 2026 14:25
Copy link

@nhsd-david-wass nhsd-david-wass left a comment

Choose a reason for hiding this comment

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

Can we have a README with instructions for running the cli please

…fig store

- add a short README for the ddb-publisher CLI
- document running the CLI against a local DynamoDB container
- add AWS CLI instructions to create the local supplier config table
- add a minimal example config store under tests/example-config-store
- rename the package script from start to cli for clearer CLI usage
- allow localhost DynamoDB endpoints to use default local fake credentials
- rename audit result field from blocking to blockingRecords for clarity
- update audit and run tests to match the new audit shape
- add coverage for local vs non-local endpoint credential handling
const base = persistedRecordShapeSchema.parse(record.data);

return {
pk: pkForEntity(record.entity),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nhsd-david-wass - does this schema work for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(it only adds pk and sk to the base domain model schema)

@m-houston m-houston requested a review from Copilot March 13, 2026 12:45
Copy link

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 a local “supplier config store” file loader/validator plus a DynamoDB publishing CLI, then wires that CLI into a composite GitHub Action that runs from a release-bundled artifact (rather than committing a large dist directory). It also adds CI workflow support to bundle and publish the artifact and to run integration tests.

Changes:

  • Add @supplier-config/file-store for loading config JSON records from disk and validating them against the supplier-config event schemas.
  • Add @supplier-config/ddb-publisher CLI to audit a target DynamoDB table and batch-publish validated config records (plus unit + integration tests and a release bundling script).
  • Add composite action actions/ddb-publish and CI workflows to bundle/upload the CLI artifact and run integration tests.

Reviewed changes

Copilot reviewed 45 out of 46 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/example-config-store/volume-group/vg-1.json Adds example volume-group record for local/integration testing.
tests/example-config-store/supplier/sup-1.json Adds example supplier record for local/integration testing.
tests/example-config-store/supplier-pack/sp-1.json Adds example supplier-pack record for local/integration testing.
tests/example-config-store/supplier-allocation/alloc-1.json Adds example supplier-allocation record for local/integration testing.
tests/example-config-store/pack-specification/pack-spec-1.json Adds example pack-specification record for local/integration testing.
tests/example-config-store/letter-variant/lv-1.json Adds example letter-variant record for local/integration testing.
tests/example-config-store/README.md Documents the example config-store directory structure.
scripts/config/vale/styles/config/vocabularies/words/accept.txt Updates Vale vocabulary to accept “repo”.
scripts/config/pre-commit.yaml Cleans up local hook configuration layout.
packages/file-store/tsconfig.json Adds TS config for new file-store package.
packages/file-store/tsconfig.build.json Adds build TS config for new file-store package.
packages/file-store/src/validation/config-store-validator.ts Adds schema-based validation for loaded config records.
packages/file-store/src/types.ts Adds shared types for loaded records and validation results.
packages/file-store/src/loader/config-store-loader.ts Adds loader to read JSON records from persisted entity folders.
packages/file-store/src/index.ts Exposes public exports for file-store package.
packages/file-store/src/tests/config-store-validator.test.ts Unit tests for validator behavior and error reporting.
packages/file-store/src/tests/config-store-loader.test.ts Unit tests for loader behavior and error cases.
packages/file-store/package.json Introduces file-store workspace package manifest.
packages/file-store/jest.config.ts Adds Jest config for file-store unit tests and coverage.
packages/ddb-publisher/tsconfig.json Adds TS config for new publisher CLI package.
packages/ddb-publisher/src/types.ts Adds CLI plan/audit types.
packages/ddb-publisher/src/run.ts Implements CLI execution flow: load → validate → audit → publish.
packages/ddb-publisher/src/ddb/publish.ts Implements DynamoDB BatchWrite publishing with retries.
packages/ddb-publisher/src/ddb/keys.ts Defines pk/sk formatting helpers for persisted items.
packages/ddb-publisher/src/ddb/audit.ts Implements DynamoDB scan-based audit to find blocking records.
packages/ddb-publisher/src/cli.ts Adds yargs-based CLI entrypoint.
packages/ddb-publisher/src/tests/run.test.ts Unit tests for run flow (dry-run, validation failure, audit blocking, endpoint handling).
packages/ddb-publisher/src/tests/publish.test.ts Unit tests for batching/retries/item shape in publish logic.
packages/ddb-publisher/src/tests/audit.test.ts Unit tests for audit scan paging and blocking record detection.
packages/ddb-publisher/src/integration/publish-action.integration.test.ts Integration test that bundles the CLI and publishes into DynamoDB Local.
packages/ddb-publisher/src/integration/dynamodb-local.ts Testcontainers DynamoDB Local helpers for integration tests.
packages/ddb-publisher/scripts/bundle-release.mjs Adds esbuild bundling script for release/action artifact generation.
packages/ddb-publisher/package.json Introduces ddb-publisher workspace package manifest and scripts.
packages/ddb-publisher/jest.integration.config.ts Adds separate Jest config for integration tests.
packages/ddb-publisher/jest.config.ts Adds Jest config for ddb-publisher unit tests and coverage.
packages/ddb-publisher/README.md Documents CLI usage, local DynamoDB setup, and integration test guidance.
packages/ddb-publisher/.gitignore Ignores generated bundle artifacts.
package.json Updates tooling deps/scripts and expands workspaces list.
actions/ddb-publish/action.yml Adds composite action to download and run the bundled CLI from Releases/CI artifacts.
.tool-versions Updates the Node.js tool version used by tooling/workflows.
.github/workflows/stage-3-build.yaml Adds job to bundle and upload the ddb-publish tarball as a workflow artifact.
.github/workflows/stage-2-test.yaml Adds integration test job to CI.
.github/workflows/release-ddb-publish.yml Adds workflow to bundle and upload tarball to GitHub Releases (or as workflow artifact).
.github/actions/bundle-ddb-publish/action.yml Adds reusable composite action to bundle + smoke-test + package the tarball.
.github/PULL_REQUEST_TEMPLATE.md Adds checkbox indicating code generated by a coding agent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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