Skip to content

fix(release): report the patched provider version prepack actually bundled#355

Merged
anconina merged 2 commits into
mainfrom
fix/prepack-pi-ai-version-drift
Jul 26, 2026
Merged

fix(release): report the patched provider version prepack actually bundled#355
anconina merged 2 commits into
mainfrom
fix/prepack-pi-ai-version-drift

Conversation

@anconina

Copy link
Copy Markdown
Contributor

Description

prepack.js bundles the patched @earendil-works/pi-ai into the published tarball and logs which version it bundled. That version was a string literal, so it went stale the moment the pin moved:

console.log("  bundled patched @earendil-works/pi-ai@0.80.10");

The workspace pins, patches and bundles 0.82.1. So the one line an operator reads to confirm what a published tarball actually carries names a version that is not in it. prepack.js runs inside npm-publish.yml, so this is the release-time record, not console decoration — and a misreport is worse than no report, because it reads as confirmation.

The fix derives the version from the bundled package's own manifest, using the readManifest helper this script already imports and already calls for this exact package three lines earlier:

console.log(
  `  bundled patched @earendil-works/pi-ai@${readManifest(patchedProviderSource).version}`,
);

patchedProviderSource is realpath-resolved, so it lands on the patched pnpm store entry and the reported version is the patched copy that ships:

patchedProviderSource: ./node_modules/.pnpm/@earendil-works+pi-ai@0.82.1_patch_hash=0ae006b5…/node_modules/@earendil-works/pi-ai
derived version      : 0.82.1
pinned in manifests  : 0.82.1
patch file           : { '@earendil-works/pi-ai@0.82.1': 'patches/@earendil-works__pi-ai@0.82.1.patch' }

The guard is added as a new dimension in umbrella-bundling.test.ts, alongside the existing "prepack.js must derive WORKSPACE_PACKAGES from bundledDependencies, not a literal array" assertion — same drift class, same file, so the two stay together. Any reintroduced pi-ai@<semver> literal in prepack.js fails it.

Related Issue

N/A: single-line correctness fix to a release script's log output, plus the architecture guard that makes the drift class fail locally instead of silently misreporting at publish time. No runtime behavior changes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor

Checklist

  • Targeted checks for the changed area pass
  • Full repository validation passes (pnpm validate)
  • New or changed behavior has a test that demonstrated the RED state before the production change
  • Documentation updated (if applicable) — no doc describes this log line; the release steps in CLAUDE.md reference prepack.js's bundling role, which is unchanged
  • No secrets or credentials committed
  • Security implications considered — supply-chain adjacent: this makes the published-artifact provenance record accurate rather than misleading. No change to what is bundled.
  • The change is focused on one concern and links the related issue, or states the allowed N/A reason

RED Test Proof

The guard was committed first (885526b87) so the failing state reproduces from that commit alone, against the unmodified prepack.js:

 × prepack.js derives the patched provider version (no hard-coded pi-ai version) 5ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  |architecture| umbrella-bundling.test.ts > umbrella-bundling -- bidirectional 5-way alignment vs bundledDependencies > prepack.js derives the patched provider version (no hard-coded pi-ai version)
AssertionError: prepack.js must derive the patched @earendil-works/pi-ai version from the bundled package's manifest (readManifest(patchedProviderSource).version), never a literal — a literal silently misreports what the published tarball carries once the pin moves.: expected [ 'pi-ai@0.80.10' ] to deeply equal []
+   "pi-ai@0.80.10",
 Test Files  1 failed (1)
      Tests  1 failed | 7 skipped (8)

Green with the fix applied (3fa4eed71), whole file:

 Test Files  1 passed (1)
      Tests  8 passed (8)

Evidence and Residual Risk

  • Contribution path: not applicable — release-script log correctness
  • Evidence level: deterministic test, plus direct evaluation of the derivation against the installed tree (shown above) confirming it resolves to the patched 0.82.1 store entry
  • Tested profile: macOS 25.3 (darwin arm64), Node 22.21.1, pnpm 10.34.5, no sandbox; existing workspace state
  • Residual risk:
    • The derivation is verified by evaluating the same resolution logic against the installed tree, not by running prepack.js end to end — that step rewrites package.json and bundles into node_modules, so it is left to the tarball CI job and the real publish.
    • The guard is textual: it forbids a pi-ai@<semver> literal in prepack.js. It does not prove the derived value is correct on every future tree, only that the value is derived rather than frozen.
    • Other version-coupled sites (pnpm.patchedDependencies, the patches/*.patch filename, the manifest pins) are already moved together by the upgrade flow and are unaffected here.

comis-agent added 2 commits July 26, 2026 13:24
…on in prepack

prepack.js logs which patched `@earendil-works/pi-ai` it bundled, and that line
is the record used to confirm what a published tarball actually carries. The
version was a string literal, so it went stale the moment the pin moved: the
script announces 0.80.10 while the workspace pins, patches and bundles 0.82.1.

Fails on the current tree naming the literal it found.
…ndled

The bundle step announced a hard-coded `@earendil-works/pi-ai@0.80.10` while the
workspace pins, patches and bundles 0.82.1, so the one line an operator reads to
confirm what a published tarball carries named a version that is not in it.

Derive it from the bundled package's own manifest instead, via the `readManifest`
helper this script already uses for the same package three lines earlier. The
source path is realpath-resolved through the patched pnpm store entry, so the
reported version is the patched copy that ships.
@anconina
anconina force-pushed the fix/prepack-pi-ai-version-drift branch from 3fa4eed to 0341f85 Compare July 26, 2026 10:24
@anconina
anconina merged commit e91500a into main Jul 26, 2026
13 checks passed
@anconina
anconina deleted the fix/prepack-pi-ai-version-drift branch July 26, 2026 10:46
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.

1 participant