ernie-research/MEnvBench huggingface dataset:
Repository: honojs/hono (TypeScript)

Issue:
ClientResponse.json() with possibly undefined values is always inferred as "never"
### What version of Hono are you using?

3.10.1

### What runtime/platform is your app running on?

Node / Browser

### What steps can reproduce the bug?

When ClientResponse.json() is called with a type that has an optional field, it types as `never`. It stems from [BlankRecordToNever](https://github.com/honojs/hono/blob/bd00d284693e2079bb3be7ee762bcde53b194c73/src/client/types.ts#L29C1-L33C10).

Example:

Using `type Resp = BlankRecordToNever<{ id: string; name?: string }>;`...

Given `ClientResponse<Resp>.json()`, your result will be typed as `never`.

Even simpler, just use the following typescript to see the undesired results:

```ts
type BlankRecordToNever<T> = T extends Record<infer R, unknown>
  ? R extends never
    ? never
    : T
  : never;

type Resp = BlankRecordToNever<{ id: string; name?: string }>;
```
Resp will by typed as `never`.

Related: https://github.com/honojs/middleware/issues/285

### What is the expected behavior?

I would expect the type to carry through correctly. e.g. res.json() -> `{ id: string; name?: string }`

### What do you see instead?

_No response_

### Additional information

_No response_



Fix (patch):
diff --git a/deno_dist/client/types.ts b/deno_dist/client/types.ts
index afc517a9e..24128dc6f 100644
--- a/deno_dist/client/types.ts
+++ b/deno_dist/client/types.ts
@@ -26,11 +26,7 @@ type ClientRequest<S extends Schema> = {
   $url: () => URL
 }
 
-type BlankRecordToNever<T> = T extends Record<infer R, unknown>
-  ? R extends never
-    ? never
-    : T
-  : never
+type BlankRecordToNever<T> = keyof T extends never ? never : T
 
 export interface ClientResponse<T> {
   ok: boolean
diff --git a/src/client/types.ts b/src/client/types.ts
index 71c83f33a..1ac6f3d25 100644
--- a/src/client/types.ts
+++ b/src/client/types.ts
@@ -26,11 +26,7 @@ type ClientRequest<S extends Schema> = {
   $url: () => URL
 }
 
-type BlankRecordToNever<T> = T extends Record<infer R, unknown>
-  ? R extends never
-    ? never
-    : T
-  : never
+type BlankRecordToNever<T> = keyof T extends never ? never : T
 
 export interface ClientResponse<T> {
   ok: boolean
Repository: denoland/std (TypeScript)

Issue:
encoding/ascii85.ts: `encode()`  returns a wrong result with a 4-byte subarray
#### Describe the bug

The `encode()` function from *encoding/ascii.ts* returns a wrong result with a subarray.  More specifically, if a subarray is a 4-byte (or multiples of 4 bytes) slice of a buffer longer than it, and the slice refers to a non-zero offset in the buffer, the function encodes the first 4 bytes of the buffer instead of the subarray bytes.

#### Steps to Reproduce

```typescript
import { encode } from "https://deno.land/std@0.178.0/encoding/ascii85.ts";
import { assertEquals } from "https://deno.land/std@0.178.0/testing/asserts.ts";

Deno.test("base85 encoding", () => {
  const data = new Uint8Array([0x73, 0x70, 0x61, 0x6d]);
  const encoded = encode(data);
  assertEquals(encoded, "F)YQ)");
});

Deno.test("base85 encoding with a 4-byte subarray", () => {
  const data = new Uint8Array(
    [0x01, 0x02, 0x03, 0x04, 0x73, 0x70, 0x61, 0x6d],
  );
  const encoded = encode(data.subarray(4));

  // The following assertion fails; it returns "!<N?+" instead, which encodes
  // the first 4 bytes of the array: [0x01, 0x02, 0x03, 0x04].
  assertEquals(encoded, "F)YQ)");
});
```

#### Expected behavior

The below test should pass, but it does not.

#### Environment

<!-- please complete the following information -->

- OS: Ubuntu 22.04 & Windows 11 Pro
- Deno version: 1.30.3
- std version: 0.178.0



Discussion: Probably the same issue that I've fixed here - https://github.com/denoland/deno_std/pull/3208

https://github.com/denoland/deno_std/blob/69fa1e956c2469f168756d757b1653323327ed53/encoding/ascii85.ts#L78-L79

Should be trivial to port the patch there with the appropriate test.



Fix (patch):
diff --git a/encoding/ascii85.ts b/encoding/ascii85.ts
index 5487ee072625..45f680e6e787 100644
--- a/encoding/ascii85.ts
+++ b/encoding/ascii85.ts
@@ -76,7 +76,7 @@ export function encode(uint8: Uint8Array, options?: Ascii85Options): string {
     uint8 = new Uint8Array(tmp.length + difference);
     uint8.set(tmp);
   }
-  const view = new DataView(uint8.buffer);
+  const view = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
   for (let i = 0, len = uint8.length; i < len; i += 4) {
     v = view.getUint32(i);
     // Adobe and btoa standards compress 4 zeroes to single "z" character
Repository: denoland/std (TypeScript)

Issue:
assertNotEquals assertion error message discrepancy
There is an issue with the `assertNotEquals` output int the current version of the library. The assertion error message does not reflect the expected string values accurately. Specifically, the following test case:

`assertNotEquals('1','1');`

is expected to throw an error with the message:

`AssertionError: Expected actual: '1' not to be: '1'.`

However, the current output is:
`AssertionError: Expected actual: 1 not to be: 1.`

**Environment**

- OS: MacOS 12
- deno version: 1.44.0
- std version: 0.226.0



Discussion: I'm happy to add quotes to strings for this function. WDYT, @kt3k?
The suggestion makes sense to me. Maybe we should use `format` of `std/internal` to make the expression?



Fix (patch):
diff --git a/assert/not_equals.ts b/assert/not_equals.ts
index 10da792b814d..b87fd7dd0beb 100644
--- a/assert/not_equals.ts
+++ b/assert/not_equals.ts
@@ -3,6 +3,7 @@
 
 import { equal } from "./equal.ts";
 import { AssertionError } from "./assertion_error.ts";
+import { format } from "@std/internal/format";
 
 /**
  * Make an assertion that `actual` and `expected` are not equal, deeply.
@@ -27,8 +28,8 @@ export function assertNotEquals<T>(actual: T, expected: T, msg?: string) {
   if (!equal(actual, expected)) {
     return;
   }
-  const actualString = String(actual);
-  const expectedString = String(expected);
+  const actualString = format(actual);
+  const expectedString = format(expected);
   const msgSuffix = msg ? `: ${msg}` : ".";
   throw new AssertionError(
     `Expected actual: ${actualString} not to be: ${expectedString}${msgSuffix}`,
Repository: adobe/spectrum-web-components (TypeScript)

Issue:
[Bug]: duplicate label in sp-progress-bar
### Code of conduct

- [X] I agree to follow this project's code of conduct.

### Impacted component(s)

sp-progress-bar, sp-field-label

### Expected behavior

An sp-progress-bar that is initially created with an undefined label, and later has a label defined, should display the label the same as if it were initially created with that label.

### Actual behavior

An sp-progress-bar that is initially created with an undefined label and later has a label added will display the label twice.

### Screenshots

Initial state (first progress bar has undefined label):
<img width="543" alt="before" src="https://github.com/adobe/spectrum-web-components/assets/1794711/65966485-6b0b-41ea-ab43-48e202a494a6">

Error state, after a new label has been provided for both progress bars, first progress bar has duplicate label:
<img width="547" alt="after" src="https://github.com/adobe/spectrum-web-components/assets/1794711/393caf34-3d65-4f7c-b8f5-3cfad5e23103">


### What browsers are you seeing the problem in?

Chrome

### How can we reproduce this issue?

1. Go to https://codepen.io/sdiverdi/pen/XWQaVog
2. Click the "change label" button
3. See the first progress bar has a duplicated label


### Sample code that illustrates the problem

https://codepen.io/sdiverdi/pen/XWQaVog

### Logs taken while reproducing problem

_No response_



Fix (patch):
diff --git a/packages/progress-bar/src/ProgressBar.ts b/packages/progress-bar/src/ProgressBar.ts
index b9799764ff3..5eebbebf5ff 100644
--- a/packages/progress-bar/src/ProgressBar.ts
+++ b/packages/progress-bar/src/ProgressBar.ts
@@ -72,9 +72,8 @@ export class ProgressBar extends SizedMixin(
                 ? html`
                       <sp-field-label size=${this.size} class="label">
                           ${this.slotHasContent ? html`` : this.label}
-                          <slot @slotchange=${this.handleSlotchange}>
-                              ${this.label}
-                          </slot>
+
+                          <slot @slotchange=${this.handleSlotchange}></slot>
                       </sp-field-label>
                   `
                 : html``}
Repository: adobe/spectrum-web-components (TypeScript)

Issue:
[split-view]: update label attribute to be customisable 
### Code of conduct

- [X] I agree to follow this project's code of conduct.

### Description of issue

Follow up to the work done in https://github.com/adobe/spectrum-web-components/pull/3800

The `this.label` attribute in `sp-split-view` is inconsistent with our other `this.label` attributes, because it sets the value internally to the code like so:

```
const label = this.label || this.resizable ? 'Resize the panels' : undefined;
```
The `aria-label` is set to `label` if it is defined, rather than `this.label`. Do we want this to be customisable by the user and have `"Resize the panels"` as a fallback option? Or is this fine as it is? 

Reference:
["The splitter also has an accessible name that matches the name of the primary pane."](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/#aboutthispattern)




Fix (patch):
diff --git a/packages/split-view/src/SplitView.ts b/packages/split-view/src/SplitView.ts
index 04776578aed..c39805e557b 100644
--- a/packages/split-view/src/SplitView.ts
+++ b/packages/split-view/src/SplitView.ts
@@ -184,8 +184,9 @@ export class SplitView extends SpectrumElement {
                         this.viewSize - this.splitterSize
                     )) as boolean,
         };
-        const label =
-            this.label || (this.resizable ? 'Resize the panels' : undefined);
+        const label = this.resizable
+            ? this.label || 'Resize the panels'
+            : undefined;
 
         return html`
             <slot
Repository: adobe/spectrum-web-components (TypeScript)

Issue:
[Bug]: sp-number-field pressing increment/decrement buttons using NVDA moves focus to the text field
### Code of conduct

- [X] I agree to follow this project's code of conduct.

### Impacted component(s)

sp-number-field

### Expected behavior

When I press the increment or decrement buttons focus should stay on the button. I can't press it more than once if focus moves

### Actual behavior

Focus currently moves to the text field

### Screenshots

_No response_

### What browsers are you seeing the problem in?

Chrome, Microsoft Edge

### How can we reproduce this issue?

1. Go to https://opensource.adobe.com/spectrum-web-components/components/number-field/
2. Turn on NVDA 
3. arrow through the page (down arrow) until you get to a number field
4. Press down arrow one more time to get to the increment button
5. press space or enter 
Note focus moves to the text field and forms mode gets enabled


### Sample code that illustrates the problem

_No response_

### Logs taken while reproducing problem

_No response_


Discussion: Related to #3274 #3271  



Fix (patch):
diff --git a/packages/number-field/src/NumberField.ts b/packages/number-field/src/NumberField.ts
index 447771ca3db..90d67581bad 100644
--- a/packages/number-field/src/NumberField.ts
+++ b/packages/number-field/src/NumberField.ts
@@ -747,7 +747,7 @@ export class NumberField extends TextfieldBase {
                               inline="end"
                               block="start"
                               class="button step-up"
-                              aria-describedby=${this.helpTextId}
+                              aria-hidden="true"
                               label=${'Increase ' + this.appliedLabel}
                               size=${this.size}
                               tabindex="-1"
@@ -764,7 +764,7 @@ export class NumberField extends TextfieldBase {
                               inline="end"
                               block="end"
                               class="button step-down"
-                              aria-describedby=${this.helpTextId}
+                              aria-hidden="true"
                               label=${'Decrease ' + this.appliedLabel}
                               size=${this.size}
                               tabindex="-1"
Repository: wxt-dev/wxt (TypeScript)

Issue:
Unlisted CSS using preprocessor does not build css file
### Describe the bug

I encountered a situation where I needed to add a stylesheet dynamically, so I tried using unlisted CSS. I created a .scss as unlisted CSS, but the scss file was not generated as a CSS output.

When adding regular .css as unlisted CSS, it works without any issues, so it seems like there's something wrong related to sass.

### Reproduction

[unlisted-css-bug.zip](https://github.com/user-attachments/files/19770199/unlisted-css-bug.zip)

### Steps to reproduce

1. `npx wxt@latest init`
2. `npm i`
3. `npm i sass-embedded -D`
4. Create a file `entrypoints/test.content.scss`
5. Run `npm run dev` or `npm run build`

**Expected**
A file named `test.css` should be generated in `.output/chrome-mv3/content-scripts`

**Actual**
The `test.css` file does not exist :(

### System Info

```shell
System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 9 6900HX with Radeon Graphics
    Memory: 11.68 GB / 27.69 GB
  Binaries:
    Node: 22.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 11.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.7.1 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (132.0.2957.140)
    Internet Explorer: 11.0.26100.1882
```

### Used Package Manager

npm

### Validations

- [x] Read the [Contributing Guidelines](https://github.com/wxt-dev/wxt/blob/main/CONTRIBUTING.md).
- [x] Read the [docs](https://wxt.dev/guide/installation.html).
- [x] Check that there isn't [already an issue](https://github.com/wxt-dev/wxt/issues) that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/wxt-dev/wxt/discussions) or join our [Discord Chat Server](https://discord.gg/ZFsZqGery9).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.


Discussion: I have submitted a PR to fix this issue. #1590

After further investigation, I found that the same issue not only with Sass but with all CSS preprocessors, so I have updated the title



Fix (patch):
diff --git a/packages/wxt/src/core/builders/vite/index.ts b/packages/wxt/src/core/builders/vite/index.ts
index 8eb2068ab..c798749da 100644
--- a/packages/wxt/src/core/builders/vite/index.ts
+++ b/packages/wxt/src/core/builders/vite/index.ts
@@ -308,7 +308,10 @@ export async function createViteBuilder(
     async build(group) {
       let entryConfig;
       if (Array.isArray(group)) entryConfig = getMultiPageConfig(group);
-      else if (group.inputPath.endsWith('.css'))
+      else if (
+        group.type === 'content-script-style' ||
+        group.type === 'unlisted-style'
+      )
         entryConfig = getCssConfig(group);
       else entryConfig = getLibModeConfig(group);
Repository: google-gemini/gemini-cli (TypeScript)

Issue:
Compression can result in 400s and inability to continue conversation
### What happened?

after hitting limit of tokens, the cli attempt a compress if you redo a compress afterward it fails, but then the conversation is not recoverable as it get stuck replying systematically 400 code with below message :
Please ensure that the number of function response parts is equal to the number of function call parts of the
  function call turn.

### What did you expect to happen?

the conversation to remain usable

### Client information


*   **CLI Version:** 0.1.12
*   **Git Commit:** b29c02dd (local modifications)
*   **Operating System:** win32 v22.17.0
*   **Sandbox Environment:** no sandbox
*   **Model Version:** gemini-2.5-pro
*   **Memory Usage:** 143.9 MB


### Login information

_No response_

### Anything else we need to know?

_No response_


Discussion: @scidomino see linked duplicate issue I put more context there.
I also encountered a similar problem. I wrote a summary reference after reading a large number of documents (~170) using Gemini. However, it may be that the free quota for the day has been used up, so I am stuck here. But in short, no matter how I use other instructions in Gemini, I can't do it in the current session, and I will only get an error:
```
[API Error: [{
    "error": {
      "code": 400,
      "message": "Please ensure that the number of function response parts is equal to the number of
  function call parts of the function call turn.",
      "errors": [
        {
          "message": "Please ensure that the number of function response parts is equal to the number
  of function call parts of the function call turn.",
          "domain": "global",
          "reason": "badRequest"
        }
      ],
      "status": "INVALID_ARGUMENT"
    }
  }
  ]]
```
This should be straightforward to fix.



Fix (patch):
diff --git a/packages/core/src/core/client.ts b/packages/core/src/core/client.ts
index ed903788b7a..d8143d05ac0 100644
--- a/packages/core/src/core/client.ts
+++ b/packages/core/src/core/client.ts
@@ -30,6 +30,7 @@ import { reportError } from '../utils/errorReporting.js';
 import { GeminiChat } from './geminiChat.js';
 import { retryWithBackoff } from '../utils/retry.js';
 import { getErrorMessage } from '../utils/errors.js';
+import { isFunctionResponse } from '../utils/messageInspectors.js';
 import { tokenLimit } from './tokenLimits.js';
 import {
   AuthType,
@@ -547,7 +548,8 @@ export class GeminiClient {
     // Find the first user message after the index. This is the start of the next turn.
     while (
       compressBeforeIndex < curatedHistory.length &&
-      curatedHistory[compressBeforeIndex]?.role !== 'user'
+      (curatedHistory[compressBeforeIndex]?.role === 'model' ||
+        isFunctionResponse(curatedHistory[compressBeforeIndex]))
     ) {
       compressBeforeIndex++;
     }
Repository: capricorn86/happy-dom (TypeScript)

Issue:
NodeList gets the first element when you pass and empty array as index
**Describe the bug**
When you use an empty array as an index of a NodeList it returns the first element instead of undefined.

**To Reproduce**
Steps to reproduce the behavior:
We have the following function:
```javascript
const getActiveTabTrackId = () => {
    const bar = document.querySelector(".container");
    const active = bar && Object.keys(bar.childNodes).filter((key) => bar.childNodes[key].classList.contains('active');
    return bar && bar.childNodes[active] ? bar.childNodes[active].getAttribute('data-track-id') : null;
}
``` 

And we are testing it using:
```javascript
test('returns null if no active tab are present', () => {
    document.body.innerHTML = '<div class="container">' +
    '<div class="tab" data-track-id="one"></div>' +
    '<div class="tab" data-track-id="two"></div>' +
    '</div>';

    expect(getActiveTabTrackId()).toBe(null);
})
``` 

When we run it, test fails because NodeList its returning the first element instead of undefined

**Expected behavior**
`document.querySelector(".container").childNodes[[]]` should return undefined instead of the first element.

**Device:**
 - OS: macos
 - Browser: happy-dom and jest
 - Version: 16.6.0

**Additional context**
We are using Jest and @happy-dom/jest-environment




Fix (patch):
diff --git a/packages/happy-dom/src/nodes/node/NodeList.ts b/packages/happy-dom/src/nodes/node/NodeList.ts
index 71b49276e..fac6bf517 100644
--- a/packages/happy-dom/src/nodes/node/NodeList.ts
+++ b/packages/happy-dom/src/nodes/node/NodeList.ts
@@ -38,6 +38,9 @@ class NodeList<T extends Node> {
 					methodBinder.bind(property);
 					return target[property];
 				}
+				if (property === '') {
+					return undefined;
+				}
 				const index = Number(property);
 				if (!isNaN(index)) {
 					return items[index];
Repository: capricorn86/happy-dom (TypeScript)

Issue:
SVGElement.ownerSVGElement cannot exit if not in svg
**Describe the bug**
When I was using SVG nodes and tried to use the ownerSVGElement property, I ended up in an infinite loop. Upon checking the code, I found the following issue.

![image](https://user-images.githubusercontent.com/56526981/223290250-e91aadf7-aad5-4462-9dc2-b28a5c0ae6ca.png)

**To Reproduce**
Steps to reproduce the behavior:
1. create a svg element, such as 'g',
2. gInstance.ownerSVGElement;
3. inifinite loop now....

**Expected behavior**
Return a correct SVG node or null value instead of an infinite loop.




Fix (patch):
diff --git a/packages/happy-dom/src/nodes/svg-element/SVGElement.ts b/packages/happy-dom/src/nodes/svg-element/SVGElement.ts
index 664e0c10d..de8a10d74 100644
--- a/packages/happy-dom/src/nodes/svg-element/SVGElement.ts
+++ b/packages/happy-dom/src/nodes/svg-element/SVGElement.ts
@@ -37,11 +37,13 @@ export default class SVGElement extends Element implements ISVGElement {
 	 * @returns Element.
 	 */
 	public get ownerSVGElement(): ISVGSVGElement {
-		const parent = this.parentNode;
+		let parent = this.parentNode;
 		while (parent) {
 			if (parent['tagName'] === 'SVG') {
 				return <ISVGSVGElement>parent;
 			}
+
+			parent = parent.parentNode;
 		}
 		return null;
 	}
Repository: vscode-neovim/vscode-neovim (TypeScript)

Issue:
[Bug] vscode-neovim runs pasted code after hitting `Esc` ???!!!
Repro Steps:

1. Create a file named `test.vim`.
2. Paste `map <leader> <cmd>call VSCodeNotifyVisual('editor.action.commentLine', 0)<cr><esc>` into the file.
3. Use VSCode to open it.
4. Enter insert mode.
5. Use `Cmd+A` to select all.
6. Use `Cmd+C` to copy.
7. Use `Cmd+V` to paste.
8. Hit `Esc`.
9. The current line gets commented out!!!!!!



Fix (patch):
diff --git a/src/document_change_manager.ts b/src/document_change_manager.ts
index dfb94f5a0..dd4e7d1fa 100644
--- a/src/document_change_manager.ts
+++ b/src/document_change_manager.ts
@@ -177,11 +177,12 @@ export class DocumentChangeManager implements Disposable, NeovimExtensionRequest
                 dotRepeatChange.text = dotRepeatChange.text.slice(dotRepeatChange.eol.length);
             }
         }
+        editStr += dotRepeatChange.text.split(dotRepeatChange.eol).join("\n");
+        edits.push(["nvim_feedkeys", [editStr, "i", false]]);
         if (dotRepeatChange.rangeLength) {
-            editStr += [...new Array(dotRepeatChange.rangeLength).keys()].map(() => "<BS>").join("");
+            const backspaceEdits = [...new Array(dotRepeatChange.rangeLength).keys()].map(() => "<BS>").join("");
+            edits.push(["nvim_input", [backspaceEdits]]);
         }
-        editStr += dotRepeatChange.text.split(dotRepeatChange.eol).join("\n").replace("<", "<LT>");
-        edits.push(["nvim_input", [editStr]]);
         // since nvim_input is not blocking we need replay edits first, then clean up things in subsequent request
         await callAtomic(this.client, edits, this.logger, LOG_PREFIX);