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-9224-4b393c4ac559932e90919aa3019a9aa630dc0767 in repository https://gitbox.apache.org/repos/asf/texera.git
commit c69988905955acea184284834aed26ee065336ce Author: Xinyuan Lin <[email protected]> AuthorDate: Mon Nov 2 06:13:55 2026 +0000 refactor(frontend): drop orphaned test fixtures and mocks (#9224) ### What changes were proposed in this PR? Removes unreferenced legacy test fixtures, mock data, and stub services across frontend workspace and dashboard test suites: 1. `frontend/src/app/workspace/service/execute-workflow/mock-result-data.ts`: - Drops orphaned file (-88 lines) containing `mockData`, `mockResultSnapshotUpdate`, `mockResultPaginationUpdate`, `mockResultOperator`, and `mockResultPoint` with zero references across the repository. 2. `frontend/src/app/dashboard/service/user/model/stub-model.service.ts`: - Drops orphaned in-memory `StubModelService` class (-47 lines) with zero callers or imports. 3. `frontend/src/app/workspace/service/execute-workflow/mock-workflow-plan.ts`: - Drops unreferenced mock plans `mockWorkflowPlan_scan_sentiment_result` and `mockLogicalPlan_scan_sentiment_result` (-41 lines). - Drops companion unused imports `mockScanSentimentLink`, `mockSentimentPredicate`, `mockSentimentResultLink` (-8 lines). 4. `frontend/src/app/workspace/service/operator-metadata/mock-operator-metadata.data.ts`: - Drops unreferenced `testJsonSchema` definition (-17 lines). - Drops companion unused import `CustomJSONSchema7` (-1 line). **+1/-202 lines.** Pure refactoring with no behavior change. ### Any related issues, documentation, discussions? Closes #9223. ### How was this PR tested? - Prettier check passed: ```bash yarn prettier --check src/app/workspace/service/execute-workflow/mock-workflow-plan.ts src/app/workspace/service/operator-metadata/mock-operator-metadata.data.ts ``` - Unit tests passed: ```bash yarn ng test --watch=false --include='src/app/workspace/service/execute-workflow/execute-workflow.service.spec.ts' yarn ng test --watch=false --include='src/app/workspace/service/operator-metadata/operator-metadata.service.spec.ts' ``` - Verified 0 callers or imports repo-wide on `origin/main` for `StubModelService`, `mock-result-data`, `mockWorkflowPlan_scan_sentiment_result`, `mockLogicalPlan_scan_sentiment_result`, and `testJsonSchema`. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Antigravity (Claude Opus 5.5) --- .../service/user/model/stub-model.service.ts | 47 ------------ .../service/execute-workflow/mock-result-data.ts | 88 ---------------------- .../service/execute-workflow/mock-workflow-plan.ts | 50 +----------- .../mock-operator-metadata.data.ts | 18 ----- 4 files changed, 1 insertion(+), 202 deletions(-) diff --git a/frontend/src/app/dashboard/service/user/model/stub-model.service.ts b/frontend/src/app/dashboard/service/user/model/stub-model.service.ts deleted file mode 100644 index d7f37a637c..0000000000 --- a/frontend/src/app/dashboard/service/user/model/stub-model.service.ts +++ /dev/null @@ -1,47 +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 { Injectable } from "@angular/core"; -import { Observable, of } from "rxjs"; -import { DashboardModel } from "../../../type/dashboard-model.interface"; - -/** - * In-memory ModelService double, so specs rendering a Models view need no HttpTestingController. - */ -@Injectable() -export class StubModelService { - constructor(private models: DashboardModel[] = []) {} - - public retrieveAccessibleModels(): Observable<DashboardModel[]> { - return of(this.models); - } - - public deleteModel(mid: number): Observable<Response> { - this.models = this.models.filter(model => model.model.mid !== mid); - return of({} as Response); - } - - public updateModelName(): Observable<Response> { - return of({} as Response); - } - - public updateModelDescription(): Observable<Response> { - return of({} as Response); - } -} diff --git a/frontend/src/app/workspace/service/execute-workflow/mock-result-data.ts b/frontend/src/app/workspace/service/execute-workflow/mock-result-data.ts deleted file mode 100644 index 16d6eefd72..0000000000 --- a/frontend/src/app/workspace/service/execute-workflow/mock-result-data.ts +++ /dev/null @@ -1,88 +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 { WebDataUpdate, WebPaginationUpdate } from "../../types/execute-workflow.interface"; -import { OperatorPredicate, Point } from "../../types/workflow-common.interface"; -import { IndexableObject } from "ng-zorro-antd/core/types"; - -export const mockData: IndexableObject[] = [ - { - id: 1, - layer: "Disk Space and I/O Managers", - duty: "Manage space on disk (pages), including extents", - slides: "slide 2", - }, - { - id: 2, - layer: "Buffer Manager", - duty: "DB-oriented page replacement schemes", - slides: "slide 3", - }, - { - id: 3, - layer: "System Catalog", - duty: "Info about physical data, tables, indexes", - slides: "slides 4 and 5", - }, - { - id: 4, - layer: "Access methods", - duty: "Index structures for access based on field values.", - slides: "B+ tree: slides 6 and 7. Hashing: slide 8. Indexing Performance: slide 9.", - }, - { - id: 5, - layer: "Plan Executor + Relational Operators", - duty: "Runtime side of query processing", - slides: "Sorting: slide 10. Selection+Projection: slide 11. Join: slide 12. Set operations: slide 13.", - }, - { - id: 6, - layer: "Query Optimizer", - duty: "Rewrite query logically. Perform cost-based optimization", - slides: "Cost estimation: slide 14. SystemR Optimizer: slide 15", - }, -]; - -export const mockResultSnapshotUpdate: WebDataUpdate = { - mode: { type: "SetSnapshotMode" }, - table: mockData, -}; - -export const mockResultPaginationUpdate: WebPaginationUpdate = { - mode: { type: "PaginationMode" }, - dirtyPageIndices: [1], - totalNumTuples: mockData.length, -}; - -export const mockResultOperator: OperatorPredicate = { - operatorID: "operator-sink", - operatorType: "ViewResults", - operatorProperties: {}, - inputPorts: [], - outputPorts: [], - showAdvanced: false, - isDisabled: false, - operatorVersion: "1.0", -}; - -export const mockResultPoint: Point = { - x: 1, - y: 1, -}; diff --git a/frontend/src/app/workspace/service/execute-workflow/mock-workflow-plan.ts b/frontend/src/app/workspace/service/execute-workflow/mock-workflow-plan.ts index c7222345b2..872b6a98d8 100644 --- a/frontend/src/app/workspace/service/execute-workflow/mock-workflow-plan.ts +++ b/frontend/src/app/workspace/service/execute-workflow/mock-workflow-plan.ts @@ -18,14 +18,7 @@ */ import { WorkflowGraph } from "../workflow-graph/model/workflow-graph"; -import { - mockResultPredicate, - mockScanPredicate, - mockScanResultLink, - mockScanSentimentLink, - mockSentimentPredicate, - mockSentimentResultLink, -} from "../workflow-graph/model/mock-workflow-data"; +import { mockResultPredicate, mockScanPredicate, mockScanResultLink } from "../workflow-graph/model/mock-workflow-data"; import { LogicalPlan } from "../../types/execute-workflow.interface"; export const mockWorkflowPlan_scan_result: WorkflowGraph = new WorkflowGraph( @@ -61,44 +54,3 @@ export const mockLogicalPlan_scan_result: LogicalPlan = { opsToViewResult: [], opsToReuseResult: [], }; - -export const mockWorkflowPlan_scan_sentiment_result: WorkflowGraph = new WorkflowGraph( - [mockScanPredicate, mockSentimentPredicate, mockResultPredicate], - [mockScanSentimentLink, mockSentimentResultLink] -); - -export const mockLogicalPlan_scan_sentiment_result: LogicalPlan = { - operators: [ - { - ...mockScanPredicate.operatorProperties, - operatorID: mockScanPredicate.operatorID, - operatorType: mockScanPredicate.operatorType, - }, - { - ...mockSentimentPredicate.operatorProperties, - operatorID: mockSentimentPredicate.operatorID, - operatorType: mockSentimentPredicate.operatorType, - }, - { - ...mockResultPredicate.operatorProperties, - operatorID: mockResultPredicate.operatorID, - operatorType: mockResultPredicate.operatorType, - }, - ], - links: [ - { - fromOpId: mockScanPredicate.operatorID, - fromPortId: { id: 0, internal: false }, - toOpId: mockSentimentPredicate.operatorID, - toPortId: { id: 0, internal: false }, - }, - { - fromOpId: mockSentimentPredicate.operatorID, - fromPortId: { id: 0, internal: false }, - toOpId: mockResultPredicate.operatorID, - toPortId: { id: 0, internal: false }, - }, - ], - opsToViewResult: [], - opsToReuseResult: [], -}; diff --git a/frontend/src/app/workspace/service/operator-metadata/mock-operator-metadata.data.ts b/frontend/src/app/workspace/service/operator-metadata/mock-operator-metadata.data.ts index 5bede97504..54e4d19483 100644 --- a/frontend/src/app/workspace/service/operator-metadata/mock-operator-metadata.data.ts +++ b/frontend/src/app/workspace/service/operator-metadata/mock-operator-metadata.data.ts @@ -18,7 +18,6 @@ */ import { GroupInfo, OperatorMetadata, OperatorSchema } from "../../types/operator-schema.interface"; -import { CustomJSONSchema7 } from "../../types/custom-json-schema.interface"; import { VIEW_RESULT_OP_TYPE } from "../workflow-graph/model/workflow-graph"; import { PortSchema } from "../../types/workflow-common.interface"; @@ -433,23 +432,6 @@ export const mockOperatorMetaData: OperatorMetadata = { groups: mockOperatorGroup, }; -export const testJsonSchema: CustomJSONSchema7 = { - properties: { - attribute: { - type: "string", - title: "attribute", - autofill: "attributeName", - autofillAttributeOnPort: 0, - }, - resultAttribute: { - type: "string", - title: "result attribute", - }, - }, - required: ["attribute", "resultAttribute"], - type: "object", -}; - export const mockPortSchema: PortSchema = { jsonSchema: { type: "object",
