Skip to content

test(engine): cover OSM multipolygon ring losses - #2412

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:test/osm-reader-losses
Nov 18, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:test/osm-reader-losses

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

The reader-loss command corpus had no OSM PBF cases. Add a complete triangular polygon with one hole and four variants: a missing inner member way, a missing node, an unclosed inner ring, and an inner ring outside the outer ring. The native reader currently imports the complete file with two rings and each variant with one, without a notice. Record these existing bugs as Silent so reader fixes must update the corpus.

Five independently encoded, made-up PBF files total 1,041 bytes. Their exact contents, schema reference and checksums are documented and attributed. The committed bytes keep these independently encoded malformed cases fixed and reproducible without a fixture generator or external writer in the tests. The roadmap retains the known reader bugs and narrows missing corpus formats to Shapefile and spreadsheets. No production reader behavior changes.

Surfaces: native layer.addData exercises the shared engine import used by desktop, CLI, Python and native Assistant/MCP calls. Browser uploads and phone controls are not exercised; their code, ribbon/shortcuts/search, plugin interfaces, saved formats and Undo behavior do not change.

Testing

  • Native fixture probe: complete file imports one polygon with two rings; each variant imports one polygon with one ring, zero reported skipped rows and no messages.
  • Local command corpus, engine all-target Clippy, formatting and commit hooks passed.
  • Full fork CI on 3d5d61dde passed: workspace tests, lint, layers, schema, wasm and licenses.

UI evidence

No visible UI change.

Related issue

Follows #2404; continues ROADMAP.md → Correct results: the reader-loss corpus.

Summary by CodeRabbit

  • Tests
    • Added coverage for OSM PBF files with missing inner ways or nodes, unclosed inner rings, and inner rings outside outer rings. These cases check that affected holes are omitted without a notice.
  • Documentation
    • Documented the OSM PBF test files, their differences, and current reader behavior.
    • Updated the roadmap to list planned height-loss sample cases for CityJSON, CityGML, GeoPackage, FlatGeobuf, GeoParquet, and FileGDB.

@Mavrick-F Mavrick-F added the ci:windows Run the Windows CI jobs on this pull request label Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change documents OSM PBF ring-loss fixtures and adds four corresponding cases to the reading-loss test corpus. It also updates the fixture attribution and roadmap entries.

Changes: OSM PBF ring-loss coverage

Layer / File(s) Summary
Document fixtures and register test cases
crates/engine/testdata/reading-losses/OSM.md, crates/engine/tests/never_silent_reading.rs, ATTRIBUTION.md, ROADMAP.md
The fixture documentation records the clean file, four loss variants, reader output, and hashes. The test corpus adds four OSM PBF Silent cases. Attribution and roadmap entries are updated.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related issues

Possibly related PRs

Suggested reviewers: flight1973, giswqs

Merge Risk: Minimal · up to 3d5d6

This PR adds test fixtures and documentation for known OSM reader ring-loss behavior, with no production behavior changes. It appears safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "test(engine): cover OSM multipolygon ring losses" matches the main change. The PR adds OSM PBF ring-loss fixtures and four lossy-variant test cases to the reader-loss corpus. It uses a conv…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description covers the Summary (what changed and why: five OSM PBF reader-loss fixtures, four variants, recorded as Silent, roadmap narrowed, no production reader change) and a Testing section wit…
Full details: Title check

Explanation

The title "test(engine): cover OSM multipolygon ring losses" matches the main change. The PR adds OSM PBF ring-loss fixtures and four lossy-variant test cases to the reader-loss corpus. It uses a conventional type(scope) prefix and names the subject, so a reviewer scanning history can identify the primary change.

Full details: Description check

Explanation

The description covers the Summary (what changed and why: five OSM PBF reader-loss fixtures, four variants, recorded as Silent, roadmap narrowed, no production reader change) and a Testing section with a native fixture probe, local command corpus, Clippy, formatting, and a linked full fork CI run. The UI evidence section states no visible UI change, as the template allows. The Related issue section cites Follows #2404 and the roadmap item. The template's Related issue line uses 'Closes' or 'Part of' phrasing, and the author used 'Follows' instead, which is a minor deviation. The description is mostly complete and specific.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

I’m a rabbit, hopping by,
Four ring-loss cases catch my eye.
Clean-file details, hashes in a row,
The test corpus shows what readers know.
I nibble grass and bound away.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 99d944f8-16ec-428f-b98c-3fa1a091742f
Commits

Reviewing files that changed from the base of the PR and between fd81ab2 and 3d5d61d.

