Skip to content

Refactor/445 realization validation#515

Draft
acgetchell wants to merge 2 commits into
mainfrom
refactor/445-realization-validation
Draft

Refactor/445 realization validation#515
acgetchell wants to merge 2 commits into
mainfrom
refactor/445-realization-validation

Conversation

@acgetchell

Copy link
Copy Markdown
Owner

No description provided.

- Rename Level 4 validation APIs, diagnostics, reports, errors, and helper modules to use realization terminology.
- Align Euclidean, toroidal, and spherical validation paths around Valid Realization before Level 5 geometric predicates.
- Refresh validation docs, references, notebook figures, and paper artifacts to distinguish realization validity from Delaunay optimality.

BREAKING CHANGE: Level 4 embedding APIs and types were removed in favor of realization names. Callers must migrate from `is_valid_embedding`, `validate_embedding`, `embedding_report`, and `TriangulationEmbeddingValidationError` to the corresponding realization APIs and types.
- Point validation Semgrep rules at the realization module after the Level 4  terminology rename.
- Align uv and ty tool-version references with the current reviewed toolchain.
- Make optional benchmark comparison reports use the existing atomic writer.
- Clarify convex hull docs around stale detached hull snapshots.
@acgetchell acgetchell self-assigned this Jul 9, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Renames "embedding validity" to "valid realization" across Level 4 validation throughout the codebase: core validation types, error enums, geometry predicates, delaunay/spherical wiring, public API/prelude exports, topology docs, tests, documentation, a validation notebook, a LaTeX paper, and bumps pinned uv/ty tooling versions in CI workflows.

Changes

Embedding to Realization Rename

Layer / File(s) Summary
Core realization validation module
src/core/realization.rs
Introduces realization-specific error enums, RealizedSimplex, and public is_valid_realization/realization_diagnostic/realization_report/validate_realization APIs replacing embedding equivalents, with rewritten tests.
Core error plumbing
src/core/tds/errors.rs, src/core/construction.rs, src/core/insertion.rs, src/core/repair.rs, src/core/validation.rs, src/core/algorithms/incremental_insertion.rs, src/core/algorithms/flips.rs
Renames InvariantError, InsertionError, TriangulationConstructionError, and FlipError variants from embedding to realization, plus field renames and updated tests.
Delaunay-layer wiring
src/delaunay/validation.rs, builder.rs, construction.rs, flips.rs, pachner.rs, query.rs, spherical.rs
Switches Level 5 gating to validate_realization() and renames ExplicitConstructionError/DelaunayConstructionFailure/SphericalValidationLayer variants.
Geometry realization predicates
src/geometry/realization.rs, util/measures.rs, util/point_generation.rs, algorithms/convex_hull.rs
Renames LabeledSimplexEmbedding types/APIs to LabeledSimplexRealization equivalents and updates docs/tests.
Topology/TDS terminology
src/topology/traits/*, src/core/tds/mutation.rs, rollback.rs, storage.rs, validation.rs, src/core/facet.rs
Renames supports_affine_embedding_validation to supports_affine_chart_realization_validation and updates "embedded" wording to "realized".
Crate root/prelude exports
src/lib.rs
Swaps re-exported TriangulationEmbedding* types for TriangulationRealization* and renames the internal module.
Config demo case and semgrep paths
src/config.rs, semgrep.yaml
Updates Level 4 validation-demo metadata and semgrep rule path targets.
Test suite updates
tests/*.rs
Updates assertions/imports across many test files to use realization APIs and error variants.
Documentation updates
AGENTS.md, README.md, REFERENCES.md, CITATION.cff, docs/*.md, benches/*
Renames "Embedding Validity" to "Valid Realization" across documentation, references, and benchmark descriptions.

CI Tooling Version Bumps

Layer / File(s) Summary
uv/ty version pins and atomic write
.github/workflows/*.yml, docs/dev/tooling-alignment.md, docs/dev/perf-tuning.md, scripts/benchmark_utils.py
Bumps UV_VERSION to 0.11.28 and ty to 0.0.56, and switches report writing to an atomic helper.

Validation Notebook and Paper Figures

Layer / File(s) Summary
Per-level validation figure rendering
notebooks/01_validation.ipynb
Replaces the combined validation table with hierarchy overview plus per-level PNG rendering and updated artifact checks.
Validation paper witness panels
papers/validation.tex
Adds a \ValidationWitnessPanel macro and composite witness figure, updating terminology to realization.

Estimated code review effort: 4 (Complex) | ~75 minutes

Possibly related PRs

  • acgetchell/delaunay#481: Introduced the Level-4 embedding validation layer that this PR renames to realization across the same APIs and error types.
  • acgetchell/delaunay#333: Both modify the same flip Level-4 postcondition validation logic in src/core/algorithms/flips.rs.
  • acgetchell/delaunay#489: Both touch FlipError/FlipFailureKind variants and flip validation paths in src/core/algorithms/flips.rs.

Suggested labels: documentation, enhancement, rust, breaking change, geometry, api

Poem

A rabbit hopped through fields of code,
Where "embedding" once bravely strode,
Now "realization" takes the stage,
Renamed with care on every page. 🐇✨
Hop, hop — the triangulation's true,
Valid and real, through and through!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided, so the intent of the changeset is not described. Add a short summary of the validation refactor and its scope so reviewers can confirm intent.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: switching validation terminology and APIs to realization validation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 100.00%.
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.
✨ 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/445-realization-validation

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

@codacy-production

codacy-production Bot commented Jul 9, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 296 complexity

Metric Results
Complexity 296

View in Codacy

🟢 Coverage 80.83% diff coverage · 0.00% coverage variation

Metric Results
Coverage variation 0.00% coverage variation (-1.00%)
Diff coverage 80.83% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ff74d7c) 80105 72941 91.06%
Head commit (ee5131c) 80114 (+9) 72947 (+6) 91.05% (0.00%)

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 (#515) 433 350 80.83%

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 api breaking change documentation Improvements or additions to documentation enhancement New feature or request geometry Geometry-related issues rust Pull requests that update rust code labels Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.83141% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.03%. Comparing base (ff74d7c) to head (ee5131c).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/core/realization.rs 76.52% 54 Missing ⚠️
src/delaunay/validation.rs 62.50% 12 Missing ⚠️
src/core/insertion.rs 64.28% 5 Missing ⚠️
src/core/algorithms/flips.rs 87.50% 3 Missing ⚠️
src/core/algorithms/incremental_insertion.rs 0.00% 3 Missing ⚠️
src/core/tds/errors.rs 0.00% 1 Missing ⚠️
src/delaunay/builder.rs 66.66% 1 Missing ⚠️
src/delaunay/flips.rs 93.33% 1 Missing ⚠️
src/delaunay/query.rs 0.00% 1 Missing ⚠️
src/delaunay/spherical.rs 93.33% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #515      +/-   ##
==========================================
- Coverage   91.03%   91.03%   -0.01%     
==========================================
  Files          88       88              
  Lines       79884    79893       +9     
==========================================
+ Hits        72722    72728       +6     
- Misses       7162     7165       +3     
Flag Coverage Δ
unittests 91.03% <80.83%> (-0.01%) ⬇️

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.

@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

🤖 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/invariants.md`:
- Around line 119-138: The Level 4 description is still attributing realization
validation to Euclidean/toroidal topology instead of the validator API. Update
the wording in this invariants section to make
`Triangulation::is_valid_realization()` and `validate_realization()` the
explicit Level 4 owners, while keeping `is_valid_topology()` as Level 3 and
`DelaunayTriangulation::is_valid_delaunay()` as Level 5. Rephrase the
surrounding text so the ownership model matches the actual API surface and
avoids implying topology performs Level 4 validation.

In `@docs/workflows.md`:
- Around line 440-441: The deletion description contains a duplicated “Level 4”
phrase in the workflow text. Update the sentence in the deletion/repair section
so it reads naturally by removing the repeated “Level 4” before “realization
validation,” while keeping the rest of the validation and rollback behavior
wording unchanged.

In `@papers/validation.tex`:
- Around line 74-79: Restore this `papers/validation.tex` block to an
author-owned placeholder instead of finished prose: the `\caption{...}` and
`\Description{...}` in the validation hierarchy figure should be wrapped back
into `\AuthorTodo{}` like the other prose blocks in this file. Keep the
structure in place, but remove the publication-ready caption/alt text and match
the file’s existing pattern so the author can supply the final wording later.
🪄 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: ab721cdd-7e01-4868-a488-21891d1fed5a

📥 Commits

Reviewing files that changed from the base of the PR and between ff74d7c and ee5131c.

⛔ Files ignored due to path filters (8)
  • papers/generated/validation_hierarchy.png is excluded by !**/*.png, !**/generated/**
  • papers/generated/validation_level_1_element_validity.png is excluded by !**/*.png, !**/generated/**
  • papers/generated/validation_level_2_combinatorial_consistency.png is excluded by !**/*.png, !**/generated/**
  • papers/generated/validation_level_3_intrinsic_pl_topology.png is excluded by !**/*.png, !**/generated/**
  • papers/generated/validation_level_4_valid_realization.png is excluded by !**/*.png, !**/generated/**
  • papers/generated/validation_level_5_geometric_predicates.png is excluded by !**/*.png, !**/generated/**
  • papers/generated/validation_model_failures.png is excluded by !**/*.png, !**/generated/**
  • papers/validation.pdf is excluded by !**/*.pdf
