Reconcile calculation audit and changelog with degradation work #21
No reviewers
Labels
No labels
bug
decision
docs
enhancement
integration
ops
security
tech-debt
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/BatteryStorageCalculator!21
Loading…
Reference in a new issue
No description provided.
Delete branch "docs/reconcile-degradation"
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?
Follow-up to #20. Docs-only.
What went wrong
I cut the #20 branch from
1d2a274without fetching first. Main had already advanced tob31aa8c(Add battery degradation and rate-escalation-adjusted payback, Jun 5). Git merged cleanly and the merged tree is green — I re-ran the full suite on merged main: 46 frontend tests, 22 backend tests, build all pass. But there were no textual conflicts precisely because the collision was semantic: the docs I merged described the pre-degradation code.CI passing on #20 did not catch this, because it ran against my branch head, which never contained
b31aa8c.What was wrong on main
Paybacks documented as plain division. The audit stated
setupPaybackVsAnytimeYears = totalInstalledCost / vsAnytimeand similar. Every payback now goes throughcalculateAdjustedPaybackYears(payback.js:11), which compounds(1 + escalationPct/100) * (1 - degradationPct/100)per year and interpolates the break-even year, capped at 50. Documented the real algorithm, including the short-circuit to plain division when both rates are zero.Two claims that were outright false, both asserting battery degradation is not modeled — in the projection caveats and in What Is Not Included In The Money Model. Battery and solar degradation are both modeled now. Replacement, maintenance, and cycle limits genuinely remain unmodeled; cycle count under dispatch stays tracked in #11.
Projection escalation formula. Now degrades battery and solar savings independently while leaving rate-plan-switch savings untouched — a real modeling decision that was undocumented.
Drifted line references:
runAllPlansSimulation(113→120),calcParametricBill(247→250),calculateQuoteComparisons(338→349),buildProjectionData(55→73), the scenario gates,buildCalculationDataRevision, the output object, and the warnings array.Two identifiers that never existed —
setupPaybackVsAnytimeYearsandbatteryInverterPaybackYears— replaced with the realpaybackVsAnytimeYearsandpaybackYears. These predateb31aa8c; they were wrong when originally written.Changelog
Recorded the degradation and adjusted-payback work under
Unreleased, plus the lockfiles and gitignore from #20.Lesson
Fetch before branching. My earlier "formulas verified accurate against the code" claim was true against
1d2a274and not against main.