helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(ext/node): use primordials in `ext/node/polyfills/_http_common.ts`

Towards #24236

Changed files:
filename: ext/node/polyfills/_http_common.ts
patch: @@ -1,31 +1,30 @@
 // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
 // Copyright Joyent and Node contributors. All rights reserved. MIT license.
 
-// TODO(petamoriken): enable prefer-primordials for node polyfills
-// deno-lint-ignore-file prefer-primordials
-
-const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
+import { primordials } from "ext:core/mod.js";
+const { RegExpPrototypeTest, SafeRegExp } = primordials;
+const tokenRegExp = new SafeRegExp(/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/);
 /**
  * Verifies that the given val is a valid HTTP token
  * per the rules defined in RFC 7230
  * See https://tools.ietf.org/html/rfc7230#section-3.2.6
  */
 function checkIsHttpToken(val: string) {
-  return tokenRegExp.test(val);
+  return RegExpPrototypeTest(tokenRegExp, val);
 }
 
-const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
+const headerCharRegex = new SafeRegExp(/[^\t\x20-\x7e\x80-\xff]/);
 /**
  * True if val contains an invalid field-vchar
  *  field-value    = *( field-content / obs-fold )
  *  field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
  *  field-vchar    = VCHAR / obs-text
  */
 function checkInvalidHeaderChar(val: string) {
-  return headerCharRegex.test(val);
+  return RegExpPrototypeTest(headerCharRegex, val);
 }
 
-export const chunkExpression = /(?:^|\W)chunked(?:$|\W)/i;
+export const chunkExpression = new SafeRegExp(/(?:^|\W)chunked(?:$|\W)/i);
 export {
   checkInvalidHeaderChar as _checkInvalidHeaderChar,
   checkIsHttpToken as _checkIsHttpToken,
Repository: vercel/next.js
Pull request: Turbopack: write `.next/turbopack` to mark Turbopack builds



Closes PACK-4300

Changed files:
filename: packages/next/src/build/turbopack-build/impl.ts
patch: @@ -88,6 +88,9 @@ export async function turbopackBuild(): Promise<{
     }
   )
 
