Coalesce empty query params to None in /node_startup_errors route

?source= or ?module_name= or ?pack_id= (param present but blank) would have returned {} because the helper treated the empty string as an exact-match filter. Coalesce to None at the route boundary so a present-but-blank query param behaves the same as the param being absent. The helper's own behaviour is unchanged and locked in by a new assertion.

Amp-Thread-ID: https://ampcode.com/threads/T-019e86fd-b68f-74de-8c91-d2662377424a
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Jedrzej Kosinski
2026-06-01 23:39:20 -07:00
parent 4eef53041e
commit 1339cb570d
2 changed files with 11 additions and 3 deletions

View File

@@ -218,6 +218,11 @@ def test_filter_node_startup_errors_source_filter():
assert set(grouped["comfy_extras"]) == {"B"}
# Non-matching source filter returns an empty dict, not an error.
assert nodes.filter_node_startup_errors(source="nope") == {}
# An explicit empty-string filter is treated as a real value (matches
# entries whose source is literally ""), NOT silently as "no filter".
# The HTTP route layer is responsible for coalescing `?source=` to None
# before calling this helper; this assertion locks that contract in.
assert nodes.filter_node_startup_errors(source="") == {}
def test_filter_node_startup_errors_module_name_filter():