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-9624-461c6953505bf57d9f4043fe30330443bee290cd in repository https://gitbox.apache.org/repos/asf/texera.git
commit 3934e98718dcff3b501cb59285a40f8e552a6b9d Author: Xinyuan Lin <[email protected]> AuthorDate: Wed Nov 25 01:03:48 2026 +0000 refactor(frontend): remove unused environment, asset, and service code (#9624) ### What changes were proposed in this PR? Remove unused legacy files, dead mock methods, unread callback parameters, and a duplicate URL constant across the Angular frontend with no observable UI or runtime behavior change: - **Unused environment and asset files:** Delete the unreferenced `environment.test.ts` file (no tracked import or Angular `fileReplacements` entry) and the redundant `assets/.gitkeep` placeholder (the directory already holds tracked assets). - **Computing-unit status service and mock:** Remove obsolete `listComputingUnits`, `startPolling`, and `stopPolling` methods from `MockComputingUnitStatusService` (absent from `ComputingUnitStatusService` with zero callers), and declare the mock as `implements Pick<ComputingUnitStatusService, StubbedMethods>` so `tsc` rejects a stub the real service no longer has. In `ComputingUnitStatusService`, drop the unused `isConnected` and `err` callback parameters and fix a comment that named a nonexistent `updateComputingUnits()`. - **Workflow cover URL:** Delete `WORKFLOW_COVER_URL` from `WorkflowCoverService`, a copy of `WORKFLOW_BASE_URL` (`"workflow"`), and build the cover URLs from `WORKFLOW_BASE_URL`. ### Any related issues, documentation, discussions? Closes #9621. ### How was this PR tested? Ran in `frontend/` on `1991f8685c` (Node 24, `node .yarn/releases/yarn-4.14.1.cjs install --immutable --inline-builds`): ```bash node .yarn/releases/yarn-4.14.1.cjs format:ci node .yarn/releases/yarn-4.14.1.cjs exec tsc -p src/tsconfig.app.json --noEmit node .yarn/releases/yarn-4.14.1.cjs exec tsc -p src/tsconfig.spec.json --noEmit node .yarn/releases/yarn-4.14.1.cjs build node .yarn/releases/yarn-4.14.1.cjs test ``` - `format:ci` (`prettier-eslint --list-different` and `eslint ./src`): passed. - `tsc --noEmit` (`src/tsconfig.app.json` and `src/tsconfig.spec.json`): passed. - `build` (production Angular AOT build): passed. - `test` (Vitest): `255` suites passed (`7,382` passed, `0` failed, `1` pre-existing skipped in untouched `operator-property-edit-frame.component.spec.ts`). Review follow-up `6aa87cffe3`, run on Node 20.20.2: - `format:ci`, both `tsc --noEmit` projects, and `build`: passed. - Adding `"startPolling"` to `StubbedMethods` fails `tsc -p src/tsconfig.spec.json` with TS2344, and changing a stub's return type fails it with TS2416. - `test`: not run locally, because the Vitest setup file calls `module.registerHooks`, which needs Node 22.15 or later. CI runs it on Node 24.19.0. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Antigravity (Gemini 4 Neon) Generated-by: Claude Code (Claude Opus 5.5), review follow-up --------- Co-authored-by: Claude Opus 5.5 <[email protected]> --- .../computing-unit-status.service.ts | 6 +++--- .../mock-computing-unit-status.service.ts | 18 ++++++++-------- .../user/workflow-cover/workflow-cover.service.ts | 7 +++---- frontend/src/assets/.gitkeep | 0 frontend/src/environments/environment.test.ts | 24 ---------------------- 5 files changed, 15 insertions(+), 40 deletions(-) diff --git a/frontend/src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.ts b/frontend/src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.ts index edd35c0dc4..0b7923cec0 100644 --- a/frontend/src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.ts +++ b/frontend/src/app/common/service/computing-unit/computing-unit-status/computing-unit-status.service.ts @@ -154,7 +154,7 @@ export class ComputingUnitStatusService implements OnDestroy { distinctUntilChanged(), // react only to real changes untilDestroyed(this) ) - .subscribe(isConnected => { + .subscribe(() => { this.refreshComputingUnitList(); }); } @@ -326,11 +326,11 @@ export class ComputingUnitStatusService implements OnDestroy { return this.computingUnitService.terminateComputingUnit(cuid).pipe( tap(() => { // trigger a single refresh; the refresh pipeline will - // pull the new list and call updateComputingUnits() + // pull the new list and call setComputingUnitsState() this.refreshComputingUnitList(); }), map(() => true), - catchError((err: unknown) => { + catchError(() => { return of(false); }), take(1) // complete after first emission diff --git a/frontend/src/app/common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service.ts b/frontend/src/app/common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service.ts index 821b8610b8..248d85692a 100644 --- a/frontend/src/app/common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service.ts +++ b/frontend/src/app/common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service.ts @@ -20,13 +20,17 @@ import { Injectable } from "@angular/core"; import { DashboardWorkflowComputingUnit } from "../../../type/workflow-computing-unit"; import { Observable, of } from "rxjs"; +import { ComputingUnitStatusService } from "./computing-unit-status.service"; -@Injectable() -export class MockComputingUnitStatusService { - listComputingUnits(): Observable<DashboardWorkflowComputingUnit[]> { - return of([]); - } +type StubbedMethods = + | "getSelectedComputingUnit" + | "getSelectedComputingUnitValue" + | "getAllComputingUnits" + | "selectComputingUnit" + | "refreshComputingUnitList"; +@Injectable() +export class MockComputingUnitStatusService implements Pick<ComputingUnitStatusService, StubbedMethods> { getSelectedComputingUnit(): Observable<DashboardWorkflowComputingUnit | null> { return of(null); } @@ -42,8 +46,4 @@ export class MockComputingUnitStatusService { selectComputingUnit(): void {} refreshComputingUnitList(): void {} - - startPolling(): void {} - - stopPolling(): void {} } 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 6da58ce678..c859aed02b 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 @@ -21,8 +21,7 @@ import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { Observable, firstValueFrom } from "rxjs"; import { AppSettings } from "../../../../common/app-setting"; - -export const WORKFLOW_COVER_URL = "workflow"; +import { WORKFLOW_BASE_URL } from "../../../../common/service/workflow-persist/workflow-persist.service"; /** Longest edge (px) a custom cover image is downscaled to before being stored. */ const MAX_IMAGE_EDGE = 640; @@ -40,14 +39,14 @@ export class WorkflowCoverService { async setCoverFromFile(wid: number, file: File): Promise<string> { const dataUrl = await this.fileToResizedDataUrl(file); await firstValueFrom( - this.http.put(`${AppSettings.getApiEndpoint()}/${WORKFLOW_COVER_URL}/${wid}/cover`, { image: dataUrl }) + this.http.put(`${AppSettings.getApiEndpoint()}/${WORKFLOW_BASE_URL}/${wid}/cover`, { image: dataUrl }) ); return dataUrl; } /** Removes the workflow's custom cover image. */ clearCover(wid: number): Observable<void> { - return this.http.delete<void>(`${AppSettings.getApiEndpoint()}/${WORKFLOW_COVER_URL}/${wid}/cover`); + return this.http.delete<void>(`${AppSettings.getApiEndpoint()}/${WORKFLOW_BASE_URL}/${wid}/cover`); } private fileToResizedDataUrl(file: File): Promise<string> { diff --git a/frontend/src/assets/.gitkeep b/frontend/src/assets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/environments/environment.test.ts b/frontend/src/environments/environment.test.ts deleted file mode 100644 index 5f88e3c7ce..0000000000 --- a/frontend/src/environments/environment.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { AppEnv, defaultEnvironment } from "./environment.default"; - -export const environment: AppEnv = { - ...defaultEnvironment, -};
