Skip to content

fix(bench): preserve setup failure messages - #468

Merged
acgetchell merged 2 commits into
mainfrom
fix/434-bench-abort-errors
Jun 18, 2026
Merged

fix(bench): preserve setup failure messages#468
acgetchell merged 2 commits into
mainfrom
fix/434-bench-abort-errors

Conversation

@acgetchell

Copy link
Copy Markdown
Owner
  • Replace benchmark setup unwrap helpers with postfix abort adapters that keep the original Result error text.
  • Keep Option setup failures explicit with caller-provided context.
  • Report abort messages without bench-logging so setup failures are visible in every benchmark build.

Closes #434

- Replace benchmark setup unwrap helpers with postfix abort adapters that keep the original Result error text.
- Keep Option setup failures explicit with caller-provided context.
- Report abort messages without bench-logging so setup failures are visible in every benchmark build.
@acgetchell acgetchell self-assigned this Jun 18, 2026
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Replaces the bench_result and bench_option free functions in benches/common/bench_utils.rs with two extension traits (OrAbort for Result, OrAbortWithContext for Option) and migrates all benchmark files to use postfix .or_abort() calls. The abort_benchmark helper is consolidated to always initialize tracing and log via tracing::error! before exiting.

Changes

OrAbort Trait Refactor Across Benchmark Suite

Layer / File(s) Summary
New OrAbort/OrAbortWithContext traits in bench_utils
benches/common/bench_utils.rs
Adds OrAbort trait impl for Result<T, E: Display> and OrAbortWithContext trait impl for Option<T>, consolidates abort_benchmark to unconditionally initialize tracing and log via tracing::error!, and removes the old bench_result/bench_option free functions.
flip_workflows: unqualified Vertex path cleanup
benches/common/flip_workflows.rs
Replaces fully-qualified delaunay::prelude::Vertex paths with the already-imported Vertex type in build_flip_dt and roundtrip_k1; no behavioral changes.
Core benchmark files migrated to .or_abort()
benches/allocation_hot_paths.rs, benches/boundary_uuid_iter.rs, benches/tds_clone.rs, benches/topology_guarantee_construction.rs, benches/circumsphere_containment.rs, benches/cold_path_predicates.rs
All bench_result/bench_option call sites replaced with .or_abort() / .or_abort(context); local coordinate_range helpers simplified to drop context-string parameters and abort directly on invalid bounds.
Large benchmark suites migrated to .or_abort()
benches/ci_performance_suite.rs, benches/profiling_suite.rs, benches/remove_vertex.rs
Replaces bench_result/bench_option wrappers across data preparation, fixture generation, flip-roundtrip verification, adversarial dataset construction, memory profiling, and timed benchmark assertions with .or_abort() calls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • #434 (refactor: run pre-feature simplification cleanup audit): The PR directly implements one of the listed candidates in #434: replacing bench_result/bench_option helpers with a postfix OrAbort extension trait and migrating all benchmark call sites to use the simplified pattern.

Possibly related PRs

  • acgetchell/delaunay#68: The profiling/memory benchmark suite updated in this PR was originally introduced in PR #68.
  • acgetchell/delaunay#464: Further refactors the same benchmark files to use or_abort-style helpers, building on fallible try_* constructor wiring in those areas.

Suggested labels

enhancement

🐇 Hop, hop, no more wrappers in sight,
.or_abort() gleams with postfix delight.
bench_result has vanished, bench_option too,
The traits now carry the error straight through!
A cleaner bench harness — that's quite a feat,
This rabbit approves with a wiggle and tweet. 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 98.31% which is insufficient. The required threshold is 100.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing setup helpers with postfix abort adapters that preserve error messages from the Result type.
Description check ✅ Passed The description is related to the changeset and explains the key improvements: postfix abort adapters, preserved error text, explicit context for Options, and visibility without bench-logging.
Linked Issues check ✅ Passed The PR successfully implements the #434 candidate by replacing bench_result/bench_option with OrAbort extension trait for both Result and Option types, migrating all call sites, and improving error visibility.
Out of Scope Changes check ✅ Passed All changes are scoped to benchmark infrastructure refactoring as outlined in #434, with no unrelated modifications to core library code or public APIs.

✏️ 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 fix/434-bench-abort-errors

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

@acgetchell
acgetchell enabled auto-merge (squash) June 18, 2026 00:52
@codacy-production

