helloadhavan/github_issues huggingface dataset:
Repository: facebook/react
Pull request: Fix misapplying prod error opt-out

The eslint-disable-next-line opt out for prod error minification was not properly working. In the build a replacable error was output even though it was not failing the build. This change refactors the code to avoid the erroneous behavior but a fix for the lint may be better.

Before this change there was an `new Error(message)` that got picked up as `FIXME (minify-errors-in-prod): Unminified error message in production build! <expected-error-format>"%s"</expected-error-format>`

Strangely, CI did not pick this up as a problem in check_error_codes...




Changed files:
filename: packages/react-reconciler/src/ReactFiberBeginWork.new.js
patch: @@ -2593,14 +2593,17 @@ function updateDehydratedSuspenseComponent(
         ({digest} = getSuspenseInstanceFallbackErrorDetails(suspenseInstance));
       }
 
-      const error = message
-        ? // eslint-disable-next-line react-internal/prod-error-codes
-          new Error(message)
-        : new Error(
-            'The server could not finish this Suspense boundary, likely ' +
-              'due to an error during server rendering. Switched to ' +
-              'client rendering.',
-          );
+      let error;
+      if (message) {
+        // eslint-disable-next-line react-internal/prod-error-codes
+        error = new Error(message);
+      } else {
+        error = new Error(
+          'The server could not finish this Suspense boundary, likely ' +
+            'due to an error during server rendering. Switched to ' +
+            'client rendering.',
+        );
+      }
       const capturedValue = createCapturedValue(error, digest, stack);
       return retrySuspenseComponentWithoutHydrating(
         current,

filename: packages/react-reconciler/src/ReactFiberBeginWork.old.js
patch: @@ -2593,14 +2593,17 @@ function updateDehydratedSuspenseComponent(
         ({digest} = getSuspenseInstanceFallbackErrorDetails(suspenseInstance));
       }
 
-      const error = message
-        ? // eslint-disable-next-line react-internal/prod-error-codes
-          new Error(message)
-        : new Error(
-            'The server could not finish this Suspense boundary, likely ' +
-              'due to an error during server rendering. Switched to ' +
-              'client rendering.',
-          );
+      let error;
+      if (message) {
+        // eslint-disable-next-line react-internal/prod-error-codes
+        error = new Error(message);
+      } else {
+        error = new Error(
+          'The server could not finish this Suspense boundary, likely ' +
+            'due to an error during server rendering. Switched to ' +
+            'client rendering.',
+        );
+      }
       const capturedValue = createCapturedValue(error, digest, stack);
       return retrySuspenseComponentWithoutHydrating(
         current,
Repository: electron/electron
Pull request: fix: -Wunsafe-buffer-usage warnings in GetNextZoomLevel() (31-x-y)

Manually backport #43803 to 31-x-y. See that PR for details.

The only thing different in this PR is the name of the blink functions being called. This is because they were renamed for consistency in https://chromium-review.googlesource.com/c/chromium/src/+/5621488. So 32-x-y and higher call `blink::ZoomFoo()`, but here the name of the function is `blink::PageZoomFoo()`.

Notes: none.

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -5,6 +5,8 @@
 
 #include "shell/browser/ui/inspectable_web_contents.h"
 
+#include <algorithm>
+#include <array>
 #include <memory>
 #include <string_view>
 #include <utility>
@@ -74,10 +76,6 @@ namespace electron {
 
 namespace {
 
-const double kPresetZoomFactors[] = {0.25, 0.333, 0.5,  0.666, 0.75, 0.9,
-                                     1.0,  1.1,   1.25, 1.5,   1.75, 2.0,
-                                     2.5,  3.0,   4.0,  5.0};
-
 const char kChromeUIDevToolsURL[] =
     "devtools://devtools/bundled/devtools_app.html?"
     "remoteBase=%s&"
@@ -126,16 +124,22 @@ void SetZoomLevelForWebContents(content::WebContents* web_contents,
   content::HostZoomMap::SetZoomLevel(web_contents, level);
 }
 
-double GetNextZoomLevel(double level, bool out) {
-  double factor = blink::PageZoomLevelToZoomFactor(level);
-  size_t size = std::size(kPresetZoomFactors);
-  for (size_t i = 0; i < size; ++i) {
-    if (!blink::PageZoomValuesEqual(kPresetZoomFactors[i], factor))
-      continue;
-    if (out && i > 0)
-      return blink::PageZoomFactorToZoomLevel(kPresetZoomFactors[i - 1]);
-    if (!out && i != size - 1)
-      return blink::PageZoomFactorToZoomLevel(kPresetZoomFactors[i + 1]);
+double GetNextZoomLevel(const double level, const bool out) {
+  static constexpr std::array<double, 16U> kPresetFactors{
+      0.25, 0.333, 0.5,  0.666, 0.75, 0.9, 1.0, 1.1,
+      1.25, 1.5,   1.75, 2.0,   2.5,  3.0, 4.0, 5.0};
+  static constexpr auto kBegin = kPresetFactors.begin();
+  static constexpr auto kEnd = kPresetFactors.end();
+
+  const double factor = blink::PageZoomLevelToZoomFactor(level);
+  auto matches = [=](auto val) {
+    return blink::PageZoomValuesEqual(factor, val);
+  };
+  if (auto iter = std::find_if(kBegin, kEnd, matches); iter != kEnd) {
+    if (out && iter != kBegin)
+      return blink::PageZoomFactorToZoomLevel(*--iter);
+    if (!out && ++iter != kEnd)
+      return blink::PageZoomFactorToZoomLevel(*iter);
   }
   return level;
 }
Repository: denoland/deno
Pull request: fix(ext/node): use primordials in `ext/node/polyfills/console.ts`

Contributing toward #24236

- Swapped `Object.assign` for `ObjectAssign` primordial.
- Removed referencing TODO comment.

Please disregard if no longer desired.

Changed files:
filename: ext/node/polyfills/console.ts
patch: @@ -1,15 +1,15 @@
 // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
 
-// TODO(petamoriken): enable prefer-primordials for node polyfills
-// deno-lint-ignore-file prefer-primordials
-
+import { primordials } from "ext:core/mod.js";
 import { Console } from "ext:deno_node/internal/console/constructor.mjs";
 import { windowOrWorkerGlobalScope } from "ext:runtime/98_global_scope_shared.js";
 // Don't rely on global `console` because during bootstrapping, it is pointing
 // to native `console` object provided by V8.
 const console = windowOrWorkerGlobalScope.console.value;
 
-Object.assign(console, { Console });
+const { ObjectAssign } = primordials;
+
+ObjectAssign(console, { Console });
 
 export default console;
Repository: vercel/next.js
Pull request: Remove some AST clones from `process_content_with_code_gens`

Eliminate some AST clones to save allocations

### How?

Destructively iterate the `code_gens` vec since we have ownership and down't need it anymore.

Closes: PACK-4563

Closes PACK-4574

Changed files:
filename: turbopack/crates/turbopack-ecmascript/src/lib.rs
patch: @@ -1151,18 +1151,18 @@ fn process_content_with_code_gens(
     program: &mut Program,
     globals: &Globals,
     top_level_mark: Option<Mark>,
-    code_gens: Vec<CodeGeneration>,
+    mut code_gens: Vec<CodeGeneration>,
 ) {
     let mut visitors = Vec::new();
     let mut root_visitors = Vec::new();
     let mut early_hoisted_stmts = FxIndexMap::default();
     let mut hoisted_stmts = FxIndexMap::default();
-    for code_gen in &code_gens {
-        for CodeGenerationHoistedStmt { key, stmt } in &code_gen.hoisted_stmts {
-            hoisted_stmts.entry(key.clone()).or_insert(stmt.clone());
+    for code_gen in &mut code_gens {
+        for CodeGenerationHoistedStmt { key, stmt } in code_gen.hoisted_stmts.drain(..) {
+            hoisted_stmts.entry(key).or_insert(stmt);
         }
-        for CodeGenerationHoistedStmt { key, stmt } in &code_gen.early_hoisted_stmts {
-            early_hoisted_stmts.insert(key.clone(), stmt.clone());
+        for CodeGenerationHoistedStmt { key, stmt } in code_gen.early_hoisted_stmts.drain(..) {
+            early_hoisted_stmts.insert(key.clone(), stmt);
         }
         for (path, visitor) in &code_gen.visitors {
             if path.is_empty() {
Repository: vercel/next.js
Pull request: Add `turbopack.root` to zod schema

Closes PACK-4571
Closes https://github.com/vercel/next.js/issues/79024

Changed files:
filename: packages/next/src/server/config-schema.ts
patch: @@ -148,6 +148,7 @@ const zTurbopackConfig: zod.ZodType<TurbopackOptions> = z.strictObject({
     .optional(),
   resolveExtensions: z.array(z.string()).optional(),
   moduleIds: z.enum(['named', 'deterministic']).optional(),
+  root: z.string().optional(),
 })
 
 // Same as zTurbopackConfig but with deprecated properties. Unfortunately, base
@@ -173,6 +174,7 @@ const zDeprecatedExperimentalTurboConfig: zod.ZodType<DeprecatedExperimentalTurb
     moduleIds: z.enum(['named', 'deterministic']).optional(),
     minify: z.boolean().optional(),
     sourceMaps: z.boolean().optional(),
+    root: z.string().optional(),
   })
 
 export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
Repository: facebook/react
Pull request: Remove extra Server Context argument

This was left over from a refactor that moved this options.


Changed files:
filename: packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js
patch: @@ -36,7 +36,6 @@ function renderToPipeableStream(
   model: ReactModel,
   webpackMap: BundlerConfig,
   options?: Options,
-  context?: Array<[string, ServerContextJSONValue]>,
 ): PipeableStream {
   const request = createRequest(
     model,
Repository: nodejs/node
Pull request: test: use --permission over --experimental-permission

Follow up #56201 

Changed files:
filename: test/parallel/test-permission-sqlite-load-extension.js
patch: @@ -8,7 +8,7 @@ const db = new sqlite.DatabaseSync(':memory:', { allowExtension: true });
 db.loadExtension('nonexistent');`.replace(/\n/g, ' ');
 
 childProcess.exec(
-  `${process.execPath} --experimental-permission -e "${code}"`,
+  `${process.execPath} --permission -e "${code}"`,
   {},
   common.mustCall((err, _, stderr) => {
     assert.strictEqual(err.code, 1);

filename: test/sqlite/test-sqlite-extensions.mjs
patch: @@ -93,7 +93,7 @@ test('should throw error if permission is enabled', async () => {
 const db = new sqlite.DatabaseSync(':memory:', { allowExtension: true });`;
   return new Promise((resolve) => {
     childProcess.exec(
-      `${cmd} --experimental-permission -e "${code}"`,
+      `${cmd} --permission -e "${code}"`,
       {
         ...opts,
       },
Repository: facebook/react
Pull request: [DevTools] Run Devtools Regression Tests Once a Day

We don't need to run DevTools regression tests once an hour, and also it makes getting the most recent react build or react devtools build really annoying, so run them once a day instead 

Changed files:
filename: .circleci/config.yml
patch: @@ -583,8 +583,8 @@ workflows:
     unless: << pipeline.parameters.prerelease_commit_sha >>
     triggers:
       - schedule:
-          # DevTools regression tests run hourly
-          cron: "0 * * * *"
+          # DevTools regression tests run once a day
+          cron: "0 0 * * *"
           filters:
             branches:
               only:
Repository: facebook/react
Pull request: Track revs that intentionally fork the reconciler

Just an idea I had to improve the reconciler fork infra a bit, as I consider using it again for an ongoing refactor. Opening for discussion purposes.

---

When we fork the the "old" and "new" reconciler implementations, it can be difficult to keep track of which commits introduced the delta in behavior. This makes bisecting difficult if one of the changes introduces a bug.

I've added a new file called `forked-revisions` that contains the list of commits that intentionally forked the reconcilers.

In CI, we'll confirm that the reconcilers are identical except for the changes in the listed revisions. This also ensures that the revisions can be cleanly reverted.

## Test Plan

- In this PR, I made a trivial fork to the reconciler. This caused CI to fail.
- In the next commit, I added the previous revision to the list of forked revisions. This fixed CI.
- Then I reverted both temporary commits.

This shows that introducing an intentional fork in behavior always requires at least two commits: one to make the change, another to add that commit's SHA to the list of revisions. You can squash the commits when merging to main, though: as long as the revision was pushed to GitHub, it doesn't matter whether it's part of the main history.

Changed files:
filename: .circleci/config.yml
patch: @@ -425,11 +425,24 @@ jobs:
       - checkout
       - run: yarn workspaces info | head -n -1 > workspace_info.txt
       - *restore_node_modules
+      - run:
+          name: Fetch revisions that contain an intentional fork
+          # This will fetch each revision listed in the `forked-revisions` file,
+          # which may be necessary if it's not part of main. For example, it
+          # may have been part of a PR branch that was squashed on merge.
+          command: |
+            cut -d " " -f 1 scripts/merge-fork/forked-revisions | xargs -r git fetch origin
+      - run:
+          name: Revert forked revisions
+          # This will revert the changes without committing. At the end, it's
+          # expected that both forks will be identical.
+          command: |
+            cut -d " " -f 1 scripts/merge-fork/forked-revisions | xargs -r git revert --no-commit
       - run:
           name: Confirm reconciler forks are the same
           command: |
             yarn replace-fork
-            git diff --quiet || (echo "Reconciler forks are not the same! Run yarn replace-fork. Or, if this was intentional, disable this CI check." && false)
+            git diff --quiet || (echo "Reconciler forks are not the same! Run yarn replace-fork. Or, if this was intentional, add the commit SHA to scripts/merge-fork/forked-revisions." && false)
 
 
 workflows:
Repository: facebook/react
Pull request: Fix CI: Download to build instead of base-build

Fixes a mistake in #24676. The get_base_build job downloads artifacts to `base-build` instead of `build`, so that sizebot can compare the two directories. For most other jobs, though, we want it to produce the same output as the normal build job.

Changed files:
filename: .circleci/config.yml
patch: @@ -122,7 +122,28 @@ jobs:
           paths:
             - build
 
-  get_base_build:
+  download_build:
+    docker: *docker
+    environment: *environment
+    parameters:
+      revision:
+        type: string
+    steps:
+      - checkout
+      - run: yarn workspaces info | head -n -1 > workspace_info.txt
+      - *restore_node_modules
+      - run:
+          name: Download artifacts for revision
+          command: |
+              git fetch origin main
+              cd ./scripts/release && yarn && cd ../../
+              scripts/release/download-experimental-build.js --commit=<< parameters.revision >> --allowBrokenCI
+      - persist_to_workspace:
+          root: .
+          paths:
+            - base-build
+
+  download_base_build_for_sizebot:
     docker: *docker
     environment: *environment
     steps:
@@ -493,7 +514,7 @@ workflows:
                 # - "-r=www-modern --env=production --variant=true"
 
                 # TODO: Test more persistent configurations?
-      - get_base_build:
+      - download_base_build_for_sizebot:
           filters:
             branches:
               ignore:
@@ -506,7 +527,7 @@ workflows:
               ignore:
                 - main
           requires:
-            - get_base_build
+            - download_base_build_for_sizebot
             - yarn_build_combined
       - yarn_lint_build:
           requires:
@@ -555,12 +576,13 @@ workflows:
                 - main
     jobs:
       - setup
-      - get_base_build:
+      - download_build:
           requires:
             - setup
+          revision: << pipeline.git.revision >>
       - build_devtools_and_process_artifacts:
           requires:
-            - get_base_build
+            - download_build
       - run_devtools_tests_for_versions:
           requires:
             - build_devtools_and_process_artifacts
Repository: facebook/react
Pull request: DevTools e2e workflow: Download build artifacts

When running the hourly DevTools testing workflow, we don't need to build React from scratch each time; we can download its build artifacts, like we do for sizebot and the release workflow.

Changed files:
filename: .circleci/config.yml
patch: @@ -555,12 +555,12 @@ workflows:
                 - main
     jobs:
       - setup
-      - yarn_build_combined:
+      - get_base_build:
           requires:
             - setup
       - build_devtools_and_process_artifacts:
           requires:
-            - yarn_build_combined
+            - get_base_build
       - run_devtools_tests_for_versions:
           requires:
             - build_devtools_and_process_artifacts
Repository: vercel/next.js
Pull request: Update middleware prefetch test

Fixing test case from https://github.com/vercel/next.js/pull/78984

Changed files:
filename: test/integration/middleware-prefetch/tests/index.test.js
patch: @@ -62,9 +62,7 @@ describe('Middleware Production Prefetch', () => {
           )
           // Check if the filename follows the format `static/chunks/pages/[pagename]-[hash].js`
           // and specifically targets files containing '/ssg-page-' in their path.
-          return attrs.find((src) => src.includes('/ssg-page-'))
-            ? 'yes'
-            : 'nope'
+          return attrs.find((src) => src.includes('/ssg-page')) ? 'yes' : 'nope'
         }, 'yes')
       })
 
@@ -76,7 +74,9 @@ describe('Middleware Production Prefetch', () => {
           const attrs = await Promise.all(
             scripts.map((script) => script.getAttribute('src'))
           )
-          return attrs.find((src) => src.includes('/ssg-page-2-'))
+          return attrs.find((src) =>
+            src.includes('/ssg-page-2' + (process.env.NEXT_RSPACK ? '-' : ''))
+          )
             ? 'nope'
             : 'yes'
         }, 'yes')
Repository: denoland/deno
Pull request: fix(ext/node): Add missing node:fs and node:constants exports

Just a bunch of random fs constants

Changed files:
filename: ext/node/polyfills/_fs/_fs_constants.ts
patch: @@ -12,6 +12,28 @@ export const {
   S_IXUSR,
   S_IRGRP,
   S_IWGRP,
+  S_IFBLK,
+  S_IFCHR,
+  S_IFDIR,
+  S_IFIFO,
+  S_IFLNK,
+  S_IFMT,
+  S_IFREG,
+  S_IFSOCK,
+  S_IRWXG,
+  S_IRWXO,
+  S_IRWXU,
+  UV_DIRENT_BLOCK,
+  UV_DIRENT_CHAR,
+  UV_DIRENT_DIR,
+  UV_DIRENT_FIFO,
+  UV_DIRENT_FILE,
+  UV_DIRENT_LINK,
+  UV_DIRENT_SOCKET,
+  UV_DIRENT_UNKNOWN,
+  UV_FS_O_FILEMAP,
+  UV_FS_SYMLINK_DIR,
+  UV_FS_SYMLINK_JUNCTION,
   S_IXGRP,
   S_IROTH,
   S_IWOTH,

filename: ext/node/polyfills/constants.ts
patch: @@ -51,6 +51,28 @@ export const {
   UV_FS_COPYFILE_EXCL,
   UV_FS_COPYFILE_FICLONE,
   UV_FS_COPYFILE_FICLONE_FORCE,
+  S_IFBLK,
+  S_IFCHR,
+  S_IFDIR,
+  S_IFIFO,
+  S_IFLNK,
+  S_IFMT,
+  S_IFREG,
+  S_IFSOCK,
+  S_IRWXG,
+  S_IRWXO,
+  S_IRWXU,
+  UV_DIRENT_BLOCK,
+  UV_DIRENT_CHAR,
+  UV_DIRENT_DIR,
+  UV_DIRENT_FIFO,
+  UV_DIRENT_FILE,
+  UV_DIRENT_LINK,
+  UV_DIRENT_SOCKET,
+  UV_DIRENT_UNKNOWN,
+  UV_FS_O_FILEMAP,
+  UV_FS_SYMLINK_DIR,
+  UV_FS_SYMLINK_JUNCTION,
 } = fsConstants;
 export const {
   RTLD_DEEPBIND,
Repository: facebook/react
Pull request: [DevTools] only polyfill requestAnimationFrame when necessary

## Summary

Improve the logic as suggested by @bvaughn https://github.com/facebook/react/pull/24633#discussion_r886103844

<!--
 Explain the **motivation** for making this change. What existing problem does the pull request solve?
-->

Tested with `yarn build:chrome:local && yarn test:chrome`

Changed files:
filename: packages/react-devtools-extensions/src/main.js
patch: @@ -33,18 +33,25 @@ const isEdge = getBrowserName() === 'Edge';
 // since Chromium v102, requestAnimationFrame no longer fires in devtools_page (i.e. this file)
 // mock requestAnimationFrame with setTimeout as a temporary workaround
 // https://github.com/facebook/react/issues/24626
-// The polyfill is based on https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
 if (isChrome || isEdge) {
-  const FRAME_TIME = 16;
-  let lastTime = 0;
-  window.requestAnimationFrame = function(callback, element) {
-    const now = window.performance.now();
-    const nextTime = Math.max(lastTime + FRAME_TIME, now);
-    return setTimeout(function() {
-      callback((lastTime = nextTime));
-    }, nextTime - now);
-  };
-  window.cancelAnimationFrame = clearTimeout;
+  const timeoutID = setTimeout(() => {
+    // if requestAnimationFrame is not working, polyfill it
+    // The polyfill is based on https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
+    const FRAME_TIME = 16;
+    let lastTime = 0;
+    window.requestAnimationFrame = function(callback, element) {
+      const now = window.performance.now();
+      const nextTime = Math.max(lastTime + FRAME_TIME, now);
+      return setTimeout(function() {
+        callback((lastTime = nextTime));
+      }, nextTime - now);
+    };
+    window.cancelAnimationFrame = clearTimeout;
+  }, 400);
+
+  requestAnimationFrame(() => {
+    clearTimeout(timeoutID);
+  });
 }
 
 let panelCreated = false;
Repository: electron/electron
Pull request: fix: -Wunsafe-buffer-usage warnings in GetNextZoomLevel()

Manually backport #43803 to 32-x-y. See that PR for details.

Almost no manual intervention was needed; just some trivial `#include` header shear

Notes: none.

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -5,6 +5,8 @@
 
 #include "shell/browser/ui/inspectable_web_contents.h"
 
+#include <algorithm>
+#include <array>
 #include <memory>
 #include <string_view>
 #include <utility>
@@ -75,10 +77,6 @@ namespace electron {
 
 namespace {
 
-const double kPresetZoomFactors[] = {0.25, 0.333, 0.5,  0.666, 0.75, 0.9,
-                                     1.0,  1.1,   1.25, 1.5,   1.75, 2.0,
-                                     2.5,  3.0,   4.0,  5.0};
-
 const char kChromeUIDevToolsURL[] =
     "devtools://devtools/bundled/devtools_app.html?"
     "remoteBase=%s&"
@@ -127,16 +125,20 @@ void SetZoomLevelForWebContents(content::WebContents* web_contents,
   content::HostZoomMap::SetZoomLevel(web_contents, level);
 }
 
-double GetNextZoomLevel(double level, bool out) {
-  double factor = blink::ZoomLevelToZoomFactor(level);
-  size_t size = std::size(kPresetZoomFactors);
-  for (size_t i = 0; i < size; ++i) {
-    if (!blink::ZoomValuesEqual(kPresetZoomFactors[i], factor))
-      continue;
-    if (out && i > 0)
-      return blink::ZoomFactorToZoomLevel(kPresetZoomFactors[i - 1]);
-    if (!out && i != size - 1)
-      return blink::ZoomFactorToZoomLevel(kPresetZoomFactors[i + 1]);
+double GetNextZoomLevel(const double level, const bool out) {
+  static constexpr std::array<double, 16U> kPresetFactors{
+      0.25, 0.333, 0.5,  0.666, 0.75, 0.9, 1.0, 1.1,
+      1.25, 1.5,   1.75, 2.0,   2.5,  3.0, 4.0, 5.0};
+  static constexpr auto kBegin = kPresetFactors.begin();
+  static constexpr auto kEnd = kPresetFactors.end();
+
+  const double factor = blink::ZoomLevelToZoomFactor(level);
+  auto matches = [=](auto val) { return blink::ZoomValuesEqual(factor, val); };
+  if (auto iter = std::find_if(kBegin, kEnd, matches); iter != kEnd) {
+    if (out && iter != kBegin)
+      return blink::ZoomFactorToZoomLevel(*--iter);
+    if (!out && ++iter != kEnd)
+      return blink::ZoomFactorToZoomLevel(*iter);
   }
   return level;
 }