[client] Trim the new comments to the contributing guide's length budget

CONTRIBUTING.md caps comments at 90 characters per line and roughly 250
per comment. The three comments added by this PR were over both limits.
The test comments also restated their own test names, so they lose that
half and keep only the why.
This commit is contained in:
Maxim Egorov
2026-08-28 01:34:09 +02:00
parent f4d9c1c0d0
commit c7afc93e41
2 changed files with 8 additions and 13 deletions
@@ -32,10 +32,9 @@ func (rs *RouteSelector) SelectRoutes(routes []route.NetID, appendRoute bool, al
rs.mu.Lock() rs.mu.Lock()
defer rs.mu.Unlock() defer rs.mu.Unlock()
// Validate before mutating: a non-append selection wipes the current selection first, so // Validate before mutating: a non-append selection wipes the current selection
// a request naming only unavailable routes would deselect everything the user had and put // first, so a request of only unavailable routes would deselect everything and
// nothing in its place. Requesting no routes at all is a different thing - that's the // put nothing back. An empty request means deselect all, so it still goes through.
// caller asking to deselect all - and still goes through.
var err *multierror.Error var err *multierror.Error
available := make([]route.NetID, 0, len(routes)) available := make([]route.NetID, 0, len(routes))
for _, r := range routes { for _, r := range routes {
@@ -888,12 +888,9 @@ func TestRouteSelector_EnableExitNodeKeepsOtherRoutes(t *testing.T) {
assert.True(t, rs.IsSelected("lan2"), "non-exit route must stay selected") assert.True(t, rs.IsSelected("lan2"), "non-exit route must stay selected")
} }
// TestRouteSelector_SelectRoutes_AllUnavailableKeepsSelection covers the destructive case: a // A non-append selection clears the current selection before applying the requested
// non-append selection clears the current selection before applying the requested one, so a // one, so an all-unavailable request used to leave nothing selected while returning
// request naming only unavailable routes used to leave everything deselected while still // an error. Requests with at least one available route are unaffected.
// returning an error - a typo in a route ID silently dropped the user's exit node. A request
// with at least one available route keeps applying the valid part (see "Select non-existing
// route" above); this is only about the all-invalid case.
func TestRouteSelector_SelectRoutes_AllUnavailableKeepsSelection(t *testing.T) { func TestRouteSelector_SelectRoutes_AllUnavailableKeepsSelection(t *testing.T) {
allRoutes := []route.NetID{"route1", "route2", "route3"} allRoutes := []route.NetID{"route1", "route2", "route3"}
@@ -909,9 +906,8 @@ func TestRouteSelector_SelectRoutes_AllUnavailableKeepsSelection(t *testing.T) {
} }
} }
// TestRouteSelector_SelectRoutes_EmptyRequestStillDeselectsAll guards the boundary of the check // Boundary of the check above: an empty request is the caller deselecting everything,
// above: asking for no routes is the caller deselecting everything, not a failed request, so it // not a failed lookup, so it must keep working.
// must keep working.
func TestRouteSelector_SelectRoutes_EmptyRequestStillDeselectsAll(t *testing.T) { func TestRouteSelector_SelectRoutes_EmptyRequestStillDeselectsAll(t *testing.T) {
allRoutes := []route.NetID{"route1", "route2", "route3"} allRoutes := []route.NetID{"route1", "route2", "route3"}