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-8717-d1f7e8456daea543fa5e2c85dfc5727444e37e4f in repository https://gitbox.apache.org/repos/asf/texera.git
commit c6495c5429d40170698088fee5e49ca17c4e4f64 Author: Xinyuan Lin <[email protected]> AuthorDate: Mon Sep 28 21:05:45 2026 +0000 refactor(frontend): remove dead WorkflowUtilService members (#8717) ### What changes were proposed in this PR? Deletes four unused members of `WorkflowUtilService`, plus the rxjs import and the three spec cases that existed only for them. **+1/−85 lines.** There is no behaviour change. The constructor still fills `operatorSchemaList` from the metadata subscription; only the `.next(true)` to a Subject with no subscriber goes. ### History | | | | --- | --- | | **Introduced by** | #712 (2019-06-06): `operatorSchemaListCreatedSubject` + getter. #754 (2020-12-11), "Added operator grouping feature": `getGroupRandomUUID`. #1309 (2021-08-28), "Re-enabling breakpoints": `getBreakpointRandomUUID`. #4020 (2025-11-25), "feat: introduce the LLM-based workflow copilot": `getOperatorTypeList` | | **Usage removed by** | #1674 (2022-10-05), the Yjs shared-editing frontend, removed the last live path to `getGroupRandomUUID` (#3033 later deleted its last textual call, inside a dead `getNewGroup`). #4495 (2026-04-27) removed the copilot tool that called `getOperatorTypeList`. The stream and `getBreakpointRandomUUID` were **never used** | The oldest of these has been dead for seven years, and the newest for five months. ### Any related issues, documentation, discussions? Closes #8716 ### How was this PR tested? No new tests. The 15 remaining service cases cover what is left. From `frontend/`: - `npx ng test --watch=false`, with one `--include` per spec that imports `workflow-util.service` (20 files): 724 tests, all pass. - `yarn format:ci`: clean. - `npx ng build`: success. To re-check: ``` git grep -n -E "getOperatorTypeList|getGroupRandomUUID|getBreakpointRandomUUID|OperatorSchemaListCreated" -- 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) --- .../util/workflow-util.service.spec.ts | 57 +--------------------- .../workflow-graph/util/workflow-util.service.ts | 29 ----------- 2 files changed, 1 insertion(+), 85 deletions(-) diff --git a/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.spec.ts b/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.spec.ts index 61c04a0825..7f2b6d18d0 100644 --- a/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.spec.ts +++ b/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.spec.ts @@ -22,16 +22,10 @@ import { OperatorMetadataService } from "./../../operator-metadata/operator-meta import { inject, TestBed } from "@angular/core/testing"; import { WorkflowUtilService } from "./workflow-util.service"; -import { - mockMultiInputOutputSchema, - mockOperatorSchemaList, - mockScanSourceSchema, -} from "../../operator-metadata/mock-operator-metadata.data"; +import { mockMultiInputOutputSchema, mockScanSourceSchema } from "../../operator-metadata/mock-operator-metadata.data"; import { commonTestProviders } from "../../../../common/testing/test-utils"; import { OperatorPredicate } from "../../../types/workflow-common.interface"; import { ExecutionMode, Workflow, WorkflowContent } from "../../../../common/type/workflow"; -import { OperatorMetadata } from "../../../types/operator-schema.interface"; -import { Subject } from "rxjs"; describe("WorkflowUtilService", () => { let workflowUtilService: WorkflowUtilService; @@ -248,53 +242,4 @@ describe("WorkflowUtilService", () => { expect(first.commentBoxID).not.toEqual(second.commentBoxID); }); - - it("should list every operator type carried by the loaded metadata", () => { - const types = workflowUtilService.getOperatorTypeList(); - - // The list is the operator *types*, not any other schema field: naming a few - // concrete ones pins the projection rather than just its length. - expect(types).toContain(mockScanSourceSchema.operatorType); - expect(types).toContain(mockMultiInputOutputSchema.operatorType); - expect(types.length).toEqual(mockOperatorSchemaList.length); - }); - - it("should prefix group and breakpoint uuids distinctly", () => { - const groupID = workflowUtilService.getGroupRandomUUID(); - const breakpointID = workflowUtilService.getBreakpointRandomUUID(); - - // The prefix is what callers key on, so assert it rather than "is a string". - expect(groupID).toMatch(/^group-/); - expect(breakpointID).toMatch(/^breakpoint-/); - expect(workflowUtilService.getGroupRandomUUID()).not.toEqual(groupID); - }); - - it("should announce on the schema-list-created stream once the metadata arrives", () => { - // The service subscribes to the metadata in its constructor, and the stub - // metadata service emits synchronously, so a TestBed-injected instance has - // already fired by the time a test could subscribe. Drive the emission by - // hand instead so the subscription is in place first. - const metadata = new Subject<OperatorMetadata>(); - const service = new WorkflowUtilService({ - getOperatorMetadata: () => metadata.asObservable(), - } as unknown as OperatorMetadataService); - - const seen: boolean[] = []; - let typesAtNotification: string[] | undefined; - service.getOperatorSchemaListCreatedStream().subscribe(value => { - seen.push(value); - // Read the list from INSIDE the notification. Asserting it afterwards - // would pass even if the subject fired before the list was assigned, - // which is precisely the ordering the notification exists to guarantee. - typesAtNotification = service.getOperatorTypeList(); - }); - - // Nothing is published before the metadata resolves. - expect(seen).toEqual([]); - - metadata.next({ operators: [mockScanSourceSchema], groups: [] } as unknown as OperatorMetadata); - - expect(seen).toEqual([true]); - expect(typesAtNotification).toEqual([mockScanSourceSchema.operatorType]); - }); }); diff --git a/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.ts b/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.ts index 0760b8841d..8b0c54fd59 100644 --- a/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.ts +++ b/frontend/src/app/workspace/service/workflow-graph/util/workflow-util.service.ts @@ -30,7 +30,6 @@ import { Injectable } from "@angular/core"; import { v4 as uuid } from "uuid"; import Ajv from "ajv"; -import { Observable, Subject } from "rxjs"; import { Workflow, WorkflowContent } from "../../../../common/type/workflow"; import { jsonCast } from "../../../../common/util/storage"; @@ -46,26 +45,12 @@ export class WorkflowUtilService { // used to fetch default values in json schema to initialize new operator private ajv = new Ajv({ useDefaults: true, strict: false }); - private operatorSchemaListCreatedSubject: Subject<boolean> = new Subject<boolean>(); - constructor(private operatorMetadataService: OperatorMetadataService) { this.operatorMetadataService.getOperatorMetadata().subscribe(value => { this.operatorSchemaList = value.operators; - this.operatorSchemaListCreatedSubject.next(true); }); } - public getOperatorSchemaListCreatedStream(): Observable<boolean> { - return this.operatorSchemaListCreatedSubject.asObservable(); - } - - /** - * Returns a list of all available operator types - */ - public getOperatorTypeList(): string[] { - return this.operatorSchemaList.map(schema => schema.operatorType); - } - /** * Generates a new UUID for operator */ @@ -80,20 +65,6 @@ export class WorkflowUtilService { return "link-" + uuid(); } - /** - * Generates a new UUID for group element - */ - public getGroupRandomUUID(): string { - return "group-" + uuid(); - } - - /** - * Generates a new UUID for breakpoint - */ - public getBreakpointRandomUUID(): string { - return "breakpoint-" + uuid(); - } - public getCommentBoxRandomUUID(): string { return "commentBox-" + uuid(); }
