helloadhavan/github_issues huggingface dataset:
Repository: nodejs/node
Pull request: doc: rename the startup performance initiative to startup snapshot

The initiative has been more focused on startup snapshot integration which is more of a feature on its own, so rename it to "startup snapshot".

Background: we are also considering adding a more generic performance initiative in https://github.com/nodejs/TSC/issues/1343.

<!--
Before submitting a pull request, please read
https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md.

Commit message formatting guidelines:
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.

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: doc/contributing/strategic-initiatives.md
patch: @@ -11,7 +11,7 @@ agenda to ensure they are active and have the support they need.
 | Core Promise APIs      | [Antoine du Hamel][aduh95]  | <https://github.com/nodejs/TSC/issues/1094>   |
 | QUIC / HTTP3           | [James M Snell][jasnell]    | <https://github.com/nodejs/quic>              |
 | Shadow Realm           | [Chengzhong Wu][legendecas] | <https://github.com/nodejs/node/issues/42528> |
-| Startup performance    | [Joyee Cheung][joyeecheung] | <https://github.com/nodejs/node/issues/35711> |
+| Startup Snapshot       | [Joyee Cheung][joyeecheung] | <https://github.com/nodejs/node/issues/35711> |
 | V8 Currency            | [Michaël Zasso][targos]     |                                               |
 | Next-10                | [Michael Dawson][mhdawson]  | <https://github.com/nodejs/next-10>           |
 | Single executable apps | [Darshan Sen][RaisinTen]    | <https://github.com/nodejs/node/issues/43432> |
Repository: facebook/react
Pull request: Allow publishing with `beta` tag


Changed files:
filename: scripts/release/publish-commands/parse-params.js
patch: @@ -44,6 +44,7 @@ module.exports = () => {
       case 'next':
       case 'experimental':
       case 'alpha':
+      case 'beta':
       case 'untagged':
         break;
       default:
Repository: huggingface/transformers
Pull request: Skip non-selected experts for mixtral and qwen2_moe

Fixes #32283

This PR avoids redundant computation for some MoE models (mixtral and qwen2_moe).
The current implementation loops all the experts and inevitably loads experts' weight, which brings extra IO costs.
@ArthurZucker 




Changed files:
filename: src/transformers/models/mixtral/modeling_mixtral.py
patch: @@ -135,11 +135,10 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
         # this will be used to easily index which expert is going to be sollicitated
         expert_mask = torch.nn.functional.one_hot(selected_experts, num_classes=self.num_experts).permute(2, 1, 0)
 
-        # Loop over all available experts in the model and perform the computation on each expert
-        for expert_idx in range(self.num_experts):
+        expert_hitted = (expert_mask.sum(dim=(-1, -2)) > 0).nonzero(as_tuple=True)[0].tolist()
+        for expert_idx in expert_hitted:
             expert_layer = self.experts[expert_idx]
             idx, top_x = torch.where(expert_mask[expert_idx])
-
             # Index the correct hidden states and compute the expert hidden state for
             # the current expert. We need to make sure to multiply the output hidden
             # states by `routing_weights` on the corresponding tokens (top-1 and top-2)

filename: src/transformers/models/mixtral/modular_mixtral.py
patch: @@ -209,11 +209,10 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
         # this will be used to easily index which expert is going to be sollicitated
         expert_mask = torch.nn.functional.one_hot(selected_experts, num_classes=self.num_experts).permute(2, 1, 0)
 
-        # Loop over all available experts in the model and perform the computation on each expert
-        for expert_idx in range(self.num_experts):
+        expert_hitted = (expert_mask.sum(dim=(-1, -2)) > 0).nonzero(as_tuple=True)[0].tolist()
+        for expert_idx in expert_hitted:
             expert_layer = self.experts[expert_idx]
             idx, top_x = torch.where(expert_mask[expert_idx])
-
             # Index the correct hidden states and compute the expert hidden state for
             # the current expert. We need to make sure to multiply the output hidden
             # states by `routing_weights` on the corresponding tokens (top-1 and top-2)

filename: src/transformers/models/qwen2_moe/modeling_qwen2_moe.py
patch: @@ -616,7 +616,8 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
         expert_mask = torch.nn.functional.one_hot(selected_experts, num_classes=self.num_experts).permute(2, 1, 0)
 
         # Loop over all available experts in the model and perform the computation on each expert
-        for expert_idx in range(self.num_experts):
+        expert_hitted = (expert_mask.sum(dim=(-1, -2)) > 0).nonzero(as_tuple=True)[0].tolist()
+        for expert_idx in expert_hitted:
             expert_layer = self.experts[expert_idx]
             idx, top_x = torch.where(expert_mask[expert_idx])
Repository: denoland/deno
Pull request: fix(ext/websocket): drop connection when close frame not ack

Fixes #24292 

Changed files:
filename: ext/websocket/01_websocket.js
patch: @@ -424,6 +424,18 @@ class WebSocket extends EventTarget {
     const rid = this[_rid];
     while (this[_readyState] !== CLOSED) {
       const kind = await op_ws_next_event(rid);
+      /* close the connection if read was cancelled, and we didn't get a close frame */
+      if (
+        (this[_readyState] == CLOSING) &&
+        kind <= 3 && this[_role] !== CLIENT
+      ) {
+        this[_readyState] = CLOSED;
+
+        const event = new CloseEvent("close");
+        this.dispatchEvent(event);
+        core.tryClose(rid);
+        break;
+      }
 
       switch (kind) {
         case 0: {

filename: ext/websocket/lib.rs
patch: @@ -699,10 +699,14 @@ pub async fn op_ws_close(
   #[smi] code: Option<u16>,
   #[string] reason: Option<String>,
 ) -> Result<(), AnyError> {
-  let resource = state
+  let Ok(resource) = state
     .borrow_mut()
     .resource_table
-    .get::<ServerWebSocket>(rid)?;
+    .get::<ServerWebSocket>(rid)
+  else {
+    return Ok(());
+  };
+
   let frame = reason
     .map(|reason| Frame::close(code.unwrap_or(1005), reason.as_bytes()))
     .unwrap_or_else(|| Frame::close_raw(vec![].into()));

filename: tests/unit/websocket_test.ts
patch: @@ -761,3 +761,47 @@ Deno.test("Close without frame", async () => {
   };
   await promise;
 });
+
+Deno.test("Close connection", async () => {
+  const ac = new AbortController();
+  const listeningDeferred = Promise.withResolvers<void>();
+
+  const server = Deno.serve({
+    handler: (req) => {
+      const { socket, response } = Deno.upgradeWebSocket(req);
+      socket.onmessage = function (e) {
+        socket.close(1008);
+        assertEquals(e.data, "Hello");
+      };
+      socket.onclose = () => {
+        ac.abort();
+      };
+      socket.onerror = () => fail();
+      return response;
+    },
+    signal: ac.signal,
+    onListen: () => listeningDeferred.resolve(),
+    hostname: "localhost",
+    port: servePort,
+  });
+
+  await listeningDeferred.promise;
+
+  const conn = await Deno.connect({ port: servePort, hostname: "localhost" });
+  await conn.write(
+    new TextEncoder().encode(
+      "GET / HTTP/1.1\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n",
+    ),
+  );
+
+  // Write a 2 text frame saying "Hello"
+  await conn.write(new Uint8Array([0x81, 0x05]));
+  await conn.write(new TextEncoder().encode("Hello"));
+
+  // We are a bad client so we won't acknowledge the close frame
+  await conn.write(new Uint8Array([0x81, 0x05]));
+  await conn.write(new TextEncoder().encode("Hello"));
+
+  await server.finished;
+  conn.close();
+});
Repository: nodejs/node
Pull request: test_runner: remove root tracking set

The `wasRootSetup` `Set` in the test harness appears to be redundant, since the `startTime` field can be used interchangeably. This commit removes `wasRootSetup`.

<!--
Before submitting a pull request, please read
https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md.

Commit message formatting guidelines:
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.

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: lib/internal/test_runner/harness.js
patch: @@ -3,7 +3,6 @@ const {
   ArrayPrototypeForEach,
   PromiseResolve,
   SafeMap,
-  SafeWeakSet,
 } = primordials;
 const {
   createHook,
@@ -25,7 +24,6 @@ const {
 const { bigint: hrtime } = process.hrtime;
 
 const testResources = new SafeMap();
-const wasRootSetup = new SafeWeakSet();
 
 function createTestTree(options = kEmptyObject) {
   return setup(new Test({ __proto__: null, ...options, name: '<root>' }));
@@ -108,7 +106,7 @@ function collectCoverage(rootTest, coverage) {
 }
 
 function setup(root) {
-  if (wasRootSetup.has(root)) {
+  if (root.startTime !== null) {
     return root;
   }
 
@@ -172,8 +170,6 @@ function setup(root) {
     coverage: null,
   };
   root.startTime = hrtime();
-
-  wasRootSetup.add(root);
   return root;
 }
Repository: electron/electron
Pull request: fix: Use XDG_ACTIVATION_TOKEN in wayland when launched by other app

Backport of #43481

See that PR for details.


Notes: Fixed electron app in ozone/wayland not being focused when launched from another app


Changed files:
filename: shell/app/electron_main_delegate.cc
patch: @@ -408,6 +408,11 @@ std::optional<int> ElectronMainDelegate::PreBrowserMain() {
   content::InitializeMojoCore();
 #if BUILDFLAG(IS_MAC)
   RegisterAtomCrApp();
+#endif
+#if BUILDFLAG(IS_LINUX)
+  // Set the global activation token sent as an environment variable.
+  auto env = base::Environment::Create();
+  base::nix::ExtractXdgActivationTokenFromEnv(*env);
 #endif
   return std::nullopt;
 }

filename: shell/browser/api/electron_api_app.cc
patch: @@ -92,6 +92,11 @@
 #include "shell/browser/ui/cocoa/electron_bundle_mover.h"
 #endif
 
+#if BUILDFLAG(IS_LINUX)
+#include "base/nix/scoped_xdg_activation_token_injector.h"
+#include "base/nix/xdg_util.h"
+#endif
+
 using electron::Browser;
 
 namespace gin {
@@ -411,6 +416,12 @@ bool NotificationCallbackWrapper(
     base::CommandLine cmd,
     const base::FilePath& cwd,
     const std::vector<uint8_t> additional_data) {
+#if BUILDFLAG(IS_LINUX)
+  // Set the global activation token sent as a command line switch by another
+  // electron app instance. This also removes the switch after use to prevent
+  // any side effects of leaving it in the command line after this point.
+  base::nix::ExtractXdgActivationTokenFromCmdLine(cmd);
+#endif
   // Make sure the callback is called after app gets ready.
   if (Browser::Get()->is_ready()) {
     callback.Run(std::move(cmd), cwd, std::move(additional_data));
@@ -1021,6 +1032,15 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) {
       base::BindRepeating(NotificationCallbackWrapper, cb));
 #endif
 
+#if BUILDFLAG(IS_LINUX)
+  // Read the xdg-activation token and set it in the command line for the
+  // duration of the notification in order to ensure this is propagated to an
+  // already running electron app instance if it exists.
+  // The activation token received from the launching app is used later when
+  // activating the existing electron app instance window.
+  base::nix::ScopedXdgActivationTokenInjector activation_token_injector(
+      *base::CommandLine::ForCurrentProcess(), *base::Environment::Create());
+#endif
   switch (process_singleton_->NotifyOtherProcessOrCreate()) {
     case ProcessSingleton::NotifyResult::PROCESS_NONE:
       if (content::BrowserThread::IsThreadInitialized(
Repository: denoland/deno
Pull request: fix(npm): use start directory deno.json as "root deno.json config" in npm workspace

Tests are in https://github.com/denoland/deno_config/pull/81

Closes https://github.com/denoland/deno/issues/24531

Changed files:
filename: Cargo.lock
patch: @@ -1308,9 +1308,9 @@ dependencies = [
 
 [[package]]
 name = "deno_config"
-version = "0.21.1"
+version = "0.21.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2df23da1c85522dd6cb23372d7953ecf576ec416c5d517b046aeeca281ca5a4"
+checksum = "13ad624cb26f547980ca481b1805c4b29d81c7631e791fe1b63f3cc697722722"
 dependencies = [
  "anyhow",
  "deno_semver",

filename: Cargo.toml
patch: @@ -101,7 +101,7 @@ console_static_text = "=0.8.1"
 data-encoding = "2.3.3"
 data-url = "=0.3.0"
 deno_cache_dir = "=0.10.0"
-deno_config = { version = "=0.21.1", default-features = false }
+deno_config = { version = "=0.21.3", default-features = false }
 dlopen2 = "0.6.1"
 ecb = "=0.1.2"
 elliptic-curve = { version = "0.13.4", features = ["alloc", "arithmetic", "ecdh", "std", "pem"] }
Repository: facebook/react
Pull request: Bump 18 from alpha to beta


Changed files:
filename: .circleci/config.yml
patch: @@ -464,7 +464,7 @@ workflows:
             - setup
           commit_sha: << pipeline.parameters.prerelease_commit_sha >>
           release_channel: stable
-          dist_tag: "next,alpha"
+          dist_tag: "next,beta"
       - publish_prerelease:
           name: Publish to Experimental channel
           requires:
@@ -496,7 +496,7 @@ workflows:
             - setup
           commit_sha: << pipeline.git.revision >>
           release_channel: stable
-          dist_tag: "next,alpha"
+          dist_tag: "next,beta"
       - publish_prerelease:
           name: Publish to Experimental channel
           requires:

filename: ReactVersions.js
patch: @@ -22,7 +22,7 @@ const ReactVersion = '18.0.0';
 
 // The label used by the @next channel. Represents the upcoming release's
 // stability. Could be "alpha", "beta", "rc", etc.
-const nextChannelLabel = 'alpha';
+const nextChannelLabel = 'beta';
 
 const stablePackages = {
   'create-subscription': ReactVersion,
Repository: facebook/react
Pull request: Fixed typos

<!--
  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
Fixes typos
<!--
 Explain the **motivation** for making this change. What existing problem does the pull request solve?
-->

## How did you test this change?
It is a small change, so very likely no tests are required.
<!--
  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: scripts/jest/matchers/toThrow.js
patch: @@ -4,7 +4,7 @@
 // Older versions use e.g. "Cannot read property 'world' of undefined"
 // Newer versions use e.g. "Cannot read properties of undefined (reading 'world')"
 // This file overrides the built-in toThrow() matches to handle both cases,
-// enabling the React project to support Node 12-16 witout forking tests.
+// enabling the React project to support Node 12-16 without forking tests.
 
 const toThrowMatchers = require('expect/build/toThrowMatchers').default;
 const builtInToThrow = toThrowMatchers.toThrow;

filename: scripts/release/README.md
patch: @@ -34,7 +34,7 @@ The high level process of creating releases is [documented below](#process). Ind
 
 ## Trigger an Automated Prerelease
 
-If your code lands in the main branch, it will be automaticaly published to the prerelease channels within the next weekday. However, if you want to immediately publish a prerelease, you can trigger the job to run immediately:
+If your code lands in the main branch, it will be automatically published to the prerelease channels within the next weekday. However, if you want to immediately publish a prerelease, you can trigger the job to run immediately:
 
 ```sh
 yarn publish-prereleases
Repository: nodejs/node
Pull request: src: remove TLSEXT_TYPE_alpn guard

`TLSEXT_TYPE_application_layer_protocol_negotiation` is always defined in all supported OpenSSL versions. We also use this macro elsewhere without guards, so if it did not exist, compilation would have already failed.

Besides that, it makes little sense to provide a TLS 1.3 implementation that does not support ALPN.

<!--
Before submitting a pull request, please read
https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md.

Commit message formatting guidelines:
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.

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: src/node_constants.cc
patch: @@ -1032,10 +1032,8 @@ void DefineCryptoConstants(Local<Object> target) {
     NODE_DEFINE_CONSTANT(target, DH_NOT_SUITABLE_GENERATOR);
 #endif
 
-#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
 #define ALPN_ENABLED 1
     NODE_DEFINE_CONSTANT(target, ALPN_ENABLED);
-#endif
 
 #ifdef RSA_PKCS1_PADDING
     NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PADDING);