Skip to content

v1.62: eight bug fixes from the code review (pricing, saved plans, clearing readings, rebates, state changes) - #59

Merged
RickUsingGitHub merged 3 commits into
mainfrom
claude/ecstatic-brown-95vo21
Nov 10, 2026
Merged

RickUsingGitHub merged 3 commits into
mainfrom
claude/ecstatic-brown-95vo21

Conversation

@RickUsingGitHub

@RickUsingGitHub RickUsingGitHub commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Fixes eight bugs found in a review of the app, adds a few robustness and cosmetic fixes, and removes two debug hooks.

Bug fixes

1. Saved prices no longer override a built-in plan after its prices change
On reload the Compare plan form was filled from the values saved in the browser, so after a price update a returning user kept the old rates under the plan's name (and in its "Every plan" row). The form now remembers a fingerprint of the built-in plan it was filled from (selectedPlanSig, Amber.templateSignature). If that no longer matches on load, the form is filled again from the current plan. Prices the user changed themselves are kept until the plan itself changes.

2. "Clear saved meter readings" works
It always reported "Cache is busy", because database connections were never closed and blocked the delete. Connections now close themselves when the database is being deleted. The action also:

  • removes households imported from NEM12 (they were left listed with no data);
  • takes the results off the page;
  • refuses politely while a Compare is running;
  • reports what happened in the header, where it shows on every tab (the message used to sit at the bottom of the Usage tab's calendar card);
  • says in its confirmation that imported files need importing again.

3. Amber's total agrees between the answer, month by month and Free?
The Ausgrid export allowance was pooled over the whole period in Compare and the planner's yearly figure, but applied per month in month by month and Free?. It is now settled one calendar month at a time everywhere (like demand), with part months getting the allowance for their days in the range. Bill? still settles the bill's own period as one settlement (billPeriod).

4. Battery rebate follows the size tiers
The planner applied a flat rebate per kWh to any battery size. Since 1 May 2026 the rebate is the full rate on the first 14 kWh, 60% from 14 to 28 kWh, 15% from 28 to 50 kWh and nothing above. The default rate is also updated from $330 to $255 a kWh (6.8 certificates per usable kWh from 1 May 2026, at about $37.50 each; $330 was the rate before that). A saved, untouched 330 moves to the new default. The breakdown text and help bubble explain the tiers.

5. Quotes in a plan name no longer break the markup
escapeHTML escaped & < > but not quotes, so a plan name like My "special" plan (or a crafted NEM12 channel name) leaked stray attributes where it was used inside an attribute. It now escapes " and ' too, and no longer needs the DOM.

6. Changing state swaps the plan too
The state selector used to reset the plan to "Enter my own rates" while leaving the old plan's name, heading and prices in the form. Now:

  • a built-in plan from the old state is replaced by one from the new state, name and prices together, and the results are refreshed;
  • rates typed in by hand are left alone;
  • a state with no plans for the site's network clears the old plan and shows a note saying which state has them (#planStateNote);
  • an Amber site outside NSW opens on its own state's plans, instead of an empty NSW list. A state picked by hand for that site is not overridden.

7. "Setup tab" wording
The bill check told users to add their key "on the Setup tab". It now says Start, with a link that goes there.

8. Free? day count
"Power going to the grid after dark on 306 of 366 days" for a 365-day period: days were counted by local date, and daylight saving added one. They are now counted by the readings' own dates, as elsewhere in the app.

Robustness

  • A Compare whose readings can't be saved in the browser (storage full) still shows its results, with a note that they will download again next time. IndexedDB transactions now reject on abort as well as error, so a failed write can't leave Compare waiting on "Comparing…".
  • Saved settings that are damaged or the wrong shape (touConfig, demandSettings, feedInWindows, customSupplierPlans, rateType) fall back to the defaults instead of stopping the page loading. Damaged custom plans are left out.

Smaller tidy-ups

  • Escape closes the settings and Download menus and returns focus to the button.
  • The calendar no longer draws a thick "selected" border on every day (every day shown is inside the chosen dates).
  • "X 31 days" is now "× 31 days"; month by month names the plan in its Difference column instead of "Other plan".
  • The "Rebates shrink each year" help no longer says it is used for a replacement battery (that is costed with no rebate).

Debug hooks removed

?fakeControlledLoad and the ?name=Rick menu items ("Save custom plans", "Show stats"), plus the modal only they used.

Behaviour changes worth knowing

  • Multi-month Compare totals on Ausgrid sites with large midday exports go up slightly (a quiet month no longer lends its allowance to a sunny one). This matches how each month is billed.
  • Solar+? recommendations can shift towards smaller batteries, since the rebate is lower and no longer flat.
  • Changing state now picks a plan for you (the network's default offer, or the state's first plan) rather than leaving "Enter my own rates" selected.
  • "Save custom plans" was the way to copy typed-in plans out as code for templates.js. Custom plans are still in localStorage under customSupplierPlans.

Tests

  • npm run test:unit: all pass, with new checks for monthly settlement, daily allocation, monthsInRange, the rebate tiers, escapeHTML and the Free? day count. The planner's "Amber's months within 2 % of its year" is now exact.
  • Playwright: 66 pass, including the new tests/v162.spec.js (12 tests).

Sources for the rebate rules

🤖 Generated with Claude Code

https://claude.ai/code/session_016net8VNmbz2wYZE9p1zt6k

…, battery rebate tiers

- A built-in plan's saved prices are filled again when a new version of the
  app changes that plan's published prices. Prices the user changed are kept
  until then.
- "Clear saved meter readings" now works after a Compare (database
  connections let go when the cache is deleted), removes households imported
  from NEM12, takes the results off the page and says what happened in the
  header, where it shows on every tab.
- The Ausgrid export allowance is settled one calendar month at a time in
  Compare and the planner, as month by month and Free? already did, so all
  of them give the same Amber total. Bill? still settles the bill's own
  period.
- The battery rebate follows the size tiers that started on 1 May 2026 (full
  to 14 kWh, 60% to 28 kWh, 15% to 50 kWh), and the default rate is the
  current one ($255 a kWh, was $330).
- Removed the ?fakeControlledLoad and ?name=Rick hooks and the modal only
  they used.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016net8VNmbz2wYZE9p1zt6k
… Start tab wording

- escapeHTML escapes quotes too, so a plan name (or NEM12 channel name) with
  a quote in it can't break out of an attribute. It no longer needs the DOM.
- Changing state swaps a built-in plan for one from the new state, name and
  prices together, and refreshes the results. Rates typed by hand stay. A
  state with no plans for the site's network clears the old plan and says
  which state has them.
- An Amber site outside NSW opens on its own state's plans rather than an
  empty NSW list.
- Free? counts days by the readings' own dates, so a year is 365 days, not
  366 with daylight saving.
- The bill check points to the Start tab (was "Setup"), with a link.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016net8VNmbz2wYZE9p1zt6k
@RickUsingGitHub RickUsingGitHub changed the title v1.62: stale saved plan prices, clearing readings, monthly export allowance, battery rebate tiers v1.62: eight bug fixes from the code review (pricing, saved plans, clearing readings, rebates, state changes) Nov 10, 2026
…nd wording tidy-ups

- A Compare whose readings can't be saved in the browser (storage full)
  still shows its results and says the readings will download again.
  IndexedDB transactions reject on abort as well as error, so nothing is
  left waiting.
- Saved settings that are damaged or the wrong shape fall back to the
  defaults instead of stopping the page loading. Damaged custom plans are
  left out.
- Escape closes the settings and Download menus and returns focus to the
  button.
- The calendar no longer draws a thick "selected" border on every day.
- "X 31 days" is now "× 31 days", and month by month names the plan in its
  Difference column instead of "Other plan".
- The "Rebates shrink each year" help no longer says it is used for a
  replacement battery, which is costed with no rebate.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016net8VNmbz2wYZE9p1zt6k
@RickUsingGitHub
RickUsingGitHub marked this pull request as ready for review November 10, 2026 11:25
@RickUsingGitHub
RickUsingGitHub merged commit c58aa10 into main Nov 10, 2026
1 check passed
@RickUsingGitHub
RickUsingGitHub deleted the claude/ecstatic-brown-95vo21 branch November 10, 2026 11:25
RickUsingGitHub added a commit that referenced this pull request Nov 15, 2026
v1.62: eight bug fixes from the code review (pricing, saved plans, clearing readings, rebates, state changes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants