Repository navigation
feat(autoresearch): wire timingDriftTest RPC for #2994 repro - #3210
Conversation
The AutoResearchTimingDrift.h harness was sitting untracked on master —
self-documented as "Invoked via the timingDriftTest JSON-RPC handler
registered in AutoResearchRemote.cpp", but the handler was never written
and the file was never #include'd anywhere.
Wires it up to match the existing AutoResearchSimd / Wave8Expand /
ParlioEncode / ParlioStream / AnimartrixBench pattern:
- Adds the include in AutoResearch.ino, AutoResearchRemote.cpp, and
all 9 *Methods.cpp translation units.
- Registers `timingDriftTest` in bindDriverMethods(), accepting
{pin, numLeds, iterations} (all optional, defaults 4/35/10) and
returning {success, pin, num_leds, iterations, cpu_mhz,
show_count, show_min_us, show_max_us, show_total_us, iter_ms[]}.
- Adds the discovery catalog entry in PinMethods.
Smoke-tested via `bash compile wasm --examples AutoResearch` (build
successful, 55s).
No host-side Python caller — the harness is invocable through the
generic JSON-RPC test path when #2994 is next investigated.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughA new header ChangesTiming Drift Repro Module
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
examples/AutoResearch/AutoResearchTimingDrift.h (1)
28-28: ⚡ Quick winReplace raw
#pragmawith the project-approved compiler-control pattern.Line 28 uses
#pragma once, which conflicts with repository C++ rules.As per coding guidelines, "Use FastLED compiler control macros from fl/stl/compiler_control.h instead of raw
#pragmadirectives."🤖 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 `@examples/AutoResearch/AutoResearchTimingDrift.h` at line 28, Replace the raw `#pragma once` directive in the AutoResearchTimingDrift.h file with the project-approved compiler control macros from the fl/stl/compiler_control.h header file. Remove the `#pragma once` line and instead include the appropriate FastLED compiler control macros that provide include guard functionality according to the project's C++ coding guidelines.Source: Coding guidelines
🤖 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.
Inline comments:
In `@examples/AutoResearch/AutoResearchRemotePinMethods.cpp`:
- Around line 576-582: A hardcoded totalFunctions constant exists somewhere
after the functions vector is populated that tracks the count of available RPC
functions. When adding the new timingDriftTest function to the functions vector
via push_back, this hardcoded value becomes stale and causes the help catalog to
under-report the RPC count. Update the totalFunctions constant to reflect the
new total count, or preferably refactor it to derive the count dynamically from
functions.size() so it automatically stays in sync whenever functions are added
or removed.
In `@examples/AutoResearch/AutoResearchTimingDrift.h`:
- Around line 147-183: The while loop starting with (completed < iterations) can
run for approximately 25 seconds with the 1000ms delay at line 174 repeated per
iteration, which exceeds the 5000ms watchdog timeout and risks system resets.
Add watchdog feed/refresh calls at strategic points within the loop to prevent
timeout violations. Place watchdog refresh calls at the beginning of each loop
iteration and after the 1000ms delay to ensure the watchdog timer is
continuously serviced before it times out.
- Around line 95-100: The FastLED.clear(ClearFlags::CHANNELS) call on line 95
modifies global state before the pin validity is checked via proxy.valid() on
line 98. Move the FastLED.clear(ClearFlags::CHANNELS) statement to after the
validity check block (after the if (!proxy.valid()) return statement) so that
global channel state is only cleared when the pin is confirmed to be valid,
preventing mutation of global state when an invalid pin is requested.
---
Nitpick comments:
In `@examples/AutoResearch/AutoResearchTimingDrift.h`:
- Line 28: Replace the raw `#pragma once` directive in the
AutoResearchTimingDrift.h file with the project-approved compiler control macros
from the fl/stl/compiler_control.h header file. Remove the `#pragma once` line
and instead include the appropriate FastLED compiler control macros that provide
include guard functionality according to the project's C++ coding guidelines.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 51dc0b12-838a-4874-870a-1625ee848a0e
📒 Files selected for processing (12)
examples/AutoResearch/AutoResearch.inoexamples/AutoResearch/AutoResearchRemote.cppexamples/AutoResearch/AutoResearchRemoteAsyncMethods.cppexamples/AutoResearch/AutoResearchRemoteBenchmarkMethods.cppexamples/AutoResearch/AutoResearchRemoteDriverMethods.cppexamples/AutoResearch/AutoResearchRemoteMathMethods.cppexamples/AutoResearch/AutoResearchRemoteNetworkMethods.cppexamples/AutoResearch/AutoResearchRemotePinMethods.cppexamples/AutoResearch/AutoResearchRemoteRunParallelTest.cppexamples/AutoResearch/AutoResearchRemoteRunSingleTest.cppexamples/AutoResearch/AutoResearchRemoteSystemMethods.cppexamples/AutoResearch/AutoResearchTimingDrift.h
…nel-clear ordering, watchdog feed Three valid CodeRabbit findings on PR #3210: 1. PinMethods.cpp: hardcoded `totalFunctions=28` would drift every time a new RPC is registered. Use `functions.size()` so it stays accurate. 2. AutoResearchTimingDrift.h: `FastLED.clear(ClearFlags::CHANNELS)` ran before pin validity was checked, mutating global RPC-test channel state on bad pin requests. Probe with a throwaway proxy first, only touch globals once the pin is known valid. 3. AutoResearchTimingDrift.h: a default 10-iter run takes ~25s; the AutoResearch watchdog timeout (AUTORESEARCH_WATCHDOG_TIMEOUT_MS=5000, AutoResearch.ino:250) would fire mid-sequence. Feed watchdog around the per-sequence delay(1000) and on a 1 s cadence inside the inner poll loop. Re-verified via `bash compile wasm --examples AutoResearch` (success, 51s). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
examples/AutoResearch/AutoResearchTimingDrift.hhas been sitting untracked onmaster— its docstring claimed it's "Invoked via thetimingDriftTestJSON-RPC handler registered in AutoResearchRemote.cpp", but the handler was never written and the file wasn't#included anywhere. This PR wires it up so the harness can actually be invoked.Related to open issue #2994 (compounded per-sequence timing drift on master vs 3.10.3).
Changes
AutoResearchTimingDrift.hto the tracked tree.#includeinAutoResearch.ino,AutoResearchRemote.cpp, and all 9*Methods.cpptranslation units (matches the existing pattern used byAutoResearchSimd/Wave8Expand/ParlioEncode/ParlioStream/AnimartrixBench).timingDriftTestinbindDriverMethods():[{pin, numLeds, iterations}](all optional; defaults4 / 35 / 10;iterationsclamped tokMaxIterations = 64).{success, pin, num_leds, iterations, cpu_mhz, show_count, show_min_us, show_max_us, show_total_us, iter_ms: [...]}.PinMethodsso the function shows up in the listed RPC catalog.No host-side Python caller — the harness is invocable through the generic JSON-RPC test path when #2994 is next investigated.
Test plan
bash compile wasm --examples AutoResearch— build successful (55s).bash lint --cpp— no new violations (one pre-existing warn-only PlatformIO-internal-usage hit, tracked in ci: sweep PlatformIO build usage and add linters that enforce fbuild-only board builds #2701).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
show()timing statistics (count/min/max/total), and per-sequence elapsed milliseconds.timingDriftTest) that accepts optional pin, LED count, and iteration parameters and returns validity plus the collected timing metrics in JSON.Documentation
helpRPC to include the newtimingDriftTestendpoint and to report the function count dynamically.