[Repo Assist] test(connection): expand SshTunnelService state-machine coverage#706
Conversation
Add 11 new unit tests for SshTunnelService covering state transitions and observable properties that don't require spawning a real SSH process: - InitialState_IsNotConfiguredWithNoError - MarkRestarting_SetsRestartingStatusAndErrorMessage - MarkRestarting_ErrorMessageContainsExitCode - Stop_FromNotConfigured_StatusRemainsNotConfigured - Stop_FromRestarting_TransitionsToStopped - Stop_ClearsBrowserProxyPorts - LocalTunnelUrl_IsNullWhenNotRunning - CreateSnapshot_DefaultState_ReturnsNotConfiguredSnapshot - CreateSnapshot_AfterMarkRestarting_CapturesErrorAndStatus - ResetNotConfigured_FromStopped_RestoresNotConfigured - Dispose_DoesNotThrow Previous coverage: 1 test (ResetNotConfigured happy path). Now: 12 tests covering the full NotConfigured→Restarting→Stopped state cycle, snapshot consistency, and default property values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: needs changes before merge. Reviewed June 6, 2026, 9:10 AM ET / 13:10 UTC. Summary Reproducibility: not applicable. This PR adds unit coverage rather than reporting a user-facing bug. Source inspection of current master shows the coverage gap is real because only the original reset test exists there. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a focused test-only coverage PR whose assertions accurately exercise reachable Do we have a high-confidence way to reproduce the issue? Not applicable; this PR adds unit coverage rather than reporting a user-facing bug. Source inspection of current master shows the coverage gap is real because only the original reset test exists there. Is this the best way to solve the issue? Mostly yes, but not completely: a test-only PR is the right boundary, while the proxy-port cleanup test should first establish a non-zero port state or stop claiming that coverage. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 4be005707f44. Label changesLabel changes:
Label justifications:
Evidence reviewedAcceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Expands
SshTunnelServiceTests.csfrom 1 test to 12 tests, covering the full state machine and observable properties ofSshTunnelServicewithout requiring a real SSH process.What was tested before
ResetNotConfiguredhappy path onlyNew tests added (11)
InitialState_IsNotConfiguredWithNoErrorNotConfigured,IsActive=false,LocalTunnelUrl=nullMarkRestarting_SetsRestartingStatusAndErrorMessageMarkRestarting(exitCode)transitions toRestarting, setsLastErrorMarkRestarting_ErrorMessageContainsExitCodeStop_FromNotConfigured_StatusRemainsNotConfiguredStop()with no process keeps status asNotConfigured(no spuriousStoppedtransition)Stop_FromRestarting_TransitionsToStoppedStop()afterMarkRestartingtransitions toStoppedStop_ClearsBrowserProxyPortsStop()zeroesCurrentBrowserProxyLocalPort/CurrentBrowserProxyRemotePortLocalTunnelUrl_IsNullWhenNotRunningLocalTunnelUrlisnullwhen no process is runningCreateSnapshot_DefaultState_ReturnsNotConfiguredSnapshotNotConfigured,IsRunning=false,LastError=nullCreateSnapshot_AfterMarkRestarting_CapturesErrorAndStatusRestartingstatus and error messageResetNotConfigured_FromStopped_RestoresNotConfiguredRestarting → Stopped → NotConfiguredcycleDispose_DoesNotThrowDispose()on a fresh service does not throwRationale
SshTunnelServiceis central to SSH gateway connectivity and restart logic. Only one state transition was previously covered. The new tests exercise theNotConfigured → Restarting → Stopped → NotConfiguredlifecycle and snapshot consistency, which guards against regressions in reconnect/restart flows.Test Status
dotnet test ./tests/OpenClaw.Connection.Tests/— Passed: 278/278 ✅dotnet test ./tests/OpenClaw.Tray.Tests/— Passed: 956/958 (2 pre-existing skips) ✅dotnet test ./tests/OpenClaw.Shared.Tests/— Passed: 2041/2078 (8 pre-existingMcpHttpServerTests/ExecApprovalV2NormalizationTestsinfrastructure failures) ✅Add this agentic workflows to your repo
To install this agentic workflow, run