Repository navigation
feat(website): Background Removal app (mocked) - #20869
mariana953 wants to merge 14 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-20869.vercel.app Models is built and gated by PostHog (workshop-enabled), using staging Cloud. This commit: https://website-frontend-bxeemw2f3-comfyui.vercel.app Last updated: 2026-10-14T00:50:09Z for |
# Conflicts: # apps/website/src/components/workshop/cinematic-studio/CinematicStudioPage.vue
…/app-background-removal
…with undo, and starts from an example card
…/app-background-removal
…drops panel dividers
…/app-background-removal
…/app-background-removal
… its panel with format and seed side by side
…/app-background-removal
dante01yoon
left a comment
There was a problem hiding this comment.
Thanks. useEditorImage and mockRenderJob are nice extractions, and the mode-specific request union is clear. Requesting changes for the copy approach (shared with the sibling app PRs) and hex colours in a component.
Size. This PR is about 3,350 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 changes kit files (EditorCompare, EditorResult, EditorBusy, mock-job.ts). Those changes belong in #20630, so sibling apps aren't built on a different kit.
Unanchored suggestion: useEditorImage is a good shared helper, but only this app uses it while the other six re-implement the same image/removed/ownUrl/pending logic. Moving it into the kit would remove that duplication.
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.
| :aria-label="brc('cutout.swatch.custom', locale)" | ||
| :title="brc('cutout.swatch.custom', locale)" | ||
| :class="swatchClass(!selected)" | ||
| class="grid place-items-center bg-[conic-gradient(#f87171,#facc15,#4ade80,#22d3ee,#818cf8,#e879f9,#f87171)]" |
There was a problem hiding this comment.
issue: apps/website/AGENTS.md: "Use a token; never write a hex value into a component." The rainbow conic-gradient(#f87171,…) here and the #7a9cc6 default on line 27 are hard-coded colours in a component. Could the gradient become a utility/token in src/styles/global.css, and the default custom colour live with the swatch data in lib/?
| update({ adjust: { ...history.state.value.adjust, ...patch } }, key) | ||
| } | ||
|
|
||
| function setReference(file: File | undefined) { |
There was a problem hiding this comment.
nit-pick (non-blocking): each reference pick creates an object URL that is only released on the next photo or on unmount. Swapping references repeatedly accumulates them. That's acceptable while undo can return to them, but worth knowing.
| } | ||
|
|
||
| /** What a Background Removal backend receives for one run. */ | ||
| export type CutoutRequest = CutoutRequestBase & |
There was a problem hiding this comment.
question: CutoutRequest 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
Workshop app at
/hub/apps/background-removal/. It does what JP Costa's Background Removal does (input image → cut-out, background and format applied client-side, Result / Compare views, no seed), with our editor kit. On top of that it adds Mar's Remove | Replace | Adjust redesign. The backend is mocked. Built on the shared editor kit (#20630), with no dependency on Relight or Move anything. Replaces #19823. The image loader is nowlib/workshop/load-image.ts, so nothing is borrowed from another app. On top of the kit it adds acheckeroption toEditorCompareandEditorResult(withEditorChecker), a slot inEditorBusy, andmockRenderJobinmock-job.ts.Changes
EditorColorPickerinEditorPopover, moved from Cinematic Studio in feat(website): shared full-screen editor pieces for the Workshop apps #20630). The selected swatch gets a white ring. The result composites the cut-out over the colour; Transparent keeps the alpha and shows a checkerboard.EditorOutput/CinematicMenu, with a chip icon. Below it, a prompt box with an optional reference-image + slot at its top-left (pick or drop an image) and a×1count. Seed is a direct panel row, shown only in Replace. Until a description or a reference is given, the run button is disabled and says "Add a prompt or reference" in place of its label and credits, short enough to show whole in the 280px panel; its tooltip has the full sentence, "Describe a background or add a reference image." (throughEditorRun'smissingHint, from feat(website): shared full-screen editor pieces for the Workshop apps #20630). The message shows only on the run button, not under the prompt. The ∞ toggle from the reference is left out because nothing real backs it.EditorSliders: Blur 0, Grayscale 0, Sepia 0, Brightness 100, Contrast 100, Saturation 100. The values apply live on the canvas as CSS filters on the chosen layer (the photo, plus the subject masked over it). They are sent in the request. A blurred background is scaled up slightly so its edge doesn't fade in from the frame.<name>-cutout|new-background|adjusted.<format>.?ux=e): the Background chip opens a tray with the mode switch and the active mode's controls (plus Seed in Replace). Format stays a composer pill. Phone: a sheet with a summary row, and the same section when expanded; the review menu's…button no longer covers the last swatch (it sits in the header on phones, from feat(website): shared full-screen editor pieces for the Workshop apps #20630).plant.jpg(1200×896, JPEG q82), the prepared cut-outplant-cutout.webp(WebP with alpha, 42 KB vs 376 KB as PNG), and the prepared Replace resultplant-replaced.jpg. The cut-out's alpha is the example's matte for Remove, Adjust and the live previews. Replace on the example (without a reference) returns the prepared photo. Uploads fall back to the canvas mock: an oval matte, with a reference image or a warm gradient behind it for Replace.example.jpgandexample-mask.png. The hub thumbnail (workshop-display.json) now usesplant.jpg.EditorDropZone(with the hover highlight), paste usesuseImagePaste, the reference + slot usesEditorUploadSlot, and the run usesEditorRun'sprogress(read off the mock's clock withclockProgress,CUTOUT_RUN_MS),missingandmissingHint. The local drop, paste and file-input code is removed.Backend contract (
lib/workshop/background-removal/contract.ts). JP's/api/run/background-removaltakes onlyimage(multipart). JP applies background and format client-side, and so does our mock (render-cutout.ts). Everything beyondimageis sent so a backend can do it server-side, and fields marked extension are Mar's additions that JP's backend does not support yet.The job reports no progress; the button's percent is an estimate from the elapsed time. To connect a real backend, replace
runCutoutinmock-run.ts. The page only needs the same shapes.Staff flag:
workshop-background-removal-app-enabled(PostHog).Review Focus
countis fixed at 1 and shown as×1. A real count needs a multi-result view.EditorCompare,EditorHint,EditorResult).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)
Taken locally: desktop 1440 (Remove with the example, custom colour picker, Remove result and Compare, Replace and its result, Adjust live), layout E tray, and phone 390 (sheet, expanded settings with the
…button clear of the swatches, Replace, running).Generated by Claude Code