PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: denoland/deno_core (rust)

Issue:
Public JS Error classes should accept the options argument
Currently public error classes (`BadResource`, `Interrupted`, and `NotCapable`) do not accept the 2nd argument. That is inconvenient when the downstream implementation want to use, for example, `cause` option of Error class (See https://github.com/denoland/deno/pull/27463/files#diff-847a11c353dfb7aeae6e35bc104b83a091ef797bdfc559d22ccfc804a3615000R380 for example)

Pull request:
feat: support options in error constructors
This PR adds support of the 2nd arguments (`options`) to JS error constructors (`BadResource`, `Interrupted`, and `NotCapable`). closes #1031

By this change, downstream implementations can use `cause` option of `Error` class.

Patch:
diff --git a/core/01_core.js b/core/01_core.js
index 17db6e5..71d9474 100644
--- a/core/01_core.js
+++ b/core/01_core.js
@@ -301,24 +301,24 @@
   // errors in the JS code (eg. "deno_net") so they are provided in "Deno.core"
   // but later reexported on "Deno.errors"
   class BadResource extends Error {
-    constructor(msg) {
-      super(msg);
+    constructor(msg, options) {
+      super(msg, options);
       this.name = "BadResource";
     }
   }
   const BadResourcePrototype = BadResource.prototype;
 
   class Interrupted extends Error {
-    constructor(msg) {
-      super(msg);
+    constructor(msg, options) {
+      super(msg, options);
       this.name = "Interrupted";
     }
   }
   const InterruptedPrototype = Interrupted.prototype;
 
   class NotCapable extends Error {
-    constructor(msg) {
-      super(msg);
+    constructor(msg, options) {
+      super(msg, options);
       this.name = "NotCapable";
     }
   }


Test patch:
diff --git a/testing/unit/error_test.ts b/testing/unit/error_test.ts
index 53d77d2..060d665 100644
--- a/testing/unit/error_test.ts
+++ b/testing/unit/error_test.ts
@@ -10,3 +10,22 @@ test(function testCustomError() {
     assert(e instanceof Deno.core.BadResource);
   }
 });
+
+test(function testJsErrorConstructors() {
+  const error = new Error("message");
+  const badResource = new Deno.core.BadResource("bad resource", {
+    cause: error,
+  });
+  assertEquals(badResource.message, "bad resource");
+  assertEquals(badResource.cause, error);
+
+  const Interrupted = new Deno.core.Interrupted("interrupted", {
+    cause: error,
+  });
+  assertEquals(Interrupted.message, "interrupted");
+  assertEquals(Interrupted.cause, error);
+
+  const notCapable = new Deno.core.NotCapable("not capable", { cause: error });
+  assertEquals(notCapable.message, "not capable");
+  assertEquals(notCapable.cause, error);
+});
Repository: Hopding/pdf-lib (ts)

Issue:
Semi-transparent PNG rendered opaque in PDF
Im trying to watermark a PDF with a semi-transparent PNG, but the semi-transparent portions are being rendered fully opaque in resulting PDF.

I can't find anything in the docs regarding transparency... any help would be greatly appreciated.

Pull request:
Fix for #483 - Semi-transparent PNG rendered opaque in PDF
Fixes #483 and #473 

Patch:
diff --git a/src/utils/png.ts b/src/utils/png.ts
index b41e810..60aad74 100644
--- a/src/utils/png.ts
+++ b/src/utils/png.ts
@@ -58,7 +58,7 @@ export class PNG {
 
     this.rgbChannel = rgbChannel;
 
-    const hasAlphaValues = alphaChannel.some((a) => a < 1);
+    const hasAlphaValues = alphaChannel.some((a) => a < 255);
     if (hasAlphaValues) this.alphaChannel = alphaChannel;
 
     this.type = getImageType(upng.ctype);


Test patch:
diff --git a/tests/utils/png.spec.ts b/tests/utils/png.spec.ts
new file mode 100644
index 0000000..c0c4584
--- /dev/null
+++ b/tests/utils/png.spec.ts
@@ -0,0 +1,19 @@
+import {PNG} from 'src/utils/png';
+
+describe(`createSemiTransparentPNG`, () => {
+  it(`createsASemiTransparentPNG`, () => {
+    // This is the byteArray of a 1x1 dimension, semi transparent PNG generated like this:
+    // const ctx = c.getContext("2d");
+    // ctx.fillStyle = "rgba(255, 120, 80, 0.5)";
+    // ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+    const input = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21, 196, 137, 0, 0, 0, 13, 73, 68, 65, 84, 24, 87, 99, 248, 95, 17, 208, 0, 0, 6, 137, 2, 72, 25, 58, 220, 62, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]);
+
+    const pngImage = PNG.load(input);
+
+    const expected = new Uint8Array([128]);
+
+    const actual = pngImage.alphaChannel;
+
+    expect(actual).toEqual(expected);
+  });
+});
\ No newline at end of file