Skip to content

refactor(core)!: replace public core module with focused facades#392

Merged
acgetchell merged 4 commits into
mainfrom
refactor/388-core-facades
May 17, 2026
Merged

refactor(core)!: replace public core module with focused facades#392
acgetchell merged 4 commits into
mainfrom
refactor/388-core-facades

Conversation

@acgetchell
Copy link
Copy Markdown
Owner

  • Make crate::core private and expose low-level APIs through curated tds, collections, algorithms, and query modules.
  • Add focused prelude/docs coverage for the new public import paths.
  • Update downstream-style tests and doctests to stop relying on delaunay::core.

BREAKING CHANGE: delaunay::core is no longer a public module. Downstream callers should import low-level APIs from delaunay::tds, delaunay::collections, delaunay::algorithms, delaunay::query, or the matching focused preludes.

Fixes #388

- Make `crate::core` private and expose low-level APIs through curated
  `tds`, `collections`, `algorithms`, and `query` modules.
- Add focused prelude/docs coverage for the new public import paths.
- Update downstream-style tests and doctests to stop relying on
  `delaunay::core`.

BREAKING CHANGE: `delaunay::core` is no longer a public module. Downstream
callers should import low-level APIs from `delaunay::tds`,
`delaunay::collections`, `delaunay::algorithms`, `delaunay::query`, or the
matching focused preludes.

Fixes #388
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

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: e815f10f-668a-4fbc-94f4-0f919849ced8

📥 Commits

Reviewing files that changed from the base of the PR and between 69f4fc3 and ba0435f.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • justfile
  • src/core/vertex.rs
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/core/vertex.rs
  • justfile

Walkthrough

Hides the crate-internal core module, adds curated crate-root facades (collections, tds, algorithms, query) and prelude re-exports, updates internal paths/macros and batch-progress telemetry, and migrates documentation, doctests, tests, and tooling recipes to the new public import surface.

Changes

Public namespace policy: hide core, expose curated facades

