anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: uccser/cs-field-guide
Issue: Search results don't link to their respective locations

Results from using the search feature on the dev site appear as clickable links. However their associated link is empty and clicking on one only reloads the search results page.

Changed files:
csfieldguide/chapters/models.py

diff --git a/csfieldguide/chapters/models.py b/csfieldguide/chapters/models.py
index 8a3ceee1..941693ba 100644
--- a/csfieldguide/chapters/models.py
+++ b/csfieldguide/chapters/models.py
@@ -4,6 +4,7 @@ from django.db import models
 from interactives.models import Interactive
 from django.core.exceptions import ValidationError
 from utils.TranslatableModel import TranslatableModel
+from django.urls import reverse
 
 
 class GlossaryTerm(TranslatableModel):
@@ -58,6 +59,10 @@ class Chapter(TranslatableModel):
         verbose_name = "Chapter"
         verbose_name_plural = "Chapters"
 
+    def get_absolute_url(self):
+        """Get absolute URL of Chapter object."""
+        return reverse('chapters:chapter', args=[self.slug])
+
 
 class ChapterSection(TranslatableModel):
     """Model for each section in a chapter in database."""
@@ -105,3 +110,13 @@ class ChapterSection(TranslatableModel):
         ordering = ["number"]
         verbose_name = "Chapter section"
         verbose_name_plural = "Chapter sections"
+
+    def get_absolute_url(self):
+        """Get absolute URL of ChapterSection object."""
+        return reverse(
+            'chapters:chapter_section',
+            kwargs={
+                'chapter_slug': self.chapter.slug,
+                'chapter_section_slug': self.slug
+            }
+        )
Repository: archiveteam/archivebot
Issue: Pollution in archives due to search domains in resolv.conf

@hook54321a brought up on IRC that a pipeline retrieved http://www/ successfully ([Wayback Machine](https://web.archive.org/web/20180511142946/http://www/)). The reason for this is that there's a `search ovh.net` line on the pipeline's `resolv.conf`, meaning that `www` resolves to `www.ovh.net`. It appears that this is not a new issue; [here](https://web.archive.org/web/20160514054923/http://www/)'s an example snapshot of Online.net's website from two years ago, captured through the same URL by an ArchiveBot pipeline.

We are not alone with this problem: there are various other snapshots showing all kinds of responses (e.g. [one](https://web.archive.org/web/20151213003158/http://www/), [two](https://web.archive.org/web/20150201002312/http://www/)), and IA even captured *itself* under that URL at least once [back in 2005](https://web.archive.org/web/20050331120708/http://www/).

Still, we need to find a way to prevent this from happening to avoid pollution in the archives. @ivan suggested testing whether `www` resolves in the preflight check, but this might not always be reliable because `www` might not resolve on the search domain while other (sub)domains work fine. Another option might be explicitly testing whether `/etc/resolv.conf` contains a `search` line, though that would obviously not work on all OS. Yet another option would be implementing a custom DNS resolving stack which completely ignores the DNS configuration in `resolv.conf` (i.e. communicates with specific DNS servers directly), but that's probably not a good idea.

In any case, the current pipelines also need to be fixed of course. Ping to the current pipeline operators: @Asparagirl, @chronomex, @falconkirtaran, @HarryC145, @MattIggo. My pipelines are not affected.

Changed files:
pipeline/archivebot/seesaw/tasks.py

diff --git a/pipeline/archivebot/seesaw/tasks.py b/pipeline/archivebot/seesaw/tasks.py
index b511c9c..f11cca8 100644
--- a/pipeline/archivebot/seesaw/tasks.py
+++ b/pipeline/archivebot/seesaw/tasks.py
@@ -37,6 +37,18 @@ class CheckIP(SimpleTask):
             raise Exception(
                 'Are you behind a firewall/proxy? That is a big no-no!')
 
+        # Domains that are not supposed to resolve
+        for domain in ('domain.invalid', 'nxdomain.archiveteam.org', 'www'):
+            try:
+                ip = socket.gethostbyname(domain)
+            except socket.gaierror as e:
+                if e.errno != socket.EAI_NONAME:
+                    raise
+            else:
+                item.log_output('Got an IP address ({}) for {} instead of NXDOMAIN'.format(ip, domain))
+                item.log_output('Are you behind a firewall/proxy or have a misconfigured resolv.conf? That is a big no-no!')
+                raise Exception('Are you behind a firewall/proxy or have a misconfigured resolv.conf? That is a big no-no!')
+
 
 class RetryableTask(Task):
     retry_delay = 5
Repository: archiveteam/archivebot
Issue: Ensure that pipeline version matches files

When the git repository is pulled while a pipeline is running and the wpull plugin is updated in that pull, jobs started afterwards will be using the new code but report the old pipeline version in the UA until the pipeline is stopped and restarted. The plugin somehow needs to check that the pipeline version matches with the files, ideally without duplicating the pipeline version number (so perhaps we should move the version number to a separate file which gets loaded by both pipeline.py and the plugin).

Changed files:
pipeline/pipeline.py, pipeline/archivebot/seesaw/tasks.py

diff --git a/pipeline/archivebot/seesaw/tasks.py b/pipeline/archivebot/seesaw/tasks.py
index b2c5fa9..b72ace7 100644
--- a/pipeline/archivebot/seesaw/tasks.py
+++ b/pipeline/archivebot/seesaw/tasks.py
@@ -101,7 +101,7 @@ class RetryableTask(Task):
 
 class GetItemFromQueue(RetryableTask):
     def __init__(self, control, pipeline_id, pipeline_nick, retry_delay=5,
-        ao_only=False, large=False):
+        ao_only=False, large=False, version_check = None):
         RetryableTask.__init__(self, 'GetItemFromQueue')
         self.control = control
         self.pipeline_id = pipeline_id
@@ -111,8 +111,16 @@ class GetItemFromQueue(RetryableTask):
         self.pipeline_queue = 'pending:%s' % self.pipeline_id
         self.ao_only = ao_only
         self.large = large
+        # (versionOnStartup, versionFunc) where the latter is an argument-less function returning the current version of the files
+        self.version_on_startup, self.version_func = version_check
 
     def process(self, item):
+        # Check that the files haven't changed since the pipeline was launched
+        currentVersion = self.version_func()
+        if currentVersion != self.version_on_startup:
+            item.log_output('Version has changed from {!r} on startup to {!r} now'.format(self.version_on_startup, currentVersion))
+            raise Exception('Version has changed from {!r} on startup to {!r} now'.format(self.version_on_startup, currentVersion))
+
         try: 
             ident, job_data = self.control.reserve_job(self.pipeline_id,
                     self.pipeline_nick, self.ao_only, self.large)
diff --git a/pipeline/pipeline.py b/pipeline/pipeline.py
index 84df1a5..689432a 100644
--- a/pipeline/pipeline.py
+++ b/pipeline/pipeline.py
@@ -141,7 +141,8 @@ pipeline = Pipeline(
     CheckIP(),
     CheckLocalWebserver(),
     GetItemFromQueue(control, pipeline_id, downloader,
-        ao_only=env.get('AO_ONLY'), large=env.get('LARGE')),
+        ao_only=env.get('AO_ONLY'), large=env.get('LARGE'),
+        version_check = (VERSION, pipeline_version)),
     StartHeartbeat(control),
     SetFetchDepth(),
     PreparePaths(),
Repository: couchers-org/couchers
Issue: clicking on a request message causes notification email to be sent

Subject: clicking on a request message causes notification email to be sent
Description:
whenever I visit the hosting request message tab and click on the message to view it, the system sends me an email saying I have a request. (Request to jesse from Itsi)

Steps:
Clicked on the request message to view it

Results:
I shouldn't get an email notification every time I click on it...

Backend version: develop-2b68134b
Frontend version: develop-2b68134b
User Agent: Mozilla/5.0 (Android 11; Mobile; rv:86.0) Gecko/86.0 Firefox/86.0
Page: https://develop--frontend.preview.coucher.org/messages/hosting
User ID: 7

Changed files:
app/backend/src/couchers/servicers/requests.py

diff --git a/app/backend/src/couchers/servicers/requests.py b/app/backend/src/couchers/servicers/requests.py
index a84f160e2..b51037da9 100644
--- a/app/backend/src/couchers/servicers/requests.py
+++ b/app/backend/src/couchers/servicers/requests.py
@@ -115,6 +115,9 @@ class Requests(requests_pb2_grpc.RequestsServicer):
             host_request.status = HostRequestStatus.pending
             host_request.from_last_seen_message_id = message.id
             session.add(host_request)
+            session.flush()
+            
+            send_host_request_email(host_request)
 
             return requests_pb2.CreateHostRequestRes(host_request_id=host_request.conversation_id)
 
@@ -146,8 +149,6 @@ class Requests(requests_pb2_grpc.RequestsServicer):
                 .one()
             )
 
-            send_host_request_email(host_request)
-
             return requests_pb2.HostRequest(
                 host_request_id=host_request.conversation_id,
                 from_user_id=host_request.from_user_id,
Repository: couchers-org/couchers
Issue: You’ve received a reference email has wrong  link

Subject: You’ve received a reference email has wrong  link
Description:
I think it includes the wrong user’s ID in the url

Results:


Backend version: develop-55e3437e
Frontend version: 
User Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_8_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1
Page: https://next.couchershq.org/leave-reference/hosted/1/90
User: aapeli (1)

Changed files:
app/backend/src/couchers/tasks.py

diff --git a/app/backend/src/couchers/tasks.py b/app/backend/src/couchers/tasks.py
index 6b9f58689..5f06e421b 100644
--- a/app/backend/src/couchers/tasks.py
+++ b/app/backend/src/couchers/tasks.py
@@ -196,7 +196,7 @@ def send_host_reference_email(reference, both_written):
         template_args={
             "reference": reference,
             "leave_reference_link": urls.leave_reference_link(
-                "surfed" if surfed else "hosted", reference.host_request.host.id, reference.host_request.conversation_id
+                "surfed" if surfed else "hosted", reference.from_user_id, reference.host_request.conversation_id
             ),
             # if this reference was written by the surfer, then the recipient hosted
             "surfed": surfed,
Repository: couchers-org/couchers
Issue: "Invalid token" when trying to sign up with username already signed up

Sentry Issue: [BACKEND-2T](https://sentry.io/organizations/couchers/issues/2582011114/?referrer=github_integration)

```
UniqueViolation: duplicate key value violates unique constraint "uq_signup_flows_username"
DETAIL:  Key (username)=(esra) already exists.

  File "sqlalchemy/engine/base.py", line 1771, in _execute_context
    self.dialect.do_execute(
  File "sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)

IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "uq_signup_flows_username"
DETAIL:  Key (username)=(esra) already exists.

[SQL: UPDATE signup_flows SET username=%(username)s, birthdate=%(birthdate)s, gender=%(gender)s, hosting_status=%(hosting_status)s, city=%(city)s, geom=CAST(CAST(ST_GeogFromText(%(param_1)s) AS geography(POINT,4326)) AS geometry(POINT,4326)), geom_radius=%(geom_radius)s, accepted_tos=%(accepted_tos)s WHERE signup_flows.id = %(signup_flows_id)s]
[param...
(15 additional frame(s) were not displayed)
...
  File "sqlalchemy/engine/base.py", line 1814, in _execute_context
    self._handle_dbapi_exception(
  File "sqlalchemy/engine/base.py", line 1995, in _handle_dbapi_exception
    util.raise_(
  File "sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "sqlalchemy/engine/base.py", line 1771, in _execute_context
    self.dialect.do_execute(
  File "sqlalchemy/engine/default.py", line 717, in do_execute
    cursor.execute(statement, parameters)
```

Changed files:
app/backend/src/couchers/servicers/auth.py

diff --git a/app/backend/src/couchers/servicers/auth.py b/app/backend/src/couchers/servicers/auth.py
index 268f226bf..e29fc81bd 100644
--- a/app/backend/src/couchers/servicers/auth.py
+++ b/app/backend/src/couchers/servicers/auth.py
@@ -117,9 +117,17 @@ class Auth(auth_pb2_grpc.AuthServicer):
         if not is_valid_username(username):
             return False
         with session_scope() as session:
-            user = session.execute(select(User).where(User.username == username)).scalar_one_or_none()
+            # check for existing user with that username
+            user_exists = (
+                session.execute(select(User).where(User.username == username)).scalar_one_or_none() is not None
+            )
+            # check for started signup with that username
+            signup_exists = (
+                session.execute(select(SignupFlow).where(SignupFlow.username == username)).scalar_one_or_none()
+                is not None
+            )
             # return False if user exists, True otherwise
-            return user is None
+            return not user_exists and not signup_exists
 
     def SignupFlow(self, request, context):
         with session_scope() as session:
Repository: couchers-org/couchers
Issue: create_engine is not being passed in future=True

Line 46 in db.py. Is there a reason for this or just missed it @ShmuelTreiger?

Changed files:
app/backend/src/couchers/db.py

diff --git a/app/backend/src/couchers/db.py b/app/backend/src/couchers/db.py
index 72f9a3c83..4c3b7b410 100644
--- a/app/backend/src/couchers/db.py
+++ b/app/backend/src/couchers/db.py
@@ -43,7 +43,7 @@ def _get_base_engine():
     if config.config["IN_TEST"]:
         return create_engine(config.config["DATABASE_CONNECTION_STRING"], poolclass=NullPool, future=True)
     else:
-        return create_engine(config.config["DATABASE_CONNECTION_STRING"])
+        return create_engine(config.config["DATABASE_CONNECTION_STRING"], future=True)
 
 
 def get_engine(isolation_level=None):
Repository: couchers-org/couchers
Issue: Photo upload causes backend error `VipsJpeg: out of order read`

Subject: trying to add photo of myself
Description:
i uploaded photo and it says invalid image 

Results:
wont let me upload a photo of myself 

Backend version: develop-2f884f53
Frontend version: develop-2f884f53
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Page: https://app.couchers.org/user/edit
User (spoofable): dmb9r3 (980)

Changed files:
app/media/src/media/server.py

diff --git a/app/media/src/media/server.py b/app/media/src/media/server.py
index f6ac90109..9e83cfb64 100644
--- a/app/media/src/media/server.py
+++ b/app/media/src/media/server.py
@@ -98,7 +98,7 @@ def create_app(
 
         # handle image uploads
         try:
-            img = pyvips.Image.new_from_buffer(request_file.read(), options="", access="sequential")
+            img = pyvips.Image.new_from_buffer(request_file.read(), options="")
         except pyvips.Error:
             abort(400, "Invalid image")
 
@@ -148,7 +148,7 @@ def create_app(
         thumbnail_path = get_path(filename, size="thumbnail")
         if not os.path.isfile(thumbnail_path):
             # generate the thumbnail...
-            img = pyvips.Image.new_from_file(full_path, access="sequential")
+            img = pyvips.Image.new_from_file(full_path)
 
             width = img.get("width")
             height = img.get("height")
Repository: landlab/landlab
Issue: LinearDiffuser doesn't hold on to "g" when it already exists as a field

The below shows how the error can be reproduced:

from landlab import RasterModelGrid
from landlab.components import LinearDiffuser

rg = RasterModelGrid((4, 5), 10.0)
rg.add_zeros('node', 'topographic__elevation')
ld1 = LinearDiffuser(rg, linear_diffusivity=0.01)
ld1.diffuse(1.0)  # no problem
ld2 = LinearDiffuser(rg, linear_diffusivity=0.001)
ld2.diffuse(1.0)  # problem: gradient field already exists

Traceback (most recent call last):
  File "reproduce_diffuser_bug.py", line 9, in <module>
    ld2.diffuse(1.0)  # problem: gradient field already exists
  File "/Users/gtucker/Dev/Landlab/Clone/landlab/landlab/components/diffusion/diffusion.py", line 249, in diffuse
    self.grid.calculate_gradients_at_active_links(z)
AttributeError: 'LinearDiffuser' object has no attribute 'g'

Happens because **init** doesn't create self.g if a gradient field already exists. A solution is to make self.g a reference to the existing field if it exists.


Changed files:
landlab/components/diffusion/diffusion.py

diff --git a/landlab/components/diffusion/diffusion.py b/landlab/components/diffusion/diffusion.py
index 30a1c27f9..8eaf081fc 100644
--- a/landlab/components/diffusion/diffusion.py
+++ b/landlab/components/diffusion/diffusion.py
@@ -153,19 +153,19 @@ class LinearDiffuser(Component):
         self.interior_cells = self.grid.node_at_core_cell
 
         self.z = self.grid.at_node[self.values_to_diffuse]
-        g = self.grid.zeros(centering='link')
-        qs = self.grid.zeros(centering='link')
+        g = self.grid.zeros(at='link')
+        qs = self.grid.zeros(at='link')
         try:
             self.g = self.grid.add_field('link', 'topographic__gradient', g,
                                          noclobber=True)
             # ^note this will object if this exists already
         except FieldError:
-            pass  # field exists, so no problem
+            self.g = self.grid.at_link['topographic__gradient'] # keep a ref
         try:
             self.qs = self.grid.add_field('link', 'unit_flux', qs,
                                           noclobber=True)
         except FieldError:
-            pass
+            self.qs = self.grid.at_link['unit_flux']
         # note all these terms are deliberately loose, as we won't always be
         # dealing with topo
Repository: landlab/landlab
Issue: Lake mapper: bug in handle_outlet_node()

  File "/Users/gtucker/Dev/Landlab/Clone/landlab/landlab/components/flow_routing/lake_mapper.py", line 582, in map_depressions
    self.route_flow()

  File "/Users/gtucker/Dev/Landlab/Clone/landlab/landlab/components/flow_routing/lake_mapper.py", line 597, in route_flow
    self.handle_outlet_node(outlet_node, nodes_in_lake)

  File "/Users/gtucker/Dev/Landlab/Clone/landlab/landlab/components/flow_routing/lake_mapper.py", line 689, in handle_outlet_node
    self._elev[out_draining]) /

IndexError: index 2147483647 is out of bounds for axis 1 with size 50344


Changed files:
landlab/components/flow_routing/lake_mapper.py

diff --git a/landlab/components/flow_routing/lake_mapper.py b/landlab/components/flow_routing/lake_mapper.py
index 2f9dbc356..a306af0c5 100644
--- a/landlab/components/flow_routing/lake_mapper.py
+++ b/landlab/components/flow_routing/lake_mapper.py
@@ -669,12 +669,12 @@ class DepressionFinderAndRouter(Component):
         if self._grid.status_at_node[outlet_node] == 0:  # it's not a BC
             if self._D8:
                 outlet_neighbors = np.hstack((self._grid.get_active_neighbors_at_node(
-                    outlet_node),
+                    outlet_node, bad_index=-1),
                     self._grid.get_diagonal_list(
-                    outlet_node)))
+                    outlet_node, bad_index=-1)))
             else:
                 outlet_neighbors = self._grid.get_active_neighbors_at_node(
-                    outlet_node).copy()
+                    outlet_node, bad_index=-1).copy()
             inlake = np.in1d(outlet_neighbors.flat, nodes_in_lake)
             assert inlake.size > 0
             outlet_neighbors[inlake] = -1
Repository: landlab/landlab
Issue: bug in as_id_array

There's an issue with as_id_array. The function is followed (`core.utils` lns 182-197) by an unindented code block which is running as a meaningless script. I assume this is supposed to be inside the function?? Don't feel confident correcting this myself as I don't know the full intended functionality of the script - sorry to assign you Katy! (Also, it's untested?) Hopefully a very quick fix.

Changed files:
landlab/core/utils.py

diff --git a/landlab/core/utils.py b/landlab/core/utils.py
index e89317b37..3fdf3a2d6 100644
--- a/landlab/core/utils.py
+++ b/landlab/core/utils.py
@@ -169,6 +169,13 @@ def as_id_array(array):
     array([0, 1, 2, 3, 4])
     >>> y.dtype == np.int
     True
+
+    >>> x = np.arange(5, dtype=np.intp)
+    >>> y = np.where(x < 3)[0]
+    >>> y.dtype == np.intp
+    True
+    >>> as_id_array(y).dtype == np.int
+    True
     """
     try:
         if array.dtype == np.int:
@@ -179,24 +186,6 @@ def as_id_array(array):
         return np.asarray(array, dtype=np.int)
 
 
-if np.dtype(np.intp) == np.int:
-
-    def _as_id_array(array):
-        if array.dtype == np.intp or array.dtype == np.int:
-            return array.view(np.int)
-        else:
-            return array.astype(np.int)
-
-
-else:
-
-    def _as_id_array(array):
-        if array.dtype == np.int:
-            return array.view(np.int)
-        else:
-            return array.astype(np.int)
-
-
 def make_optional_arg_into_id_array(number_of_elements, *args):
     """Transform an optional argument into an array of element ids.
Repository: meilisearch/meilisearch-python
Issue: TaskHandler's delete_task has paramaters as optional but it should be required

<!-- This is not an exhaustive model but a help. No step is mandatory. -->

**Description**
Description of what the bug is about.

The signature of `delete_tasks` in `TaskHandler` is `def delete_tasks(self, parameters: Dict[str, Any]) -> TaskInfo:`. However if you don't provide any parameters you get an error from Meilisearch so this should really be required.

**Expected behavior**
What you expected to happen.

No error

**Current behavior**
What happened.

Meilisearch returns an error if no parameters are provided.

`meilisearch.errors.MeilisearchApiError: MeilisearchApiError. Error code: missing_task_filters. Error message: Query parameters to filter the tasks to delete are missing. Available query parameters are: `uids`, `indexUids`, `statuses`, `types`, `canceledBy`, `beforeEnqueuedAt`, `afterEnqueuedAt`, `beforeStartedAt`, `afterStartedAt`, `beforeFinishedAt`, `afterFinishedAt`. Error documentation: https://docs.meilisearch.com/errors#missing_task_filters Error type: invalid_request`

**Screenshots or Logs**
If applicable, add screenshots or logs to help explain your problem.

**Environment (please complete the following information):**
 - OS: [e.g. Debian GNU/Linux]
 - Meilisearch version: [e.g. v.0.20.0]
 - meilisearch-python version: [e.g v0.14.1]


Changed files:
meilisearch/task.py

diff --git a/meilisearch/task.py b/meilisearch/task.py
index c6d4361..a10e94e 100644
--- a/meilisearch/task.py
+++ b/meilisearch/task.py
@@ -100,13 +100,13 @@ class TaskHandler:
         response = self.http.post(f"{self.config.paths.task}/cancel?{parse.urlencode(parameters)}")
         return TaskInfo(**response)
 
-    def delete_tasks(self, parameters: Optional[Dict[str, Any]] = None) -> TaskInfo:
+    def delete_tasks(self, parameters: Dict[str, Any]) -> TaskInfo:
         """Delete a list of enqueued or processing tasks.
         Parameters
         ----------
         config:
             Config object containing permission and location of Meilisearch.
-        parameters (optional):
+        parameters:
             parameters accepted by the delete tasks route:https://www.meilisearch.com/docs/reference/api/tasks#delete-task.
         Returns
         -------
@@ -118,8 +118,6 @@ class TaskHandler:
         MeilisearchApiError
             An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
         """
-        if parameters is None:
-            parameters = {}
         for param in parameters:
             if isinstance(parameters[param], list):
                 parameters[param] = ",".join(parameters[param])