Skip to content

Feat/update packages#3

Merged
fgiova merged 2 commits intomainfrom
feat/update-packages
Feb 17, 2026
Merged

Feat/update packages#3
fgiova merged 2 commits intomainfrom
feat/update-packages

Conversation

@fgiova
Copy link
Copy Markdown
Owner

@fgiova fgiova commented Feb 17, 2026

This pull request introduces significant improvements to the development, testing, and CI/CD workflows for the project, focusing on modernizing Node.js support, enhancing test coverage (including integration tests with AWS-compatible services), and updating dependencies and documentation. The most important changes are grouped below by theme.

Node.js Version and Dependency Updates:

  • Dropped support for Node.js 20 and now require Node.js ^22.14.0 or >=24.10.0, updating .nvmrc, package.json, and documentation accordingly. Updated dependencies, including @fgiova/aws-signature to v4 and other dev dependencies for compatibility with newer Node.js versions. [1] [2] [3]
  • Updated GitHub Actions workflow to only test on Node.js 22 and 24, and migrated action versions to latest (actions/checkout@v5, actions/setup-node@v5). Adjusted release workflow to use Node.js 22.x. [1] [2] [3]

Testing Enhancements:

  • Added comprehensive integration tests using LocalStack and Testcontainers, verifying end-to-end message publishing and delivery to SQS. New setup and teardown scripts automate environment provisioning and cleanup. [1] [2] [3] [4] [5]
  • Improved test configuration: added local and debug test scripts, set timeouts, and excluded helper and script files from coverage. [1] [2]
  • Added .env.dev for local/test AWS credentials and region configuration.

Documentation Updates:

  • Updated README.md to clarify supported Node.js versions, batch message publishing behavior, and updated type signatures in code examples. [1] [2]

Code Quality and Robustness:

  • Improved robustness of the SNS client to handle unexpected or non-standard response content in batch publishing. [1] [2] [3]

CI/CD and Permissions:

  • Enhanced GitHub Actions workflow security and permissions, specifying required access for testing, building, and releasing. [1] [2]

These changes collectively modernize the codebase, improve reliability and test coverage, and ensure compatibility with current Node.js and AWS SDK tooling.

…ve CI configuration

BREAKING-CHANGE: Drop support to Node.js 20.x
Copilot AI review requested due to automatic review settings February 17, 2026 09:58
@fgiova fgiova force-pushed the feat/update-packages branch from a56b0b7 to e71635b Compare February 17, 2026 10:05
Copy link
Copy Markdown

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 pull request modernizes the mini-sns-client package by updating Node.js version requirements, enhancing test coverage with comprehensive integration tests, and improving error handling robustness. The changes drop support for Node.js 20 and require Node.js ^22.14.0 or >=24.10.0, while introducing LocalStack and Testcontainers-based integration testing infrastructure.

Changes:

  • Updated Node.js version requirements to ^22.14.0 or >=24.10.0, with corresponding updates to dependencies (@fgiova/aws-signature v4, @tsconfig/node22, semantic-release v25, and others)
  • Added comprehensive integration test infrastructure using LocalStack and Testcontainers, with automated setup/teardown scripts for test environment provisioning
  • Improved error handling in batch response parsing to gracefully handle malformed AWS SNS responses

Reviewed changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.nvmrc Set Node.js version to 22 for development
tsconfig.json Updated to extend @tsconfig/node22 configuration
package.json Updated Node.js engines requirement, upgraded dependencies, added test scripts for local development and integration testing
.env.dev Added development environment configuration for AWS credentials
.gitignore Fixed typo in first line, added test-env.json and tool directories to ignore list
.github/workflows/node.js.yml Updated to test on Node.js 22 and 24 only, upgraded action versions, added permissions for OIDC publishing, removed NPM_TOKEN
test/scripts/runners/localstack.js New LocalStack container runner with SNS/SQS bootstrap functionality
test/scripts/executors/before.js New test setup script that starts LocalStack and creates test environment
test/scripts/executors/teardown.js New test cleanup script that removes test environment file
test/helpers/localtest.ts New helper to load test environment configuration and manage reaper cleanup
test/integration.ts New comprehensive integration tests verifying SNS message publishing and SQS delivery
test/index.ts Added test case for handling malformed batch response content
src/index.ts Improved parseBatchResponseResult to return undefined for malformed responses, added type cast for method parameter
README.md Updated Node.js requirements and clarified batch publishing behavior in documentation

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

