From 133c5ec27ca77fa8e8d7d04682b8519500b719df Mon Sep 17 00:00:00 2001 From: Jonathon Leight Date: Wed, 5 Aug 2026 21:21:29 -0400 Subject: [PATCH] Explain regions and flooding --- internal/core/config_region_modal_test.go | 19 ++++++++ .../core/templates/config_region_edit.html | 6 ++- internal/e2e/region_editor_test.go | 45 +++++++++++++++++++ internal/web/static/ui.js | 16 +++++++ internal/web/templates/org_config.html | 41 +++++++++++++++-- 5 files changed, 123 insertions(+), 4 deletions(-) diff --git a/internal/core/config_region_modal_test.go b/internal/core/config_region_modal_test.go index ca81d14..72104d6 100644 --- a/internal/core/config_region_modal_test.go +++ b/internal/core/config_region_modal_test.go @@ -361,4 +361,23 @@ func TestConfigRootFloodToggle(t *testing.T) { if !strings.Contains(page, `name="root_allow_flood" value="1"`) { t.Fatal("config page should render the root flood switch") } + // While flooding is allowed there's nothing to warn about. + if strings.Contains(page, `data-testid="config-root-deny-warning"`) { + t.Error("the deny warning should only show while flooding is denied") + } + + // Denying is the consequential setting: the wildcard is the only thing that + // repeats unscoped packets (meshcore-go node/region.go, FindFloodMatch), so + // turning it off silently strands anyone who hasn't configured regions. Say so. + resp = post(t, ts, h.app, path, url.Values{}, sess) + resp.Body.Close() + denied := readBody(t, do(t, ts, h.app, "/orgs/"+org.Slug+"/config", sess)) + if !strings.Contains(denied, `data-testid="config-root-deny-warning"`) { + t.Error("denying root flood should warn what it does to unscoped traffic") + } + // And the label must not claim the wildcard applies "everywhere" — it governs + // only packets that carry no region. + if strings.Contains(denied, "everywhere") { + t.Error(`the root row should not describe the wildcard as "everywhere"`) + } } diff --git a/internal/core/templates/config_region_edit.html b/internal/core/templates/config_region_edit.html index da1d3b8..7a2e0f8 100644 --- a/internal/core/templates/config_region_edit.html +++ b/internal/core/templates/config_region_edit.html @@ -95,7 +95,11 @@