helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(ext/http): correctly consume response body in `Deno.serve`

Prior to this commit, you could return a `Response` created from a string or Uint8Array multiple times.

Now you can't do that anymore.


Changed files:
filename: ext/http/00_serve.ts
patch: @@ -436,6 +436,11 @@ function fastSyncResponseOrStream(
 
   const stream = respBody.streamOrStatic;
   const body = stream.body;
+  if (body !== undefined) {
+    // We ensure the response has not been consumed yet in the caller of this
+    // function.
+    stream.consumed = true;
+  }
 
   if (TypedArrayPrototypeGetSymbolToStringTag(body) === "Uint8Array") {
     innerRequest?.close();
@@ -505,6 +510,12 @@ function mapToCallback(context, callback, onError) {
           "Return value from serve handler must be a response or a promise resolving to a response",
         );
       }
+
+      if (response.bodyUsed) {
+        throw TypeError(
+          "The body of the Response returned from the serve handler has already been consumed.",
+        );
+      }
     } catch (error) {
       try {
         response = await onError(error);

filename: tests/unit/serve_test.ts
patch: @@ -631,6 +631,51 @@ Deno.test(
   },
 );
 
+Deno.test(
+  { permissions: { net: true } },
+  async function httpServerMultipleResponseBodyConsume() {
+    const ac = new AbortController();
+    const { promise, resolve } = Promise.withResolvers<void>();
+    const response = new Response("Hello World");
+    let hadError = false;
+    const server = Deno.serve({
+      handler: () => {
+        return response;
+      },
+      port: servePort,
+      signal: ac.signal,
+      onListen: onListen(resolve),
+      onError: () => {
+        hadError = true;
+        return new Response("Internal Server Error", { status: 500 });
+      },
+    });
+
+    await promise;
+    assert(!response.bodyUsed);
+
+    const resp = await fetch(`http://127.0.0.1:${servePort}/`, {
+      headers: { "connection": "close" },
+    });
+    assertEquals(resp.status, 200);
+    const text = await resp.text();
+    assertEquals(text, "Hello World");
+    assert(response.bodyUsed);
+
+    const resp2 = await fetch(`http://127.0.0.1:${servePort}/`, {
+      headers: { "connection": "close" },
+    });
+    assertEquals(resp2.status, 500);
+    const text2 = await resp2.text();
+    assertEquals(text2, "Internal Server Error");
+    assert(hadError);
+    assert(response.bodyUsed);
+
+    ac.abort();
+    await server.finished;
+  },
+);
+
 Deno.test({ permissions: { net: true } }, async function httpServerOverload1() {
   const ac = new AbortController();
   const deferred = Promise.withResolvers<void>();
Repository: vercel/next.js
Pull request: Turbopack: Remove `next start --turbopack`

This removes the `--turbopack` and `--turbo` flags from `next start`, as it correctly launches the server to handle Turbopack builds without the flag.

It also removes this section from the documentation.

This is a breaking change, but Turbopack-powered builds are experimental, so this can probably go out with the next stable release.


Closes PACK-4405
Resolves #78339

Changed files:
filename: docs/01-app/05-api-reference/08-turbopack.mdx
patch: @@ -18,14 +18,14 @@ We built Turbopack to push the performance of Next.js, including:
 
 ## Getting started
 
-To enable Turbopack in your Next.js project, add the `--turbopack` flag to the `dev`, `build`, and `start` scripts in your `package.json` file:
+To enable Turbopack in your Next.js project, add the `--turbopack` flag to the `dev` and `build` scripts in your `package.json` file:
 
 ```json filename="package.json" highlight={3}
 {
   "scripts": {
     "dev": "next dev --turbopack",
     "build": "next build --turbopack",
-    "start": "next start --turbopack"
+    "start": "next start"
   }
 }
 ```

filename: packages/next/src/bin/next.ts
patch: @@ -351,8 +351,6 @@ program
       'Specify the maximum amount of milliseconds to wait before closing inactive connections.'
     ).argParser(parseValidPositiveInteger)
   )
-  .addOption(new Option('--turbo').hideHelp())
-  .option('--turbopack', 'Starts development mode using Turbopack.')
   .action((directory: string, options: NextStartOptions) =>
     import('../cli/next-start.js').then((mod) =>
       mod.nextStart(options, directory)

filename: packages/next/src/cli/next-start.ts
patch: @@ -13,8 +13,6 @@ export type NextStartOptions = {
   port: number
   hostname?: string
   keepAliveTimeout?: number
-  turbo?: boolean
-  turbopack?: boolean
 }
 
 /**
Repository: huggingface/transformers
Pull request: Fix wrong argparse type in modular checker script

# What does this PR do?

In the `argparse` library, the `type` parameter is applied to each argument individually. When using `type=list` in combination with `nargs="+"`, the command `python utils/check_modular_conversion.py --files abc def` is parsed as `[['a', 'b', 'c'], ['d', 'e', 'f']]`. This behavior occurs because the script typically relies on no arguments being passed, defaulting to `['all']`, which has allowed it to function correctly until now.

This PR corrects this behaviour.

CC: @ArthurZucker


Changed files:
filename: utils/check_modular_conversion.py
patch: @@ -115,7 +115,7 @@ def guaranteed_no_diff(modular_file_path, dependencies, models_in_diff):
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="Compare modular_xxx.py files with modeling_xxx.py files.")
     parser.add_argument(
-        "--files", default=["all"], type=list, nargs="+", help="List of modular_xxx.py files to compare."
+        "--files", default=["all"], type=str, nargs="+", help="List of modular_xxx.py files to compare."
     )
     parser.add_argument(
         "--fix_and_overwrite", action="store_true", help="Overwrite the modeling_xxx.py file if differences are found."
Repository: denoland/deno
Pull request: fix: Don't panic if failed to add system certificate

This commit fixes the panic from https://github.com/denoland/deno/issues/24137.

I'm not sure if we want to hard error or maybe instead skip with a warning
and continue execution.

Changed files:
filename: cli/args/mod.rs
patch: @@ -624,6 +624,8 @@ pub enum RootCertStoreLoadError {
   UnknownStore(String),
   #[error("Unable to add pem file to certificate store: {0}")]
   FailedAddPemFile(String),
+  #[error("Unable to add system certificate to certificate store: {0}")]
+  FailedAddSystemCert(String),
   #[error("Failed opening CA file: {0}")]
   CaFileOpenError(String),
 }
@@ -659,7 +661,9 @@ pub fn get_root_cert_store(
         for root in roots {
           root_cert_store
             .add(rustls::pki_types::CertificateDer::from(root.0))
-            .expect("Failed to add platform cert to root cert store");
+            .map_err(|e| {
+              RootCertStoreLoadError::FailedAddSystemCert(e.to_string())
+            })?;
         }
       }
       _ => {
Repository: facebook/react
Pull request: Add package.json as one of entry point

<!--
  Thanks for submitting a pull request!
  We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.

  Before submitting a pull request, please make sure the following is done:

  1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`.
  2. Run `yarn` in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
  5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`.
  6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
  7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
  8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

  Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

Remove entry point `build-info.json` (close #22947)

Add entry point `package.json` (close https://github.com/storybookjs/storybook/issues/16623)

I added `package.json` because it makes the storybook a fatal error in Node 17 because it tried to import this file.

## How did you test this change?

<!--
  Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface.
  How exactly did you verify that your PR solves the issue you wanted to solve?
  If you leave this empty, your PR will very likely be closed.
-->


Changed files:
filename: packages/react/package.json
patch: @@ -11,7 +11,6 @@
   "files": [
     "LICENSE",
     "README.md",
-    "build-info.json",
     "index.js",
     "cjs/",
     "umd/",
@@ -29,7 +28,7 @@
       "react-server": "./unstable-shared-subset.js",
       "default": "./index.js"
     },
-    "./build-info.json": "./build-info.json",
+    "./package.json": "./package.json",
     "./jsx-runtime": "./jsx-runtime.js",
     "./jsx-dev-runtime": "./jsx-dev-runtime.js",
     "./": "./"
Repository: nodejs/node
Pull request: build: allow overriding clang usage

Refs https://github.com/nodejs/node/commit/6e0a2bb5
Refs https://github.com/electron/electron/pull/44189

The above commit configures the value for `clang` usage at build time which doesn't work in Electron. It depends on the environment where the headers got generated, which doesn't always reflect the platform where the binary was built for us.

This isn't an issue for Node.js since node-gyp will use the result of `process.config` that reflects the environment in which the binary got built.

To fix this, allow overriding clang usage.
<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->


Changed files:
filename: configure.py
patch: @@ -131,6 +131,12 @@
     default=None,
     help='use the prefix to look for pre-installed headers')
 
+parser.add_argument('--use_clang',
+    action='store_true',
+    dest='use_clang',
+    default=None,
+    help='use clang instead of gcc')
+
 parser.add_argument('--dest-os',
     action='store',
     dest='dest_os',
@@ -1407,6 +1413,10 @@ def configure_node(o):
   o['variables']['target_arch'] = target_arch
   o['variables']['node_byteorder'] = sys.byteorder
 
+  # Allow overriding the compiler - needed by embedders.
+  if options.use_clang:
+    o['variables']['clang'] = 1
+
   cross_compiling = (options.cross_compiling
                      if options.cross_compiling is not None
                      else target_arch != host_arch)
Repository: denoland/deno
Pull request: fix(compile): adhoc codesign mach-o by default

Missed to add this in #24604 

Changed files:
filename: cli/standalone/binary.rs
patch: @@ -183,7 +183,7 @@ fn write_binary_bytes(
   } else if target.contains("darwin") {
     libsui::Macho::from(original_bin)?
       .write_section("d3n0l4nd", writer)?
-      .build(&mut file_writer)?;
+      .build_and_sign(&mut file_writer)?;
   }
   Ok(())
 }
@@ -194,8 +194,8 @@ pub fn is_standalone_binary(exe_path: &Path) -> bool {
   };
 
   libsui::utils::is_elf(&data)
-    | libsui::utils::is_pe(&data)
-    | libsui::utils::is_macho(&data)
+    || libsui::utils::is_pe(&data)
+    || libsui::utils::is_macho(&data)
 }
 
 /// This function will try to run this binary as a standalone binary

filename: tests/integration/compile_tests.rs
patch: @@ -34,6 +34,17 @@ fn compile_basic() {
     output.assert_matches_text("Welcome to Deno!\n");
   }
 
+  // On arm64 macOS, check if `codesign -v` passes
+  #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
+  {
+    let output = std::process::Command::new("codesign")
+      .arg("-v")
+      .arg(&exe)
+      .output()
+      .unwrap();
+    assert!(output.status.success());
+  }
+
   // now ensure this works when the deno_dir is readonly
   let readonly_dir = dir.path().join("readonly");
   readonly_dir.make_dir_readonly();
Repository: facebook/react
Pull request: Console message fixed for devtools

Fixed console message plus other typos

Changed files:
filename: scripts/circleci/run_devtools_e2e_tests.js
patch: @@ -86,7 +86,7 @@ function runTestShell() {
   });
   serverProcess.stderr.on('data', data => {
     if (`${data}`.includes('EADDRINUSE')) {
-      // Something is occuprying this port;
+      // Something is occupying this port;
       // We could kill the process and restart but probably better to prompt the user to do this.
 
       logError('Free up the port and re-run tests:');

filename: scripts/devtools/build-and-test.js
patch: @@ -210,7 +210,7 @@ async function downloadLatestReactBuild() {
   const buildID = match[1];
 
   console.log('');
-  console.log(`Downloaded artiacts for CI build ${chalk.bold(buildID)}.`);
+  console.log(`Downloaded artifacts for CI build ${chalk.bold(buildID)}.`);
 
   return buildID;
 }

filename: scripts/flow/runFlow.js
patch: @@ -52,7 +52,7 @@ async function runFlow(renderer, args) {
         fs.unlinkSync(destPath);
         fs.copyFileSync(srcPath, destPath);
         // Set the mtime of the copied file to be same as the original file,
-        // so that the ahove check works.
+        // so that the above check works.
         fs.utimesSync(destPath, srcStat.atime, srcStat.mtime);
       }
     } else {

filename: scripts/jest/jest-cli.js
patch: @@ -297,7 +297,7 @@ function getEnvars() {
       ? 'experimental'
       : 'stable',
 
-    // Pass this flag through to the confit environment
+    // Pass this flag through to the config environment
     // so the base config can conditionally load the console setup file.
     compactConsole: argv.compactConsole,
   };
Repository: ggml-org/llama.cpp
Pull request: test: non-cont. b in test-backend-ops -o MUL_MAT

See https://github.com/ggml-org/llama.cpp/pull/13137 and https://github.com/ggml-org/llama.cpp/pull/13155 .

The Vulkan backend still needs a fix, these tests should be merged either at the same time or after Vulkan has been fixed.

Changed files:
filename: tests/test-backend-ops.cpp
patch: @@ -1981,7 +1981,7 @@ struct test_mul_mat : public test_case {
     const std::array<int64_t, 2> bs;  // dims 3 and 4
     const std::array<int64_t, 2> nr;  // repeat in dims 3 and 4
     const std::array<int64_t, 4> per; // permutation of dimensions
-    const bool v; // whether a is a non-contiguous view
+    const bool v; // whether a and b are non-contiguous views
 
     std::string vars() override {
         return VARS_TO_STR9(type_a, type_b, m, n, k, bs, nr, per, v);
@@ -2042,12 +2042,15 @@ struct test_mul_mat : public test_case {
         } else {
 
             if (v) {
-                a = ggml_new_tensor_4d(ctx, type_a, k*2, m, bs[0], bs[1]);
-                a = ggml_view_4d(ctx, a, k, m, bs[0], bs[1], a->nb[1], a->nb[2], a->nb[3], 0);
+                a = ggml_new_tensor_4d(ctx, type_a, k*2, m, bs[0],       bs[1]);
+                b = ggml_new_tensor_4d(ctx, type_b, k*2, n, bs[0]*nr[0], bs[1]*nr[1]);
+
+                a = ggml_view_4d(ctx, a, k, m, bs[0],       bs[1],       a->nb[1], a->nb[2], a->nb[3], 0);
+                b = ggml_view_4d(ctx, b, k, n, bs[0]*nr[0], bs[1]*nr[1], b->nb[1], b->nb[2], b->nb[3], 0);
             } else {
                 a = ggml_new_tensor_4d(ctx, type_a, k, m, bs[0],       bs[1]);
+                b = ggml_new_tensor_4d(ctx, type_b, k, n, bs[0]*nr[0], bs[1]*nr[1]);
             }
-            b = ggml_new_tensor_4d(ctx, type_b, k, n, bs[0]*nr[0], bs[1]*nr[1]);
             if (!ggml_is_quantized(type_a)) {
                 if (bs[1] == 1 && nr[1] == 1) {
                     ggml_set_param(ctx, a);
Repository: vercel/next.js
Pull request: Turbopack: add random_change test case to test persistent caching changes

### What?

Add a test case that checks if we can apply changes to the app after restoring from cache.

Closes PACK-4407

Changed files:
filename: turbopack/crates/turbo-tasks-backend/tests/random_change.rs
patch: @@ -0,0 +1 @@
+../../turbo-tasks-testing/tests/random_change.rs
\ No newline at end of file

filename: turbopack/crates/turbo-tasks-testing/tests/random_change.rs
patch: @@ -0,0 +1,71 @@
+#![feature(arbitrary_self_types)]
+#![feature(arbitrary_self_types_pointers)]
+#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
+
+use anyhow::{bail, Result};
+use rand::Rng;
+use turbo_tasks::{State, Vc};
+use turbo_tasks_testing::{register, run, Registration};
+
+static REGISTRATION: Registration = register!();
+
+#[tokio::test]
+async fn random_change() {
+    run(&REGISTRATION, || async {
+        let state = make_state();
+        let value = rand::rng().random_range(0..100);
+        state.await?.state.set(value);
+
+        let result = func(state, 0).await?;
+        assert_eq!(result.value, value);
+
+        let result = func2(state).await?;
+        assert_eq!(result.value, value);
+
+        anyhow::Ok(())
+    })
+    .await
+    .unwrap()
+}
+
+#[turbo_tasks::value]
+#[derive(Clone, Debug)]
+struct Value {
+    value: i32,
+}
+
+#[turbo_tasks::value]
+#[derive(Debug)]
+struct ValueContainer {
+    state: State<i32>,
+}
+
+#[turbo_tasks::function]
+fn make_state() -> Vc<ValueContainer> {
+    ValueContainer {
+        state: State::new(0),
+    }
+    .cell()
+}
+
+#[turbo_tasks::function]
+async fn func2(input: Vc<ValueContainer>) -> Result<Vc<Value>> {
+    let state = input.await?;
+    let value = state.state.get();
+    println!("func2 {}", *value);
+    Ok(func(input, -*value))
+}
+
+#[turbo_tasks::function]
+async fn func(input: Vc<ValueContainer>, nesting: i32) -> Result<Vc<Value>> {
+    let state = input.await?;
+    let value = state.state.get();
+    if nesting < *value {
+        return Ok(func(input, nesting + 1));
+    }
+    if nesting == *value {
+        println!("func {}", nesting);
+        return Ok(Value { value: *value }.cell());
+    }
+    bail!("func no longer valid {}", nesting)
+}
Repository: denoland/deno
Pull request: fix(ext/crypto): respect offsets when writing into ab views in randomFillSync

Fixes #24799


Changed files:
filename: ext/node/polyfills/internal/crypto/_randomFill.mjs
patch: @@ -86,7 +86,9 @@ export function randomFillSync(buf, offset = 0, size) {
     return buf;
   }
 
-  const bytes = new Uint8Array(buf.buffer ? buf.buffer : buf, offset, size);
+  const bytes = isAnyArrayBuffer(buf)
+    ? new Uint8Array(buf, offset, size)
+    : new Uint8Array(buf.buffer, buf.byteOffset + offset, size);
   op_node_generate_secret(bytes);
 
   return buf;

filename: tests/unit_node/crypto/crypto_misc_test.ts
patch: @@ -1,6 +1,7 @@
 // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
 import { randomFillSync, randomUUID } from "node:crypto";
 import { assert, assertEquals } from "../../unit/test_util.ts";
+import { assertNotEquals } from "@std/assert";
 
 Deno.test("[node/crypto.getRandomUUID] works the same way as Web Crypto API", () => {
   assertEquals(randomUUID().length, crypto.randomUUID().length);
@@ -16,3 +17,14 @@ Deno.test("[node/crypto.randomFillSync] supported arguments", () => {
   assert(randomFillSync(buf.buffer));
   assert(randomFillSync(new DataView(buf.buffer)));
 });
+
+Deno.test("[node/crypto.randomFillSync] array buffer view", () => {
+  const buf = new Uint8Array(32);
+  const view = new Uint8Array(buf.buffer, 8, 16);
+
+  assert(randomFillSync(view));
+  assertEquals(view.length, 16);
+  assertNotEquals(view, new Uint8Array(16));
+  assertEquals(buf.subarray(0, 8), new Uint8Array(8));
+  assertEquals(buf.subarray(24, 32), new Uint8Array(8));
+});
Repository: ggml-org/llama.cpp
Pull request: rpc: avoid uninitialized memory in serialize_tensor

Zero out the name and padding buffers.


Changed files:
filename: ggml/src/ggml-rpc/ggml-rpc.cpp
patch: @@ -518,6 +518,11 @@ static rpc_tensor serialize_tensor(const ggml_tensor * tensor) {
     result.view_src = reinterpret_cast<uint64_t>(tensor->view_src);
     result.view_offs = tensor->view_offs;
     result.data = reinterpret_cast<uint64_t>(tensor->data);
+
+    // Avoid sending uninitialized data over the wire
+    memset(result.name, 0, sizeof(result.name));
+    memset(result.padding, 0, sizeof(result.padding));
+
     snprintf(result.name, GGML_MAX_NAME, "%s", tensor->name);
     return result;
 }
Repository: facebook/react
Pull request: Minor fix params description for addPercent function

Just fix function's comment

Changed files:
filename: dangerfile.js
patch: @@ -53,7 +53,8 @@ function generateMDTable(headers, body) {
 
 /**
  * Generates a user-readable string from a percentage change
- * @param {string[]} headers
+ * @param {number} change
+ * @param {boolean} includeEmoji
  */
 function addPercent(change, includeEmoji) {
   if (!isFinite(change)) {
Repository: nodejs/node
Pull request: doc: add create-release-action to process

After https://github.com/nodejs/node/pull/55690 it's time to suggest it's usage as a replacement of manual steps. 

Changed files:
filename: doc/contributing/releases.md
patch: @@ -282,7 +282,15 @@ You can integrate the PRs into the proposal without running full CI.
 
 ### 2. Create a new branch for the release
 
-⚠️ At this point, you can either run `git node release --prepare`:
+> \[!TIP] Once the staging branch is up-to-date you can use the
+> [`create-release-proposal`][] action to generate the proposal.
+
+```bash
+gh workflow run "Create Release Proposal" -f release-line=N -f release-date=YYYY-MM-DD
+```
+
+If you prefer to run it locally you can either run
+`git node release --prepare`:
 
 ```bash
 git node release -S --prepare x.y.z
@@ -1424,6 +1432,7 @@ Typical resolution: sign the release again.
 [Node.js Snap management repository]: https://github.com/nodejs/snap
 [Partner Communities]: https://github.com/nodejs/community-committee/blob/HEAD/governance/PARTNER_COMMUNITIES.md
 [Snap]: https://snapcraft.io/node
+[`create-release-proposal`]: https://github.com/nodejs/node/actions/workflows/create-release-proposal.yml
 [build-infra team]: https://github.com/orgs/nodejs/teams/build-infra
 [expected assets]: https://github.com/nodejs/build/tree/HEAD/ansible/www-standalone/tools/promote/expected_assets
 [nodejs.org release-post.js script]: https://github.com/nodejs/nodejs.org/blob/HEAD/scripts/release-post/index.mjs