Repository navigation
chore(quality): the cognitive-complexity findings of the local SonarQube and IDE round - #57
Merged
Merged
Conversation
…ube and IDE round, no behaviour change Seven functions above the threshold of 15 are split along their natural seams: the host's _ttl, _deliver, _handler_event and _classify_segment; the OTLP decoder's _response_field, _partial_success_block and _partial_success_field; the span mapper's _start_unix_nano, _span_status and _span_attributes; the ISO-8601 parser's _date_time_fields and _fraction_nanos; the LLM helper's _tool and _check_turn_shape. Every check keeps its order and its message, so the shared vector files pass unchanged. Also the IDE nits: the exporter's session bound through a narrowed local, the MCP binding's unknown keys built as strings and its shutdown warning naming the error, a docstring word, and the envelope codec's cast replaced by a one-line checker note (Eric's edit, kept). CHANGELOG Unreleased Changed 7; lightweight session log. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
acn-ericlaw
added a commit
that referenced
this pull request
Nov 16, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What
The cognitive-complexity findings of the local SonarQube and IDE round of 2026-11-16, fixed with no behaviour change.
Seven functions the scanner measured above its threshold of 15 are split along their natural seams: the Event API host
reads the
x-ttlbound in_ttl, delivers an RPC in_deliver, builds an interceptor's envelope in_handler_eventand renders a stream segment through
_classify_segment(the shape the Node twin'sclassifySegmentalready had); theOTLP response decoder reads a response field, the
partial_successblock and its fields in_response_field,_partial_success_blockand_partial_success_field; the span mapper computes the start time, the status and theattributes in
_start_unix_nano,_span_statusand_span_attributes; the ISO-8601 parser validates the date-timefields in
_date_time_fieldsand reads the fraction in_fraction_nanos; the LLM helper validates one tool in_tooland the shape of a first or a later turn in
_check_turn_shape. Every check runs in the order it did and raises themessage it did, so the shared vector files pass unchanged. Measured before and after with the
cognitive-complexitypackage, which gives Sonar's numbers on six of the seven (Sonar's before, the package's after):
server.handle_event_ttl2,_deliver4server._dispatch_interceptor_handler_event6server._stream_segments_classify_segment7otlp.partial_success_response_field3,_partial_success_block5,_partial_success_field10span.span_from_dataset_start_unix_nano2,_span_status3,_span_attributes5span.parse_iso8601_nanos_date_time_fields6,_fraction_nanos4llm_helper._tools_tool11llm_helper.prepare_loop_check_turn_shape8The IDE nits beside them: the exporter binds its lazy session through a local the checker can narrow, the MCP binding
builds its unknown-key list from strings (the
joinoverload complaint) and names the error in its shutdown warning (thebroad-clause inspection accepts a used exception), "deployment" in a docstring, and Eric's removal of the envelope
codec's
castis kept behind a one-linepyright: ignorecarrying the rationale. CHANGELOG Unreleased Changed 7.ruffclean,basedpyright0 errors,pytest410 passed, 64 skipped; nothing else in the pack measures above 13.Why
The second batch of Eric's local scan: the first round (#56) left the cognitive-complexity findings by design, and this
round takes them, since the functions had grown past the point where a flat walk reads better than named parts - and the
split brings the host's segment rendering to the shape the Node twin already has. The envelope codec's
castwasEric's edit; msgpack ships no type information, so without the
castthe basedpyright gate fails(
Unknown | Noneis notbytes), and the one-line note keeps both his edit and the gate - restoring thecastis thealternative. Left by design: the memory store's
asyncmethods without an await (the store protocol is async; theRedis store awaits). IDE noise: the requirements inspection on
boto3,redisandhttpx2(two extras and the MCPSDK's own dependency), dictionary typos, British spellings. The Node pack's round is opened in lockstep.
🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com