fix(coordinator): repoint rotation chores when their assignee is deleted (#787) - #789
Merged
Conversation
…ted (#787) async_remove_child stripped the child from assigned_to and (since #786) cleared the swap override, but left assignment_current_child_id pointing at the deleted child. The child sensor includes a non-everyone chore only when that field matches, and a deleted id matches nobody — so the chore went invisible to every surviving child until the midnight pass recomputed it. The completion service, per-chore button and to-do list all gate on _compute_active_children instead, which recomputes from the live pool, so they kept accepting the survivor. Only the card disagreed. Chores pointing at the removed child are now repointed at today's live pool via _compute_daily_assignments — recomputed rather than just blanked, so the chore comes back for the survivors immediately instead of at midnight. When the pool empties, the pointer clears. Reproduced and verified on the live ha-dev instance.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #787.
async_remove_childstripped the child fromassigned_toand (since #786) cleared the swap override, but never touchedassignment_current_child_id.ChildStatsSensorincludes a non-everyonechore only when that field matches the child — and a deleted id matches nobody, so the chore went invisible to every surviving child until the midnight pass recomputed it.The completion service, the per-chore button entity and the to-do list all gate on
_compute_active_children, which recomputes from the live pool, so they carried on accepting the survivor. Only the card disagreed — the mirror image of #781, where the card showed a chore the backend refused.Fix
Chores whose pointer names the removed child are repointed at today's live pool via
_compute_daily_assignments(), inasync_remove_childafter the child is out of storage. Recomputed rather than just blanked, per the issue's open question: blanking would leave the chore hidden until midnight anyway, and the daily map is exactly what the midnight pass would have produced. When the pool empties, the pointer clears.Verification
Reproduced on the live ha-dev instance first — two children, an alternating chore, delete today's assignee:
The same probe is re-run against the merged fix on ha-dev.
4 new tests in
tests/test_rotation_quota.py, 3 of which fail onmain:ChildStatsSensor1565 tests pass, ruff clean.