Repository navigation
test(engine): cover OSM multipolygon ring losses #2412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # OSM PBF ring-loss fixtures | ||
|
|
||
| Made-up data, constructed offline with Python's standard library from the published | ||
| [OSM PBF schemas](https://github.com/openstreetmap/OSM-binary/tree/master/osmpbf). | ||
| No data or implementation from another project is included. Each file has an uncompressed | ||
| `OSMHeader` declaring `OsmSchema-V0.6`, then one `OSMData` block. Nodes, ways and the relation | ||
| have separate primitive groups. Coordinates use the default 100-nanodegree granularity and | ||
| zero offsets. There are no timestamps, user details or downloaded map features. | ||
|
|
||
| The clean file has untagged nodes 1–6 at longitude/latitude (0,0), (10,0), (0,10), (1,1), | ||
| (2,1), (1,2). Way 10 references [1,2,3,1]; way 20 references [4,5,6,4]. Relation 50 has | ||
| `type=multipolygon`, with way 10 as `outer` and way 20 as `inner`. The string table is | ||
| ["", "type", "multipolygon", "outer", "inner"]. No other tags are present. | ||
|
|
||
| Each lossy file changes just one thing: | ||
|
|
||
| | File | Difference from `hole-clean.osm.pbf` | | ||
| |---|---| | ||
| | `hole-missing-member.osm.pbf` | Omit way 20, retaining the relation's reference to it. | | ||
| | `hole-missing-node.osm.pbf` | Omit node 6, retaining way 20's reference to it. | | ||
| | `hole-unclosed.osm.pbf` | Way 20 references [4,5,6], without its closing node. | | ||
| | `hole-outside.osm.pbf` | Move nodes 4–6 to (21,21), (22,21), (21,22). | | ||
|
|
||
| The native reader currently produces one polygon with two rings for the clean file and one | ||
| ring for each lossy file, without a loss notice. The command corpus records these existing | ||
| bugs as `Silent`; this contribution does not fix the reader or certify other OSM loss kinds. | ||
|
|
||
| | File | SHA-256 | | ||
| |---|---| | ||
| | `hole-clean.osm.pbf` | `b5d5a9d0256b5c420005fd9fe08da6bb51d87a896ab5d8e65f2f32d906d86934` | | ||
| | `hole-missing-member.osm.pbf` | `773140490c9dbcbb1914db863143b22528700922e07bf58bab24272b7ef1536e` | | ||
| | `hole-missing-node.osm.pbf` | `9c1c5e4d483415809e47e1a5c5f1fb1d682e83c98c1351355c78e2fbadebef77` | | ||
| | `hole-unclosed.osm.pbf` | `057ac714164461be6ce76960563d7786a40436a57518d26561584bf3480c8cd3` | | ||
| | `hole-outside.osm.pbf` | `2b0a1150e2dce48cddcf7533c27a336f054d0f23fbdf26b773bb746c375754dc` | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quality (test coverage): the OSM cases don't check the geometry they describe.
read()returns only notices and whether a layer was added, and aSilentcase passes whenever the lossy file adds a layer with no new notice. So if the reader stopped assigning theinnerrole, or dropped every hole, the clean file and all four lossy files would still import one layer with no notice. All five cases would pass while the corpus stopped covering rings at all. The PR's own probe (clean = one polygon with two rings, each variant one ring) is not in the test suite. Suggested fix: a small dedicated test that readshole-cleanand each lossy file throughlayer.addDataand asserts the ring count per polygon (2 for clean, 1 for each lossy file), so the fixtures' claims are enforced. Confidence: high that the harness can't catch this; the fix is outside this diff's small scope, so the author can decide whether to add it here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The harness checks import success and notices, so it does not enforce ring counts. Before submission, the native-reader probe confirmed one polygon with two rings for the clean file and one ring for each of the four variants, with zero skipped features and no messages. The extra persistent geometry assertions are left for the release quality pass.