Skip to content

fix(sharp): support create input descriptors - #8818

Closed
proggeramlug wants to merge 2 commits into
mainfrom
fix/8748-sharp-create
Closed

fix(sharp): support create input descriptors#8818
proggeramlug wants to merge 2 commits into
mainfrom
fix/8748-sharp-create

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Summary

Adds support for Sharp's object-form create input so sharp({ create: ... }).png().toBuffer() creates a real solid RGB or RGBA image instead of returning an invalid handle.

Changes

  • Parse and validate create.width, height, channels, and background using Sharp-compatible bounds and channel rules.
  • Preserve RGB/RGBA pixel data and alpha while making nested option reads safe across GC activity.
  • Add native unit coverage and a compiled TypeScript regression for both RGB and RGBA PNG pipelines.
  • Document the supported sharp({ create: ... }) constructor form.
  • Refresh Sharp's test-only async FFI shims to match the current host ABI.

Related issue

Fixes #8748

Test plan

  • cargo build --release -p perry-ext-sharp
  • cargo test -p perry-ext-sharp --lib
  • cargo clippy -p perry-ext-sharp --lib --no-deps -- -D warnings
  • cargo test -p perry --test issue_8748_sharp_create
  • python scripts/check_test_registration.py
  • cargo run -p perry-doc-tests -- --lint docs/src
  • cargo fmt -p perry-ext-sharp -p perry-codegen -p perry -- --check
  • Added native and compiled TypeScript regression coverage
  • Updated docs/src/
  • Full workspace test suite (targeted affected-crate and runtime-path checks used instead)

Screenshots / output

Before: object-form create input produced Invalid sharp handle.

After: RGB and RGBA canvases encode to PNG and decode with the expected dimensions, channels, and alpha metadata.

Checklist

  • I have NOT bumped the workspace version or edited CLAUDE.md / CHANGELOG.md (maintainer handles these at merge)
  • My commits follow the loose feat: / fix: / docs: / chore: prefix convention used in the log
  • I've read CONTRIBUTING.md and agree to the Code of Conduct

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 306aaea9-4c0d-4745-95a5-6b3dd24ae186

📥 Commits

Reviewing files that changed from the base of the PR and between 8f026e5 and b807c13.

📒 Files selected for processing (6)
  • changelog.d/8818-sharp-create.md
  • crates/perry-codegen/src/lower_call/native_table/media.rs
  • crates/perry-ext-sharp/src/lib.rs
  • crates/perry-ext-sharp/src/test_async_shims.rs
  • crates/perry/tests/issue_8748_sharp_create.rs
  • docs/src/stdlib/other.md

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.

proggeramlug added a commit that referenced this pull request Aug 25, 2026
* fix(async_hooks): address lifecycle review feedback

* fix(doctor): reject stale runtime archives

* docs: add runtime compatibility changelog fragment

* fix(sharp): support create input descriptors

* perf(codegen): specialize call-returned array stores

* perf(map): repair ordered-delete indexes in place

* chore: add changelog for map delete optimization

* test(map): root ordered-delete string keys

* feat(qs): add native Stripe-compatible shim (#8751)

* docs: add changelog fragment for sharp create

* fix(runtime): complete build identity inputs

* test(compile): cover compiled package builtin imports

* chore: add changelog for array-store optimization

---------

Co-authored-by: Ralph Küpper <ralph@skelpo.com>
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main via the #8822 batch.

@proggeramlug
proggeramlug deleted the fix/8748-sharp-create branch August 25, 2026 13:33
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.

ext-sharp: sharp({ create: {...} }) throws 'Invalid sharp handle'

1 participant