Files
Vito 36564b4767 feat(parse): one generation-parameter parser in Python; scan links what the resolver cannot decide (#253)
* feat(parse): port the browser generation-parameter parser to Python

Adds utils/generation_params.py, a line-for-line port of
extractGenerationParams in web/js/comfy-metadata.js, the parser behind
the gallery, admin and metadata pages. The scan and live monitor can use
it so every surface reads prompts the same way. The JavaScript parser is
unchanged.

The port reproduces the JavaScript value semantics the result depends on
(property order, truthiness, String(), trim(), strict equality, Map keys,
JSON.parse number rounding, and the inputs on which it throws), and runs
its recursive tracing on an explicit stack so crafted graphs cannot
exhaust the Python stack.

Tests:
- behaviour tests for each tracing rule, with JavaScript results as
  expected values, including the visit-limit boundary;
- golden vectors of the JavaScript parser's results for every named case
  and every PNG fixture, so the comparison runs without Node;
- a live comparison against the JavaScript parser when Node is present;
- a randomized differential test over 9,000 generated graphs and
  workflows, coherent and corrupted, including inputs where the
  JavaScript throws.

Five deliberate porting mistakes (trim, truthiness, prepend handling,
visit limit, pair slot) each fail the tests. On a 38,602-file output
folder, all 18,491 files with a workflow give identical results.

* fix(scan): link the traced prompt when the pair resolver cannot decide

The output scan skipped every file the pair resolver called ambiguous or
unresolved, so workflows where several samplers share one prompt (a base
pass, an upscale pass and a detailer) never reached the Library from a
scan. It now links the positive prompt the shared parser traces for
those files, the prompt the inspector and the legacy pages show. Files
the resolver decides are stored as before, and graphs without a
recognized sampler keep the legacy extractor (#252).

Read-only scans of a 38,602-file output folder into temporary databases:
- links: 1,500 before, 7,954 after; none of the 1,500 dropped or changed;
- of the added links that differ from the pre-redesign scan, 1,275
  replace a number, a LoRA tag, a fragment or a truncated prompt that
  scan stored.

* refactor(parse): return a uniform pair from the SameValueZero key
2026-10-19 20:56:51 -07:00
..

Browser media fixtures

tiny.webm is an original, silent, one-second VP8 color test pattern generated for this repository. It contains no user media and is dedicated to the public domain under CC0-1.0.

Reproduce with FFmpeg:

ffmpeg -f lavfi -i testsrc=size=32x32:rate=4:duration=1 \
  -c:v libvpx -pix_fmt yuv420p -an tiny.webm

Browser tests use the committed file; FFmpeg is not required to run them.

Inspection parity fixtures

inspection_parity/ holds small synthetic PNGs (f01b.png ... f24.png, each under 32 KiB) and vectors.json, used by the #240 inspection parity tests. Every graph, prompt text, model name and filename prefix in them is original synthetic content written for this repository. Nothing comes from user output. They are dedicated to the public domain under CC0-1.0.

tests/inspection_parity.py builds every fixture from code. It writes the prompt and workflow records the way core ComfyUI SaveImage does (Pillow PngInfo.add_text, compress_level=4, a 64x64 constant colour image), and splices extra raw tEXt chunks with real CRC32 for the duplicate-chunk shapes f15 and f16. The larger shapes f01, f04 and f05 are built at test time instead of committed. Reproduce the committed files with:

python3 -m tests.inspection_parity --write tests/fixtures/inspection_parity

tests/test_inspection_parity_fixtures.py compares the decoded text chunks with the builders (not bytes, because zlib output differs between platforms).

vectors.json holds an inspection and a default vector for every fixture, committed or built at test time (test-time fixtures are built into a temporary directory). inspection is the workspace inspector path, with the facts the workspace shows. default pins only the resolver's default profile, run on the role records decoded from the PNG text chunks. Ingestion's own readers are covered by their own suites. The expectations start as the observed baseline. A change that alters an outcome edits the vector in the same commit. tests/js/legacy-metadata-characterization.test.js pins what the legacy viewers show on the same files.