From b16a5c9724030b6798c17b3b349d126a297dede6 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Thu, 1 Oct 2026 21:51:14 +0200 Subject: [PATCH] Say env var changes take effect at the next deploy or rollback (closes #255) The hint under the app page's environment variable editor asked for a container restart. Environment variables are set when a container is created, and upaas's restart stops and starts the same container, so it keeps the old values; deploy and rollback each create a new container. The hint now says so in one sentence, styled with alert-warning like the page's Volume Mounts note: its old text-amber-600 class is not in the built stylesheet. A handler test renders the app page and checks the hint. Model: opus-5-5 --- TODO.md | 5 +++ .../handlers/app_page_env_var_hint_test.go | 39 +++++++++++++++++++ templates/app_detail.html | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 internal/handlers/app_page_env_var_hint_test.go diff --git a/TODO.md b/TODO.md index 9d51956..ba79bcf 100644 --- a/TODO.md +++ b/TODO.md @@ -20,6 +20,11 @@ regress. # Completed Steps +- 2026-10-01: The hint under the app page's environment variable editor now says + changes take effect at the next deploy or rollback, in the page's warning + style, instead of asking for a container restart, which keeps the old values + (#255). + - 2026-10-01: An app with no volume mounts says on its page, and in the log of each deploy, that a deploy or rollback loses the files it writes and a restart keeps them; the README's Volume mounts section says a deploy or rollback keeps diff --git a/internal/handlers/app_page_env_var_hint_test.go b/internal/handlers/app_page_env_var_hint_test.go new file mode 100644 index 0000000..41d05dc --- /dev/null +++ b/internal/handlers/app_page_env_var_hint_test.go @@ -0,0 +1,39 @@ +package handlers_test + +import ( + "net/http" + "net/http/httptest" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "sneak.berlin/go/upaas/internal/service/app" +) + +// TestAppPageEnvVarHint checks that the environment variable editor says +// changes take effect at the next deploy or rollback, in the warning style. +func TestAppPageEnvVarHint(t *testing.T) { + t.Parallel() + + testCtx := setupTestHandlers(t) + + createdApp, err := testCtx.appSvc.CreateApp(t.Context(), app.CreateAppInput{ + Name: "env-hint-app", + RepoURL: "git@example.com:user/env-hint-app.git", + }) + require.NoError(t, err) + + request := httptest.NewRequestWithContext( + t.Context(), http.MethodGet, "/apps/"+createdApp.ID, nil, + ) + request = addChiURLParams(request, map[string]string{"id": createdApp.ID}) + recorder := httptest.NewRecorder() + + testCtx.handlers.HandleAppDetail().ServeHTTP(recorder, request) + + require.Equal(t, http.StatusOK, recorder.Code) + assert.Contains(t, recorder.Body.String(), + `
`+ + "Environment variable changes take effect at the next deploy or rollback.
") +} diff --git a/templates/app_detail.html b/templates/app_detail.html index 7166a69..0889c3d 100644 --- a/templates/app_detail.html +++ b/templates/app_detail.html @@ -178,7 +178,7 @@ -⚠ Container restart needed after env var changes.
+Environment variable changes take effect at the next deploy or rollback.