Skip to content

feat: add persistent generated asset media tabs - #14830

Open
adobex wants to merge 6 commits into
Comfy-Org:mainfrom
adobex:agent/generated-assets-media-tabs
Open

adobex wants to merge 6 commits into
Comfy-Org:mainfrom
adobex:agent/generated-assets-media-tabs

Conversation

@adobex

@adobex adobex commented Aug 6, 2026 •

Copy link
Copy Markdown

Summary

Use the persistent local output asset index for the Generated gallery when the server advertises asset support, while preserving one card per job and adding All, Images, Videos, and Audio filters.

Changes

  • Groups persisted outputs by job_id and preserves outputCount / allOutputs; assets without a job remain independent.
  • Keeps current main subfolder handling and history-backed behavior when the asset API is unavailable.
  • Filters mixed-output jobs by every grouped output, not only the representative card.
  • Loads additional pages when the selected media type is absent, serializes requests, and stops stale pagination after tab, folder, or media-context changes.
  • Aligns the grouping contract with the overlapping work in fix(assets): cloud Generated tab uses /api/assets so deleted outputs disappear (FE-740) #12464 and has no dependency on the closed feat: add local asset file actions #14831.

Review Focus

  • One-card-per-job behavior across pages, including mixed media and output counts.
  • Pagination cancellation when switching Generated/Imported, entering a folder, or changing media filters.
  • Existing Generated subfolder behavior and the asset-API-disabled fallback.

Tests

  • 263 tests across 11 related Vitest files
  • pnpm typecheck
  • pnpm format:check
  • pnpm lint
  • pnpm knip
  • Commit and pre-push hooks

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ❌ Failed

Details

⏰ Completed at: 09/24/2026, 12:37:38 PM UTC

Links

🎭 Playwright: ⏳ Running...

📦 Bundle Size

⚠️ Size data collection failed. Check the CI workflow logs.

⚡ Performance

⚠️ Performance tests failed. Check the CI workflow logs.

🔬 E2E Coverage

⚠️ Coverage collection failed. Check the CI workflow logs.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The asset sidebar adds generated-output filters for all assets, images, videos, and audio. It uses metadata-based media detection, flat output loading in eligible non-cloud environments, paginated filtering, and metadata-based preview handling.

Changes

Generated media asset filtering

Layer / File(s) Summary
Media kind detection
src/platform/assets/utils/assetMetadataUtils.ts, src/platform/assets/utils/assetMetadataUtils.test.ts
getAssetMediaKind detects image, video, and audio assets from MIME metadata or filename fallbacks. Tests cover the supported detection paths.
Sidebar filtering and pagination
src/components/sidebar/tabs/AssetsSidebarTab.vue, src/locales/en/main.json
The sidebar adds generated-media tabs, uses useFlatOutputAssets for eligible non-cloud output assets, loads additional pages when needed, and derives preview and context-menu media types from metadata. English labels describe the four tabs.
Filtering validation
src/components/sidebar/tabs/AssetsSidebarTab.test.ts
Tests cover media filtering, pagination during concurrent loading, disabled asset API behavior, and guarded folder navigation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AssetSidebarTab
  participant useFlatOutputAssets
  participant getAssetMediaKind
  participant AssetGrid
  AssetSidebarTab->>useFlatOutputAssets: Load generated output assets
  AssetSidebarTab->>getAssetMediaKind: Classify asset metadata
  AssetSidebarTab->>AssetGrid: Render assets for selected media kind
  AssetSidebarTab->>useFlatOutputAssets: Load another page when no match exists
  useFlatOutputAssets-->>AssetSidebarTab: Return additional output assets
Loading

Possibly related PRs

Suggested reviewers: drjkl, ryan-di


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
End-To-End Regression Coverage For Fixes ❓ Inconclusive The changed files and description are available, but the PR title and commit subjects are not provided, so the required bug-fix signal cannot be verified. Provide the PR title and commit subjects, then reassess whether bug-fix language triggers the end-to-end regression-test requirement.
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The changed files are limited to sidebar assets, localization, and asset metadata utilities; none are under the specified graph or ECS paths.
Description check ✅ Passed The description includes the required Summary, Changes, and Review Focus sections. It clearly explains the generated asset media tabs, fallback behavior, pagination, grouping, and validation performed…
Title check ✅ Passed The title clearly and concisely describes the main change: adding persistent media tabs for generated assets.
Full details: Description check

