Skip to content

Prevent area merges that introduce repeated interior nodes - #12755

Open
seanwessmith wants to merge 3 commits into
openstreetmap:developfrom
seanwessmith:agent/prevent-invalid-area-node-merges
Open

seanwessmith wants to merge 3 commits into
openstreetmap:developfrom
seanwessmith:agent/prevent-invalid-area-node-merges

Conversation

@seanwessmith

@seanwessmith seanwessmith commented Aug 18, 2026 •

Copy link
Copy Markdown

AI disclosure: This PR contains AI-generated code and tests. This review update was prepared with OpenAI Codex: it read #9328 and the review comments, inspected the merge implementation, clarified the helper name and comments, added regression tests, ran the checks below, and exercised the local editor to capture the demonstration. These checks were performed by the agent; they are not a claim of independent human review.

What changed

Prevent area-node merges that introduce or increase a repeated interior vertex. The normal repetition of the first node at the end of a closed way is explicitly excluded from the check.

  • Preserve valid merges of adjacent or consecutive area nodes, including across the ring closure.
  • Keep repeated interior nodes supported for linear ways.
  • Allow merges that do not worsen an already-invalid area's repeated nodes.

The connect action simulates node replacements in affected parent areas and disables the merge with the existing paths_intersect reason when it would introduce or increase an interior repetition.

Closes #9328.

Demonstration

Recorded from the local iD build at 5246475, using synthetic geometry matching #9328. The extra “Load example area” button only supplies the fixture; selection and merging use the normal editor UI. OSM loading and saving were disabled using the walkthrough controls.

  1. Select the nonadjacent top-right and bottom-right nodes and press C: the intersection warning appears and the area stays unchanged.
  2. Reload the example, select the adjacent top-left and bottom-left nodes (across the ring closure), and press C: the merge succeeds.

Recorded demonstration of the blocked invalid merge and allowed adjacent merge

MP4 recording. Pauses between steps were shortened.

Validation

  • Focused connect/merge-node tests: 41 passed.
  • Full unit suite: 2,268 passed, 9 skipped, 6 todo.
  • Build, distribution build, and TypeScript checks passed.
  • Changed-file ESLint passed without warnings. Full lint completed with one existing no-console warning in test/spec/core/difference.js:371.
  • git diff --check passed.

Comment thread modules/actions/connect.ts Resolved
@matkoniecz

Copy link
Copy Markdown
Collaborator

This is LLM generated PR, right? In such case it should be disclosed at beginning of description, with explanation how it was generated.

@matkoniecz

Copy link
Copy Markdown
Collaborator

This pull request is still a work in progress

please, mark it as ready for review once it is ready for review

also, can you attach recording of this change in action and attach it to original post or in a new comment?

@seanwessmith seanwessmith changed the title Prevent invalid area node merges Prevent area merges that introduce repeated interior nodes Sep 12, 2026
@seanwessmith
seanwessmith marked this pull request as ready for review September 12, 2026 20:39
@k-yle k-yle added the ai-assisted This PR makes extensive use of outsourced intelligence label Nov 15, 2026

This branch was successfully deployed

1 active deployment
pr-preview-12755 — 52464758 Deployed Sep 12, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted This PR makes extensive use of outsourced intelligence

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can create invalid geometries with node merge.

3 participants