Skip to content

test(analysis): pin Repair Geometry where rules for inside differ, and cancel Check and Repair Geometry (#2003) - #2291

Merged
deniial00 merged 4 commits into
opengeos:mainfrom
flight1973:test/repair-geometry-pins
Nov 17, 2026
Merged

deniial00 merged 4 commits into
opengeos:mainfrom
flight1973:test/repair-geometry-pins

Conversation

@flight1973

@flight1973 flight1973 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Groundwork for #2003, tests only. Nothing changes in how Repair Geometry works.

  • Check Geometry and Repair Geometry are now in cancel_tools, so both cancel tests run them. Their work grows with the layer, and both look at Cancel per feature.

  • what_is_inside_where_rules_differ pins today's output on the shapes where another rule for what's inside (even-odd, say) would give a different polygon. Each runs as written, with every ring reversed (GeoJSON's and Shapefile's windings), and with one ring at a time reversed:

    • a plus sign;
    • a hole crossing its shell;
    • a part inside another, wound either way. The clockwise one is what a hole listed as its own part looks like.
    • the same part twice, from another vertex, and reversed;
    • a ring traced twice, alone and beside another part;
    • spikes in and out.

    Two valid shapes, a hole wound like its shell and an island in another part's hole, are checked to be copied unchanged in every winding.

  • the_postgis_manual_examples_merge_into_one_polygon runs the two overlap examples from the ST_MakeValid page. Each comes out as one polygon, as the manual shows for its structure method. The manual gives no areas, so the expected ones are this tool's own output. They're also checked against a bound any union has to meet: at least the largest part, less than all parts added up.

If the rule parameter from #2003 goes ahead, these tests show that the default rule's output stays the same.

Testing

  • cargo xtask ci passes.
  • cargo test -p rustgis-analysis --test repair_geometry: 20 pass.
  • The two engine cancel tests (long_commands_stop_when_cancelled_while_they_run, cancelling_at_each_check_leaves_nothing_behind) pass with the two tools added.
  • I checked each pinned result by hand against the current rule (each part is its shell minus its holes, and the parts are merged).

UI evidence

No visible UI change.

Related issue

Part of #2003.

Summary by CodeRabbit

  • Tests
    • Expanded geometry repair coverage for overlapping parts, holes crossing shells, repeated rings, spikes, and different ring windings.
    • Added checks that valid holes and islands remain unchanged and that repair results match PostGIS examples.
    • Clarified cancellation test coverage for commands that check for cancellation while running, including exports and raster-producing operations.

…d cancel Check and Repair Geometry (opengeos#2003)

Check Geometry and Repair Geometry join the long tools the cancel tests run, as AGENTS.md asks of a tool whose work grows with its input.

Two tests pin today's output where another rule for what is inside would give a different polygon, in both windings: a plus sign, a hole crossing its shell, a part inside another wound either way (one is a hole listed as a part), the same part twice (from another vertex, reversed), a ring traced twice, spikes in and out, and the two overlap examples in the PostGIS manual's ST_MakeValid page. Two valid shapes (a hole wound as its shell, an island in another part's hole) are copied unchanged. No behavior changes.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR adds repair geometry tests for ring-winding cases and two overlapping-parts examples from the PostGIS manual. It also updates engine cancellation test documentation to describe cancellation checks and how the test detects runs that do not check the flag.

Changes: Geometry repair tests

Layer / File(s) Summary
Winding cases and test helpers
crates/analysis/tests/repair_geometry.rs
A shared fixed helper replaces the helper previously local to each_repair_on_its_own. New tests check overlapping parts, crossing or repeated rings, and spikes across ring windings. They also check that valid wound holes and islands remain unchanged.
PostGIS examples
crates/analysis/tests/repair_geometry.rs
Tests use two overlapping-parts examples from the PostGIS ST_MakeValid manual. They check the repaired geometry and area against the input areas and pinned expected value.

Cancellation test documentation

Layer / File(s) Summary
Cancellation test description
crates/engine/src/tests.rs
The documentation describes cancellation checks for commands running on another thread, including exports, raster-producing commands, and long-running tools. It states that commands which do not check the flag finish and are detected by their check count.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Possibly related issues

  • opengeos/RustGIS#2003: The repair geometry tests cover output cases listed in the issue’s proposed first step. The changes summarized here do not include its proposed rule parameter.

Possibly related PRs

  • opengeos/RustGIS#1443: The repair geometry tests cover output behavior for the tool introduced in this PR.
  • opengeos/RustGIS#1417: The engine cancellation test documentation describes checks for commands that include checkGeometry.

Suggested reviewers: pawelkra, giswqs

Merge Risk: Minimal · up to d0002

This PR adds tests for Repair Geometry and updates test documentation. It changes no product behavior and has no identified merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two changes in this PR: pinning Repair Geometry output where inside rules differ, and adding Check Geometry and Repair Geometry to the cancel tests. The changeset is tests only and…
Description check Passed The description follows the template. It has Summary, Testing, and Related issue sections, and it states 'No visible UI change' under UI evidence. It explains the cancel_tools change, the pinned-outpu…
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.
Full details: Title check

Explanation

The title names the two changes in this PR: pinning Repair Geometry output where inside rules differ, and adding Check Geometry and Repair Geometry to the cancel tests. The changeset is tests only and matches both parts. The title is long (111 characters) but specific and accurate.

Full details: Description check

Explanation

The description follows the template. It has Summary, Testing, and Related issue sections, and it states 'No visible UI change' under UI evidence. It explains the cancel_tools change, the pinned-output tests, and the PostGIS manual examples. It reports validation with cargo xtask ci and the 20 passing repair_geometry tests. The Related issue section links to Part of #2003, as the template asks.

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

A rabbit checks each winding ring,
And tests the shapes that repairs bring.
Two PostGIS examples join the play,
Their areas checked along the way.
The cancel notes now say when checks begin,
Then off I hop, with ears held in.

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: a0f104b6-be45-4f87-a6f6-3967925f6779
Commits

Reviewing files that changed from the base of the PR and between 1e6213c and d000232.

Files selected for processing: 1

  • crates/engine/src/tests.rs

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

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2291/
Web app https://preview.rustgis.app/pr-2291/app/
Commit d000232

GitHub Pages takes a minute or two to publish a new commit.

@deniial00 deniial00 added the claude-autofix Apply to have Claude merge the base, resolve conflicts and fix review comments (re-add to run again) label Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Claude autofix

  • Merged main and resolved conflicts in 1 file(s).

@github-actions github-actions Bot removed the claude-autofix Apply to have Claude merge the base, resolve conflicts and fix review comments (re-add to run again) label Nov 17, 2026
}

/// Every registered long command looks at Cancel in its work, without timing.
/// A long command stops when it is cancelled while it runs (#1562): every command the app runs

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.

The PR description says Check Geometry and Repair Geometry were added to cancel_tools and that both cancel tests run them, but that list isn't in this PR. cancel_tools doesn't exist anywhere in the repo, crates/engine/src/tests/cancellation.rs is not in the changed files, and this PR only changes this doc comment. The tool list in cancellation.rs (around line 222) has no checkGeometry or repairGeometry entry.

Both tools grow with their input and look at Cancel per feature (repair_geometry.rs:104,179, check_geometry.rs:85,139), so AGENTS.md's "a tool whose work grows with its input goes in the lists in long_commands" applies. Adding them to that tools array would be the missing change, along the lines of:

("checkGeometry", json!({"input": "Cities"})),
("repairGeometry", json!({"input": "Countries"})),

I haven't run the cancel tests, so I can't say whether these fixtures pass them. Either way the PR description's "cancel tests pass with the two tools added" is not true for this head commit.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • None found in the new tests. I could not run them (no shell here), so the pinned results in what_is_inside_where_rules_differ and the PostGIS area values are checked by reading only. (Confidence: medium.)

Security

  • None. The PR only touches test code.

Performance

  • None.

Quality

  • The new ring helper in the_postgis_manual_examples_merge_into_one_polygon uses panic! and expect. That is fine in test code, and I'm raising it only for completeness. (Confidence: high, low severity.)
  • one(GeometryType::Polygon, Some(input.clone())) clones input unnecessarily. Nit, left for the release quality pass. (Confidence: high.)

AGENTS.md

  • The cancellation half of the PR is missing. The description and title say Check Geometry and Repair Geometry were added to cancel_tools. That list doesn't exist in the repo, crates/engine/src/tests/cancellation.rs is not in the diff, and the only change in crates/engine/src/tests.rs is a doc comment. Both tools grow with input and look at Cancel per feature, so AGENTS.md's long_commands rule applies. (Confidence: high.) Posted inline on crates/engine/src/tests.rs:48978.

Not verified

  • The PostGIS manual coordinates and the expected areas cannot be checked without network access. The areas are the tool's own output, as the PR says.

Earlier concerns: there are no prior review threads on this PR, so none were left alone.

Change size

Compared with main (merge base 841447d to PR head d000232): 2 files modified, 0 added, 0 removed, 0 renamed.

Measure Value
Files changed 2 (added 0, modified 2, removed 0, renamed 0)
Size before 3.06 MB
Size after 3.07 MB
Total size change +8.5 KB
Path Before After Change
crates/analysis/tests/repair_geometry.rs 47.3 KB 55.7 KB +8.4 KB
crates/engine/src/tests.rs 3.02 MB 3.02 MB +409 B

@deniial00
deniial00 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into opengeos:main with commit ade142a Nov 17, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants