Skip to content

feat(website): Virtual try-on app (mocked) - #20870

Open
mariana953 wants to merge 10 commits into
mariana/editor-kitfrom
mariana/app-virtual-try-on
Open

mariana953 wants to merge 10 commits into
mariana/editor-kitfrom
mariana/app-virtual-try-on

Conversation

@mariana953

@mariana953 mariana953 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the Virtual try-on Workshop app at /hub/apps/virtual-try-on/. It works like the reference Virtual try-on app (Person and Garment images, Fit Slim/Regular/Relaxed, seed, Result and Compare views, run label "Try it on"), in the same full-screen editor as Relight and Move anything. The backend is mocked. Built on the shared editor kit (#20630), with no dependency on Relight or Move anything. Replaces #19824. Its Hub card copy now sits in the locale files like the other apps, and its copy helper no longer needs the removed i18n/interpolate.

Changes

  • What:
    • Opens with an example ready to run. The person photo is in the middle of the canvas. The garment is a small floating card on the photo, with Replace and Remove. When it is empty it becomes a drop card.
    • Floating left panel, with the same fields as the reference app:
      • Person row, with Change
      • Garment: 3 example product photos as tiles, plus any upload
      • Fit: a segmented row (Slim / Regular / Relaxed, default Regular)
      • Seed: a row with a shuffle button
    • The bottom composer (?ux=e) has Garment, Fit and Seed chips that open trays. On phones the panel becomes a bottom sheet with a summary row and the run button.
    • Result view by default. Compare is the shared kit EditorCompareToggle in the pill, and it shows EditorCompare (a draggable before/after line, labelled Original and Result). The pill also has Edit and Try again. Download is in the header.
    • Undo and redo cover garment, fit and seed changes. They sit at the right end of the pill.
    • Shared kit adopted (from feat(website): shared full-screen editor pieces for the Workshop apps #20630): drops use EditorDropZone, paste uses useImagePaste, every file button uses EditorUploadSlot, the garment grid uses EditorTiles with aspect="square", and the run uses EditorRun's progress and missing. Removed this branch's EditorFileButton and square prop on EditorTiles (both now in the kit), VirtualTryOnDropZone and image-transfer.ts.
  • Removed (no backend meaning):
    • The dashed "Fit guide" outline and its pill tool. It drew a made-up garment outline that the real backend never makes.
    • The drawn silhouette fit tiles. Fit is now a plain segmented control, as in the reference app.
  • Added:
    • Drag and drop onto every input slot:
      • a person photo on the stage photo or on the Person row;
      • a garment on the garment card or on the Garment picker.
      • Each slot shows a highlight while a file is held over it.
    • Paste an image from the clipboard to set the garment. This works anywhere on the page, except while a run is in progress.
    • A missing-input message on the run button: "Upload a garment" (it says this in place of its label and credits, and is disabled).
    • Run progress: "Queued…", then "Trying it on · N%", with elapsed time, garment, fit and Cancel; the run button shows the same progress.
    • The download file is named try-on-<person file name>.
  • Staff flag: workshop-virtual-try-on-app-enabled (PostHog), listed in workshop-model-availability.json.

Backend contract

apps/website/src/lib/workshop/virtual-try-on/contract.ts. It maps 1:1 to POST /api/run/virtual-try-on, a multipart form:

interface TryOnRequest {
  person: string   // image (multipart key `person`); the page holds a URL and sends the bytes
  garment: string  // image (multipart key `garment`); garment alone, flat lay or product shot
  fit: 'slim' | 'regular' | 'relaxed'   // default 'regular'
  seed: number
}
interface TryOnResult { url: string; seed: number }

There are no extension fields. Every field the page sends is a reference-app field.

The mock is runTryOn in mock-run.ts. It waits 2.4 s. mockProgress reports { kind: 'queued' } for the first 0.4 s, then { kind: 'running', percent } (the kit's RunProgress, via clockProgress). The real job reports the same two stages. When the mock answers:

  • For the example person in one of the three example garments, it returns that garment's example photo (public/images/apps/virtual-try-on/result-{breton,flannel,knit}.jpg).
  • For anything else, it draws the garment's cloth over the torso on a canvas. The shape gets wider from Slim to Relaxed. If drawing fails, it returns the person photo.

To connect the backend, replace runTryOn with the real job call. The page already uses the request and result shapes above.

Review Focus

  • Example assets: the person is a crop of the existing site still cinematic-studio/options/shot-medium.jpg. The garments are real product photos, and each one has an example result photo.
  • Tests:
    • Unit tests:
      • geometry, compositing and the mock run
      • mockProgress, as a table
      • the composable: missing input, and non-image files are ignored
    • Component tests:
      • a panel run with progress, then Result, then the Compare toggle
      • paste, and drops on the picker and on the card (one table)
      • person drops on the stage and on the Person row
      • the missing-garment label
      • the composer tray and the phone sheet
    • Playwright tests in e2e/workshop-apps.spec.ts:
      • flag off
      • a panel run with keyboard compare, then an uploaded garment
      • a garment dropped on the picker and a pasted garment, with the missing-input label
      • the phone sheet with no horizontal overflow
    • imageFileOf, the drop and paste reader, is now tested in the kit.
  • Shared with the other app PRs. The app registers itself in the kit's EDITOR_APPS list on the studio page (one entry), and its copy goes through lib/workshop/app-copy.ts. Shared helpers (app-copy.ts, and where used load-image.ts, nudge.ts, useSnapshotHistory.ts) are identical in every app PR, so they merge cleanly whichever lands first.

Screenshots (if applicable)

These were checked locally: desktop 1440 with the example, run progress, Result, Compare, the missing-garment state, layout E, and phone 390 (sheet and result).


Generated by Claude Code

@mariana953
mariana953 requested review from a team and dante01yoon as code owners October 12, 2026 21:06
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 45b3fbde-0c81-4e7e-9bee-82c840da492b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size

⏳ Size data collection in progress…

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

This candidate changes nothing the matrix measures, so every expensive stage was skipped.

Reproduce locally
# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
  npx vitest run --config vitest.matrix.config.mts

Full docs: scripts/registry-census/README.md

🌾 Fallow: ✅ Passed

Fallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened.

No new findings in the changed files.

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since fa6d451f5d507b9e31956425e939e0ee8d12cd1d

Full docs: ADR-DEVEX-LINT-0015

🌐 Website E2E

Tip

All tests passed.

Status ✅ Passed
Report View Report

🔗 Website Preview

Website Preview: https://comfy-website-preview-pr-20870.vercel.app

Models is built and gated by PostHog (workshop-enabled), using staging Cloud.

This commit: https://website-frontend-p4mblf943-comfyui.vercel.app

Last updated: 2026-10-14T01:19:50Z for df28e1a

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.63446% with 78 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...te/src/lib/workshop/virtual-try-on/render-image.ts 8.16% 45 Missing ⚠️
apps/website/src/composables/useVirtualTryOn.ts 81.92% 5 Missing and 10 partials ⚠️
apps/website/src/lib/workshop/load-image.ts 0.00% 6 Missing ⚠️
...nts/workshop/virtual-try-on/VirtualTryOnStudio.vue 88.88% 2 Missing and 1 partial ⚠️
...ts/workshop/virtual-try-on/VirtualTryOnSummary.vue 60.00% 0 Missing and 2 partials ⚠️
apps/website/src/composables/useSnapshotHistory.ts 92.59% 0 Missing and 2 partials ⚠️
...nents/workshop/virtual-try-on/VirtualTryOnMain.vue 85.71% 0 Missing and 1 partial ⚠️
.../workshop/virtual-try-on/VirtualTryOnWorkspace.vue 94.11% 0 Missing and 1 partial ⚠️
...src/components/workshop/virtual-try-on/sections.ts 87.50% 0 Missing and 1 partial ⚠️
apps/website/src/lib/workshop/app-copy.ts 75.00% 0 Missing and 1 partial ⚠️
... and 1 more

❌ Your patch check has failed because the patch coverage (79.63%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

@@                  Coverage Diff                  @@
##             mariana/editor-kit   #20870   +/-   ##
=====================================================
  Coverage                      ?   85.79%           
=====================================================
  Files                         ?     3579           
  Lines                         ?   169425           
  Branches                      ?    46414           
=====================================================
  Hits                          ?   145359           
  Misses                        ?    22152           
  Partials                      ?     1914           
Flag Coverage Δ
website-unit 80.62% <79.63%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ebsite/src/components/workshop/ModelsCatalogue.vue 100.00% <100.00%> (ø)
.../workshop/cinematic-studio/CinematicStudioPage.vue 91.46% <100.00%> (ø)
...s/workshop/virtual-try-on/VirtualTryOnComposer.vue 100.00% <100.00%> (ø)
...ents/workshop/virtual-try-on/VirtualTryOnDocks.vue 100.00% <100.00%> (ø)
...onents/workshop/virtual-try-on/VirtualTryOnFit.vue 100.00% <100.00%> (ø)
...orkshop/virtual-try-on/VirtualTryOnGarmentCard.vue 100.00% <100.00%> (ø)
...rkshop/virtual-try-on/VirtualTryOnGarmentEmpty.vue 100.00% <100.00%> (ø)
...s/workshop/virtual-try-on/VirtualTryOnGarments.vue 100.00% <100.00%> (ø)
...ts/workshop/virtual-try-on/VirtualTryOnHistory.vue 100.00% <100.00%> (ø)
...ents/workshop/virtual-try-on/VirtualTryOnPanel.vue 100.00% <100.00%> (ø)
... and 27 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Oct 12, 2026

@dante01yoon dante01yoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Dropping the made-up fit guide was the right call, and undo covering garment/fit/seed through useSnapshotHistory is clean. Requesting changes for the copy approach (shared with the sibling app PRs) and internal comments.

Size. This PR is about 2,700 lines (excluding binaries). That is far past the ~300-line guideline and hard to review well in one pass. Could you split it, e.g. (1) wiring: catalogue, routes, flag, Hub card; (2) pure lib/ logic with its tests; (3) components and e2e?

Stacking. Base is mariana/editor-kit (#20630), which is still open with changes requested. Every app PR edits the same shared lists (routes.ts, apps.ts, catalogue-apps.ts, CinematicStudioPage.vue, schema enums, locales, vercel.json), so they will conflict with each other as they land. The identical helpers (app-copy.ts, load-image.ts, useSnapshotHistory.ts, nudge.ts) would be better landed once in #20630 than duplicated in every app branch. This PR also adds animate-editor-shimmer to global.css. If it's a kit animation, it belongs in #20630.

Checks: CI is green; I didn't run tests locally.

named: CopyValues = {}
): string {
const [one, many = one] = (entry[locale] ?? entry.en).split(' | ')
return (named.n === 1 ? one : many).replace(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: appCopy fills placeholders with .replace and parses | plurals by hand, and the app's strings live in a TS copy.ts instead of src/locales/<locale>/main.json. apps/website/AGENTS.md says copy goes in main.json and is read with translationsFor(locale).t, and to "never fill a placeholder with .replace". Doing it this way also skips the catalog test that compiles each message and checks zh-CN coverage. It also treats a literal {word} the visitor types (a star name, a light name) as a placeholder whenever named has that key.

Could the app's strings move under a namespaced key in main.json (moveAnything.*, relight.*, …) and be read through t(key, named, { locale })? If keeping them out of the site-wide bundle is the real goal (as for catalogue-apps.ts), please get that exception agreed on #20630 first, where all seven apps can share it, without hand-rolled interpolation.

}

/**
* Call before a change the visitor can undo. Changes that share a `key`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this PR adds comments to internal, non-exported code, like this one and the others on inner functions of this composable. The repo rule only allows a short JSDoc on exported API. Please drop the internal ones and let the names carry the meaning. (This JSDoc also says "Call before a change", but change is the change.)


export const DEFAULT_FIT: TryOnFit = 'regular'

export interface TryOnRequest {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: TryOnRequest is a hand-written request/response contract for a backend that doesn't exist yet. Is there a tracking issue for the endpoint? Once it ships in the OpenAPI spec, these types should be imported from @comfyorg/ingest-types rather than kept by hand. Could you link the issue here (or in the PR body) so the swap isn't forgotten?

This branch was previously deployed

1 inactive deployment
website-approval — df28e1a6 Deployed Oct 14, 2026 by mariana953 via fast-lane #1929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants