Skip to content

fix(release): verify and package TypeScript CLI artifacts - #13063

Merged
zkochan merged 5 commits into
mainfrom
fix-release-empty-payloads
Jul 16, 2026
Merged

zkochan merged 5 commits into
mainfrom
fix-release-empty-payloads

Conversation

@zkochan

@zkochan zkochan commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add a manual TypeScript release-artifact verification mode that cannot publish
  • allow legitimate empty files when checking packed payloads
  • prevent the workspace-root dist ignore from removing the TypeScript CLI bundle during pack and publish
  • install the executable smoke-test tarballs from outside the checkout so npm does not inherit pnpm-only devEngines constraints

The no-publish verification passed in https://github.com/pnpm/pnpm/actions/runs/29460017538, including the packed TypeScript CLI, npm lifecycle installation, and native executable smoke test. The release job was skipped.

Squash Commit Body

The TypeScript release preflight rejected valid empty files and allowed the
workspace root gitignore to remove the CLI dist directory from the pnpm
tarball. Its executable installation test also ran npm from inside a checkout
whose devEngines requires pnpm.

Accept empty regular files while retaining byte-for-byte hash verification,
isolate the pnpm package from workspace ignore rules before building, and run
the npm lifecycle smoke test from its temporary install directory. Add a
manual verification-only dispatch that exercises the complete artifact build
and smoke test while keeping every publish job disabled.

Checklist

  • This is release-workflow-only; no TypeScript or Rust CLI behavior needs porting.
  • No changeset is needed because no published package source changed.
  • Verified with the no-publish release-artifact workflow.

Written by an agent (Codex, GPT-5).


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Added a manual workflow option to verify TypeScript release artifacts without publishing them.
  • Bug Fixes

    • Improved release artifact verification to recognize valid files even when they are empty.
    • Expanded TypeScript package smoke tests with clearer runtime diagnostics, installation checks, and command validation.
    • Improved consistency across TypeScript, Rust, and pnpr artifact checks.

Copilot AI review requested due to automatic review settings July 16, 2026 00:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

npm --version
npm config get ignore-scripts
npm config get strict-allow-scripts
npm install --foreground-scripts --ignore-scripts=false --loglevel verbose "$exe_tarball" "$native_tarball"
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: de2657b8-d58d-454c-aa59-df832d4c5aa4

📥 Commits

Reviewing files that changed from the base of the PR and between fb4639f and b9eef8a.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

The release workflow adds a manual TypeScript verification-only mode, skips publishing jobs during that mode, clears .npmignore before TypeScript builds, strengthens the TypeScript smoke test, and changes artifact checks to verify file existence.

Changes

Release verification workflow

Layer / File(s) Summary
Manual verification mode and release gating
.github/workflows/release.yml
A verify_ts_release dispatch input enables TypeScript verification without tag validation and skips TypeScript, Rust, and pnpr publishing paths.
TypeScript artifact build and smoke test
.github/workflows/release.yml
TypeScript verification and release builds clear .npmignore; verification checks file existence and exercises the packaged CLI, npm installation, and installed binaries.
Rust and pnpr artifact checks
.github/workflows/release.yml
Rust and pnpr verification checks now require artifact files to exist rather than requiring non-empty files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Maintainer
  participant ReleaseWorkflow
  participant TypeScriptVerification
  participant ArtifactChecks

  Maintainer->>ReleaseWorkflow: Dispatch with verify_ts_release=true
  ReleaseWorkflow->>TypeScriptVerification: Run verification without publishing
  TypeScriptVerification->>ArtifactChecks: Build and inspect release artifacts
  ArtifactChecks-->>ReleaseWorkflow: Confirm files exist and smoke tests pass
Loading

Possibly related PRs

  • pnpm/pnpm#13061: Updates the related TypeScript release smoke-test tarball installation flow.

Suggested reviewers: copilot

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-release-empty-payloads

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Release workflow: verify and package TypeScript CLI artifacts without publishing

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add a manual “verify TypeScript release” mode that builds/smokes but never publishes.
• Fix tarball integrity checks to allow legitimate empty files while still hashing contents.
• Prevent workspace ignore rules from dropping the TypeScript CLI dist during pack/publish.
• Run npm smoke installs from the extracted temp dir to avoid pnpm-only devEngines constraints.
Diagram

graph TD
  A{{"workflow_dispatch / tag"}} --> B["validate-release-ref"] --> C{ "verify_ts_release?" }
  C -->|"yes"| D["verify-ts-release (build+verify+smoke)"] --> E[("packed tarballs")]
  C -->|"no"| D --> E --> F["release (publish)"]
  C -->|"no"| G["build-rust / build-pnpr"]
  D --> H["npm smoke install (temp dir)"]
  subgraph Legend
    direction LR
    _tr{{"Trigger"}} ~~~ _job["Job"] ~~~ _dec{"Decision"} ~~~ _art[("Artifact")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Split into a dedicated “verify-ts-release.yml” workflow
  • ➕ No conditional logic scattered across publish/build jobs
  • ➕ Clear separation between verification and release responsibilities
  • ➕ Lower risk of accidentally weakening publish gating in the future
  • ➖ More duplication of steps (artifact build, verification, smoke) unless refactored
  • ➖ Harder to keep behavior perfectly in sync with the real release workflow
2. Refactor release steps into a reusable workflow (workflow_call)
  • ➕ Share a single implementation between publish and verification workflows
  • ➕ Easier to test changes safely via callers (verify vs publish)
  • ➕ Improves long-term maintainability of the release pipeline
  • ➖ Up-front refactor cost and potential churn in job/secret/permissions wiring
  • ➖ May complicate artifact/attestation wiring across callers
3. Containerize the smoke test environment (pin npm/node tooling)
  • ➕ Eliminates host checkout/tooling constraints (like pnpm-only devEngines) entirely
  • ➕ More reproducible smoke tests across runners
  • ➖ More CI complexity (build/pull images, cache, permissions)
  • ➖ May diverge from how end-users actually install via npm on their systems

Recommendation: The PR’s approach is a good tactical fix: it adds a verification-only path with explicit publish disablement, fixes correctness issues (empty files, ignore rules), and makes the smoke test reflect real-world npm installs by running from the extracted temp dir. If this workflow continues to grow, consider the reusable-workflow option to reduce conditional sprawl while keeping verification and publish behavior aligned.

Files changed (1) +41 / -12

Other (1) +41 / -12
release.ymlAdd TS verification-only dispatch and harden artifact packaging/smoke tests +41/-12

Add TS verification-only dispatch and harden artifact packaging/smoke tests

• Introduces a workflow_dispatch boolean input to run TypeScript release artifact verification from a branch while skipping all publish jobs. Fixes packed payload checks to allow empty files (test -f) and overrides workspace ignore behavior for the TypeScript pnpm package to keep the built CLI bundle in the tarball. Improves smoke-test diagnostics and runs npm installs from the temporary extraction directory to avoid pnpm-only devEngines constraints from the checkout.

.github/workflows/release.yml

@zkochan
zkochan merged commit 566864e into main Jul 16, 2026
36 of 38 checks passed
@zkochan
zkochan deleted the fix-release-empty-payloads branch July 16, 2026 00:04
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. Branch secret exfiltration 🐞 Bug ⛨ Security
Description
validate-release-ref now allows non-tag refs when verify_ts_release=true, which makes
verify-ts-release runnable from arbitrary branches while still receiving
secrets.GARNET_API_TOKEN and executing repo-controlled build steps and npm lifecycle scripts. Any
user with permission to workflow_dispatch this workflow can run a modified branch that exfiltrates
that secret (and any other secrets later added to the job).
Code

.github/workflows/release.yml[R51-53]

+              if [ "${{ inputs.verify_ts_release }}" = "true" ]; then
+                exit 0
+              fi
Evidence
The PR explicitly bypasses the tag-only restriction when verify_ts_release is true, while
verify-ts-release still uses a repository secret and executes repository-controlled build and npm
lifecycle code.

.github/workflows/release.yml[20-56]
.github/workflows/release.yml[147-179]
.github/workflows/release.yml[234-264]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Manual branch verification (`workflow_dispatch` with `verify_ts_release`) bypasses the tag-only guard and reaches `verify-ts-release`, which currently uses `secrets.GARNET_API_TOKEN` and runs repository-defined build steps and `npm install` with scripts enabled. This creates a straightforward secret-exfiltration path for anyone allowed to dispatch workflows on arbitrary branches.

### Issue Context
This PR intentionally adds a no-publish verification mode; however, “no publish” is not the same as “no secrets”. The risky combination is: (a) run on arbitrary branch content + (b) secrets available in job + (c) arbitrary code execution via build/lifecycle scripts.

### Fix Focus Areas
- .github/workflows/release.yml[20-28]
- .github/workflows/release.yml[41-56]
- .github/workflows/release.yml[147-178]
- .github/workflows/release.yml[234-264]

### Concrete remediation options (pick one)
1) **Make verify mode secretless** (recommended):
  - Gate the secret-consuming step(s) with `if: ${{ !inputs.verify_ts_release }}` (or move them to the publish job only), so branch verification cannot access secrets.
  - If the garnet step is required for verification, replace it with a non-secret configuration or a public token with no privileges.

2) **Add an approval boundary**:
  - Put `verify-ts-release` behind an `environment:` that requires approvals, or create a dedicated environment for verification.

3) **Split workflows**:
  - Create a separate `release-verify.yml` workflow with **no secrets** and minimal permissions, and keep `release.yml` tag-only.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Verify blocks release queue 🐞 Bug ☼ Reliability
