Repository navigation
refactor: behaviour-preserving /simplify pass over src/ - #67
Merged
Merged
Conversation
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
This runs Claude Code's
/simplifyover every module insrc/ssh_mcp/, with one change set per slice of files so no two edited the same file. A finding was applied only if it keeps behaviour exactly the same and has clear value: dead code, redundant checks, needless indirection, or a comment that just restates the line beside it. The rest were rejected. Result: 6 files, +63 / −131. Tests, public signatures, MCP tool docstrings and every security invariant in AGENTS.md are untouched.config.pyif "groups"/"servers" in …guards with.get(…, {})and dedented. Membership now checks the dicts directly instead of copied key sets. Simpler circular jump-host loop, with the same error text.formatting.pyif s.groupsguards, since", ".join(())is already"". The footer is one expression.failed = len(results) - succeededreplaces a second counter.healthcheck.pyimport ssh_mcpprobe that can never fail insidessh_mcp.healthcheck.return e.code < 500, …replaces an if/return/return.server.pyglobal _sshdeclarations and two redundant local imports. The identicalToolError/CancelledErrorre-raise clauses are merged, and a dict comprehension builds the group counts.ssh.pyoffsetcounter that duplicatedwritten.return awaitdirectly. The eviction scan is a list comprehension, with an unusedidle_timeremoved.pyproject.tomlhealthcheck.pynow names_check_http.Models were left alone because nothing there qualified. So was
paths.py, which is security-critical, and the rejected findings are listed with reasons in each worker's report.Verification
HYPOTHESIS_PROFILE=cipytest: 848 passed. ruff format and check, mypy, bandit and gitleaks are clean.''/Nonevalues, undefined hosts and every dict order;cdcommand composition, 60 cases;list_groupsandlist_serversover HTTP (valid, empty and unknown group), plusssh-mcp healthcheckin HTTP (up and down) and stdio (valid and circular config) modes. Old and new registry and formatter output were identical.Note: the
Dependency auditcheck will fail on this PR until #66 (or Dependabot's #65) lands. That is the pyjwt 2.13.0 advisory set already onmain, not something this PR introduces.