Simplify transport module and remove unnecessary complexity#278
Merged
Mng-dev-ai merged 3 commits intomainfrom Feb 24, 2026
Merged
Simplify transport module and remove unnecessary complexity#278Mng-dev-ai merged 3 commits intomainfrom
Mng-dev-ai merged 3 commits intomainfrom
Conversation
- Remove _get_logger abstract method, use module-level logger in each file - Inline single-use methods (_ensure_input_open, _preexec_drop_privileges, _write_stream_eof) - Narrow broad except clauses to specific exception types - Remove redundant exception wrapping in docker connect - Remove explanatory comments from _parse_cli_output - Simplify _parse_json_buffer whitespace handling - Replace first_brace_positions logic with compiled regex - Centralize TERM env var in _prepare_environment - Remove dead code (isinstance check, redundant guards, seen set) - Inline single-use variables throughout - Use dict unpacking and short-circuit patterns for cleaner expressions - Sync frontend/backend-sidecar transport files
5b1d18e to
a0b3cd9
Compare
Mng-dev-ai
added a commit
that referenced
this pull request
Feb 24, 2026
…ation Simplify transport module and remove unnecessary complexity
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.
Summary
base.py,docker.py, andhost.pyChanges
Removed abstractions:
_get_loggerabstract method → module-levelloggerin each file_ensure_input_open→ inlined intowrite()_preexec_drop_privilegeswrapper → directpartial(self._set_process_ids, ...)_write_stream_eof→ merged into_send_eofSimplified logic:
_parse_json_bufferwhitespace handling (4 lines → 1 line)first_brace_positionslist comprehension (9 lines) → compiledJSON_START_REregex (4 lines)servers_for_clifor-loop → dict comprehension, removed deadif servers_for_cli:guard_send_eofnull checks (3 early returns → 1 short-circuit chain)_kill_exec_processRunning + Pid checks combined into short-circuitos.environ.copy()+update()+ assignments → single dict literal with**unpacking_prepare_environment(was duplicated in both subclasses)Removed dead code:
isinstance(chunk, str)check (queue only containsstrand sentinel)seenset in_resolve_run_user(duplicate lookup is harmless)if servers_for_cli:guard (always true for non-empty dict)or env.get("USER", "user")fallback (_prepare_environmentguarantees non-empty)Narrowed exception handling:
end_input:except Exception→except (OSError, CLIConnectionError)_send_eofin docker:except Exception→except OSErrorconnectTest plan