Skip to content

Conversation

webfiltered
Copy link
Contributor

@webfiltered webfiltered commented Oct 4, 2025

Summary

Extracts desktop UI into apps/desktop-ui package with minimal changes.

Changes

  • What:
    • Separates desktop-specific code into standalone package with independent Vite config, router, and i18n
    • Drastically simplifies the main app router by removing all desktop routes
    • Adds a some code duplication, most due to the existing design
    • Some duplication can be refactored to be simpler on either side - no need to split things by isElectron()
    • Rudimentary storybook support has been added
  • Breaking: Stacked PR for publishing must be merged before this PR makes it to stable core (but publishing could be done manually)
  • Dependencies: Takes full advantage of pnpm catalog. No additional dependencies added.

Review Focus

  • Should be no changes to normal frontend operation
  • Scripts added to root package.json are acceptable
  • The duplication in this PR is copied as is, wherever possible. Any corrections or fix-ups beyond the scope of simply migrating the functionality as-is, can be addressed in later PRs. That said, if any changes are made, it instantly becomes more difficult to separate the duplicated code out into a shared utility.

i18n

Fixing i18n is out of scope for this PR. It is a larger task that we should consider carefully and implement properly. Attempting to isolate the desktop i18n and duplicate the current localisation scripts would be wasted energy.

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Oct 4, 2025
Copy link

github-actions bot commented Oct 4, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 10/05/2025, 04:51:29 AM UTC

🔗 Links


🎉 Your Storybook is ready for review!

Copy link

github-actions bot commented Oct 4, 2025

🎭 Playwright Test Results

⚠️ Tests passed with flaky tests

⏰ Completed at: 10/05/2025, 05:05:26 AM UTC

