Repository navigation
fix(chores): prune a half-done split once its any-day period ends - #410
Conversation
A split on an any-day card never expired: the nightly prune only took a split once every share was ticked, and the split return kept a one-time split with a ticked share, so an expired any-day card stayed visible for weeks — its open share could still be ticked and paid, and it blocked its holder's bonus claims. The period ending now prunes the card regardless of its ticks: a ticked share stays earned in history, and the next period rolls a fresh card like an unsplit any-day chore. Regression test: a half-done split on an any-day chore expires with its period (server/tests/bonusChoreSplitAssign.test.js).
|
Thanks, Adam. This is the right fix, and a tidy one. The regression test fails on One small thing before it goes in. The nightly job's description in
Once that's in, it's good to merge. |
The nightly-job description still said a half-done one-time split stays split until every share is ticked (issue jherforth#407), with no exception for any-day cards. PR jherforth#410 prunes those when their period ends, split or not: a ticked share stays earned, and the next period starts with a fresh card.
|
Done — added that note to the nightly-job description in docs/reference/backend-api.md: an any-day card goes when its period ends, split or not, a ticked share stays earned, and the next period starts with a fresh card. Thanks for the review! |
Bug
mrramam reported (Dec 1, on #407, reproduced on f6f103e with a fresh database): a half-done split on an any-day chore never expires. Weekly any-day 5-Star bonus chore, card due Saturday, split Ava + Ben, Ava ticks. After Saturday the nightly job keeps the card — still visible with the split a week and two weeks later. The chore gets no new weekly card. Ben can still tick the stale card after its due date and is paid, and his open share blocks his bonus claims (409 "already has an outstanding bonus chore" 15 days later).
Cause
Two guards that are right for plain one-time splits combine badly on an any-day card:
An expired any-day card is one-time, so neither path lets it go.
Fix
The period ending now prunes the card regardless of its ticks: the prune query marks rows matched by the any-day-expiry branch, and the filter prunes those unconditionally. A ticked share stays earned — the prune moves its history row to the parent schedule, as it already does — and the next period rolls a fresh unsplit card like an unsplit any-day chore. The split return is untouched: it never sees the card, because the prune runs first. No client change: once the server prunes the card, it is gone everywhere.
Regression test
server/tests/bonusChoreSplitAssign.test.js: "a half-done split on an any-day chore expires with its period" — reproduces the bug on f6f103e (failed before the fix: the stale card survived the nightly run with the split intact), then verifies all five: the stale card is pruned; Ava's 3 Stars stay earned (history moved to the parent); Ben's late tick is a 404; a fresh unsplit card rolls for the new week; Ben can claim again. A second nightly changes nothing.Verification