Issue #29 refactored the Total Cost of Ownership (TCO) feature to be document-driven via the ownership-costs feature. 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):
Field
Location
Status
insuranceCost
VehicleForm
Should be removed
insuranceInterval
VehicleForm
Should be removed
registrationCost
VehicleForm
Should be removed
registrationInterval
VehicleForm
Should be removed
tcoEnabled
VehicleForm
Should be removed
TCODisplay component
VehicleDetailPage
Should be removed
Problems:
These fields are marked as required in the form schema, blocking vehicle creation/editing
Insurance/registration costs should now be entered via the documents feature (linked to ownership-costs per #29)
TCO display is being moved to a future reporting feature
Users see duplicate cost entry points, creating confusion
Target State
Vehicle forms only collect vehicle attributes (VIN, year, make, model, purchase price, purchase date, etc.)
No recurring cost fields on vehicle forms
No TCO display on vehicle detail page (moved to future reporting feature)
Vehicle detail page shows associated documents only
## Problem Statement
Issue #29 refactored the Total Cost of Ownership (TCO) feature to be document-driven via the `ownership-costs` feature. 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):
| Field | Location | Status |
|-------|----------|--------|
| `insuranceCost` | VehicleForm | Should be removed |
| `insuranceInterval` | VehicleForm | Should be removed |
| `registrationCost` | VehicleForm | Should be removed |
| `registrationInterval` | VehicleForm | Should be removed |
| `tcoEnabled` | VehicleForm | Should be removed |
| TCODisplay component | VehicleDetailPage | Should be removed |
**Problems:**
1. These fields are marked as **required** in the form schema, blocking vehicle creation/editing
2. Insurance/registration costs should now be entered via the documents feature (linked to ownership-costs per #29)
3. TCO display is being moved to a future reporting feature
4. Users see duplicate cost entry points, creating confusion
### Target State
- Vehicle forms only collect vehicle attributes (VIN, year, make, model, purchase price, purchase date, etc.)
- No recurring cost fields on vehicle forms
- No TCO display on vehicle detail page (moved to future reporting feature)
- Vehicle detail page shows associated documents only
## Affected Areas
### Frontend
- `frontend/src/features/vehicles/components/VehicleForm.tsx`
- Remove insuranceCost, insuranceInterval fields (lines ~844-920)
- Remove registrationCost, registrationInterval fields (lines ~921-982)
- Remove tcoEnabled checkbox
- Update Zod schema to remove these fields
- `frontend/src/features/vehicles/types/vehicles.types.ts`
- Remove TCO field types from VehicleFormData
- `frontend/src/features/vehicles/pages/VehicleDetailPage.tsx`
- Remove TCODisplay component usage
- Keep documents section display
- `frontend/src/features/onboarding/components/AddVehicleStep.tsx`
- Verify form changes propagate correctly
### Backend
- `backend/src/features/vehicles/domain/vehicles.types.ts`
- Remove TCO fields from vehicle types (or mark as deprecated)
- `backend/src/features/vehicles/routes/vehicles.routes.ts`
- Update create/update schemas to not require TCO fields
- `backend/src/features/vehicles/domain/vehicles.service.ts`
- Remove any TCO calculation logic (or mark for future reporting feature)
### Database
- Consider migration to drop legacy columns (or defer to reporting feature work):
- `insurance_cost`, `insurance_interval`
- `registration_cost`, `registration_interval`
- `tco_enabled`
- **Keep**: `purchase_price`, `purchase_date` (valid vehicle attributes)
## Acceptance Criteria
- [ ] New Vehicle screen does not show insurance/registration cost fields
- [ ] Edit Vehicle screen does not show insurance/registration cost fields
- [ ] New Vehicle screen does not show TCO enabled checkbox
- [ ] Edit Vehicle screen does not show TCO enabled checkbox
- [ ] Vehicle Detail page does not show TCODisplay component
- [ ] Vehicle Detail page still shows associated documents
- [ ] Vehicle creation works without providing TCO fields
- [ ] Vehicle editing works without TCO fields
- [ ] Purchase price and purchase date fields remain on vehicle form
- [ ] Mobile and desktop responsive design maintained
- [ ] Existing vehicles with TCO data are not broken (graceful handling)
## Out of Scope
- TCO reporting feature (future work)
- Database column removal (defer to reporting feature migration)
- Ownership-costs feature changes (already working per #29)
## References
- Related: #29 (TCO refactor - document-driven costs)
- Related: #31 (Document feature enhancements)
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
Decision
Reasoning Chain
Complete cleanup over partial removal
Legacy fields moved to ownership-costs feature in #29 -> keeping unused types creates confusion -> delete old code per CLAUDE.md guidelines
Keep purchasePrice/purchaseDate
Issue #37 explicitly requires these fields remain -> valid vehicle attributes not related to recurring costs
Delete TCODisplay.tsx
Component no longer used -> CLAUDE.md mandates 'delete old code when replacing it' -> future reporting feature can recreate if needed
No backend changes
Issue #37 out of scope -> TCO endpoint needed for future reporting feature -> backend fields already optional
No new tests
Field removal task -> existing tests validate form functionality -> default-conventions: 'do not test simple code'
Rejected Alternatives
Alternative
Why Rejected
Keep form fields hidden
Creates confusion, fields still in schema causing type mismatches with no user benefit
Deprecate with warnings
Adds complexity, fields already moved to ownership-costs in #29, no gradual transition needed
Remove backend endpoint
Future reporting feature needs TCO calculation (out of scope per issue)
Constraints & Assumptions
Backend TCO fields remain optional (no breaking changes)
Database columns preserved for future reporting feature
Mobile + desktop responsive design must be maintained
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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