Skip to content

Use agentrc's shared core HIL battery and build core_cdc_tinyusb from core_cdc - #406

Merged
hathach merged 1 commit into
masterfrom
wave4
Nov 23, 2026
Merged

hathach merged 1 commit into
masterfrom
wave4

Conversation

@hathach

@hathach hathach commented Nov 23, 2026

Copy link
Copy Markdown
Member

Problem

  • The HIL harness carried its own copy of the core host protocol (INFO, ECHO, TIME, DELAY), as the nRF52 and ESP32 cores did.
  • test/hil/core_cdc_tinyusb was a byte-for-byte copy of core_cdc, kept equal by a contract test.
  • The agentrc pin predates arduino: wave 4 (#455, #488, #456, #438) hathach/agentrc#567, which moved the protocol into agentrc's shared core battery and added named builds.

Solution

What the host sends to the board is unchanged. The pinned battery widens the millis() and delay() brackets by 1 ms beyond the 1% tolerance.

Testing

  • agentrc_pin.py test against 2eb13e0: 66 pass.
  • check_build.py: core_cdc and core_cdc_tinyusb build for metro_m0_express and metro_m4_express.
  • HIL at content-equivalent agentrc (arduino: wave 4 (#455, #488, #456, #438) hathach/agentrc#567 verification): metro_m4 passes cdc_arduino, cdc_tinyusb and timing. SAMD21 has no farm board.

… core_cdc

The host protocol now lives once in arduino_hil (hathach/agentrc#488);
core_cdc_tinyusb is a named build instead of a byte copy of core_cdc
(hathach/agentrc#456). Both need agentrc's 'battery' and 'named'
profile features, which agentrc_pin.py now requires, so the pin moves
to agentrc's wave 4 (hathach/agentrc#567).
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The HIL configuration now maps the TinyUSB CDC variant to a named build of the core CDC sketch. The profile requires core mode, named builds, and the shared test battery. HIL tests use the shared engine and a fake clock.

Changes: HIL build and profile

Layer / File(s) Summary
Named TinyUSB CDC build
.claude/skills/build/SKILL.md, .claude/skills/build/scripts/check_build.py, .claude/test/test_build.py, test/hil/core_cdc/core_cdc.ino, test/hil/core_cdc_tinyusb/core_cdc_tinyusb.ino
The TinyUSB variant now maps to core_cdc with usbstack=tinyusb. The separate TinyUSB sketch and the copy-equality check are removed. Build tests verify the sketch mapping and FQBN.
Shared battery profile and requirements
.claude/skills/hil-contract/SKILL.md, .claude/skills/hil-contract/scripts/agentrc_pin.py, .claude/skills/hil-contract/scripts/hil_test.py, .claude/test/test_agentrc_pin.py, test/hil/agentrc.json
The profile requires core, named, and battery features. It declares the shared test battery and test-function registry. The pin tests check rejection when any required feature is missing, and the agentrc commit value changes.
Battery test harness and checks
.claude/test/test_hil.py
The tests use the profile-bound engine and a fake clock and device. They check CDC replies, board-family chip selection, timing bounds, and error details.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Possibly related PRs

  • adafruit/ArduinoCore-samd#402: Adds the copied TinyUSB CDC sketch, its copy-equality contract test, and the FQBN hook that this change replaces.

Suggested reviewers: greptile-apps

Merge Risk: Minimal · up to 3b7ce

This change moves the HIL tests onto a shared test battery and builds the TinyUSB CDC variant from the main CDC sketch. It affects development and test tooling, not runtime firmware behavior. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two main changes: the shared core HIL battery from agentrc and the core_cdc_tinyusb build now made from core_cdc. Both match the changeset, which removes the copied sketch, adds CO…
Description check Passed The description states the problem, the solution, and the testing performed. It maps directly to the changed files: the shared core battery for cdc, cdc_tinyusb and timing, the named build replacing t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: the shared core HIL battery from agentrc and the core_cdc_tinyusb build now made from core_cdc. Both match the changeset, which removes the copied sketch, adds CORE_TESTS and INFO_DETAIL usage, and updates the agentrc pin and pin checks. The title is specific and concise, and a teammate scanning history would understand the primary change.

Full details: Description check

Explanation

The description states the problem, the solution, and the testing performed. It maps directly to the changed files: the shared core battery for cdc, cdc_tinyusb and timing, the named build replacing the copied sketch, the agentrc_pin.py feature requirements, the fake clock tests, and the agentrc.json pin update. It is clearly related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 033985b and 3b7ce23.

Files selected for processing: 11

  • .claude/skills/build/SKILL.md
  • .claude/skills/build/scripts/check_build.py
  • .claude/skills/hil-contract/SKILL.md
  • .claude/skills/hil-contract/scripts/agentrc_pin.py
  • .claude/skills/hil-contract/scripts/hil_test.py
  • .claude/test/test_agentrc_pin.py
  • .claude/test/test_build.py
  • .claude/test/test_hil.py
  • test/hil/agentrc.json
  • test/hil/core_cdc/core_cdc.ino
  • test/hil/core_cdc_tinyusb/core_cdc_tinyusb.ino
Files with no reviewable changes: 1

  • test/hil/core_cdc_tinyusb/core_cdc_tinyusb.ino

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@hathach hathach self-assigned this Nov 23, 2026
@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Moves the HIL checks to agentrc’s shared core battery and builds both USB stacks from one sketch.

  • The SAMD HIL profile uses agentrc’s shared core tests.
  • The TinyUSB HIL test builds from the shared CDC sketch.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Source["core_cdc source"] --> Arduino["core_cdc · Arduino stack"]
  Source --> TinyUSB["core_cdc_tinyusb · TinyUSB stack"]
  Arduino --> A["cdc_arduino"]
  TinyUSB --> T["cdc_tinyusb"]
  A --> Shared["agentrc shared CDC checks"]
  T --> Shared
Loading

Reviews (1) · Last reviewed commit: "Use agentrc's shared core HIL battery an..." · Reviewed by Greptile

@hathach
hathach merged commit f17d5a9 into master Nov 23, 2026
28 checks passed
@hathach
hathach deleted the wave4 branch November 23, 2026 05:49
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