📒 Files selected for processing (74)
  • .github/workflows/benchmarks.yml
  • .github/workflows/ci.yml
  • .github/workflows/generate-baseline.yml
  • .github/workflows/papers.yml
  • .github/workflows/release-benchmarks.yml
  • .github/workflows/semgrep-sarif.yml
  • AGENTS.md
  • CITATION.cff
  • README.md
  • REFERENCES.md
  • benches/README.md
  • benches/common/flip_fixtures.rs
  • benches/profiling_suite.rs
  • docs/ORIENTATION_SPEC.md
  • docs/api_design.md
  • docs/architecture/module_map.md
  • docs/architecture/prelude_reference.md
  • docs/code_organization.md
  • docs/dev/commands.md
  • docs/dev/perf-tuning.md
  • docs/dev/tooling-alignment.md
  • docs/diagnostics.md
  • docs/invariants.md
  • docs/limitations.md
  • docs/topology.md
  • docs/validation.md
  • docs/workflows.md
  • notebooks/01_validation.ipynb
  • papers/validation.tex
  • scripts/benchmark_utils.py
  • semgrep.yaml
  • src/config.rs
  • src/core/algorithms/flips.rs
  • src/core/algorithms/incremental_insertion.rs
  • src/core/construction.rs
  • src/core/facet.rs
  • src/core/insertion.rs
  • src/core/realization.rs
  • src/core/repair.rs
  • src/core/tds/errors.rs
  • src/core/tds/mutation.rs
  • src/core/tds/rollback.rs
  • src/core/tds/storage.rs
  • src/core/tds/validation.rs
  • src/core/validation.rs
  • src/delaunay/builder.rs
  • src/delaunay/construction.rs
  • src/delaunay/flips.rs
  • src/delaunay/pachner.rs
  • src/delaunay/query.rs
  • src/delaunay/spherical.rs
  • src/delaunay/validation.rs
  • src/geometry/algorithms/convex_hull.rs
  • src/geometry/realization.rs
  • src/geometry/util/measures.rs
  • src/geometry/util/point_generation.rs
  • src/lib.rs
  • src/topology/spaces/euclidean.rs
  • src/topology/spaces/spherical.rs
  • src/topology/traits/global_topology_model.rs
  • src/topology/traits/topological_space.rs
  • tests/benchmark_flip_fixtures.rs
  • tests/cli.rs
  • tests/delaunay_edge_cases.rs
  • tests/euler_characteristic.rs
  • tests/large_scale_debug.rs
  • tests/pachner_roundtrip.rs
  • tests/prelude_exports.rs
  • tests/proptest_delaunay_triangulation.rs
  • tests/proptest_flips.rs
  • tests/regressions.rs
  • tests/semgrep/src/project_rules/rust_style.rs
  • tests/spherical_delaunay.rs
  • tests/triangulation_builder.rs

