fix(scan): leave the browser-parser NaN parse to the resolver parity fix

The scan fallback's legacy-page parse (parse_page_json in _graph_prompt_text)
is owned by the resolver parity change, which adds the same helper with the
legacy pages' exact rule (NaN reads as null, Infinity still rejected). This
branch keeps only the strict serialization of stored and answered JSON.
This commit is contained in:
Vito Sansevero
2026-10-23 04:24:00 -07:00
parent 58a4026a99
commit b5cb591bb0
4 changed files with 10 additions and 54 deletions
-24
View File
@@ -28,7 +28,6 @@ __all__ = [
"extract_generation_params",
"extract_from_records",
"parse_js_json",
"parse_page_json",
]
PLACEHOLDERS = MappingProxyType(
@@ -954,29 +953,6 @@ def parse_js_json(text):
return None
def _null_constant(_name):
return None
def parse_page_json(text):
"""A metadata record as the legacy pages parse it, or None where they fail.
The gallery, admin and metadata pages replace ComfyUI's ``NaN`` with
``null`` before ``JSON.parse``. Here every non-finite literal ComfyUI
writes (``NaN``, ``Infinity``, ``-Infinity``) is null, and only where it is
a number: unlike the pages' text replacement, a prompt that spells "NaN"
keeps its text.
"""
if not isinstance(text, str):
return None
try:
return json.loads(
text, parse_constant=_null_constant, parse_int=_double_integer
)
except (ValueError, RecursionError):
return None
def extract_from_records(prompt_text, workflow_text):
"""``extract_generation_params`` for raw ``prompt``/``workflow`` record text.