+  // Write an empty file in a known location to signal this was built with Turbopack
+  await fs.writeFile(path.join(distDir, 'turbopack'), '')
+
   await fs.mkdir(path.join(distDir, 'server'), { recursive: true })
   await fs.mkdir(path.join(distDir, 'static', buildId), {
     recursive: true,
Repository: denoland/deno
Pull request: fix(ext/console): bump default max str lengthto 10_000

Fixes https://github.com/denoland/deno/issues/22160

Changed files:
filename: ext/console/01_console.js
patch: @@ -2329,7 +2329,7 @@ const denoInspectDefaultOptions = {
 
   // node only
   maxArrayLength: 100,
-  maxStringLength: 100, // deno: strAbbreviateSize: 100
+  maxStringLength: 10_000, // deno: strAbbreviateSize: 10_000
   customInspect: true,
 
   // deno only
@@ -2357,7 +2357,7 @@ function getDefaultInspectOptions() {
 
 const DEFAULT_INDENT = "  "; // Default indent string
 
-const STR_ABBREVIATE_SIZE = 100;
+const STR_ABBREVIATE_SIZE = 10_000;
 
 class CSI {
   static kClear = "\x1b[1;1H";

filename: tests/unit/console_test.ts
patch: @@ -174,11 +174,11 @@ Deno.test(function consoleTestStringifyQuotes() {
 });
 
 Deno.test(function consoleTestStringifyLongStrings() {
-  const veryLongString = "a".repeat(200);
+  const veryLongString = "a".repeat(10_100);
   // If we stringify an object containing the long string, it gets abbreviated.
   let actual = stringify({ veryLongString });
   assert(actual.includes("..."));
-  assert(actual.length < 200);
+  assert(actual.length < 10_100);
   // However if we stringify the string itself, we get it exactly.
   actual = stringify(veryLongString);
   assertEquals(actual, veryLongString);
Repository: facebook/react
Pull request: Update CodeSandbox to pull build artifacts from CI

Instead of building them from source.

The `download-experimental-build` script polls CI until the build has finished.

Changed files:
filename: .codesandbox/ci.json
patch: @@ -1,11 +1,11 @@
 {
   "packages": ["packages/react", "packages/react-dom", "packages/scheduler"],
-  "buildCommand": "build --type=NODE react/index,react-dom/index,react-dom/src/server,react-dom/test-utils,scheduler/index,react/jsx-runtime,react/jsx-dev-runtime",
+  "buildCommand": "download-build-in-codesandbox-ci",
   "node": "12",
   "publishDirectory": {
-    "react": "build/node_modules/react",
-    "react-dom": "build/node_modules/react-dom",
-    "scheduler": "build/node_modules/scheduler"
+    "react": "build/oss-experimental/react",
+    "react-dom": "build/oss-experimental/react-dom",
+    "scheduler": "build/oss-experimental/scheduler"
   },
   "sandboxes": ["new"],
   "silent": true

filename: package.json
patch: @@ -141,6 +141,9 @@
     "version-check": "node ./scripts/tasks/version-check.js",
     "merge-fork": "node ./scripts/merge-fork/merge-fork.js",
     "replace-fork": "node ./scripts/merge-fork/replace-fork.js",
-    "publish-prereleases": "node ./scripts/release/publish-using-ci-workflow.js"
+    "publish-prereleases": "node ./scripts/release/publish-using-ci-workflow.js",
+    "download-build": "node ./scripts/release/download-experimental-build.js",
+    "download-build-for-head": "node ./scripts/release/download-experimental-build.js --commit=$(git rev-parse HEAD)",
+    "download-build-in-codesandbox-ci": "cd scripts/release && yarn install && cd ../../ && yarn download-build-for-head"
   }
 }
Repository: nodejs/node
Pull request: test: fix invalid test

The test setup is incorrect:

```js
it('should error on import', async () => {
  try {
    await import(fixtures.fileURL('es-modules/noext-wasm'));
    mustNotCall();
  } catch (err) {
    ok(err instanceof SyntaxError);
  }
});
```

In the correct setup, `mustNotCall()` should be invoked as `mustNotCall()();`. However, the test fails in this case, indicating that the import is actually successful. This PR fixes the invalid test.

Changed files:
filename: test/es-module/test-esm-extensionless-esm-and-wasm.mjs
patch: @@ -1,8 +1,8 @@
 // Flags: --experimental-wasm-modules
-import { mustNotCall, spawnPromisified } from '../common/index.mjs';
+import { spawnPromisified } from '../common/index.mjs';
 import * as fixtures from '../common/fixtures.mjs';
 import { describe, it } from 'node:test';
-import { match, ok, strictEqual } from 'node:assert';
+import { match, strictEqual } from 'node:assert';
 
 describe('extensionless ES modules within a "type": "module" package scope', {
   concurrency: !process.env.TEST_PARALLEL,
@@ -91,13 +91,7 @@ describe('extensionless Wasm within no package scope', { concurrency: !process.e
     strictEqual(signal, null);
   });
 
-  // This succeeds with `--experimental-default-type=module`
-  it('should error on import', async () => {
-    try {
-      await import(fixtures.fileURL('es-modules/noext-wasm'));
-      mustNotCall();
-    } catch (err) {
-      ok(err instanceof SyntaxError);
-    }
+  it('should run on import', async () => {
+    await import(fixtures.fileURL('es-modules/noext-wasm'));
   });
 });
Repository: electron/electron
Pull request: build: add nacl back to buildtools gitignore

Backport of #43238

See that PR for details.


Notes: none

Changed files:
filename: patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch
patch: @@ -9,6 +9,16 @@ their generator to run ours immediately after.
 This can't be upstreamed though may be replaceable later with some upstream refactors
 around reclient config generation.
 
+diff --git a/buildtools/reclient_cfgs/.gitignore b/buildtools/reclient_cfgs/.gitignore
+index 17103061c4752e6fcac07413dbf574e0c6fd6d39..848be71fa6dc81a64b7274b31d461f9dcc4697fc 100644
+--- a/buildtools/reclient_cfgs/.gitignore
++++ b/buildtools/reclient_cfgs/.gitignore
+@@ -1,4 +1,5 @@
+ /chromium-browser-clang/
+ /python/
++/nacl/
+ /win-cross/
+ reproxy.cfg
 diff --git a/buildtools/reclient_cfgs/configure_reclient_cfgs.py b/buildtools/reclient_cfgs/configure_reclient_cfgs.py
 index 9d8ebedb3373441e02a2a7edb28535c587753446..705c62eb357036018df630fce6e4021b64595cea 100755
 --- a/buildtools/reclient_cfgs/configure_reclient_cfgs.py
@@ -28,3 +38,19 @@ index 9d8ebedb3373441e02a2a7edb28535c587753446..705c62eb357036018df630fce6e4021b
 +        sys.exit(r)
 +
 +    print('done')
+diff --git a/buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg b/buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg
+deleted file mode 100644
+index f4690257587ee8a83111abc39039c3d552da0979..0000000000000000000000000000000000000000
+--- a/buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg
++++ /dev/null
+@@ -1,10 +0,0 @@
+-# use the same platform container image as build/config/siso/main.star
+-platform=container-image=docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:912808c295e578ccde53b0685bcd0d56c15d7a03e819dcce70694bfe3fdab35e,label:action_default=1
+-server_address=unix:///tmp/reproxy.sock
+-labels=type=compile,compiler=nacl,lang=cpp
+-exec_strategy=racing
+-inputs=native_client/toolchain/linux_x86/saigo_newlib/lib
+-dial_timeout=10m
+-canonicalize_working_dir=true
+-exec_timeout=2m
+-reclient_timeout=4m
Repository: denoland/deno
Pull request: perf(ext/websocket): avoid global interceptor overhead

Improves echo server message throughput by ~40-50% (103k -> 146k msg/sec)


Before: https://share.firefox.dev/3Rzzez2
After: https://share.firefox.dev/3VzXAKn

![image](https://github.com/denoland/deno/assets/34997667/a4426c9f-2175-414a-930c-f837149d37e3)



Changed files:
filename: ext/websocket/01_websocket.js
patch: @@ -50,6 +50,7 @@ import * as webidl from "ext:deno_webidl/00_webidl.js";
 import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
 import { HTTP_TOKEN_CODE_POINT_RE } from "ext:deno_web/00_infra.js";
 import { DOMException } from "ext:deno_web/01_dom_exception.js";
+import { clearTimeout, setTimeout } from "ext:deno_web/02_timers.js";
 import {
   CloseEvent,
   defineEventHandler,
Repository: vercel/next.js
Pull request: Turbopack: add attribute name to trace server search

### What?

Allow to search for attribute name and name value pair

Closes PACK-4303

Changed files:
filename: turbopack/crates/turbopack-trace-server/src/span_ref.rs
patch: @@ -434,14 +434,14 @@ impl<'a> SpanRef<'a> {
                             .raw_entry_mut()
                             .from_key(name)
                             .and_modify(|_, v| v.push(span.index()))
-                            .or_insert_with(|| (name.to_string(), vec![span.index()]));
+                            .or_insert_with(|| (format!("name={name}"), vec![span.index()]));
                     }
-                    for (_, value) in span.span.args.iter() {
+                    for (name, value) in span.span.args.iter() {
                         index
                             .raw_entry_mut()
                             .from_key(value)
                             .and_modify(|_, v| v.push(span.index()))
-                            .or_insert_with(|| (value.to_string(), vec![span.index()]));
+                            .or_insert_with(|| (format!("{name}={value}"), vec![span.index()]));
                     }
                     if !span.is_complete() && !span.time_data().ignore_self_time {
                         let name = "incomplete_span";
Repository: facebook/react
Pull request: Scrape warning messages in CI

There's a downstream workflow that runs the `print-warnings` command. We can make it faster by scraping the warnings in CI and storing the result as a build artifact.

Changed files:
filename: .circleci/config.yml
patch: @@ -91,6 +91,22 @@ jobs:
       - *restore_node_modules
       - run: node ./scripts/tasks/flow-ci
 
+  scrape_warning_messages:
+    docker: *docker
+    environment: *environment
+
+    steps:
+      - checkout
+      - run: yarn workspaces info | head -n -1 > workspace_info.txt
+      - *restore_node_modules
+      - run:
+          command: |
+            mkdir -p ./build
+            node ./scripts/print-warnings/print-warnings.js > build/WARNINGS
+      - persist_to_workspace:
+          root: .
+          paths:
+            - build
 
   yarn_build_combined:
     docker: *docker
@@ -345,8 +361,12 @@ workflows:
       - yarn_build_combined:
           requires:
             - setup
+      - scrape_warning_messages:
+          requires:
+            - setup
       - process_artifacts_combined:
           requires:
+            - scrape_warning_messages
             - yarn_build_combined
       - yarn_test_build:
           requires:
Repository: electron/electron
Pull request: build: add nacl back to buildtools gitignore

#### Description of Change

Refs https://chromium-review.googlesource.com/c/chromium/src/+/5724912.

Upstream now supports static nacl configs, whereas https://github.com/EngFlow/reclient-configs doesn't, so we get git conflicts that can make it harder to sync. This fixes that.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none

Changed files:
filename: patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch
patch: @@ -9,6 +9,16 @@ their generator to run ours immediately after.
 This can't be upstreamed though may be replaceable later with some upstream refactors
 around reclient config generation.
 
+diff --git a/buildtools/reclient_cfgs/.gitignore b/buildtools/reclient_cfgs/.gitignore
+index 17103061c4752e6fcac07413dbf574e0c6fd6d39..848be71fa6dc81a64b7274b31d461f9dcc4697fc 100644
+--- a/buildtools/reclient_cfgs/.gitignore
++++ b/buildtools/reclient_cfgs/.gitignore
+@@ -1,4 +1,5 @@
+ /chromium-browser-clang/
+ /python/
++/nacl/
+ /win-cross/
+ reproxy.cfg
 diff --git a/buildtools/reclient_cfgs/configure_reclient_cfgs.py b/buildtools/reclient_cfgs/configure_reclient_cfgs.py
 index ba44640480e758d4ed8c9115497a2c09074918b4..837158cbbeb9120b7456aefc516eb3db6a38558c 100755
 --- a/buildtools/reclient_cfgs/configure_reclient_cfgs.py
@@ -28,3 +38,19 @@ index ba44640480e758d4ed8c9115497a2c09074918b4..837158cbbeb9120b7456aefc516eb3db
 +        sys.exit(r)
 +
 +    print('done')
+diff --git a/buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg b/buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg
+deleted file mode 100644
+index f4690257587ee8a83111abc39039c3d552da0979..0000000000000000000000000000000000000000
+--- a/buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg
++++ /dev/null
+@@ -1,10 +0,0 @@
+-# use the same platform container image as build/config/siso/main.star
+-platform=container-image=docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:912808c295e578ccde53b0685bcd0d56c15d7a03e819dcce70694bfe3fdab35e,label:action_default=1
+-server_address=unix:///tmp/reproxy.sock
+-labels=type=compile,compiler=nacl,lang=cpp
+-exec_strategy=racing
+-inputs=native_client/toolchain/linux_x86/saigo_newlib/lib
+-dial_timeout=10m
+-canonicalize_working_dir=true
+-exec_timeout=2m
+-reclient_timeout=4m
Repository: facebook/react
Pull request: Fix sizebot mistakenly detecting deleted files


Changed files:
filename: .circleci/config.yml
patch: @@ -120,6 +120,14 @@ jobs:
               cd ./scripts/release && yarn && cd ../../
               scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main)
               mv ./build ./base-build
+      - run:
+          # TODO: The `download-experimental-build` script copies the npm
+          # packages into the `node_modules` directory. This is a historical
+          # quirk of how the release script works. Let's pretend they
+          # don't exist.
+          name: Delete extraneous files
+          command: rm -rf ./base-build/node_modules
+
       - persist_to_workspace:
           root: .
           paths:
Repository: vercel/next.js
Pull request: compile-time error for useLinkStatus imports in server components

Adds `useLinkStatus` to the list of APIs that can't be imported in server components.

Changed files:
filename: crates/next-custom-transforms/src/transforms/react_server_components.rs
patch: @@ -626,6 +626,7 @@ impl ReactServerComponentValidator {
                         "ServerInsertedHTMLContext",
                     ],
                 ),
+                ("next/link", vec!["useLinkStatus"]),
             ]),
             deprecated_apis_mapping: FxHashMap::from_iter([("next/server", vec!["ImageResponse"])]),
 

filename: test/development/acceptance-app/server-components.test.ts
patch: @@ -532,4 +532,37 @@ describe('Error Overlay for server components', () => {
       )
     })
   })
+
+  describe('Next.js link client hooks called in Server Component', () => {
+    it.each([['useLinkStatus']])(
+      'should show error when %s is called',
+      async (hook: string) => {
+        await using sandbox = await createSandbox(
+          next,
+          new Map([
+            [
+              'app/page.js',
+              outdent`
+              import { ${hook} } from 'next/link'
+              export default function Page() {
+                return "Hello world"
+              }
+            `,
+            ],
+          ])
+        )
+        const { session } = sandbox
+        await session.assertHasRedbox()
+        // In webpack when the message too long it gets truncated with `  | ` with new lines.
+        // So we need to check for the first part of the message.
+        const normalizedSource = await session.getRedboxSource()
+        expect(normalizedSource).toContain(
+          `You're importing a component that needs \`${hook}\`. This React hook only works in a client component. To fix, mark the file (or its parent) with the \`"use client"\` directive.`
+        )
+        expect(normalizedSource).toContain(
+          `import { ${hook} } from 'next/link'`
+        )
+      }
+    )
+  })
 })
Repository: huggingface/transformers
Pull request: Stop DOSing the Hub in the CI

Several of our test suites use `setUp()` methods, but these are called **once per test**. This repeatedly loads the same files from the Hub when the test suite has lots of small tests, and this increases the risk of a single connection failure giving us a red CI, and also seems very likely to trigger DOS protection from the Hub. I'm experimenting with refactoring some tests so that Hub operations are only called once for the whole test class

Changed files:
filename: tests/models/fuyu/test_processor_fuyu.py
patch: @@ -1,6 +1,7 @@
 import io
 import tempfile
 import unittest
+from shutil import rmtree
 
 import requests
 
@@ -32,18 +33,21 @@
 class FuyuProcessingTest(ProcessorTesterMixin, unittest.TestCase):
     processor_class = FuyuProcessor
 
-    def setUp(self):
-        self.tmpdirname = tempfile.mkdtemp()
+    @classmethod
+    def setUpClass(cls):
+        cls.tmpdirname = tempfile.mkdtemp()
+        # Ensure tempdir is cleaned up even if there's a failure
+        cls.addClassCleanup(lambda tempdir=cls.tmpdirname: rmtree(tempdir))
 
         image_processor = FuyuImageProcessor()
         tokenizer = AutoTokenizer.from_pretrained("adept/fuyu-8b")
 
         processor = FuyuProcessor(image_processor=image_processor, tokenizer=tokenizer)
-        processor.save_pretrained(self.tmpdirname)
+        processor.save_pretrained(cls.tmpdirname)
 
-        self.text_prompt = "Generate a coco-style caption.\\n"
+        cls.text_prompt = "Generate a coco-style caption.\\n"
         bus_image_url = "https://huggingface.co/datasets/hf-internal-testing/fixtures-captioning/resolve/main/bus.png"
-        self.bus_image_pil = Image.open(io.BytesIO(requests.get(bus_image_url).content))
+        cls.bus_image_pil = Image.open(io.BytesIO(requests.get(bus_image_url).content))
 
     def get_processor(self):
         image_processor = FuyuImageProcessor()
Repository: facebook/react
Pull request: Increase polling threshold for publish-prereleases

The `publish-prereleases` command prints the URL of the publish workflow so that you can visit the page and follow along.

But it can take a few seconds before the workflow ID is available, after you create the pipeline. So the script polls the workflow endpoint until it's available.

The current polling limit is too low so I increased it.

I also updated the error message to provide more info.

Changed files:
filename: scripts/release/publish-using-ci-workflow.js
patch: @@ -22,8 +22,8 @@ function sleep(ms) {
 
 async function getPublishWorkflowID(pipelineID) {
   // Since we just created the pipeline in a POST request, the server may 404.
-  // Try up to three times before giving up.
-  for (let i = 0; i < 3; i++) {
+  // Try a few times before giving up.
+  for (let i = 0; i < 20; i++) {
     const pipelineWorkflowsResponse = await fetch(
       `https://circleci.com/api/v2/pipeline/${pipelineID}/workflow`
     );
@@ -37,7 +37,7 @@ async function getPublishWorkflowID(pipelineID) {
     // CircleCI server may be stale. Wait a sec and try again.
     await sleep(1000);
   }
-  throw new Error('Failed to create CircleCI workflow.');
+  return null;
 }
 
 async function pollUntilWorkflowFinishes(workflowID) {
@@ -108,6 +108,20 @@ async function main() {
     2 * 1000 // Estimated time: 2 seconds,
   );
 
+  if (workflowID === null) {
+    console.warn(
+      theme.yellow(
+        'Created a CI pipeline to publish the packages, but the script timed ' +
+          "out when requesting the associated workflow ID. It's still " +
+          'possible the workflow was created.\n\n' +
+          'Visit ' +
+          'https://app.circleci.com/pipelines/github/facebook/react?branch=main ' +
+          'for a list of the latest workflows.'
+      )
+    );
+    process.exit(1);
+  }
+
   await logPromise(
     pollUntilWorkflowFinishes(workflowID),
     theme`{header Publishing in CI workflow}: https://app.circleci.com/pipelines/workflows/${workflowID}`,
Repository: electron/electron
Pull request: fix: accidental handle copying in a range loop

#### Description of Change

Fix a wart from e929b2140d4a1b8bce621f8826639e38cb3f3c6d which used `auto` instead of `auto&` in a ranged loop, causing us to create & throw away `gin::Handle<MessagePort>`s as we loop. Not a major problem; but since we can avoid it, let's avoid it.

#### Checklist

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none.

Changed files:
filename: shell/browser/api/message_port.cc
patch: @@ -9,6 +9,7 @@
 #include <utility>
 
 #include "base/containers/contains.h"
+#include "base/containers/to_vector.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/task/single_thread_task_runner.h"
 #include "gin/arguments.h"
@@ -250,11 +251,7 @@ std::vector<blink::MessagePortChannel> MessagePort::DisentanglePorts(
   }
 
   // Passed-in ports passed validity checks, so we can disentangle them.
-  std::vector<blink::MessagePortChannel> channels;
-  channels.reserve(ports.size());
-  for (auto port : ports)
-    channels.push_back(port->Disentangle());
-  return channels;
+  return base::ToVector(ports, [](auto& port) { return port->Disentangle(); });
 }
 
 void MessagePort::Pin() {