Comment thread docs/invariants.md
Comment on lines +119 to +138
4. **Level 4 — Valid Realization**: the complex is geometrically valid in the chosen coordinate
model. Euclidean/toroidal topology validates affine-chart realizations, with toroidal checks
lifted to periodic covering-space charts; the bounded spherical prototype validates simplices on
`S^D \subset R^(D+1)`.
5. **Level 5 — Geometric Predicates**: the embedding satisfies the selected geometry-specific
predicate family. The implemented family today is Delaunay, with Euclidean/toroidal
empty-circumsphere predicates and spherical empty-cap / ambient-hull-facet predicates.
5. **Level 5 — Geometric Predicates**: the valid realization satisfies the selected
geometry-specific predicate family. The implemented family today is Delaunay, with
Euclidean/toroidal empty-circumsphere predicates and spherical empty-cap / ambient-hull-facet
predicates.

`Triangulation::is_valid_topology()` is a Level 3 intrinsic PL-topology check.
`DelaunayTriangulation::is_valid_delaunay()` is the implemented Level 5 geometric-predicate check
for an already-formed Delaunay triangulation. `Triangulation` also exposes Level 4 embedding
validation through `is_valid_embedding` /
`validate_embedding`.
for an already-formed Delaunay triangulation. `Triangulation` also exposes Level 4 realization
validation through `is_valid_realization` /
`validate_realization`.
Cumulative validation is exposed through the `validate` / `validation_report` APIs described in
[`docs/validation.md`](validation.md).

Automatic validation during construction is intentionally topology-oriented: `ValidationPolicy`
controls Level 3 checks during insertion and can enable local insertion-time embedding checks.
Full/global Level 4 embedding certification and Level 5 geometric-predicate validation remain
controls Level 3 checks during insertion and can enable local insertion-time realization checks.
Full/global Level 4 realization certification and Level 5 geometric-predicate validation remain

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Keep Level 4 ownership on the validator API.

This section still frames Level 4 as something “Euclidean/toroidal topology validates,” but the actual Level 4 surface is Triangulation::is_valid_realization() / validate_realization() in src/core/realization.rs. Rewording this around the validator would avoid a stale owner-model split.

🤖 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 `@docs/invariants.md` around lines 119 - 138, The Level 4 description is still
attributing realization validation to Euclidean/toroidal topology instead of the
validator API. Update the wording in this invariants section to make
`Triangulation::is_valid_realization()` and `validate_realization()` the
explicit Level 4 owners, while keeping `is_valid_topology()` as Level 3 and
`DelaunayTriangulation::is_valid_delaunay()` as Level 5. Rephrase the
surrounding text so the ownership model matches the actual API surface and
avoids implying topology performs Level 4 validation.

Comment thread docs/workflows.md
Comment on lines 440 to +441
`DelaunayRepairPolicy` allows it. If automatic repair is disabled, deletion still runs Level 4
Embedding Validity and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
Level 4 realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Duplicated "Level 4" in the deletion description.

The sentence reads "deletion still runs Level 4 Level 4 realization validation and the Level 5 Delaunay predicate..." — the word "Level 4" is repeated.

✏️ Proposed fix
-Level 4 realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
+Level 4 realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or

Concretely, remove the duplicate "Level 4" so the sentence reads:

-`DelaunayRepairPolicy` allows it. If automatic repair is disabled, deletion still runs Level 4
-Level 4 realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
+`DelaunayRepairPolicy` allows it. If automatic repair is disabled, deletion still runs Level 4
+realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`DelaunayRepairPolicy` allows it. If automatic repair is disabled, deletion still runs Level 4
Embedding Validity and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
Level 4 realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
`DelaunayRepairPolicy` allows it. If automatic repair is disabled, deletion still runs Level 4
realization validation and the Level 5 Delaunay predicate, rolling back on any violation. If post-deletion repair, validation, or
🤖 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 `@docs/workflows.md` around lines 440 - 441, The deletion description contains
a duplicated “Level 4” phrase in the workflow text. Update the sentence in the
deletion/repair section so it reads naturally by removing the repeated “Level 4”
before “realization validation,” while keeping the rest of the validation and
rollback behavior wording unchanged.

Comment thread papers/validation.tex
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 geometry Geometry-related issues rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant