Repository navigation
recurse: handle wr(bn) in the query constraint - #193
Conversation
|
CI on this PR, against
fuzz: all 36 differing queries contain
history: the 10 differing queries are in encrypted artifacts and weren't inspected. They are expected to be the same pattern, including the past-date case in #192 where Generated by Claude Code |
|
Colin thoughts: checks fail, because they correctly identify that this is a change in behaviour. When I dig into the artifacts, the a.out and b.out file contents seem to be the same, which is suspicious. Maybe a bug in the fuzz artifact outputter, will dig into it. Separately, this class of bug could have been caught by our property-based tester (it was caught by Claude when investigating a slow query), will look at extending it. |
|
Colin thoughts: #201 fixes the fuzz artifact issue, it wasn't including the stderr output. |
|
Colin thoughts: #202 fixes the proeprty based tester to now detect this class of error. |
…ne's way + relation answer The baseline (upstream master) gets wr(bn.s) with filters wrong (issue #192): it returns nothing at the current date, unrelated relations at past dates, or fails with "Filters too weak". #193 fixes it on all-changes, so every such query showed up as a difference. wr_union.py rewrites each top-level wr...(bn...) statement as its way and relation halves, both reading the same _, which the baseline answers correctly. A difference is accepted only if the candidate's output equals the baseline's for the rewritten query, so a regression in the candidate's wr(bn) still fails. fuzz.py reports such queries as verdict expected-wr-bn; props.py counts them as fixed. Statements inside unions, differences or blocks are not rewritten, and neither is any query that has one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01736kJTiuJPoCWZs7RtFYjm
e4fb860 to
3ee5733
Compare
|
Offered upstream in fossgis#21 |
…ters In a query statement, wr(bn.s) is a Recurse_Constraint of type RECURSE_NODE_WR, which none of the constraint's methods handled: get_way_ranges and get_relation_ranges returned global ranges, get_data collected nothing, and filter dropped all ways and kept attic relations unfiltered. So wr(bn.s) with a tag filter fell back to the tag filter over the whole database: it returned nothing or failed with "Filters too weak" at the current date, and returned unrelated relations at a past date. Handle RECURSE_NODE_WR in these methods as RECURSE_NODE_WAY for ways and RECURSE_NODE_RELATION for relations, as the standalone wr(bn.s) statement does. The regression tests regression_wr_bn_tag_filter and regression_wr_bn_tag_filter_date cover the current and past-date cases. On a Nova Scotia extract: [out:csv(::count)]; node(44.6470,-63.5760,44.6490,-63.5730)->.s; wr(bn.s)["highway"]; out count; returned 0 ways in 0.53 s, and now returns 141 in 0.01 s, the same as (way(bn.s)["highway"]; rel(bn.s)["highway"];). Co-Authored-By: Colin Dellow <cldellow@gmail.com>
3ee5733 to
3bfdade
Compare
|
Merged upstream as fossgis@02ae8f7. The fork's Generated by Claude Code |
Fixes #192.
Change
Recurse_Constraint(statements/recurse.cc) now handlesRECURSE_NODE_WR, the type ofwr(bn.…)in a query statement, like the standalone statement does: asRECURSE_NODE_WAYfor ways andRECURSE_NODE_RELATIONfor relations.get_way_ranges/get_relation_ranges: the parent indices of the input nodes, instead of global ranges.get_data: collects the ways (with the position, as forbn) and the relations of the input nodes, including the role case for relations.filter: keeps the ways and relations that have an input node, instead of dropping all ways and only the current relations.With a role (
wr(bn.s:"role")),filterstill empties both ways and relations, as before and as the standalone statement does; that case is unchanged.One file, 11 lines added, 8 removed. No change to the database format or the query API.
Impact
US northeast full-history extract (Geofabrik), current-date queries unless stated, warm cache, 4-core VM. Input
node(42.3601,-71.0590,42.3620,-71.0570)->.s;unless stated:upstream/masterwr(bn.s)["highway"]; out count;wr(bn.s)["type"="route"]; out count;wr(bn.s)[~"^tig"~"A"]; out count;.s= 5 ways (way["tiger:zip_left_2"="04344"]):wr(bn.s)["building"="yes"]; out count;[date:"2020-01-01T00:00:00Z"]:wr(bn.s)["type"="route"]; out ids;Benchmark queries: none uses
wr(bn); thetimingworkflow runs them on this PR.Testing
["highway"],["building"="yes"],["type"="route"],["name"~"^Main",i],["highway"]["highway"!="footway"]) × 3 dates (current, 2020-01-01, 2014-06-01),wr(bn.s)[filter]with this PR gives the same output as(way(bn.s)[filter]; rel(bn.s)[filter];)onupstream/master: 90 of 90.wr(bn.s:"stop")andwr(bn.s:"")with the same inputs, filters and dates: identical toupstream/master, 180 of 180.fuzz,historyandpropsrun on this PR.Expected CI differences
Queries with
wr(bn.…)plus a tag filter will differ fromupstream/master, becauseupstream/masterreturns nothing, "Filters too weak", or extra relations for them. In the fuzz workflows' queries this shows up as "Filters too weak" turning into results. Each such difference should match the union form above.Generated by Claude Code