Skip to content

test(telemetry-support): pin alias normalisation and YAML decode contract#512

Draft
EffortlessSteven wants to merge 1 commit into
mainfrom
claude/improve-code-coverage-xaNsj-telemetry-support
Draft

test(telemetry-support): pin alias normalisation and YAML decode contract#512
EffortlessSteven wants to merge 1 commit into
mainfrom
claude/improve-code-coverage-xaNsj-telemetry-support

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Adds 18 new tests for racing-wheel-telemetry-support. The crate is the canonical loader for game_support_matrix.yaml and exposes a normalize_game_id boundary helper; both surfaces had branches that were not being exercised.

What the new tests cover

  • normalize_game_id alias matrix.
    • ea_wrc / ea-wrc / ea wrceawrc
    • Mixed-case variants EA-WRC, Ea Wrc, eA_wRc, EA_WRCeawrc
    • f1_2025 / f1-2025 / f1 2025 and uppercase variants → f1_25
    • Trim + alias interaction (" Ea-Wrc\t"eawrc)
    • Non-alias passthrough (iracing stays iracing, ACC keeps its case)
  • GameSupportStatus YAML decode.
    • Accepts lowercase stable / experimental
    • Rejects Stable / STABLE (rename_all = "lowercase" contract)
    • Rejects unknown values like deprecated, retired
  • GameSupportStatus semantics.
    • default() is Stable
    • Copy works (assign and reuse)
  • GameSupportMatrix::game_ids_by_status sort guarantee. Uses a custom in-memory matrix with out-of-order inserts to confirm the result is sorted, rather than relying on the embedded YAML's order.
  • matrix_game_ids() uniqueness. No duplicate IDs in the embedded matrix.
  • TelemetryFieldMapping::clone preserves all eight Option<String> fields verbatim.
  • supports_360hz_option: true without high_rate_update_rate_hz parses successfully; documents that the cross-field invariant lives in tests, not the type.
  • output_target: "" is distinct from null — decodes to Some(""), not None.
  • load_default_matrix()game_ids() consistency.

Verification

cargo test -p racing-wheel-telemetry-support
running 32/24/18/46/31/0 → 151 tests pass
cargo clippy -p racing-wheel-telemetry-support --tests -- -D warnings    # clean

Test plan

  • cargo test -p racing-wheel-telemetry-support
  • cargo clippy -p racing-wheel-telemetry-support --tests -- -D warnings
  • Coverage CI confirms a bump for the crate

https://claude.ai/code/session_01NZ5jzdE2H3bbuPuYqbjCnh


Generated by Claude Code

…ract

Adds 18 tests for `racing-wheel-telemetry-support` covering paths
the existing suite did not exercise:

- `normalize_game_id` mixed-case aliases ("EA-WRC", "Ea Wrc",
  "F1-2025", "F1 2025") and trim-plus-alias interaction
  ("  Ea-Wrc\t" → "eawrc"). Pins the case-insensitive contract.
- `normalize_game_id` returns the input verbatim (case preserved)
  when no alias matches, after trimming.
- `GameSupportStatus` YAML decoder accepts the lowercase forms,
  rejects "Stable"/"STABLE" (capitalisation) under
  `rename_all="lowercase"`, and rejects unknown values like
  "deprecated"/"retired".
- `GameSupportStatus::default()` is `Stable`; `Copy` semantics
  exercised so removing the derive is caught.
- `GameSupportMatrix::game_ids_by_status` returns a sorted vec even
  when entries are inserted in non-sorted order — uses a custom
  matrix to avoid depending on the embedded YAML.
- `matrix_game_ids()` from the embedded YAML has no duplicates and
  matches `GameSupportMatrix::game_ids()`.
- `TelemetryFieldMapping::clone` preserves all eight `Option<String>`
  fields verbatim.
- `supports_360hz_option: true` without `high_rate_update_rate_hz`
  parses; documents that the consistency invariant lives in tests.
- `output_target: ""` decodes to `Some("")` (distinct from `null`).
- `load_default_matrix()` keys equal `game_ids()` output.
@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!

@coderabbitai

coderabbitai Bot commented May 16, 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 13 minutes and 4 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: 7c42c9ed-ea8b-47bd-a37c-cffda56d2468

📥 Commits

Reviewing files that changed from the base of the PR and between d151081 and 0d7e9b6.

📒 Files selected for processing (1)
  • crates/telemetry-support/tests/coverage_gaps.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/improve-code-coverage-xaNsj-telemetry-support

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.

@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants