Skip to content

feat(apps): Show in Finder for app results made on this computer - #2050

Open
PabloWiedemann wants to merge 16 commits into
claude/assets-folder-cards-92eb1afrom
claude/app-local-show-in-finder-1c9e83
Open

PabloWiedemann wants to merge 16 commits into
claude/assets-folder-cards-92eb1afrom
claude/app-local-show-in-finder-1c9e83

Conversation

@PabloWiedemann

@PabloWiedemann PabloWiedemann commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: When an app result was made on This computer (the Apps build), the output preview now shows Show in Finder, and it reveals the real file in the Apps build's output folder.
Why: the app page keeps each result as a Blob and never gets a file path, so the preview had nothing to reveal. ComfyUI already saved the file; the page only knows its ComfyUI filename and subfolder, and older results know nothing.
Can affect: the app output preview for This computer results, and Show in folder from it. Main process only. Cloud results, and results the page saved itself to <outputDir>/apps, do not change. The <outputDir>/apps check on the page's own comfy-apps:show-in-folder call is unchanged.

Stack (merge in order): … → #2045 → this PR
Pairs with: Comfy-Org/comfy-website#384, commits da1e92adb and 0908a25b7 on vinh/apps-preview (not pushed yet). Without them the page sends nothing new and nothing changes.

Changes

  • The page sends a reference, never a path (outputs.ts): a savedOn: 'computer' item may carry comfyFile: { filename, subfolder, type }. Only type: 'output' is kept. A filename with a separator, ./.., or hidden characters, and a subfolder that is absolute or has .. or empty parts, are dropped.
  • Desktop finds the file (outputLocator in outputFolders.ts):
    • With a reference: join it to the Apps build's output folder, resolve links, check the size matches the bytes the page shows.
    • Without one (results made before this change, or pages that do not tag files): find the file with exactly the same bytes. One scan per preview: apps/ first, then the rest of the folder, at most 5000 entries and 4 levels, no links followed. Same size first, then a byte compare.
    • Either way the file must be inside the Apps build's folder and inside the allowed output roots Assets uses (allowedPath).
  • Preview (appsView.ts, resolveOutputFiles): a found file gives the item savedOn: 'computer' and its folder. A page-sent folder is never shown for an item with a reference. Show in folder reveals the checked path from main (checked again on click) and is not relayed to the page. Only the newest preview for a window is shown, so a slow lookup cannot replace a newer preview.

Review

  • A cold review ran on the full diff and again on the fixes. Fixed: previews arriving out of order, the scan running out of budget before apps/, a linked apps/ folder being read, an unhandled reveal error, and test links left behind on failure. No critical findings.
  • CodeRabbit could not run: its sign-in has expired.
  • Left as notes:
    • The byte scan runs on each preview that has a result with no reference, and the preview waits for it. This only happens for older results and untagged pages.
    • When two output files have the same bytes, the first one found is revealed.

Testing

  • pnpm run typecheck, pnpm run lint, pnpm run format:check: pass.
  • vitest run: 345 files, 7971 pass, 12 skipped. New tests:
    • The reference: parsing it, and every refused shape.
    • Finding a file: by reference in the build's own folder and in the shared folder; by bytes; by bytes when the reference is wrong.
    • Refusing: a missing file, a size mismatch, a link out of the folder, a link into another build's folder, a linked apps/ folder, .., and cloud or Desktop-managed builds.
    • The preview: it never shows a page-sent folder with a reference.
  • pnpm run dev on macOS with the comfy-website dev server:
    • Remove Background (tagged result): Show in Finder showed, and Finder selected ComfyUI-Apps/output/apps/remove-background/cutout_00001_.png. A reference to a missing file and one with ../ both showed no button.
    • SDR to HDR (result made before the change, found by bytes): Pablo checked that Show in Finder works.
  • Not tested:
    • A fresh local run end to end (the Apps ComfyUI was busy in another app).
    • Windows and Linux.
    • Video results.
    • Most of the 12 tagged app pages in the app.
    • The out-of-order preview fix and the apps/-first scan order (no unit test for these).

