PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: google/go-github (go)

Issue:
The Copilot Seat Billing API response for the assignee type can be "null"
There is a bug in the copilot seat details, per the spec null is a valid response type for the assignee:

```json
          "assignee": {
            "anyOf": [
              {
                "type": "null"
              },
```

https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization

However, the code here errors with 
Code:
https://github.com/google/go-github/blob/eff2bbd83e04dfdb38a9a878f7756e305656a9e2/github/copilot.go#L47

https://github.com/google/go-github/blob/eff2bbd83e04dfdb38a9a878f7756e305656a9e2/github/copilot.go#L212

 it's getting tested here and expecting an error, as invalid json. 
This test checks for nil type, and returns an error, it should pass. 
https://github.com/google/go-github/blob/eff2bbd83e04dfdb38a9a878f7756e305656a9e2/github/copilot_test.go#L30


Pull request:
fix: Handle null assignee in Copilot Seat Billing API response
### Fix: Handle `null` assignee in Copilot API response
Resolves #3616  
#### 🔧 Changes Made
- **Fixed `UnmarshalJSON` method** in `copilot.go`:
  - Added a `case nil:` branch to handle `null` `assignee` values.
  - Sets `cp.Assignee = nil` when `assignee` is `null`, instead of returning an error.
- **Updated `copilot_test.go`**:
  - Added a unit test case `"Null Assignee"` to ensure the `assignee: null` scenario is handled correctly and no error is thrown.

#### 🐛 Problem
The current implementation of `UnmarshalJSON` for `CopilotSeatDetails` throws an error when the `assignee` field is `null`, even though the [GitHub API documentation](https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization) explicitly states that `assignee` can be `null`.




Patch:
diff --git a/github/copilot.go b/github/copilot.go
index bed83536..b4f21ad3 100644
--- a/github/copilot.go
+++ b/github/copilot.go
@@ -203,6 +203,11 @@ func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error {
 	cp.PlanType = seatDetail.PlanType
 
 	switch v := seatDetail.Assignee.(type) {
+	case nil:
+		// Assignee can be null according to GitHub API specification.
+		// See: https://docs.github.com/en/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization
+		// Note: Copilot API is in public preview and subject to change.
+		cp.Assignee = nil
 	case map[string]any:
 		jsonData, err := json.Marshal(seatDetail.Assignee)
 		if err != nil {


Test patch:
diff --git a/github/copilot_test.go b/github/copilot_test.go
index ed817613..1aeb4308 100644
--- a/github/copilot_test.go
+++ b/github/copilot_test.go
@@ -58,6 +58,16 @@ func TestCopilotSeatDetails_UnmarshalJSON(t *testing.T) {
 			want:    &CopilotSeatDetails{},
 			wantErr: true,
 		},
+		{
+			name: "Null Assignee",
+			data: `{
+					"assignee": null
+				}`,
+			want: &CopilotSeatDetails{
+				Assignee: nil,
+			},
+			wantErr: false,
+		},
 		{
 			name: "Invalid Assignee Field Type",
 			data: `{
Repository: intel/rohd (dart)

Issue:
Simulator.reset does not wait for simulation to complete creating race condition
## Describe the bug
The `_simulationEndRequested` after reset is not set for run loop causing simulation to keep running even after it was asked to be ended.

## To Reproduce
Step 1) `simulator.endSimulation()`
Step 2) `simulator.reset()` before `simulationHasEnded`

## Expected behavior
After we call reset the simulation is not running anymore.

## Actual behavior
Previous simulation tries to run even after reset because it never ended.

Pull request:
<!-- Please make sure you check out the contribution guidelines before submitting a pull request! -->

## Description & Motivation

Simulator Bug found causing failures 

## Related Issue(s)

Fix #126 

## Testing

Added a new test to reproduce the issue

## Backwards-compatibility

> Is this a breaking change that will not be backwards-compatible?  If yes, how so?

No

## Documentation

> Does the change require any updates to documentation?  If so, where?  Are they included?

No

Patch:
diff --git a/lib/src/simulator.dart b/lib/src/simulator.dart
index ae0e4f3b0..1c99ef27f 100644
--- a/lib/src/simulator.dart
+++ b/lib/src/simulator.dart
@@ -92,6 +92,8 @@ class Simulator {
   ///
   /// Note: values deposited on [Module]s from the previous simulation remain.
   static Future<void> reset() async {
+    if (_simulationEndRequested) await simulationEnded;
+
     _currentTimestamp = 0;
     _simulationEndRequested = false;
     _maxSimTime = -1;


Test patch:
diff --git a/test/simulator_test.dart b/test/simulator_test.dart
index 4d8a63779..862817992 100644
--- a/test/simulator_test.dart
+++ b/test/simulator_test.dart
@@ -49,4 +49,11 @@ void main() {
     expect(tooFar, equals(false));
     expect(farEnough, equals(true));
   });
+
+  test('simulator reset waits for simulation to complete', () async {
+    Simulator.registerAction(100, () => Simulator.endSimulation());
+    Simulator.registerAction(100, () => Simulator.reset());
+    Simulator.registerAction(100, () => true);
+    await Simulator.run();
+  });
 }