internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ietf-tools/datatracker

Issue:
Nomcom years listed on announcement page are confusing
`type_defect`   |    by spencerdawkins.ietf@gmail.com

___


I happened to be looking at the past nomcom announcements this morning, and noticed that https://datatracker.ietf.org/nomcom/ann/#2012 says Messages from 2012/2014 - it should be Messages from 2012/2013.

___
_Issue migrated from trac:3419 at 2022-03-04 09:15:25 +0000_


Discussion:
_@rjsparks@nostrum.com_ _commented_


___
Spencer - the dates shown are when the nomcom was active - that is, from when it was opened until it was closed.

In this case, see <https://datatracker.ietf.org/group/nomcom2012/history/> and note that that nomcom was not closed until 2014. I don't remember why, but some archive spelunking might explain it.

You'll see this with other nomcoms as well, in particular, see <https://datatracker.ietf.org/group/nomcom2014/history/>

Perhaps, since the announcement page is talking about announcements, it could calculate the years of the first and last announcement sent instead.
_@rjsparks@nostrum.com_ _commented_


___
Some quick spelunking by the secretariat uncovers that both of those nomcoms were awakened to fill mid-term vacancies. The dates are probably proper as is. Thoughts?
_@spencerdawkins.ietf@gmail.com_ _commented_


___
Dear Robert and Secretariat - thank you for poking at this, because I learned a fair amount poking at the places you poked. 

Thanks especially for pointing me at the 2014/2017(!!!) Nomcom - I was looking specifically at the 2012 and 2013 Nomcom entries, and 2014/2017 is a lot more borked than 2012/2014. 

I have thoughts - please see whether they qualify as helpful thoughts. 

(Full disclosure - I remember the 2012 Nomcom well, because they ended up putting me on the IESG :-) - details at https://datatracker.ietf.org/nomcom/ann/56850/)

I think either showing each Nomcom with its opened date from the datatracker, or with its first and last announcement sent dates, would be more helpful than showing each Nomcom with its opened and closed dates.

I can't imagine what the 2014/? Nomcom would have been doing after they announced Leslie on 
2015-06-15, that would have lasted until 2017!
_@spencerdawkins.ietf@gmail.com_ changed _comment0 which not transferred by tractive
_@rjsparks@nostrum.com_ _changed status from `new` to `accepted`_
Would it be clear "enough" if instead of saying things like `Messages from 2022/2023` we used `Messages from 2022 Nomcom` ?  That is, we only list the year that the nomcom was started.


Resolving patch:
diff --git a/ietf/nomcom/views.py b/ietf/nomcom/views.py
--- a/ietf/nomcom/views.py
+++ b/ietf/nomcom/views.py
@@ -57,7 +57,7 @@ def index(request):
     for nomcom in nomcom_list:
         year = int(nomcom.acronym[6:])
         nomcom.year = year
-        nomcom.label = "%s/%s" % (year, year+1)
+        nomcom.label = str(year)
         if year > 2012:
             nomcom.url = "/nomcom/%04d" % year
         else:


Test patch:
Repository: ietf-tools/datatracker

Issue:
Scheduling an interim
### What happened?

When a chair is logged in, the 'meetings' menu has no option to schedule an interim meeting; instead, they need to open the 'documents' tab and select 'xxxx wg meetings'.

It'd make a lot more sense if the 'xxxx wg meetings' was under the 'meetings' menu, rather than the 'documents' menu.


### What browser(s) are you seeing the problem on?

Not Applicable

### Code of Conduct

- [X] I agree to follow the IETF's Code of Conduct


Discussion:
See also #4005

Resolving patch:
diff --git a/ietf/meeting/templatetags/meetings_filters.py b/ietf/meeting/templatetags/meetings_filters.py
new file mode 100644
--- /dev/null
+++ b/ietf/meeting/templatetags/meetings_filters.py
@@ -0,0 +1,21 @@
+# Copyright The IETF Trust 2023, All Rights Reserved
+# -*- coding: utf-8 -*-
+
+from django import template
+from ietf.meeting.helpers import can_request_interim_meeting
+
+import debug                            # pyflakes:ignore
+
+register = template.Library()
+
+@register.filter
+def can_request_interim(user):
+    """Determine whether the user can request an interim meeting
+
+    Usage: can_request_interim
+        Returns Boolean. True means user can request an interim meeting.
+    """
+
+    if not user:
+        return False
+    return can_request_interim_meeting(user)


