[Arch] Duplicate/shadow Shipment type definitions (api.ts vs types/shipment.ts) #61

Closed
opened 2026-07-01 07:27:03 +02:00 by bullitt · 1 comment
Owner

Severity: Medium | Category: Frontend

Shipment/ShipmentEvent/Parser are defined independently in frontend/src/lib/api.ts:9-49 and again in frontend/src/types/shipment.ts:14-41, with divergent shapes. Every page imports from @/lib/api; types/shipment.ts is effectively dead/shadow duplication.

Recommendation: Make one file the single source of truth (fold types/shipment.ts into api.ts or vice versa), delete the other.

Full detail: docs/architecture-review.md § C + § H.5

**Severity:** Medium | **Category:** Frontend `Shipment`/`ShipmentEvent`/`Parser` are defined independently in `frontend/src/lib/api.ts:9-49` and again in `frontend/src/types/shipment.ts:14-41`, with divergent shapes. Every page imports from `@/lib/api`; `types/shipment.ts` is effectively dead/shadow duplication. **Recommendation:** Make one file the single source of truth (fold `types/shipment.ts` into `api.ts` or vice versa), delete the other. Full detail: `docs/architecture-review.md` § C + § H.5
Author
Owner

Fixed on branch architecture-rework, commit 0991956: frontend/src/types/shipment.ts deleted; ShipmentState inlined into lib/api.ts, which every page already imported from. Verified: tsc --noEmit, eslint, knip, vite build all pass.

Fixed on branch `architecture-rework`, commit 0991956: `frontend/src/types/shipment.ts` deleted; `ShipmentState` inlined into `lib/api.ts`, which every page already imported from. Verified: `tsc --noEmit`, `eslint`, `knip`, `vite build` all pass.
Sign in to join this conversation.
No labels
arch
harness
security
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bullitt/trackbox#61
No description provided.