We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`/merges` entries should be displayed in descending order
<!-- What problem are we solving? What does the experience look like today? What are the symptoms? -->
Today, entries in all `/merges` views are displayed in order of `created` timestamp, ascending.  They should instead by ordered by `created` timestamp, __descending__.

### Evidence / Screenshot (if possible)

### Relevant url?
<!-- `https://openlibrary.org/...` -->
https://openlibrary.org/merges

### Steps to Reproduce
<!-- What steps caused you to find the bug? -->
1. Go to any `/merges` view.
2. Note the order of the merge requests in the table.

<!-- What actually happened after these steps? What did you expect to happen? -->
* Actual: Entries are listed from oldest to newest.
* Expected: Entries are listed from newest to oldest.

### Details

- **Logged in (Y/N)?**N
- **Browser type/version?**Any
- **Operating system?** Any
- **Environment (prod/dev/local)?** prod
<!-- If not sure, put prod -->

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->
When we fetch the requests for the `/merges` table, we should pass `order='created desc'` to the `CommunityEditsQueue.get_requests()` call.

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->
`/merges` controller is in [/openlibrary/plugins/upstream/edits.py](https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/upstream/edits.py)

### Stakeholders
<!-- @ tag stakeholders of this bug -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `openlibrary/plugins/upstream/edits.py`
Content:
```
1 """Librarian Edits
2 """
3 
4 import json
5 import web
6 
7 from openlibrary import accounts
8 from openlibrary.core.edits import CommunityEditsQueue, get_status_for_view
9 from infogami.utils import delegate
10 from infogami.utils.view import render_template
11 
12 
13 def create_request(olids: str, username: str, comment: str = None):
14     work_ids = olids.split(',')
15     return CommunityEditsQueue.submit_work_merge_request(
16         work_ids,
17         submitter=username,
18         comment=comment,
19     )
20 
21 
22 class community_edits_queue(delegate.page):
23     path = '/merges'
24 
25     def POST(self):
26         def response(status='ok', **kwargs):
27             return {'status': status, **kwargs}
28 
29         i = web.input(
30             work_ids="",  # Comma-separated OLIDs (OL1W,OL2W,OL3W,...,OL111W)
31             rtype="merge-works",
32             mrid=None,
33             action=None,  # create, approve, decline, comment, unassign
34             comment=None,
35         )
36         user = accounts.get_current_user()
37         username = user['key'].split('/')[-1]
38         if i.mrid:  # We are updating an existing merge request
39             if i.action == 'comment':
40                 if i.comment:
41                     CommunityEditsQueue.comment_request(i.mrid, username, i.comment)
42                     return delegate.RawText(
43                         json.dumps(response()), content_type="application/json"
44                     )
45                 else:
46                     return delegate.RawText(
47                         json.dumps(
48                             response(
49                                 status='error', error='No comment sent in request.'
50                             )
51                         )
52                     )
53             elif i.action == 'claim':
54                 result = CommunityEditsQueue.assign_request(i.mrid, username)
55                 return delegate.RawText(
56                     json.dumps(response(**result)), content_type="application/json"
57                 )
58             elif i.action == 'unassign':
59                 CommunityEditsQueue.unassign_request(i.mrid)
60                 status = get_status_for_view(CommunityEditsQueue.STATUS['PENDING'])
61                 return delegate.RawText(json.dumps(response(newStatus=status)))
62             else:
63                 if i.action == "decline":
64                     status = CommunityEditsQueue.STATUS['DECLINED']
65                 elif i.action == 'approve':
66                     status = CommunityEditsQueue.STATUS['MERGED']
67                 CommunityEditsQueue.update_request_status(
68                     i.mrid, status, username, comment=i.comment
69                 )
70                 return delegate.RawText(
71                     json.dumps(response()), content_type="application/json"
72                 )
73         elif i.rtype == "merge-works":
74             if i.action == 'create':
75                 result = create_request(i.work_ids, username, i.comment)
76                 resp = (
77                     response(id=result)
78                     if result
79                     else response(
80                         status='error',
81                         error='A request to merge these works has already been submitted.',
82                     )
83                 )
84                 return delegate.RawText(
85                     json.dumps(resp), content_type="application/json"
86                 )
87 
88     def GET(self):
89         i = web.input(page=1, limit=25, mode="open", submitter=None, reviewer=None)
90         merge_requests = CommunityEditsQueue.get_requests(
91             page=int(i.page),
92             limit=int(i.limit),
93             mode=i.mode,
94             submitter=i.submitter,
95             reviewer=i.reviewer,
96             order='created',
97         ).list()
98         enriched_requests = self.enrich(merge_requests)
99         total_found = CommunityEditsQueue.get_counts_by_mode(
100             mode=i.mode, submitter=i.submitter, reviewer=i.reviewer
101         )
102         return render_template(
103             'merge_queue/merge_queue',
104             total_found,
105             merge_requests=enriched_requests,
106         )
107 
108     def enrich(self, merge_requests):
109         results = []
110         for r in merge_requests:
111             comments = r['comments']
112             obj = {
113                 'id': r['id'],
114                 'submitter': r['submitter'],
115                 'reviewer': r['reviewer'],
116                 'url': r['url'],
117                 'status': r['status'],
118                 'comments': (comments and comments.get('comments')) or [],
119                 'created': r['created'],
120                 'updated': r['updated'],
121             }
122             olids = self.extract_olids(r['url'])
123             obj['title'] = ''
124             for olid in olids:
125                 book = web.ctx.site.get(f'/works/{olid}')
126                 if book:
127                     if not obj['title']:
128                         obj['title'] = book.title
129                         break
130 
131             results.append(obj)
132         return results
133 
134     def extract_olids(self, url):
135         query_string = url.split('?')[1]
136         split_params = query_string.split('&')
137         params = {}
138         for p in split_params:
139             kv = p.split('=')
140             params[kv[0]] = kv[1]
141         return params['records'].split(',')
142 
143 
144 class ui_partials(delegate.page):
145     path = '/merges/partials'
146 
147     def GET(self):
148         i = web.input(type=None, comment='')
149         if i.type == 'comment':
150             component = render_template('merge_queue/comment', comment_str=i.comment)
151             return delegate.RawText(component)
152 
153 
154 def setup():
155     pass
156
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/openlibrary/plugins/upstream/edits.py b/openlibrary/plugins/upstream/edits.py
--- a/openlibrary/plugins/upstream/edits.py
+++ b/openlibrary/plugins/upstream/edits.py
@@ -93,7 +93,7 @@
             mode=i.mode,
             submitter=i.submitter,
             reviewer=i.reviewer,
-            order='created',
+            order='created desc',
         ).list()
         enriched_requests = self.enrich(merge_requests)
         total_found = CommunityEditsQueue.get_counts_by_mode(

{"golden_diff": "diff --git a/openlibrary/plugins/upstream/edits.py b/openlibrary/plugins/upstream/edits.py\n--- a/openlibrary/plugins/upstream/edits.py\n+++ b/openlibrary/plugins/upstream/edits.py\n@@ -93,7 +93,7 @@\n             mode=i.mode,\n             submitter=i.submitter,\n             reviewer=i.reviewer,\n-            order='created',\n+            order='created desc',\n         ).list()\n         enriched_requests = self.enrich(merge_requests)\n         total_found = CommunityEditsQueue.get_counts_by_mode(\n", "issue": "`/merges` entries should be displayed in descending order\n<!-- What problem are we solving? What does the experience look like today? What are the symptoms? -->\r\nToday, entries in all `/merges` views are displayed in order of `created` timestamp, ascending.  They should instead by ordered by `created` timestamp, __descending__.\r\n\r\n### Evidence / Screenshot (if possible)\r\n\r\n### Relevant url?\r\n<!-- `https://openlibrary.org/...` -->\r\nhttps://openlibrary.org/merges\r\n\r\n### Steps to Reproduce\r\n<!-- What steps caused you to find the bug? -->\r\n1. Go to any `/merges` view.\r\n2. Note the order of the merge requests in the table.\r\n\r\n<!-- What actually happened after these steps? What did you expect to happen? -->\r\n* Actual: Entries are listed from oldest to newest.\r\n* Expected: Entries are listed from newest to oldest.\r\n\r\n### Details\r\n\r\n- **Logged in (Y/N)?**N\r\n- **Browser type/version?**Any\r\n- **Operating system?** Any\r\n- **Environment (prod/dev/local)?** prod\r\n<!-- If not sure, put prod -->\r\n\r\n### Proposal & Constraints\r\n<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->\r\nWhen we fetch the requests for the `/merges` table, we should pass `order='created desc'` to the `CommunityEditsQueue.get_requests()` call.\r\n\r\n### Related files\r\n<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->\r\n`/merges` controller is in [/openlibrary/plugins/upstream/edits.py](https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/upstream/edits.py)\r\n\r\n### Stakeholders\r\n<!-- @ tag stakeholders of this bug -->\r\n\n", "before_files": [{"content": "\"\"\"Librarian Edits\n\"\"\"\n\nimport json\nimport web\n\nfrom openlibrary import accounts\nfrom openlibrary.core.edits import CommunityEditsQueue, get_status_for_view\nfrom infogami.utils import delegate\nfrom infogami.utils.view import render_template\n\n\ndef create_request(olids: str, username: str, comment: str = None):\n    work_ids = olids.split(',')\n    return CommunityEditsQueue.submit_work_merge_request(\n        work_ids,\n        submitter=username,\n        comment=comment,\n    )\n\n\nclass community_edits_queue(delegate.page):\n    path = '/merges'\n\n    def POST(self):\n        def response(status='ok', **kwargs):\n            return {'status': status, **kwargs}\n\n        i = web.input(\n            work_ids=\"\",  # Comma-separated OLIDs (OL1W,OL2W,OL3W,...,OL111W)\n            rtype=\"merge-works\",\n            mrid=None,\n            action=None,  # create, approve, decline, comment, unassign\n            comment=None,\n        )\n        user = accounts.get_current_user()\n        username = user['key'].split('/')[-1]\n        if i.mrid:  # We are updating an existing merge request\n            if i.action == 'comment':\n                if i.comment:\n                    CommunityEditsQueue.comment_request(i.mrid, username, i.comment)\n                    return delegate.RawText(\n                        json.dumps(response()), content_type=\"application/json\"\n                    )\n                else:\n                    return delegate.RawText(\n                        json.dumps(\n                            response(\n                                status='error', error='No comment sent in request.'\n                            )\n                        )\n                    )\n            elif i.action == 'claim':\n                result = CommunityEditsQueue.assign_request(i.mrid, username)\n                return delegate.RawText(\n                    json.dumps(response(**result)), content_type=\"application/json\"\n                )\n            elif i.action == 'unassign':\n                CommunityEditsQueue.unassign_request(i.mrid)\n                status = get_status_for_view(CommunityEditsQueue.STATUS['PENDING'])\n                return delegate.RawText(json.dumps(response(newStatus=status)))\n            else:\n                if i.action == \"decline\":\n                    status = CommunityEditsQueue.STATUS['DECLINED']\n                elif i.action == 'approve':\n                    status = CommunityEditsQueue.STATUS['MERGED']\n                CommunityEditsQueue.update_request_status(\n                    i.mrid, status, username, comment=i.comment\n                )\n                return delegate.RawText(\n                    json.dumps(response()), content_type=\"application/json\"\n                )\n        elif i.rtype == \"merge-works\":\n            if i.action == 'create':\n                result = create_request(i.work_ids, username, i.comment)\n                resp = (\n                    response(id=result)\n                    if result\n                    else response(\n                        status='error',\n                        error='A request to merge these works has already been submitted.',\n                    )\n                )\n                return delegate.RawText(\n                    json.dumps(resp), content_type=\"application/json\"\n                )\n\n    def GET(self):\n        i = web.input(page=1, limit=25, mode=\"open\", submitter=None, reviewer=None)\n        merge_requests = CommunityEditsQueue.get_requests(\n            page=int(i.page),\n            limit=int(i.limit),\n            mode=i.mode,\n            submitter=i.submitter,\n            reviewer=i.reviewer,\n            order='created',\n        ).list()\n        enriched_requests = self.enrich(merge_requests)\n        total_found = CommunityEditsQueue.get_counts_by_mode(\n            mode=i.mode, submitter=i.submitter, reviewer=i.reviewer\n        )\n        return render_template(\n            'merge_queue/merge_queue',\n            total_found,\n            merge_requests=enriched_requests,\n        )\n\n    def enrich(self, merge_requests):\n        results = []\n        for r in merge_requests:\n            comments = r['comments']\n            obj = {\n                'id': r['id'],\n                'submitter': r['submitter'],\n                'reviewer': r['reviewer'],\n                'url': r['url'],\n                'status': r['status'],\n                'comments': (comments and comments.get('comments')) or [],\n                'created': r['created'],\n                'updated': r['updated'],\n            }\n            olids = self.extract_olids(r['url'])\n            obj['title'] = ''\n            for olid in olids:\n                book = web.ctx.site.get(f'/works/{olid}')\n                if book:\n                    if not obj['title']:\n                        obj['title'] = book.title\n                        break\n\n            results.append(obj)\n        return results\n\n    def extract_olids(self, url):\n        query_string = url.split('?')[1]\n        split_params = query_string.split('&')\n        params = {}\n        for p in split_params:\n            kv = p.split('=')\n            params[kv[0]] = kv[1]\n        return params['records'].split(',')\n\n\nclass ui_partials(delegate.page):\n    path = '/merges/partials'\n\n    def GET(self):\n        i = web.input(type=None, comment='')\n        if i.type == 'comment':\n            component = render_template('merge_queue/comment', comment_str=i.comment)\n            return delegate.RawText(component)\n\n\ndef setup():\n    pass\n", "path": "openlibrary/plugins/upstream/edits.py"}], "after_files": [{"content": "\"\"\"Librarian Edits\n\"\"\"\n\nimport json\nimport web\n\nfrom openlibrary import accounts\nfrom openlibrary.core.edits import CommunityEditsQueue, get_status_for_view\nfrom infogami.utils import delegate\nfrom infogami.utils.view import render_template\n\n\ndef create_request(olids: str, username: str, comment: str = None):\n    work_ids = olids.split(',')\n    return CommunityEditsQueue.submit_work_merge_request(\n        work_ids,\n        submitter=username,\n        comment=comment,\n    )\n\n\nclass community_edits_queue(delegate.page):\n    path = '/merges'\n\n    def POST(self):\n        def response(status='ok', **kwargs):\n            return {'status': status, **kwargs}\n\n        i = web.input(\n            work_ids=\"\",  # Comma-separated OLIDs (OL1W,OL2W,OL3W,...,OL111W)\n            rtype=\"merge-works\",\n            mrid=None,\n            action=None,  # create, approve, decline, comment, unassign\n            comment=None,\n        )\n        user = accounts.get_current_user()\n        username = user['key'].split('/')[-1]\n        if i.mrid:  # We are updating an existing merge request\n            if i.action == 'comment':\n                if i.comment:\n                    CommunityEditsQueue.comment_request(i.mrid, username, i.comment)\n                    return delegate.RawText(\n                        json.dumps(response()), content_type=\"application/json\"\n                    )\n                else:\n                    return delegate.RawText(\n                        json.dumps(\n                            response(\n                                status='error', error='No comment sent in request.'\n                            )\n                        )\n                    )\n            elif i.action == 'claim':\n                result = CommunityEditsQueue.assign_request(i.mrid, username)\n                return delegate.RawText(\n                    json.dumps(response(**result)), content_type=\"application/json\"\n                )\n            elif i.action == 'unassign':\n                CommunityEditsQueue.unassign_request(i.mrid)\n                status = get_status_for_view(CommunityEditsQueue.STATUS['PENDING'])\n                return delegate.RawText(json.dumps(response(newStatus=status)))\n            else:\n                if i.action == \"decline\":\n                    status = CommunityEditsQueue.STATUS['DECLINED']\n                elif i.action == 'approve':\n                    status = CommunityEditsQueue.STATUS['MERGED']\n                CommunityEditsQueue.update_request_status(\n                    i.mrid, status, username, comment=i.comment\n                )\n                return delegate.RawText(\n                    json.dumps(response()), content_type=\"application/json\"\n                )\n        elif i.rtype == \"merge-works\":\n            if i.action == 'create':\n                result = create_request(i.work_ids, username, i.comment)\n                resp = (\n                    response(id=result)\n                    if result\n                    else response(\n                        status='error',\n                        error='A request to merge these works has already been submitted.',\n                    )\n                )\n                return delegate.RawText(\n                    json.dumps(resp), content_type=\"application/json\"\n                )\n\n    def GET(self):\n        i = web.input(page=1, limit=25, mode=\"open\", submitter=None, reviewer=None)\n        merge_requests = CommunityEditsQueue.get_requests(\n            page=int(i.page),\n            limit=int(i.limit),\n            mode=i.mode,\n            submitter=i.submitter,\n            reviewer=i.reviewer,\n            order='created desc',\n        ).list()\n        enriched_requests = self.enrich(merge_requests)\n        total_found = CommunityEditsQueue.get_counts_by_mode(\n            mode=i.mode, submitter=i.submitter, reviewer=i.reviewer\n        )\n        return render_template(\n            'merge_queue/merge_queue',\n            total_found,\n            merge_requests=enriched_requests,\n        )\n\n    def enrich(self, merge_requests):\n        results = []\n        for r in merge_requests:\n            comments = r['comments']\n            obj = {\n                'id': r['id'],\n                'submitter': r['submitter'],\n                'reviewer': r['reviewer'],\n                'url': r['url'],\n                'status': r['status'],\n                'comments': (comments and comments.get('comments')) or [],\n                'created': r['created'],\n                'updated': r['updated'],\n            }\n            olids = self.extract_olids(r['url'])\n            obj['title'] = ''\n            for olid in olids:\n                book = web.ctx.site.get(f'/works/{olid}')\n                if book:\n                    if not obj['title']:\n                        obj['title'] = book.title\n                        break\n\n            results.append(obj)\n        return results\n\n    def extract_olids(self, url):\n        query_string = url.split('?')[1]\n        split_params = query_string.split('&')\n        params = {}\n        for p in split_params:\n            kv = p.split('=')\n            params[kv[0]] = kv[1]\n        return params['records'].split(',')\n\n\nclass ui_partials(delegate.page):\n    path = '/merges/partials'\n\n    def GET(self):\n        i = web.input(type=None, comment='')\n        if i.type == 'comment':\n            component = render_template('merge_queue/comment', comment_str=i.comment)\n            return delegate.RawText(component)\n\n\ndef setup():\n    pass\n", "path": "openlibrary/plugins/upstream/edits.py"}]}