Skip to content

feat(points): negative-balance policy (FEAT-7)#595

Merged
tempus2016 merged 1 commit into
mainfrom
feat/negative-balance-policy
Jun 25, 2026
Merged

feat(points): negative-balance policy (FEAT-7)#595
tempus2016 merged 1 commit into
mainfrom
feat/negative-balance-policy

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

FEAT-7 — negative-balance policy

New opt-in setting allow_negative_balance (default off = current floor-at-zero behaviour). When enabled, penalties / point removals can take a child's spendable balance below zero instead of clamping at zero — useful for families who want penalties to "stick" as a debt.

Changes

  • coord_points.async_remove_points gates the zero-floor on the setting (read via _setting_enabled, so a stored bool or "true"/"false" string both work).
  • Settings WS schema + _SUBKEY_SETTINGS accept the new key.
  • Panel: a new toggle in the points settings section.
  • i18n: panel.settings_allow_negative_label / _hint added to all 8 panel locales.

Testing

  • Unit tests: floors at zero by default; allows negative when enabled.
  • Live on ha-dev (panel→WS→storage→backend): with the policy on, removing 58 from a 53-point balance produced -5; restored to 53; default still floors at 0. (The live test caught a bool-vs-string read bug a string-only unit test missed.)

From AUDIT_REPORT.md §5 (FEAT-7).

New opt-in setting 'allow_negative_balance' (default off = current
floor-at-zero behaviour). When on, penalties / point removals can take a
child's spendable balance below zero instead of clamping at zero.

- coord_points.async_remove_points gates the floor on the setting
  (read via _setting_enabled so bool or string both work).
- Settings WS schema + allowlist accept the key.
- Panel settings: new toggle in the points section.
- i18n: panel.settings_allow_negative_label/_hint in all 8 locales.

Tests: floors by default, allows negative when enabled. Verified live on
ha-dev: with the policy on, over-deducting a 53-pt balance produced -5;
default still floors at 0.
@github-actions github-actions Bot added backend Python integration code cards Lovelace cards / frontend (www/*.js) translations i18n / locale strings tests Test suite labels Jun 25, 2026
@tempus2016 tempus2016 merged commit f9e909c into main Jun 25, 2026
10 checks passed
@tempus2016 tempus2016 deleted the feat/negative-balance-policy branch June 25, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Python integration code cards Lovelace cards / frontend (www/*.js) tests Test suite translations i18n / locale strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant