Remove legacy p95 demand fallback from parseEmporia.js #9
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#9
Loading…
Reference in a new issue
No description provided.
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?
docs/implementation-audit.mdnotes: The older p95-style demand fallback still exists insrc/lib/parseEmporia.jsfor parametric rate inputs.The percentile peak work in
src/lib/analytics.jssupersedes this - it provides p95/p99/p99.5 bands with timestamps and circuit context. Two code paths computing demand peaks differently is a correctness hazard.Confirm the analytics path fully covers the parametric case, then remove the fallback. If parametric mode genuinely still needs it, document why it differs instead of removing.
Audit note (2026-07-16)
While in this code, three adjacent cleanups belong in the same pass:
src/lib/rates.js:37-42—isHolidayis exported but never called, and its no-year branch uses a 4-date holiday list that contradictsisHolidayDate's real calendar. Any future caller gets wrong answers. Delete it (or make it delegate toisHolidayDate).src/lib/parseEmporia.js:279usesfloor(n*0.95)whilesrc/lib/analytics.js:237usesceil(n*p)-1— two rank conventions for the same concept. When removing the legacy fallback, standardize on the analytics convention.src/lib/simulation.js:508—getTieredBlendedRate's 0.10 fallback is unreachable (only anytime/eveningMorning ever signal null); replace with a thrown error or a comment so a future plan addition doesn't silently bill at 10¢. Alsosimulation.js:77-87pre-computes Ultimate monthly peaks that the main loop recomputes identically at :127-129 — delete the pre-scan.Acceptance criteria (audit additions):
(Audit finding F-18, 2026-07-16)