# DataOps Platform Codebase Cleanup Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [x]`) syntax for tracking. **Goal:** Remove confirmed historical frontend/backend code while preserving n8n, DataFlow definition and lineage, data-security entry, governance knowledge-base entry, workbench, HOPMS tooling, and active governance/service/review flows. **Architecture:** Treat `frontend/src/router/routes.js` and Flask Blueprint registration as reachability sources. Protect retained capabilities with a dependency-free cleanup contract test, remove legacy code in batches, make `app/` the backend source of truth, and verify with static contracts, Python tests, frontend dependency installation, and a production build. **Tech Stack:** Vue 2, Vue Router 3, Vuex, Flask, Python unittest/pytest, Node.js 24 LTS target with Node.js 22 LTS compatibility fallback, npm. --- ### Task 1: Establish Recovery and Cleanup Contracts **Files:** - Backup: `/Users/maxiaolong/Documents/Codex/2026-07-06/g-i/DataOps-platform-backup-before-cleanup-20260716-170321.tar.gz` - Create: `tests/test_cleanup_contract.py` - [x] Verify the backup contains `.git`, `app/`, `frontend/`, `database/`, and the analysis report; record its SHA-256. - [x] Add dependency-free unittest assertions that retained routes/files exist and confirmed legacy paths/routes/API strings do not exist. - [x] Run `python3 -m unittest tests.test_cleanup_contract -v` and confirm RED failures identify the current legacy code. ### Task 2: Prune Frontend Routes and Historical Pages **Files:** - Modify: `frontend/src/router/routes.js` - Modify: `frontend/src/router/defaultRoute.js` - Delete: `frontend/src/views/dataChart/` - Delete: `frontend/src/views/modelSystem/` - Delete: `frontend/src/views/dataAsset/` - Delete: `frontend/src/views/dataDiagram/` - Delete: `frontend/src/views/questionnaireInquiry/` - Delete: `frontend/src/views/knowledgeBaseResume/` - Delete: `frontend/src/views/dataGovernance/dataResource/` - Delete: `frontend/src/views/dataGovernance/dataModules/` - Delete: `frontend/src/views/dataGovernance/dataIndicator/` - Delete: `frontend/src/views/dataBook/dataResource/` - Delete: `frontend/src/views/dataBook/dataModel/` - Delete: `frontend/src/views/dataBook/indicator/` - Delete: old non-n8n directories under `frontend/src/views/dataFactory/` - Delete: old data-origin pages after confirming `dataGovernance/dataSource` has no component dependency on them - Delete: old system-management pages while retaining `frontend/src/views/systemManage/error/404.vue` - [x] Remove active and commented legacy route blocks; restore the Data Security route as a visible placeholder. - [x] Keep `/home`, `/knowledge-base-product` as the future governance knowledge-base entry, active governance/data-book pages, n8n production-line link, `/dataFactory/workflow`, data service, and data review. - [x] Remove `/update` from base routes and retain only the generic 404 component from system management. - [x] Scan retained components for imports of deleted views. ### Task 3: Slim Frontend API and Shared Components **Files:** - Replace: `frontend/src/api/dataFactory.js` with the ten n8n adapter calls only - Modify: `frontend/src/api/dataGovernance.js` - Modify: `frontend/src/api/dataOrigin.js` - Modify: retained shared data-book components that default to removed resource/model APIs - Delete: `frontend/src/api/dataChart.js` - Delete: `frontend/src/api/chartCustomized.js` - Delete: `frontend/src/api/report.js` - Delete: `frontend/src/api/productionLine.js` - Delete: obsolete API modules used only by removed system-management pages - [x] Remove Data Resource, Data Model, Data Indicator, Vanna training, and DataFlow execute/status/log client functions. - [x] Keep DataFlow list/detail/CRUD, business-domain list, and script retrieval. - [x] Remove business-card API functions while preserving `/datasource/*` functions. - [x] Make shared graph/info components require explicit APIs or use retained metadata/business-domain APIs. - [x] Scan all retained Vue/JS files for imports of deleted API exports. ### Task 4: Remove Backend DataFlow Runtime and Obsolete Subsystems **Files:** - Modify: `app/api/data_flow/routes.py` - Modify: `app/core/data_flow/dataflows.py` - Mirror generated deployment output only after `app/` is correct - Delete: `mcp-servers/task-manager/` - [x] Remove `/execute-dataflow/{id}`, `/get-dataflow-status/{id}`, and `/get-dataflow-logs/{id}` routes. - [x] Remove the matching mock service methods without touching DataFlow CRUD, relationships, task/script metadata, product lineage, or n8n Workflow generation. - [x] Remove the independent task-manager MCP service and stale documentation references. - [x] Verify `/api/datafactory/workflows*`, execution records, health check, generated n8n JSON, and order `onboard` remain referenced. ### Task 5: Make `app/` the Source of Truth and Clean Configuration/DDL **Files:** - Review and merge: the 12 differing files under `deployment/app/` into `app/` - Modify: `app/config/config.py` - Modify: `deployment/dataops.env` - Modify: `docs/CODE_DOCUMENTATION.md` - Delete: historical SQL files for calendar, WeChat, business cards, hotel brands, and hotel positions from `database/` and `deployment/database/` - [x] Merge only still-valid DeepSeek, environment loading, timezone, logging, health-check, and production fixes into `app/`. - [x] Remove Airflow configuration and Qwen generative fallback while leaving room for a separately scoped future Qwen Embedding client. - [x] Keep core orders/products/review/version/task DDL and HOPMS assets/tests/results. - [x] Regenerate `deployment/app/` and `deployment/database/` from source through the repository sync mechanism, then verify no reverse drift remains. ### Task 6: Upgrade the Frontend Runtime Baseline **Files:** - Modify: `frontend/package.json` - Modify: lockfile produced by the selected package manager - Add if useful: `frontend/.nvmrc` - [x] Change the engine from Node 14 to Node 24 LTS. - [x] Install dependencies and run the production build under Node 24. - [x] Confirm Node 24 builds successfully; keep Vue 2 unchanged and record legacy dependency warnings for the next phase. - [x] Do not perform Vue 3 migration in this cleanup. ### Task 7: Verify the Cleaned Baseline **Files:** - Update: `docs/2026-07-16_codebase_full_analysis_and_iteration_baseline.md` - Update: this plan's checkboxes - [x] Run the cleanup contract test and confirm all assertions pass. - [x] Run Python syntax compilation and the available backend test suite in an isolated environment with requirements installed. - [x] Run frontend production build and scan build output for missing modules. - [x] Recount backend routes and frontend API calls; document before/after totals. - [x] Run `rg` scans for Vanna, Airflow, removed routes, old data-factory calls, business-card APIs, and deleted components. - [x] Review `git diff --check` and `git status --short`; confirm the pre-existing route edit and report remain preserved.