Tech/migrate state util into features (#4504)
* refactor(visualization): move gameObjectsParser util into navBar feature Sole consumer is navBar/services/readFiles.ts; relocate the whole gameObjectsParser module (importer, validator, schema, mocks, specs) into features/navBar/util/. Verified by dependency-cruiser (0 errors) and jest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): remove dead truncateText pipe TruncateTextPipe had no template usage and no class references outside its own spec. Removing the orphan. dependency-cruiser clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: record verified outcome of state/util-into-features analysis Re-verified every fan-out move candidate against the real import graph with dependency-cruiser + jest. Most util predictions were wrong (grep blind spot for intra-util relative imports / state-core consumers / app.config effect registration). Only gameObjectsParser move + dead truncateText pipe deletion held up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): drop dead buildingArrayToMap to break treeMapHelper cycle buildingArrayToMap had no production callers (only its own test) and was the sole reason util/algorithm/treeMapHelper imported CodeMapBuilding from the codeMap feature. Removing it eliminates the util->feature inversion and 30 of the 126 no-circular warnings (126 -> 96). CodeMapBuilding stays in the codeMap feature where it belongs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): move CodeMapBuilding fixtures out of dataMocks into codeMap The 5 CodeMapBuilding test fixtures (CODE_MAP_BUILDING*, CONSTANT_HIGHLIGHT) lived in the shared util/dataMocks god-file but are consumed only by codeMap specs, forcing util/ to import up into the codeMap feature. Move them to a codeMap-owned features/codeMap/rendering/codeMapBuilding.mocks.ts and repoint the 3 codeMap specs. Removes the last util->codeMap inversion; CodeMapBuilding stays in the feature. dependency-cruiser 0 errors, 143 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: record CodeMapBuilding dependency-inversion cleanup Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): extract dataMocks from util into its own mocks/ root folder dataMocks is a ~2500-line cross-layer test-fixture file that was sitting in util/ and obscuring real util problems. Move it to app/codeCharta/mocks/ (a sibling of util/), repoint all 57 importers, and fix its one same-dir import (./codeMapHelper -> ../util/codeMapHelper). Pure relocation: dependency-cruiser 0 errors, tests green across every import depth. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * build(visualization): exclude test fixtures from dependency-cruiser analysis dataMocks (now in mocks/) and *.mocks.ts files are test fixtures, not production architecture, yet dataMocks alone added ~67 edges as a hub node that obscured real structure in the graph. Exclude mocks/ and *.mocks.ts so the dependency graph and boundary rules reflect production code only (fixtures are imported solely by tests). 4622 -> 4555 dependencies cruised. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): remove dead mockHelper mockHelper.ts had zero references anywhere (production or test). Orphan, like the truncateText pipe — removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): move file-ingestion parser into loadFile feature fileParser + fileValidator are consumed only by loadFile in production, so relocate them to features/loadFile/util/. The one cross-feature consumer (the globalSettings spec using getNameDataPair) now imports it via loadFile's public facade, which is the depcruise-legal way to cross features. generatedSchema.json stays in util/ (generated artifact) and is imported feature->util. mockHelper already removed. dependency-cruiser 0 errors, 74 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): break codeCharta.model import cycles codeCharta.model (the leaf domain types) was reaching up into two higher layers, forming type-only cycles: - NameDataPair.content needed ExportCCFile -> codeCharta.model <-> codeCharta.api.model - CcState.files needed FileState -> codeCharta.model <-> model/files/files Fix by making the leaf stop importing upward: - Move NameDataPair into codeCharta.api.model (next to ExportCCFile); repoint its 8 type importers. - Move FileState/FileSelectionState into codeCharta.model; model/files/files re-exports them (natural files->model direction), so its 47 importers are untouched. Both edges removed: dependency-cruiser warnings 96 -> 94, 0 errors, tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(visualization): correct fileValidator path in navBar e2e The fileValidator move left a 4-level relative path pointing at codeCharta/ instead of features/loadFile/. e2e files aren't type-checked by jest and depcruise ignores unresolvable modules, so tsc surfaced it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): split codeCharta.model into domain + state behind a barrel Step 1 of incrementally breaking up the 363-line model god-file. Definitions now live in model/domain.model.ts (leaf .cc.json domain types) and model/state.model.ts (the ngrx state tree, which imports the domain one-way). codeCharta.model.ts becomes a pure barrel re-exporting both, so all 416 existing importers keep working unchanged. Consumers can migrate to the specific files over time, then the barrel can be dropped. Verified: dependency-cruiser 0 errors / 94 warnings / no new cycles, tsc 0 errors across all importers, model tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(visualization): consolidate cc.json read path into loadFile + pin the wire DTO loadFile now owns cc.json ingestion: moved urlExtractor in, and extracted the wire-parsing functions (getCCFile, getCCFileAndDecorateFileChecksum) out of the mixed util/fileHelper into loadFile/util/ccFileHelper. The cross-feature callers reach them through loadFile's facade (navBar upload, globalSettings url-reset). util/fileHelper keeps only getSelectedFilesSize (a FileState helper, no wire format). fileDownloader (export side) stays shared. Adds a dependency-cruiser rule 'wire-dto-only-in-serialization-boundary' that confines codeCharta.api.model to the loadFile feature, the navBar gameObjects importer, and util/fileDownloader — so rendering/state/UI can't couple to the wire format and the upcoming cc.json 2.0 change stays contained to the converter. tsc 0 errors, dependency-cruiser 0 errors / 94 warnings, tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: clean up irrelevant files --------- Co-authored-by: Christian Hühn <christian.huehn@maibornwolff.de> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
C
Christian Hühn committed
76da06841d62ca271bdaea778fe890eb898cce5e
Parent: 066912e
Committed by GitHub <noreply@github.com>
on 6/29/2026, 6:58:46 AM