Test patch:
Repository: ietf-tools/datatracker

Issue:
Double entries for RFCs in group documents list on feat/rfc
### Describe the issue

RFC documents are listed twice in the last section of the group documents page. They appear once for the RFC and once for the draft that became that RFC. These should be merged into a single entry.

@kivinen 

### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:
This appears only to be in the "Related Internet-Drafts" section. Production shows RFCs in this section - it is mislabeled.

Resolving patch:
diff --git a/ietf/group/views.py b/ietf/group/views.py
--- a/ietf/group/views.py
+++ b/ietf/group/views.py
@@ -469,8 +469,8 @@ def prepare_group_documents(request, group, clist):
         # non-WG drafts and call for WG adoption are considered related
         if (d.group != group
             or (d.stream_id and d.get_state_slug("draft-stream-%s" % d.stream_id) in ("c-adopt", "wg-cand"))):
-            if d.get_state_slug() != "expired":
-                d.search_heading = "Related Internet-Draft"
+            if (d.type_id == "draft" and d.get_state_slug() not in ["expired","rfc"]) or d.type_id == "rfc":
+                d.search_heading = "Related Internet-Drafts and RFCs"
                 docs_related.append(d)
         else:
             if not (d.get_state_slug('draft-iesg') == "dead" or (d.stream_id and d.get_state_slug("draft-stream-%s" % d.stream_id) == "dead")):


Test patch:
Repository: ietf-tools/datatracker

Issue:
[dt-rfc] Non existing draft or RFC raises attribute error
### Describe the issue

In dt-rfc branch, the API call `/api/rfcdiff-latest-json/` for a non-existing draft/RFC generates an attribute error.

Example:
* https://dt-rfc.dev.ietf.org/api/rfcdiff-latest-json/rfc9999
* https://dt-rfc.dev.ietf.org/api/rfcdiff-latest-json/draft-ftie-foo-bar-00

### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:

Resolving patch:
diff --git a/ietf/api/views.py b/ietf/api/views.py
--- a/ietf/api/views.py
+++ b/ietf/api/views.py
@@ -327,7 +327,7 @@ def get_previous_url(name, rev=None):
 def rfcdiff_latest_json(request, name, rev=None):
     response = dict()
     condition, document, history, found_rev = find_doc_for_rfcdiff(name, rev)
-    if document.type_id == "rfc":
+    if document and document.type_id == "rfc":
         draft = document.came_from_draft()
     if condition == 'no such document':
         raise Http404


Test patch:
diff --git a/ietf/api/tests.py b/ietf/api/tests.py
--- a/ietf/api/tests.py
+++ b/ietf/api/tests.py
@@ -1080,3 +1080,9 @@ def test_rfc_with_broken_history(self):
         # tricky draft names
         self.do_rfc_with_broken_history_test(draft_name='draft-gizmo-01')
         self.do_rfc_with_broken_history_test(draft_name='draft-oh-boy-what-a-draft-02-03')
+
+    def test_no_such_document(self):
+        for name in ['rfc0000', 'draft-ftei-oof-rab-00']:
+            url = urlreverse(self.target_view, kwargs={'name': name})
+            r = self.client.get(url)
+            self.assertEqual(r.status_code, 404)
Repository: ietf-tools/datatracker

Issue:
Assertions in AgendaFilterOrganizer do not account for GroupHistory
### Describe the issue

A pair of `log.assertion()` guards in `AgendaFilterOrganizer._group_filter_headings()` sound an alarm if the number of groups (or group parents) does not match the number of distinct acronyms. The intention is to alert the admins of a collision between group acronyms. However, the group list is generated using `Session.group_at_the_time()`, which can return either a `Group` or a `GroupHistory`. If a group has sessions both before and after a change, then it appears in the group list as both a `Group` and a `GroupHistory` and is double-counted, causing the assertion to fail.

This occurred on 2023-11-21 because a change in the chairs for the ntfsv4 group occurred on the day of an interim meeting for the group. Visits to the upcoming meeting page triggered the assertion.

This cannot affect an IETF meeting because all sessions in a meeting use the meeting start to calculate their `group_at_the_time` so will always agree on either a `Group` or a `GroupHistory`.

To fix this, the assertion logic needs to recognize when a `GroupHistory` and a `Group` refer to the same group.

### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:

