Repository navigation
fix(chores): the nightly job keeps chores that have no schedule - #408
Merged
Merged
Conversation
The nightly cleanup deleted every chore definition with no schedules (#41). That was meant for one-time chores once done, but it also deleted a chore made and not yet scheduled, a chore whose schedule was deleted, a follow-up target (and, by cascade, the rule handing it out), and a calendar routine's chore with no events coming up (and, by cascade, the routine itself). Now a definition goes only when this run pruned its last schedule, and no follow-up rule or routine points at it. A finished one-time chore still takes its definition with it. New server/tests/nightlyChorePrune.test.js runs the job on a real server: it fails on the old code and passes now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adamecker
pushed a commit
to adamecker/HomeGlow
that referenced
this pull request
Nov 29, 2026
…h#409), nightly job keeps unscheduled chores (jherforth#408), bonus chore offered to some people only (jherforth#403/jherforth#404) Upstream's migrations 44 (choreClaimUsers) and 45 (weekRhythm) collide with the prod line's own 44 (anyDayChores) and 45 (prizePaused), so they land here renumbered as 50 and 51, per the established prod-line practice. anyDayChores test updated for the new final schema version (51).
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.
Why
The nightly job deleted every chore definition with no schedules ("to avoid clutter", #41). That was meant for one-time chores that were done, but it caught much more. On
main, one run of the job (GET /api/system/backgroundTasks) deleted all of these:ON DELETE CASCADE), so Dishes stopped handing it onroutines.chore_id … ON DELETE CASCADE). A calendar routine has schedules only for matching events in the next 14 days, so a routine with nothing coming up has noneDeleting a chore's schedule also lost the chore definition that night.
Found while reviewing #407, which relies on this prune.
What changes
A chore's definition is deleted only when:
So "Wash the car" still goes once it's done, as #41 wanted. A chore that simply has no schedule stays.
Nothing to migrate. Anything this would have kept on an existing install was already deleted by earlier nights.
Checks
New
server/tests/nightlyChorePrune.test.js(real server, the job run on demand):It fails on
main's code and passes with the fix.Server
npm test(TZ=UTC), 832/833. The one failure ismirrorReload.test.js, which compares clocks across two processes with no tolerance. It fails the same way on unmodifiedmainon this machine, and it passed and failed at random when re-run.The same check on a real server, before and after:
mainpruned four chores and one routine; the fix prunes only "Wash the car".🤖 Generated with Claude Code