Problem
PurchaseHistoryRecord.MonthlyCost is float64 (not *float64), so a nil/unknown monthly cost is stored as 0. Per feedback_nullable_not_zero, an absent monthly cost coerced to 0 is indistinguishable from a real $0/mo commitment in any downstream sum or average.
File: internal/purchase/execution.go:601, 904-913
The derefFloat64 helper is honest about the coercion in its comment, but the table column type forces the information loss.
Compare: RecommendationRecord.MonthlyCost is already *float64 — this field should mirror that.
Fix
- Change
PurchaseHistoryRecord.MonthlyCost to *float64.
- Add a nullable column migration for the history schema.
- Update all readers/writers that currently dereference the field unconditionally.
Notes
- This is migration-bearing — batch with the next history-schema change.
- Out of scope for the immediate
fix/exchange-fail-loud PR (L4 finding from docs/code-review/19-hardcoded-fallbacks-core.md).
Problem
PurchaseHistoryRecord.MonthlyCostisfloat64(not*float64), so a nil/unknown monthly cost is stored as0. Perfeedback_nullable_not_zero, an absent monthly cost coerced to 0 is indistinguishable from a real $0/mo commitment in any downstream sum or average.File:
internal/purchase/execution.go:601, 904-913The
derefFloat64helper is honest about the coercion in its comment, but the table column type forces the information loss.Compare:
RecommendationRecord.MonthlyCostis already*float64— this field should mirror that.Fix
PurchaseHistoryRecord.MonthlyCostto*float64.Notes
fix/exchange-fail-loudPR (L4 finding fromdocs/code-review/19-hardcoded-fallbacks-core.md).