From 9ea926aee8ecd89c509f3de7040567691ff7ade0 Mon Sep 17 00:00:00 2001 From: Raj Nakarja Date: Fri, 21 Aug 2026 11:40:44 +0200 Subject: [PATCH 1/2] Name the flake job for what it builds ci.yml and flake.yml both called their job build, so a pull request that runs both showed two checks with the same name and no way to tell which had failed. The three jobs are release, build and flake now. --- .github/workflows/flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake.yml b/.github/workflows/flake.yml index 44a56b1..5ba7b20 100644 --- a/.github/workflows/flake.yml +++ b/.github/workflows/flake.yml @@ -20,7 +20,7 @@ concurrency: cancel-in-progress: true jobs: - build: + flake: runs-on: ubuntu-latest timeout-minutes: 20 steps: From 335f18720c1d9aab4c50fd4ff6e4431fbbab98b1 Mon Sep 17 00:00:00 2001 From: Raj Nakarja Date: Fri, 21 Aug 2026 11:50:44 +0200 Subject: [PATCH 2/2] Pin the probe guard's boundary, not just its presence The review of the last cycle found that nothing held the widened condition on account delete's probe. Reverting it to the 401 it replaced left the whole package green, because every test answered the probe with 200 or 401 and both take the same branch either way. The cycle's own commit message said every new guard had been checked against the mutation that breaks it, which was true only of the coarse mutation that deletes the guard outright. The two standalone probe tests become one table over 401, 503 and 426, so a refusal of any kind stops the delete, suppresses the question and relays the server's own sentence. Checked against three mutations: narrowing the condition back to 401, removing it, and pointing the probe back at the health check the server does not authenticate. --- internal/account/account_test.go | 71 ++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/internal/account/account_test.go b/internal/account/account_test.go index 9dffb63..2990f7f 100644 --- a/internal/account/account_test.go +++ b/internal/account/account_test.go @@ -429,35 +429,64 @@ func TestAccountDeleteAsksNothingWhenTheServerIsGone(t *testing.T) { } } -func TestAccountDeleteStopsWhenTheStoredLoginIsNoLongerValid(t *testing.T) { - deleted := false +func TestAccountDeleteStopsWhenTheProbeIsRefused(t *testing.T) { + tests := []struct { + name string + status int + body string + wantError string + }{ + { + name: "the login is no longer valid", + status: http.StatusUnauthorized, + body: "the login is no longer valid, log in again", + wantError: "no longer valid", + }, + { + name: "the server cannot answer", + status: http.StatusServiceUnavailable, + body: "the server could not list the fleets", + wantError: "could not list the fleets", + }, + { + name: "the version gate refuses", + status: http.StatusUpgradeRequired, + body: "update superstack to carry on", + wantError: "update superstack", + }, + } - mux := http.NewServeMux() + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + deleted := false + + mux := http.NewServeMux() - // What the server's own auth middleware answers for a revoked login. - mux.HandleFunc("GET /fleets", func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "the login is no longer valid, log in again", http.StatusUnauthorized) - }) + mux.HandleFunc("GET /fleets", func(w http.ResponseWriter, r *http.Request) { + http.Error(w, test.body, test.status) + }) - mux.HandleFunc("DELETE /account", func(w http.ResponseWriter, r *http.Request) { - deleted = true - }) + mux.HandleFunc("DELETE /account", func(w http.ResponseWriter, r *http.Request) { + deleted = true + }) - session, out := apitest.LoggedInSession(t, mux) + session, out := apitest.LoggedInSession(t, mux) - session.In = strings.NewReader("y\n") + session.In = strings.NewReader("y\n") - err := Delete(session, nil) + err := Delete(session, nil) - if err == nil || !strings.Contains(err.Error(), "no longer valid") { - t.Fatalf("error = %v, want the server's own refusal", err) - } + if err == nil || !strings.Contains(err.Error(), test.wantError) { + t.Fatalf("error = %v, want the server's own refusal", err) + } - if out.String() != "" { - t.Errorf("output = %q, want the question never to be put", out.String()) - } + if out.String() != "" { + t.Errorf("output = %q, want the question never to be put", out.String()) + } - if deleted { - t.Error("the server saw the account deleted although the login was refused") + if deleted { + t.Error("the server saw the account deleted although the probe was refused") + } + }) } }