Skip to content

refactor(api)!: split Pachner moves from vertex lifecycle edits#477

Merged
acgetchell merged 2 commits into
mainfrom
feat/252-pachner-api-split
Jun 24, 2026
Merged

refactor(api)!: split Pachner moves from vertex lifecycle edits#477
acgetchell merged 2 commits into
mainfrom
feat/252-pachner-api-split

Conversation

@acgetchell

Copy link
Copy Markdown
Owner
  • Add a unified PachnerMove request/result API with attempt_pachner dispatch and a focused prelude::pachner import surface.
  • Move vertex deletion into its own Delaunay module with typed DeleteVertexError and keep insertion/deletion terminology explicit through public docs and examples.
  • Keep primitive bistellar flip APIs available from delaunay::flips while hiding them from focused preludes intended for workflow users.
  • Add Pachner stress coverage, delete_vertex benchmarks, and Semgrep rules that require fallible results to be consumed and workflow fixtures to use vertex!.
  • Split long agent/development guidance into focused dev and architecture docs, including release citation and performance-tuning checklists.

BREAKING CHANGE: DelaunayTriangulation::insert and remove_vertex are replaced by insert_vertex and delete_vertex, and focused Pachner workflows now import from prelude::pachner instead of prelude::flips. Primitive flip APIs remain available from delaunay::flips for tests, benchmarks, and low-level expert use.

Closes #252

- Add a unified PachnerMove request/result API with attempt_pachner dispatch and a focused prelude::pachner import surface.
- Move vertex deletion into its own Delaunay module with typed DeleteVertexError and keep insertion/deletion terminology explicit through public docs and examples.
- Keep primitive bistellar flip APIs available from delaunay::flips while hiding them from focused preludes intended for workflow users.
- Add Pachner stress coverage, delete_vertex benchmarks, and Semgrep rules that require fallible results to be consumed and workflow fixtures to use vertex!.
- Split long agent/development guidance into focused dev and architecture docs, including release citation and performance-tuning checklists.

BREAKING CHANGE: DelaunayTriangulation::insert and remove_vertex are replaced by insert_vertex and delete_vertex, and focused Pachner workflows now import from prelude::pachner instead of prelude::flips. Primitive flip APIs remain available from delaunay::flips for tests, benchmarks, and low-level expert use.

Closes #252
@acgetchell acgetchell self-assigned this Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 98add7df-8428-451b-8d4e-3471bf79d732

📥 Commits

Reviewing files that changed from the base of the PR and between e728bb1 and 4893b18.

📒 Files selected for processing (9)
  • AGENTS.md
  • docs/dev/commands.md
  • docs/workflows.md
  • src/core/repair.rs
  • src/delaunay/construction.rs
  • src/delaunay/deletion.rs
  • src/delaunay/insertion.rs
  • src/delaunay/pachner.rs
  • src/lib.rs
✅ Files skipped from review due to trivial changes (1)
  • docs/dev/commands.md
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/delaunay/pachner.rs
  • src/delaunay/construction.rs
  • docs/workflows.md
  • src/delaunay/deletion.rs
  • AGENTS.md
  • src/lib.rs
  • src/delaunay/insertion.rs

Walkthrough

Adds a unified Pachner-move API, a transactional vertex-deletion path, and insert_vertex renames. It also rewires preludes and crate exports, updates benchmarks, tests, and Semgrep fixtures, and restructures the documentation into focused architecture and development guides.

Changes

Pachner API, deletion, and API renames

Layer / File(s) Summary
Deletion core and repair outcomes
src/core/repair.rs
VertexRemovalOutcome replaces a bare removal count in the repair path, and remove_vertex_with_repair_seeds returns repair-seed simplex keys alongside removed simplex counts.
Deletion API and error type
src/delaunay/deletion.rs
DeleteVertexError, delete_vertex, rollback, fast-path deletion, repair fallback, spatial-index updates, and deletion tests are added.
Insertion rename and Pachner API
src/delaunay/insertion.rs, src/delaunay/flips.rs, src/core/algorithms/flips.rs, src/delaunay/pachner.rs
insert becomes insert_vertex, remove_vertex is removed from insertion, direct flip doctests point at delaunay::flips, BistellarFlips loses the extra kernel bound, and src/delaunay/pachner.rs adds PachnerMove, PachnerMoveResult, and attempt_pachner.
Crate exports and prelude reshape
src/lib.rs, src/delaunay/construction.rs, src/delaunay/validation.rs
src/lib.rs wires deletion and Pachner modules, re-exports DeleteVertexError, replaces prelude::flips with prelude::pachner, and adds prelude::deletion; construction and validation docs gain DeleteVertexError references.
Examples and tests moved to new APIs
examples/*, tests/*
Examples and tests switch to attempt_pachner, insert_vertex, delete_vertex, vertex!, and the new prelude paths, while roundtrip and prelude coverage expands.
Benchmarks and CI bench manifest
benches/*, Cargo.toml
benches/pachner_stress.rs adds a 4D stress harness, benches/delete_vertex.rs is renamed throughout, CI bench wiring uses insert_vertex, and bench lists/docs are updated.
Semgrep rules and fixtures
semgrep.yaml, tests/semgrep/src/project_rules/*
Two new Semgrep rules are added for ignored fallible results and workflow vertex macro usage, with matching fixture files and updated exclusions.
Documentation reorganization
AGENTS.md, docs/*, README.md, REFERENCES.md
AGENTS.md, docs/code_organization.md, docs/architecture/*, and docs/dev/* are rewritten into focused navigation, ownership, workflow, and architecture guides; user-facing docs are updated to the new naming.

Possibly related issues

Possibly related PRs

  • acgetchell/delaunay#124: Both PRs touch triangulation invariants around vertex removal and topology consistency.
  • acgetchell/delaunay#392: Both PRs touch the public-namespace and import-path cleanup around docs/code_organization.md and related facade use.
  • acgetchell/delaunay#401: Both PRs modify the remove_vertex repair path in src/core/repair.rs.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 I hop where the Pachner moves align,
And delete_vertex leaves no loose design.
New preludes bloom, the warren is neat,
With insert_vertex dancing on quick little feet.
Benchmarks chatter, docs now sing,
A tidy burrow for every spring.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: splitting Pachner moves from vertex lifecycle edits.
Description check ✅ Passed The description matches the changeset and summarizes the API split, docs, benchmarks, and lint rules.
Linked Issues check ✅ Passed The PR defines PachnerMove, adds attempt_pachner, preserves low-level flip APIs, and adds a pachner stress benchmark as requested in #252.
Out of Scope Changes check ✅ Passed The changes stay aligned with the API refactor and supporting docs, benchmarks, and rules; no unrelated code work stands out.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 100.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/252-pachner-api-split

Comment @coderabbitai help to get the list of available commands.

@codacy-production

codacy-production Bot commented Jun 24, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 119 complexity

Metric Results
Complexity 119

View in Codacy

🟢 Coverage 97.66% diff coverage · +0.07% coverage variation

Metric Results
Coverage variation +0.07% coverage variation (-1.00%)
Diff coverage 97.66% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (db3fcb3) 72534 66383 91.52%
Head commit (4893b18) 72771 (+237) 66650 (+267) 91.59% (+0.07%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#477) 684 668 97.66%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

🧹 Nitpick comments (2)
src/delaunay/insertion.rs (1)

55-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove stale deletion references from the insertion module comments.

These comments still describe deletion as part of this module/path, which conflicts with the insertion-only API split.

Suggested cleanup
-// Incremental insertion, deletion, and post-insertion repair/check helpers.
+// Incremental insertion and post-insertion repair/check helpers.
 // These require an f64-backed kernel for spatial-index construction,
-// Triangulation-layer insertion, and Triangulation-layer deletion.
+// and Triangulation-layer insertion.
-        // - Future: Delaunay property restoration after deletion
+        // - Policy-controlled Delaunay property restoration after insertion

Also applies to: 184-184

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/delaunay/insertion.rs` around lines 55 - 57, The comments in the
insertion path still mention deletion, which no longer matches the
insertion-only split. Update the module documentation near the insertion helpers
in insertion.rs so it only describes incremental insertion and post-insertion
repair/check behavior, and remove any reference to Triangulation-layer deletion
or deletion-related support from the affected comment blocks.
src/lib.rs (1)

1387-1391: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make this compile-fail guard the new Pachner prelude contract.

This currently proves only that the old prelude::flips path is gone. Point it at prelude::pachner so it catches accidental re-export of BistellarFlips.

As per coding guidelines, “Focused preludes must stay narrow and workflow-specific; use delaunay::prelude::pachner::* for Pachner workflows, and import primitive bistellar flips directly only for testing, benchmarking, or documenting that primitive layer.”

Suggested doctest adjustment
 /// ```compile_fail
-/// use delaunay::prelude::flips::BistellarFlips;
+/// use delaunay::prelude::pachner::BistellarFlips;
 /// ```
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib.rs` around lines 1387 - 1391, Update the compile_fail doctest in the
focused prelude docs to validate the new Pachner prelude contract instead of the
removed flips path. In the `src/lib.rs` prelude documentation block, change the
import used in the guard to `delaunay::prelude::pachner::BistellarFlips` so the
test catches any accidental re-export from `prelude::pachner`. Keep the check
scoped to the existing doctest near the focused prelude explanation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/workflows.md`:
- Around line 456-457: Reword the delete_vertex documentation to match the
actual behavior: successful deletions do not reset the spatial index, they only
remove the deleted vertex entry and rely on live TDS validation for lookups.
Update the wording around the delete_vertex workflow in docs/workflows.md to
avoid implying a full spatial-index invalidation while still describing that
stale locate hints are no longer used.

In `@src/delaunay/deletion.rs`:
- Around line 229-266: The delete_vertex path in deletion::delete_vertex
currently returns success when
should_run_delaunay_repair_after_mutation(topology) is false, without enforcing
the Level-4 Delaunay invariant. Update this flow so it either performs the
repair via repair_delaunay_with_flips_k2_k3 and
normalize_and_promote_positive_orientation, or explicitly runs the Level-4
validation and maps any failure to DeleteVertexError::InvariantViolation with
rollback instead of returning Ok(simplices_removed).
- Around line 232-236: The vertex-deletion repair path in `deletion.rs`
currently calls `repair_delaunay_with_flips_k2_k3` with `None`, leaving the
flip-repair work unbounded and implicit. Update the `repair_result` block in
`delete_vertex` to derive or accept a deletion-specific maximum flip budget and
pass it explicitly as `Some(max_flips)` to `repair_delaunay_with_flips_k2_k3`,
so the repair work stays bounded and non-convergence can be surfaced
consistently.

---

Nitpick comments:
In `@src/delaunay/insertion.rs`:
- Around line 55-57: The comments in the insertion path still mention deletion,
which no longer matches the insertion-only split. Update the module
documentation near the insertion helpers in insertion.rs so it only describes
incremental insertion and post-insertion repair/check behavior, and remove any
reference to Triangulation-layer deletion or deletion-related support from the
affected comment blocks.

In `@src/lib.rs`:
- Around line 1387-1391: Update the compile_fail doctest in the focused prelude
docs to validate the new Pachner prelude contract instead of the removed flips
path. In the `src/lib.rs` prelude documentation block, change the import used in
the guard to `delaunay::prelude::pachner::BistellarFlips` so the test catches
any accidental re-export from `prelude::pachner`. Keep the check scoped to the
existing doctest near the focused prelude explanation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 5f45e8b1-ab58-45dc-8213-882c1fe704d3

📥 Commits

Reviewing files that changed from the base of the PR and between db3fcb3 and e728bb1.

📒 Files selected for processing (61)
  • AGENTS.md
  • Cargo.toml
  • README.md
  • REFERENCES.md
  • benches/PERFORMANCE_RESULTS.md
  • benches/README.md
  • benches/ci_performance_suite.rs
  • benches/common/flip_workflows.rs
  • benches/delete_vertex.rs
  • benches/pachner_stress.rs
  • docs/README.md
  • docs/RELEASING.md
  • docs/api_design.md
  • docs/architecture/README.md
  • docs/architecture/module_map.md
  • docs/architecture/module_patterns.md
  • docs/architecture/prelude_reference.md
  • docs/architecture/project_structure.md
  • docs/code_organization.md
  • docs/dev/README.md
  • docs/dev/commands.md
  • docs/dev/docs.md
  • docs/dev/git.md
  • docs/dev/perf-tuning.md
  • docs/dev/rust.md
  • docs/dev/testing.md
  • docs/dev/tooling-alignment.md
  • docs/numerical_robustness_guide.md
  • docs/production_review_remediation_checklist.md
  • docs/workflows.md
  • examples/README.md
  • examples/delaunayize_repair.rs
  • examples/diagnostics.rs
  • examples/topology_editing.rs
  • semgrep.yaml
  • src/core/algorithms/flips.rs
  • src/core/repair.rs
  • src/core/tds/mutation.rs
  • src/core/tds/storage.rs
  • src/core/traits/facet_cache.rs
  • src/delaunay/construction.rs
  • src/delaunay/deletion.rs
  • src/delaunay/flips.rs
  • src/delaunay/insertion.rs
  • src/delaunay/pachner.rs
  • src/delaunay/query.rs
  • src/delaunay/validation.rs
  • src/geometry/algorithms/convex_hull.rs
  • src/lib.rs
  • tests/README.md
  • tests/benchmark_flip_fixtures.rs
  • tests/delaunay_incremental_insertion.rs
  • tests/delaunay_repair_fallback.rs
  • tests/delaunayize_workflow.rs
  • tests/pachner_roundtrip.rs
  • tests/prelude_exports.rs
  • tests/proptest_convex_hull.rs
  • tests/proptest_delaunay_triangulation.rs
  • tests/proptest_flips.rs
  • tests/semgrep/src/project_rules/rust_style.rs
  • tests/semgrep/src/project_rules/workflow_vertex_macro.rs

Comment thread docs/workflows.md Outdated
Comment thread src/delaunay/deletion.rs
Comment thread src/delaunay/deletion.rs
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.60120% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.56%. Comparing base (db3fcb3) to head (4893b18).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/delaunay/deletion.rs 96.30% 13 Missing ⚠️
src/core/repair.rs 97.90% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #477      +/-   ##
==========================================
+ Coverage   91.49%   91.56%   +0.06%     
==========================================
  Files          78       80       +2     
  Lines       72313    72550     +237     
==========================================
+ Hits        66164    66431     +267     
+ Misses       6149     6119      -30     
Flag Coverage Δ
unittests 91.56% <97.60%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

- Validate the Level 4 Delaunay invariant when automatic post-deletion repair is disabled, rolling back instead of returning success on violations.
- Bound vertex-deletion flip repair with the shared local repair budget so non-convergence is surfaced consistently.
- Document that successful deletion prunes only the removed spatial-index entry while live TDS validation protects later lookups.
- Refine maintainer guidance for choosing focused Rust validators for test-, example-, and benchmark-only changes.
@acgetchell
acgetchell enabled auto-merge (squash) June 24, 2026 11:24
@acgetchell
acgetchell merged commit f6efe10 into main Jun 24, 2026
24 checks passed
@acgetchell
acgetchell deleted the feat/252-pachner-api-split branch June 24, 2026 12:03
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.

Unified Pachner Move API

1 participant