helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(ext/crypto): handle wrong algorithm in subtle.importKey without panicking

## Summary
- Fixes #30243. Passing a valid PKCS#8 DER key with the wrong algorithm (e.g., an RSA key imported as ECDSA) to `crypto.subtle.importKey` caused a panic due to an `.unwrap()` on a `try_into()` conversion in `import_key_ec`.
- Replaced the `.unwrap()` with `.map_err(|_| ImportKeyError::MalformedParameters)?` so it returns a proper error instead of panicking.
- Added a regression test that generates an RSA PKCS#8 key and attempts to import it as ECDSA, asserting that it rejects.

## Test plan
- [x] Added unit test in `tests/unit_node/crypto/crypto_key_test.ts`
- [ ] `cargo test -p deno_crypto` passes
- [ ] New test passes with `./target/debug/deno test tests/unit_node/crypto/crypto_key_test.ts`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Changed files:
filename: ext/crypto/import_key.rs
patch: @@ -686,7 +686,7 @@ fn import_key_ec(
         .parameters
         .ok_or(ImportKeyError::MalformedParameters)?
         .try_into()
-        .unwrap();
+        .map_err(|_| ImportKeyError::MalformedParameters)?;
 
       let pk_named_curve = match named_curve_alg {
         // id-secp256r1

filename: tests/unit_node/crypto/crypto_key_test.ts
patch: @@ -19,7 +19,7 @@ import {
 } from "node:crypto";
 import { promisify } from "node:util";
 import { Buffer } from "node:buffer";
-import { assert, assertEquals, assertThrows } from "@std/assert";
+import { assert, assertEquals, assertRejects, assertThrows } from "@std/assert";
 
 const RUN_SLOW_TESTS = Deno.env.get("SLOW_TESTS") === "1";
 
@@ -1118,3 +1118,30 @@ Deno.test("generateKeyPair async ec secp256k1", async () => {
   const signature = sign("sha256", data, privateKey);
   assert(verify("sha256", data, publicKey, signature));
 });
+
+// Regression test for https://github.com/denoland/deno/issues/30243
+// Importing a PKCS#8 RSA key with the wrong algorithm (ECDSA) should throw, not panic.
+Deno.test("crypto.subtle.importKey PKCS#8 with wrong algorithm does not panic", async () => {
+  const rsaKey = await crypto.subtle.generateKey(
+    {
+      name: "RSASSA-PKCS1-v1_5",
+      modulusLength: 2048,
+      publicExponent: new Uint8Array([1, 0, 1]),
+      hash: "SHA-256",
+    },
+    true,
+    ["sign", "verify"],
+  );
+
+  const pkcs8 = await crypto.subtle.exportKey("pkcs8", rsaKey.privateKey);
+
+  await assertRejects(() =>
+    crypto.subtle.importKey(
+      "pkcs8",
+      pkcs8,
+      { name: "ECDSA", namedCurve: "P-256" },
+      true,
+      ["sign"],
+    )
+  );
+});
Repository: ollama/ollama
Pull request: darwin: no partial offloading if required memory greater than system


Changed files:
filename: gpu/gpu_darwin.go
patch: @@ -32,6 +32,7 @@ func CheckVRAM() (uint64, error) {
 		// gpu not supported, this may not be metal
 		return 0, nil
 	}
+
 	return uint64(C.getRecommendedMaxVRAM()), nil
 }
 
@@ -52,7 +53,7 @@ func GetGPUInfo() GpuInfo {
 
 func getCPUMem() (memInfo, error) {
 	return memInfo{
-		TotalMemory: 0,
+		TotalMemory: uint64(C.getPhysicalMemory()),
 		FreeMemory:  0,
 		DeviceCount: 0,
 	}, nil

filename: gpu/gpu_info_darwin.h
patch: @@ -1,3 +1,4 @@
 #import <Metal/Metal.h>
 #include <stdint.h>
 uint64_t getRecommendedMaxVRAM();
+uint64_t getPhysicalMemory();

filename: gpu/gpu_info_darwin.m
patch: @@ -1,11 +1,13 @@
-//go:build darwin
+// go:build darwin
 #include "gpu_info_darwin.h"
 
-uint64_t getRecommendedMaxVRAM()
-{
-	id<MTLDevice> device = MTLCreateSystemDefaultDevice();
-	uint64_t result = device.recommendedMaxWorkingSetSize;
-	CFRelease(device);
-	return result;
+uint64_t getRecommendedMaxVRAM() {
+  id<MTLDevice> device = MTLCreateSystemDefaultDevice();
+  uint64_t result = device.recommendedMaxWorkingSetSize;
+  CFRelease(device);
+  return result;
 }
 
+uint64_t getPhysicalMemory() {
+  return [[NSProcessInfo processInfo] physicalMemory];
+}

filename: llm/server.go
patch: @@ -108,7 +108,11 @@ func NewLlamaServer(model string, adapters, projectors []string, opts api.Option
 
 	memoryLayerOutput := layers["output"].size()
 	memoryRequiredTotal += memoryLayerOutput
-	if memoryAvailable > memoryRequiredTotal {
+
+	if info.Library == "metal" && memoryRequiredTotal > info.TotalMemory {
+		// disable partial offloading when model is greater than total system memory
+		opts.NumGPU = 0
+	} else if memoryAvailable > memoryRequiredTotal {
 		layerCount = int(ggml.KV().BlockCount()) + 1
 		memoryRequiredPartial = memoryRequiredTotal
 	}
Repository: nodejs/node
Pull request: doc: fix missing link to the Error documentation in the `http` page

<!--
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.
-->

This is a small change fixes a link where previously it was broken in the `response.writeHead()` documentation:
<img width="248" height="79" alt="image" src="https://github.com/user-attachments/assets/88e4c69b-b801-4295-9674-e4458b3b30ed" />


Changed files:
filename: doc/api/http.md
patch: @@ -2641,7 +2641,7 @@ will check whether `Content-Length` and the length of the body which has
 been transmitted are equal or not.
 
 Attempting to set a header field name or value that contains invalid characters
-will result in a \[`Error`]\[] being thrown.
+will result in a [`TypeError`][] being thrown.
 
 ### `response.writeProcessing()`
Repository: ollama/ollama
Pull request: update llama.cpp submodule to `7593639`

Enables DBRX support on Metal

Changed files:
filename: llm/llama.cpp
patch: @@ -1 +1 @@
-Subproject commit 4bd0f93e4ab4fe6682e7d0241c1bdec1397e954a
+Subproject commit 7593639ce335e8d7f89aa9a54d616951f273af60
Repository: facebook/react
Pull request: Fix rust lints

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* #30615
* #30614
* #30613
* __->__ #30616



Changed files:
filename: compiler/crates/react_hir/src/merge_consecutive_blocks.rs
patch: @@ -151,6 +151,7 @@ impl MergedBlocks {
 
 #[derive(Debug, Error)]
 #[error("Expected predecessor {predecessor} to exist")]
+#[allow(dead_code)]
 pub struct ExpectedPredecessorToExist {
     predecessor: BlockId,
 }

filename: compiler/crates/react_semantic_analysis/src/scope_view.rs
patch: @@ -159,6 +159,7 @@ impl<'m> std::fmt::Debug for ScopeView<'m> {
 }
 
 #[derive(Clone, Copy)]
+#[allow(dead_code)]
 pub struct LabelView<'m> {
     #[allow(dead_code)]
     pub(crate) manager: &'m ScopeManager,
Repository: ollama/ollama
Pull request: fix padding in decode

TODO: update padding() to _only_ returning the padding

Changed files:
filename: llm/gguf.go
patch: @@ -248,7 +248,7 @@ func (llm *gguf) Decode(rs io.ReadSeeker) error {
 	}
 
 	padding := llm.padding(offset, int64(alignment))
-	if _, err := rs.Seek(padding, io.SeekCurrent); err != nil {
+	if _, err := rs.Seek(padding-offset, io.SeekCurrent); err != nil {
 		return err
 	}
Repository: ggml-org/llama.cpp
Pull request: arg: fix server router mode not accepting negated arg

Missed a spot at the `common_params_to_map` used by router mode of server

Note: I'm also changing the overload `common_params_parse` to `common_params_to_map` to make it less confusing

Tested and working with `llama-server --no-mmap`

Changed files:
filename: common/arg.cpp
patch: @@ -724,7 +724,7 @@ static void add_rpc_devices(const std::string & servers) {
     }
 }
 
-bool common_params_parse(int argc, char ** argv, llama_example ex, std::map<common_arg, std::string> & out_map) {
+bool common_params_to_map(int argc, char ** argv, llama_example ex, std::map<common_arg, std::string> & out_map) {
     common_params dummy_params;
     common_params_context ctx_arg = common_params_parser_init(dummy_params, ex, nullptr);
 
@@ -733,6 +733,9 @@ bool common_params_parse(int argc, char ** argv, llama_example ex, std::map<comm
         for (const auto & arg : opt.args) {
             arg_to_options[arg] = &opt;
         }
+        for (const auto & arg : opt.args_neg) {
+            arg_to_options[arg] = &opt;
+        }
     }
 
     // TODO @ngxson : find a way to deduplicate this code

filename: common/arg.h
patch: @@ -115,7 +115,7 @@ bool common_params_parse(int argc, char ** argv, common_params & params, llama_e
 
 // parse input arguments from CLI into a map
 // TODO: support repeated args in the future
-bool common_params_parse(int argc, char ** argv, llama_example ex, std::map<common_arg, std::string> & out_map);
+bool common_params_to_map(int argc, char ** argv, llama_example ex, std::map<common_arg, std::string> & out_map);
 
 // initialize argument parser context - used by test-arg-parser and preset
 common_params_context common_params_parser_init(common_params & params, llama_example ex, void(*print_usage)(int, char **) = nullptr);

filename: tests/test-arg-parser.cpp
patch: @@ -72,6 +72,10 @@ int main(void) {
     argv = {"binary_name", "--draft", "123"};
     assert(false == common_params_parse(argv.size(), list_str_to_char(argv).data(), params, LLAMA_EXAMPLE_EMBEDDING));
 
+    // negated arg
+    argv = {"binary_name", "--no-mmap"};
+    assert(false == common_params_parse(argv.size(), list_str_to_char(argv).data(), params, LLAMA_EXAMPLE_COMMON));
+
 
     printf("test-arg-parser: test valid usage\n\n");
 

filename: tools/server/server-models.cpp
patch: @@ -171,7 +171,7 @@ server_presets::server_presets(int argc, char ** argv, common_params & base_para
     }
 
     // read base args from router's argv
-    common_params_parse(argc, argv, LLAMA_EXAMPLE_SERVER, base_args);
+    common_params_to_map(argc, argv, LLAMA_EXAMPLE_SERVER, base_args);
 
     // remove any router-controlled args from base_args
     for (const auto & cargs : control_args) {
Repository: electron/electron
Pull request: fix: ensure `/dev/null` fd is closed on failure

#### Description of Change

Closes https://github.com/electron/electron/issues/47515.

Previously we were opening a handle to `/dev/null` and never remapping it, so it would be leaked as we never explicitly closed it. This fixes that.

Upstream in this case just called [`_exit`](https://source.chromium.org/chromium/chromium/src/+/main:base/process/launch_posix.cc;l=612;bpv=0;bpt=1) which terminates the process and closes open file descriptors belonging to the process, which s why they didn't have this issue.

#### 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: Fixed an issue where utility processes could leak file handles.

Changed files:
filename: shell/browser/api/electron_api_utility_process.cc
patch: @@ -78,6 +78,9 @@ UtilityProcessWrapper::UtilityProcessWrapper(
   base::FileHandleMappingVector fds_to_remap;
 #endif
   for (const auto& [io_handle, io_type] : stdio) {
+    if (io_handle == IOHandle::STDIN)
+      continue;
+
     if (io_type == IOType::IO_PIPE) {
 #if BUILDFLAG(IS_WIN)
       HANDLE read = nullptr;
Repository: vercel/next.js
Pull request: [ci]: de-flake client cache test

Waits for prefetches to complete before navigating. [x-ref](https://github.com/vercel/next.js/actions/runs/18237285313/attempts/3)

Changed files:
filename: test/e2e/app-dir/app-client-cache/client-cache.experimental.test.ts
patch: @@ -75,6 +75,9 @@ describe('app dir client cache semantics (experimental staleTimes)', () => {
       it('should re-use the cache for 5 minutes (default "static" time)', async () => {
         const browser = await next.browser('/', browserConfigWithFixedTime)
 
+        // Wait for the prefetch to complete before clicking
+        await browser.waitForIdleNetwork()
+
         let initialRandomNumber = await browser
           .elementByCss('[href="/0?timeout=0"]')
           .click()
@@ -265,6 +268,9 @@ describe('app dir client cache semantics (experimental staleTimes)', () => {
       it('should use the custom static override time (3 minutes)', async () => {
         const browser = await next.browser('/', browserConfigWithFixedTime)
 
+        // Wait for the prefetch to complete before clicking
+        await browser.waitForIdleNetwork()
+
         let initialRandomNumber = await browser
           .elementByCss('[href="/0?timeout=0"]')
           .click()
Repository: ollama/ollama
Pull request: This proved to be more painful than useful.

This reverts commit 7d05a6ee8f44b314fa697a427439e5fa4d78c3d7.  

This proved to be more painful than useful.                                 

See: https://github.com/ollama/ollama/issues/3624                  


Changed files:
filename: cmd/cmd.go
patch: @@ -252,14 +252,6 @@ func createBlob(cmd *cobra.Command, client *api.Client, path string) (string, er
 }
 
 func RunHandler(cmd *cobra.Command, args []string) error {
-	if os.Getenv("OLLAMA_MODELS") != "" {
-		return errors.New("OLLAMA_MODELS must only be set for 'ollama serve'")
-	}
-
-	if err := checkServerHeartbeat(cmd, args); err != nil {
-		return err
-	}
-
 	client, err := api.ClientFromEnvironment()
 	if err != nil {
 		return err
@@ -986,10 +978,11 @@ func NewCLI() *cobra.Command {
 	showCmd.Flags().Bool("system", false, "Show system message of a model")
 
 	runCmd := &cobra.Command{
-		Use:   "run MODEL [PROMPT]",
-		Short: "Run a model",
-		Args:  cobra.MinimumNArgs(1),
-		RunE:  RunHandler,
+		Use:     "run MODEL [PROMPT]",
+		Short:   "Run a model",
+		Args:    cobra.MinimumNArgs(1),
+		PreRunE: checkServerHeartbeat,
+		RunE:    RunHandler,
 	}
 
 	runCmd.Flags().Bool("verbose", false, "Show timings for response")
Repository: nodejs/node
Pull request: test_runner: set mocktimer's interval undefined when clearInterval called

this PR prevents adding timer to execution queue if clearInterval() called.
fixes https://github.com/nodejs/node/issues/59483

<!--
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: lib/internal/test_runner/mock/mock_timers.js
patch: @@ -321,6 +321,7 @@ class MockTimers {
     if (timer?.priorityQueuePosition !== undefined) {
       this.#executionQueue.removeAt(timer.priorityQueuePosition);
       timer.priorityQueuePosition = undefined;
+      timer.interval = undefined;
     }
   }
 

filename: test/parallel/test-runner-mock-timers.js
patch: @@ -201,6 +201,27 @@ describe('Mock Timers Test Suite', () => {
         // Should not throw
       });
     });
+
+    it('interval cleared inside callback should only fire once', (t) => {
+      t.mock.timers.enable();
+      const calls = [];
+
+      setInterval(() => {
+        calls.push('foo');
+      }, 10);
+      const timerId = setInterval(() => {
+        calls.push('bar');
+        clearInterval(timerId);
+      }, 10);
+
+      t.mock.timers.tick(10);
+      t.mock.timers.tick(10);
+
+      assert.deepStrictEqual(
+        calls,
+        ['foo', 'bar', 'foo'],
+      );
+    });
   });
 
   describe('globals/timers', () => {
Repository: ollama/ollama
Pull request: Added Solar example at README.md

Added just one line

| Solar              | 10.7B      | 6.1GB | `ollama run solar`             |

Changed files:
filename: README.md
patch: @@ -64,6 +64,7 @@ Here are some example models that can be downloaded:
 | LLaVA              | 7B         | 4.5GB | `ollama run llava`             |
 | Gemma              | 2B         | 1.4GB | `ollama run gemma:2b`          |
 | Gemma              | 7B         | 4.8GB | `ollama run gemma:7b`          |
+| Solar              | 10.7B      | 6.1GB | `ollama run solar`             |
 
 > Note: You should have at least 8 GB of RAM available to run the 7B models, 16 GB to run the 13B models, and 32 GB to run the 33B models.
Repository: facebook/react
Pull request: Replace NodeJS 21 with 22 in devEngines field


21 is EOL and 22 is stable now.

Homebrew installs 22 by default as well which is the practical reason for me to update this.


Changed files:
filename: fixtures/flight/package.json
patch: @@ -4,7 +4,7 @@
   "version": "0.1.0",
   "private": true,
   "devEngines": {
-    "node": "20.x || 21.x"
+    "node": "20.x || 22.x"
   },
   "dependencies": {
     "@babel/core": "^7.16.0",

filename: package.json
patch: @@ -103,7 +103,7 @@
     "yargs": "^15.3.1"
   },
   "devEngines": {
-    "node": "16.x || 18.x || 20.x || 21.x"
+    "node": "16.x || 18.x || 20.x || 22.x"
   },
   "jest": {
     "testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
Repository: vercel/next.js
Pull request: [segment cache]: collectSegmentData should respect experimental.staleTime config

When we calculate the desired `staleTime` value we leverage the `selectStaleTime` util which has some logic to fallback to the `experimental.staleTimes` configuration if not otherwise overridden in the prerenderStore. Without this change, the static staleTime from the `/_tree` requests would always be the max (1 year), regardless of user configuration. 

This was caught by `prefetching.stale-times.test.ts` which I have re-enabled & refactored in the next PR in the stack. 

Changed files:
filename: packages/next/src/server/app-render/app-render.tsx
patch: @@ -4833,7 +4833,8 @@ async function collectSegmentData(
     serverModuleMap: getServerModuleMap(),
   }
 
-  const staleTime = prerenderStore.stale
+  const selectStaleTime = createSelectStaleTime(renderOpts.experimental)
+  const staleTime = selectStaleTime(prerenderStore.stale)
   return await ComponentMod.collectSegmentData(
     renderOpts.experimental.clientParamParsing,
     fullPageDataBuffer,
Repository: ggml-org/llama.cpp
Pull request: llama_context: synchronize before reallocating output buffer

Fixes #17957.

Changed files:
filename: src/llama-context.cpp
patch: @@ -1318,6 +1318,7 @@ uint32_t llama_context::output_reserve(int32_t n_outputs) {
             // This doesn't happen often, but may be annoying in some cases (like the HellaSwag benchmark)
             LLAMA_LOG_INFO("%s: reallocating output buffer from size %.02f MiB to %.02f MiB\n", __func__, prev_size / 1024.0 / 1024.0, new_size / 1024.0 / 1024.0);
 #endif
+            synchronize();
             buf_output = nullptr;
             logits = nullptr;
             embd = nullptr;
Repository: electron/electron
Pull request: fix: ensure `/dev/null` fd is closed on failure

Backport of #47525

See that PR for details.


Notes: Fixed an issue where utility processes could leak file handles.

Changed files:
filename: shell/browser/api/electron_api_utility_process.cc
patch: @@ -78,6 +78,9 @@ UtilityProcessWrapper::UtilityProcessWrapper(
   base::FileHandleMappingVector fds_to_remap;
 #endif
   for (const auto& [io_handle, io_type] : stdio) {
+    if (io_handle == IOHandle::STDIN)
+      continue;
+
     if (io_type == IOType::IO_PIPE) {
 #if BUILDFLAG(IS_WIN)
       HANDLE read = nullptr;
Repository: ggml-org/llama.cpp
Pull request: common : skip model validation when --completion-bash is requested

cont #17755

Fixes #17973

Changed files:
filename: common/arg.cpp
patch: @@ -504,7 +504,7 @@ static bool common_params_parse_ex(int argc, char ** argv, common_params_context
 
     // model is required (except for server)
     // TODO @ngxson : maybe show a list of available models in CLI in this case
-    if (params.model.path.empty() && ctx_arg.ex != LLAMA_EXAMPLE_SERVER && !params.usage) {
+    if (params.model.path.empty() && ctx_arg.ex != LLAMA_EXAMPLE_SERVER && !params.usage && !params.completion) {
         throw std::invalid_argument("error: --model is required\n");
     }
Repository: ggml-org/llama.cpp
Pull request: common : add llama-completion to completion-bash executables


Changed files:
filename: common/arg.cpp
patch: @@ -639,6 +639,7 @@ static void common_params_print_completion(common_params_context & ctx_arg) {
         "llama-batched-bench",
         "llama-bench",
         "llama-cli",
+        "llama-completion",
         "llama-convert-llama2c-to-ggml",
         "llama-cvector-generator",
         "llama-embedding",