#122: Sweden's remaining R-checks as acceptance tests (R38, R40/R125, R90/R91, R95/R96, R119) #134
No reviewers
Labels
No labels
blocked
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap!134
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-122-se-acceptance-tests"
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?
Closes #122
#122 — Sweden: acceptance tests for the remaining R-checks
Part of the #115 plan: the manual R-checks still listed as candidates for
Sweden in
docs/country-requirements.mdare now acceptance tests inconf/semap.yaml, run on every import of the layer and in-acceptance-onlyreview runs. Config + doc only; no import was needed — every test reads data
already live in the DB.
What was added (14 tests, all 10 s bucket; measured 1 ms–0.5 s live — R35 stays the only 100 s test)
Design decisions worth the reviewer's eye
aggregate, not the per-polygon sub-pixel rule, so the test pins the aggregate to
the measured record: the #47 post-fix build (docs/performance.md) kept every
z9→z4 step within ±9k km² and measured z4→z3 at +33 285 km²; the pre-fix build
grew +21 204 km² on z5→z4 (the coastline-eater — fails the 15 000 km² finer
bound); the current build measures z6→z5 +5 977 km² and z4→z3 +27 071 km². The
z3 step gets its own 40 000 km² bound because it is the standing Mälaren-scale
collapse (sub-pixel wetland pieces absorbing into water at z3's pixel size,
issue #117) — accepted, not asserted away.
#117's recorded, accepted data-resolution consequence. The test asserts z3
wetland ≥ 30 000 km², below both recorded builds (48 853 km² post-#116
hardening, 34 028 km² before it), so a cascade that loses the class or
collapses it to a sliver fails.
is "2.0 points and ~200 m per feature". The NPoints half alone cannot
discriminate for waterways: at z3 the importance-5 filter leaves chains that
simplification legitimately straightens to 2.01 pts. Length discriminates:
roads z5 28.4 km avg, waterways z3 2.3 km avg, railways z3 168.6 km avg —
all ≫ the pre-split ~200 m, floor at 1 km.
DBSCAN clusters (the places query takes rn = 1 per name-per-cluster), so they
must be > 15 000 units apart (the
se_text_t10_cleps, ~7.7 km ground at59°N). Live: 203 830 rows, 96 499 distinct names, 2 918 492 same-name pairs,
closest at 15 001.6. That witnesses spatial-not-nationwide dedupe (R90) and
is R91's whole "no name repeats within one view" for a point layer (the
closest same-name pair is far wider than a maxz tile, so no tile ever holds
two same-name labels).
count(*) > 1 after the join") presumes names attach by spatial join against a
standalone register. Sweden's names ride on the label points themselves (Topo
10
text→se_text_t10_cl); there is no unnamed geometry plus a separateregister, and the output has no
feature_idcolumn. Said in the R92 Checkline and here.
A finding: map_water_bodies_3_se is empty (recorded, not fixed)
The R119 pass found the one empty partition in Sweden's range:
map_water_bodies_3_se(0 rows). It is the R31 deliberate-empty case, and thewater_bodies test records it as such (asserting z4–z14, naming z3 in the
comment): the 4-px² area floor at z3's pixel scale drops every lake piece the
pre-tessellated
markcoverage delivers (largest source pieces cap at~100 km²). It is a shared-contract property, not Sweden's — measured across
countries: fi 0, is 0, pl 1 rows at z3.
coverpaints Sweden's lakes at z3 inthe same blue (water is deliberately drawn twice), so nothing is lost on the
map. If water_bodies should actually draw at z3 (a
stop_z: 4on thecontract, or merging lake pieces), that is a follow-up — this issue is about
recording the state, and #125 (global checks) will hit the same empty z3 for
every country.
Verification (live DB, no writes)
New-test highlights from the -acceptance all run:
Nothing left undone that I know of: R92's register-join shape is genuinely not
applicable to Sweden (above), and the water_bodies z3 empty is recorded as the
R31 deliberate-empty case rather than fixed (also above).
Closes #122to #122: Sweden's remaining R-checks as acceptance tests (R38, R40/R125, R90/R91, R95/R96, R119)Review
Verified:
go test ./...green, and the semap suite runs 26 passed / 0 failed against the live database (R35 correctly not run outside-acceptance all). Every R119 table list matches its layer's declared zoom range, and the single omission is real —map_water_bodies_3_seis 0 rows, and the comment's cross-country note checks out too (fi 0, is 0, pl 1).The R38 measurement reproduces:
step_growth_km2 = 8: -4108, 7: -2096, 6: 1082, 5: 5977, 4: -11137, 3: 27071, so the 15 000 / 40 000 split is the right shape for the data, with the z3 exception carrying the Mälaren-scale collapse the comment describes.min_distance_3857prints as a Go struct, not a distanceThe R90/R91 test's diagnostic column comes back unreadable:
round(...)::numericarrives as a*pgtype.Numeric, andacceptance.go:390formats values with%v, which prints the struct. The sibling column works becauseround(...)::bigintmaps to anint64— same reasonwetland_km2_3857=48853renders fine in the R40/R125 test right above.It only matters on failure, but that is exactly when it matters: the whole reason to carry
min_distance_3857is that a red test should tell you how close the offending pair was, and today it would say&{0 0 2}. Casting to::float8(or::text) fixes it without touching the formatter.Note on R38's direction
Like R40/R125's floor, R38 is one-sided — it bounds growth from above, so a cascade that lost water area entirely would pass it. R119 catches a collapse to zero and R40/R125 puts a floor under wetland specifically, so the gap is narrow, and I don't think it needs fixing here. Worth knowing it exists if the boundary classes ever get a regression that shrinks rather than grows them.
21546dfc30toa74ec01ed1Rebased onto
issue-113-fi-name-casing(#130) to turn the doc conflicts into an explicit dependency:Force-pushed
21546df → a74ec01. Content is unchanged — the rebase was clean, no conflicts on this branch. The PR base is retargeted to #130's branch, so the diff above shows only Sweden's work (2 files); Forgejo will retarget it tomainwhen #130 merges.Re-verified after the rebase:
go test ./...green, semap 26 passed / 0 failed (R35 not run outside-acceptance all).