Skip to content

test(cli): add release smoke tests#2861

Open
sjinks wants to merge 1 commit into
trunkfrom
pltfrm-2356-add-release-smoke-script-for-high-risk-commands-logs
Open

test(cli): add release smoke tests#2861
sjinks wants to merge 1 commit into
trunkfrom
pltfrm-2356-add-release-smoke-script-for-high-risk-commands-logs

Conversation

@sjinks
Copy link
Copy Markdown
Member

@sjinks sjinks commented May 29, 2026

Description

Adds a release smoke test script for high-risk VIP-CLI parser and dispatch paths. The script runs credential-free checks against built dist/bin commands for logs, slowlogs, wp, and dev-env shell, with safeguards for safe process execution, filtered environment variables, symlink rejection, and credential redaction in failure output.

Related tracking: PLTFRM-2356.

Changelog Description

Added

  • Added a release smoke test script for high-risk VIP-CLI parser and dispatch checks.

Pull request checklist

New release checklist

Steps to Test

  1. Run npm run build.
  2. Run npm run smoke:release.
  3. Verify all smoke cases pass.
  4. Run npx jest __tests__/helpers/release-smoke-test.js --no-coverage.

Copilot AI review requested due to automatic review settings May 29, 2026 18:22
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Comment thread helpers/release-smoke-test.js Fixed
Comment thread helpers/release-smoke-test.js Fixed
Comment thread helpers/release-smoke-test.js Fixed
Comment thread helpers/release-smoke-test.js Fixed
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

Adds a credential-free “release smoke test” harness intended to exercise VIP CLI’s highest-risk argument parsing / dispatch paths against built dist/bin/* entrypoints, plus docs and npm script wiring to run it before release.

Changes:

  • Added helpers/release-smoke-test.js script to execute a set of safe --help-based smoke cases against dist/bin commands.
  • Added Jest coverage for the helper’s validation/execution/redaction helpers.
  • Documented the new smoke test flow in docs/TESTING.md and docs/RELEASING.md, and exposed it via npm run smoke:release.

Reviewed changes

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

Show a summary per file
File Description
package.json Adds smoke:release npm script entry.
helpers/release-smoke-test.js Implements the release smoke test runner, case validation, and failure logging/redaction.
tests/helpers/release-smoke-test.js Adds Jest tests for validation/execution behavior and credential redaction.
docs/TESTING.md Documents running the release smoke tests before release.
docs/RELEASING.md Adds release checklist step to run the smoke tests.

Comment thread __tests__/helpers/release-smoke-test.js
Comment thread helpers/release-smoke-test.js Outdated
sjinks

This comment was marked as off-topic.

sjinks

This comment was marked as off-topic.

@sjinks sjinks self-assigned this May 29, 2026
@sjinks sjinks requested a review from Copilot May 29, 2026 22:01
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

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

Comment thread __tests__/helpers/release-smoke-test.js Outdated
Comment thread docs/RELEASING.md
sjinks added a commit that referenced this pull request May 29, 2026
… feedback

## Purpose and Context

Addresses PR #2861 review feedback and adversarial review findings on the
release smoke test helper. Two primary goals:

(1) Eliminate code duplication that caused SonarCloud to fail the quality
gate at 3.5% (threshold ≤ 3%).

(2) Add assertions that verify the security-critical properties of the
spawnSync call site — previously no test confirmed shell:false, nodeExec,
or the credential-exclusion env allowlist.

## Key Changes

- __tests__/helpers/release-smoke-test.js:
  - Fix misleading jest.mock comments ("before requiring the helper" was
    a carry-over from CommonJS; jest.mock is hoisted before imports)
  - Add beforeEach in safe-flag validation to share common mock setup
    across six acceptance tests; remove inline duplication
  - Add beforeEach in binary-file-system validation to share existsSync
    and lstatSync defaults; remove inline duplication from several tests
  - Add assertion: spawnSync called with process.execPath, shell:false,
    and env containing NODE_ENV=test and DO_NOT_TRACK=1
  - Add assertion: WPVIP_DEPLOY_TOKEN and NPM_TOKEN are not forwarded
    to child processes even if set in the host environment
  - Add tests: exitCode validation rejects strings and non-integers
- helpers/release-smoke-test.js:
  - Add exitCode type and integer validation in validateExpectationFields
  - Add comment explaining HOME/USERPROFILE/APPDATA forwarding rationale
    and the auth short-circuit dependency for stricter CI isolation
  - Add comment documenting the credential adjacency edge-case limitation
    in formatCommandForLogging
- docs/RELEASING.md:
  - Add explicit npm run build prerequisite to the smoke test checklist

## Testing and Validation

87 Jest tests pass (0 failures). ESLint and tsc pass.
@sjinks sjinks requested a review from Copilot May 29, 2026 23:10
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

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

Comment thread helpers/release-smoke-test.js Outdated
Comment thread helpers/release-smoke-test.js Outdated
Comment thread __tests__/helpers/release-smoke-test.js Outdated
Comment thread helpers/release-smoke-test.js Fixed
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

## Purpose and Context

Release preparation needs a credential-free smoke check for CLI parser and
dispatch paths that are easy to regress but expensive to catch during a
manual release. The helper exercises built `dist/bin` commands using safe
non-executing forms so release operators can verify high-risk command
routing before publishing.

## Key Changes

- Add a release smoke test helper for `logs`, `slowlogs`, `wp`, and
  `dev-env shell` parser and dispatch paths.
- Add validation for safe arguments, built binary paths, required child
  binaries, expected output fields, and symlink-safe filesystem checks.
- Run smoke cases with `shell: false`, an explicit environment allowlist,
  isolated temporary credential paths, timeout handling, and credential
  redaction in failure output.
- Add Jest coverage for validation failures, spawn behavior, credential
  redaction, cleanup handling, and platform-portable path assertions.
- Document the release smoke workflow and add the `smoke:release` npm
  script.

## Impact and Considerations

The smoke runner targets built release artifacts and requires `npm run
build` before `npm run smoke:release`. It avoids API, Docker, and Lando
side effects by using `--help` or equivalent non-executing argument forms.
Child processes do not inherit host home/profile credential paths by
default; unexpected credential lookups land in a temporary scope that is
removed after each case.

## Testing and Validation

Added focused unit coverage for the release smoke helper. During PR
validation, the focused helper Jest suite passed, ESLint passed,
TypeScript type-checking passed, scoped diff whitespace checks passed,
and SonarCloud reported the Quality Gate passed with 0.0% duplication on
new code.

Refs PLTFRM-2356
@sjinks sjinks force-pushed the pltfrm-2356-add-release-smoke-script-for-high-risk-commands-logs branch from bd82b73 to 2689c35 Compare May 30, 2026 14:09
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants