Repository navigation
Conversation
Mirrors AutoResearchLowMemory.h:158 — `remote.bind("echo", [](int v) -> int
{ return v; })` — and the exact JSON-RPC wire request that LPC845-BRK and
ESP32-C6 both fail to dispatch on master. The test:
1. Constructs an `fl::Remote` with a TestIO request source / sink.
2. Binds `"echo"` with the exact signature AutoResearch uses.
3. Parses the literal device wire bytes
{"jsonrpc":"2.0","id":1,"method":"echo","params":[4242]}
via `fl::json::parse()` (same path createSerialRequestSource takes).
4. Drives `remote.update(0)` end-to-end (pull -> handler -> processRpc
-> mRpc.handle -> response sink -> push).
5. Asserts the response is `{"result": 4242}`, not the
`{"error":{"code":-32601,"message":"Method not found: echo"}}` the
device emits.
On master this test PASSES — which is itself a finding: the bug
isolated in #3300 (echo unbound at runtime on real device) does NOT
reproduce in the host bind+dispatch chain. Either the regression lives
on the device-side serial source / parse / static-init path that host
doesn't model, or in a build-define divergence between
`FL_PLATFORM_HAS_LARGE_MEMORY=1` on LPC8xx (mis-detected — see
update on #3325) vs the same flag on host. Either way, having this
canary in the test suite means any future regression in the core
bind+dispatch path will fail loud here first instead of being
discovered weeks later via a silent device.
Refs:
- #3300 — LPC845-BRK bring-up echo silence (root issue).
- #3325 — ACLPC bisection plan (re-scoped after this test
showed the bug is FastLED-side, not Arduino-core; see comment
#3325 (comment)).
- #3336 — agents/hooks forbid powershell SerialPort (the
methodology bug that masked the real symptom for two sessions).
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 (1)
📝 WalkthroughWalkthroughA new ChangesJSON-RPC echo regression test
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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 |
|
Closing as a completed investigation rather than a change to merge. This PR's own finding is that the test passes on master — the Merging a canary that passes for the wrong reason would add CI surface without protecting anything. The diagnostic value lives in the writeup, which stays on this closed PR and is linked from #3300 / #3325. If the wire-format bug resurfaces, reopen and rebase — the test file is a good starting point once there's a device-side reproduction to anchor it. |
Summary
Adds a host unit test that mirrors
AutoResearchLowMemory.h:158's exact bind pattern (remote.bind(\"echo\", [](int v) -> int { return v; })) and drives the fullpull → handler → processRpc → mRpc.handle → sink → pushpipeline using the literal JSON-RPC wire bytes the device receives.The test PASSES on master. That is itself the finding: the bug seen on LPC845-BRK and ESP32-C6 (`{"error":{"code":-32601,"message":"Method not found: echo"}}`) does NOT reproduce in the host bind+dispatch chain. The regression must live in one of three places host doesn't model:
createSerialRequestSource()uses real serial I/O. If the line accumulator hands the dispatcher a request whose `method` field differs from `"echo"` (extra char, BOM, surrogate, etc.), lookup fails. Host bypasses this.static fl::Remote remote(...)inside an inline function inAutoResearchLowMemory.h, withg_low_memory_remotein an anonymous namespace per-TU. If the setup() and loop() functions resolve to different TUs'g_low_memory_remote, bind() and dispatch could touch different Remote instances. Host uses a directly-constructed Remote.-DSKETCH_HAS_LARGE_MEMORY=1soFL_PLATFORM_HAS_LARGE_MEMORY=1. On LPC845-BRK the same flag is also 1, but only becauseFL_IS_ARM_LPC_845mis-detects (ArduinoCore-LPC8xx'svariant.hdefinesVARIANT_BOARD_LPC845BRKbut not theLPC845*macros ouris_lpc.hkeys off of — see [#3300 bisect] Find the commit that broke LPC845-BRK JSON-RPC echo — bisect Arduino-core LPC8xx #3325 update). The TypedInvoker path then runs on a 16 KB part. Iffl::make_shared<TypedInvoker<int(int)>>(fn)returns null shared_ptr under OOM andmRegistry[key] = fl::move(entry)silently no-ops on a fullvector_inlined<Entry, 8>, lookup misses. Not yet proven.Why land this anyway
Even though it currently passes, the canary anchors the bind+dispatch invariant against future regressions. The next time someone refactors
RuntimeRpcBinding/TypedInvoker(e.g. another #3246-style change) and accidentally breaks the registration key, this test fails immediately instead of being discovered weeks later via a silent device.The test is tiny (~50 LOC), runs in 0.03s, and uses zero new infrastructure (reuses the existing `TestIO` fixture + `makeRequest` helper).
Test plan
Refs
🤖 Generated with Claude Code
Summary by CodeRabbit