This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/main/pr-8924-a182a23e31f08e4f14d0d0beb405feb84f1e0431
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 87eaf5c109d85d18a7f8e2729e23a9c059c18d8a
Author: Xinyuan Lin <[email protected]>
AuthorDate: Mon Oct 12 03:24:20 2026 +0000

    refactor(frontend): remove the unused getCover (#8924)
    
    ### What changes were proposed in this PR?
    
    Removes `WorkflowCoverService.getCover`, which no production code has
    called since covers started arriving on the search and list responses.
    It also drops the `of` / `catchError` / `map` imports that only
    `getCover` used. **+6/−31 lines.** There is no behaviour change.
    `setCoverFromFile` and `clearCover`, the service's live methods, stay.
    
    Spec changes:
    
    - **`workflow-cover.service.spec.ts`:** the two `getCover` cases are
    deleted.
    - **`card-item.component.spec.ts`:** the `getCover` mock member is
    dropped. The two "use the stored cover" / "fall back to the default
    image" cases keep their assertions. Their
    `expect(getCover).not.toHaveBeenCalled()` line was #6280's guard against
    a per-card cover fetch, so it is replaced with an HTTP-level
    `expectNone` on `/cover`. That keeps the guard without naming a method
    that no longer exists.
    - **`hub-search-result.component.spec.ts`:** the mock member is dropped.
    
    ### History
    
    | | |
    | --- | --- |
    | **Introduced by** | #5704 (2026-07-04), "feat(dashboard): add custom
    cover image for workflow cards". Each card called it to load its cover |
    | **Usage removed by** | #6280 (2026-07-13), "fix(workflow): include
    coverImage in search and list API responses". It fixed the N+1 fetch by
    putting the cover on the entry and deleted the card's call |
    
    It has been unused for nearly three months.
    
    ### Any related issues, documentation, discussions?
    
    Closes #8923
    
    ### How was this PR tested?
    
    No new tests. #6280's no-per-card-fetch guard is kept, now as an
    HTTP-level assertion.
    
    From `frontend/`:
    
    - `npx ng test --watch=false --include='**/card-item.component.spec.ts'
    --include='**/workflow-cover.service.spec.ts'
    --include='**/hub-search-result.component.spec.ts'`: 3 files, 128 tests,
    all pass.
    - `yarn format:ci`: clean.
    - `npx ng build`: success.
    
    To re-check:
    
    ```
    git grep -n -w "getCover" -- frontend   # no hits
    ```
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code (Claude Opus 5.5)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
 .../user/list-item/card-item/card-item.component.spec.ts |  8 ++++----
 .../user/workflow-cover/workflow-cover.service.spec.ts   | 16 ----------------
 .../user/workflow-cover/workflow-cover.service.ts        | 11 +----------
 .../hub-search-result.component.spec.ts                  |  2 +-
 4 files changed, 6 insertions(+), 31 deletions(-)

diff --git 
a/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.spec.ts
 
b/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.spec.ts
index 69f036b19b..4aa3be8629 100644
--- 
a/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.spec.ts
+++ 
b/frontend/src/app/dashboard/component/user/list-item/card-item/card-item.component.spec.ts
@@ -24,7 +24,7 @@ import {
   DEFAULT_WORKFLOW_NAME,
   WorkflowPersistService,
 } from "src/app/common/service/workflow-persist/workflow-persist.service";
-import { HttpClientTestingModule } from "@angular/common/http/testing";
+import { HttpClientTestingModule, HttpTestingController } from 
"@angular/common/http/testing";
 import { NzModalService } from "ng-zorro-antd/modal";
 import { of, throwError, Subject } from "rxjs";
 import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
@@ -108,7 +108,6 @@ describe("CardItemComponent", () => {
       setDefaultView: vi.fn(),
     };
     const workflowCoverServiceSpy = {
-      getCover: vi.fn().mockReturnValue(of(undefined)),
       setCoverFromFile: vi.fn(),
       clearCover: vi.fn().mockReturnValue(of(undefined)),
     };
@@ -281,7 +280,8 @@ describe("CardItemComponent", () => {
     component.entry = entry;
     component.ngOnChanges({ entry: { currentValue: component.entry } as any });
 
-    expect(workflowCoverService.getCover).not.toHaveBeenCalled();
+    // The cover arrives on the entry; a card must not fetch its own (#6280).
+    TestBed.inject(HttpTestingController).expectNone(req => 
req.url.endsWith("/cover"));
     expect(component.hasCustomImage).toBe(true);
     expect(component.coverImageSrc).toBe(cover);
   });
@@ -293,7 +293,7 @@ describe("CardItemComponent", () => {
     component.entry = entry;
     component.ngOnChanges({ entry: { currentValue: component.entry } as any });
 
-    expect(workflowCoverService.getCover).not.toHaveBeenCalled();
+    TestBed.inject(HttpTestingController).expectNone(req => 
req.url.endsWith("/cover"));
     expect(component.hasCustomImage).toBe(false);
     
expect(component.coverImageSrc).toBe(CardItemComponent.DEFAULT_PREVIEW_IMAGE);
   });
diff --git 
a/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.spec.ts
 
b/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.spec.ts
index 2a25a1f018..d2de707b73 100644
--- 
a/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.spec.ts
+++ 
b/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.spec.ts
@@ -40,22 +40,6 @@ describe("WorkflowCoverService", () => {
     httpMock.verify();
   });
 
-  it("getCover returns the stored image data URL", () => {
-    let result: string | undefined;
-    service.getCover(7).subscribe(image => (result = image));
-    const req = httpMock.expectOne(coverUrl(7));
-    expect(req.request.method).toBe("GET");
-    req.flush({ image: "data:image/jpeg;base64,abc" });
-    expect(result).toBe("data:image/jpeg;base64,abc");
-  });
-
-  it("getCover resolves to undefined when no cover exists (404)", () => {
-    let result: string | undefined = "unset";
-    service.getCover(7).subscribe(image => (result = image));
-    httpMock.expectOne(coverUrl(7)).flush(null, { status: 404, statusText: 
"Not Found" });
-    expect(result).toBeUndefined();
-  });
-
   it("clearCover issues a DELETE", () => {
     let completed = false;
     service.clearCover(7).subscribe(() => (completed = true));
diff --git 
a/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.ts
 
b/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.ts
index 42cb070538..6da58ce678 100644
--- 
a/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.ts
+++ 
b/frontend/src/app/dashboard/service/user/workflow-cover/workflow-cover.service.ts
@@ -19,8 +19,7 @@
 
 import { HttpClient } from "@angular/common/http";
 import { Injectable } from "@angular/core";
-import { Observable, firstValueFrom, of } from "rxjs";
-import { catchError, map } from "rxjs/operators";
+import { Observable, firstValueFrom } from "rxjs";
 import { AppSettings } from "../../../../common/app-setting";
 
 export const WORKFLOW_COVER_URL = "workflow";
@@ -37,14 +36,6 @@ const IMAGE_QUALITY = 0.8;
 export class WorkflowCoverService {
   constructor(private http: HttpClient) {}
 
-  /** The workflow's custom cover image data URL, or undefined if it has none. 
*/
-  getCover(wid: number): Observable<string | undefined> {
-    return this.http.get<{ image: string 
}>(`${AppSettings.getApiEndpoint()}/${WORKFLOW_COVER_URL}/${wid}/cover`).pipe(
-      map(response => response.image),
-      catchError(() => of(undefined))
-    );
-  }
-
   /** Downscales/re-encodes the chosen image, stores it as the workflow's 
cover, and resolves with the data URL. */
   async setCoverFromFile(wid: number, file: File): Promise<string> {
     const dataUrl = await this.fileToResizedDataUrl(file);
diff --git 
a/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.spec.ts
 
b/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.spec.ts
index fd16d9d54d..5ba06789d7 100644
--- 
a/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.spec.ts
+++ 
b/frontend/src/app/hub/component/hub-search-result/hub-search-result.component.spec.ts
@@ -492,7 +492,7 @@ describe("HubSearchResultComponent rendered template", () 
=> {
           provide: DatasetService,
           useValue: { getDatasetCoverUrl: vi.fn(() => of({ url: undefined })), 
retrieveOwners: vi.fn(() => of([])) },
         },
-        { provide: WorkflowCoverService, useValue: { getCover: vi.fn(() => 
of(undefined)) } },
+        { provide: WorkflowCoverService, useValue: {} },
         NzModalService,
         provideNzI18n(en_US),
         ...commonTestProviders,

Reply via email to