Files
ComfyAssets-ComfyUI_PromptM…/tools/vendor
Vito 048d599386 fix(inspect): bound inspection work, not graph size (#244)
* test(inspect): add synthetic inspection parity fixtures and legacy characterization

* test(inspect): pin test-time parity vectors and keep fixtures fully synthetic

* fix(inspect): bound resolver work instead of graph size

* fix(inspect): bound shared-node and stripped-text work in the inspection profile

Keep one memo per resolution whose entries carry their unfolded visit cost;
a memo hit charges that cost to the current candidate's allowance only.
Cache node validation and charge input keys, stripped characters and copied
provenance entries to a whole-resolution work budget before doing the work.
The default profile is unchanged.

* fix(inspect): keep memoized depth honest across inspection candidates

A memo entry now records its height below the reusing depth; a hit raises
depth-limit exactly where a fresh walk would, so each candidate's outcome
matches its anchored result and does not depend on trace or node order.
The default profile is unchanged.

* test(inspect): pin memo height propagation

Three samplers share one chain, each later one hanging below a memo hit.
The third candidate must report depth-limit in both trace orders and when
anchored; removing the memo-hit height propagation fails this test. The
provenance test now asserts a plain subset.

* fix(inspect): tolerate ComfyUI node metadata quirks in projections

Projections now take a kind. Each prompt node keeps exactly class_type and
inputs; _meta, is_changed and other node keys are validated and dropped, so
"is_changed": [NaN] no longer marks the whole prompt graph malformed. A
nonfinite value inside inputs, anywhere in a workflow, or in a retained
carrier member projects to null and is never reported as a number. The
carrier applies the prompt/workflow kinds to its members. Exact numbers are
unchanged (Decimal spelling, unsafe integers as strings) and duplicate keys
are still malformed. The 500-node gate is replaced by a 20,000-node backstop
(workflow count includes subgraph definitions). Raw records are untouched.

The f14 inspection vector's facts become known; default vectors are unchanged.

* fix(inspect): budget metadata per record so large workflows never hide prompts

PNG inspection no longer counts every text chunk against one shared 2 MiB
budget. Role records (prompt, parameters, the pair execution record) keep a
2 MiB budget together, encoded and decoded, and exceeding it still fails the
whole read. A workflow has its own 4 MiB budget: a chunk over it is skipped
by seek, and a compressed one stops inflating at budget + 1. Only the
workflow is then reported as limited (record format "limited", no raw text,
workflow_graph limited); prompts, facts and the prompt graph are unaffected.

Each text chunk's keyword is read first (at most 80 bytes). Chunks that are
not retained are skipped by length without being read or checksummed, so
memory stays bounded. Byte-identical duplicates of a retained record are
accepted and do not consume budget; differing duplicates still raise
"Duplicate prompt metadata", and a duplicate of a limited workflow stays
limited. The chunk-count limit is unchanged.

InspectionRead gains limited_records (empty by default). The reader is only
used by the inspection routes, so ingestion, scan and import are unchanged.

Vectors: f04-inspection (2.5 MB workflow, within the new workflow budget)
and f15-inspection (identical duplicate chunks) now read and resolve, with
the same outcome and facts as f05-inspection. Default vectors are unchanged.

* fix(inspect): keep prompt evidence longest under the response budget

* fix(inspect): bound identical duplicate chunk reads

* fix(inspect): fail closed when role duplicates exceed their budget

* fix(inspect): use the bounded inspection profile end to end

Inspection routes resolve with INSPECTION_PROFILE and expose reason_code
and node on the resolution; scan, live monitor and admin import keep the
default profile (pinned by spies over the real resolver on f03).

JS facts drop the entries and workflow node-count gates; per-lookup visit
sets and the server's node ceiling bound the work. The validator accepts
the textless `limited` workflow format, follows the workflow-first
response omission order, and checks the closed reason-code vocabulary.
The file inspector labels limited records and disables their workflow
download.

vectors.json: 12 inspection vectors gain their reason codes; f03 facts
become known and f01 facts ambiguous. Default vectors are unchanged. A
new parity test asserts vectors.json facts through the workspace JS.

* chore(tools): add read-only inspection corpus tool

tools/inspection_corpus.py runs the inspection route pipeline and the
workspace JS facts of a chosen code tree over a media folder, read-only,
and reports the #240 invariants H1 to H8 with aggregate counts. Rows hold
statuses and SHA-256 digests of resolved role texts, never file names or
prompt text unless --with-paths is given. Outputs inside the root or a code
tree are refused.

The facts-over-vectors test now fails instead of skipping when CI is set
and Node.js is missing.

* docs(testing): document bounded inspection work

* fix(tools): fail the corpus run when facts or inspection did not run

Rows whose facts were never computed (no or exiting Node.js) now fail H3,
and a new harness line fails on any tool exception or missing facts, so a
run where nothing was measured can no longer exit 0. Unreadable files stay
inspector outcomes. A missing --node binary is refused, an exited harness
is reaped, H8 has a 50 ms floor for tiny baselines, and JSONL rows are
sorted by id.

* docs(inspect): correct ceiling wording and bandit annotations

Describe the two 20,000-node ceilings (prompt entries, workflow UI plus
subgraph nodes) in TESTING.md, and use bare nosec ids so Bandit stops
warning about unparsed test names.

* test(inspect): make parity observation tuples explicit
2026-10-19 09:54:29 -07:00
..

Viewer.js maintenance

ComfyUI serves the committed files in web/lib/viewerjs/. Node and npm are only needed by maintainers and CI. Keep upstream files pristine; application behavior belongs in web/js/, and theme overrides belong in comfyui-theme.css.

Install and verify

Use Node 24 or newer. From the repository root:

npm ci --prefix tools/vendor --ignore-scripts
npm run --prefix tools/vendor check
npm run --prefix tools/vendor test
node --test tests/js/*.test.js
npx --prefix tools/vendor playwright install chromium
npm run --prefix tools/vendor test:browser

On Linux, use playwright install --with-deps chromium when browser system libraries are missing. The browser tests use synthetic images and mock the ComfyUI API boundary; they run production viewer methods and the committed Viewer.js JS/CSS, without a running ComfyUI instance.

check is read-only and fails if any JS, CSS, license, or provenance file differs from the installed package. The manifest, lockfile, installed package, and asset version banners must agree. The lockfile records npm's archive integrity; provenance.json records the upstream source, package integrity, and SHA-256 of each copied file. A normal npm ci --ignore-scripts verifies archive integrity.

Full-page workflows, frontend coverage gates, and required merge checks are documented in TESTING.md. The viewerjs CI check runs both the fixture tests above and the real-page workflows on every PR.

Update

npm run --prefix tools/vendor update
# Or select a specific stable version:
npm run --prefix tools/vendor update -- --version 1.15.2

The command installs an exact version with lifecycle scripts disabled and copies dist/viewer.min.js, dist/viewer.min.css, and LICENSE. It writes deterministic provenance with no timestamps. Repeat the checks above and commit the manifest, lockfile, and all vendor files together. To regenerate files from the current pin without changing versions, run npm run --prefix tools/vendor sync.

Automated update PRs

Update vendored Viewer.js checks npm's stable release daily at 07:30 UTC and supports Actions → Update vendored Viewer.js → Run workflow, with an optional version. It tests the generated update before opening deps/viewerjs-X.Y.Z. Existing open or closed PRs for that release are left alone. A failed test does not publish a branch or PR. Changes require review; the workflow never merges or approves PRs.

The organization and repository must enable Actions → General → Workflow permissions → Allow GitHub Actions to create and approve pull requests. Keep default workflow permissions read-only. Only the update job requests contents: write, pull-requests: write, and actions: write.

The workflow uses GITHUB_TOKEN; no personal token is needed. Because bot-token pushes do not normally trigger other workflows, it explicitly dispatches the read-only Viewer.js vendor and compatibility workflow on the update branch. Both workflow files must be merged into the default branch before scheduling or manual dispatch becomes available.

Compatibility checklist

Check gallery grid/list views, navigation across 100-image windows, metadata, slideshow/fullscreen, keyboard navigation, Escape and focus cleanup. Check the admin gallery/filmstrip and tag viewer. On touch devices, test long swipes, short drags, and pinch/rotate gestures. Confirm the ComfyUI theme remains usable.

The gallery keeps its bounded viewer and custom slideshow. Upstream navbar windowing is not a replacement for bounding the supplied image list: native slideshow playback can still preload every supplied original. Review new preloading defaults, gesture behavior, CSS changes, and any adapter use of Viewer.js internal methods before adopting another release.

Shared ComfyAssets test tooling

The exact toolkit commit archive in package.json / package-lock.json supplies host orchestration and coverage helpers. comfyui-host.mjs is PromptManager's configuration adapter; keep reusable lifecycle changes in the toolkit source. The existing npm scripts remain the public maintainer entry points. See TESTING.md for the managed real-host matrix and update policy.

Shared ComfyAssets browser controls

Prompt Manager (Classic) consumes the same pinned toolkit's browser controls. The node identifier remains PromptManager; existing workflows, sockets, and immediate result selection are preserved. PromptManager Text is unchanged.

Committed assets in web/js/shared/toolkit/ work without npm or KikoTools installed. Maintain common controls in ComfyAssets Toolkit, then update the exact archive pin and lockfile here. Regenerate using npm run --prefix tools/vendor sync:toolkit; npm run --prefix tools/vendor check verifies both Viewer.js and the toolkit without rewriting files. The toolkit distribution includes its license, source history, archive integrity and per-file hashes. Do not edit its copied files directly. Classic's controller and layout remain in web/js/classic-node.js and web/js/classic-node.css.

Run the frontend coverage/browser suites and managed Classic/Nodes 2.0 matrix after updates. Shared modules participate in the frontend coverage gate. Pixaroma's reusable framework inspired this architecture; no Pixaroma code, styles or assets are included.