helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(init): support scoped npm packages

The naming scheme for create npm packages varies depending on whether they are scoped or not. We only supported unscoped packages prior to this PR. This PR adds support for all the following cases which npm supports:

- `foo` -> `create-foo`
- `@foo/bar` -> `@foo/create-bar`
- `@foo` -> `@foo/create`
- `@foo@2.0.0` -> `@foo/create@2.0.0`
- `@foo/bar@2.0.0` -> `@foo/create-bar@2.0.0`

See https://docs.npmjs.com/cli/v8/commands/npm-init#description

Fixes https://github.com/denoland/deno/issues/27127

Changed files:
filename: cli/tools/init/mod.rs
patch: @@ -252,8 +252,46 @@ Deno.test(function addTest() {
   Ok(0)
 }
 
+fn npm_name_to_create_package(name: &str) -> String {
+  let mut s = "npm:".to_string();
+
+  let mut scoped = false;
+  let mut create = false;
+
+  for (i, ch) in name.char_indices() {
+    if i == 0 {
+      if ch == '@' {
+        scoped = true;
+      } else {
+        create = true;
+        s.push_str("create-");
+      }
+    } else if scoped {
+      if ch == '/' {
+        scoped = false;
+        create = true;
+        s.push_str("/create-");
+        continue;
+      } else if ch == '@' && !create {
+        scoped = false;
+        create = true;
+        s.push_str("/create@");
+        continue;
+      }
+    }
+
+    s.push(ch);
+  }
+
+  if !create {
+    s.push_str("/create");
+  }
+
+  s
+}
+
 async fn init_npm(name: &str, args: Vec<String>) -> Result<i32, AnyError> {
-  let script_name = format!("npm:create-{}", name);
+  let script_name = npm_name_to_create_package(name);
 
   fn print_manual_usage(script_name: &str, args: &[String]) -> i32 {
     log::info!("{}", cformat!("You can initialize project manually by running <u>deno run {} {}</> and applying desired permissions.", script_name, args.join(" ")));
@@ -336,3 +374,37 @@ fn create_file(
     Ok(())
   }
 }
+
+#[cfg(test)]
+mod test {
+  use crate::tools::init::npm_name_to_create_package;
+
+  #[test]
+  fn npm_name_to_create_package_test() {
+    // See https://docs.npmjs.com/cli/v8/commands/npm-init#description
+    assert_eq!(
+      npm_name_to_create_package("foo"),
+      "npm:create-foo".to_string()
+    );
+    assert_eq!(
+      npm_name_to_create_package("foo@1.0.0"),
+      "npm:create-foo@1.0.0".to_string()
+    );
+    assert_eq!(
+      npm_name_to_create_package("@foo"),
+      "npm:@foo/create".to_string()
+    );
+    assert_eq!(
+      npm_name_to_create_package("@foo@1.0.0"),
+      "npm:@foo/create@1.0.0".to_string()
+    );
+    assert_eq!(
+      npm_name_to_create_package("@foo/bar"),
+      "npm:@foo/create-bar".to_string()
+    );
+    assert_eq!(
+      npm_name_to_create_package("@foo/bar@1.0.0"),
+      "npm:@foo/create-bar@1.0.0".to_string()
+    );
+  }
+}
Repository: nodejs/node
Pull request: test: update `console` wpt

## `git node wpt console`

All tests pass.

Changed files:
filename: test/fixtures/wpt/README.md
patch: @@ -12,7 +12,7 @@ Last update:
 
 - common: https://github.com/web-platform-tests/wpt/tree/dbd648158d/common
 - compression: https://github.com/web-platform-tests/wpt/tree/da8d6860b2/compression
-- console: https://github.com/web-platform-tests/wpt/tree/767ae35464/console
+- console: https://github.com/web-platform-tests/wpt/tree/e48251b778/console
 - dom/abort: https://github.com/web-platform-tests/wpt/tree/0143fe244b/dom/abort
 - dom/events: https://github.com/web-platform-tests/wpt/tree/0a811c5161/dom/events
 - encoding: https://github.com/web-platform-tests/wpt/tree/1ac8deee08/encoding

filename: test/fixtures/wpt/console/console-countReset-logging-manual.html
patch: @@ -24,21 +24,25 @@
 console.count();
 console.countReset();
 console.count();
+console.countReset();
 
 console.count(undefined);
 console.countReset(undefined);
 console.count(undefined);
+console.countReset(undefined);
 
 console.count("default");
 console.countReset("default");
 console.count("default");
+console.countReset("default");
 
 console.count({toString() {return "default"}});
 console.countReset({toString() {return "default"}});
 console.count({toString() {return "default"}});
+console.countReset({toString() {return "default"}});
 
 console.count("a label");
-console.countReset();
+console.countReset("a label");
 console.count("a label");
 
 console.countReset("b"); // should produce a warning

filename: test/fixtures/wpt/console/console-log-large-array.any.js
patch: @@ -0,0 +1,8 @@
+// META: global=window,dedicatedworker,shadowrealm
+"use strict";
+// https://console.spec.whatwg.org/
+
+test(() => {
+    console.log(new Array(10000000).fill("x"));
+    console.log(new Uint8Array(10000000));
+}, "Logging large arrays works");

filename: test/fixtures/wpt/console/console-log-symbol.any.js
patch: @@ -0,0 +1,10 @@
+// META: global=window,dedicatedworker,shadowrealm
+"use strict";
+// https://console.spec.whatwg.org/
+
+test(() => {
+    console.log(Symbol());
+    console.log(Symbol("abc"));
+    console.log(Symbol.for("def"));
+    console.log(Symbol.isConcatSpreadable);
+}, "Logging a symbol doesn't throw");

filename: test/fixtures/wpt/versions.json
patch: @@ -8,7 +8,7 @@
     "path": "compression"
   },
   "console": {
-    "commit": "767ae354642bee1e4d90b28df4480475b9260e14",
+    "commit": "e48251b77834f9689e9df3f49b93b3387dee72d6",
     "path": "console"
   },
   "dom/abort": {
Repository: facebook/react
Pull request: Make "unexpected batch number" a warning

This was added to catch internal errors in React but doesn't seem to be doing much good except frustrating people more when their apps throw (#6895, FB-internal t11950821). Until more proper error boundaries land, let's make this a warning.


Changed files:
filename: src/renderers/shared/stack/reconciler/ReactReconciler.js
patch: @@ -14,7 +14,7 @@
 var ReactRef = require('ReactRef');
 var ReactInstrumentation = require('ReactInstrumentation');
 
-var invariant = require('invariant');
+var warning = require('warning');
 
 /**
  * Helper to call ReactRef.attachRefs with this composite component, split out
@@ -206,7 +206,7 @@ var ReactReconciler = {
     if (internalInstance._updateBatchNumber !== updateBatchNumber) {
       // The component's enqueued batch number should always be the current
       // batch or the following one.
-      invariant(
+      warning(
         internalInstance._updateBatchNumber == null ||
         internalInstance._updateBatchNumber === updateBatchNumber + 1,
         'performUpdateIfNecessary: Unexpected batch number (current %s, ' +
Repository: vercel/next.js
Pull request: fix(turbopack): Next.js package not found panics in Turbopack

## Warn when multiple lockfiles are found and use highest level lockfile

### What?
This PR enhances the lockfile detection logic to identify multiple lockfiles in a project hierarchy and use the highest level one as the tracing root.

### Why?
When multiple lockfiles exist in a project, it can cause confusion and potential issues. By detecting this situation, we can warn users about redundant lockfiles and consistently use the highest level one.

### How?
- Modified `findRootDir` to recursively search for lockfiles up the directory tree
- Added a warning when multiple lockfiles are detected, showing the paths to redundant lockfiles
- Updated comment in config.ts to clarify we use the "highest level lockfile" rather than "closest lockfile"
- Added support for passing root directory as an argument in telemetry flush

Fixes #3980

This is a draft PR currently because the logging is duplicated across processes which I am currently working on a fix for.

Changed files:
filename: packages/next/src/lib/find-root.ts
patch: @@ -1,5 +1,6 @@
 import { dirname } from 'path'
 import findUp from 'next/dist/compiled/find-up'
+import * as Log from '../build/output/log'
 
 export function findRootLockFile(cwd: string) {
   return findUp.sync(
@@ -18,5 +19,29 @@ export function findRootLockFile(cwd: string) {
 
 export function findRootDir(cwd: string) {
   const lockFile = findRootLockFile(cwd)
-  return lockFile ? dirname(lockFile) : undefined
+  if (!lockFile) return undefined
+
+  const lockFiles = [lockFile]
+  while (true) {
+    const nextDir = dirname(dirname(lockFiles[lockFiles.length - 1]))
+    const newLockFile = findRootLockFile(nextDir)
+
+    if (newLockFile) {
+      lockFiles.push(newLockFile)
+    } else {
+      break
+    }
+  }
+
+  // Only warn if not in a build worker to avoid duplicate warnings
+  if (typeof process.send !== 'function' && lockFiles.length > 1) {
+    Log.warnOnce(
+      `Warning: Found multiple lockfiles. Consider removing the lockfiles at ${lockFiles
+        .slice(0, lockFiles.length - 1)
+        .map((str) => '\n   * ' + str)
+        .join('')}\n`
+    )
+  }
+
+  return dirname(lockFile)
 }

filename: packages/next/src/server/config.ts
patch: @@ -699,7 +699,7 @@ function assignDefaults(
     dset(result, ['turbopack', 'root'], result.outputFileTracingRoot)
   }
 
-  // use the closest lockfile as tracing root
+  // use the highest level lockfile as tracing root
   if (!result?.outputFileTracingRoot || !result?.turbopack?.root) {
     let rootDir = findRootDir(dir)
Repository: denoland/deno
Pull request: fix(node/http): casing ignored in ServerResponse.hasHeader()

We didn't respect casing when checking if a HTTP header is present in Node's `ServerResponse.hasHeader()`. This lead to us returning incorrect results when the header was present. Koa assumed that the `Content-Type` header wasn't present when it actually was and defaulted to a different `Content-Type` value.

Fixes https://github.com/denoland/deno/issues/27101

Changed files:
filename: ext/node/polyfills/http.ts
patch: @@ -1409,7 +1409,7 @@ ServerResponse.prototype.hasHeader = function (
   this: ServerResponse,
   name: string,
 ) {
-  return Object.hasOwn(this._headers, name);
+  return Object.hasOwn(this._headers, StringPrototypeToLowerCase(name));
 };
 
 ServerResponse.prototype.writeHead = function (

filename: tests/unit_node/http_test.ts
patch: @@ -1151,6 +1151,7 @@ Deno.test("[node/http] ServerResponse header names case insensitive", async () =
   const { promise, resolve } = Promise.withResolvers<void>();
   const server = http.createServer((_req, res) => {
     res.setHeader("Content-Length", "12345");
+    assert(res.hasHeader("Content-Length"));
     res.removeHeader("content-length");
     assertEquals(res.getHeader("Content-Length"), undefined);
     assert(!res.hasHeader("Content-Length"));
Repository: vercel/next.js
Pull request: Add a test to show that `'use cache'` works in `generateMetadata`

When calling a function with a `'use cache'` directive from `generateMetadata`, and from the page/layout, the invocations are deduped and the result is shared.

When `generateMetadata` itself also has a `'use cache'` directive, and it calls a nested function with a `'use cache'` directive, we do need to land #78703 for proper deduplication of the nested cache.

Changed files:
filename: test/e2e/app-dir/use-cache/app/generate-metadata/cached-data.ts
patch: @@ -0,0 +1,7 @@
+import { setTimeout } from 'timers/promises'
+
+export async function getCachedData() {
+  'use cache'
+  await setTimeout(1000)
+  return new Date().toISOString()
+}

filename: test/e2e/app-dir/use-cache/app/generate-metadata/layout.tsx
patch: @@ -0,0 +1,15 @@
+import { getCachedData } from './cached-data'
+
+export default async function Layout({
+  children,
+}: {
+  children: React.ReactNode
+}) {
+  return (
+    <>
+      <h1>Layout</h1>
+      <p id="layout-data">{await getCachedData()}</p>
+      <div>{children}</div>
+    </>
+  )
+}

filename: test/e2e/app-dir/use-cache/app/generate-metadata/page.tsx
patch: @@ -0,0 +1,24 @@
+import { Metadata } from 'next'
+import { connection } from 'next/server'
+import { getCachedData } from './cached-data'
+
+export async function generateMetadata(): Promise<Metadata> {
+  // TODO: Deduping with nested caches requires #78703.
+  // 'use cache'
+
+  return {
+    description: new Date().toISOString(),
+    title: await getCachedData(),
+  }
+}
+
+export default async function Page() {
+  await connection()
+
+  return (
+    <>
+      <h2>Page</h2>
+      <p id="page-data">{await getCachedData()}</p>
+    </>
+  )
+}

filename: test/e2e/app-dir/use-cache/use-cache.test.ts
patch: @@ -980,6 +980,34 @@ describe('use-cache', () => {
       expect(randomOne).toBe(randomTwo)
     })
   })
+
+  it('shares caches between the page/layout and generateMetadata', async () => {
+    const browser = await next.browser('/generate-metadata')
+    const layoutData = await browser.elementByCss('#layout-data').text()
+    const pageData = await browser.elementByCss('#page-data').text()
+    const title = await browser.eval('document.title')
+
+    expect(layoutData).toBe(pageData)
+    expect(pageData).toBe(title)
+
+    const initialDescription = await browser
+      .elementByCss('meta[name="description"]')
+      .getAttribute('content')
+
+    expect(initialDescription).not.toBe(title)
+
+    await browser.refresh()
+
+    const description = await browser
+      .elementByCss('meta[name="description"]')
+      .getAttribute('content')
+
+    // TODO: After #78703 has landed, we can enable the outer 'use cache' in
+    // generateMetadata, and still have the cached title (a nested cache) be
+    // shared with the page/layout. Then the description will also be cached (by
+    // the outer 'use cache'), and this expectation needs to be flipped.
+    expect(description).not.toBe(initialDescription)
+  })
 })
 
 async function getSanitizedLogs(browser: Playwright): Promise<string[]> {
Repository: huggingface/transformers
Pull request: Skip torchscript tests for 2 models

# What does this PR do?

We won't actively maintain the torchscript stuff.

See #35972


Probably I need to do the same as in #35972 but you get the idea :-)

Changed files:
filename: tests/models/canine/test_modeling_canine.py
patch: @@ -241,6 +241,14 @@ def setUp(self):
         # we set has_text_modality to False as the config has no vocab_size attribute
         self.config_tester = ConfigTester(self, config_class=CanineConfig, has_text_modality=False, hidden_size=37)
 
+    @unittest.skip("failing. Will fix only when the community opens an issue for it.")
+    def test_torchscript_output_hidden_state(self):
+        pass
+
+    @unittest.skip("failing. Will fix only when the community opens an issue for it.")
+    def test_torchscript_simple(self):
+        pass
+
     def test_config(self):
         self.config_tester.run_common_tests()
 

filename: tests/models/moonshine/test_modeling_moonshine.py
patch: @@ -150,6 +150,14 @@ def setUp(self):
         self.model_tester = MoonshineModelTester(self)
         self.config_tester = ConfigTester(self, config_class=MoonshineConfig)
 
+    @unittest.skip("failing. Will fix only when the community opens an issue for it.")
+    def test_torchscript_output_hidden_state(self):
+        pass
+
+    @unittest.skip("failing. Will fix only when the community opens an issue for it.")
+    def test_torchscript_simple(self):
+        pass
+
     def test_config(self):
         self.config_tester.run_common_tests()
Repository: nodejs/node
Pull request: lib: add flag to drop connection when running in cluster mode

Refs: https://github.com/nodejs/node/issues/54882

- [x] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes
- [x] tests and/or benchmarks are included
- [x] documentation is changed or added
- [x] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)


Changed files:
filename: doc/api/net.md
patch: @@ -603,12 +603,25 @@ changes:
 
 * {integer}
 
-Set this property to reject connections when the server's connection count gets
-high.
+When the number of connections reaches the `server.maxConnections` threshold:
+
+1. If the process is not running in cluster mode, Node.js will close the connection.
+
+2. If the process is running in cluster mode, Node.js will, by default, route the connection to another worker process. To close the connection instead, set \[`server.dropMaxConnection`]\[] to `true`.
 
 It is not recommended to use this option once a socket has been sent to a child
 with [`child_process.fork()`][].
 
+### `server.dropMaxConnection`
+
+<!-- YAML
+added: REPLACEME
+-->
+
+* {boolean}
+
+Set this property to `true` to begin closing connections once the number of connections reaches the \[`server.maxConnections`]\[] threshold. This setting is only effective in cluster mode.
+
 ### `server.ref()`
 
 <!-- YAML

filename: lib/internal/cluster/child.js
patch: @@ -231,7 +231,9 @@ function onconnection(message, handle) {
 
   if (accepted && server[owner_symbol]) {
     const self = server[owner_symbol];
-    if (self.maxConnections != null && self._connections >= self.maxConnections) {
+    if (self.maxConnections != null &&
+        self._connections >= self.maxConnections &&
+        !self.dropMaxConnection) {
       accepted = false;
     }
   }

filename: test/parallel/test-net-server-drop-connections-in-cluster.js
patch: @@ -0,0 +1,21 @@
+'use strict';
+const common = require('../common');
+const cluster = require('cluster');
+const http = require('http');
+
+if (cluster.isPrimary) {
+  cluster.fork();
+} else {
+  const server = http.createServer();
+  server.maxConnections = 0;
+  server.dropMaxConnection = true;
+  // When dropMaxConnection is false, the main process will continue to
+  // distribute the request to the child process, if true, the child will
+  // close the connection directly and emit drop event.
+  server.on('drop', common.mustCall((a) => {
+    process.exit();
+  }));
+  server.listen(common.mustCall(() => {
+    http.get(`http://localhost:${server.address().port}`).on('error', console.error);
+  }));
+}
Repository: ggml-org/llama.cpp
Pull request: ggml: fix loongarch quantize_row_q8_1 error

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: ggml/src/ggml-cpu/arch/loongarch/quants.c
patch: @@ -544,7 +544,7 @@ void quantize_row_q8_1(const float * GGML_RESTRICT x, void * GGML_RESTRICT vy, i
         __m128 max4 = __lsx_vfmax_s( lasx_extractf128( max_abs, 1 ), lasx_extractf128( max_abs, 0) );
         max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vpickod_d((__m128i) max4, (__m128i)max4 ) );
         __m128 tmp = max4;
-        max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vextrins_w((__m128i)tmp, (__m128i)max4, 0x10 ));
+        max4 = __lsx_vfmax_s( max4, (__m128)__lsx_vextrins_w((__m128i)tmp, (__m128i)max4, 0x1 ));
         const float max_scalar = ((v4f32)max4)[0];
 
         // Quantize these floats
Repository: huggingface/transformers
Pull request: Protect `get_default_device` for torch<2.3

# What does this PR do?

As per the title! It was reported in https://github.com/huggingface/transformers/issues/38329!
`set_default_device` has been around for a long time, but not `get_default_device` interestingly!

Changed files:
filename: src/transformers/modeling_utils.py
patch: @@ -324,7 +324,8 @@ def get_torch_context_manager_or_global_device():
     is not "cpu". This is used to infer the correct device to load the model on, in case `device_map` is not provided.
     """
     device_in_context = torch.tensor([]).device
-    default_device = torch.get_default_device()
+    # `get_default_device` was only introduced in torch>=2.3 - use cpu otherwise to align the behavior
+    default_device = torch.get_default_device() if is_torch_greater_or_equal("2.3") else torch.device("cpu")
     # This case means no context manager was used -> we still check if the default that was potentially set is not cpu
     if device_in_context == default_device:
         if default_device != torch.device("cpu"):
Repository: electron/electron
Pull request: ci: remove from issue triage on issue transferred

#### Description of Change

<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
-->

If an issue is transferred to another repo, it stays on the issue triage board, so this updates our automation to remove it.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd

#### Release Notes

Notes: none <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->


Changed files:
filename: .github/workflows/issue-transferred.yml
patch: @@ -0,0 +1,24 @@
+name: Issue Transferred
+
+on:
+  issues:
+    types: [transferred]
+
+permissions: {}
+
+jobs:
+  issue-transferred:
+    name: Issue Transferred
+    runs-on: ubuntu-latest
+    steps:
+      - name: Generate GitHub App token
+        uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
+        id: generate-token
+        with:
+          creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }}
+          org: electron
+      - name: Remove from issue triage
+        uses: dsanders11/project-actions/delete-item@438b25e007c2f4efec324497fadc6402e7cc61a6 # v1.4.0
+        with:
+          token: ${{ steps.generate-token.outputs.token }}
+          project-number: 90