From 4f75f57177bc423e5aaeed0350386cd1edfbe3b5 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 5 Aug 2026 19:37:53 +0300 Subject: [PATCH] test(deploy): preserve empty Foundry map filters --- .../build-module-foundry-filter-toggle-artifact.mjs | 8 +++++--- .../test_module_foundry_filter_toggle_artifact.py | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/infra/deploy-runner/build-module-foundry-filter-toggle-artifact.mjs b/infra/deploy-runner/build-module-foundry-filter-toggle-artifact.mjs index 7dcac0a..bf4f8fd 100644 --- a/infra/deploy-runner/build-module-foundry-filter-toggle-artifact.mjs +++ b/infra/deploy-runner/build-module-foundry-filter-toggle-artifact.mjs @@ -64,8 +64,8 @@ async function assertFilterToggleBoundary() { const helper = await readFile(resolve(foundryRoot, files[1]), "utf8"); for (const marker of [ "toggleMapPresentationFacetSelection", - "const { [field]: _removed, ...unconstrained } = facets", - "return unconstrained", + "const { [field]: _removed, ...remaining } = facets", + "return { [field]: [] }", ]) { if (!helper.includes(marker)) throw new Error(`foundry_filter_toggle_helper_missing:${marker}`); } @@ -77,7 +77,9 @@ async function assertFilterToggleBoundary() { const test = await readFile(resolve(foundryRoot, files[2]), "utf8"); for (const marker of [ - "interactive deselect of the last chip removes the facet constraint", + "interactive deselect of the last chip preserves the zero-match state", + "the first chip selected after a saved empty view removes every empty sentinel", + "a complete interactive toggle cycle returns to zero matches instead of all", "interactive deselect preserves other values and facet constraints", "deselecting the last chip remains empty and never normalizes to all", ]) { diff --git a/infra/deploy-runner/test_module_foundry_filter_toggle_artifact.py b/infra/deploy-runner/test_module_foundry_filter_toggle_artifact.py index 7e865d1..b59094f 100644 --- a/infra/deploy-runner/test_module_foundry_filter_toggle_artifact.py +++ b/infra/deploy-runner/test_module_foundry_filter_toggle_artifact.py @@ -75,9 +75,10 @@ class ModuleFoundryFilterToggleArtifactTest(unittest.TestCase): preview = (payload / EXPECTED_FILES[0]).read_text(encoding="utf-8") regression = (payload / EXPECTED_FILES[2]).read_text(encoding="utf-8") self.assertIn("toggleMapPresentationFacetSelection", helper) - self.assertIn("return unconstrained", helper) + self.assertIn("return { [field]: [] }", helper) self.assertIn("filters: toggleMapPresentationFacetSelection(filters, field, value)", preview) - self.assertIn("interactive deselect of the last chip removes the facet constraint", regression) + self.assertIn("interactive deselect of the last chip preserves the zero-match state", regression) + self.assertIn("a complete interactive toggle cycle returns to zero matches instead of all", regression) with tarfile.open(first_artifact, "r:gz") as archive: members = archive.getmembers()