internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: cisagov/manage.get.gov

Issue:
create sandbox for christina
### Issue description

Create Christina's sandbox

### Acceptance criteria

- [x] Christina's sandbox is created
- [ ] epp creds added
- [ ] email creds added
- [x] fixtures are loaded

### Additional context

_No response_

### Links to other issues

blocked by: #2052 


Discussion:
Note to developer: the "Blocked by" ticket seems incorrect.
@vickyszuchin the blocked by has been fixed it should have been blocked by 2052 and instead it had 2054, just a bad keyboard entry there.
"blocked" label removed. #2052 is done.

Resolving patch:
diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py
--- a/src/registrar/config/settings.py
+++ b/src/registrar/config/settings.py
@@ -642,6 +642,7 @@
     "getgov-stable.app.cloud.gov",
     "getgov-staging.app.cloud.gov",
     "getgov-development.app.cloud.gov",
+    "getgov-cb.app.cloud.gov",
     "getgov-bob.app.cloud.gov",
     "getgov-meoward.app.cloud.gov",
     "getgov-backup.app.cloud.gov",


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Django admin: add "show more/show less" for status audit log trail
### Issue description

Add "show more/show less" for status audit log trail.  Position at the top, default to Shown, with a "More Details (Show/Hide)". 



### Acceptance criteria

