Skip to content

feat: add runtime traits crate for circular deps#229

Merged
ChefBingbong merged 1 commit intomainfrom
feat-add-runtime-traits-crate-for-circular-deps
Feb 25, 2026
Merged

feat: add runtime traits crate for circular deps#229
ChefBingbong merged 1 commit intomainfrom
feat-add-runtime-traits-crate-for-circular-deps

Conversation

@ChefBingbong
Copy link
Copy Markdown
Contributor

@ChefBingbong ChefBingbong commented Feb 25, 2026

Auto-generated PR from staged changes.


Note

Medium Risk
Adds a large new shared API surface (traits + statistical aggregation logic) that other crates will depend on, so bugs or API churn could ripple widely once adopted.

Overview
Introduces a new poly-bench-runtime-traits crate that centralizes the public interfaces runtimes must implement (Runtime, RuntimeFactory, RuntimePlugin) plus common support traits/types for project root detection, compiler error line remapping, and language display metadata.

Adds a unified, serde-serializable Measurement model with helpers for outlier filtering, stability metrics (CV/RME), multi-run aggregation with bootstrap confidence intervals, timeout markers, and a Comparison type for reporting cross-language speedups.

Written by Cursor Bugbot for commit cab88f9. This will update automatically on new commits. Configure here.

@ChefBingbong ChefBingbong merged commit caa926c into main Feb 25, 2026
1 of 5 checks passed
@ChefBingbong ChefBingbong deleted the feat-add-runtime-traits-crate-for-circular-deps branch February 25, 2026 23:10
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on March 22

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

/// Create a measurement from aggregate data (no samples)
pub fn from_aggregate(iterations: u64, total_nanos: u64) -> Self {
let nanos_per_op = total_nanos as f64 / iterations as f64;
let ops_per_sec = if nanos_per_op > 0.0 { 1_000_000_000.0 / nanos_per_op } else { 0.0 };
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Division by zero produces NaN, breaking JSON serialization

High Severity

from_aggregate divides total_nanos as f64 / iterations as f64 with no guard for iterations == 0, producing NaN. Both aggregate_runs and aggregate_runs_memory call from_aggregate(0, 0) for empty input. The resulting NaN in nanos_per_op, raw_nanos_per_op, and filtered_nanos_per_op will cause serde_json serialization to fail at runtime, since serde_json cannot serialize NaN by default. The from_samples_with_options method correctly guards against this with an if effective_iterations > 0 check, but from_aggregate does not.

Additional Locations (2)

Fix in Cursor Fix in Web

timed_out: Some(false),
run_nanos_per_op: Some(run_nanos_per_op),
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Near-complete duplication between two aggregation methods

Medium Severity

aggregate_runs_memory is ~140 lines that are identical to aggregate_runs, differing only in how bytes_per_op and allocs_per_op are aggregated (mean vs. median — about 5 lines). This duplication means any future bug fix or field addition needs to be applied in two places, risking inconsistency. A shared helper accepting an aggregation strategy parameter would eliminate this.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

1 participant