Explanation

The description includes the required Summary, Changes, and Review Focus sections. It clearly explains the generated asset media tabs, fallback behavior, pagination, grouping, and validation performed. Screenshots are not applicable to this UI behavior change.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/sidebar/tabs/AssetsSidebarTab.test.ts`:
- Around line 54-67: Add a test in the AssetsSidebarTab test suite covering
selected-kind pagination: initialize the mocked useFlatOutputAssets media
without a video, set hasMore to true, make loadMore append a video asset, select
Videos, and assert that the video becomes visible. Keep the assertion focused on
observable additional-page loading behavior and update the mock state
accordingly.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3c188932-6b4f-4827-af43-6bce2a6bbba0

📥 Commits

Reviewing files that changed from the base of the PR and between db147c0 and 599afca.

📒 Files selected for processing (5)
  • src/components/sidebar/tabs/AssetsSidebarTab.test.ts
  • src/components/sidebar/tabs/AssetsSidebarTab.vue
  • src/locales/en/main.json
  • src/platform/assets/utils/assetMetadataUtils.test.ts
  • src/platform/assets/utils/assetMetadataUtils.ts

@adobex
adobex force-pushed the agent/generated-assets-media-tabs branch from 599afca to 9c81084 Compare August 6, 2026 06:04
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/sidebar/tabs/AssetsSidebarTab.test.ts`:
- Around line 238-241: Update the test around the Videos tab interaction to
await Vue’s nextTick() immediately after userEvent.click and before asserting
the filtered assets. Keep the existing visibility assertions unchanged.

In `@src/components/sidebar/tabs/AssetsSidebarTab.vue`:
- Around line 452-465: Update the showLoadingState and showEmptyState computed
conditions so outputAssets.isLoadingMore.value is considered only when
activeTab.value === 'output'. Preserve the existing loading and empty-state
behavior for the Imported tab and other non-output tabs.

In `@src/platform/assets/utils/assetMetadataUtils.test.ts`:
- Around line 152-170: Add a focused test for getAssetMediaKind that uses a
hash-like asset name, an unrecognized MIME type, and filename metadata set to a
video filename such as render.mp4; assert the result is video. Keep the case
behavior-focused and preserve the existing display_name and name fallback tests.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bb531e5b-2dc6-46b7-a346-d691f0ded61e

📥 Commits

Reviewing files that changed from the base of the PR and between db147c0 and 9c81084.

📒 Files selected for processing (5)
  • src/components/sidebar/tabs/AssetsSidebarTab.test.ts
  • src/components/sidebar/tabs/AssetsSidebarTab.vue
  • src/locales/en/main.json
  • src/platform/assets/utils/assetMetadataUtils.test.ts
  • src/platform/assets/utils/assetMetadataUtils.ts

@adobex
adobex force-pushed the agent/generated-assets-media-tabs branch from 9c81084 to 7b9aa95 Compare August 10, 2026 02:30
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 10, 2026
@adobex

adobex commented Aug 10, 2026

Copy link
Copy Markdown
Author

Updated onto current main in 7b9aa95 and addressed all four current review threads. Validation completed locally: 140 targeted Vitest tests passed, plus typecheck, changed-file lint, format check, knip, and git diff --check. Local validation used Node 24.14 while the repository currently declares Node 25.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@adobex
adobex marked this pull request as ready for review August 11, 2026 09:17
@adobex
adobex requested a review from a team August 11, 2026 09:17
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 11, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/sidebar/tabs/AssetsSidebarTab.vue`:
- Around line 527-540: Update ensureGeneratedMediaResults to return early when
outputAssets.isLoadingMore.value is true, alongside its existing guard
conditions, so concurrent loadMore calls cannot overlap. Preserve the watcher
retry behavior after the active request completes, and add a regression test
covering a generated-media tab switch during loadMore().
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d73b388a-b995-4928-b2bf-1d84daf139a2

📥 Commits

Reviewing files that changed from the base of the PR and between 84d2b22 and 4f29430.

📒 Files selected for processing (5)
  • src/components/sidebar/tabs/AssetsSidebarTab.test.ts
  • src/components/sidebar/tabs/AssetsSidebarTab.vue
  • src/locales/en/main.json
  • src/platform/assets/utils/assetMetadataUtils.test.ts
  • src/platform/assets/utils/assetMetadataUtils.ts

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/sidebar/tabs/AssetsSidebarTab.test.ts`:
- Around line 315-319: After the loadMore call completes in the test, await
Vue’s nextTick before asserting the audio asset visibility. Add this
synchronization between the loadMore wait and getByText('audio-output.mp3')
assertion, preserving the existing call-count verification.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 334b2b8c-ada3-4c73-8cb4-78ce6f310796

