fix: Remove legacy TCO fields from vehicle forms #37
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
Issue #29 refactored the Total Cost of Ownership (TCO) feature to be document-driven via the
ownership-costsfeature. However, the legacy TCO fields were not removed from the vehicle forms, creating duplicate data entry points and user confusion.Current State (Broken)
The following legacy fields still exist on VehicleForm (used by both New Vehicle and Edit Vehicle screens):
insuranceCostinsuranceIntervalregistrationCostregistrationIntervaltcoEnabledProblems:
Target State
Affected Areas
Frontend
frontend/src/features/vehicles/components/VehicleForm.tsxfrontend/src/features/vehicles/types/vehicles.types.tsfrontend/src/features/vehicles/pages/VehicleDetailPage.tsxfrontend/src/features/onboarding/components/AddVehicleStep.tsxBackend
backend/src/features/vehicles/domain/vehicles.types.tsbackend/src/features/vehicles/routes/vehicles.routes.tsbackend/src/features/vehicles/domain/vehicles.service.tsDatabase
insurance_cost,insurance_intervalregistration_cost,registration_intervaltco_enabledpurchase_price,purchase_date(valid vehicle attributes)Acceptance Criteria
Out of Scope
References
Plan: Remove Legacy TCO Fields from Vehicle Forms
Phase: Planning | Agent: Planner | Status: AWAITING_REVIEW
Overview
Remove legacy TCO fields (insuranceCost, insuranceInterval, registrationCost, registrationInterval, tcoEnabled) from vehicle forms after the TCO refactor to document-driven ownership-costs feature (#29). Keep purchasePrice and purchaseDate as valid vehicle attributes. No backend or database changes.
Approach: Complete frontend cleanup - remove fields from forms, types, and delete unused components.
Planning Context
Decision Log
Rejected Alternatives
Constraints & Assumptions
Known Risks
Milestones
M1: Update Frontend Types
Files:
frontend/src/features/vehicles/types/vehicles.types.tsRequirements:
CostIntervaltype (line 6)Vehicleinterface (lines 31-35): insuranceCost, insuranceInterval, registrationCost, registrationInterval, tcoEnabledCreateVehicleRequestinterface (lines 55-59)UpdateVehicleRequestinterface (lines 79-83)TCOResponseinterface (lines 86-100)Acceptance Criteria:
M2: Update VehicleForm Component
Files:
frontend/src/features/vehicles/components/VehicleForm.tsxRequirements:
CostIntervalimportcostIntervalOptionsconstantAcceptance Criteria:
M3: Update VehicleDetailPage and Cleanup
Files:
frontend/src/features/vehicles/pages/VehicleDetailPage.tsxfrontend/src/features/vehicles/components/TCODisplay.tsx(DELETE)frontend/src/features/vehicles/api/vehicles.api.tsRequirements:
TCODisplayimport from VehicleDetailPage (line 19)getTCOmethod from vehicles.api.ts (lines 93-99)TCOResponsefrom vehicles.api.ts import (line 6)Acceptance Criteria:
M4: Validation
Requirements:
npm run lint- all checks passnpm run type-check- no type errorsnpm test- all tests passAcceptance Criteria:
Milestone Dependencies
Verdict: AWAITING_REVIEW | Next: Plan review (TW scrub, QR validation)
Milestone: Implementation Complete
Phase: Execution | Agent: Developer | Status: PASS
Changes Made
Files Modified:
frontend/src/features/vehicles/types/vehicles.types.ts- Removed CostInterval type, TCOResponse interface, and TCO fields from Vehicle/Request interfacesfrontend/src/features/vehicles/components/VehicleForm.tsx- Removed TCO schema fields, costIntervalOptions, form UI for insurance/registration/tcoEnabledfrontend/src/features/vehicles/pages/VehicleDetailPage.tsx- Removed TCODisplay import and usagefrontend/src/features/vehicles/api/vehicles.api.ts- Removed getTCO method and TCOResponse importFiles Deleted:
frontend/src/features/vehicles/components/TCODisplay.tsxQuality Checks
9644010on branchissue-37-remove-tco-fieldsAcceptance Criteria Status
Notes
Branch pushed to GitHub remote. Gitea remote has SSH agent connectivity issue.
Verdict: PASS | Next: Create PR when gitea push resolved