Files
Vito a6f6697c50 feat(activity): shared job registry, Activity page and Scan for metadata (#269)
* feat(activity): shared session job registry with the scan as its first kind

The output scan now runs as the first kind of an in-memory JobRegistry
(py/api/jobs.py, replacing py/api/scan_job.py). Each job keeps exact
counters, at most 200 outcome rows per group and a log capped at 2,000
lines, with root-relative paths and public root labels only. New routes
list, inspect, follow (SSE) and cancel jobs and start the scan
(POST /prompt_manager/jobs/scan, 409 busy while another record-changing
job runs). The legacy /prompt_manager/scan routes attach to the same job
and stream unchanged payloads.

* feat(activity): concept Activity page, top-bar button and progress pill

The workspace gains the concept's Activity page (renderActivity), its
top-bar button and sidebar row, fed by one session job store: a /jobs
read, one SSE stream per running job, a 1-30 s capped backoff after a
dropped stream and a 15 s list poll while visible. A job the server no
longer lists shows as ended, so no pill stays stuck after a restart.

D52: the counts show running jobs and hide at 0; the phone top-bar row
may wrap. D53: the mockup's progress pill links the running job. D54:
real job items with state chips, detail lines and Cancel job. Start and
finish toasts follow the spec copy. Fake browser jobs come from
tests/browser/workspace_activity_fixture.py.

* feat(activity): Scan for metadata with its review dialog and job view

Images -> Import keeps Rescan and adds the concept's "Review scan" row as
"Scan for metadata". It opens the concept's "Review metadata scan" with the
real source count, the fixed "All files" scope, a backup box that downloads
the existing database backup, and Cancel / Start scan. Start scan starts the
session scan job and opens its view; a start refused by another
record-changing job toasts its title as a link.

#/activity/<id> is now the approved job-view mockup: the heading with
Download report (disabled until Activity-2) and Cancel scan, the Progress
surface with the five counter tiles, the Results surface with the outcome
list, path filter and capped rows (Added and Already known open the viewer
through the listing identity), and the collapsed Scan log. Activity item
titles link their views. The scan's progress line groups thousands.

Deviations D55-D57 are recorded in TESTING.md.

* fix(activity): stop the job store on pagehide and let proxied routes outlive teardown

CI's touch coverage run failed "a resolver failure for the ComfyUI link never
stops the shell from mounting" with "route.fulfill: Fetch response has been
disposed": its trace shows two Library thumbnail requests started by the last
route still in the spec's proxy-mount handler while the page fixture was torn
down.

- The proxy-mount handler ignores only that teardown error, and the workspace
  and Activity specs unroute with ignoreErrors before teardown.
- The Activity store now ends its work on pagehide: the poll and backoff timers
  stop, the job streams close and a list read in flight is aborted (an older
  read is also aborted when a newer one starts). A pageshow from the
  back-forward cache reads the list again.

* test(activity): compare the job view log's line height to the hundredth of a pixel

WebKit reports the mockup's 11px/1.7 line height as 18.700001px, so the job view comparison failed on WebKit only. The measurement now rounds it, as other engine-dependent values are normalized.

* fix(activity): final review round for the job store, job view and scan rows

- Store: one failed list read no longer marks running jobs as ended; two in
  a row, or a good list without them, do (M1). A good read resets the
  backoff, except for a stream that keeps dropping while the list reads fine
  (M2). Finished jobs the server pruned are dropped (M3). Numbers group as
  en-US, like the server's lines (M13).
- Job view: a job the store's list no longer has shows the not-found state
  (M3). Focus moves to the job heading when Cancel scan goes away, and to the
  item's title link in the list (M4). The detail is read only when its listed
  rows change or the open log grows, using the summary's new listed and
  log_length (M12).
- Viewer rows open by exact identity: each scan row records its root's
  listing index, the source must still carry the row's label, and the
  workspace listing gains an exact `path` filter (M8, M9).
- Scan rows name the prompt by its Library title, stored title first (M10).
- A toast with a link stays 20 s, and any toast stays while hovered or
  focused (M14).
- A real two-batch scan cancelled after batch 1 keeps partial counts (M7).
- TESTING.md: D54, D56 and D57 updated (M5, M6).

* test(activity): cover the held and linked toast and a job view pruned by the server

Unit tests for the toast's 6.5 s and 20 s timeouts and its hover and focus hold, and a browser test for a finished job's open view after the server stops listing it. Coverage floors are only raised.
2026-10-21 14:22:30 -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.