An app result made on a local ComfyUI is already saved in the Apps
build's output folder, but the page only had the image, so the preview
could not reveal it.

The page now sends the ComfyUI output reference (filename and
subfolder, type output) as comfyFile. Desktop never takes a path from
the page: it joins the reference to the Apps build's output folder,
resolves links, checks the file is inside that folder and inside the
same allowed output roots Assets uses, and checks its size matches the
bytes the page shows. Only then does the item get savedOn computer and
its folder. Show in folder for that item reveals the checked path from
main and is not relayed to the page. The <outputDir>/apps check for the
page's own show-in-folder call is unchanged.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 84e16ac2-ee00-4547-8141-4f65abd4ba2a

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

…o reference

A result made on This computer before the page sent ComfyUI file
references (or on a page that does not tag them) reached the preview
with no folder, so it had no Show in Finder.

When an item is marked savedOn computer and has no folder, or its
reference does not resolve, Desktop now looks in the Apps build's
output folder for a file with exactly the same bytes (same size first,
then a byte compare, at most 5000 entries and 4 levels deep, no
followed links). A match must still be inside that folder and inside
the allowed output roots, and it is revealed through the same checked
path.
…a' into claude/app-local-show-in-finder-1c9e83
… bytes

Each preview item without a usable reference used to scan the whole
Apps output folder on its own. One locator per preview now scans once,
indexes files by size, and tries the reference before the bytes.
A slow byte lookup for an older preview could finish after a newer one
and replace it, so only the newest preview for a window is shown now.
The byte lookup scans the apps/ subfolder before the rest of the output
folder, so a large shared folder does not use up the scan limit first.
A failed reveal is caught, and test links are removed even when a test
fails.
The byte lookup now scans the whole apps/ subtree in its own pass
before the output root, so a root with thousands of files cannot use up
the scan limit before an app's subfolder is reached. A linked apps/
folder is skipped, like every other link in the scan.
@PabloWiedemann
PabloWiedemann marked this pull request as ready for review November 12, 2026 21:10
@PabloWiedemann
PabloWiedemann requested review from a team as code owners November 12, 2026 21:10
@PabloWiedemann PabloWiedemann added the cursor-review Trigger multi-model Cursor code review label Nov 12, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Cursor Review — Consolidated panel

Triggered by @PabloWiedemann.

Found 10 finding(s).

Severity Count
🟠 High 2
🟡 Medium 5
🟢 Low 3

Panel: 8/8 reviewers contributed findings.

