helloadhavan/github_issues huggingface dataset:
Repository: facebook/react
Pull request: Fix function declaration in if statement

Firefox doesn't like these and throws.

cc @zpao (for lint), @jimfb (for sync)


Changed files:
filename: .eslintrc.js
patch: @@ -30,6 +30,7 @@ module.exports = {
     'indent': [ERROR, 2, {SwitchCase: 1}],
     'jsx-quotes': [ERROR, 'prefer-double'],
     'no-bitwise': OFF,
+    'no-inner-declarations': [ERROR, 'functions'],
     'no-multi-spaces': ERROR,
     'no-restricted-syntax': [ERROR, 'WithStatement'],
     'no-shadow': ERROR,

filename: scripts/bench/extract-component.js
patch: @@ -112,7 +112,7 @@ function print(outerComponent) {
         var values = keys.map((childKey) => renderedChildren[childKey]);
 
         if (keys.length) {
-          function dump(children) {
+          var dump = function(children) {
             if (typeof children === 'boolean' || children == null) {
               return '' + children;
             }
@@ -130,7 +130,7 @@ function print(outerComponent) {
               debugger;
               throw new Error('hmm');
             }
-          }
+          };
 
           markup += '\n';
           var children = element.props.children;

filename: src/isomorphic/classic/element/ReactElement.js
patch: @@ -210,7 +210,7 @@ ReactElement.createElement = function(type, config, children) {
       type;
 
     // Create dummy `key` and `ref` property to `props` to warn users against its use
-    function warnAboutAccessingKey() {
+    var warnAboutAccessingKey = function() {
       if (!specialPropKeyWarningShown) {
         specialPropKeyWarningShown = true;
         warning(
@@ -223,10 +223,10 @@ ReactElement.createElement = function(type, config, children) {
         );
       }
       return undefined;
-    }
+    };
     warnAboutAccessingKey.isReactWarning = true;
 
-    function warnAboutAccessingRef() {
+    var warnAboutAccessingRef = function() {
       if (!specialPropRefWarningShown) {
         specialPropRefWarningShown = true;
         warning(
@@ -239,7 +239,7 @@ ReactElement.createElement = function(type, config, children) {
         );
       }
       return undefined;
-    }
+    };
     warnAboutAccessingRef.isReactWarning = true;
 
     if (typeof props.$$typeof === 'undefined' ||
Repository: vercel/next.js
Pull request: Reuse routeModule loaderTree

## What?

Currently there are two paths to access the same variable loaderTree variable. This makes it one path.

Closes PACK-5342

Changed files:
filename: packages/next/src/build/templates/app-page.ts
patch: @@ -70,7 +70,7 @@ declare const pages: any
 // INJECT:tree
 // INJECT:pages
 
-export { tree, pages }
+export { pages }
 
 import GlobalError from 'VAR_MODULE_GLOBAL_ERROR' with { 'turbopack-transition': 'next-server-utility' }
 

filename: packages/next/src/server/app-render/app-render.tsx
patch: @@ -430,7 +430,9 @@ async function generateDynamicRSCPayload(
 
   const {
     componentMod: {
-      tree: loaderTree,
+      routeModule: {
+        userland: { loaderTree },
+      },
       createMetadataComponents,
       MetadataBoundary,
       ViewportBoundary,
@@ -619,10 +621,14 @@ async function generateRuntimePrefetchResult(
   const generatePayload = () => generateDynamicRSCPayload(ctx, undefined)
 
   const {
-    componentMod: { tree },
+    componentMod: {
+      routeModule: {
+        userland: { loaderTree },
+      },
+    },
     getDynamicParamFromSegment,
   } = ctx
-  const rootParams = getRootParams(tree, getDynamicParamFromSegment)
+  const rootParams = getRootParams(loaderTree, getDynamicParamFromSegment)
 
   // We need to share caches between the prospective prerender and the final prerender,
   // but we're not going to persist this anywhere.
@@ -953,7 +959,7 @@ async function warmupDevRender(
   }
 
   const rootParams = getRootParams(
-    ComponentMod.tree,
+    ComponentMod.routeModule.userland.loaderTree,
     getDynamicParamFromSegment
   )
 
@@ -1589,7 +1595,12 @@ async function renderToHTMLOrFlightImpl(
   ComponentMod.patchFetch()
 
   // Pull out the hooks/references from the component.
-  const { tree: loaderTree, taintObjectReference } = ComponentMod
+  const {
+    routeModule: {
+      userland: { loaderTree },
+    },
+    taintObjectReference,
+  } = ComponentMod
   if (enableTainting) {
     taintObjectReference(
       'Do not pass process.env to Client Components since it will leak sensitive data',
@@ -2601,7 +2612,7 @@ async function spawnDynamicValidationInDev(
   const { ServerInsertedHTMLProvider } = createServerInsertedHTML()
 
   const rootParams = getRootParams(
-    ComponentMod.tree,
+    ComponentMod.routeModule.userland.loaderTree,
     getDynamicParamFromSegment
   )
Repository: ollama/ollama
Pull request: clean up: remove server functions from client

We have had trouble with cross-account file permission when the Ollama client and server are running as different users. This change is a small clean up to remove all calls to server package code from the client (except for `server.Run()`), from now on we should not call anymore server package functions from `cmd` to prevent bugs.

Changed files:
filename: cmd/cmd.go
patch: @@ -11,6 +11,7 @@ import (
 	"io"
 	"log"
 	"net"
+	"net/http"
 	"os"
 	"os/exec"
 	"os/signal"
@@ -98,22 +99,21 @@ func RunHandler(cmd *cobra.Command, args []string) error {
 		return err
 	}
 
-	models, err := client.List(context.Background())
+	name := args[0]
+	// check if the model exists on the server
+	_, err = client.Show(context.Background(), &api.ShowRequest{Name: name})
 	if err != nil {
-		return err
-	}
-
-	canonicalModelPath := server.ParseModelPath(args[0])
-	for _, model := range models.Models {
-		if model.Name == canonicalModelPath.GetShortTagname() {
-			return RunGenerate(cmd, args)
+		var statusError api.StatusError
+		switch {
+		case errors.As(err, &statusError) && statusError.StatusCode == http.StatusNotFound:
+			if err := PullHandler(cmd, args); err != nil {
+				return err
+			}
+		case err != nil:
+			return err
 		}
 	}
 
-	if err := PullHandler(cmd, args); err != nil {
-		return err
-	}
-
 	return RunGenerate(cmd, args)
 }
 
@@ -731,21 +731,6 @@ func RunServer(cmd *cobra.Command, _ []string) error {
 		origins = strings.Split(o, ",")
 	}
 
-	if noprune := os.Getenv("OLLAMA_NOPRUNE"); noprune == "" {
-		if err := server.PruneLayers(); err != nil {
-			return err
-		}
-
-		manifestsPath, err := server.GetManifestPath()
-		if err != nil {
-			return err
-		}
-
-		if err := server.PruneDirectory(manifestsPath); err != nil {
-			return err
-		}
-	}
-
 	return server.Serve(ln, origins)
 }
 

filename: server/routes.go
patch: @@ -614,6 +614,22 @@ var defaultAllowOrigins = []string{
 }
 
 func Serve(ln net.Listener, allowOrigins []string) error {
+	if noprune := os.Getenv("OLLAMA_NOPRUNE"); noprune == "" {
+		// clean up unused layers and manifests
+		if err := PruneLayers(); err != nil {
+			return err
+		}
+
+		manifestsPath, err := GetManifestPath()
+		if err != nil {
+			return err
+		}
+
+		if err := PruneDirectory(manifestsPath); err != nil {
+			return err
+		}
+	}
+
 	config := cors.DefaultConfig()
 	config.AllowWildcard = true
Repository: denoland/deno
Pull request: fix(update): preserve tilde in version range

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

Changed files:
filename: cli/tools/pm/outdated/mod.rs
patch: @@ -305,13 +305,23 @@ fn choose_new_version_req(
         latest_available: false,
       };
     };
-    let exact = if let Some(range) = dep.req.version_req.range() {
-      range.0[0].start == range.0[0].end
+    // Detect the original operator to preserve it
+    let version_req_str = dep.req.version_req.to_string();
+    let operator = if version_req_str.starts_with('~') {
+      "~"
+    } else if version_req_str.starts_with('^') {
+      "^"
     } else {
-      false
+      // Check if it's an exact version (no operator)
+      let exact = if let Some(range) = dep.req.version_req.range() {
+        range.0[0].start == range.0[0].end
+      } else {
+        false
+      };
+      if exact { "" } else { "^" }
     };
     let candidate_version_req = VersionReq::parse_from_specifier(
-      format!("{}{}", if exact { "" } else { "^" }, preferred.version).as_str(),
+      format!("{}{}", operator, preferred.version).as_str(),
     )
     .unwrap();
     if preferred.version <= resolved.version

filename: tests/specs/outdated/preserve_tilde/__test__.jsonc
patch: @@ -0,0 +1,20 @@
+{
+  "tempDir": true,
+  "steps": [
+    {
+      "args": "install",
+      "output": "[WILDCARD]"
+    },
+    {
+      "args": "update",
+      "output": "update.out"
+    },
+    {
+      "args": [
+        "eval",
+        "const content = Deno.readTextFileSync('./deno.json'); const imports = JSON.parse(content).imports; const version = imports['@denotest/has-patch-versions']; console.log(version);"
+      ],
+      "output": "deno.json.version.out"
+    }
+  ]
+}

filename: tests/specs/outdated/preserve_tilde/deno.json
patch: @@ -0,0 +1,5 @@
+{
+  "imports": {
+    "@denotest/has-patch-versions": "npm:@denotest/has-patch-versions@~0.1.0"
+  }
+}

filename: tests/specs/outdated/preserve_tilde/deno.json.version.out
patch: @@ -0,0 +1 @@
+npm:@denotest/has-patch-versions@~0.1.1

filename: tests/specs/outdated/preserve_tilde/update.out
patch: @@ -0,0 +1,2 @@
+Updated 1 dependency:
+ - npm:@denotest/has-patch-versions ~0.1.0 -> ~0.1.1
Repository: electron/electron
Pull request: fix: `NativeWindow.window_id()` returns same value for all windows

#### Description of Change

`NativeWindow::window_id()` always returned the same value, no matter which `NativeWindow` was being queried. This caused `ElectronAccessibilityUI` to behave unpredictably because `RequestNativeUITree()` could sometimes key in on the wrong native window. Introduced in 3f37ff8.

#### 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: Fixed ElectronAccessibilityUI bug.

Changed files:
filename: shell/browser/native_window.cc
patch: @@ -94,8 +94,6 @@ gfx::Size GetExpandedWindowSize(const NativeWindow* window, gfx::Size size) {
 NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
                            NativeWindow* parent)
     : widget_(std::make_unique<views::Widget>()), parent_(parent) {
-  ++next_id_;
-
   options.Get(options::kFrame, &has_frame_);
   options.Get(options::kTransparent, &transparent_);
   options.Get(options::kEnableLargerThanScreen, &enable_larger_than_screen_);
@@ -820,9 +818,6 @@ void NativeWindow::HandlePendingFullscreenTransitions() {
   SetFullScreen(next_transition);
 }
 
-// static
-int32_t NativeWindow::next_id_ = 0;
-
 bool NativeWindow::IsTranslucent() const {
   // Transparent windows are translucent
   if (transparent()) {

filename: shell/browser/native_window.h
patch: @@ -409,7 +409,7 @@ class NativeWindow : public base::SupportsUserData,
   NativeWindow* parent() const { return parent_; }
   bool is_modal() const { return is_modal_; }
 
-  int32_t window_id() const { return next_id_; }
+  int32_t window_id() const { return window_id_; }
 
   void add_child_window(NativeWindow* child) {
     child_windows_.push_back(child);
@@ -472,7 +472,8 @@ class NativeWindow : public base::SupportsUserData,
  private:
   std::unique_ptr<views::Widget> widget_;
 
-  static int32_t next_id_;
+  static inline int32_t next_id_ = 0;
+  const int32_t window_id_ = ++next_id_;
 
   // The content view, weak ref.
   raw_ptr<views::View> content_view_ = nullptr;
Repository: ollama/ollama
Pull request: catch insufficient permissions nvidia err

If there is an insufficient permissions error on `nvidia-smi` execution if would be logged as a parsing error. Catch the error before this happens.

#932 

Changed files:
filename: llm/llama.go
patch: @@ -212,6 +212,10 @@ func CheckVRAM() (int64, error) {
 	scanner := bufio.NewScanner(&stdout)
 	for scanner.Scan() {
 		line := scanner.Text()
+		if strings.Contains(line, "[Insufficient Permissions]") {
+			return 0, fmt.Errorf("GPU support may not enabled, check you have installed GPU drivers and have the necessary permissions to run nvidia-smi")
+		}
+
 		vram, err := strconv.ParseInt(strings.TrimSpace(line), 10, 64)
 		if err != nil {
 			return 0, fmt.Errorf("failed to parse available VRAM: %v", err)
Repository: facebook/react
Pull request: Add test to ensure 'undefined' children is used


Changed files:
filename: src/isomorphic/classic/element/__tests__/ReactElement-test.js
patch: @@ -223,6 +223,18 @@ describe('ReactElement', function() {
     expect(console.error.argsForCall.length).toBe(0);
   });
 
+  it('overrides children if undefined is provided as an argument', function() {
+    var element = React.createElement(ComponentClass, {
+      children: 'text',
+    }, undefined);
+    expect(element.props.children).toBe(undefined);
+
+    var element2 = React.cloneElement(React.createElement(ComponentClass, {
+      children: 'text',
+    }), {}, undefined);
+    expect(element2.props.children).toBe(undefined);
+  });
+
   it('merges rest arguments onto the children prop in an array', function() {
     spyOn(console, 'error');
     var a = 1;

filename: src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js
patch: @@ -117,6 +117,18 @@ describe('ReactJSXElement', function() {
     expect(console.error.argsForCall.length).toBe(0);
   });
 
+  it('overrides children if undefined is provided as an argument', function() {
+    var element = <Component children="text">{undefined}</Component>;
+    expect(element.props.children).toBe(undefined);
+
+    var element2 = React.cloneElement(
+      <Component children="text" />,
+      {},
+      undefined
+    );
+    expect(element2.props.children).toBe(undefined);
+  });
+
   it('merges JSX children onto the children prop in an array', function() {
     spyOn(console, 'error');
     var a = 1;
Repository: huggingface/transformers
Pull request: Include machine type in collated reports filename


Changed files:
filename: utils/collated_reports.py
patch: @@ -198,7 +198,7 @@ def upload_collated_report(job: str, report_repo_id: str, filename: str):
         collated_report_buffer.append(report)
 
     # Write collated report
-    with open(f"collated_reports_{commit_hash}.json", "w") as f:
+    with open(f"collated_reports_{machine_type}_{commit_hash}.json", "w") as f:
         json.dump(
             {
                 "gpu_name": gpu_name,
Repository: facebook/react
Pull request: Fix trailing build issues

I screwed up my push in #7164.

Here's the remaining pieces.


Changed files:
filename: grunt/config/browserify.js
patch: @@ -19,15 +19,17 @@ var SECRET_INTERNALS_NAME = 'React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_
 var shimSharedModules = globalShim.configure({
   './ReactCurrentOwner': SECRET_INTERNALS_NAME + '.ReactCurrentOwner',
   './ReactComponentTreeHook': SECRET_INTERNALS_NAME + '.ReactComponentTreeHook',
-  // All these methods are shared are exposed.
+  // The methods we used here are exposed on the main React export.
+  // TODO: Change all renderer code to require the isomorphic React directly
+  // instead of these internals.
   './ReactElement': 'React',
   './ReactPropTypes': 'React.PropTypes',
   './ReactChildren': 'React.Children',
 });
 
 var shimDOMModules = aliasify.configure({
   'aliases': {
-    './ReactAddonsDOMDependencies': './build/modules/ReactAddonsDOMDependenciesUMDShim.js',
+    './ReactAddonsDOMDependencies': {relative: './ReactAddonsDOMDependenciesUMDShim'},
   },
 });
 

filename: src/renderers/dom/client/ReactMount.js
patch: @@ -237,6 +237,7 @@ if (__DEV__) {
 TopLevelWrapper.prototype.render = function() {
   return this.props.child;
 };
+TopLevelWrapper.isReactTopLevelWrapper = true;
 
 /**
  * Mounting is the process of initializing a React component by creating its

filename: src/renderers/shared/stack/reconciler/ReactUpdates.js
patch: @@ -160,10 +160,7 @@ function runBatchedUpdates(transaction) {
     if (ReactFeatureFlags.logTopLevelRenders) {
       var namedComponent = component;
       // Duck type TopLevelWrapper. This is probably always true.
-      if (
-        component._currentElement.props.child ===
-        component._renderedComponent._currentElement
-      ) {
+      if (component._currentElement.type.isReactTopLevelWrapper) {
         namedComponent = component._renderedComponent;
       }
       markerName = 'React update: ' + namedComponent.getName();
Repository: vercel/next.js
Pull request: fix: find root dir on fs root

Attempt at fixing from our side: https://github.com/vercel/next.js/issues/82577, https://github.com/vercel/next.js/issues/82356

Rather, the issue is that when the project is at the root of the file system - `findRootDir` loops indefinitely, and we keep pushing to the lockFiles found.

I also noticed the warning claims we use the last lockfile found, but we return `dirname(lockfile)` - that is the first lock file found.

Regardless, when using this project setup:

```console
.
├── apps
│   └── frontend
│       ├── README.md
│       ├── next.config.ts
│       ├── package.json
│       ├── pnpm-lock.yaml
│       ├── src
│       │   └── app
│       │       ├── globals.css
│       │       ├── layout.tsx
│       │       └── page.tsx
│       └── tsconfig.json
├── package.json
├── pnpm-lock.yaml
└── pnpm-workspace.yaml
```

Running `pnpm --filter frontend dev` still ends up in panic: `Error [TurbopackInternalError]: Next.js package not found` - Maybe that's still expected :) 

As for https://github.com/vercel/next.js/issues/82577 - a way for them to get unblocked is to use a `WORKDIR`. More details on that issue thread.

Changed files:
filename: packages/next/src/lib/find-root.ts
patch: @@ -23,21 +23,25 @@ export function findRootDir(cwd: string) {
 
   const lockFiles = [lockFile]
   while (true) {
-    const nextDir = dirname(dirname(lockFiles[lockFiles.length - 1]))
-    const newLockFile = findRootLockFile(nextDir)
+    const lastLockFile = lockFiles[lockFiles.length - 1]
+    const currentDir = dirname(lastLockFile)
+    const parentDir = dirname(currentDir)
 
-    if (newLockFile) {
-      lockFiles.push(newLockFile)
-    } else {
-      break
-    }
+    // dirname('/')==='/' so if we happen to reach the FS root (as might happen in a container we need to quit to avoid looping forever
+    if (parentDir === currentDir) break
+
+    const newLockFile = findRootLockFile(parentDir)
+
+    if (!newLockFile) break
+
+    lockFiles.push(newLockFile)
   }
 
   // Only warn if not in a build worker to avoid duplicate warnings
   if (typeof process.send !== 'function' && lockFiles.length > 1) {
     const additionalLockFiles = lockFiles
       .slice(0, -1)
-      .map((str) => '\n   * ' + str)
+      .map((str) => `\n   * ${str}`)
       .join('')
 
     if (process.env.TURBOPACK) {
@@ -61,5 +65,5 @@ export function findRootDir(cwd: string) {
     }
   }
 
-  return dirname(lockFile)
+  return dirname(lockFiles[lockFiles.length - 1])
 }
Repository: denoland/deno
Pull request: test: update autobahn test suite

<!--
Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label.
-->


Changed files:
filename: ext/websocket/autobahn/fuzzingclient.js
patch: @@ -8,7 +8,7 @@ $.setPrintCommand(true);
 const pwd = new URL(".", import.meta.url).pathname;
 
 const AUTOBAHN_TESTSUITE_DOCKER =
-  "crossbario/autobahn-testsuite:0.8.2@sha256:5d4ba3aa7d6ab2fdbf6606f3f4ecbe4b66f205ce1cbc176d6cdf650157e52242";
+  "crossbario/autobahn-testsuite:25.10.1@sha256:519915fb568b04c9383f70a1c405ae3ff44ab9e35835b085239c258b6fac3074";
 
 const self = Deno.execPath();
 $`${self} run -A --config ${pwd}/../../../tests/config/deno.json ${pwd}/autobahn_server.js`

filename: tests/node_compat/config.toml
patch: @@ -302,7 +302,7 @@
 "parallel/test-dgram-send-default-host.js" = {}
 "parallel/test-dgram-send-empty-array.js" = { flaky = true }
 "parallel/test-dgram-send-empty-buffer.js" = { darwin = false, flaky = true }
-"parallel/test-dgram-send-empty-packet.js" = { flaky = true }
+"parallel/test-dgram-send-empty-packet.js" = { darwin = false, flaky = true }
 "parallel/test-dgram-send-error.js" = {}
 "parallel/test-dgram-send-invalid-msg-type.js" = {}
 "parallel/test-dgram-send-multi-buffer-copy.js" = {}
Repository: facebook/react
Pull request: Include React itself in the list of build shims

Without this we end up bundling all of the isomorphic React into the DOM bundle. This was fixed in #7168 too but I'll just do an early fix to ensure that #7168 is purely an npm change.


Changed files:
filename: grunt/config/browserify.js
patch: @@ -22,6 +22,7 @@ var shimSharedModules = globalShim.configure({
   // The methods we used here are exposed on the main React export.
   // TODO: Change all renderer code to require the isomorphic React directly
   // instead of these internals.
+  './React': 'React',
   './ReactElement': 'React',
   './ReactPropTypes': 'React.PropTypes',
   './ReactChildren': 'React.Children',
Repository: electron/electron
Pull request: fix: crash on parent window close and focur/blur

Backport of #46559

See that PR for details.


Notes: Fixed a possible BrowserWindow crash caused by closing a parent window with focus or blur events.

Changed files:
filename: shell/browser/api/electron_api_browser_window.cc
patch: @@ -219,14 +219,14 @@ void BrowserWindow::CloseImmediately() {
 }
 
 void BrowserWindow::Focus() {
-  if (api_web_contents_->IsOffScreen())
+  if (api_web_contents_ && api_web_contents_->IsOffScreen())
     FocusOnWebView();
   else
     BaseWindow::Focus();
 }
 
 void BrowserWindow::Blur() {
-  if (api_web_contents_->IsOffScreen())
+  if (api_web_contents_ && api_web_contents_->IsOffScreen())
     BlurWebView();
   else
     BaseWindow::Blur();

filename: spec/api-browser-window-spec.ts
patch: @@ -4929,6 +4929,18 @@ describe('BrowserWindow module', () => {
         expect(w.getChildWindows().length).to.equal(0);
       });
 
+      it('can handle parent window close with focus or blur events', (done) => {
+        const w = new BrowserWindow({ show: false });
+        const c = new BrowserWindow({ show: false, parent: w });
+
+        c.on('closed', () => {
+          w.focus();
+          done();
+        });
+
+        w.close();
+      });
+
       ifit(process.platform === 'darwin')('only shows the intended window when a child with siblings is shown', async () => {
         const w = new BrowserWindow({ show: false });
         const childOne = new BrowserWindow({ show: false, parent: w });