Skip to content

Improve pipeline validator unit tests#554

Open
EffortlessSteven wants to merge 1 commit into
mainfrom
codex/improve-unit-testing-1wgve1
Open

Improve pipeline validator unit tests#554
EffortlessSteven wants to merge 1 commit into
mainfrom
codex/improve-unit-testing-1wgve1

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Motivation

  • Make PipelineValidator unit tests more robust and idiomatic by converting panic-based tests to Result-returning tests so the ? operator can be used instead of unwrap-style helpers.
  • Increase coverage for edge cases in filter validation to catch regressions around gains, notch filters, bumpstop/hands-off behavior, curve monotonicity, empty-config detection, and response-curve validation.

Description

  • Refactor the test module in crates/openracing-pipeline/src/validation.rs to return Result from tests and remove the must() panic helper and the #[allow(clippy::unwrap_used)] exception.
  • Change create_valid_config() to return Result<FilterConfig, _> and construct domain types with their validated constructors (e.g. Gain::new, FrequencyHz::new, CurvePoint::new, NotchFilter::new) using ? instead of unwrapping.
  • Add an assert_invalid_parameters helper and new tests that cover boundary gains, notch frequency and Q limits, enabled/disabled bumpstop and hands-off validation, schema-rejected non-monotonic curves, exact linear-identity empty-config behavior, and response curve validation.
  • Run workspace formatting to update the file layout and keep tests tidy.

Testing

  • Ran python scripts/cargo_fmt_workspace.py to format the workspace and the formatting step completed successfully.
  • Ran cargo test -p openracing-pipeline validation::tests and the test suite passed: 15 passed; 0 failed.
  • Ran cargo clippy -p openracing-pipeline --all-targets -- -D warnings and the lint run completed successfully.
  • Note: attempting cargo test ... --all-features initially failed due to a missing system dependency (libudev required by hidapi), after installing libudev-dev the targeted validation tests were executed and passed as reported above.

Codex Task

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 31 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 65d538a7-094a-498f-822e-2def84a91c13

📥 Commits

Reviewing files that changed from the base of the PR and between d836f5b and a074617.

📒 Files selected for processing (1)
  • crates/openracing-pipeline/src/validation.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/improve-unit-testing-1wgve1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@factory-droid

factory-droid Bot commented May 17, 2026

Copy link
Copy Markdown

Droid finished @EffortlessSteven's task —— View job


Review summary

LGTM — the test refactor is more idiomatic (Result-returning tests) and the added boundary coverage looks correct; I didn’t spot any actionable correctness or security issues in this diff.

@github-actions

Copy link
Copy Markdown

Compatibility Layer Usage Report

Current usage count: 193
Baseline usage count: 193
ℹ️ Usage unchanged

📈 Usage Trend (Last 30 Days)

  • Peak usage: 193
  • Current trend: insufficient_data (0%)
  • Projected removal: unknown

Usage Details

  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/compat_impl.rs:69 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/hid/linux.rs:1253 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/hid/linux.rs:1282 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/hid/mod.rs:230 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/protocol.rs:290 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/protocol.rs:742 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/engine/src/protocol.rs:749 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/schemas/src/service_example.rs:189 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/schemas/src/service_example.rs:218 - temp_c
  • /home/runner/work/OpenRacing/OpenRacing/crates/schemas/src/integration_test.rs:79 - temp_c

... and 183 more occurrences

Migration Guide

To migrate these usages, replace:

  • .temp_c().temperature_c
  • .faults().fault_flags
  • .wheel_angle_mdeg().wheel_angle_deg
  • .wheel_speed_mrad_s().wheel_speed_rad_s

See Migration Patterns for detailed examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant