refactor(api)!: require validated generator and Hilbert inputs - #452
Conversation
- Rename raw-bound generator and Hilbert ordering APIs to `try_*` names so fallible parsing is visible at call sites. - Add `CoordinateRange`-based and prevalidated Hilbert batch APIs for callers that already carry validation evidence. - Replace Hilbert debug-only invariants with proof-carrying index modes and typed permutation errors. - Bound ball rejection sampling with a typed `BallSamplingFailed` error instead of relying on unbounded retry. - Update preludes, examples, benches, and tests to exercise the refined API surface. BREAKING CHANGE: Raw-bound generator and Hilbert helpers now use `try_*` names, and focused preludes no longer export the old non-`try` raw-bound APIs. Callers should migrate to the `try_*` functions for raw tuple inputs or to the `*_in_range` / prevalidated batch APIs when they already have validated inputs. Resolves #441
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR refactors public APIs across Hilbert ordering, point generation, and triangulation to use the parse-don't-validate pattern: all raw coordinate bounds are now validated at fallible ChangesHilbert Core API Refactoring
Point Generation & Triangulation Naming
Construction and Batch Integration
Benchmarks Consolidated on Validated Bounds
Examples, Validation & Prelude Surface
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 76 |
🟢 Coverage 97.89% diff coverage · +0.04% coverage variation
Metric Results Coverage variation ✅ +0.04% coverage variation (-1.00%) Diff coverage ✅ 97.89% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (b1c52b6) 63824 58155 91.12% Head commit (ccb9ee4) 64257 (+433) 58576 (+421) 91.16% (+0.04%) 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 (#452) 662 648 97.89% 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.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/core/util/hilbert.rs`:
- Around line 1823-1832: The new tests only exercise D=2; extend them to cover
dimensions D=2..5 by reusing the repository's pastey macro pattern to generate
parallel cases for hilbert_quantize_in_range, HilbertQuantizedBatch::try_new,
and hilbert_quantize_batch_in_range so the happy-path is exercised for each
dimension; replace the single test (e.g.,
test_quantize_in_range_matches_tuple_boundary) with a pastey-generated set that
iterates dims 2..5 (keeping the existing D=0 special-case test), verifying
parsed == prevalidated for each dimension and using the same inputs and
CoordinateRange construction per-dimension. Ensure macro-expanded test names are
unique and follow existing naming conventions so CI recognizes them.
🪄 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: 56ab7bff-800e-4de9-9464-e9a3ec5c243f
📒 Files selected for processing (22)
benches/allocation_hot_paths.rsbenches/boundary_uuid_iter.rsbenches/ci_performance_suite.rsbenches/circumsphere_containment.rsbenches/cold_path_predicates.rsbenches/profiling_suite.rsbenches/remove_vertex.rsbenches/tds_clone.rsbenches/topology_guarantee_construction.rsexamples/triangulation_and_hull.rssrc/core/util/hilbert.rssrc/core/validation.rssrc/delaunay/construction.rssrc/geometry/util/point_generation.rssrc/geometry/util/triangulation_generation.rssrc/lib.rssrc/topology/traits/topological_space.rstests/delaunay_edge_cases.rstests/large_scale_debug.rstests/prelude_exports.rstests/proptest_euler_characteristic.rstests/regressions.rs
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #452 +/- ##
==========================================
+ Coverage 91.09% 91.13% +0.04%
==========================================
Files 72 72
Lines 63612 64045 +433
==========================================
+ Hits 57945 58366 +421
- Misses 5667 5679 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
- Generate D=2 through D=5 happy-path cases for parsed and prevalidated Hilbert quantization. - Cover prevalidated batch construction and in-range batch quantization with matching coordinate fixtures. - Keep zero-dimensional in-range quantization covered as a dedicated edge case.
try_*names so fallible parsing is visible at call sites.CoordinateRange-based and prevalidated Hilbert batch APIs for callers that already carry validation evidence.BallSamplingFailederror instead of relying on unbounded retry.BREAKING CHANGE: Raw-bound generator and Hilbert helpers now use
try_*names, and focused preludes no longer export the old non-tryraw-bound APIs. Callers should migrate to thetry_*functions for raw tuple inputs or to the*_in_range/ prevalidated batch APIs when they already have validated inputs.Resolves #441