Skip to content

test(vader5): pin block_kernel_drivers to xpad only (regression #355)#363

Merged
BANANASJIM merged 1 commit into
mainfrom
fix/355-regression-test
Jun 4, 2026
Merged

test(vader5): pin block_kernel_drivers to xpad only (regression #355)#363
BANANASJIM merged 1 commit into
mainfrom
fix/355-regression-test

Conversation

@BANANASJIM

@BANANASJIM BANANASJIM commented Jun 4, 2026

Copy link
Copy Markdown
Owner

What

Add a regression test asserting the shipped devices/flydigi/vader5.toml blocks only xpad and never hid_generic/usbhid.

Why

#362 fixed #355 by changing the device file's block_kernel_drivers value, but added no test. The existing install tests use inline TOML, so they cannot catch a value regression in the real shipped file. This test parses the actual file via parseFile("devices/flydigi/vader5.toml") and pins the fix — re-adding the HID-driver block would fail CI.

Changes

  • src/config/device.zig: new test device: vader5 blocks only xpad (regression #355).

Test plan

  • zig build test green in the canonical Docker image (full suite EXIT=0).

Refs #355, #362

Summary by CodeRabbit

  • Tests
    • Added regression test to verify the Flydigi Vader5 controller properly manages kernel driver blocking configuration.

Assert the shipped devices/flydigi/vader5.toml blocks only xpad and never
hid_generic/usbhid. The inline-TOML install tests cannot catch a value
regression in the real device file; this pins the #355 fix.
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add regression test for vader5 block_kernel_drivers fix

🧪 Tests

Grey Divider

Walkthroughs

Description
• Add regression test for vader5 device file
• Verify block_kernel_drivers contains only xpad
• Ensure hid_generic and usbhid are not blocked
• Parse actual shipped device file to catch regressions
Diagram
flowchart LR
  A["vader5.toml device file"] -- "parseFile" --> B["Test validates config"]
  B -- "checks block_kernel_drivers" --> C["Only xpad blocked"]
  C -- "excludes hid_generic/usbhid" --> D["Regression #355 pinned"]

Loading

Grey Divider

File Changes

1. src/config/device.zig 🧪 Tests +17/-0

Add vader5 block_kernel_drivers regression test

• Added new test device: vader5 blocks only xpad (regression #355)
• Test parses actual shipped devices/flydigi/vader5.toml file
• Validates block_kernel_drivers list contains exactly one entry: xpad
• Asserts hid_generic and usbhid are not in the blocked drivers list

src/config/device.zig


Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a regression test for the Vader 5 controller device configuration. The test loads the device TOML file and validates that block_kernel_drivers is configured to block only the "xpad" kernel driver while excluding unwanted generic USB HID drivers.

Changes

Vader 5 Kernel Driver Block List Regression Test

Layer / File(s) Summary
Vader 5 driver block list regression test
src/config/device.zig
New test device: vader5 blocks only xpad (regression #355) loads Vader 5 device configuration and asserts block_kernel_drivers contains exactly "xpad" while explicitly verifying absence of "hid_generic" and "usbhid".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • BANANASJIM/padctl#362: Adds a regression test asserting devices/flydigi/vader5.toml blocks only "xpad" and excludes "hid_generic"/"usbhid", enforcing the same code/config behavior.
  • BANANASJIM/padctl#357: Modifies the block_kernel_drivers list for Vader 5 to include "hid_generic" and "usbhid", which is the target configuration validated by this regression test.

Poem

A rabbit hops with glee,
Testing Vader5's decree:
Block xpad, one and one alone,
No generic drivers shown! 🎮✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a regression test to verify the vader5 device blocks only xpad, directly referencing issue #355.
Linked Issues check ✅ Passed The PR adds a regression test that verifies the vader5 device file correctly blocks only xpad (addressing #355), ensuring the fix from #362 is permanently covered by automated tests.
Out of Scope Changes check ✅ Passed All changes are within scope: a new regression test in src/config/device.zig that validates the vader5 device configuration, directly supporting the linked issue #355.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/355-regression-test

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.

@qodo-code-review

qodo-code-review Bot commented Jun 4, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@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.

🧹 Nitpick comments (1)
src/config/device.zig (1)

655-658: ⚡ Quick win

Simplify: Remove redundant loop after single-entry assertion.

After asserting blocked.len == 1 (line 653) and blocked[0] == "xpad" (line 654), the loop checking that no entry matches "hid_generic" or "usbhid" is redundant. It will execute exactly once, checking that "xpad" is neither of those values, which is already guaranteed by the earlier assertions.

♻️ Simplify by removing the redundant loop
 const blocked = result.value.device.block_kernel_drivers orelse return error.MissingBlockList;
 try std.testing.expectEqual(`@as`(usize, 1), blocked.len);
 try std.testing.expectEqualStrings("xpad", blocked[0]);
-for (blocked) |drv| {
-    try std.testing.expect(!std.mem.eql(u8, drv, "hid_generic"));
-    try std.testing.expect(!std.mem.eql(u8, drv, "usbhid"));
-}
🤖 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 `@src/config/device.zig` around lines 655 - 658, Remove the redundant loop that
iterates over `blocked` and checks `drv` against "hid_generic" and "usbhid";
since you already assert `blocked.len == 1` and `blocked[0] == "xpad"`, delete
the `for (blocked) |drv| { try std.testing.expect(!std.mem.eql(u8, drv,
"hid_generic")); try std.testing.expect(!std.mem.eql(u8, drv, "usbhid")); }`
block and rely on the existing assertions (using `blocked` and `std.mem.eql`) to
keep the test concise.
🤖 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.

Nitpick comments:
In `@src/config/device.zig`:
- Around line 655-658: Remove the redundant loop that iterates over `blocked`
and checks `drv` against "hid_generic" and "usbhid"; since you already assert
`blocked.len == 1` and `blocked[0] == "xpad"`, delete the `for (blocked) |drv| {
try std.testing.expect(!std.mem.eql(u8, drv, "hid_generic")); try
std.testing.expect(!std.mem.eql(u8, drv, "usbhid")); }` block and rely on the
existing assertions (using `blocked` and `std.mem.eql`) to keep the test
concise.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 224ea772-5cfd-4e1a-a605-43b38af9f322

📥 Commits

Reviewing files that changed from the base of the PR and between b76edee and 6e2c413.

📒 Files selected for processing (1)
  • src/config/device.zig

@BANANASJIM BANANASJIM merged commit 69cb41c into main Jun 4, 2026
38 checks passed
@BANANASJIM BANANASJIM deleted the fix/355-regression-test branch June 4, 2026 00:43
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.

Generic X-Box pad is not hidden for Vader 5 (Bazzite)

1 participant