- [ ] Add "show more/show less" for status audit log trail, position at top
- [ ] Set default to Shown (reference #1853)

### Additional context

This feature was identified in #1849 but not as an acceptance criteria. 

### Links to other issues

Relates to: #1849 


Discussion:

Resolving patch:
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -1013,7 +1013,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
         (
             "Show details",
             {
-                "classes": ["collapse--dotgov"],
+                "classes": ["collapse--dgfieldset"],
                 "description": "Extends type of organization",
                 "fields": [
                     "federal_type",
@@ -1039,7 +1039,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
         (
             "Show details",
             {
-                "classes": ["collapse--dotgov"],
+                "classes": ["collapse--dgfieldset"],
                 "description": "Extends organization name and mailing address",
                 "fields": [
                     "address_line1",
@@ -1266,7 +1266,7 @@ def custom_election_board(self, obj):
         (
             "Show details",
             {
-                "classes": ["collapse--dotgov"],
+                "classes": ["collapse--dgfieldset"],
                 "description": "Extends type of organization",
                 "fields": [
                     "federal_type",
@@ -1292,7 +1292,7 @@ def custom_election_board(self, obj):
         (
             "Show details",
             {
-                "classes": ["collapse--dotgov"],
+                "classes": ["collapse--dgfieldset"],
                 "description": "Extends organization name and mailing address",
                 "fields": [
                     "address_line1",


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Add documentation on models affecting or being affected by signals
### Issue description

We have code, especially for Users and Contacts that makes changes by using django signals. However this is very hard for new developers to find out as it's very buried in the code. The goal here is to make sure a new developer would easily know that we 1.) use signals. 2) where we use it. 3) how we use it. 4) when looking at the given model affected by the signal its clearly documented what is relying on the signal. 


### Acceptance criteria

- [ ] Add documentation in our developer readme (or a similiar readme) to explain that we are using signals on some models (answer why, how and where). 
- [ ] On models affecting or being affected by signals, add documentation on what is being changed by a signal and when (and any other useful info deemed worthwhile to add)

### Additional context

Discussed in engineer huddle on 4/8/2024. See [notes](https://docs.google.com/document/d/16S6VNKOYW2HI7bKwOwOdQzon5SZA0ZgkMkGfQHLZoTw/edit).

### Links to other issues

_No response_


Discussion:
Removed "pulled in" label since this is planned for the upcoming sprint (starting on 5/8).

Resolving patch:
diff --git a/src/registrar/models/contact.py b/src/registrar/models/contact.py
--- a/src/registrar/models/contact.py
+++ b/src/registrar/models/contact.py
@@ -6,7 +6,16 @@
 
 
 class Contact(TimeStampedModel):
-    """Contact information follows a similar pattern for each contact."""
+    """
+    Contact information follows a similar pattern for each contact.
+
+    This model uses signals [as defined in [signals.py](../../src/registrar/signals.py)].
+    When a new user is created through Login.gov, a contact object will be created and
+    associated on the `user` field.
+
+    If the `user` object already exists, the underlying user object
+    will be updated if any updates are made to it through Login.gov.
+    """
 
     user = models.OneToOneField(
         "registrar.User",
diff --git a/src/registrar/models/user.py b/src/registrar/models/user.py
--- a/src/registrar/models/user.py
+++ b/src/registrar/models/user.py
@@ -22,6 +22,13 @@ class User(AbstractUser):
     """
     A custom user model that performs identically to the default user model
     but can be customized later.
+
+    This model uses signals [as defined in [signals.py](../../src/registrar/signals.py)].
+    When a new user is created through Login.gov, a contact object will be created and
+    associated on the contacts `user` field.
+
+    If the `user` object already exists, said user object
+    will be updated if any updates are made to it through Login.gov.
     """
 
     class VerificationTypeChoices(models.TextChoices):


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Add summary box with user's profile information to Preamble
### Issue description

As part of the larger work around adding a user profile, we need to add a users contact information to the preamble when they start a new request. This info will be pulled from their user profile and shown as a summary box on the preamble

### Acceptance criteria

- [ ] on the preamble page: add another text section: Follow the [content and layout shown here](https://www.figma.com/file/xFtGLHVrhp0lvwh0gYWnbx/.gov-Designs-CISA?node-id=2247%3A70204&mode=dev)
- [ ] add a summary box that shows the users contact information ^ the above link shows this too (this should go off of the contact object linked with their user
- [ ] all the above should only show when the profile waffle flag is turned on (see #2054 and linked pr #2100) 

### Additional context

_No response_

### Links to other issues

Relates to #1808 (collapse creator/submitter design ticket)
Relates to: #1807 (implement user profile dev ticket)
Relates to #1585 (user profile design ticket)
Relates to #1573 (force invited domain manager to add contact info)
blocked by: #2054 


Discussion:

Resolving patch:
diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py
--- a/src/registrar/views/domain_request.py
+++ b/src/registrar/views/domain_request.py
@@ -230,7 +230,8 @@ def get(self, request, *args, **kwargs):
         context = self.get_context_data()
         if self.__class__ == DomainRequestWizard:
             if request.path_info == self.NEW_URL_NAME:
-                return render(request, "domain_request_intro.html", context)
+                context = self.get_context_data()
+                return render(request, "domain_request_intro.html", context=context)
             else:
                 return self.goto(self.steps.first)
 
@@ -386,7 +387,10 @@ def get_context_data(self):
         else:
             modal_heading = "You are about to submit an incomplete request"
 
-        return {
+        has_profile_flag = flag_is_active(self.request, "profile_feature")
+        logger.debug("PROFILE FLAG is %s" % has_profile_flag)
+
+        context = {
             "form_titles": self.TITLES,
             "steps": self.steps,
             # Add information about which steps should be unlocked
@@ -394,8 +398,11 @@ def get_context_data(self):
             "is_federal": self.domain_request.is_federal(),
             "modal_button": modal_button,
             "modal_heading": modal_heading,
-            "has_profile_feature_flag": flag_is_active(self.request, "profile_feature"),
+            # Use the profile waffle feature flag to toggle profile features throughout domain requests
+            "has_profile_feature_flag": has_profile_flag,
+            "user": self.request.user,
         }
+        return context
 
     def get_step_list(self) -> list:
         """Dynamically generated list of steps in the form wizard."""


Test patch:
Repository: cisagov/manage.get.gov

Issue:
(User profile) Remove Your Contact from the Domain Request flow 
### Issue description

We have added in user profile now, so we can remove YourContact on the Domain Request flow as users should now just enter it on their profile.

### Acceptance criteria

- [ ] Hide Your Contact on the Domain Request flow when the user profile flag is turned on
- [ ] Hide Your Contact from the review page
- [ ] Edit unit tests as needed but within reason. This is a WIP.

### Additional context

_No response_

### Links to other issues

_No response_


Discussion:

Resolving patch:
diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py
--- a/src/registrar/views/domain_request.py
+++ b/src/registrar/views/domain_request.py
@@ -22,7 +22,7 @@
     DomainRequestWizardPermissionView,
 )
 
-from waffle.decorators import flag_is_active
+from waffle.decorators import flag_is_active, waffle_flag
 
 logger = logging.getLogger(__name__)
 
@@ -406,6 +406,10 @@ def get_step_list(self) -> list:
                 condition = condition(self)
             if condition:
                 step_list.append(step)
+
+        if flag_is_active(self.request, "profile_feature"):
+            step_list.remove(Step.YOUR_CONTACT)
+
         return step_list
 
     def goto(self, step):
@@ -540,6 +544,10 @@ class YourContact(DomainRequestWizard):
     template_name = "domain_request_your_contact.html"
     forms = [forms.YourContactForm]
 
+    @waffle_flag("!profile_feature")  # type: ignore
+    def dispatch(self, request, *args, **kwargs):  # type: ignore
+        return super().dispatch(request, *args, **kwargs)
+
 
 class OtherContacts(DomainRequestWizard):
     template_name = "domain_request_other_contacts.html"


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Admin: Reorder options in the request "status" dropdown menu
### Issue description

Within Django admin: We need to slightly modify the order in which domain "statuses" are listed in the dropdown menu on a Domain Request page. It's currently too easy to accidentally click "Approved" during the review process. 

### Acceptance criteria

- [ ] Statuses in the dropdown menu reflect this order: 
  - In Review
  - Action Needed
  - Approved
  - Rejected
  - Ineligible
  - Submitted
  - Withdrawn
  - Started

### Additional context

[See slack thread](https://cisa-corp.slack.com/archives/C05BDEA3C11/p1712721335104159)

Only statuses applicable to the current state should be shown. (per normal operations)
Changing the order of the default list will change the list in the FSM.

### Links to other issues

_No response_


Discussion:
PO suggested timeline: 1-2 sprint from sprint 43.

Resolving patch:
diff --git a/src/registrar/migrations/0096_alter_domainrequest_status.py b/src/registrar/migrations/0096_alter_domainrequest_status.py
new file mode 100644
--- /dev/null
+++ b/src/registrar/migrations/0096_alter_domainrequest_status.py
@@ -0,0 +1,32 @@
+# Generated by Django 4.2.10 on 2024-06-04 00:00
+
+from django.db import migrations
+import django_fsm
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("registrar", "0095_user_middle_name_user_title"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="domainrequest",
+            name="status",
+            field=django_fsm.FSMField(
+                choices=[
+                    ("in review", "In review"),
+                    ("action needed", "Action needed"),
+                    ("approved", "Approved"),
+                    ("rejected", "Rejected"),
+                    ("ineligible", "Ineligible"),
+                    ("submitted", "Submitted"),
+                    ("withdrawn", "Withdrawn"),
+                    ("started", "Started"),
+                ],
+                default="started",
+                max_length=50,
+            ),
+        ),
+    ]
diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py
--- a/src/registrar/models/domain_request.py
+++ b/src/registrar/models/domain_request.py
@@ -34,14 +34,14 @@ class DomainRequest(TimeStampedModel):
 
     # Constants for choice fields
     class DomainRequestStatus(models.TextChoices):
-        STARTED = "started", "Started"
-        SUBMITTED = "submitted", "Submitted"
         IN_REVIEW = "in review", "In review"
         ACTION_NEEDED = "action needed", "Action needed"
         APPROVED = "approved", "Approved"
-        WITHDRAWN = "withdrawn", "Withdrawn"
         REJECTED = "rejected", "Rejected"
         INELIGIBLE = "ineligible", "Ineligible"
+        SUBMITTED = "submitted", "Submitted"
+        WITHDRAWN = "withdrawn", "Withdrawn"
+        STARTED = "started", "Started"
 
     class StateTerritoryChoices(models.TextChoices):
         ALABAMA = "AL", "Alabama (AL)"


Test patch:
Repository: cisagov/manage.get.gov

Issue:
In /admin, "Add Domain Invitation" function is broken, drop down is loading all 10K+ domains
### Current Behavior

The Add Domain Invitation function is essentially broken because the only way to locate a domain to add to is through a drop down that appears to try to load all 10k+ domains.

Note: the drop down works in Firefox, but quits/dies on Edge

Workaround: go to Manage Domain and then going to Domain Managers and adding them from there




### Expected Behavior

The Add Domain Invitation functions efficiently. Shows a combo textbox that provides a drop-down.

### Steps to Reproduce

1. In Microsoft Edge, as an analyst, navigate to manage.get.gov/admin/registrar/domaininvitation/
2. Click "Add"
3. Enter an email then select the Domain dropdown
4. Attempt to navigate the dropdown or select a domain not at the top of the list
5. The process should not complete. 
6. Retry in Firefox, it should be successful 


### Environment

Stable
Edge 

### Additional Context
1. This functionality is often needed to resolve issues where users have deleted their Login.gov accounts and when we have to reestablish trust with a new set of managers on a domain. 

Slack [discussion](https://cisa-corp.slack.com/archives/C06VDEWTGSH/p1715975812851809)

### Issue Links

_No response_


Discussion:

Resolving patch:
diff --git a/src/registrar/admin.py b/src/registrar/admin.py
--- a/src/registrar/admin.py
+++ b/src/registrar/admin.py
@@ -1149,6 +1149,8 @@ class Meta:
     # error.
     readonly_fields = ["status"]
 
+    autocomplete_fields = ["domain"]
+
     change_form_template = "django/admin/email_clipboard_change_form.html"
 
     # Select domain invitations to change -> Domain invitations


Test patch:
Repository: cisagov/manage.get.gov

Issue:
Don't filter the domain metadata report by `Ready`, `DNS needed`, or `On hold`
### Issue description

The [domain metadata report](https://github.com/cisagov/manage.get.gov/blob/bf1d5fad474eee3760ae5f8d06d6dc3eccd9ff88/src/registrar/utility/csv_export.py#L411-L415) that is available for download in the registrar and emailed to the team currently filtered out certain domain states. After using the report for awhile, I can see that having all domain states, including `Ready`, `DNS needed`, and `On hold` would be worthwhile.

### Acceptance criteria

- [x] Eliminate the filter that limits "Ready", "DNS needed", and "On hold" domains from showing up in the domain metadata report. All domains are included in the output file, regardless of status.

### Additional context

🔎 Clues at https://github.com/cisagov/manage.get.gov/blob/bf1d5fad474eee3760ae5f8d06d6dc3eccd9ff88/src/registrar/utility/csv_export.py#L411-L415

### Links to other issues

_No response_


Discussion:

Resolving patch:
diff --git a/src/registrar/utility/csv_export.py b/src/registrar/utility/csv_export.py
--- a/src/registrar/utility/csv_export.py
+++ b/src/registrar/utility/csv_export.py
@@ -381,6 +381,7 @@ def export_data_type_to_csv(csv_file):
     """
     All domains report with extra columns.
     This maps to the "All domain metadata" button.
+    Exports domains of all statuses.
     """
 
     writer = csv.writer(csv_file)
@@ -408,15 +409,8 @@ def export_data_type_to_csv(csv_file):
         "federal_agency",
         "domain__name",
     ]
-    filter_condition = {
-        "domain__state__in": [
-            Domain.State.READY,
-            Domain.State.DNS_NEEDED,
-            Domain.State.ON_HOLD,
-        ],
-    }
     write_csv_for_domains(
-        writer, columns, sort_fields, filter_condition, should_get_domain_managers=True, should_write_header=True
+        writer, columns, sort_fields, filter_condition={}, should_get_domain_managers=True, should_write_header=True
     )
 
 


Test patch:
Repository: huggingface/transformers

Issue:
Dropout Layer in OpenAIGPTMultipleChoiceHead not used
[OpenAIGPTMultipleChoiceHead](https://github.com/huggingface/pytorch-pretrained-BERT/blob/master/pytorch_pretrained_bert/modeling_openai.py#L363) defines an additional dropout layer, which is not used in `forward`.






Discussion:

Resolving patch:
diff --git a/pytorch_pretrained_bert/modeling_openai.py b/pytorch_pretrained_bert/modeling_openai.py
--- a/pytorch_pretrained_bert/modeling_openai.py
+++ b/pytorch_pretrained_bert/modeling_openai.py
@@ -374,6 +374,7 @@ def forward(self, hidden_states, mc_token_ids):
         # (bsz, num_choices, 1, hidden_size)
         multiple_choice_h = hidden_states.gather(2, mc_token_ids).squeeze(2)
         # (bsz, num_choices, hidden_size)
+        multiple_choice_h = self.dropout(multiple_choice_h.transpose(1, 2)).transpose(1, 2)
         multiple_choice_logits = self.linear(multiple_choice_h).squeeze(-1)
         # (bsz, num_choices)
         return multiple_choice_logits


Test patch:
Repository: huggingface/transformers

Issue:
New GPT2 tokenizer no longer encodes Unicode characters properly in Python 3
In commit 5afa497cbfc53c679a9b22997b6312fad57ee2f8, you changed `token.encode('utf-8')` to simply `token`.

This would make the code compatible with Python 2, but now it breaks in Python 3. You'll get a KeyError when you try to encode a Unicode character that requires more than 1 byte in UTF-8 encoding. For example, this raises a KeyError in Python 3:

```python
from pytorch_pretrained_bert.tokenization_gpt2 import GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
tokenizer.encode('你')
```

I think what you want to do is:

```python
if sys.version_info[0] == 2:
    token = ''.join(self.byte_encoder[ord(b)] for b in token)
else:
    token = ''.join(self.byte_encoder[b] for b in token.encode('utf-8'))
```


Discussion:

Resolving patch:
diff --git a/pytorch_pretrained_bert/tokenization_gpt2.py b/pytorch_pretrained_bert/tokenization_gpt2.py
--- a/pytorch_pretrained_bert/tokenization_gpt2.py
+++ b/pytorch_pretrained_bert/tokenization_gpt2.py
@@ -221,7 +221,10 @@ def tokenize(self, text):
         """ Tokenize a string. """
         bpe_tokens = []
         for token in re.findall(self.pat, text):
-            token = ''.join(self.byte_encoder[ord(b)] for b in token)
+            if sys.version_info[0] == 2:
+                token = ''.join(self.byte_encoder[ord(b)] for b in token)
+            else:
+                token = ''.join(self.byte_encoder[b] for b in token.encode('utf-8'))
             bpe_tokens.extend(bpe_token for bpe_token in self.bpe(token).split(' '))
         return bpe_tokens
 


Test patch:
Repository: huggingface/transformers

Issue:
 module 'torch.nn' has no attribute 'Identity'
Traceback (most recent call last):
  File "trainer.py", line 17, in <module>
    model = XLMForSequenceClassification(config)
  File "/home/ankit/anaconda3/lib/python3.6/site-packages/pytorch_transformers/modeling_xlm.py", line 823, in __init__
    self.sequence_summary = SequenceSummary(config)
  File "/home/ankit/anaconda3/lib/python3.6/site-packages/pytorch_transformers/modeling_utils.py", line 734, in __init__
    self.summary = nn.Identity()
AttributeError: module 'torch.nn' has no attribute 'Identity'



https://github.com/huggingface/pytorch-transformers/blob/2f869dc6651f9cf9253f4c5a43279027a0eccfc5/pytorch_transformers/modeling_utils.py#L734


Discussion:
This was added in PyTorch 1.1.0 (see [changelog here](https://github.com/pytorch/pytorch/tree/v1.1.0) :)

So I guess you just have to update your PyTorch version!

Resolving patch:
diff --git a/pytorch_transformers/modeling_utils.py b/pytorch_transformers/modeling_utils.py
--- a/pytorch_transformers/modeling_utils.py
+++ b/pytorch_transformers/modeling_utils.py
@@ -39,6 +39,20 @@
 TF_WEIGHTS_NAME = 'model.ckpt'
 
 
+try:
+    from torch.nn import Identity
+except ImportError:
+    # Older PyTorch compatibility
+    class Identity(nn.Module):
+        r"""A placeholder identity operator that is argument-insensitive.
+        """
+        def __init__(self, *args, **kwargs):
+            super(Identity, self).__init__()
+
+        def forward(self, input):
+            return input
+
+
 if not six.PY2:
     def add_start_docstrings(*docstr):
         def docstring_decorator(fn):
@@ -731,7 +745,7 @@ def __init__(self, config):
             # We can probably just use the multi-head attention module of PyTorch >=1.1.0
             raise NotImplementedError
 
-        self.summary = nn.Identity()
+        self.summary = Identity()
         if hasattr(config, 'summary_use_proj') and config.summary_use_proj:
             if hasattr(config, 'summary_proj_to_labels') and config.summary_proj_to_labels and config.num_labels > 0:
                 num_classes = config.num_labels
@@ -739,15 +753,15 @@ def __init__(self, config):
                 num_classes = config.hidden_size
             self.summary = nn.Linear(config.hidden_size, num_classes)
 
-        self.activation = nn.Identity()
+        self.activation = Identity()
         if hasattr(config, 'summary_activation') and config.summary_activation == 'tanh':
             self.activation = nn.Tanh()
 
-        self.first_dropout = nn.Identity()
+        self.first_dropout = Identity()
         if hasattr(config, 'summary_first_dropout') and config.summary_first_dropout > 0:
             self.first_dropout = nn.Dropout(config.summary_first_dropout)
 
-        self.last_dropout = nn.Identity()
+        self.last_dropout = Identity()
         if hasattr(config, 'summary_last_dropout') and config.summary_last_dropout > 0:
             self.last_dropout = nn.Dropout(config.summary_last_dropout)
 


Test patch: