Repository navigation
feat(website): Hand product swap app (mocked) - #20865
mariana953 wants to merge 12 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
📦 Bundle Size
🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight 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: ✅ PassedFallow 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 E2ETip All tests passed.
🔗 Website PreviewWebsite Preview: https://comfy-website-preview-pr-20865.vercel.app Models is built and gated by PostHog (workshop-enabled), using staging Cloud. This commit: https://website-frontend-f8ry2ghl9-comfyui.vercel.app Last updated: 2026-10-14T01:10:07Z for |
# Conflicts: # apps/website/src/components/workshop/cinematic-studio/CinematicStudioPage.vue
…/app-hand-product-swap
…oto with undo, and starts from an example card
…/app-hand-product-swap
…rops panel dividers
…/app-hand-product-swap
…/app-hand-product-swap
dante01yoon
left a comment
There was a problem hiding this comment.
Thanks. Removing the placement box that mapped to nothing was the right call, and the request shape is simple. Requesting changes for the copy approach (shared with the sibling app PRs) and internal comments.
Size. This PR is about 2,650 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.
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( |
There was a problem hiding this comment.
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.
| }) | ||
| } | ||
|
|
||
| /** A pasted image is the hand photo until there is one, then the product. */ |
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| /** Swaps the present without a new step, for the moves of one drag. */ | ||
| export function replace<T>(history: History<T>, present: T): History<T> { |
There was a problem hiding this comment.
suggestion: checkpoint/replace only existed for the placement-box drag, which this PR removes. They're now exercised only by history.test.ts. This file is also a third undo implementation next to useSnapshotHistory (in the sibling PRs). Could the composable use useSnapshotHistory and drop history.ts and its test?
| reset({ url, name, width, height }) | ||
| } | ||
|
|
||
| async function decode(file: File): Promise<SwapImage | undefined> { |
There was a problem hiding this comment.
suggestion: decode shares one pendingUrl between hand and product uploads. Dropping a hand photo and then quickly a product (or pasting twice) makes the first decode fail the pendingUrl !== url check, so that upload is silently dropped. Per-slot pending tokens would avoid it. (PLAUSIBLE)
| * the hand holds by itself and keeps the same hand and grip, so there is no | ||
| * placement to send. | ||
| */ | ||
| export interface HandSwapRequest { |
There was a problem hiding this comment.
question: HandSwapRequest 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?
Summary
New Workshop app at
/hub/apps/hand-product-swap/: drop a photo of a hand holding something, pick a product, and get the same hand and grip holding the new product. It works like the reference Hand product swap app (inputs Hand + Product, Resolution 1K/2K/4K with 2K as default, seed, Result/Compare views, run label "Swap product"), inside the shared full-screen editor. The backend is mocked. Built on the shared editor kit (#20630), with no dependency on Relight or Move anything. Replaces #19820. The image loader is nowlib/workshop/load-image.tsand the box type lives inplacement.ts, so nothing is borrowed from another app.Changes
EditorCompareTogglein the pill turns on Compare (the before/after split line throughEditorResult/EditorCompare). The pill also has Edit and Try again. Download is in the header, right of GitHub.hub-app-names.json,routes.ts,apps.ts,CinematicStudioPage, availability,vercel.json, en + zh-CN copy inlib/workshop/hand-product-swap/copy.ts. Staff flag:workshop-hand-product-swap-app-enabled.hand.jpg,product-{can,serum,tube}.jpg,result-{can,serum,tube}.jpg.EditorTiles(4 square columns, custom white-backed tiles, trailing upload tile); the hand row's Change, the product card and the upload tile useEditorUploadSlot; the stage drop usesEditorDropZone(now with the hover highlight); paste usesuseImagePaste; the run button shows the job's progress (Queued, then the percent) throughEditorRun'sprogress. Removed the localHandSwapUpload,HandSwapProductTileandfiles.ts(firstImage).<hand photo name>-swapped-<seed>.<result type>, for examplehand-holding-can-swapped-42.jpg.Backend contract
HandSwapRequestinapps/website/src/lib/workshop/hand-product-swap/contract.tsmaps 1:1 to the multipart fields ofPOST /api/run/hand-product-swap:No extension fields. Credits shown: 14 / 14 / 25.
Mock:
runHandSwap(mock-run.ts) reports queued for 0.4 s, then a climbing percent for 2 s. For the example hand with one of the three example products it answers with that product's example photo. Anything else is composited on a canvas: white backdrops keyed out, then drawn at the example's known grip or a guessed centred grip. That guess is internal to the mock and is not sent.Review Focus
placement.ts(gripRect) is now used only by the mock's canvas drawing.useHandProductSwap.ts: one phase union (editing | running{progress} | done | failed). A dropped or pasted image is ignored while a run is going. A new product arriving over a result goes back to editing.EditorCompareToggle,EditorResult,EditorOutput,EditorSeedField,EditorPanelRow,EditorTiles,EditorUploadSlot,EditorDropZone,useImagePasteandEditorRunprogress. No kit files change in this PR.EDITOR_APPSlist on the studio page (one entry), and its copy goes throughlib/workshop/app-copy.ts. Shared helpers (app-copy.ts, and where usedload-image.ts,nudge.ts,useSnapshotHistory.ts) are identical in every app PR, so they merge cleanly whichever lands first.Screenshots (if applicable)
Desktop 1440 with the example, running at 40%, Result and Compare, layout E, and phone 390 (sheet, result, layout E) were reviewed locally. The phone has no horizontal overflow.
Generated by Claude Code