- run: npm run build
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The NPM_TOKEN environment variable has been removed from the release workflow. While the id-token: write permission has been added for OIDC-based publishing, @semantic-release/npm version 13.x typically requires either: (1) NPM_TOKEN to be set, or (2) explicit provenance configuration in .releaserc. Without either, the release step may fail when attempting to publish to npm. Consider adding provenance configuration to the @semantic-release/npm plugin in .releaserc, or ensure that NPM_TOKEN is still available as a secret if OIDC alone is insufficient for your npm publishing setup.

Suggested change
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +4
const { unlink } = require("node:fs/promises");
const teardown = async () => {
if (!process.env.TEST_LOCAL) {
await unlink("test-env.json");
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The unlink operation on line 4 will throw an error if the file doesn't exist, potentially causing the test teardown to fail. Consider wrapping the unlink call in a try-catch block or using the force: true option with rm() instead of unlink() to silently ignore missing files.

Suggested change
const { unlink } = require("node:fs/promises");
const teardown = async () => {
if (!process.env.TEST_LOCAL) {
await unlink("test-env.json");
const { rm } = require("node:fs/promises");
const teardown = async () => {
if (!process.env.TEST_LOCAL) {
await rm("test-env.json", { force: true });

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +23
const reaper = runningContainers.find(
(container) => container.Labels["org.testcontainers.ryuk"] === "true",
);
// biome-ignore lint/suspicious/noDoubleEquals: as is
const reaperNetwork = reaper.Ports.find((port) => port.PrivatePort == 8080);
const reaperPort = reaperNetwork.PublicPort;
const reaperIp = containerRuntimeClient.info.containerRuntime.host;
const reaperSessionId = reaper.Labels["org.testcontainers.session-id"];
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

There's no null/undefined check for the reaper variable after the find() operation on line 16-17. If no container with the label "org.testcontainers.ryuk" is found, reaper will be undefined, and accessing reaper.Ports on line 20 will throw a TypeError. Consider adding a check like if (!reaper) throw new Error('Reaper container not found') before accessing its properties.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +20
// biome-ignore lint/suspicious/noDoubleEquals: as is
const reaperNetwork = reaper.Ports.find((port) => port.PrivatePort == 8080);
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

There's no null/undefined check for the reaperNetwork variable after the find() operation on line 20. If no port with PrivatePort 8080 is found, reaperNetwork will be undefined, and accessing reaperNetwork.PublicPort on line 21 will throw a TypeError. Consider adding validation to ensure the reaper network configuration is present before accessing its properties.

Suggested change
// biome-ignore lint/suspicious/noDoubleEquals: as is
const reaperNetwork = reaper.Ports.find((port) => port.PrivatePort == 8080);
if (!reaper) {
throw new Error("Reaper container not found (label org.testcontainers.ryuk=true)");
}
// biome-ignore lint/suspicious/noDoubleEquals: as is
const reaperNetwork = Array.isArray(reaper.Ports)
? reaper.Ports.find((port) => port.PrivatePort == 8080)
: undefined;
if (!reaperNetwork || typeof reaperNetwork.PublicPort === "undefined") {
throw new Error("Reaper network configuration with PrivatePort 8080 not found");
}

Copilot uses AI. Check for mistakes.
Comment thread test/helpers/localtest.ts Outdated
@fgiova fgiova force-pushed the feat/update-packages branch from e71635b to af8f284 Compare February 17, 2026 10:18
@fgiova fgiova merged commit 0065fb8 into main Feb 17, 2026
5 checks passed
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