📈 Summary

  • Total Tests: 489
  • Passed: 457 ✅
  • Failed: 0
  • Flaky: 2 ⚠️
  • Skipped: 30 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 448 / ❌ 0 / ⚠️ 2 / ⏭️ 30
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 6 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@webfiltered webfiltered marked this pull request as draft October 4, 2025 07:00
@webfiltered webfiltered marked this pull request as ready for review October 4, 2025 08:51
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Oct 4, 2025
@webfiltered webfiltered changed the title Decouple desktop UI into monorepo app Decouple Desktop UI into monorepo app Oct 4, 2025
Adds apps/desktop-ui package setup, Vite config, TypeScript config, base index.html, public assets, env/types, and base router/i18n/main wiring.
Relocates Desktop UI components, views, stores, types, and constants under apps/desktop-ui with no content changes (pure moves).
Updates existing app router to accommodate Desktop UI extraction.
Added by pattern from packages/* packages.
Copies style to local style.css
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Comprehensive PR Review

This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.

Review Summary

PR: Decouple Desktop UI into monorepo app (#5912)
Impact: 1188 additions, 96 deletions across 67 files

Issue Distribution

  • Critical: 0
  • High: 1
  • Medium: 4
  • Low: 3

Category Breakdown

  • Architecture: 4 issues
  • Security: 2 issues
  • Performance: 1 issue
  • Code Quality: 1 issue

Key Findings

Architecture & Design

This PR successfully extracts desktop-specific functionality into a standalone apps/desktop-ui package, which is a positive architectural move. The separation creates clear boundaries and eliminates conditional isElectron() checks from the main app. However, several consistency issues were identified:

  • Missing functions in desktop utilities compared to main app (showNativeSystemMenu)
  • Port conflicts between desktop and main Storybook instances
  • Cross-dependencies from build scripts to desktop app constants
  • Missing TypeScript type exports for consistency

The move to use file renaming (R100) rather than copy-paste is excellent for git history preservation.

Security Considerations

Two security vulnerabilities were identified in development configurations:

  • Storybook server configured with allowedHosts: true creates host header attack vulnerability
  • Vite dev server exposes to all network interfaces (0.0.0.0) when VITE_REMOTE_DEV=true

Both should be addressed before production deployment of development tooling.

Performance Impact

The desktop app eagerly loads all locale files at startup, which increases initial bundle size. Consider implementing lazy locale loading based on detected language for better startup performance.

Integration Points

The desktop UI properly integrates with:

  • Nx build orchestration with appropriate caching and outputs
  • pnpm workspace catalog for dependency management
  • Shared frontend utilities package
  • Main app locale files via path aliasing

The CODEOWNERS file was properly updated to consolidate ownership under @webfiltered.

Positive Observations

  • Clean separation of concerns with minimal code duplication
  • Proper use of Nx monorepo architecture with appropriate tagging
  • Good use of pnpm catalog for dependency management
  • Comprehensive Storybook setup for component development
  • Maintains TypeScript strict mode compliance
  • Proper Vue 3 Composition API patterns throughout
  • Well-structured component architecture with proper prop/emit patterns

References

Next Steps

  1. Address the high-priority security issue in Storybook configuration
  2. Resolve API consistency between desktop and main utilities
  3. Fix port conflicts for simultaneous development
  4. Consider performance optimization for locale loading
  5. Verify all development tooling works correctly in the new structure

This is a comprehensive automated review. For architectural decisions requiring human judgment, please request additional manual review.

@webfiltered
Copy link
Contributor Author

Comprehensive PR Review

Addressed all comments individually. Resolved all that were not introduced by this PR, just replicated, hallucinations, requests to add unused code, or just ridiculous.

@webfiltered
Copy link
Contributor Author

For visibility: I used both Sonnet 4.5 and Opus (it's a big PR, it needs some big understanding) to review this PR locally. Only came back with similar issues - things that are out of scope for this PR.

I did caveat the bots with the i18n situation (only), as I realise it's not great. I also don't have the time to make it a pre-req for merge. Have updated PR description.

@webfiltered
Copy link
Contributor Author

@christian-byrne Did you guys get codex working on the repo? Can it review?

christian-byrne
christian-byrne previously approved these changes Oct 4, 2025
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

LGTM

@christian-byrne
Copy link
Contributor

@christian-byrne Did you guys get codex working on the repo? Can it review?

@benceruleanlu can you remind me how it's done again?

@webfiltered
Copy link
Contributor Author

@codex review

Copy link

To use Codex here, create a Codex account and connect to github.

DrJKL
DrJKL previously approved these changes Oct 5, 2025
@@ -1,12 +1,12 @@
import * as fs from 'fs'

import { DESKTOP_DIALOGS } from '../apps/desktop-ui/src/constants/desktopDialogs'
Copy link
Contributor

Choose a reason for hiding this comment

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

Want to add a path in the root tsconfig?
Maybe '@desktop/*': './apps/desktop-ui/src'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought on this is that we should do this when we move the frontend to an app - properly, and all at once.

Right now the root tsconfig is actually still just the frontend tsconfig - and it doesn't make sense to have it ref the desktop.

Comment on lines +3 to +6
#desktop-app {
position: absolute;
inset: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't use tailwind utilities for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like-for-like migration - honestly, I went one step too far here and didn't use top:0; left:0; width:100%; height:100%; (because .. no).

size="small"
:class="
cn('absolute top-2 right-8 transition-opacity', {
'opacity-0 pointer-events-none select-none': !isHovered
Copy link
Contributor

Choose a reason for hiding this comment

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

The CSS hover doesn't work for this?

Copy link
Contributor Author

@webfiltered webfiltered Oct 5, 2025

Choose a reason for hiding this comment

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

This isn't a change, afaik. (edit: confirmed!)

size="small"
:class="
cn('absolute top-2 right-8 transition-opacity', {
'opacity-0 pointer-events-none select-none': !isHovered
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These files were duplicated as is - i.e. the PR isn't to make changes, it's to do the split. Trying to fix things at the same time as you migrate them is almost always a misstep; if there are any issues, you will have no idea what caused it.

In my experience, it's usually the opportunistic fix.

I'll add context to the PR body.

Comment on lines +46 to +47
const terminalEl = ref<HTMLElement | undefined>()
const rootEl = ref<HTMLElement | undefined>()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The possibly-undefinedness is implicit when you don't pass in a default.

Suggested change
const terminalEl = ref<HTMLElement | undefined>()
const rootEl = ref<HTMLElement | undefined>()
const terminalEl = ref<HTMLElement>()
const rootEl = ref<HTMLElement>()

Copy link
Contributor Author

@webfiltered webfiltered Oct 5, 2025

Choose a reason for hiding this comment

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

Should be no change here too - can address post-migration.

const terminalEl = ref<HTMLElement | undefined>()
const rootEl = ref<HTMLElement | undefined>()

Comment on lines +16 to +21
const ComfyUIPreset = definePreset(Aura, {
semantic: {
// @ts-expect-error fixme ts strict error
primary: Aura['primitive'].blue
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Should some of this also be moved to the design system package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be no change here, also - can address post-migration.

const ComfyUIPreset = definePreset(Aura, {
semantic: {
// @ts-expect-error fixme ts strict error
primary: Aura['primitive'].blue
}
})

@webfiltered webfiltered dismissed stale reviews from DrJKL and christian-byrne via bc2fd61 October 5, 2025 01:57
Copy link
Contributor Author

@webfiltered webfiltered left a comment

Choose a reason for hiding this comment

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

The original images were not removed, and are being duplicated here for likely no reason. Comfy brand mark will probably see re-use. This can be moved to an assets package.

Originally LLM-parsed and "fixed"
The external: () => false configuration causes a PostCSS error
during CSS URL processing. Removing it fixes the build without
affecting dependency bundling.
@webfiltered webfiltered enabled auto-merge (squash) October 5, 2025 04:51
@webfiltered webfiltered merged commit 07a74e3 into main Oct 5, 2025
25 checks passed
@webfiltered webfiltered deleted the desktop-ui-c branch October 5, 2025 05:04
webfiltered added a commit that referenced this pull request Oct 5, 2025
## Summary

Adds automated npm publishing for @comfyorg/desktop-ui package with
version management and release workflows.

- Ref: #5912

## Changes

- **What**: Three GitHub Actions workflows for desktop-ui npm publishing
automation

### Two functions

1. Bump action - Just creates a version bump PR for `desktop-ui`
2. Publish action - Can be run manually - essentially a function with
params / void return

### One automation

- Watches for matching commits, then calls the Publish action with
pre-filled details

## Review Focus

Security hardening and workflow correctness.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5915-Add-Desktop-UI-npm-publishing-workflows-2826d73d365081d9b7f8d7f752536ceb)
by [Unito](https://www.unito.io)
arjansingh pushed a commit that referenced this pull request Oct 7, 2025
## Summary

Extracts desktop UI into apps/desktop-ui package with minimal changes.

## Changes

- **What**:
- Separates desktop-specific code into standalone package with
independent Vite config, router, and i18n
- Drastically simplifies the main app router by removing all desktop
routes
  - Adds a some code duplication, most due to the existing design
- Some duplication can be refactored to be *simpler* on either side - no
need to split things by `isElectron()`
  - Rudimentary storybook support has been added
- **Breaking**: Stacked PR for publishing must be merged before this PR
makes it to stable core (but publishing _could_ be done manually)
  - #5915
- **Dependencies**: Takes full advantage of pnpm catalog. No additional
dependencies added.

## Review Focus

- Should be no changes to normal frontend operation
- Scripts added to root package.json are acceptable
- The duplication in this PR is copied as is, wherever possible. Any
corrections or fix-ups beyond the scope of simply migrating the
functionality as-is, can be addressed in later PRs. That said, if any
changes are made, it instantly becomes more difficult to separate the
duplicated code out into a shared utility.
  - Tracking issue to address concerns: #5925

### i18n

Fixing i18n is out of scope for this PR. It is a larger task that we
should consider carefully and implement properly. Attempting to isolate
the desktop i18n and duplicate the _current_ localisation scripts would
be wasted energy.
arjansingh pushed a commit that referenced this pull request Oct 7, 2025
## Summary

Adds automated npm publishing for @comfyorg/desktop-ui package with
version management and release workflows.

- Ref: #5912

## Changes

- **What**: Three GitHub Actions workflows for desktop-ui npm publishing
automation

### Two functions

1. Bump action - Just creates a version bump PR for `desktop-ui`
2. Publish action - Can be run manually - essentially a function with
params / void return

### One automation

- Watches for matching commits, then calls the Publish action with
pre-filled details

## Review Focus

Security hardening and workflow correctness.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5915-Add-Desktop-UI-npm-publishing-workflows-2826d73d365081d9b7f8d7f752536ceb)
by [Unito](https://www.unito.io)
arjansingh pushed a commit that referenced this pull request Oct 7, 2025
Extracts desktop UI into apps/desktop-ui package with minimal changes.

- **What**:
- Separates desktop-specific code into standalone package with
independent Vite config, router, and i18n
- Drastically simplifies the main app router by removing all desktop
routes
  - Adds a some code duplication, most due to the existing design
- Some duplication can be refactored to be *simpler* on either side - no
need to split things by `isElectron()`
  - Rudimentary storybook support has been added
- **Breaking**: Stacked PR for publishing must be merged before this PR
makes it to stable core (but publishing _could_ be done manually)
  - #5915
- **Dependencies**: Takes full advantage of pnpm catalog. No additional
dependencies added.

- Should be no changes to normal frontend operation
- Scripts added to root package.json are acceptable
- The duplication in this PR is copied as is, wherever possible. Any
corrections or fix-ups beyond the scope of simply migrating the
functionality as-is, can be addressed in later PRs. That said, if any
changes are made, it instantly becomes more difficult to separate the
duplicated code out into a shared utility.
  - Tracking issue to address concerns: #5925

Fixing i18n is out of scope for this PR. It is a larger task that we
should consider carefully and implement properly. Attempting to isolate
the desktop i18n and duplicate the _current_ localisation scripts would
be wasted energy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
claude-review Add to trigger a PR code review from Claude Code Electron ComfyUI Desktop related size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants