From cf426946bbe4e95a36dc50e924e55cbf223092e9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 16:19:16 +0000 Subject: [PATCH 1/3] mutants: add mutants for eight all-changes commits For #8's weighted time-limit check, #38's two follow-ups (past-date member ranges, member-range cache), #117 (end iterators by reference), #122 (running size at past dates), #126 (placeholder tag cleanup), #136 (way geometry once) and #138 (tag lookup cursor). Each note says what the mutant breaks; the expect_caught field gives the expected result, with the reason where a mutant can't change props.py's results. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01736kJUqyDw9zM3Bkh2W2QT --- bench/props/mutants-all-changes.json | 74 +++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/bench/props/mutants-all-changes.json b/bench/props/mutants-all-changes.json index b2aa3b771..771b9932f 100644 --- a/bench/props/mutants-all-changes.json +++ b/bench/props/mutants-all-changes.json @@ -277,5 +277,77 @@ "new": " { return !(b < a); }), current_objects.end());", "note": "metadata dedup collapses each tile to one entry", "expect_caught": "yes" + }, + { + "commit": "2273b99", + "subject": "around: weight the time-limit check by the work done, and check inside long ways", + "file": "src/overpass_api/statements/around.cc", + "old": " if (work_done >= 64*1024)", + "new": " if (false && work_done >= 64*1024)", + "note": "the time-limit check never runs; it only decides when a query that is out of time stops, and props.py sets no time limit, so this can't change a result", + "expect_caught": "no" + }, + { + "commit": "634d377", + "subject": "around: take candidate ranges for relations at a past date from their members", + "file": "src/overpass_api/statements/around.cc", + "old": " new_way_ranges = new_way_ranges.union_(ranges(relation_way_members(", + "new": " if (false) new_way_ranges = new_way_ranges.union_(ranges(relation_way_members(", + "note": "relations at a past date lose their way members' candidate ranges; only an around filter with relation input at a past date can show it", + "expect_caught": "maybe" + }, + { + "commit": "5df9912", + "subject": "around: look up the input relations' members once per input", + "file": "src/overpass_api/statements/around.cc", + "old": " || member_ranges_relations != relations || member_ranges_attic_relations != attic_relations)", + "new": " || false)", + "note": "the cached member ranges are kept when the input relations change; only an around statement executed again with other relations (e.g. in foreach) can show it", + "expect_caught": "maybe" + }, + { + "commit": "358e322", + "subject": "collect_items: pass end iterators to reconstruct_items by reference", + "file": "src/overpass_api/data/collect_items.h", + "old": " Iterator& it, const Iterator& end, Index index,", + "new": " Iterator& it, Iterator end, Index index,", + "note": "equivalent: the commit only avoids copies and adds no logic, so the only mutant is reverting it", + "expect_caught": "no" + }, + { + "commit": "4033566", + "subject": "collect_items_by_timestamp: keep the result size up to date instead of recounting it", + "file": "src/overpass_api/data/collect_items.h", + "old": " return it == m.end() ? 0 : eval_index_size + it->second.size()*eval_object_size((const Object*)0);", + "new": " return it == m.end() ? 0 : eval_index_size;", + "note": "the running size counts only indexes; that changes only where chunks end and which queries hit [maxsize:], never a result, and props.py's queries stay far below the limits", + "expect_caught": "no" + }, + { + "commit": "7b7d798", + "subject": "tag_store: remove placeholder tags only from the entries just collected", + "file": "src/overpass_api/data/tag_store.h", + "old": " touched.push_back(&obj_vec);", + "new": " if (false) touched.push_back(&obj_vec);", + "note": "placeholder tags for tags added after the date stay in the output of objects at a past date", + "expect_caught": "yes" + }, + { + "commit": "9945057", + "subject": "area and poly queries: build each way's geometry once in collect_ways", + "file": "src/overpass_api/statements/area_query.cc", + "old": " add_way_to_area_blocks(coords, it2->id.val(), way_segments);", + "new": " add_way_to_area_blocks(std::vector< Quad_Coord >(coords.begin(), coords.end() - (coords.empty() ? 0 : 1)), it2->id.val(), way_segments);", + "note": "area queries split each way into segments without its last vertex", + "expect_caught": "yes" + }, + { + "commit": "e643105", + "subject": "tag_store: find tag entries' ids with a forward cursor instead of a binary search", + "file": "src/overpass_api/data/tag_store.h", + "old": " if (cursor != ids.begin() && !(*(cursor - 1) < id))", + "new": " if (false && cursor != ids.begin() && !(*(cursor - 1) < id))", + "note": "the cursor never starts over, so tags of a later tag group whose ids are below the cursor are lost", + "expect_caught": "yes" } -] \ No newline at end of file +] From 1dc694db8d9a4677380a23b9671041c66d97d2fe Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 03:40:35 +0000 Subject: [PATCH 2/3] props: check around over relations in a foreach and at a past date The mutants for 5df9912 (around's member-range cache) and 634d377 (member ranges for relations at a past date) weren't caught: no check ran an around statement again with other relations, or around with relation input at a past date. Two consistency checks cover them: - around a set of relations = the union of around each one, collected in a foreach (current data); - at each history date, around a relation = around its direct member nodes and ways, preferring relations edited after the date. On 6 seeds both pass on all-changes and on upstream master. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01736kJUqyDw9zM3Bkh2W2QT --- bench/README.md | 6 +++++- bench/props/consistency.py | 10 ++++++++++ bench/props/history.py | 21 +++++++++++++++++++++ bench/props/props.py | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/bench/README.md b/bench/README.md index 604955b40..d661d5eb3 100644 --- a/bench/README.md +++ b/bench/README.md @@ -202,7 +202,11 @@ python3 bench/props/props.py --seeds 7 --show against the union of its two halves (split on a tile boundary where possible); a polygon against itself reversed and starting at another vertex; the same filters in different orders; `[bbox:]` against an inline bbox; `around` a point against `around` a node at that point; - `way(bn)` of the nodes in a box within `way(bbox)`; a way within `way(around.s:0)` of itself. + `way(bn)` of the nodes in a box within `way(bbox)`; a way within `way(around.s:0)` of itself; + `around` a set of relations against the union of `around` each one, collected in a `foreach` + (the same statement run again with another relation); and, on the history database at each + date, `around` a relation against `around` its direct member nodes and ways, preferring + relations edited after the date. And translation: each seed is also imported shifted by an offset that isn't a multiple of the tile size, and bbox, `poly:`, area and `is_in` queries must return the same elements on both. Region comparisons leave out elements that come within one unit of the boundary without being diff --git a/bench/props/consistency.py b/bench/props/consistency.py index 5b7b6138c..b7ae32d87 100644 --- a/bench/props/consistency.py +++ b/bench/props/consistency.py @@ -149,6 +149,16 @@ def box(): f'node({i})->.c; {kind}(around.c:{r});') wid = rnd.choice(list(data.ways)) add('way within around.self:0', f'way({wid});', f'way({wid})->.s; way(around.s:0);', 'subset') + + # around a set of relations = the union of around each one, collected in a foreach. Each + # iteration runs the same around statement with another relation as input. + if len(data.rels) > 1: + ids = ','.join(str(r) for r in sorted(data.rels)) + r = rnd.choice([0, 5, 50]) + for kind in ('node', 'way'): + add(f'foreach around rel = around rels ({kind}s)', + f'relation(id:{ids})->.r; ()->.acc; foreach.r->.it {{ {kind}(around.it:{r})->.x; (.acc; .x;)->.acc; }} .acc;', + f'relation(id:{ids})->.r; {kind}(around.r:{r});') return checks diff --git a/bench/props/history.py b/bench/props/history.py index b6c114484..2b0555daa 100644 --- a/bench/props/history.py +++ b/bench/props/history.py @@ -377,3 +377,24 @@ def gen_history_output_checks(h, seed): checks.append(('adiff', f'[adiff:"{d1}","{d2}"];\n(way({world}); node({world}););\nout meta geom;\n', props.no_verify)) return checks + + +def gen_history_consistency_checks(h, seed): + """Pairs of queries at a past date that must agree: around a relation = around its direct + member nodes and ways, which make up its geometry. Prefers relations edited after the date, + so the relation used is an old version.""" + rnd = random.Random(seed * 104729 + 11) + checks = [] + for date in DATES: + rels = h.alive('relation', date) + if not rels: + continue + later = [r for r in sorted(rels) if any(v['ts'] > date for v in h.versions[('relation', r)])] + rid = rnd.choice(later or sorted(rels)) + r = rnd.choice([0, 5, 50]) + d = f'[date:"{date}"]' + for kind in ('node', 'way'): + checks.append((f'date around rel = around members ({kind}s)', + f'{d}; relation({rid})->.r; {kind}(around.r:{r});', + f'{d}; relation({rid})->.rr; (node(r.rr); way(r.rr);)->.m; {kind}(around.m:{r});', 'equal')) + return checks diff --git a/bench/props/props.py b/bench/props/props.py index b5a117252..625254c02 100644 --- a/bench/props/props.py +++ b/bench/props/props.py @@ -936,6 +936,7 @@ def run_seed(seed, args, tmp): results += run_checks(args, hdb, h, hchecks, seed, prefix='h') results += run_output_checks(args, hdb, h, history.gen_history_output_checks(h, seed), seed, len(hchecks), prefix='h') + results += run_pairs(args, hdb, hdb, h, history.gen_history_consistency_checks(h, seed), seed, 'hc') shutil.rmtree(hdb, ignore_errors=True) return seed, data.scale, results From d748eabf69cf2024785c90bd1308563ab7128691 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 03:57:39 +0000 Subject: [PATCH 3/3] mutants: record the results for 634d377 and 5df9912 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01736kJWpJaGbt8ML6jz9N35 --- bench/props/mutants-all-changes.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bench/props/mutants-all-changes.json b/bench/props/mutants-all-changes.json index 771b9932f..615505eb4 100644 --- a/bench/props/mutants-all-changes.json +++ b/bench/props/mutants-all-changes.json @@ -293,8 +293,8 @@ "file": "src/overpass_api/statements/around.cc", "old": " new_way_ranges = new_way_ranges.union_(ranges(relation_way_members(", "new": " if (false) new_way_ranges = new_way_ranges.union_(ranges(relation_way_members(", - "note": "relations at a past date lose their way members' candidate ranges; only an around filter with relation input at a past date can show it", - "expect_caught": "maybe" + "note": "relations at a past date lose their way members' candidate ranges; caught by the history check 'date around rel = around members'", + "expect_caught": "yes" }, { "commit": "5df9912", @@ -302,8 +302,8 @@ "file": "src/overpass_api/statements/around.cc", "old": " || member_ranges_relations != relations || member_ranges_attic_relations != attic_relations)", "new": " || false)", - "note": "the cached member ranges are kept when the input relations change; only an around statement executed again with other relations (e.g. in foreach) can show it", - "expect_caught": "maybe" + "note": "the cached member ranges are kept when the input relations change. Needs data beyond the synthetic sets: the ranges are whole index tiles widened by the radius, and the synthetic data spans so few tiles that the first relation's ranges already cover the others, so the 'foreach around rel' check returns the same result. The targeted around check on the Nova Scotia history database caught it (see #38)", + "expect_caught": "no" }, { "commit": "358e322",