Repository navigation
feat(autoresearch): host driver for the #2994 timing-drift reproducer (#3765) - #3768
Conversation
…#3765) AutoResearchTimingDrift.h has faithfully replayed the #2994 reporter's sketch for some time -- 35-LED WS2812B ring on the legacy addLeds path, setMaxRefreshRate(800), millisDelay-gated 255-step fade, delay(1000) between sequences -- and exposes it as the `timingDriftTest` JSON-RPC method. It had no host driver. Nothing in ci/ referenced `timingDriftTest` and there was no CLI flag, so the reproducer had never been run. That is why #2994 went a year with a wrong root cause: the tool to falsify it existed but could not be invoked. Follows the established standalone bring-up pattern (test_flexio_rx_objectfled.py), not a new autoresearch flag, since that is what these device probes already look like. Reports the two numbers that matter: 1. Per-sequence wall time against the 2495 ms theoretical (225 + 254*5 + 1000). Index 0 is excluded -- it is partial by construction, with no leading 225 ms arm and no trailing 1000 ms delay, so including it understates the mean. 2. FastLED.show() duration. The firmware already returns show_min/max/ total_us; nothing consumed them. This is the decisive measurement: the reported drift is 268-1012 us per fade step, the same order as one 35-LED WS2812 frame (~1050 us of wire time). tests/profile/ fastled_show.cpp already showed the CPU-side dispatch path costs ~2 us, so if show() sits well above the wire floor the cost is in encoding, DMA, or a driver wait -- none visible off-device. Deliberately does not fail on drift. What counts as "too much" is the question under investigation, not something to hardcode into the tool. Tests: 7 cases in ci/tests/test_timing_drift_driver.py covering the arithmetic that would otherwise silently mislead -- the theoretical period, the wire floor, the partial-first-sequence exclusion, drift reported against theory, and the missing-timing fallback. Mutation-checked: removing the index-0 skip fails three of them. Note this is validated at the analysis layer only. The RPC round-trip is unexercised -- the ESP32-C6 on this bench dropped off the USB bus and FastLED/fbuild#1213 blocks redeploying it. Refs #3765, #2994 Co-Authored-By: Claude <[email protected]>
📝 WalkthroughWalkthroughAdds a command-line host driver for the ChangesTiming drift driver
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant RpcBench
participant Firmware
CLI->>RpcBench: Connect using --port
CLI->>RpcBench: Call ping
RpcBench->>Firmware: Send ping JSON-RPC request
Firmware-->>RpcBench: Return ping result
CLI->>RpcBench: Call timingDriftTest with test parameters
RpcBench->>Firmware: Send timingDriftTest JSON-RPC request
Firmware-->>RpcBench: Return timing and show metrics
CLI->>CLI: Print sequence and show summaries
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ci/autoresearch/test_timing_drift.py (1)
1-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename the driver to avoid test-discovery ambiguity.
ci/autoresearch/test_timing_drift.pymatches the repo test-file glob and pytest’s defaulttest_*.pycollection pattern, but it is a CLI/module driver, not a pytest test file. Rename it to something liketiming_drift_driver.pyor another non-test_-prefixed module name, and updateci/tests/test_timing_drift_driver.pyimports accordingly.🤖 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 `@ci/autoresearch/test_timing_drift.py` around lines 1 - 10, Rename the CLI/module driver currently represented by the timing-drift script to a non-test-prefixed name such as timing_drift_driver.py, then update imports in ci/tests/test_timing_drift_driver.py to reference the renamed module. Preserve the driver’s behavior and pytest test discovery for the actual test module.
🤖 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 `@ci/autoresearch/test_timing_drift.py`:
- Around line 1-10: Rename the CLI/module driver currently represented by the
timing-drift script to a non-test-prefixed name such as timing_drift_driver.py,
then update imports in ci/tests/test_timing_drift_driver.py to reference the
renamed module. Preserve the driver’s behavior and pytest test discovery for the
actual test module.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 367a8cdd-3969-4c1b-b9e9-0f229d0e8a91
📒 Files selected for processing (2)
ci/autoresearch/test_timing_drift.pyci/tests/test_timing_drift_driver.py
Another #3765 item: the #2994 reproducer had no way to run.
The gap
AutoResearchTimingDrift.hhas faithfully replayed the reporter's sketch for some time — 35-LED WS2812B ring on the legacyaddLedspath,setMaxRefreshRate(800), millisDelay-gated 255-step fade,delay(1000)between sequences — exposed as thetimingDriftTestJSON-RPC method.It had no host driver. Nothing in
ci/referencedtimingDriftTest, andbash autoresearch --helphas no matching flag. The reproducer had never been run.That is not a footnote — it is arguably why #2994 went a year with a wrong root cause. The tool built to falsify a hypothesis existed but could not be invoked, so hypotheses got tested by argument instead of measurement. (Mine included: I published a throttle-based root cause that this script would have refuted in one run.)
What it reports
Follows the established standalone bring-up pattern (
test_flexio_rx_objectfled.py) rather than adding an autoresearch flag, since that is what these device probes already look like.1. Per-sequence wall time against the 2495 ms theoretical (
225 + 254*5 + 1000), with a per-sequence bar chart. Index 0 is excluded — it is partial by construction (no leading 225 ms arm, no trailing 1000 ms delay), so including it understates the mean.2.
FastLED.show()duration — the decisive number. The firmware already returnedshow_min_us/show_max_us/show_total_us; nothing consumed them. The reported drift is 268–1012 µs per fade step, the same order as one 35-LED WS2812 frame (~1050 µs of wire time). Sincetests/profile/fastled_show.cpp(#3767) established the CPU-side dispatch path costs only ~2 µs, ifshow()sits well above the wire floor then the cost is in encoding, DMA, or a driver wait — none of which are visible off-device.It deliberately does not fail on drift. What counts as "too much" is the question under investigation, not something to hardcode into the tool.
Usage
Run on master and on 3.10.3, compare.
Tests
7 cases in
ci/tests/test_timing_drift_driver.py, covering the arithmetic that would otherwise silently mislead the investigation: the theoretical period, the wire floor, the partial-first-sequence exclusion, drift reported against theory, and the missing-timing fallback for older firmware.Mutation-checked — removing the index-0 skip fails three of them.
What is not validated
The RPC round-trip is unexercised. The ESP32-C6 on this bench dropped off the USB bus during earlier deploy attempts and FastLED/fbuild#1213 blocks redeploying it, so only the analysis layer is covered here. Flagging that rather than implying an end-to-end run.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
FastLED.show()performance statistics.Tests