Skip to content

fix(coordinator): repoint rotation chores when their assignee is deleted (#787) - #789

Merged
tempus2016 merged 2 commits into
mainfrom
fix/787-orphan-rotation-pointer
Aug 13, 2026
Merged

fix(coordinator): repoint rotation chores when their assignee is deleted (#787)#789
tempus2016 merged 2 commits into
mainfrom
fix/787-orphan-rotation-pointer

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

Closes #787.

async_remove_child stripped the child from assigned_to and (since #786) cleared the swap override, but never touched assignment_current_child_id. ChildStatsSensor includes a non-everyone chore 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(), in async_remove_child after 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:

active   = zz787 Ana
survivor = zz787 Ben
after deleting the assignee:
  assignment_current_child_id = 7fe753256dba4bdf (zz787 Ana)
  points at a deleted child   = True
  assigned_to                 = [743d7f16c9764b9c]      <- correctly stripped
  survivor stats sensor lists it = False                <- the bug
RESULT: FAIL — chore hidden from the survivor

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 on main:

  • pointer is repointed at a surviving child
  • the child sensor still lists the chore for the survivor — the user-visible symptom, via a real ChildStatsSensor
  • pointer clears when the pool empties
  • removing an off-rotation child leaves the pointer alone (control; passed before the fix too)

1565 tests pass, ruff clean.

tempus2016 and others added 2 commits August 13, 2026 11:01
…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.
@github-actions github-actions Bot added backend Python integration code tests Test suite labels Aug 13, 2026
@tempus2016
tempus2016 merged commit 4d916c4 into main Aug 13, 2026
16 checks passed
@tempus2016
tempus2016 deleted the fix/787-orphan-rotation-pointer branch August 13, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Python integration code tests Test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting a child leaves rotation chores pointing at them, hiding the chore from everyone until midnight

1 participant