Skip to content

feat(validation): add intrinsic orientability witnesses - #526

Merged
acgetchell merged 2 commits into
mainfrom
feat/520-intrinsic-orientability-witness
Jul 15, 2026
Merged

feat(validation): add intrinsic orientability witnesses#526
acgetchell merged 2 commits into
mainfrom
feat/520-intrinsic-orientability-witness

Conversation

@acgetchell

Copy link
Copy Markdown
Owner
  • Expose orientation certificates for pure 2D and 3D simplicial complexes.
  • Report typed non-orientability failures during Level 3 PL-manifold validation.
  • Document intrinsic orientation and refresh the generated validation diagrams.

Closes #520

- Expose orientation certificates for pure 2D and 3D simplicial complexes.
- Report typed non-orientability failures during Level 3 PL-manifold validation.
- Document intrinsic orientation and refresh the generated validation diagrams.

Closes #520
@acgetchell acgetchell self-assigned this Jul 15, 2026
@acgetchell
acgetchell enabled auto-merge (squash) July 15, 2026 02:38
@coderabbitai

coderabbitai Bot commented Jul 15, 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: b76a4c69-3480-49cf-bb82-d42b9150931f

📥 Commits

Reviewing files that changed from the base of the PR and between df17131 and 5758d78.

⛔ Files ignored due to path filters (1)
  • papers/validation.pdf is excluded by !**/*.pdf
📒 Files selected for processing (2)
  • src/core/tds/errors.rs
  • src/core/validation.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/core/tds/errors.rs
  • src/core/validation.rs

Walkthrough

Adds a public OrientationWitness API for intrinsic 2D/3D orientability, reports typed NonOrientable validation errors, integrates the check into Level 3 topology validation, and adds parity-obstruction tests, documentation, and notebook updates.

Changes

Intrinsic PL orientability

Layer / File(s) Summary
Orientation contract and public API
src/core/validation.rs, src/core/tds/errors.rs, src/core/tds/validation.rs, src/lib.rs
Adds OrientationWitness, the NonOrientable diagnostic and kind mapping, widens internal parity helper access, and re-exports the witness publicly.
Witness computation and Level 3 integration
src/core/validation.rs, src/core/algorithms/incremental_insertion.rs
Computes simplex reversal assignments with BFS parity constraints, invokes the check for applicable 2D/3D Level 3 validation, and classifies failures as retryable.
Fixtures and orientability tests
src/core/validation.rs, src/core/tds/errors.rs
Adds Möbius-strip-like and 3D parity-obstruction fixtures and tests intrinsic orientability independently from stored simplex ordering, including diagnostic-kind preservation.
Documentation and validation presentation
docs/ORIENTATION_SPEC.md, docs/validation.md, notebooks/01_validation.ipynb
Describes the three orientation properties and adds Level 3 orientability guidance, questions, and glyphs.
Repository support updates
Cargo.toml, README.md
Updates uuid and sysinfo patch versions and changes the README hero image reference to an absolute raw GitHub URL.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

  • acgetchell/delaunay#521 — The intrinsic witness excludes periodic quotient identifications, which this issue addresses separately.
  • acgetchell/delaunay#445 — Its validation terminology and documentation objectives overlap with the orientability documentation updates.

Possibly related PRs

Suggested labels: enhancement, rust, geometry, api, topology

Sequence Diagram(s)

sequenceDiagram
  participant Triangulation
  participant OrientationWitness
  participant Tds
  participant Level3Validation
  Triangulation->>OrientationWitness: compute simplex reversal assignments
  OrientationWitness->>Tds: inspect ordinary shared-facet parity
  Tds-->>OrientationWitness: return neighboring constraints
  OrientationWitness-->>Triangulation: return witness or NonOrientable
  Level3Validation->>Triangulation: validate intrinsic orientability
  Triangulation-->>Level3Validation: propagate validation result
Loading

Poem

I’m a rabbit with a witness in hand,
Mapping each simplex across the land.
Parity hops where shared facets meet,
A Möbius twist makes failure complete.
Level Three now knows which paths align—
Hop, hop, coherent by design!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Cargo.toml dependency bumps are unrelated to the orientability feature and appear out of scope. Split the version bumps into a separate dependency update, or remove them if they are not required for this feature.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding intrinsic orientability witnesses to validation.
Description check ✅ Passed The description matches the PR’s orientability, diagnostics, and documentation changes.
Linked Issues check ✅ Passed The PR adds 2D/3D orientability witnesses, typed non-orientability, Level 3 integration, docs, and tests aligned with #520.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/520-intrinsic-orientability-witness

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

@codacy-production

codacy-production Bot commented Jul 15, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 92.45% diff coverage · +0.00% coverage variation

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

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (de8b861) 80257 73129 91.12%
Head commit (5758d78) 80533 (+276) 73384 (+255) 91.12% (+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 (#526) 278 257 92.45%

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 documentation Improvements or additions to documentation enhancement New feature or request geometry Geometry-related issues rust Pull requests that update rust code topology labels Jul 15, 2026

@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.

🧹 Nitpick comments (2)
src/core/validation.rs (2)

318-328: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

NonOrientable carries less diagnostic detail than sibling error variants.

The intrinsic simplex-orientation constraints contain a parity obstruction.
#[error(
"Intrinsic complex is non-orientable: the shared facet between simplices {simplex1_key:?} and {simplex2_key:?} closes with contradictory orientation parity"
)]
NonOrientable {
/// First simplex on the contradictory adjacency.
simplex1_key: SimplexKey,
/// Second simplex on the contradictory adjacency.
simplex2_key: SimplexKey,
}, Other variants in the same enum (e.g. BoundaryFacetInClosedTopology, IsolatedVertex) include both the key and UUID plus facet index for stable, human-readable identification. NonOrientable only has bare SimplexKeys (printed via {:?} as opaque slotmap debug output) and omits the facet index that caused the contradiction, even though facet_index/mirror_index are already computed locally at the call site (lines 1375-1390). This makes the error harder to act on than its siblings.

🤖 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/core/validation.rs` around lines 318 - 328, Expand the NonOrientable
error variant to carry the UUIDs and the shared facet index alongside the
simplex keys, matching the diagnostic detail of BoundaryFacetInClosedTopology
and IsolatedVertex. Update its error message and the call site using
facet_index/mirror_index so both contradictory simplices and the triggering
facet are reported with stable, human-readable identifiers.

385-450: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider a hash-map-backed OrientationWitness for O(1) is_reversed lookups.

The internal computation already builds FastHashMap<SimplexKey, bool> during BFS (line 1315), but the final struct pub struct OrientationWitness {
assignments: Vec<(SimplexKey, bool)> converts to a Vec, and is_reversed does a linear scan: pub fn is_reversed(&self, simplex_key: SimplexKey) -> Option {
self.assignments
.iter()
.find_map(|&(key, reversed)| (key == simplex_key).then_some(reversed))
}. Callers who look up reversal state per-simplex (the pattern shown in the doctest itself) get O(N) per lookup instead of O(1), turning natural usage patterns into O(N²). Since SimplexKey already supports hashing, storing a FastHashMap<SimplexKey, bool> internally would preserve the opaque API while fixing this.

Also applies to: 1399-1409

🤖 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/core/validation.rs` around lines 385 - 450, Change OrientationWitness to
store the existing FastHashMap<SimplexKey, bool> assignments instead of a Vec,
and update its constructor/conversion path from the BFS result to retain that
map. Update len, is_empty, is_reversed, and iter to use the map while preserving
the current public behavior and iterator item type, so reversal lookups are
O(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.

Nitpick comments:
In `@src/core/validation.rs`:
- Around line 318-328: Expand the NonOrientable error variant to carry the UUIDs
and the shared facet index alongside the simplex keys, matching the diagnostic
detail of BoundaryFacetInClosedTopology and IsolatedVertex. Update its error
message and the call site using facet_index/mirror_index so both contradictory
simplices and the triggering facet are reported with stable, human-readable
identifiers.
- Around line 385-450: Change OrientationWitness to store the existing
FastHashMap<SimplexKey, bool> assignments instead of a Vec, and update its
constructor/conversion path from the BFS result to retain that map. Update len,
is_empty, is_reversed, and iter to use the map while preserving the current
public behavior and iterator item type, so reversal lookups are O(1).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 062db724-ec0a-45ef-83e4-3c53034b4cb5

📥 Commits

Reviewing files that changed from the base of the PR and between de8b861 and df17131.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • docs/assets/validation/validation_hierarchy.png is excluded by !**/*.png
  • docs/assets/validation/validation_level_3_intrinsic_pl_topology.png is excluded by !**/*.png
📒 Files selected for processing (10)
  • Cargo.toml
  • README.md
  • docs/ORIENTATION_SPEC.md
  • docs/validation.md
  • notebooks/01_validation.ipynb
  • src/core/algorithms/incremental_insertion.rs
  • src/core/tds/errors.rs
  • src/core/tds/validation.rs
  • src/core/validation.rs
  • src/lib.rs

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.44604% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.10%. Comparing base (de8b861) to head (5758d78).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/core/validation.rs 92.01% 21 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main     #526    +/-   ##
========================================
  Coverage   91.09%   91.10%            
========================================
  Files          88       88            
  Lines       80046    80322   +276     
========================================
+ Hits        72920    73175   +255     
- Misses       7126     7147    +21     
Flag Coverage Δ
unittests 91.10% <92.44%> (+<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.

- Preserve BFS assignments for constant-time simplex reversal lookups.
- Report stable simplex UUIDs and shared-facet indices for parity obstructions.
- Defer periodic quotient orientability to its dedicated validation contract.
- Refresh the generated validation paper artifact.
@coderabbitai coderabbitai Bot removed the documentation Improvements or additions to documentation label Jul 15, 2026
@acgetchell
acgetchell merged commit cf93dec into main Jul 15, 2026
25 checks passed
@acgetchell
acgetchell deleted the feat/520-intrinsic-orientability-witness branch July 15, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api enhancement New feature or request geometry Geometry-related issues rust Pull requests that update rust code topology

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Certify intrinsic orientability for 2D and 3D PL topology

1 participant