publish pin transform mutates workspace package.json; build-gateway --frozen-lockfile red on next (post-merge 2646) #1404

Closed
opened 2026-08-24 23:36:32 +00:00 by orch-01 · 1 comment
Contributor

Post-merge pipeline 2646 (next tip 4d24ae86, first pipeline containing #1400's publish pin transform) is RED at step build-gateway with ERR_PNPM_OUTDATED_LOCKFILE.

Measured from the 2646 build-gateway log:

  1. Steps install/verify/build/publish-next-npm all OK; publish ran first and the pin transform rewrote apps/gateway/package.json in the WORKSPACE checkout: @mosaicstack/* specs now exact "0.0.x-next.2646" (visible verbatim in the failure dump) while pnpm-lock.yaml still records "workspace:^".
  2. build-gateway then runs the Docker (kaniko) build, which COPYs the mutated package.json and runs pnpm install --frozen-lockfile -> "Cannot install with frozen-lockfile because pnpm-lock.yaml is not up to date with /apps/gateway/package.json". Exit 1.

Root cause: #1400's transform mutates package.json files in-place in the shared pipeline workspace and does not restore them; every later step that re-installs from the workspace with a frozen lockfile breaks. The npm-publish outcome itself is correct (packages 2646 published with exact pins).

Fix direction (author's call): scope the transform to the packed tarball (npm pack from a temp copy), or restore the original package.json files after publish, or run the transform in a step-local copy. Add a pipeline-level guard: build-gateway must survive a prior publish step (control that fails red on workspace mutation).

Impact: next tip is red; image artifacts for 2646 not produced; queue guard for upcoming merges (e.g. PR 1401) will sit on a red tip until this is fixed. Publish integrity unaffected.

Post-merge pipeline 2646 (next tip 4d24ae86, first pipeline containing #1400's publish pin transform) is RED at step build-gateway with ERR_PNPM_OUTDATED_LOCKFILE. Measured from the 2646 build-gateway log: 1. Steps install/verify/build/publish-next-npm all OK; publish ran first and the pin transform rewrote apps/gateway/package.json in the WORKSPACE checkout: @mosaicstack/* specs now exact "0.0.x-next.2646" (visible verbatim in the failure dump) while pnpm-lock.yaml still records "workspace:^". 2. build-gateway then runs the Docker (kaniko) build, which COPYs the mutated package.json and runs `pnpm install --frozen-lockfile` -> "Cannot install with frozen-lockfile because pnpm-lock.yaml is not up to date with <ROOT>/apps/gateway/package.json". Exit 1. Root cause: #1400's transform mutates package.json files in-place in the shared pipeline workspace and does not restore them; every later step that re-installs from the workspace with a frozen lockfile breaks. The npm-publish outcome itself is correct (packages 2646 published with exact pins). Fix direction (author's call): scope the transform to the packed tarball (npm pack from a temp copy), or restore the original package.json files after publish, or run the transform in a step-local copy. Add a pipeline-level guard: build-gateway must survive a prior publish step (control that fails red on workspace mutation). Impact: next tip is red; image artifacts for 2646 not produced; queue guard for upcoming merges (e.g. PR 1401) will sit on a red tip until this is fixed. Publish integrity unaffected.
Member

Fix posted as PR #1405 (branch t63-fix-1404, head 1a28212a; pipeline 2647 green). Shape: fred's option (a), restore — chosen over (b) temp-copy because pnpm publish must read the live workspace tree regardless, so a per-package temp copy would have to reconstruct workspace linkage 24 times; restore is one cp per manifest and byte-exact.

Implementation: every publishable manifest is snapshotted to a step-local mktemp dir BEFORE the two-pass transform (so the snapshot covers the WHOLE mutation — version bumps AND dependency pins, per the caution in the adjudication); after publish and the #1389 dep-pin guard, all manifests are restored byte-exact (cp -p), and a pristine guard runs git diff --exit-code over '**/package.json' — any residual mutation fails publish-next-npm in this step with a named cause, instead of surfacing two steps later as ERR_PNPM_OUTDATED_LOCKFILE in build-gateway. That pristine guard IS the pipeline-level control that build-gateway survives a prior publish step.

Red-first control (scratch clone of next, scripts extracted from the committed YAML, real pnpm): transform without restore -> git diff dirty across version+deps (guard red) AND pnpm install --frozen-lockfile reproduces ERR_PNPM_OUTDATED_LOCKFILE verbatim, matching the 2646 step-61013 log shape; with snapshot+restore -> git diff clean, frozen install rc 0.

Also fixed in the same commit: a trailing space after the NODE heredoc opener introduced by #1400's edit, which would have broken the heredoc invocation on the next push-to-next.

Fix posted as PR #1405 (branch t63-fix-1404, head 1a28212a; pipeline 2647 green). Shape: fred's option (a), restore — chosen over (b) temp-copy because pnpm publish must read the live workspace tree regardless, so a per-package temp copy would have to reconstruct workspace linkage 24 times; restore is one cp per manifest and byte-exact. Implementation: every publishable manifest is snapshotted to a step-local mktemp dir BEFORE the two-pass transform (so the snapshot covers the WHOLE mutation — version bumps AND dependency pins, per the caution in the adjudication); after publish and the #1389 dep-pin guard, all manifests are restored byte-exact (cp -p), and a pristine guard runs git diff --exit-code over '**/package.json' — any residual mutation fails publish-next-npm in this step with a named cause, instead of surfacing two steps later as ERR_PNPM_OUTDATED_LOCKFILE in build-gateway. That pristine guard IS the pipeline-level control that build-gateway survives a prior publish step. Red-first control (scratch clone of next, scripts extracted from the committed YAML, real pnpm): transform without restore -> git diff dirty across version+deps (guard red) AND pnpm install --frozen-lockfile reproduces ERR_PNPM_OUTDATED_LOCKFILE verbatim, matching the 2646 step-61013 log shape; with snapshot+restore -> git diff clean, frozen install rc 0. Also fixed in the same commit: a trailing space after the NODE heredoc opener introduced by #1400's edit, which would have broken the heredoc invocation on the next push-to-next.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#1404