- Rewrite CLAUDE.md to match current 8-service architecture (was 11, 5 deleted) - Remove all as-any casts in OrderDetail.tsx (9 casts → 0) - Add cad_parsed_objects/cad_part_materials to OrderItem interface - Rename require_admin → require_global_admin across 6 router files (22 calls) - Remove EXPORT_GLB_PRODUCTION enum + generate_gltf_production_task (dead code) - Remove worker-thumbnail from ALLOWED_SERVICES, replace Flamenco link - Delete obsolete PLAN.md (1455 lines) and PLAN_REFACTOR.md (1174 lines) - Fix digit-only USD prim names with p_ prefix Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7.4 KiB
Plan: P12 — Codebase Hygiene Sprint (CLAUDE.md + Type Safety + Stale References)
Date: 2026-03-13 | Branch: refactor/v2
Context
All 10 roadmap priorities are complete. A codebase scan reveals three categories of debt:
-
CLAUDE.md is dangerously stale: References 11 services (4 deleted),
worker-thumbnail(nowrender-worker),blender-renderer/threejs-renderer/flamenco(all removed), wrong roles (admininstead ofglobal_admin/tenant_admin), deleted STL endpoints, and wrong task locations. Since CLAUDE.md is the AI instruction file, every future conversation gets wrong context. -
Frontend type safety: 4 unnecessary
(rp as any).cancelledcasts in OrderDetail.tsx (the type already hascancelled), plus 4(item as any).cad_parsed_objects/cad_part_materialscasts (need 2 fields added toOrderIteminterface). -
Stale service references:
worker-thumbnailin the/scaleendpoint'sALLOWED_SERVICES, hardcodedhttp://localhost:8080Flamenco link in OrderDetail.tsx, and obsoletePLAN.md+PLAN_REFACTOR.mdfiles in the repo root.
Parallelization: All 4 tracks are independent and can run in parallel.
Affected Files
| File | Change |
|---|---|
CLAUDE.md |
Full rewrite — update services, queues, roles, endpoints, structure |
frontend/src/pages/OrderDetail.tsx |
Remove (rp as any) casts (4 sites), remove (item as any) casts (4 sites), remove Flamenco hardcoded link |
frontend/src/api/orders.ts |
Add cad_parsed_objects and cad_part_materials to OrderItem interface |
backend/app/api/routers/worker.py |
Remove worker-thumbnail from ALLOWED_SERVICES |
PLAN.md |
Delete (superseded by ROADMAP.md) |
PLAN_REFACTOR.md |
Delete (superseded by ROADMAP.md) |
Tasks (in order)
Track A — CLAUDE.md Rewrite
[x] Task 1: Update CLAUDE.md to match current architecture — DONE
- File:
CLAUDE.md - What: Full rewrite of the project instructions file:
- Ziel: Remove "Flamenco" reference
- Tech Stack: Remove Flamenco, Three.js (Playwright), cadquery (STEP→STL). Add: MinIO (S3-compatible storage), OCC (cadquery/OCP for STEP parsing), GMSH (tessellation), usd-core (USD export)
- Services table: 8 services (postgres, redis, minio, backend, worker, render-worker, beat, frontend). Remove blender-renderer, threejs-renderer, worker-thumbnail, flamenco-manager, flamenco-worker
- Logs section:
docker compose logs -f render-worker(not worker-thumbnail or blender-renderer). Rebuild:docker compose up -d --build backend worker render-worker beat - Credentials: Remove Flamenco Manager line
- Project structure: Remove
blender-renderer/,threejs-renderer/,flamenco/. Addrender-worker/scripts/. Updatetasks/description to mention it's a compatibility shim, active tasks indomains/pipeline/tasks/. Adddomains/directory - Celery queues:
asset_pipelinequeue onrender-worker(notworker-thumbnail). Remove "blender-renderer only 1 request" note — now it's "render-worker concurrency=1 because Blender is single-threaded". Addthumbnail_renderingif it's different fromasset_pipeline— CHECK: docker-compose saysasset_pipeline - Roles: Add
global_admin,tenant_admin. Update table to 4 roles - API endpoints: Remove
generate-stl/{quality},generate-missing-stls. Addgenerate-usd-master,generate-gltf-geometry,scene-manifest - Bekannte Eigenheiten: Remove Flamenco GPU note
- Pipeline section: Update to mention OCC/GMSH tessellation, USD export
- Acceptance gate:
grep -c "blender-renderer\|threejs-renderer\|flamenco\|worker-thumbnail\|11 Services" CLAUDE.mdreturns 0 - Dependencies: none
- Risk: None. Documentation only.
Track B — Frontend Type Safety
[x] Task 2: Fix as any casts in OrderDetail.tsx and OrderItem type — DONE
- Files:
frontend/src/api/orders.ts,frontend/src/pages/OrderDetail.tsx - What:
- Add to
OrderIteminterface inorders.ts:cad_parsed_objects: string[] | null cad_part_materials: Array<{ part_name: string; material_name: string; [key: string]: unknown }> - Remove
(rp as any).cancelled→ justrp.cancelled(4 sites in OrderDetail.tsx — the type already hascancelled: number) - Remove
(item as any).cad_parsed_objects→item.cad_parsed_objects(2 sites) - Remove
(item as any).cad_part_materials→item.cad_part_materials(1 site) - For
(item as any)[c.key]dynamic access: replace with(item as Record<string, unknown>)[c.key](narrower cast)
- Add to
- Acceptance gate:
grep -c "as any" frontend/src/pages/OrderDetail.tsxdecreases by at least 8. Rundocker compose exec frontend npx tsc --noEmit— no new errors - Dependencies: none
- Risk: Low. Type-only changes, no behavioral change. Must run tsc check.
Track C — Stale Backend Reference
[x] Task 3: Remove worker-thumbnail from scale endpoint — DONE
- File:
backend/app/api/routers/worker.py - What:
- Remove
"worker-thumbnail"fromALLOWED_SERVICESset (line 424) - Update the
ScaleRequestdocstring/comment (line 367) to list only"render-worker" | "worker" - Update the endpoint docstring (line 414) to remove
worker-thumbnail
- Remove
- Acceptance gate:
grep "worker-thumbnail" backend/app/api/routers/worker.pyreturns 0 matches - Dependencies: none
- Risk: None.
worker-thumbnailservice doesn't exist in docker-compose.
Track D — Delete Obsolete Files + Flamenco Link
[x] Task 4: Delete PLAN.md, PLAN_REFACTOR.md, and remove Flamenco hardcoded link — DONE
- Files:
PLAN.md,PLAN_REFACTOR.md,frontend/src/pages/OrderDetail.tsx - What:
- Delete
PLAN.md(superseded by ROADMAP.md — noted in the Archive section) - Delete
PLAN_REFACTOR.md(superseded by ROADMAP.md) - In OrderDetail.tsx (~line 942–950): Remove the
localhost:8080Flamenco link block. Replace with just the job ID text (sincerender_backend_used === 'flamenco'only applies to historical data, show the ID as plain text instead of a broken link)
- Delete
- Acceptance gate:
ls PLAN.md PLAN_REFACTOR.md 2>&1 | grep "No such file"succeeds.grep "localhost:8080" frontend/src/pages/OrderDetail.tsxreturns 0 matches - Dependencies: none
- Risk: Low. PLAN files are archived references. Flamenco link is non-functional (service removed).
Migration Check
No. No database changes.
Order Recommendation
Fully parallel — all 4 tracks independent:
- Agent 1: Task 1 (CLAUDE.md rewrite) — largest, highest impact
- Agent 2: Task 2 (frontend type safety)
- Agent 3: Task 3 (worker.py cleanup)
- Agent 4: Task 4 (file deletion + Flamenco link)
Risks / Open Questions
-
CLAUDE.md as AI instructions: This file is loaded into every AI conversation as project context. Getting it wrong means every future session starts with bad information. The rewrite must be verified against the actual docker-compose.yml and codebase.
-
OrderItem
cad_part_materialstype: Backend returnslist[dict]— need to check what keys the dicts actually contain. The frontend usespart_nameandmaterial_namebased on grep of CadPartMaterials component. -
require_admin_or_pmrename: 71 occurrences across 13 files could be renamed torequire_pm_or_abovefor consistency. Deferred — it's high churn, low impact (the alias works correctly), and can be a separate micro-task later.