Comment thread src/main/apps/appsView.ts Resolved
Comment thread src/main/lib/outputFolders.ts Resolved
Comment thread src/main/lib/outputFolders.ts Resolved
Comment thread src/main/lib/outputFolders.ts Resolved
Comment thread src/main/apps/appsView.ts Resolved
Comment thread src/main/apps/appsView.ts Resolved
Comment thread src/main/apps/appsView.ts Resolved
Comment thread src/main/lib/outputFolders.ts Resolved
Comment thread src/main/apps/outputs.ts
const shown = items.map(({ comfyFile, folder, ...item }, i): AppOutputItem => {
const file = files[i]
if (file) return { ...item, savedOn: 'computer', folder: path.dirname(file) }
return folder && !comfyFile ? { ...item, folder } : item

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Low — When an item has both folder and comfyFile and the lookup returns null, the page-supplied folder is dropped entirely (folder && !comfyFile). Since the renderer gates both the "Saved in" line and the Show-in-folder button on folder, a file that genuinely is on disk loses all location affordances whenever it was renamed, resized, or missed by the byte scan. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).

Comment thread src/main/lib/outputFolders.ts Resolved
- A file named by the page's reference must now have exactly the same
  bytes, not only the same size.
- Files are checked against the allowed folders before they are read,
  opened without following links or blocking, and read only up to the
  expected size.
- At most four same-size files are compared per output.
- A lookup stops when a newer preview starts, the page navigates or
  closes, and the backdrop is not captured from a closed page.
- apps/ and the rest of the output folder each get their own scan limit.
- The scan includes files of any type, such as AAC audio.
@PabloWiedemann

Copy link
Copy Markdown
Contributor Author

Review comments handled in b9ca95f.

Fixed

  • Stale lookups pile up: a lookup now stops when a newer preview starts or the page navigates or closes. Only the newest preview is shown.
  • Unbounded same-size reads: at most 4 same-size files are compared per output, and each is read only up to the expected size.
  • Read before check: each file is checked against the allowed folders first, then opened without following links or blocking, and must be a regular file of the expected size.
  • Reference matched by size only: the referenced file must now have exactly the same bytes.
  • Capture from a closed page: the backdrop is not captured once the page is closed.
  • No reset on navigation: navigating clears the shown files and moves the request counter on.
  • Shared scan limit: apps/ and the rest of the output folder each get their own limit.
  • Extension filter: the scan includes files of any type, such as .aac.

Already fixed

  • None.

Not changed

  • Show in folder click from the previous preview: the panel replaces the dialog when new outputs arrive. A click can only race inside that short gap, and it still only reveals a checked file in the allowed folders. Closing it fully needs a generation id in the panel action protocol. That is a renderer change outside this PR.
  • Page folder dropped when a reference does not resolve: the page never sends both a folder and a reference. If the reference does not resolve, Desktop shows no location rather than one it could not confirm.
  • CodeRabbit comment: it only says the review was skipped for a non-default base branch. There is nothing to fix.

@PabloWiedemann

Copy link
Copy Markdown
Contributor Author

Review comments handled in b9ca95f.

Fixed

  • Stale lookups pile up: a lookup now stops when a newer preview starts or the page navigates or closes. Only the newest preview is shown.
  • Unbounded same-size reads: at most 4 same-size files are compared per output, and each is read only up to the expected size.
  • Read before check: each file is checked against the allowed folders first, then opened without following links or blocking, and must be a regular file of the expected size.
  • Reference matched by size only: the referenced file must now have exactly the same bytes.
  • Capture from a closed page: the backdrop is not captured once the page is closed.
  • No reset on navigation: navigating clears the shown files and moves the request counter on.
  • Shared scan limit: apps/ and the rest of the output folder each get their own limit.
  • Extension filter: the scan includes files of any type, such as .aac.

Already fixed

  • None.

Not changed

  • Show in folder click from the previous preview: the panel replaces the dialog when new outputs arrive. A click can only race inside that short gap, and it still only reveals a checked file in the allowed folders. Closing it fully needs a generation id in the panel action protocol. That is a renderer change outside this PR.
  • Page folder dropped when a reference does not resolve: the page never sends both a folder and a reference. If the reference does not resolve, Desktop shows no location rather than one it could not confirm.
  • CodeRabbit comment: it only says the review was skipped for a non-default base branch. There is nothing to fix.

The panel could send Show in folder for a preview that main had
already replaced with newer outputs, and main resolved the index
against the new files. Each preview now carries its turn, the panel
sends it back with every action, and main drops an action whose turn
is not the one it last showed. The page still gets only the action
and the index.
@PabloWiedemann

Copy link
Copy Markdown
Contributor Author

Review follow-up.

Branch: merged #2045 (3629faa). One conflict in showOutput: kept the turn check from this PR and added the on-screen check from #2008. Typecheck, lint, format and unit tests pass.

Fixed (threads resolved)

  • Each preview has a turn number, and main ignores an action from an older preview (9f1c91e).

Not changed (threads left open for the reviewer)

  • By design: Desktop shows only a folder it found and checked itself, never one the page sent.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cursor-review Trigger multi-model Cursor code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants