Skip to content

chore: share SSH mocks and cover all tool handlers - #180

Open
laozhej wants to merge 1 commit into
TMHSDigital:mainfrom
laozhej:test/164-shared-ssh-handler-coverage
Open

laozhej wants to merge 1 commit into
TMHSDigital:mainfrom
laozhej:test/164-shared-ssh-handler-coverage

Conversation

@laozhej

@laozhej laozhej commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The handler, integration and confirm-gate suites now share an SSH mock factory that retains the real module and replaces only execSSH. Shared hooks reset queued replies and implementations and restore HOMELAB_* settings after each test.

Added 28 handler cases covering the remaining 15 untested tools, plus per-node AdGuard configuration, Pi status fan-out, NPM certificate request/error paths and Compose discovery/timeouts. All 57 registered tools now have handler coverage across the three suites. Removed the unused checkSSHAvailable wrapper.

Why

Fixes #164. Copied configuration, timeout and error helpers let tests pass against behavior that differed from production, and clearAllMocks left implementations and queued replies behind.

This overlaps #175 only in resetting the integration suite's SSH mock. Its dynamic-import cleanup remains separate; this PR does not depend on it. The Speedtest handler test exercises per-node configuration and connection errors without depending on the API changes in #176.

Type

  • New MCP tool
  • New skill
  • New rule
  • Bug fix
  • Documentation
  • Other: test coverage and mock isolation

Testing

  • cd mcp-server && npm run build && npm test passes
  • pytest tests/ -v --tb=short passes
  • Tested against a live Pi (if applicable)

Local Node 22.23.0: build and npm run typecheck passed; 637 TypeScript tests passed, with the 10 opt-in live-Pi tests skipped. All 273 Python structure tests passed. The three affected suites also passed with shuffled execution (--sequence.shuffle --sequence.seed=164): 208 tests. Audited the registered tool list against handler invocations: 57 of 57 covered.

No live Pi was used. Handler tests mock SSH transport; they do not execute remote commands or certify live service behavior.

Checklist

  • No secrets or credentials committed
  • CHANGELOG.md updated
  • README.md updated (if adding tools/skills/rules)
  • CLAUDE.md updated (if adding tools/skills/rules)

README/CLAUDE updates are not applicable: no tools, skills or rules were added or removed. Test authentication strings are fixtures only. Prepared with OpenAI Codex assistance; changes reviewed and the checks above run locally. The commit includes the required matching DCO sign-off.

@laozhej
laozhej requested a review from TMHSDigital as a code owner November 23, 2026 04:16
@github-actions github-actions Bot added documentation Improvements or additions to documentation mcp labels Nov 23, 2026
@TMHSDigital

Copy link
Copy Markdown
Owner

Thanks for this. #175 just merged and overlaps with integration.test.ts, and #177 and #178 both change handlers.test.ts. Could you rebase on main once those are in? After that it's good to go from my side.


Generated by Claude Code

@laozhej
laozhej force-pushed the test/164-shared-ssh-handler-coverage branch from 23d0bb9 to c6d9db7 Compare November 27, 2026 06:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

16 tools have no handler test; ssh-api test mocks are copied and have drifted

2 participants