Resolving patch:
diff --git a/ietf/meeting/helpers.py b/ietf/meeting/helpers.py
--- a/ietf/meeting/helpers.py
+++ b/ietf/meeting/helpers.py
@@ -317,10 +317,21 @@ def _group_filter_headings(self):
         groups = set(self._get_group(s) for s in self.sessions
                      if s
                      and self._get_group(s))
-        log.assertion('len(groups) == len(set(g.acronym for g in groups))')  # no repeated acros
+        # Verify that we're not using the same acronym for more than one distinct group, accounting for
+        # the possibility that some groups are GroupHistory instances. This assertion will fail if a Group
+        # and GroupHistory for the same group have a different acronym - in that event, the filter will
+        # not match the meeting display, so we should be alerted that this has actually occurred.
+        log.assertion(
+            "len(set(getattr(g, 'group_id', g.id) for g in groups)) "
+            "== len(set(g.acronym for g in groups))"
+        )
 
         group_parents = set(self._get_group_parent(g) for g in groups if self._get_group_parent(g))
-        log.assertion('len(group_parents) == len(set(gp.acronym for gp in group_parents))')  # no repeated acros
+        # See above for explanation of this assertion
+        log.assertion(
+            "len(set(getattr(gp, 'group_id', gp.id) for gp in group_parents)) "
+            "== len(set(gp.acronym for gp in group_parents))"
+        )
 
         all_groups = groups.union(group_parents)
         all_groups.difference_update([g for g in all_groups if g.acronym in self.exclude_acronyms])


Test patch:
Repository: ietf-tools/datatracker

Issue:
feat/rfc - older rfcs with incomplete/incorrect DocHistory won't show the last draft before the rfc is published where main does
https://datatracker.ietf.org/doc/draft-klensin-rfc2821bis/11/ shows a draft

https://dt-rfc.dev.ietf.org/doc/draft-klensin-rfc2821bis/11/
redirects to RFC5321

The existing datatracker behavior should be preserved until improvements related to #6059 and the tree of issues mentioned there are made.


Discussion:

Resolving patch:
diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py
--- a/ietf/doc/views_doc.py
+++ b/ietf/doc/views_doc.py
@@ -210,8 +210,8 @@ def document_main(request, name, rev=None, document_html=False):
     snapshot = False
 
     gh = None
-    if rev:
-        # find the entry in the history
+    if rev and rev != doc.rev:
+        # find the entry in the history if the rev requested is not the current rev
         for h in doc.history_set.order_by("-time"):
             if rev == h.rev:
                 snapshot = True


Test patch:
Repository: ietf-tools/datatracker

Issue:
wrap weasyprint to catch exceptions
A recent network issue caused weasyprint to fail to fetch some font information from the static site.

At weasyprint/urls.py#L249 a URLFetching error was raised trying to retrieve https://static.ietf.org/fonts/noto-sans-mono/import.css (the fetch returned a 502 Bad Gateway).

The library is called in the pdfized() call at doc/views_doc.py#L977 -> doc/models.py#L641 call to wpHTML





Discussion:

Resolving patch:
diff --git a/ietf/doc/models.py b/ietf/doc/models.py
--- a/ietf/doc/models.py
+++ b/ietf/doc/models.py
@@ -634,6 +634,9 @@ def pdfized(self):
                 )
             except AssertionError:
                 pdf = None
+            except Exception as e:
+                log.log('weasyprint failed:'+str(e))
+                raise
             if pdf:
                 cache.set(cache_key, pdf, settings.PDFIZER_CACHE_TIME)
         return pdf
diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py
--- a/ietf/doc/views_doc.py
+++ b/ietf/doc/views_doc.py
@@ -51,7 +51,6 @@
 from django import forms
 from django.contrib.staticfiles import finders
 
-
 import debug                            # pyflakes:ignore
 
 from ietf.doc.models import ( Document, DocHistory, DocEvent, BallotDocEvent, BallotType,
@@ -1064,7 +1063,10 @@ def document_pdfized(request, name, rev=None, ext=None):
     if not os.path.exists(doc.get_file_name()):
         raise Http404("File not found: %s" % doc.get_file_name())
 
-    pdf = doc.pdfized()
+    try:
+        pdf = doc.pdfized()
+    except Exception:
+        return render(request, "doc/weasyprint_failed.html")
     if pdf:
         return HttpResponse(pdf,content_type='application/pdf')
     else:


Test patch:
diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py
--- a/ietf/doc/tests.py
+++ b/ietf/doc/tests.py
@@ -1,4 +1,4 @@
-# Copyright The IETF Trust 2012-2020, All Rights Reserved
+# Copyright The IETF Trust 2012-2023, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 
@@ -31,6 +31,8 @@
 
 from tastypie.test import ResourceTestCaseMixin
 
+from weasyprint.urls import URLFetchingError
+
 import debug                            # pyflakes:ignore
 
 from ietf.doc.models import ( Document, DocRelationshipName, RelatedDocument, State,
@@ -2844,6 +2846,12 @@ def test_pdfized(self):
                 self.should_succeed(dict(name=draft.name,rev=f'{r:02d}',ext=ext))
         self.should_404(dict(name=draft.name,rev='02'))
 
+        with mock.patch('ietf.doc.models.DocumentInfo.pdfized', side_effect=URLFetchingError):
+            url = urlreverse(self.view, kwargs=dict(name=rfc.name))
+            r = self.client.get(url)
+            self.assertEqual(r.status_code, 200)
+            self.assertContains(r, "Error while rendering PDF")
+
 class NotifyValidationTests(TestCase):
     def test_notify_validation(self):
         valid_values = [
Repository: ietf-tools/datatracker

Issue:
interim_send_announcement doesn't display form errors
A change that went into 11.11.0 caused browsers to submit a POST that would always be invalid to the view. The view code raised some validation errors and re-displayed the form, but the template didn't render the errors to the user.


Discussion:
شكرا

Resolving patch:
diff --git a/ietf/meeting/forms.py b/ietf/meeting/forms.py
--- a/ietf/meeting/forms.py
+++ b/ietf/meeting/forms.py
@@ -1,4 +1,4 @@
-# Copyright The IETF Trust 2016-2020, All Rights Reserved
+# Copyright The IETF Trust 2016-2023, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 
@@ -361,7 +361,13 @@ def save_agenda(self):
 class InterimAnnounceForm(forms.ModelForm):
     class Meta:
         model = Message
-        fields = ('to', 'frm', 'cc', 'bcc', 'reply_to', 'subject', 'body')
+        fields = ('to', 'cc', 'frm', 'subject', 'body')
+
+    def __init__(self, *args, **kwargs):
+        super(InterimAnnounceForm, self).__init__(*args, **kwargs)
+        self.fields['frm'].label='From'
+        self.fields['frm'].widget.attrs['readonly'] = True
+        self.fields['to'].widget.attrs['readonly'] = True
 
     def save(self, *args, **kwargs):
         user = kwargs.pop('user')


Test patch:
Repository: ietf-tools/datatracker

Issue:
AssertionError "rev is None" in fuzzy_find_documents() after feat/rfc deployment
### Describe the issue

After deploying v12.0.0, a call to `document_pdfized()` led to a failed assertion in `fuzzy_find_documents()`

The offending parameters were `{'name': 'rfc4231', 'rev': '02'}`

Traceback in a screenshot here because I don't have a better way to copy/paste at the moment
<img width="902" alt="image" src="https://github.com/ietf-tools/datatracker/assets/19472766/68a50cd4-9578-4399-8ef4-3ca5e4ce357c">


### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:
also seeing:
`{'name': 'rfcdraft-ietf-httpbis-cookie-alone', 'rev': '01'}`
I think the log.assertion was a mistake - this code deals with strings provided directly in urls which may be nonsense, and it should just not find anything matching the nonsense.



Resolving patch:
diff --git a/ietf/doc/utils.py b/ietf/doc/utils.py
--- a/ietf/doc/utils.py
+++ b/ietf/doc/utils.py
@@ -1209,14 +1209,15 @@ def fuzzy_find_documents(name, rev=None):
 
     if name.startswith("rfc"):
         sought_type = "rfc"
-        log.assertion("rev is None")
+        name = name.split("-")[0] # strip any noise (like a revision) at and after the first hyphen
+        rev = None # If someone is looking for an RFC and supplies a version, ignore it.
     else:
         sought_type = "draft"
 
     # see if we can find a document using this name
     docs = Document.objects.filter(name=name, type_id=sought_type)
-    if rev and not docs.exists():
-        # No document found, see if the name/rev split has been misidentified.
+    if sought_type == "draft" and rev and not docs.exists():
+        # No draft found, see if the name/rev split has been misidentified.
         # Handles some special cases, like draft-ietf-tsvwg-ieee-802-11.
         name = '%s-%s' % (name, rev)
         docs = Document.objects.filter(name=name, type_id='draft')


Test patch:
diff --git a/ietf/doc/tests_utils.py b/ietf/doc/tests_utils.py
--- a/ietf/doc/tests_utils.py
+++ b/ietf/doc/tests_utils.py
@@ -309,6 +309,12 @@ def do_fuzzy_find_documents_rfc_test(self, name):
         found = fuzzy_find_documents(draft.name, '22')
         self.assertCountEqual(found.documents, [draft],
                               'Should find document even if rev does not exist')
+        
+        # by rfc name mistakenly trying to provide a revision
+        found = fuzzy_find_documents(rfc.name+"-22")
+        self.assertCountEqual(found.documents, [rfc], "Should ignore versions when fuzzyfinding RFCs" )
+        found = fuzzy_find_documents(rfc.name,"22")
+        self.assertCountEqual(found.documents, [rfc], "Should ignore versions when fuzzyfinding RFCs" )
 
 
     def test_fuzzy_find_documents(self):
Repository: ietf-tools/datatracker

Issue:
BCP references mislabeled as "possible downref"
### Describe the issue

The references for RFC 9514 (and others - no particularly relevant reason to single this one out) includes two normative references to BCPs, both labeled as "Possible Downref". Prior to the feat/rfc (v12.0.0) release, these had no downref noted at all.

Wild guess is that the "Possible Downref" is noticing that the target of the ref is not of `type_id='rfc'`

### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:

Resolving patch:
diff --git a/ietf/doc/models.py b/ietf/doc/models.py
--- a/ietf/doc/models.py
+++ b/ietf/doc/models.py
@@ -700,6 +700,8 @@ def is_downref(self):
 
         if self.source.type_id == "rfc":
             source_lvl = self.source.std_level_id
+        elif self.source.type_id in ["bcp","std"]:
+            source_lvl = self.source.type_id
         else:
             source_lvl = self.source.intended_std_level_id
 
@@ -711,6 +713,8 @@ def is_downref(self):
                 target_lvl = 'unkn'
             else:
                 target_lvl = self.target.std_level_id
+        elif self.target.type_id in ["bcp", "std"]:
+            target_lvl = self.target.type_id
         else:
             if not self.target.intended_std_level:
                 target_lvl = 'unkn'


Test patch:
Repository: ietf-tools/datatracker

Issue:
RFCs are listed twice on https://datatracker.ietf.org/stream/ise/
### Describe the issue

Some RFCs seem to be listed twice on https://datatracker.ietf.org/stream/ise/, e.g., 9361 and 9367.

### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:

Resolving patch:
diff --git a/ietf/group/views.py b/ietf/group/views.py
--- a/ietf/group/views.py
+++ b/ietf/group/views.py
@@ -1296,7 +1296,7 @@ def stream_documents(request, acronym):
     qs = Document.objects.filter(stream=acronym).filter(
         Q(type_id="draft", states__type="draft", states__slug="active")
         | Q(type_id="rfc")
-    )
+    ).distinct()
     docs, meta = prepare_document_table(request, qs, max_results=1000)
     return render(request, 'group/stream_documents.html', {'stream':stream, 'docs':docs, 'meta':meta, 'editable':editable } )
 


Test patch:
Repository: ietf-tools/datatracker

Issue:
Duplicate rows on the referencedBy page
### Describe the issue

At https://dt-main.dev.ietf.org/doc/rfc2784/referencedby/ there are currently three identical rows for the reference from RFC 9378. There should be only one.

<img width="817" alt="screenshot showing three rows labeled 'RFC 9378'" src="https://github.com/ietf-tools/datatracker/assets/19472766/2710e2e6-e3d8-4b0c-b145-188d17549910">


### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:
I don't see this on `main` on my local dev instance?
How recent is your db snapshot? I think this is similar to 6802 and will probably show or not depending on how events were migrated (or not) and whether the `rfc-editor-index-update` script has run.

Resolving patch:
diff --git a/ietf/doc/models.py b/ietf/doc/models.py
--- a/ietf/doc/models.py
+++ b/ietf/doc/models.py
@@ -649,7 +649,7 @@ def referenced_by(self):
                 source__states__slug="active",
             )
             | models.Q(source__type__slug="rfc")
-        )
+        ).distinct()
     
     def referenced_by_rfcs(self):
         """Get refs to this doc from RFCs"""


Test patch: