Skip to content

Bump sharp to 0.35.3 and bring compliance tooling up to date - #36

Merged
Giorgio Ughini (GiorgioUghini) merged 3 commits into
mainfrom
bump-sharp-libvips-compliance
Aug 3, 2026
Merged

Giorgio Ughini (GiorgioUghini) merged 3 commits into
mainfrom
bump-sharp-libvips-compliance

Conversation

@adilei

@adilei adilei commented Aug 2, 2026 •

Copy link
Copy Markdown
Collaborator

Bumps sharp 0.34.5 -> 0.35.3 (sharp-libvips 1.2.4 -> 1.3.2, libvips 8.17.3 -> 8.18.3) and reworks the compliance tooling so the LGPL obligations for the bundled libvips stack stay satisfied.

Why the tooling had to change

sharp 0.35 removed cpu: ["wasm32"] from @img/sharp-wasm32 and moved the gating to the @img/sharp-freebsd-wasm32 / @img/sharp-webcontainers-wasm32 wrappers, which merely depend on it. npm therefore hoists and installs the WASM payload on every platform. It is non-functional (@emnapi/runtime is not installed) but still landed inside the asarUnpack'd node_modules/@img/**, and its differing versions.json made compliance:licenses fail with "Installed Sharp native packages disagree about embedded library versions."

There are exactly two shipped native manifests, and they are not identical:

Windows (@img/sharp-win32-*) POSIX (@img/sharp-libvips-*)
archive 3.8.7 3.8.8
expat 2.8.1 2.8.2
ffi 3.5.2 3.6.0
glib 2.89.0 2.89.1
heif 1.23.0 1.23.1
pango 1.57.1 1.58.0
rsvg 2.62.3 2.62.90
tiff 732665c d01a94b
uhdr 13a058f 1acdbed

@img/sharp-{darwin,linux}-*@0.35.3 no longer ship a versions.json, so POSIX must resolve through the @img/sharp-libvips-* package. spng is gone; libultrahdr (dual MIT + Apache-2.0) is new.

Changes

Packaging

  • Exclude @img/sharp-wasm32, @img/sharp-freebsd-wasm32 and @img/sharp-webcontainers-wasm32 from the app bundle.
  • verify-packaged-compliance.mjs and verify-windows-package.mjs now reject those packages and any .wasm under node_modules/@img/ in the packaged artifact.
  • Release targets are Windows x64, Windows arm64 and macOS arm64; the unused Linux AppImage target is removed.

Compliance engine (scripts/compliance.mjs)

  • Select the architecture-matched native payload instead of requiring every installed @img package to agree.
  • Disambiguate the Linux payload by runtime libc. package-lock.json cannot express libc, so npm ci installs both the glibc and musl variants on every host — verified with npm ci --dry-run --os=linux --cpu=x64 --libc=glibc.
  • Derive source materials from the selected payload's versions.json, with version-qualified ids so the two manifests can diverge.
  • Fetch commit-pinned components (mozjpeg, libtiff, libultrahdr) by immutable SHA via git archive.
  • Emit only the in-repo Windows build archive on win32 (build-win64-mxe 8.18.3 carries all its patches in-tree) and the four externally fetched POSIX patches elsewhere. Drops the stale aom, highway and heif patch entries plus spng.
  • The new libultrahdr patch is pinned to commit e2daed8da97d8857dcec2fd68d2f6f3326170f67 rather than the mutable pull/383.patch URL.
  • Resolve SPDX AND expressions so multi-licensed payloads are fully covered.

Also fixed: verify-windows-package.mjs expected lib/sharp-win32-<arch>.node, but 0.35 renames it to lib/sharp-win32-<arch>-<version>.node. Windows CI would have failed on this.

CI: macOS now runs the full compliance:prepare instead of licenses-only, and both workflows cache .compliance-cache.

New: scripts/review-compliance-sources.mjs (npm run compliance:review) downloads candidate source material into a scratch directory and prints proposed policy hashes for human review. It never writes the policy itself.

Verification

  • compliance:licenses (179 packages), compliance:prepare (34 Windows source materials)
  • compliance:test 27/27, typecheck, npm test 72/73 (the one failure, writeDebugBundle, is pre-existing on main — no unzip on Windows)
  • npm run dist:win:arm64 + verify-windows-package.mjs arm64; the packaged app contains only @img/colour and @img/sharp-win32-arm64
  • Shallow git fetch --depth=1 <repo> <sha> confirmed working for every commit-pinned source

Fixed while getting CI green

  • The lockfile was not installable on Linux or macOS. sharp 0.35 makes @img/sharp-wasm32 installable everywhere, so its @emnapi/runtime dependency is now required on every platform, but npm on Windows prunes entries it does not need locally when it updates an existing lock. install.sh / install.ps1 also pull latest-v24.x, which ships a newer npm that additionally wants @emnapi/core hoisted to the root. The lock is repaired with that exact npm and verified under npm 11.6.2 and 11.16.0 for linux x64/arm64 (glibc and musl), darwin arm64 and win32 x64/arm64. assertLockfileClosure now rejects a lock whose declared dependencies cannot be resolved.
  • Chromium's LICENSES.chromium.html differs per platform. The single reviewed hash only ever matched Windows, so macOS failed as soon as it started running the full compliance:prepare. electron.notices is now keyed by platform-arch alongside electron.distributions, with the macOS hash derived from the already-reviewed darwin-arm64 distribution archive.
  • selectNativePayload threw on every glibc Linux host. package-lock.json cannot express libc, so npm installs both the glibc and musl payloads; the payload is now chosen by the running C library.
  • verify-windows-package.mjs looked for the wrong addon filename. 0.35 renames it to lib/sharp-win32-<arch>-<version>.node.

Upgrades sharp 0.34.5 -> 0.35.3 (sharp-libvips 1.2.4 -> 1.3.2, libvips
8.17.3 -> 8.18.3) and reworks the fail-closed compliance machinery so the
LGPL obligations for the bundled libvips stack stay satisfied.

sharp 0.35 dropped the `cpu: ["wasm32"]` constraint from
@img/sharp-wasm32 and moved gating to the freebsd/webcontainers wrapper
packages, so npm now installs the WASM payload on every platform. It is
non-functional (@emnapi/runtime is not installed) but still landed inside
asarUnpack'd node_modules/@img/**, and its differing versions.json broke
license preparation. It is now excluded from packaging and the packaged
artifact verifiers reject it.

Compliance engine:
- select the architecture-matched native payload instead of requiring
  every installed @img package to agree; POSIX resolves through
  @img/sharp-libvips-* because @img/sharp-{darwin,linux}-* no longer ship
  versions.json
- disambiguate the Linux payload by runtime libc, since package-lock.json
  cannot express `libc` and npm installs both glibc and musl variants
- derive source materials from the selected payload's versions.json, with
  version-qualified ids so the Windows and POSIX manifests can diverge
- fetch commit-pinned components (mozjpeg, libtiff, libultrahdr) by
  immutable SHA via git archive
- emit only the in-repo Windows build archive on win32, and the four
  externally fetched POSIX patches elsewhere; drop the stale aom, highway
  and heif patch entries plus spng
- resolve SPDX `AND` expressions so multi-licensed payloads are covered

Also fixes verify-windows-package.mjs, which expected
lib/sharp-win32-<arch>.node; 0.35 renames it to
lib/sharp-win32-<arch>-<version>.node.

Release targets are now Windows x64, Windows arm64 and macOS arm64; the
unused Linux AppImage target is removed and macOS CI runs the full
compliance:prepare rather than licenses only.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 485e0e65-2d1a-4a93-a864-ec460c2059dd
@GiorgioUghini Giorgio Ughini (GiorgioUghini) changed the title Bump sharp to 0.35.3 (libvips 1.3.2) — compliance review needed [draft] Bump sharp to 0.35.3 and bring compliance tooling up to date Aug 3, 2026
@GiorgioUghini
Giorgio Ughini (GiorgioUghini) marked this pull request as ready for review August 3, 2026 08:51
`npm ci` failed on ubuntu-latest and on the Windows source-install job with
packages missing from the lock file. sharp 0.35 makes @img/sharp-wasm32
installable on every platform, so its @emnapi/runtime dependency is now
required everywhere, but npm on Windows prunes entries it does not need
locally when it updates an existing lock. The result installs fine here and
fails everywhere else, which breaks the documented `npm ci` source-install
path.

install.sh and install.ps1 both pull `latest-v24.x`, which currently ships a
newer npm than the one that generated the lock, and that newer npm also wants
@emnapi/core hoisted to the root. The lock is now repaired with that exact
npm, so it satisfies both. Verified with `npm ci --dry-run` under npm 11.6.2
and 11.16.0 on Linux, and for linux x64/arm64 (glibc and musl), darwin arm64
and win32 x64/arm64.

Adds assertLockfileClosure so every compliance run rejects a lock whose
declared dependencies cannot be resolved, instead of finding out from a
release job.

@emnapi/runtime exists only to support the WASM payload we already exclude,
so it is excluded from packaging too rather than shipped as dead code.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 485e0e65-2d1a-4a93-a864-ec460c2059dd
Chromium's LICENSES.chromium.html is not the same file on every platform, so
the single reviewed hash in the policy only ever matched Windows. macOS now
runs the full compliance:prepare and failed on it.

Keys electron.notices by platform-arch alongside electron.distributions, with
the macOS hash derived from the already-reviewed darwin-arm64 distribution
archive, and makes both the preparation and the packaged-artifact verifier
look up the reviewed value for the platform they are running on. A missing
entry is now an explicit "has not been reviewed" failure rather than a hash
mismatch.

Also stops asserting a fixed detectLinuxLibc() result for the host running
the tests, which made the suite fail on Linux.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 485e0e65-2d1a-4a93-a864-ec460c2059dd

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.

Fixed compliance, now ok

@GiorgioUghini
Giorgio Ughini (GiorgioUghini) merged commit 44d9872 into main Aug 3, 2026
5 checks passed
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.

2 participants