📥 Commits

Reviewing files that changed from the base of the PR and between 4f29430 and fec5be0.

📒 Files selected for processing (2)
  • src/components/sidebar/tabs/AssetsSidebarTab.test.ts
  • src/components/sidebar/tabs/AssetsSidebarTab.vue

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 11, 2026
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/components/sidebar/tabs/AssetsSidebarTab.vue 95.55% 2 Missing ⚠️
@@           Coverage Diff            @@
##             main   #14830    +/-   ##
========================================
  Coverage   80.90%   80.91%            
========================================
  Files        1872     1872            
  Lines      122197   122237    +40     
  Branches    37896    37457   -439     
========================================
+ Hits        98864    98908    +44     
+ Misses      22784    22772    -12     
- Partials      549      557     +8     
Flag Coverage Δ
unit 72.50% <96.07%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/assets/utils/assetMetadataUtils.ts 93.51% <100.00%> (+0.21%) ⬆️
src/components/sidebar/tabs/AssetsSidebarTab.vue 84.77% <95.55%> (+2.54%) ⬆️

... and 8 files with indirect coverage changes

🚀 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.

@christian-byrne christian-byrne 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.

Two blocking regressions: stale pagination and lost output grouping.

Full context for agent readers

Reviewed exact head 7be8f108ccab3ed241b059fe7c18bdb33382c6a5. The branch also conflicts with current main; the resolved head should preserve current main's generated-asset subfolder handling and reconcile the overlapping grouping/source work in #12464 and dependent #14831 before re-review.


while (baseAssets.value.length === 0 && outputAssets.hasMore.value) {
const previousCount = mediaAssets.value.length
await outputAssets.loadMore()

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.

issue: Pagination survives leaving Generated.

Full context for agent readers

The active-tab/folder/media-kind guards run only before the loop. If this await is pending while the user switches to Imported or enters an empty folder, the resumed loop reads that view's empty baseAssets and can keep loading Generated output pages until exhaustion. Please invalidate the loop when its starting context changes and cover a tab/folder switch during a pending loadMore().

@adobex adobex Aug 25, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 72e3d12b13. The pagination loop now captures a synchronous context version that changes when the active tab, folder view, or media kind changes, and checks it both in the loop condition and immediately after each awaited loadMore(). Regression tests cover switching to Imported and entering a folder while a page is pending, plus serialized media-filter switches. The related tests and typecheck pass.

const outputAssets = useAssetsApi('output')
const outputAssets =
!isCloud && api.getServerFeature('assets', false)
? useFlatOutputAssets()

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.

issue: Flat outputs drop job grouping.

Full context for agent readers

The current history provider emits one representative card per job with outputCount and allOutputs; useFlatOutputAssets() exposes each persisted asset row directly. A multi-output job therefore becomes multiple top-level cards and loses its count badge, folder navigation, and grouped actions. Please preserve the existing one-card-per-job contract while changing the persistence source.

@adobex adobex Aug 25, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 72e3d12b13. useFlatOutputAssetsGrouped now groups persisted rows by job_id in first-seen order, exposes one representative card with outputCount and allOutputs, retains current-main subfolder derivation, and leaves rows without a job independent. Filtering examines every grouped output, so mixed-media jobs keep one card while appearing under each applicable filter. Tests cover multi-output jobs, same-job pagination, mixed media, ordering, and non-mutation.

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

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants