Repository navigation
refactor(parser): remove dead CompositeMessageParser protobuf heuristic - #810
Conversation
LikelyProtobuf and Uncertain already share the protobuf-first branch, so the extra classifier never changed parser order. Co-authored-by: Tyler Kron <tylerkron@gmail.com>
|
/agentic_review |
PR Summary by QodoRemove inert protobuf heuristic from CompositeMessageParser
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR |
|
Bench test on a real Nq1 (USB, fw 3.8.0, hw 2.0.0): no behavior change. I ran the same scenarios against Note: Raw serial → CompositeMessageParser (ch0,
Deterministic replay: I replayed each of the 4 captures through both builds. Both builds produce the identical output hash (message sequence and consumed bytes), and replay reproduces the live run exactly. Heuristic 4 never fired on live traffic, even on main. Full Pre-existing, not caused by this PR, and identical on main: when a text reply arrives mid-stream in the same read as a 10-byte stream frame, the buffer is LGTM from the bench. |
CompositeMessageParsercarried a fourth classification heuristic (IsLikelyProtobufData) that could never change what the parser does. It only ever turned anUncertainhint intoLikelyProtobuf, andParseMessagestreats those two hints identically: anything that is notLikelyTexttries the protobuf parser first and falls back to text. So the heuristic was dead weight that a reader had to understand before realising it was inert.This PR deletes heuristic 4 and the
IsLikelyProtobufDatahelper. Heuristics 1-3 (printable ratio, null-byte ratio, leading SCPI marker) are unchanged.Why this is safe
DetectMessageTypeandIsLikelyProtobufDataare private and pure; the hint is consumed in exactly one place (ParseMessages), which only branches on== LikelyText.LikelyText, so it could only re-labelUncertainasLikelyProtobuf— both take the protobuf-first branch. No input can route differently.CompositeMessageParserBenchCaptureTests(Nq1 fw 3.7.2 status reply, 1- and 4-channel stream frames, SCPI replies, echoed command ahead of a status frame) and the rest of the suite pass unchanged: Core.Tests 4356 passed / 3 skipped on net9.0 and net10.0 (Release).🤖 Generated with Claude Code