feat: hardware-in-the-loop smoke test + /hil-smoke-test skill#219
feat: hardware-in-the-loop smoke test + /hil-smoke-test skill#219tylerkron wants to merge 3 commits into
Conversation
Introduces a developer-local sanity check for confirming real-device USB/serial integration still works after touching the SDK. - src/Daqifi.Core.SmokeTest: standalone console project (net9.0;net10.0) that discovers, connects, reads metadata, streams briefly, asserts a reasonable sample throughput, and tears down cleanly. Stable named exit codes (10/11/12/13/20/99) so wrappers can react to failure mode without parsing message text. - .claude/skills/hil-smoke-test/SKILL.md: project-level skill that orchestrates the binary, interprets exit codes with concrete remediation suggestions, and refuses out-of-scope destructive ops (SD card, firmware, network reconfig). Read-only with respect to persistent device state. The test logic lives in C# (deterministic, runnable without Claude); the skill is a thin orchestrator so HIL coverage stays reproducible. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Review Summary by QodoAdd hardware-in-the-loop smoke test + Claude Code skill
WalkthroughsDescription• Add hardware-in-the-loop smoke test console app for real-device USB/serial validation • Implement deterministic C# test logic with stable named exit codes for failure modes • Create Claude Code skill to orchestrate test execution and interpret results • Enable developer-local sanity checks after SDK modifications without destructive operations Diagramflowchart LR
A["Developer touches SDK"] --> B["Run smoke test"]
B --> C["SmokeTest.Program.cs"]
C --> D["Discover device"]
D --> E["Connect & init"]
E --> F["Read metadata"]
F --> G["Stream & verify samples"]
G --> H["Exit code 0-99"]
H --> I["SKILL.md orchestrator"]
I --> J["Interpret & report to user"]
File Changes1. src/Daqifi.Core.SmokeTest/Program.cs
|
Code Review by Qodo
1.
|
Three corrections from a self-review pass. - csproj: TargetFrameworks net9.0;net10.0 → TargetFramework net9.0. Multi-targeting an exe forces every dotnet run to pass -f, which the skill's example commands did not — so the first invocation would fail with a confusing TFM-selection error. As a developer tool the smoke test only needs one runtime; pick the lib's minimum. - Program.cs: drop the 100ms delay between EnableAdcChannels and StartStreaming and the comment that justified it. The producer queue already serializes Send calls; the README, DEVICE_INTERFACES, and end-to-end tests all sequence these back-to-back. The comment also asserted a specific firmware -200 behavior with no evidence behind it. - Program.cs: help-text exit-code section reformatted as a single ordered column so codes read top-to-bottom in order. - SKILL.md: drop the stale "-f net10.0" note now that the target is single. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three correctness fixes flagged by code review. 1. Auto mode honored --baud only for discovery, then connected through ConnectFromDeviceInfoAsync whose serial path resets the baud to the SDK default (9600). Collapse both branches into a single ConnectSerialAsync(port, baud) call so the user's baud is end-to-end. 2. The degraded-samples threshold compared AnalogInData total to rate × duration, but AnalogInData carries one element per enabled channel per tick — so the threshold was off by a factor of N (channels), letting a real ~50%-loss stream pass with default --channels=3. Parse --channels as int at parse time, derive the enabled-channel count via BitOperations.PopCount, and multiply expected by it. Invalid --channels values now surface as exit code 2 (BadArgs) instead of being passed verbatim to the device. 3. SKILL.md's relative link to Program.cs assumed repo-root resolution but lives at .claude/skills/hil-smoke-test/, so GitHub renders it broken. Use ../../../src/... to escape the subdirectory. Also drop an unused ConnectAttemptCount constant noticed in passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@qodo-code-review thanks for the review — all three findings addressed in 6def15c.
One thing I deliberately did not do: extend |
Summary
Adds a developer-local hardware-in-the-loop (HIL) smoke test for confirming real-device USB/serial integration still works after touching the SDK. All existing tests are mock-based — this is the first piece of real-device coverage that lives in the repo.
Two pieces:
`src/Daqifi.Core.SmokeTest/` — a standalone console project (`net9.0;net10.0`) that discovers, connects, reads metadata, enables ADC channels, streams briefly, asserts a reasonable sample throughput, and tears down cleanly. Exit codes are stable and named (`10`=no device, `11`=connect fail, `12`=metadata missing, `13`=degraded samples, `20`=no samples, `99`=unexpected). Runnable without Claude — `dotnet run --project src/Daqifi.Core.SmokeTest`.
`.claude/skills/hil-smoke-test/SKILL.md` — a project-level Claude Code skill that orchestrates the binary, interprets exit codes with concrete remediation suggestions, retries transient failures once before reporting, and refuses out-of-scope destructive operations.
Design notes
Test plan
Out of scope
Each of these is destructive or hardware-modifying and belongs in its own opt-in tool, not a smoke test:
🤖 Generated with Claude Code