From db52f5a4cf58c4484639d6b9207c8ef0e15bfaf9 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Thu, 15 Oct 2026 19:27:21 +0200 Subject: [PATCH] =?UTF-8?q?v0.315.0:=20close=20the=20log=20tab's=20=20=E2=80=94=20the=20live=20poller=20was=20dead,=20and=20a=20t?= =?UTF-8?q?est=20now=20says=20so?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FOUND IN A BROWSER. The log tab's body was lifted out of the old logs.html by line range and the range stopped one line short, so the closing never came with it. Everything downstream agreed the page was fine: - html/template parsed it, - the page rendered and looked right, - TestAppPage_EachTabRendersItsOwnContent found `setInterval(window.fetchLogs` exactly where it expected it, because the TEXT was there. Chrome refused the whole block with "SyntaxError: Unexpected token '<'" at the `` that followed, so the live log never refreshed. A marker proves a string is present; it does not prove the browser will execute it. TestAppPage_ScriptTagsAreBalanced now counts on all seven app-page URLs and checks the last block is closed. Red-proved by removing the tag again: it fails naming the logs tab, 3 opened and 2 closed. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0117kRTSgs3rJWUFGxyoWN6Y --- controller/internal/web/app_page_test.go | 36 +++++++++++++++++++ .../internal/web/templates/app_logs.html | 1 + .../web/testdata/i18n_parity/app_logs.html | 1 + 3 files changed, 38 insertions(+) diff --git a/controller/internal/web/app_page_test.go b/controller/internal/web/app_page_test.go index cb26ecb..991164d 100644 --- a/controller/internal/web/app_page_test.go +++ b/controller/internal/web/app_page_test.go @@ -583,3 +583,39 @@ func TestAppPage_EachTabRendersItsOwnContent(t *testing.T) { } } } + +// TestAppPage_ScriptTagsAreBalanced — every tab's rendered HTML closes every `. Go's +// html/template parsed it, the page rendered, and TestAppPage_EachTabRendersItsOwnContent found +// `setInterval(window.fetchLogs` exactly where it expected it — because the TEXT was there. The +// browser then refused the block with „SyntaxError: Unexpected token '<'" and the live log poller +// never ran. A marker proves a string is present; it does not prove the browser will execute it. +// +// RED-PROOF (REPORT.md): delete the `` from app_logs.html again → this fails naming the +// logs tab. Reverted. +func TestAppPage_ScriptTagsAreBalanced(t *testing.T) { + s := appPageHarness(t) + for _, p := range []string{ + "/apps/adventurelog", "/apps/adventurelog/settings", "/apps/adventurelog/data", + "/apps/adventurelog/guide", "/apps/adventurelog/logs", + "/apps/grocy", "/apps/grocy/install", + } { + body := appGet(t, s, p).Body.String() + open := strings.Count(body, "") + if open != closed { + t.Errorf("%s: %d . + if i := strings.LastIndex(body, "= 0 { + rest := body[i:] + if j := strings.Index(rest, ""); j < 0 { + t.Errorf("%s: the last {{template "layout_end" .}} diff --git a/controller/internal/web/testdata/i18n_parity/app_logs.html b/controller/internal/web/testdata/i18n_parity/app_logs.html index 08f1293..50a7093 100644 --- a/controller/internal/web/testdata/i18n_parity/app_logs.html +++ b/controller/internal/web/testdata/i18n_parity/app_logs.html @@ -289,6 +289,7 @@ line two container.scrollTop = container.scrollHeight; startPolling(); })(); +