Description
The workflow-level concurrency group is a single global release, and the new long-running branch
verification mode participates in that same group, so manual dispatches can delay real tag releases
(with cancel-in-progress: false). This is a CI availability footgun and can be abused by anyone
with workflow-dispatch permissions.
Code

.github/workflows/release.yml[R20-28]

+  # Manual trigger for rerunning a tag release or verifying TypeScript release
+  # artifacts from a branch without publishing.
  workflow_dispatch:
+    inputs:
+      verify_ts_release:
+        description: Verify TypeScript release artifacts without publishing
+        required: false
+        type: boolean
+        default: false
Evidence
The workflow defines a single global concurrency group release, and this PR adds a new manual
branch verification mode that can run the long macOS verification job, meaning it will contend for
(and serialize within) the same queue as production releases.

.github/workflows/release.yml[30-38]
.github/workflows/release.yml[20-56]
.github/workflows/release.yml[147-179]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The new branch verification mode runs under the same workflow-level concurrency group (`release`) used to serialize production tag releases. Because cancellation is disabled, a manual verification run can block/delay real releases.

### Issue Context
The serialization makes sense for multiple tag releases landing together, but manual verification is a different concern and shouldn’t be able to monopolize the release queue.

### Fix Focus Areas
- .github/workflows/release.yml[30-38]
- .github/workflows/release.yml[20-28]

### Suggested fix
Change concurrency grouping to separate verification dispatches from real releases while preserving tag serialization. For example:
- Keep `release` group for `push` tag events.
- Use a distinct group (e.g. `release-verify`) for `workflow_dispatch` with `verify_ts_release=true`.

(Implement via an expression in `concurrency.group` keyed on `github.event_name` and `inputs.verify_ts_release`.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ  1 issues published inline · 2 in summary

Qodo Logo

Comment on lines +51 to +53
if [ "${{ inputs.verify_ts_release }}" = "true" ]; then
exit 0
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Branch secret exfiltration 🐞 Bug ⛨ Security

validate-release-ref now allows non-tag refs when verify_ts_release=true, which makes
verify-ts-release runnable from arbitrary branches while still receiving
secrets.GARNET_API_TOKEN and executing repo-controlled build steps and npm lifecycle scripts. Any
user with permission to workflow_dispatch this workflow can run a modified branch that exfiltrates
that secret (and any other secrets later added to the job).
Agent Prompt
### Issue description
Manual branch verification (`workflow_dispatch` with `verify_ts_release`) bypasses the tag-only guard and reaches `verify-ts-release`, which currently uses `secrets.GARNET_API_TOKEN` and runs repository-defined build steps and `npm install` with scripts enabled. This creates a straightforward secret-exfiltration path for anyone allowed to dispatch workflows on arbitrary branches.

### Issue Context
This PR intentionally adds a no-publish verification mode; however, “no publish” is not the same as “no secrets”. The risky combination is: (a) run on arbitrary branch content + (b) secrets available in job + (c) arbitrary code execution via build/lifecycle scripts.

### Fix Focus Areas
- .github/workflows/release.yml[20-28]
- .github/workflows/release.yml[41-56]
- .github/workflows/release.yml[147-178]
- .github/workflows/release.yml[234-264]

### Concrete remediation options (pick one)
1) **Make verify mode secretless** (recommended):
   - Gate the secret-consuming step(s) with `if: ${{ !inputs.verify_ts_release }}` (or move them to the publish job only), so branch verification cannot access secrets.
   - If the garnet step is required for verification, replace it with a non-secret configuration or a public token with no privileges.

2) **Add an approval boundary**:
   - Put `verify-ts-release` behind an `environment:` that requires approvals, or create a dedicated environment for verification.

3) **Split workflows**:
   - Create a separate `release-verify.yml` workflow with **no secrets** and minimal permissions, and keep `release.yml` tag-only.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Convert tarball paths to absolute before cd

Convert $exe_tarball and $native_tarball to absolute paths using realpath before
changing directories. This prevents the npm install command from failing if
$release_tarballs is a relative path.

.github/workflows/release.yml [249-260]

 exe_tarball=$(find "$release_tarballs/pnpm11_pnpm_artifacts_exe" -type f -name '*.tgz' -print -quit)
 native_tarball=$(find "$release_tarballs/pnpm11_pnpm_artifacts_darwin-arm64" -type f -name '*.tgz' -print -quit)
 test -n "$exe_tarball"
 test -n "$native_tarball"
+exe_tarball=$(realpath "$exe_tarball")
+native_tarball=$(realpath "$native_tarball")
 (
   cd "$smoke_dir"
   command -v npm
   npm --version
   npm config get ignore-scripts
   npm config get strict-allow-scripts
   npm install --foreground-scripts --ignore-scripts=false --loglevel verbose "$exe_tarball" "$native_tarball"
 )
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: Converting the tarball paths to absolute paths ensures they remain valid after changing directories in the subshell, preventing potential path resolution failures.

Medium
  • More

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