Layer / File(s) Summary
Namespace policy documentation
CONTRIBUTING.md, README.md, docs/code_organization.md, docs/production_review_remediation_checklist.md, CHANGELOG.md
Adds and updates policy language: src/core/ is internal; public low-level APIs are exposed via curated facades delaunay::tds, delaunay::collections, delaunay::algorithms, delaunay::query and matching preludes; adds an “Unreleased” changelog section.
Core encapsulation and prelude/facade wiring
src/lib.rs
Change pub mod coremod core; add crate-root facade modules and rewire prelude re-exports and doctests to route consumers through crate::tds, crate::collections, crate::algorithms, and crate::query.
Internal re-exports, macros, and docs
src/core/*, src/core/algorithms/locate.rs, src/core/algorithms/incremental_insertion.rs, src/core/vertex.rs, src/core/util/jaccard.rs
Remove select public re-exports, narrow diagnostics/test cfg gating, and update macro/internal call-site paths and doc examples to use the new prelude/facade locations.
Triangulation public surface & delaunayize/flips re-exports
src/triangulation.rs, src/triangulation/delaunayize.rs, src/triangulation/flips.rs
Expand triangulation module re-exports and retarget public pub use exports to facade/crate::triangulation paths instead of crate::core::*.
Triangulation bulk progress telemetry
src/triangulation/delaunay.rs
Refactor batch progress telemetry to bulk-only counters/fields, update logging gating/cadence and bookkeeping, and update unit tests and doc references accordingly.
Test imports migration & large-debug harness
tests/*, tests/README.md, tests/large_scale_debug.rs, tests/prelude_exports.rs
Migrate test and README import paths to the curated preludes/facades (e.g., delaunay::prelude::query, delaunay::prelude::tds, delaunay::prelude::triangulation::construction), add DELAUNAY_LARGE_DEBUG_PROGRESS_EVERY env handling, and update prelude smoke tests to import vertex from the construction prelude.
Tooling/Justfile formatting
justfile
Add [private] marker and reformat template-variable spacing and inline command quoting; update coverage/profile/tagging recipe templates and TOML-check inline Python invocation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • acgetchell/delaunay#147: Introduced InsertionOutcome/statistics and relates to re-export/routing changes for insertion telemetry.
  • acgetchell/delaunay#309: Adjusts gating for conflict-region verification and relates to locate/diagnostics work updated here.
  • acgetchell/delaunay#356: Related focused prelude migration and diagnostics/test gating that overlaps with this PR.

Poem

🐰 I hopped through docs and hid the core,
Facades at root now open the door.
Macros and tests now find the right place,
Bulk progress trimmed to a tidy trace.
A rabbit nods — namespace neat, on the morrow!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: replacing the public core module with focused facade modules (tds, collections, algorithms, query).
Description check ✅ Passed The description is related to the changeset and explains the main objective: making crate::core private and exposing low-level APIs through curated public modules.
Linked Issues check ✅ Passed The PR fulfills all coding requirements from #388: makes crate::core private, exposes low-level APIs through curated modules (tds, collections, algorithms, query), updates documentation and tests, and includes focused preludes.
Out of Scope Changes check ✅ Passed All changes are in scope: privatizing core, creating facade modules, updating documentation, tests, and preludes to reflect the new import strategy as required by #388.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.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 refactor/388-core-facades

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

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 17, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 88.57% diff coverage · +0.01% coverage variation

Metric Results
Coverage variation +0.01% coverage variation (-1.00%)
Diff coverage 88.57% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (5fb2d4a) 61000 55188 90.47%
Head commit (ba0435f) 61005 (+5) 55199 (+11) 90.48% (+0.01%)

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 (#392) 35 31 88.57%

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 added documentation Improvements or additions to documentation rust Pull requests that update rust code breaking change api topology labels May 17, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 `@CHANGELOG.md`:
- Around line 10-19: The generated CHANGELOG is missing the breaking-change note
about the namespace/visibility break in delaunay::core from PR `#392`; update the
changelog generation inputs (not the generated file) so the generator picks up
this break: ensure PR `#392` is tagged with the breaking-change label and/or add
the explicit breaking-change entry for "delaunay::core visibility break" into
the changelog metadata used by the generator (e.g., the PR release-notes body or
changelog source data) so the Unreleased section includes this namespace break
on next generation.

In `@src/lib.rs`:
- Around line 71-84: Update the crate-level documentation to stop linking or
referencing types via crate::core; replace any occurrences that expose or point
readers to the private namespace with the public curated module paths (use
crate::tds, crate::collections, crate::algorithms, crate::query and their
focused preludes) and update example/doctest/benchmark links and
cross-references that currently use crate::core::... to reference the
corresponding public symbol (e.g., public types/functions currently linked
through crate::core::TypeName should be linked as crate::tds::TypeName or
crate::collections::TypeName as appropriate), ensuring all policy and example
text and intra-doc links consistently point to the public low-level surface
instead of crate::core.

In `@tests/public_topology_api.rs`:
- Around line 11-13: Update tests that import the vertex macro from the crate
root to instead import from the recommended curated path: replace uses of
delaunay::vertex (or re-exports at crate root) with imports from
delaunay::prelude::triangulation::construction::vertex (or use a glob import
from delaunay::prelude::triangulation::construction::*). Specifically modify the
test modules mentioned (tests/tds_orientation.rs, tests/prelude_exports.rs,
tests/delaunay_public_api_coverage.rs) so they reference the vertex macro via
the construction prelude (symbol: vertex or vertex! macro) to match
tests/public_topology_api.rs and the documented guidance.
🪄 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: aee10700-4d76-4166-aaf6-72fb3741bde0

📥 Commits

Reviewing files that changed from the base of the PR and between 5fb2d4a and 3fc95ea.

📒 Files selected for processing (27)
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • docs/code_organization.md
  • docs/production_review_remediation_checklist.md
  • src/core/algorithms/incremental_insertion.rs
  • src/core/algorithms/locate.rs
  • src/core/boundary.rs
  • src/core/traits/facet_cache.rs
  • src/core/util/jaccard.rs
  • src/core/vertex.rs
  • src/lib.rs
  • src/triangulation.rs
  • src/triangulation/delaunay.rs
  • tests/README.md
  • tests/check_perturbation_stats.rs
  • tests/delaunay_incremental_insertion.rs
  • tests/delaunayize_workflow.rs
  • tests/proptest_convex_hull.rs
  • tests/proptest_facet.rs
  • tests/proptest_orientation.rs
  • tests/proptest_tds.rs
  • tests/proptest_vertex.rs
  • tests/public_topology_api.rs
  • tests/serialization_vertex_preservation.rs
  • tests/tds_orientation.rs
  • tests/trait_bound_ergonomics.rs
💤 Files with no reviewable changes (2)
  • tests/proptest_convex_hull.rs
  • src/core/algorithms/incremental_insertion.rs

Comment thread CHANGELOG.md
Comment thread src/lib.rs
Comment thread tests/public_topology_api.rs
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

❌ Patch coverage is 88.57143% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.47%. Comparing base (5fb2d4a) to head (ba0435f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/triangulation/delaunay.rs 87.87% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #392      +/-   ##
==========================================
+ Coverage   90.46%   90.47%   +0.01%     
==========================================
  Files          61       61              
  Lines       60796    60801       +5     
==========================================
+ Hits        54998    55009      +11     
+ Misses       5798     5792       -6     
Flag Coverage Δ
unittests 90.47% <88.57%> (+0.01%) ⬆️

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

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

- Report the effective batch progress cadence in the large-scale debug harness, including the canonical `DELAUNAY_BULK_PROGRESS_EVERY` fallback behavior.
- Rename bulk progress tracing fields so post-initial-simplex counters are distinct from total input and final insertion statistics.
- Point public docs and downstream-style API tests at curated low-level modules and construction prelude imports.
- Regenerate the changelog so the core facade break appears in Unreleased.

BREAKING CHANGE: Bulk progress tracing fields were renamed from `processed`, `total_vertices`, `inserted`, and `skipped` to explicit `bulk_*`, `input_vertices`, and `initial_simplex_vertices` fields.
@acgetchell acgetchell enabled auto-merge (squash) May 17, 2026 06:14
@coderabbitai coderabbitai Bot added the enhancement New feature or request label May 17, 2026
@acgetchell
Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/lib.rs (1)

1112-1119: ⚡ Quick win

Pick one canonical home for point-location APIs.

query now re-exports the same locate / conflict-region surface that delaunay::algorithms already owns. That gives downstream users two equally official import paths for the same low-level API and weakens the new “focused facades” story. Either keep these exports under algorithms only, or document query as an intentional convenience superset.

🤖 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 1112 - 1119, The query module currently re-exports
low-level point-location symbols (e.g., locate, locate_with_stats,
find_conflict_region, ConflictError, LocateError, LocateFallback,
LocateFallbackReason, LocateResult, LocateStats, extract_cavity_boundary) from
crate::core::algorithms::locate which duplicates the canonical home under the
delaunay::algorithms facade; remove these pub use lines from the pub mod query
block so the locate APIs are only exported from the algorithms/delaunay facade
(or alternatively, if you prefer query to be an intentional convenience, replace
the raw re-exports with a clear module-level doc comment stating that query
intentionally re-exports the locate APIs as a convenience), and update any
internal imports to reference crate::core::algorithms::locate::locate (or the
chosen canonical path) accordingly.
🤖 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 `@src/lib.rs`:
- Around line 391-410: The PR made mod core private but left many public
signatures and docs referencing crate::core:: which exposes a now-private
namespace; update all public-facing references to use the public facade
re-exports instead (e.g., replace SurfaceMeasureError::FacetError(#[from]
crate::core::facet::FacetError) and all pub use crate::core::... prelude
exports) so public types and docs point to crate::tds, crate::collections,
crate::algorithms, crate::query or the corresponding re-exports in src/lib.rs;
search for occurrences of "crate::core::" across src/lib.rs,
src/triangulation.rs and docs, change them to the appropriate public facade
symbol, and ensure doc links and error type From annotations reference the
public re-exported types rather than crate::core:: symbols.

---

Nitpick comments:
In `@src/lib.rs`:
- Around line 1112-1119: The query module currently re-exports low-level
point-location symbols (e.g., locate, locate_with_stats, find_conflict_region,
ConflictError, LocateError, LocateFallback, LocateFallbackReason, LocateResult,
LocateStats, extract_cavity_boundary) from crate::core::algorithms::locate which
duplicates the canonical home under the delaunay::algorithms facade; remove
these pub use lines from the pub mod query block so the locate APIs are only
exported from the algorithms/delaunay facade (or alternatively, if you prefer
query to be an intentional convenience, replace the raw re-exports with a clear
module-level doc comment stating that query intentionally re-exports the locate
APIs as a convenience), and update any internal imports to reference
crate::core::algorithms::locate::locate (or the chosen canonical path)
accordingly.
🪄 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: b3d85af4-9a94-4db6-af40-7af558766d80

📥 Commits

Reviewing files that changed from the base of the PR and between 5fb2d4a and 393e463.

📒 Files selected for processing (31)
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • docs/code_organization.md
  • docs/dev/debug_env_vars.md
  • docs/production_review_remediation_checklist.md
  • src/core/algorithms/incremental_insertion.rs
  • src/core/algorithms/locate.rs
  • src/core/boundary.rs
  • src/core/traits/facet_cache.rs
  • src/core/util/jaccard.rs
  • src/core/vertex.rs
  • src/lib.rs
  • src/triangulation.rs
  • src/triangulation/delaunay.rs
  • tests/README.md
  • tests/check_perturbation_stats.rs
  • tests/delaunay_incremental_insertion.rs
  • tests/delaunay_public_api_coverage.rs
  • tests/delaunayize_workflow.rs
  • tests/large_scale_debug.rs
  • tests/prelude_exports.rs
  • tests/proptest_convex_hull.rs
  • tests/proptest_facet.rs
  • tests/proptest_orientation.rs
  • tests/proptest_tds.rs
  • tests/proptest_vertex.rs
  • tests/public_topology_api.rs
  • tests/serialization_vertex_preservation.rs
  • tests/tds_orientation.rs
  • tests/trait_bound_ergonomics.rs
💤 Files with no reviewable changes (2)
  • tests/proptest_convex_hull.rs
  • src/core/algorithms/incremental_insertion.rs

Comment thread src/lib.rs
- Move public documentation, doctests, and prelude exports away from the private `crate::core` namespace.
- Keep point-location and conflict-region APIs canonical under `delaunay::algorithms` and `delaunay::prelude::algorithms`.
- Expose repair, insertion, flip, and validation contracts through the triangulation and TDS facades.
- Harden `toml-check` by passing TOML filenames to Python via argv.

BREAKING CHANGE: `delaunay::query` and `delaunay::prelude::query` no longer re-export point-location and conflict-region APIs. Import `locate`, `locate_with_stats`, `find_conflict_region`, `extract_cavity_boundary`, and related locate/conflict types from `delaunay::algorithms` or `delaunay::prelude::algorithms` instead.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
justfile (1)

14-14: 💤 Low value

The [private] attribute placement is correct but redundant.

The [private] attribute at line 14 applies to the variable _coverage_base_args (line 15), not the recipe _ensure-actionlint. This is valid just syntax—the attribute can be placed on variables to hide them from just --variables output. However, since the variable already starts with _, it is automatically hidden by naming convention, making the [private] attribute redundant. Consider removing it for simplicity.

🤖 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 `@justfile` at line 14, The `[private]` attribute on the line above
`_coverage_base_args` is redundant because the variable is already hidden by its
leading underscore; remove the solitary `[private]` attribute line and leave the
variable `_coverage_base_args` and the recipe `_ensure-actionlint` unchanged so
the variable remains hidden by convention and no other attributes are affected.
🤖 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 `@justfile`:
- Line 954: The one-liner that calls Python to validate TOML uses
open(sys.argv[1], 'rb') without closing the file; update the command string (the
Python -c invocation inside the xargs call) to open the file with a context
manager (e.g., use "with open(..., 'rb') as f: tomllib.load(f) ..." inside the
-c code) or explicitly close the file after loading so the file handle is not
leaked.

---

Nitpick comments:
In `@justfile`:
- Line 14: The `[private]` attribute on the line above `_coverage_base_args` is
redundant because the variable is already hidden by its leading underscore;
remove the solitary `[private]` attribute line and leave the variable
`_coverage_base_args` and the recipe `_ensure-actionlint` unchanged so the
variable remains hidden by convention and no other attributes are affected.
🪄 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: 68b8667c-3728-406e-b997-00003bab6cea

📥 Commits

Reviewing files that changed from the base of the PR and between 393e463 and 69f4fc3.

📒 Files selected for processing (11)
  • docs/numerical_robustness_guide.md
  • docs/validation.md
  • justfile
  • src/core/algorithms/locate.rs
  • src/lib.rs
  • src/triangulation.rs
  • src/triangulation/delaunay.rs
  • src/triangulation/delaunayize.rs
  • src/triangulation/flips.rs
  • src/triangulation/validation.rs
  • tests/allocation_api.rs
✅ Files skipped from review due to trivial changes (2)
  • docs/numerical_robustness_guide.md
  • src/triangulation/validation.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/core/algorithms/locate.rs
  • src/lib.rs

Comment thread justfile Outdated
- Route the exported `vertex!` macro through the canonical `tds` facade.
- Harden TOML validation by loading files through a scoped Python file handle.
- Regenerate changelog entries for the existing facade and diagnostics breaking changes.
@acgetchell acgetchell merged commit 655ff4c into main May 17, 2026
21 checks passed
@acgetchell acgetchell deleted the refactor/388-core-facades branch May 17, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api breaking change documentation Improvements or additions to documentation enhancement New feature or request rust Pull requests that update rust code topology

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor!: decide public core module naming

1 participant