Result should only show when we FAIL#10
Open
zeerekahmad wants to merge 7 commits into
Open
Conversation
|
ty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge from zeerek/bugfix-axiomatic-flips-error-logic to main
Description
ECU flashing through the Axiomatic CAN-to-Ethernet adapter has been failing intermittently, while the equivalent flash via Kvaser SocketCAN is reliable. A code audit traced the asymmetry to the TCP transport layer: the adapter was treating the byte stream as one-CAN-frame-per-read and only understood the deprecated "CAN Stream" message type, so under bursty flash traffic frames were being lost three different ways (coalesced reads, heartbeat-induced desync, packed multi-frame messages). This MR closes all eight audit findings across three phases — a quick correctness pass, a protocol-correct streaming parser rewrite, and a concurrency/throughput refactor onto a persistent
io_contextwith a strand. Public API is unchanged for existing consumers (the newverboseargument onAxiomaticAdapteris defaulted). See CLAUDE_PLAN_AND_RESOLUTIONS.md for the full design doc and finding-by-finding status.Highlighted Changes
axiomatic_adapter/include/axiomatic_adapter/axiomatic_frame_parser.hpp
SYNC_PREFIX(was a wrong 7-byte "header" that included Message ID), plus explicitMSG_ID_*constants for the four known message types.heartbeats_seen,notification_frames_skipped,dropped_bytes, etc.) and aset_verbose()switch.axiomatic_adapter/src/axiomatic_frame_parser.cpp
tryParseFrame()walks the protocol envelope using the Message Data Length at bytes 9-10 — the canonical framing field — and dispatches on Message ID; heartbeats / status / FD / unknown are consumed and counted, never raised as errors.decodeCanStreamBody()iterates packed CAN frames and skips Notification frames inside a single CAN Stream message, draining everything into the internal queue so the existing one-frame-per-call API still works.std::coutper non-CAN event.axiomatic_adapter/src/axiomatic_adapter.cpp
send()now writes exactlyframe_data_lengthpayload bytes — declaredmessage_lengthand the actual wire payload finally agree for any DLC.io_contextwithexecutor_work_guardruns on a dedicated worker thread for the adapter's lifetime; per-callrestart()/run()is gone.boost::asio::strandserializes every socket op;send()andreceive()post async work and block onstd::promise/std::future— public sync signatures unchanged.async_receivechain posted onto the strand;startReceptionThread()no longer spawns a thread,joinReceptionThread()poststcp_socket_.cancel()and waits for the chain to drain.TCP_NODELAYset immediately after a successful connect.receive()caller.axiomatic_adapter/include/axiomatic_adapter/axiomatic_adapter.hpp
DEFAULT_SOCKET_RECEIVE_TIMEOUT_MSlowered from 100 ms → 20 ms now that the receive loop is async and the timeout only bounds the sync polling API.bool verbose = falseconstructor argument; no break for existing callers.axiomatic_adapter/src/axiomatic_socketcan_bridge.cpp
-vflag into theAxiomaticAdapterconstructor soros2 run axiomatic_adapter axiomatic_socketcan_bridge ... -vflips parser verbosity too.axiomatic_adapter/test/axiomatic_frame_parser_test.cpp
axiomatic_adapter/test/axiomatic_send_wire_format_test.cpp
send()produces a wire-correct CAN Stream message for DLC 0 / 4 / 8 and round-trips cleanly through the parser. No hardware required.axiomatic_adapter/test/axiomatic_concurrent_io_test.cpp
send()and the reception chain delivers frames via callback. Validates the strand serialization end-to-end.axiomatic_adapter/CMakeLists.txt
axiomatic_frame_parser.cppto the shared library, plus three no-hardware test executables.libaxiomatic_adapter.soat runtime — avoids the symbol-lookup race against an older/opt/polymath/axiomatic_adapterinstall onLD_LIBRARY_PATH.axiomatic_adapter/test/axiomatic_adapter_test.cpp
// NOTE: the first run may failcomment — that symptom was caused by the absent TCP stream framer and is fixed by this MR.CLAUDE_PLAN_AND_RESOLUTIONS.md
Test Plan
Automated (added in this MR, no hardware required): 25 Catch2 cases / 273 assertions across
test_axiomatic_frame_parser,test_axiomatic_send_wire_format, andtest_axiomatic_concurrent_io. Build withcolcon build --merge-install --packages-select axiomatic_adapter --cmake-args -DBUILD_TESTING=ONand run withcolcon test --merge-install --packages-select axiomatic_adapter. All passing locally.Manual (still owed before sign-off):
192.168.0.34:4000and confirm the previously flaky "first read" no longer fails.heartbeats_seen() ≈ 30,dropped_bytes() == 0.send()→receive()round trip should drop from the previous ~40 ms (first-frame Nagle) to sub-millisecond.-fsanitize=threadand runtest_axiomatic_concurrent_iofor the formal TSAN sign-off on the Phase 3 strand refactor.Pre-Merge Tasks
Changes