sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Feature request: Make `Program.sourceFileToPackageName` public
Labels: Needs Investigation

# Suggestion

## 🔍 Search Terms

sourceFileToPackageName

## ✅ Viability Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

I would like to request `Program.sourceFileToPackageName` to be marked as public (or rather, un-marked as `internal`)

## 📃 Motivating Example & Use Case

In `typescript-eslint`, I have recently worked on a way to [specify a type](https://github.com/typescript-eslint/typescript-eslint/blob/a3a55f8b6aa40ec912e34b5f272ddcd5fcca63c1/packages/type-utils/src/TypeOrValueSpecifier.ts) including its source (local/package/lib). Well, as part of that, we need to know if a type is declared in a particular package (well, or a corresponding `@types` package). Currently, this is implemented by just [checking](https://github.com/typescript-eslint/typescript-eslint/blob/a3a55f8b6aa40ec912e34b5f272ddcd5fcca63c1/packages/type-utils/src/TypeOrValueSpecifier.ts#L173-L179) the type's declaration files for the `node_modules/package_name` substring - a rather crude approach.

I stumbled upon `Program.sourceFileToPackageName`, which as far as I understand is TypeScript doing the same thing - recording the package in which the type was declared, if any. So I would like to use that to prevent any possible discrepancy between TS and `typescript-eslint`. Additionally, it would solve the problem of not everyone having their dependencies in `node_modules` - with things like type roots and similar.

Corresponding `typescript-eslint` issue: typescript-eslint/typescript-eslint#6861
Repository: material-ui
Issue: Button Component value is not updated in case of conditional statement
Labels: component: button

Hi,

I have tried to use the example Stepper Component and realize that the value of the Button is not updated at the last step:

https://github.com/mui/material-ui/blob/05127cf65b4250f836897428cd15829669ab8d6c/docs/data/material/components/steppers/HorizontalLinearStepper.tsx#L109

I have tried other components like Box and Typography but they work as expected (update the value to the latest state). Tried to duplicate the Button Component but references to the same state value and it works only if the other Button is clicked. Can you please check, looks like the Button component misses the latest state update if it was initiated from its own **onClick**. 

Thanks
Repository: storybook
Issue: Move cyclical satellite repos into monorepo
Labels: maintenance

### Describe the bug

Storybook has a cyclical dependency issue where packages can depend on packages from satellite repos which in turn depend on monorepo packages.

An example of this is `@storybook/addon-interactions` (monorepo) which depends on `@storybook/testing-library` (satellite) which depends on `@storybook/instrumenter` (monorepo).

The problem with this cycle is that monorepo packages depend on exact versions of other monorepo packages, and those versions get bumped with every publish. However, satellite repos depend on version ranges. Due to this inconsistency, it's very easy for multiple versions of packages to get installed. This can lead to bugs, especially in the case of instrumener.

To resolve these problems, we should move the following packages into the monorepo:
- [ ] `@storybook/testing-library`
- [ ] `@storybook/jest`

This will technically be a breaking change, since users also have these dependencies in their project's `package.json`. Therefore we either need to do this as part of 8.0, or we need to be OK with this breaking change early in 7.0 and
- [ ] create an automigration that also bumps the user's versions of `@storybook/testing-library`/`@storybook/jest` to `7.0.x`

### To Reproduce

_No response_

### System

_No response_

### Additional context

_No response_
Repository: next.js
Issue: Cannot set `Vary` header in middleware
Labels: bug,Runtime

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 18.11.0
      npm: 8.19.2
      Yarn: 1.22.19
      pnpm: 7.28.0
    Relevant packages:
      next: 13.3.1-canary.8
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

Middleware / Edge (API routes, runtime)

### Link to the code that reproduces this issue

https://github.com/darthmaim-reproductions/vercel-next.js-48480

### To Reproduce

1. Clone reproduction repository
2. Install Dependencies (`npm i`)
3. Start server (`npm run dev`)
4. Open http://localhost:3000/ in your browser
5. Open your browsers dev tools and inspect the request in the network tab (might need to reload the page if dev tools was opened after the page load)
6. Check headers

![image](https://user-images.githubusercontent.com/2511547/232481171-966bf33f-cf6b-4e2a-b9aa-17566ffb3731.png)


### Describe the Bug

The middleware in the reproduction example sets two headers, `my-custom-header` and `vary`.

```ts
response.headers.append('my-custom-header', 'test');
response.headers.append('vary', 'my-custom-header');
```

The `my-custom-header` header is correctly included in the response.

But the response does not include the custom `vary` header, because it gets overriden by next.js. For appDir requests it is happening here: https://github.com/vercel/next.js/blob/2a61253f72e629816b989acadf088e0e2ff5bd9c/packages/next/src/server/base-server.ts#L1326

### Expected Behavior

It should be possible to add a custom vary header, which then gets merged with the default next.js header. Otherwise caching breaks if the content depends on headers.

One example use case is CORS: The `Access-Control-Allow-Origin` response header depends on the `Origin` request header (`Vary` should include `Origin`).

One possible solution would be to use `appendHeader` instead of `setHeader` to set the `Vary` header in next.js.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_
Repository: godot
Issue: Window per-pixel transparency does not work on hybrid GPU systems (NVIDIA Optimus)
Labels: platform:windows,topic:rendering,topic:porting,confirmed,documentation

### Godot version

3.x, 4.x

### System information

Windows 10, Windows 11, GLES3, Vulkan, various GPUs

### Issue description

It seems that transparency (`per_pixel_transparency_allowed = true`, `window_set_flag(WINDOW_FLAG_TRANSPARENT, true)`, `set_transparent_background(true)`) has issues on especially Laptops that have both an iGPU and a dGPU. For users of these systems, the background renders completely opaque in black. The color of the background is not actually influenced by the clear color so I am not sure where this is coming from

There seem to be 3 workarounds to this issue I could find with my users (I personally sadly don't have a gaming laptop to test this)

1. Completely disable the iGPU
2. Attach a secondary monitor to the laptop
3. Actually in contrast to 1. force Godot to run on the iGPU with `--gpu-index 1`

Printing the supported composite alpha flags got us these results for the iGPU:
`VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR, VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR`

and this for the dGPU:
`VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR`

Strangely enough, if I test on my system which has only a dedicated GPU I also only get `VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR` reported. At this point, I really don't know what might be the issue.

### Steps to reproduce

1. get a laptop with both a dGPU and an iGPU
2. Enable per_pixel_transparency_allowed, set_transparent_background(true) and window_set_flag(WINDOW_FLAG_TRANSPARENT, true)
3. Background is opaque black unless one of the workarounds is used

### Minimal reproduction project

-
Repository: storybook
Issue: [Bug]: Storybook Composition does not connect properly on Storybook 7
Labels: bug,has workaround,composition,sev:S3

### Describe the bug

First off, I would like to point out that I am trying to run my main storybook with composition config on Storybook 7 while my reference storybooks are still on Storybook ~6.5, so I'm not sure if this is intended to work. I can do some more investigation into upgrading those other ones to see if it resolves my issues, but it might be a while before I can get to it.

When my static storybook loads, I get an error from  [Explorer](https://github.com/storybookjs/storybook/blob/next/code/ui/manager/src/components/sidebar/Explorer.tsx#L49). In this instance selected is `null` and `ref.id` is undefined. The `?.` operator causes them to be equal and get an error:
<img width="644" alt="Screenshot 2023-04-17 at 5 56 41 AM" src="https://user-images.githubusercontent.com/88802614/232487357-c26e8aac-f28c-435b-a42c-539fa6463b2d.png">


I wrote a patch in my project to have a better check than the above. Basically changing that line to the following:
```
          selectedStoryId={selected?.refId && selected.refId === ref.id ? selected.storyId : null}
```

This worked for the most part. The only problem is now with that I am seeing double instances of all my references -- one that looks exactly how I would expect and another that stays in a perpetual loading state.
<img width="163" alt="Screenshot 2023-04-17 at 6 36 47 AM" src="https://user-images.githubusercontent.com/88802614/232488679-5f85e877-860e-4cf6-9cc9-c1ffe03e9571.png">


Hopefully this is good information. I unfortunately can't share more because it's in private repos.



### To Reproduce

Will try and set up a repro -- composition has always been difficult for me to set up locally.

### System

```shell
All storybook dependencies `@7.0.5`
```


### Additional context

_No response_
Repository: next.js
Issue: (Inconsistent): Automatic Image Optimization - Caching response headers
Labels: bug,Image (next/image)

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
N/A I am unable to reproduce this consistently - in fact the issue is incredibly rare - so I can't say for a fact whether this occurs on Canary.

I've only been able to reproduced it while deployed on Vercel infrastructure - here's all the information:

- Next: 13.1.0
- Build and deployment settings - default Next.JS 
- Node.JS 18.X
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

Image optimization (next/image, next/legacy/image)

### Link to the code that reproduces this issue

n/a

### To Reproduce

N/A I am unable to reproduce this consistently - in fact the issue is incredibly rare - so I can't say for a fact whether this occurs on Canary.

I've only been able to reproduced it while deployed on Vercel infrastructure - here's all the information:

- Next: 13.1.0
- Build and deployment settings - default Next.JS 
- Node.JS 18.X.


That said when I did reproduce it looked something like:
- Tab 1: MY_DOMAIN/_next/image?url=https%3A%2F%2FINTERNAL%2Frails%2Factive_storage%2Fblobs%2Fproxy%2FSOME_RESOURCE.jpg&w=1920&q=75

- On tab 1: Have a `cookie` header in
- Internally: Next calls the image, apparently passing through the cookies - we'll call this REQUEST_1.
- INTERNAL/rails responds with: `set-cookie` (and a bunch of other heads) when a request comes in with cookie headers echoing the headers.


- Tab 2: MY_DOMAIN/_next/image?url=https%3A%2F%2FINTERNAL%2Frails%2Factive_storage%2Fblobs%2Fproxy%2FSOME_RESOURCE.jpg&w=1920&q=75
- On tab 2 we had separate cookies set.
- Requesting the image is coming back with the response headers from REQUEST_1

This is incorrectly setting the cookies for user 2 to the credentials of user 1.

### Describe the Bug

Next seems to sometimes (unclear what triggers these conditions) cache the response headers of the original request under /image.

Under certain conditions - this is resulting on authentication credentials leaking from one user to another.

### Expected Behavior

Next should either respond with the cached content / body of the response and new set of headers, OR it should fallback to the original resource and either respond with the underlying headers / respond and / or respond with a new set of headers.

It should **never** be caching information on the headers and using those details directly in a response to a different user.

### Which browser are you using? (if relevant)

Chrome

### How are you deploying your application? (if relevant)

Vercel
Repository: pytorch
Issue: Torch func Documentation for trees
Labels: module: docs,triaged,module: functorch

### 📚 The doc issue

`functorch` / `torch.func` seems to support pytrees similar to `JAX`. However, there seems to be no documentation on that.

For example, this works:

```
import torch.func as FT
import torch

a = {
    "A": torch.randn(2,2),
    "inner": {
        "B": torch.randn(2,2),
        "C": torch.randn(2,2)
        }
    }

b = [
    torch.randn(2,2),
    torch.randn(2,2),
]

def f(x, y):
    return (x["A"] + x["inner"]["B"] @ x["inner"]["C"]).sum() + y[0].sum() + y[1].sum()


grad, val = FT.grad_and_value(f, argnums=(0,1))(a, b)

print(grad)
```

But I couldnt find anything in the docs, nor does there seem to be a `tree_utils` package like in JAX.

### Suggest a potential alternative/fix

It would be useful to clarify what is possible and what isnt.

cc @svekars @carljparker @zou3519 @Chillee @samdow @soumith @kshitij12345 @janeyx99
Repository: go
Issue: proposal: x/build: add a CI runner with CC="zig cc" for linux/amd64
Labels: Builders,Proposal,new-builder

## Short Summary

Add a CI worker that runs Go's unit tests with `CC="zig cc"` on `linux/amd64`.

## About `zig cc`

On Linux, `zig cc` is a wrapper on top of LLVM and LLD. Main benefits compared to other popular compilers:

- Cross-compilation out of the box via a command-line flag.
- Can dynamically link to a specified glibc version via a command-line flag (i.e. it generates a `libc.so.6` on the fly before linking, no need to ship one).

For example:

    CC="zig cc -target aarch64-linux-gnu.2.17" go build .

Will (cross-)compile the current package for `linux/arm64` and link to glibc 2.17. Read [this](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html) to learn more about `zig cc`.

Zig also has it's own Mach-O linker, making it possible to cross-compile to OS X. This is not in scope for this proposal, but may be considered as a next step. cc @kubkon who expressed interest in this.

## Logistics

Initial changes:

1. Add a `linux/amd64` worker that lack any C/C++ compiler (i.e. make sure gcc/ld are not installed).
2. Install `zig v0.11` (to be released in May) to the worker.
3. Run all Golang's unit tests with `CC="zig cc"`.

Upkeep:
1. The CI worker will have `ReleaseSafe+Debug` build, so, in case Zig crashes or trips an assertion, there will be decent information about the crash right in the logs. Refs https://github.com/ziglang/zig/issues/15194.
2. The worker should have Zig upgraded when a new Zig version is released. This can be coordinated by Uber's Go team (cc @linzhp @sywhang) or Zig folks (cc @kubkon @andrewrk).

## Why is this important?

As of writing a few companies are known to use `zig cc` to compile C/C++ (via [this toolchain][cc-toolchain]) and bundle it with Go code. My employer Uber uses `zig cc` to compile+link it's Go Monorepo for `linux/amd64` and `linux/arm64`. During the last 4 months that we have been using `zig cc` in production (which included an upgrade to Go 1.20) we have encountered some issues in a released Go version that would have been caught in dev versions should `zig cc` worker be present:

- https://github.com/golang/go/issues/59466
- https://github.com/golang/go/issues/58935 - any Go 1.20-1.20.2 executable on `darwin/arm64` would have triggered an assertion during linking with Zig.

Since Go unit tests is a decent "integration" test, we believe it is a worth-while exercise to have this in CI.

[cc-toolchain]: https://github.com/uber/hermetic_cc_toolchain
Repository: material-ui
Issue: [material] Add "pulse" animation
Labels: new feature,waiting for 👍,package: material-ui

### Duplicates

- [X] I have searched the existing issues

### Latest version

- [X] I have tested the latest version

### Summary 💡

A "pulse" animation seems to me like it's a pretty basic one along the lines of `Grow`, `Slide`, etc. The icon button already has a (`bgcolor`, I think) pulse [built in](https://github.com/mui/material-ui/issues/22064), but there's no general mechanism for pulsing an element. Here's one for pulsing size:

```
interface PulseProps extends PropsWithChildren {
  durationMs?: number
}

export default function Pulse({
  duration = 400,
  children
}: PulseProps) {

  const pulse = keyframes `
    0% {
      transform: scale(1);
    }
      50% {
      transform: scale(1.2);
    }
    100% {
      transform: scale(1);
    }
  `

  return (
    <Box
      sx={{
        animation: `${pulse} ${duration}ms ease`
      }}
    >
      {children}
    </Box>
  )
}
```

It would be cool to be able to specify the property that gets pulsed. I'm not sure exactly what that would look like?

```
<Pulse 
  property='opacity' 
  keyframes=[1, 0.5] 
/>
```

It's easy enough to make my own pulsing animations, as above, but I thought it worth adding this request to gauge the demand for a library component.

### Examples 🌈

Here's a simple [CSS pulse tutorial](https://reactgo.com/css-pulse-animation/) that's the basis of my component.

### Motivation 🔦

In my case, I wanted to pulse a success icon after a long download finishes. In general, the pulse animation is useful for subtly drawing attention to a particular element on the screen after some change in state.
Repository: rust
Issue: Compiler incorrectly understand initialisation of vars with patterns.
Labels: T-compiler,C-bug,A-patterns,A-control-flow

Hey, this code does not work in 1.68.2, but it should.
```
struct W(u8);

fn sooqa () -> Option<W> {
    Some(W(0))
}

fn main() {
    let p@W(v);
    loop {
        if let Some(p_) = sooqa() { p = p_;break /*A*/ };
    }
    println!("{}", v);
}
```
This is the error message
```
error[[E0381]](https://doc.rust-lang.org/stable/error_codes/E0381.html): used binding `v` isn't initialized
  --> src/main.rs:13:20
   |
9  |     let p@W(v);
   |             - binding declared here but left uninitialized
...
13 |     println!("{}", v);
   |                    ^ `v` used here but it isn't initialized
   |
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider assigning a value
   |
9  |     let p@W(v = 0);
   |               +++
```
Repository: TypeScript
Issue: Type-level narrowing constraints (like `as const`)
Labels: Suggestion,Needs Proposal

# Suggestion

In userland code, you can use `as const`, but as a library author, I often want to provide the best possible experience, and when there's an opportunity for a literal value to be produced, I would like to infer that value for my users without them having to use (or remember to use) `as const`.

## 🔍 Search Terms

constant literals, Math.random, require as const, infer literals, readonly by default

## ✅ Viability Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

Provide an ability to narrow types at the type level (i.e. without JavaScript where you can use `as const`).

## 📃 Motivating Example

```ts
const notLiteral = () => "A";
```

A type like this produces `() => string`.  I can improve the situation by specifying `as const`, which will cause it to produce `() => "A"`.

> Note: I'm not totally sure how related this is, but I've seen `> () => Math.random() > 0.5 ? "A" : "B"` which produces `() => "A" | "B"`, and it's not clear to me what the difference is from the example above

However, in the context of a library, a library author doesn't have the option to do this in the type level.  Something for this use-case would be a nice improvement:

```ts
////// LIBRARY CODE
const UploadThingServerHelper = <ValidRoutes,>(
  route: {
    readonly [Route in keyof ValidRoutes]: {
      middleware: () => ValidRoutes[Route]; // how can a library author force a more specific type here?
      onUpload: (response: { metadata: ValidRoutes[Route] }) => void;
    };
  }
) => {};

////// END USER CODE
const FileRouter = UploadThingServerHelper({
  example: {
    middleware: () => "someValue", // and end-user must remember to put `as const` here to force it to return a literal
    onUpload: response => {
      response.metadata; // the result is that the type here is not as narrow as it could be for the best user experience
      //       ^?
    },
  },
});
```

## 💻 Use Cases

This is useful for libraries trying to provide a great user experience with great inferencing.  It should be a backwards compatible change.  There are no workarounds that I'm aware of (from the code of a library).
Repository: pytorch
Issue: torch.linalg.lstsq doc arguments error
Labels: module: docs,triaged,module: linear algebra

### 📚 The doc issue

According to [doc](https://pytorch.org/docs/stable/generated/torch.linalg.lstsq.html), the arguments of torch.linalg.lstsq are `A`、`B`、`rcond`、`driver`. But when using these arguments, below code will throw exception: `ERROR:linalg_lstsq() missing 2 required positional argument: "input", "b"`. Actually the arguments should be `input`、`b`、`rcond`、`driver`.
```
import torch
arg_1 = torch.rand([5, 3], dtype=torch.float32)
arg_2 = torch.rand([5, 3], dtype=torch.float32)
results = torch.linalg.lstsq(A=arg_1,B=arg_2,)
print(results)
```

### Suggest a potential alternative/fix

_No response_

cc @svekars @carljparker @jianyuh @nikitaved @pearu @mruberry @walterddr @IvanYashchuk @xwang233 @Lezcano
Repository: go
Issue: x/build/cmd/watchflakes: misattributed `Fail in goroutine after … has completed`
Labels: Builders,NeedsFix

In #59646, `watchflakes` reported an issue for a log that includes the line:
```
panic: Fail in goroutine after TestDialTimeout has completed
```

However, the pattern it filed erroneously attributed the failure to the `TestDeadlineOnWrite` test, which is unrelated except to the extent that it happened to be running when the stray `Error` call from the previous test was detected.

`watchflakes` should look for the `Fail in goroutine after .* has completed` log line and update its classification accordingly.

(attn @cherrymui)