Coding & agentsGitHub Changelog / npm batch approval releases for staged packages

npm staged publishing plans: compare the package set before approval

npm’s grouped staged-package approval makes the selected package and version set worth inspecting together. A runnable Node.js example exposes missing packages, unexpected additions and version drift without contacting the registry.

A moss-green coding orc holds a shallow copper tray with two blank ivory package boxes, one taller and one low rectangular box, each wrapped in a lavender band.
Conceptual illustration.

Review the selected group, then track each result

GitHub’s November 30 announcement introduces npm Staged Publishing Plans: grouped staged versions can share one two-factor approval, bound to the exact package/version set shown for approval. A group permits one version per package. That makes the selected set an important review boundary for a release containing related packages.

The linked npm documentation adds two operational limits: batch actions are rolling out gradually, and individual actions are independent. One version can fail while others succeed; successful actions are not rolled back. A grouped confirmation therefore needs a per-version completion record. After an unconfirmed result, check current state before starting another batch. The local example below inspects lists only; registry progress remains a separate part of the release.

Retain a small list that a reviewer can inspect

Our original fictional release contains @fern-kit/core and @fern-kit/cli, both at 1.4.0. npm-plan-reviewed.json records that two-entry snapshot. npm-plan-intended.json reverses the entry order and changes the CLI package to 1.4.1. A check based only on the count would see two packages in both files and miss the changed version.

Each file is an array of objects containing exactly name and version. The teaching fixture accepts between one and 100 entries, rejects repeated names and requires nonempty text without surrounding whitespace. It compares those strings literally. It is not an npm package-name validator or a semantic-version parser: a locally accepted string still needs the real registry’s validation. The reviewed filename is a local label, not evidence that npm or another person approved its contents.

Read one concrete difference from one command

With the three downloads in one folder, run node npm-plan-review.mjs npm-plan-reviewed.json npm-plan-intended.json. The output has matches: false, empty missing and extra arrays, and one versionChanges record: name @fern-kit/cli, reviewedVersion 1.4.0, intendedVersion 1.4.1. That separates a changed version from a package that disappeared or was newly added.

The sample exits with status 2 because its lists differ. Equal lists produce status 0; invalid input or an unreadable file produces status 1. Running the command with npm-plan-reviewed.json as both inputs produces matches: true. Reversing the entries alone also matches, because ordering is not part of this helper’s set comparison. Difference records are sorted by package name so an input reorder does not rearrange the report.

Reject an ambiguous package list before comparing it

A repeated package name returns E_DUPLICATE on either side, including when both entries carry the same version. Two versions under the same name also fail. This avoids silently keeping whichever duplicate a map happened to see last. A missing version, an extra object field or an array used as an entry returns E_ENTRY; empty or padded text returns E_TEXT.

If a package is absent from the intended list, missing retains its reviewed name and version. An unexpected intended package appears in extra. A mixed case can report missing, extra and changed entries together. Investigate every category rather than editing the reviewed snapshot merely to turn matches green. Any deliberate release change needs a newly reviewed reference and a clear record connecting that reference to the intended work.

Keep the ten-case evidence separate from publishing evidence

Codorc executed ten local cases with Node v22.23.2 on December 1. They covered reordered equality, version drift, missing and extra entries, sorted mixed differences, duplicate names, malformed inputs, the 100-entry boundary, literal comparison, unchanged inputs and independent returned records. The CLI case checked the supplied difference, an equal-input result and a usage error with their exit statuses.

No npm command, account, token, two-factor challenge or network request was involved. List equality cannot establish approval, matching package bytes, provenance, package safety or successful publication. Two records with the same name and version can still be attached to different local artifacts. Keep the actual staged-content inspection and final registry results alongside this comparison when reviewing a real release.

Connect the comparison to the real release record

The useful output is a discrepancy that a reviewer can explain before continuing. Preserve the input files, the helper revision and its output together. If the intended set changes, repeat the comparison against the appropriate reviewed snapshot rather than reusing an earlier successful result.

These proposed review points extend beyond the offline helper. They connect a list-level check with content inspection, the real approval screen and observed per-version outcomes:

  • Record the exact names and versions in the reviewed release snapshot.
  • Inspect every missing, extra and changed record, including changes that preserve the total count.
  • Reject repeated package names instead of silently choosing one entry.
  • Inspect staged contents and retain the relevant artifact and provenance evidence separately.
  • Compare the real confirmation screen with the selected release set before completing approval.
  • Record each version’s final status and recheck unconfirmed results before another attempt.

Event dates identify the announcement or milestone covered. Publication dates show when this article first appeared on Codorc.

Continue reading

All stories