Files selected for processing: 9

  • ATTRIBUTION.md
  • ROADMAP.md
  • crates/engine/testdata/reading-losses/OSM.md
  • crates/engine/testdata/reading-losses/hole-clean.osm.pbf
  • crates/engine/testdata/reading-losses/hole-missing-member.osm.pbf
  • crates/engine/testdata/reading-losses/hole-missing-node.osm.pbf
  • crates/engine/testdata/reading-losses/hole-outside.osm.pbf
  • crates/engine/testdata/reading-losses/hole-unclosed.osm.pbf
  • crates/engine/tests/never_silent_reading.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

gpx(r#"<trk><trkseg><trkpt lat="1" lon="1"/><trkpt lat="2" lon="2"/></trkseg><trkseg><trkpt lat="3" lon="3"/></trkseg></trk>"#),
Silent("the segment is left out of the track's line"),
),
// OSM PBF: keep the outer polygon while one inner member is lost.

Copy link
Copy Markdown
Contributor

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 a Silent case passes whenever the lossy file adds a layer with no new notice. So if the reader stopped assigning the inner role, 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 reads hole-clean and each lossy file through layer.addData and 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.

Copy link
Copy Markdown
Member Author

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.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Checked: the five new OSM PBF fixtures and their OSM.md notes, the four new Silent cases in never_silent_reading.rs, the ROADMAP and ATTRIBUTION edits, the OSM reader (crates/data/src/osm.rs, multipolygon assembly and the missing notice), and the harness logic (read() and the Expect checks). No prior review threads existed, so none were carried over.

Bugs: none found. I traced the reader against each fixture's description. Clean input yields two rings. Each lossy variant drops the inner ring with no notice. The missing counter only fires when a relation has no outer ring, so the inner-member variants stay silent, as the Silent labels say.

Security: none found. The change adds only test data and test code.

Performance: none found.

Quality:

  • Test coverage (inline comment posted on never_silent_reading.rs:257, medium-high confidence): the harness compares notices and layer presence only. A reader regression that dropped the inner role would still pass all five OSM cases. Suggested fix: assert ring counts for the clean file and each lossy file.
  • Nit, for the release quality pass: the notes live in a new OSM.md, while the other fixtures document themselves in reading-losses/README.md. The PR could add the section there instead. Low confidence this matters.
  • Nit: docs/contributing.md says to generate test data instead of committing fixtures. The PR commits binaries without saying why. Independent encoding is the reason, and reading-losses/README.md already gives it as the precedent. The PR body should say so. Low confidence.

AGENTS.md: no violations found. The ATTRIBUTION row, the ROADMAP wording, the include_bytes! paths, and the Silent convention all follow the file. The OSM schema is cited as a published spec, which is allowed.

Not verified: the SHA-256 checksums in OSM.md. I have no hashing tool in this session, so I could not confirm them. The total size (1,041 bytes) matches the five file sizes in stats.json.

Already raised earlier: 0 concerns. There were no prior threads.

Change size

Compared: the whole PR against main (merge base 6a22581 to PR head 3d5d61d).

Measure Value
Files changed 9 (added 6, modified 3, removed 0, renamed 0)
Size before 57.0 KB
Size after 61.8 KB
Total size change +4.8 KB
Path Before After Change
crates/engine/testdata/reading-losses/OSM.md 0 B 2.1 KB +2.1 KB
crates/engine/tests/never_silent_reading.rs 26.3 KB 27.7 KB +1.4 KB
ATTRIBUTION.md 11.1 KB 11.4 KB +296 B
crates/engine/testdata/reading-losses/hole-outside.osm.pbf 0 B 218 B +218 B
crates/engine/testdata/reading-losses/hole-clean.osm.pbf 0 B 212 B +212 B
crates/engine/testdata/reading-losses/hole-unclosed.osm.pbf 0 B 211 B +211 B
crates/engine/testdata/reading-losses/hole-missing-member.osm.pbf 0 B 202 B +202 B
crates/engine/testdata/reading-losses/hole-missing-node.osm.pbf 0 B 198 B +198 B
ROADMAP.md 19.6 KB 19.6 KB +10 B

@Mavrick-F

Copy link
Copy Markdown
Member Author

The PR body now explains why the independently encoded bytes are committed: these malformed cases stay fixed and reproducible without running a fixture generator or external writer in the tests. All five documented SHA-256 checksums match the committed files (1,041 bytes total). The geometry-assertion coverage is deferred as explained inline; consolidating the fixture notes into README.md is also left for the release quality pass.

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2412/
Web app https://preview.rustgis.app/pr-2412/app/
Commit 3d5d61d

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@Mavrick-F
Mavrick-F added this pull request to the merge queue Nov 18, 2026
Merged via the queue into opengeos:main with commit 0e9e6cd Nov 18, 2026
47 checks passed
@Mavrick-F
Mavrick-F deleted the test/osm-reader-losses branch November 18, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:windows Run the Windows CI jobs on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant