Skip to content

fix(workflow): include coverImage in search and list API responses#6280

Merged
xuang7 merged 8 commits into
apache:mainfrom
VuMartin:n-plus-one-cover-fetches
Jul 13, 2026
Merged

fix(workflow): include coverImage in search and list API responses#6280
xuang7 merged 8 commits into
apache:mainfrom
VuMartin:n-plus-one-cover-fetches

Conversation

@VuMartin

@VuMartin VuMartin commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Include workflow cover image data in the dashboard search response to prevent the frontend from needing additional requests to fetch cover images.

This PR fixes the N+1 query issue where each workflow card was making a separate GET /workflow/{wid}/cover request to fetch its cover image.

Before:

· The frontend loads the workflow list (1 request)
· Each card calls workflowCoverService.getCover() individually (N requests)
· Total: 1 + N requests for N workflows
Screenshot 2026-07-10 at 12 37 25 AM
Screenshot 2026-07-10 at 12 37 41 AM

After:

· /dashboard/search and workflow responses now include the coverImage field in the response
· Each card uses the bundled data directly
· Total: 1 request
Screenshot 2026-07-10 at 1 28 12 AM
image
image

Changes made:

  1. Added coverImage field to DashboardWorkflow case class
  2. Modified baseWorkflowSelect() to left join WORKFLOW_COVER_IMAGE and select max(WORKFLOW_COVER_IMAGE.IMAGE).as("cover_image")
  3. Updated WorkflowSearchQueryBuilder to include coverImage in search results
  4. Updated frontend DashboardEntry and DashboardWorkflow interfaces to include coverImage data and use it directly in card rendering
  5. Replaced per-card getCover() calls with direct coverImage usage in card-item.component.ts

Any related issues, documentation, discussions?

Closes #5920
Follow-up to #5704

How was this PR tested?

Manual Testing:

· Verified coverImage field appears in search responses
· Uploaded a test cover image via API and confirmed it appears in search response

Automated Tests:

· Added a test case to verify workflow cover images are included in search results.

Tested with:

sbt "project WorkflowExecutionService" "testOnly *WorkflowResourceSpec -- -z "include workflow cover image in search results""

Was this PR authored or co-authored using generative AI tooling?

Co-authored with ChatGPT 5.5-mini

@github-actions github-actions Bot added engine frontend Changes related to the frontend GUI labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @roshiiiz, @Ma77Ball, @aglinxinyuan
    You can notify them by mentioning @roshiiiz, @Ma77Ball, @aglinxinyuan in a comment.

Copilot AI 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.

Pull request overview

This PR reduces dashboard workflow-card network fan-out by including each workflow’s coverImage payload directly in workflow list/search responses, so the frontend can render card previews without per-card GET /workflow/{wid}/cover calls.

Changes:

  • Backend: extend workflow search/list query builders to left-join WORKFLOW_COVER_IMAGE and aggregate/select the cover image into DashboardWorkflow.coverImage.
  • Frontend: extend dashboard workflow typings/entry mapping and switch card rendering to use the bundled coverImage value instead of fetching covers per card.
  • Tests: add a backend test asserting cover images are present in workflow search results.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/app/dashboard/type/dashboard-workflow.interface.ts Adds coverImage to the workflow dashboard type.
frontend/src/app/dashboard/type/dashboard-entry.ts Maps backend coverImage onto DashboardEntry.coverImageUrl for card rendering.
frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.ts Stops per-card cover fetch; uses bundled cover image for workflow cards.
amber/src/test/scala/org/apache/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala Adds regression test for cover image inclusion in search results.
amber/src/main/scala/org/apache/texera/web/resource/dashboard/WorkflowSearchQueryBuilder.scala Includes cover image in workflow search query + mapping.
amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala Includes cover image in workflow list query + DashboardWorkflow model.
amber/src/main/scala/org/apache/texera/web/resource/dashboard/UnifiedResourceSchema.scala Extends unified schema to carry workflow cover image field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/app/dashboard/type/dashboard-workflow.interface.ts Outdated
@chenlica

chenlica commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@VuMartin Please include screenshots to show the interface before and after the PR.

@mengw15 Please review this PR.

@chenlica chenlica requested a review from mengw15 July 9, 2026 16:50
@codecov-commenter

codecov-commenter commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.07%. Comparing base (afa8af2) to head (3a61a39).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6280      +/-   ##
============================================
+ Coverage     66.04%   66.07%   +0.02%     
  Complexity     3380     3380              
============================================
  Files          1142     1142              
  Lines         44980    44991      +11     
  Branches       4948     4950       +2     
============================================
+ Hits          29709    29728      +19     
+ Misses        13631    13621      -10     
- Partials       1640     1642       +2     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from afa8af2
agent-service 51.90% <ø> (ø) Carriedforward from afa8af2
amber 66.64% <100.00%> (+0.06%) ⬆️
computing-unit-managing-service 9.97% <ø> (ø) Carriedforward from afa8af2
config-service 52.30% <ø> (ø) Carriedforward from afa8af2
file-service 63.97% <ø> (ø) Carriedforward from afa8af2
frontend 63.51% <100.00%> (ø)
notebook-migration-service 78.94% <ø> (ø) Carriedforward from afa8af2
pyamber 91.18% <ø> (ø) Carriedforward from afa8af2
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from afa8af2

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 6 better · 🔴 1 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main afa8af2 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🟢 bs=10 sw=10 sl=64 548 0.334 18,360/22,234/22,234 us 🟢 -37.3% / 🔴 +53.0%
🔴 bs=100 sw=10 sl=64 1,226 0.748 82,786/89,697/89,697 us 🟢 -16.0% / 🟢 -19.3%
bs=1000 sw=10 sl=64 1,410 0.861 710,555/741,039/741,039 us ⚪ within ±5% / 🟢 +28.9%
Baseline details

Latest main afa8af2 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 548 tuples/sec 490 tuples/sec 825.74 tuples/sec +11.8% -33.6%
bs=10 sw=10 sl=64 MB/s 0.334 MB/s 0.299 MB/s 0.504 MB/s +11.7% -33.7%
bs=10 sw=10 sl=64 p50 18,360 us 19,061 us 12,003 us -3.7% +53.0%
bs=10 sw=10 sl=64 p95 22,234 us 35,483 us 14,566 us -37.3% +52.6%
bs=10 sw=10 sl=64 p99 22,234 us 35,483 us 18,190 us -37.3% +22.2%
bs=100 sw=10 sl=64 throughput 1,226 tuples/sec 1,213 tuples/sec 1,072 tuples/sec +1.1% +14.3%
bs=100 sw=10 sl=64 MB/s 0.748 MB/s 0.741 MB/s 0.654 MB/s +0.9% +14.3%
bs=100 sw=10 sl=64 p50 82,786 us 78,224 us 94,522 us +5.8% -12.4%
bs=100 sw=10 sl=64 p95 89,697 us 106,823 us 101,111 us -16.0% -11.3%
bs=100 sw=10 sl=64 p99 89,697 us 106,823 us 111,122 us -16.0% -19.3%
bs=1000 sw=10 sl=64 throughput 1,410 tuples/sec 1,417 tuples/sec 1,094 tuples/sec -0.5% +28.8%
bs=1000 sw=10 sl=64 MB/s 0.861 MB/s 0.865 MB/s 0.668 MB/s -0.5% +28.9%
bs=1000 sw=10 sl=64 p50 710,555 us 705,473 us 934,546 us +0.7% -24.0%
bs=1000 sw=10 sl=64 p95 741,039 us 763,431 us 975,104 us -2.9% -24.0%
bs=1000 sw=10 sl=64 p99 741,039 us 763,431 us 1,005,414 us -2.9% -26.3%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,364.95,200,128000,548,0.334,18360.42,22233.94,22233.94
1,100,10,64,20,1631.61,2000,1280000,1226,0.748,82786.11,89696.58,89696.58
2,1000,10,64,20,14184.44,20000,12800000,1410,0.861,710555.17,741039.26,741039.26

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

LGTM. Could you add a test case for the uncovered part?

@xuang7 xuang7 added release/v1.2 back porting to release/v1.2 and removed release/v1.2 back porting to release/v1.2 labels Jul 10, 2026
@VuMartin

Copy link
Copy Markdown
Contributor Author

Thanks, added the requested test coverage

@xuang7 xuang7 added this pull request to the merge queue Jul 12, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 12, 2026
@xuang7 xuang7 added this pull request to the merge queue Jul 12, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 12, 2026
@VuMartin VuMartin force-pushed the n-plus-one-cover-fetches branch from 52c9e5a to 3a61a39 Compare July 12, 2026 22:16
@xuang7 xuang7 added this pull request to the merge queue Jul 13, 2026
Merged via the queue into apache:main with commit ff82fd8 Jul 13, 2026
22 checks passed
@VuMartin VuMartin deleted the n-plus-one-cover-fetches branch July 13, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fold workflow cover into list/search payload to avoid per-card N+1 fetches

5 participants