drolbr / Overpass-API

A database engine to query the OpenStreetMap data.
http://overpass-api.de
GNU Affero General Public License v3.0
690 stars 90 forks source link

Augmented-difference empty results #734

Open Zaczero opened 4 days ago

Zaczero commented 4 days ago

Affected node: https://www.openstreetmap.org/node/3809873262/history

When retrieving adiff between v3 and v5 (both are deleted), the response is empty.

Example query: https://overpass-turbo.eu/s/1NvB

I expected the response to be:

<action type="delete">  # or modify
<old>
  <node id="3809873262" visible="false" version="3" timestamp="2024-03-03T18:29:54Z" changeset="148177328" uid="16834111" user="the13thsense"/>
</old>
<new>
  <node id="3809873262" visible="false" version="5" timestamp="2024-03-07T19:01:30Z" changeset="148356229" uid="6168709" user="Udarian"/>
</new>
</action>

Is that intended behavior or a bug?

drolbr commented 10 hours ago

This is a tricky question. As of today, it is intended behaviour.

However, the augmented diff feature is barely used. So if we can hammer out useful semantics that are backwards compatible or almost backwards compatible then I'm willing to change it.

What currently happens:

What happens in other adiff cases:

Note that line 2 does not know for what kind of object has been asked for, and line 1 does not know that it runs in an adiff setting. Think about cases like someone adiffing a bounding box, a tag globally, or a tag in a bounding box. Shall all objects appear that ever beared that tag or lived in the bounding box? I'm happy for a discussion.

Zaczero commented 1 hour ago

line 1 yields an empty result for 2024-03-03T18:29:54Z. line 1 yields again an empty result now.

From my perspective, returning empty results for visible="false" object is incorrect. This is intuitive from human perspective, but not from scripting/data perspective. There is very little difference between visible="true" and visible="false" elements, the only being whether they're shown to the user or not. Given my very limited understanding of Overpass, I would always return all elements (ignoring the visible flag), and perform visibility filtering as an optional final stage. This would make Overpass behavior predictable and customizable.

Edit: To clarify one detail, visible="false" nodes should not be queryable by bbox, given that they have no geographic location. However, they should be when requested directly by id (because they do exist in the data).

Edit2: And here's why this behavior seems like a bug: if we use adiff to compare between V1 and V2 where nothing changes (tags, location, members) except the version number, we receive results, despite there being virtually no difference. Now that we repeat this query for versions that are visible="false", we receive no results. The current behavior is not consistent.