R119: the shared-contract check passes vacuously when a zoom partition is missing, not just empty #200
Labels
No labels
blocked
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap#200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The shared contracts' R119 check catches an empty partition but not a missing
one, so a country with a ragged zoom ladder passes vacuously.
The gap
Every contract that carries R119 uses the same catalogue query
(
conf/shared/contracts/: 02-country_borders, 04-cover, 14-airports,15-airport_points, 16-buildings, 17-building_points, 18-contours):
count(*)is reported but never asserted. The predicate isbool_andoverwhatever partitions exist, so a partition that is absent from
pg_inheritsis not "empty" — it is invisible, and the check passes.
R119 as written (docs/country-requirements.md:1516) is "Row counts per zoom per
country, with no unintended empty partition". A missing zoom is squarely the
thing it is meant to catch: an interrupted import, a
--layerrun that diedbetween zooms, or a country swapped in at some zooms and not others leaves the
map silently missing a level, and every acceptance run says PASS.
The per-country R119s that predate the folds did assert it — Iceland's old
contours check was
count(*) = 5 AND bool_and(...), with a comment saying in asmany words that "count(*) = 5 turns a missing zoom table into a failure rather
than a vacuous pass". The guard was dropped when those checks moved onto the
contracts (#149/#150/#151), because a contract cannot hardcode a number: it does
not know how many countries have a partition.
Suggested shape
It does not need a hardcoded number — the invariant is rectangular: every
country that has any partition of a layer has one at every zoom of that layer.
with the offending country/zoom pairs named on failure, the way
empty_partitionsnames the empty ones. Deriving the country from the partitionname is the fiddly part (
right(relname, 2)works today but is not a contract);pg_get_expr(c.relpartbound, c.oid)is the honest source, or the importer couldgrow a helper the way it did for the other catalogue checks.
Notes
(
count(*) = zoom_parents * countriesholds for everymap_*layer today).This is a guard against a class of silent failure, not a fix for a broken
partition.
docs/country-requirements.mdshould say the check covers missing as wellas empty, and the "copy this pair" instruction at :1523 should point at the
tightened version so the eighth contract inherits it.