Skip to content

refactor(api)!: normalize public declarations under cdt - #120

Merged
acgetchell merged 3 commits into
mainfrom
feat/115-public-api-namespace
Jul 22, 2026
Merged

refactor(api)!: normalize public declarations under cdt#120
acgetchell merged 3 commits into
mainfrom
feat/115-public-api-namespace

Conversation

@acgetchell

@acgetchell acgetchell commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Move supported declarations into the cdt namespace, classify implementation helpers under detail, and document the supported API boundary. Retain line and branch coverage while disabling unreliable GCC function coverage records.

BREAKING CHANGE: Global and unrelated top-level project names are removed. Downstream code must qualify supported APIs through cdt.

Closes #115

Summary by CodeRabbit

  • Documentation
    • Added API boundary documentation (supported cdt surface, header classification, and compatibility expectations).
    • Updated README Quickstart/coverage details and refreshed generated docs to exclude additional internal symbols.
  • Refactor
    • Standardized the public C++ entry points under the cdt namespace and scoped implementation/detail helpers separately.
  • Tests
    • Added public-header compile-contract checks and updated move/audit assertions to target the intended helper surfaces.
  • Build/Chores
    • Added scripts/pkgx-env.sh for interactive environment setup; disabled function coverage in coverage reports; pinned uv version.

Move supported declarations into the cdt namespace, classify implementation
helpers under detail, and document the supported API boundary. Retain line and
branch coverage while disabling unreliable GCC function coverage records.

BREAKING CHANGE: Global and unrelated top-level project names are removed.
Downstream code must qualify supported APIs through cdt.

Closes #115
@acgetchell acgetchell self-assigned this Jul 22, 2026
@acgetchell
acgetchell enabled auto-merge July 22, 2026 16:45
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The project’s C++ declarations are consolidated under the cdt namespace, implementation helpers move into detail, experimental utilities receive explicit namespaces, and consumers/tests are updated. New API-boundary documentation, compile contracts, Doxygen exclusions, environment setup, and coverage settings document and validate the supported surface.

Changes

C++ API namespace normalization

Layer / File(s) Summary
Public header namespace contracts
include/*.hpp
Core types, actions, utilities, runtime configuration, settings, strategies, and experimental helpers are moved under cdt or classified subnamespaces.
Ergodic helper boundary
include/Ergodic_moves_3.hpp
Move-validation, cavity, incident-cell, vertex, and bistellar helpers move under cdt::ergodic_moves::detail; (2,6) wrappers call the internal implementation explicitly.
Consumer and strategy integration
include/Metropolis.hpp, include/Move_command.hpp, src/*.cpp
Production code uses relocated namespaces and detail::check_move, while strategy behavior remains otherwise unchanged.

Validation and documentation

Layer / File(s) Summary
Compile and test validation
tests/*.cpp, tests/CMakeLists.txt
Existing tests update namespace-qualified calls, add geometry-delta checks, and compile supported headers and public signatures.
Documentation, environment, and coverage contracts
README.md, docs/*, scripts/*, Justfile
The API boundary, Doxygen exclusions, pkgx/vcpkg setup, uv version, and LCOV function-coverage settings are documented or configured.

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

Possibly related issues

  • #102: The namespace, triangulation-traits, and public API changes overlap its CGAL-backed modernization objectives.

Possibly related PRs

Poem

Names gather beneath cdt bright,
Helpers tuck into detail’s quiet night.
Headers compile, docs draw the line,
Branches are counted, contracts align.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes unrelated tooling churn, including a new pkgx environment script and a Justfile uv pin, beyond the API-boundary scope. Split the environment/bootstrap changes into a separate PR unless they are required for this work, and document that dependency if kept.
Docstring Coverage ⚠️ Warning Docstring coverage is 74.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the API-boundary refactor and breaking namespace normalization under cdt.
Linked Issues check ✅ Passed The PR matches #115 by moving public names under cdt, pushing helpers into detail, adding API docs, compile checks, and test updates.
✨ 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/115-public-api-namespace

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@tests/Move_command_test.cpp`:
- Line 120: Replace the assertions calling the implementation-only
ergodic_moves::detail::check_move in Move_command_test.cpp with assertions
against the supported public move-command behavior and its required outcomes.
Apply the same change to all referenced assertion groups, and only introduce a
public validation API if the invariant cannot be verified through existing
public interfaces.

In `@tests/Public_api_consumer.cpp`:
- Around line 32-52: Extend the requires expression in the public API compile
contract to include propose_32_move, propose_26_move, propose_62_move, and
propose_44_move alongside propose_23_move, asserting each returns Move_result
with the same manifold and random arguments.
🪄 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.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 79142b65-3c12-4aa6-9962-69f8f5810a06

📥 Commits

Reviewing files that changed from the base of the PR and between 42fd262 and a02a732.

📒 Files selected for processing (50)
  • README.md
  • docs/Doxyfile
  • docs/api-boundary.md
  • docs/ergodic-moves.md
  • include/Apply_move.hpp
  • include/Ergodic_moves_3.hpp
  • include/Foliated_triangulation.hpp
  • include/Geometry.hpp
  • include/Manifold.hpp
  • include/Metropolis.hpp
  • include/Move_always.hpp
  • include/Move_command.hpp
  • include/Move_strategy.hpp
  • include/Move_tracker.hpp
  • include/Mpfr_value.hpp
  • include/Periodic_3_complex.hpp
  • include/Periodic_3_triangulations.hpp
  • include/Runtime_config.hpp
  • include/S3Action.hpp
  • include/Settings.hpp
  • include/Torus_d.hpp
  • include/Triangulation_traits.hpp
  • include/Utilities.hpp
  • scripts/coverage.sh
  • src/cdt-viewer.cpp
  • src/cdt.cpp
  • src/initialize.cpp
  • tests/Apply_move_test.cpp
  • tests/Bistellar_flip_test.cpp
  • tests/CMakeLists.txt
  • tests/Ergodic_moves_3_audit_test.cpp
  • tests/Ergodic_moves_3_test.cpp
  • tests/Foliated_triangulation_test.cpp
  • tests/Function_ref_test.cpp
  • tests/Geometry_test.cpp
  • tests/Manifold_test.cpp
  • tests/Metropolis_test.cpp
  • tests/Move_always_test.cpp
  • tests/Move_command_test.cpp
  • tests/Move_tracker_test.cpp
  • tests/Public_api_consumer.cpp
  • tests/Random_benchmark.cpp
  • tests/Random_test.cpp
  • tests/Runtime_config_test.cpp
  • tests/S3Action_test.cpp
  • tests/Settings_test.cpp
  • tests/Tetrahedron_test.cpp
  • tests/Torus_test.cpp
  • tests/Utilities_test.cpp
  • tests/Vertex_test.cpp

Comment thread tests/Move_command_test.cpp Outdated
Comment thread tests/Public_api_consumer.cpp
- Add a sourceable pkgx environment for CLion and shells.
- Keep project dependencies under vcpkg control.
- Use the permanent Zenodo concept DOI and refresh the uv pin.
- Keep public move validation independent of internal helpers.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 `@scripts/pkgx-env.sh`:
- Line 8: Add a line-scoped ShellCheck SC2296 disable with a brief explanatory
note immediately before the intentional Zsh-specific assignment to script_file.
Keep the existing `${(%):-%x}` expression and surrounding behavior unchanged.
🪄 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.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9456aa88-88f2-4807-9ab9-3eeb2525510b

📥 Commits

Reviewing files that changed from the base of the PR and between a02a732 and 3ce8780.

📒 Files selected for processing (5)
  • Justfile
  • README.md
  • scripts/pkgx-env.sh
  • tests/Move_command_test.cpp
  • tests/Public_api_consumer.cpp

Comment thread scripts/pkgx-env.sh

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
scripts/pkgx-env.sh (3)

56-65: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fail fast if macOS toolchain lookup fails. command -v only proves xcode-select and xcrun exist; xcode-select -p or xcrun --sdk macosx --show-sdk-path can still fail here, leaving empty DEVELOPER_DIR/SDKROOT values exported and the setup continuing with a broken environment. Check both commands and return a clear error before exporting.

🤖 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 `@scripts/pkgx-env.sh` around lines 56 - 65, Update the Darwin toolchain setup
block to validate the exit status and non-empty output of xcode-select -p and
xcrun --sdk macosx --show-sdk-path before exporting DEVELOPER_DIR and SDKROOT.
If either lookup fails, print a clear error and exit or return immediately; only
export the environment variables after both values are valid.

28-29: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Avoid clobbering caller variables in a sourced script. repo_root, script_dir, script_file, had_allexport, and pkgx_environment are assigned in the caller’s shell and then unset again, so any pre-existing values are lost. Use prefixed temporaries or save and restore the originals.

🤖 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 `@scripts/pkgx-env.sh` around lines 28 - 29, Update the sourced-script cleanup
around pkgx_environment, repo_root, script_dir, script_file, and had_allexport
so it does not overwrite or unset caller-owned variables. Use uniquely prefixed
temporary names, or capture each original value and restoration state before
assignment and restore them before returning, while preserving the existing
failure exit behavior.

36-39: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Propagate pkgx eval failures.
eval "${pkgx_environment}" can hide failures inside the generated shell and still leave the script continuing with a partially applied environment. Route that path through the existing nonzero failure handling, with set +a restored before returning.

🤖 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 `@scripts/pkgx-env.sh` around lines 36 - 39, Update the pkgx environment
evaluation flow around eval "${pkgx_environment}" to detect nonzero failures and
route them through the script’s existing failure handling instead of continuing.
Ensure set +a is restored before returning from the failure path, while
preserving the current success behavior and had_allexport conditional.
🤖 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.

Outside diff comments:
In `@scripts/pkgx-env.sh`:
- Around line 56-65: Update the Darwin toolchain setup block to validate the
exit status and non-empty output of xcode-select -p and xcrun --sdk macosx
--show-sdk-path before exporting DEVELOPER_DIR and SDKROOT. If either lookup
fails, print a clear error and exit or return immediately; only export the
environment variables after both values are valid.
- Around line 28-29: Update the sourced-script cleanup around pkgx_environment,
repo_root, script_dir, script_file, and had_allexport so it does not overwrite
or unset caller-owned variables. Use uniquely prefixed temporary names, or
capture each original value and restoration state before assignment and restore
them before returning, while preserving the existing failure exit behavior.
- Around line 36-39: Update the pkgx environment evaluation flow around eval
"${pkgx_environment}" to detect nonzero failures and route them through the
script’s existing failure handling instead of continuing. Ensure set +a is
restored before returning from the failure path, while preserving the current
success behavior and had_allexport conditional.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 443beae4-9ac3-49d1-9f58-b75895b7d566

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce8780 and 189cc0d.

📒 Files selected for processing (1)
  • scripts/pkgx-env.sh

@acgetchell
acgetchell merged commit 14476a4 into main Jul 22, 2026
13 checks passed
@acgetchell
acgetchell deleted the feat/115-public-api-namespace branch July 22, 2026 20:20
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.

Define and normalize the public C++ namespace and API boundary

1 participant