Skip to content

feat(website): Relight app, place new lights on a photo and relight it - #20860

Open
mariana953 wants to merge 18 commits into
mariana/editor-kitfrom
mariana/app-relight
Open

mariana953 wants to merge 18 commits into
mariana/editor-kitfrom
mariana/app-relight

Conversation

@mariana953

@mariana953 mariana953 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Relight as a Workshop app at /hub/apps/relight/, built on the shared editor kit (#20630): place point and directional lights on a photo, watch them shade it live, and get a result rendered from those lights. Mocked until the backend exists. Replaces #19760, and no longer depends on Move anything; the other image apps no longer depend on Relight.

Changes

  • What:
    • Layout. The kit's floating panel (Mood, Lights, Shadows, Scene, Masks, Generation, Seed, run) with the control pill: Add light, Compare, handles, Light only, light map, undo, redo. Phones get a bottom sheet with "Sunset · 2 lights · Long". ?ux=e keeps the bottom composer for review.
    • Lights. Up to four, as rows: select, hide, duplicate, delete. Directional lights get a direction dial with presets and an Elevation slider; colour, intensity, softness, shadows per light. Handles on the photo can be dragged or nudged.
    • Live preview. A WebGL shader relights the photo per pixel; Compare splits original and relit; Light only shows just the added light.
    • Light map. A corner card with top and side views; dragging a dot turns or raises a light. It moves to a corner with no light under it, and folds to a chip on phones.
    • Moods and shadows. Mood tiles relit by the same shader; None / Soft / Hard / Long shadow tiles.
    • Mock. runRelight answers after a short wait with the example's relit image or a render of the visitor's photo.
    • Wiring. Catalogue, routes, hub names, Hub card with its cover, redirects. Gated by workshop-relight-app-enabled.
    • Shared helper. lib/workshop/nudge.ts (arrow-key nudging) is added here as in Move anything (feat(website): Move anything app, an image editor with a floating side panel #20854), identical, so whichever lands first carries it.
    • Tests. Unit tests for shading, dial, light map geometry, map corner, shadows, mock run and the composable; component tests for the panel, light rows, Compare, Light only and the light map; E2E for the panel, map, zoom, phone sheet and hidden site header.
  • Dependencies: feat(website): shared full-screen editor pieces for the Workshop apps #20630 (editor kit)

Review Focus

  • Backend contract. runRelight(request, signal) resolves { url, seed }. The request holds imageUrl, lights[] (kind, position as image fractions, colour, intensity, softness, direction, elevation, shadows, visible, mask), masks[], scene and generation.
  • Preview is an approximation. Normals come from the photo's brightness and sharpness, not depth.
  • Shared files. Editor kit pieces are untouched. Like every app it adds one entry to the shared lists, so sibling app PRs may need a small merge as they land.
  • 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)

Preview (once deployed): https://comfy-website-preview-pr-20860.vercel.app/hub/apps/relight/


Generated by Claude Code

@mariana953
mariana953 requested review from a team and dante01yoon as code owners October 12, 2026 19:27
@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: dda52703-ecaf-46fa-adcc-2097dbb019e8

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-20860.vercel.app

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

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

Last updated: 2026-10-14T01:40:14Z for 65fa801

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.74004% with 203 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/website/src/lib/workshop/relight/renderer.ts 5.47% 68 Missing and 1 partial ⚠️
...s/website/src/lib/workshop/relight/render-image.ts 8.51% 43 Missing ⚠️
.../src/components/workshop/relight/RelightCanvas.vue 60.97% 9 Missing and 7 partials ⚠️
...te/src/components/workshop/relight/RelightDial.vue 64.70% 11 Missing and 1 partial ⚠️
apps/website/src/composables/useRelight.ts 90.90% 3 Missing and 9 partials ⚠️
...src/components/workshop/relight/RelightMapView.vue 84.09% 2 Missing and 5 partials ⚠️
apps/website/src/composables/useMoodThumbnails.ts 63.15% 4 Missing and 3 partials ⚠️
apps/website/src/lib/workshop/load-image.ts 0.00% 6 Missing ⚠️
...rc/components/workshop/relight/RelightSwatches.vue 61.53% 2 Missing and 3 partials ⚠️
...e/src/components/workshop/relight/RelightMasks.vue 85.00% 3 Missing ⚠️
... and 15 more
@@                  Coverage Diff                  @@
##             mariana/editor-kit   #20860   +/-   ##
=====================================================
  Coverage                      ?   85.80%           
=====================================================
  Files                         ?     3605           
  Lines                         ?   170093           
  Branches                      ?    46562           
=====================================================
  Hits                          ?   145945           
  Misses                        ?    22206           
  Partials                      ?     1942           
Flag Coverage Δ
website-unit 80.81% <80.74%> (?)

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%> (ø)
...e/src/components/workshop/relight/RelightDocks.vue 100.00% <100.00%> (ø)
.../components/workshop/relight/RelightGeneration.vue 100.00% <100.00%> (ø)
...src/components/workshop/relight/RelightHistory.vue 100.00% <100.00%> (ø)
...components/workshop/relight/RelightLightEditor.vue 100.00% <100.00%> (ø)
...c/components/workshop/relight/RelightLightKind.vue 100.00% <100.00%> (ø)
...rc/components/workshop/relight/RelightLightMap.vue 100.00% <100.00%> (ø)
...rc/components/workshop/relight/RelightLightRow.vue 100.00% <100.00%> (ø)
...components/workshop/relight/RelightMaskOutline.vue 100.00% <100.00%> (ø)
... and 53 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. The shading and light-map maths are well isolated in lib/ with good tests, and the WebGL renderer is disposed on unmount. Requesting changes for the copy approach (shared with the sibling app PRs), internal comments, and a duplicate mask-ID bug.

Size. This PR is about 7,200 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? At this size a WebGL renderer and shader belong in their own PR.

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(

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.

}

const image = shallowRef<RelightImage>()
/** The photo taken out last, kept so it can be put back. */

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.

const label = subject.trim()
if (!label) return
const { masks } = setup.value
const mask = newMask(`mask-${masks.length + 1}`, label, masks.length)

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: mask IDs come from masks.length + 1, so they repeat after a delete. Repro: the example starts with mask-1; add a mask (mask-2), add another (mask-3), remove mask-2, then add one: masks.length + 1 is 3 again, so two masks share mask-3. After that, updateMask/removeMask hit both, the v-for keys collide, and a light's mask reference is ambiguous. Could this use a counter like nextId() for lights? A composable test for add → remove → add would cover it. (CONFIRMED)

} from './lights'
import { renderRelitImage } from './render-image'

export interface RelightRequest {

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: RelightRequest 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?

const relight = useRelight(locale)
const { image, removed, phase } = relight
const result = ref<EditorView>('compare')
const panel = computed(() => layout !== 'e')

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.

suggestion: ?ux=e keeps a second, review-only layout (bottom composer + trays) in production code and in the e2e suite. Once the team picks a layout, could the other one be removed? Each app carries roughly a third more components and tests for a variant visitors aren't meant to use.

This branch was previously deployed

1 inactive deployment
website-approval — 65fa8014 Deployed Oct 14, 2026 by mariana953 via fast-lane #1962
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