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-7030-65d769dfe74b845fede8f5fdbabd0b8eed9914c2 in repository https://gitbox.apache.org/repos/asf/texera.git
commit 7d5276de1e7a6ca6f7b8dc92a316ffa0a4ba320a Author: Xinyuan Lin <[email protected]> AuthorDate: Wed Jul 29 18:36:47 2026 -0700 chore(frontend): remove unused environment component and map util (#7030) ### What changes were proposed in this PR? Deletes three frontend files that nothing references. Pure deletion, no behaviour change: **−146 lines**. | Removed | Lines | Why it is dead | | --- | ---: | --- | | `workspace/component/left-panel/environment/environment.component.ts` | 18 | contains only the ASF license header — zero statements | | `common/util/map.ts` | 42 | `mapToRecord` / `recordToMap` have no caller | | `common/util/map.spec.ts` | 86 | covers only the above | `environment.component.ts` has no class, no decorator and no exports, so it cannot be declared in a module, matched by a selector, or loaded by a route. It was the only file in `environment/`, so that directory goes too. `map.ts` predates `Object.fromEntries` and `new Map(Object.entries(...))`, both already available under the project's `lib: ES2022` setting, so nothing needs to replace it. Its spec was added by #6621, which is why the util currently looks live. ### Any related issues, documentation, discussions? Closes #7029 ### How was this PR tested? Existing tests only — this PR adds none, since it removes files and the spec that covered them. - `npx tsc --noEmit -p frontend/tsconfig.json` — exit 0, confirming no dangling imports. - Checked that no build or test config enumerates the deleted paths (`angular.json`, `tsconfig*.json`, `src/test.ts`). Verification that nothing references the removed code, re-runnable by a reviewer: ``` grep -rn "mapToRecord\|recordToMap\|EnvironmentComponent" frontend/src --include=*.ts --include=*.html --include=*.json ``` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5) --- frontend/src/app/common/util/map.spec.ts | 86 ---------------------- frontend/src/app/common/util/map.ts | 42 ----------- .../environment/environment.component.ts | 18 ----- 3 files changed, 146 deletions(-) diff --git a/frontend/src/app/common/util/map.spec.ts b/frontend/src/app/common/util/map.spec.ts deleted file mode 100644 index 88249f738a..0000000000 --- a/frontend/src/app/common/util/map.spec.ts +++ /dev/null @@ -1,86 +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 { mapToRecord, recordToMap } from "./map"; - -describe("mapToRecord", () => { - it("converts a populated Map into an equivalent plain record", () => { - const map = new Map<string, any>([ - ["a", 1], - ["b", "two"], - ["c", { nested: true }], - ]); - expect(mapToRecord(map)).toEqual({ a: 1, b: "two", c: { nested: true } }); - }); - - it("returns an empty object for an empty Map", () => { - expect(mapToRecord(new Map())).toEqual({}); - }); - - it("overwrites an existing key with the latest value", () => { - const map = new Map<string, any>(); - map.set("x", 1); - map.set("y", 2); - map.set("x", 99); // overwrite - expect(mapToRecord(map)).toEqual({ x: 99, y: 2 }); - }); - - it("survives a JSON.stringify round-trip (its stated purpose)", () => { - const map = new Map<string, any>([ - ["k", [1, 2, 3]], - ["flag", false], - ]); - const json = JSON.stringify(mapToRecord(map)); - expect(JSON.parse(json)).toEqual({ k: [1, 2, 3], flag: false }); - }); -}); - -describe("recordToMap", () => { - it("converts a plain record into an equivalent Map", () => { - const map = recordToMap({ a: 1, b: "two" }); - expect(map).toBeInstanceOf(Map); - expect(map.get("a")).toBe(1); - expect(map.get("b")).toBe("two"); - expect(map.size).toBe(2); - }); - - it("returns an empty Map for an empty record", () => { - expect(recordToMap({}).size).toBe(0); - }); - - it("only copies own enumerable keys, not inherited ones", () => { - const proto = { inherited: "nope" }; - const record = Object.create(proto); - record.own = "yes"; - const map = recordToMap(record); - expect(map.has("own")).toBe(true); - expect(map.has("inherited")).toBe(false); - }); -}); - -describe("mapToRecord / recordToMap round-trip", () => { - it("reconstructs the original Map contents", () => { - const original = new Map<string, any>([ - ["one", 1], - ["two", { deep: [true, null] }], - ]); - const rebuilt = recordToMap(mapToRecord(original)); - expect(rebuilt).toEqual(original); - }); -}); diff --git a/frontend/src/app/common/util/map.ts b/frontend/src/app/common/util/map.ts deleted file mode 100644 index 649a10e160..0000000000 --- a/frontend/src/app/common/util/map.ts +++ /dev/null @@ -1,42 +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. - */ - -/** - * Converts ES6 Map object to TS Record object. - * This method is used to stringify Map objects. - * @param map - */ -export function mapToRecord(map: Map<string, any>): Record<string, any> { - const record: Record<string, any> = {}; - map.forEach((value, key) => (record[key] = value)); - return record; -} - -/** - * Converts TS Record object to ES6 Map object. - * This method is used to construct Map objects from JSON. - * @param record - */ -export function recordToMap(record: Record<string, any>): Map<string, any> { - const map = new Map<string, any>(); - for (const key of Object.keys(record)) { - map.set(key, record[key]); - } - return map; -} diff --git a/frontend/src/app/workspace/component/left-panel/environment/environment.component.ts b/frontend/src/app/workspace/component/left-panel/environment/environment.component.ts deleted file mode 100644 index 51da6c0f2b..0000000000 --- a/frontend/src/app/workspace/component/left-panel/environment/environment.component.ts +++ /dev/null @@ -1,18 +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. - */