codacy-production Bot commented Jun 18, 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 ∅ diff coverage · +0.00% coverage variation

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

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f6a85e8) 69019 63272 91.67%
Head commit (5cd24d4) 69019 (+0) 63272 (+0) 91.67% (+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 (#468) 0 0 ∅ (not applicable)

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 bug Something isn't working rust Pull requests that update rust code labels Jun 18, 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.

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 `@benches/common/bench_utils.rs`:
- Around line 31-35: In the abort_benchmark function, replace the eprintln!
macro call with tracing::error! to ensure benchmark diagnostics use the proper
logging framework instead of direct standard error output. Update the line that
currently uses eprintln!("{message}") to instead use
tracing::error!("{message}") or a similar tracing error call that captures the
message parameter.
🪄 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: 05ea91b0-42c9-426c-b23d-89770eb985c0

📥 Commits

Reviewing files that changed from the base of the PR and between f6a85e8 and 4c790ab.

📒 Files selected for processing (11)
  • benches/allocation_hot_paths.rs
  • benches/boundary_uuid_iter.rs
  • benches/ci_performance_suite.rs
  • benches/circumsphere_containment.rs
  • benches/cold_path_predicates.rs
  • benches/common/bench_utils.rs
  • benches/common/flip_workflows.rs
  • benches/profiling_suite.rs
  • benches/remove_vertex.rs
  • benches/tds_clone.rs
  • benches/topology_guarantee_construction.rs

Comment thread benches/common/bench_utils.rs Outdated
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.64%. Comparing base (f6a85e8) to head (5cd24d4).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #468   +/-   ##
=======================================
  Coverage   91.64%   91.64%           
=======================================
  Files          72       72           
  Lines       68799    68799           
=======================================
  Hits        63054    63054           
  Misses       5745     5745           
Flag Coverage Δ
unittests 91.64% <ø> (ø)

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.

- Initialize a default error-level tracing subscriber for fatal benchmark setup failures.
- Emit abort diagnostics through tracing in all benchmark builds instead of using direct stderr output.
@coderabbitai coderabbitai Bot added the enhancement New feature or request label Jun 18, 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.

Caution

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

⚠️ Outside diff range comments (1)
benches/common/bench_utils.rs (1)

11-18: ⚠️ Potential issue | 🟡 Minor

Gate init_tracing() behind #[cfg(feature = "bench-logging")] to comply with diagnostic feature-gating guideline.

The coding guideline requires: "Gate non-essential test/benchmark diagnostics behind feature flags: use 'diagnostics' for test diagnostics and 'bench-logging' for benchmark diagnostics."

The established codebase pattern confirms this—benches/profiling_suite.rs gates its init_tracing() with #[cfg(feature = "bench-logging")] and provides a no-op const fn alternative when the feature is disabled. Similarly, benches/ci_performance_suite.rs gates all tracing output behind the same feature flag.

The new init_tracing() in benches/common/bench_utils.rs runs unconditionally, violating both the explicit guideline and the project's established pattern. Move the function and its call in abort_benchmark() behind a feature gate, or provide a no-op alternative like the existing code does.

🤖 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 `@benches/common/bench_utils.rs` around lines 11 - 18, The init_tracing()
function is running unconditionally and needs to be gated behind the
bench-logging feature flag to comply with the project's diagnostic
feature-gating guideline. Add #[cfg(feature = "bench-logging")] above the
init_tracing() function definition to gate the implementation. Then provide an
alternative no-op const fn for when the bench-logging feature is disabled using
#[cfg(not(feature = "bench-logging"))]. Similarly, gate any call to
init_tracing() (such as in abort_benchmark()) behind the same #[cfg(feature =
"bench-logging")] conditional to ensure tracing is only initialized when the
feature is enabled, matching the pattern used in other benchmark files like
benches/profiling_suite.rs and benches/ci_performance_suite.rs.
🤖 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 `@benches/common/bench_utils.rs`:
- Around line 11-18: The init_tracing() function is running unconditionally and
needs to be gated behind the bench-logging feature flag to comply with the
project's diagnostic feature-gating guideline. Add #[cfg(feature =
"bench-logging")] above the init_tracing() function definition to gate the
implementation. Then provide an alternative no-op const fn for when the
bench-logging feature is disabled using #[cfg(not(feature = "bench-logging"))].
Similarly, gate any call to init_tracing() (such as in abort_benchmark()) behind
the same #[cfg(feature = "bench-logging")] conditional to ensure tracing is only
initialized when the feature is enabled, matching the pattern used in other
benchmark files like benches/profiling_suite.rs and
benches/ci_performance_suite.rs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 17d518d1-2948-4405-bd83-c709065bc580

📥 Commits

Reviewing files that changed from the base of the PR and between 4c790ab and 5cd24d4.

📒 Files selected for processing (1)
  • benches/common/bench_utils.rs

@acgetchell
acgetchell merged commit fe3ed92 into main Jun 18, 2026
22 checks passed
@acgetchell
acgetchell deleted the fix/434-bench-abort-errors branch June 18, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: run pre-feature simplification cleanup audit

1 participant