Skip to content

Add a chore grace period and photo-verified chore claims - #17

Merged
AshtonLong merged 3 commits into
masterfrom
chore-grace-period-and-cover
Nov 6, 2026
Merged

AshtonLong merged 3 commits into
masterfrom
chore-grace-period-and-cover

Conversation

@AshtonLong

@AshtonLong AshtonLong commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Chores now get a grace period before they count as missed, and roommates can cover a missed chore and earn its penalty. Every chore carries the house penalty, so the per-chore penalty checkbox is gone. It was never enforced anyway.

Grace period

  • The admin sets it in Settings → Grace period. It defaults to 4 hours and can go up to 12. The due time doesn't change. A chore only counts as missed once the grace period ends.
  • During the grace period, the assignee can still finish the chore, even after midnight. A chore due at 11:59 PM can be finished until 3:59 AM.
  • Coming up shows a "Grace period" badge with the new deadline. Today keeps a chore from yesterday on today's list until its grace period ends, even if the page stays open past midnight.
  • Editing or deleting a chore no longer erases an assignment that's in its grace period.

Covering a missed chore

  • Covering only works in houses with 3 or more people. When the grace period ends, anyone except the assignee can claim the chore from "Up for grabs" by taking a before photo. The first claim wins.

  • Claims close at the end of the day after the chore was due. The claimer has to add an after photo by then, or the claim lapses and the normal review takes over again.

  • After a chore is claimed, the infraction can't be disputed, put to the normal vote, or forgiven. The assignee can add a note for the voters.

  • Only the roommates outside the claim vote. That list is fixed when the after photo is submitted. The vote closes once all of them have voted, or after 48 hours.

  • More rejects than approves means the claim is rejected: the miss is excused and no money moves. A tie, or no votes, approves the claim.

  • When a claim is approved, a single balanced ledger entry moves the whole penalty from the assignee to the roommate who covered it. The household fund gets nothing, and the assignee owes the fund nothing for that miss.

    For example, on a $15 second miss: assignee −$15, coverer +$15, fund $0. It's an ordinary balance between the two roommates, so it nets against shared expenses and bills like any other balance. Nobody has to make a separate payment for it.

  • Covered penalties don't count toward the infractions history's "unpaid" or "paid" totals, since those track what's owed to the fund.

  • Push notifications go to:

    • the assignee, when their chore is claimed
    • the voters, when the after photo is in
    • both people, when the claim is decided
  • Photos are stored in a new private chore-claims bucket. Members can add photos but can't replace or delete them. The server checks that each photo was uploaded by the claimer, at the right time, and isn't a copy of another photo from the house.

Deploying

The migration 20261103170000_chore_grace_period_and_claims.sql:

  • adds households.chore_grace_minutes
  • drops task_definitions.penalty_enabled
  • adds the chore_claims and chore_claim_votes tables and the chore-claims storage bucket
  • adds households to realtime
  • redefines several chore and penalty functions

Other fixes in this PR

  • Fund payments: confirming a fund payment no longer marks an upheld penalty as paid if it hasn't been charged yet. Before, that penalty was never charged at all.
  • Disputes: only the affected member can dispute an infraction. Before, someone outside the house could dispute it too.
  • Cron safety: process_due_work now handles each claim and penalty on its own. One bad row gets logged and retried instead of blocking every household.
  • Missed icon: missed chores now show the coral icon instead of the amber one.

Validation

  • Database (pgTAP): all 238 tests pass, 127 of them new. They cover grace boundaries, every claim rule, ledger math on $10 and $15 covered penalties (full penalty to the coverer, no fund entry, nothing owed to the fund, member balances), a reward that doesn't match its penalty, rejection, lapse, deadline approval, the voter snapshot, photo timing and copies, fund payments around covered penalties, and the cron surviving bad rows.
  • Database lint: no new warnings.
  • Unit tests: all 81 pass. That includes time-zone and daylight saving deadlines.
  • Lint and build: both pass.
  • End to end: all pass on mobile Chrome and mobile Safari, including the new claim flow, voting, and grace period setting tests, except two tests that already fail on master: "bill tap opens breakdown" (both browsers) and "driveway grid drag" (Safari).

Known limitations

  • If a claim fails after its photo was uploaded (for example, someone else claimed first), the photo stays in storage, because the bucket doesn't allow deletes.
  • A one-off chore can still be created with a past date. That's an existing gap. This PR only stops those chores from being claimed.

Chores now get an admin-configurable grace period (default 4 hours, up to
12) before they count as missed. The assignee can still finish a chore
during the grace period, including past midnight.

Once the grace period ends, another roommate can cover the missed chore:
claim it with a before photo, finish it with an after photo, and the
roommates outside the claim vote. Approval charges the assignee the full
penalty, pays the roommate who covered it up to $10, and sends the rest to
the household fund. Rejection excuses the miss. A tie or no votes approves.
Claims need at least three roommates and close at the end of the day after
the chore was due. A claimed infraction cannot be disputed, voted on, or
forgiven, and a claim without an after photo lapses back to normal review.

Every chore now carries the house penalty, so the unused per-chore penalty
toggle is removed.
Database:
- Fund payments only mark posted, uncovered penalties as paid, so an open
  claim can no longer get stuck on an already-settled penalty.
- process_due_work handles each claim and penalty on its own, so one bad
  row is logged and retried instead of blocking every household.
- Chores added after their due time cannot be claimed, which closes a
  backdated-chore exploit.
- Deleting a chore keeps assignments that are already in their grace period.
- Only the affected member can dispute an infraction; outsiders are refused.
- Claim photos must be uploaded after the miss (before photo) or after the
  claim (after photo), and copies of another household photo are refused.
  Retrying with the same photo after a failed request still works.
- Reviewers are fixed when the after photo is submitted, so membership
  changes cannot decide a claim.
- Households are published to realtime so grace period changes reach
  every member.

App:
- Photo picker uses focusable buttons, so it works with a keyboard.
- Today page follows midnight while open and keeps grace-period chores
  visible until their grace period ends.
- Claim dialogs show errors inline, can be closed during an upload, and
  fit on a phone screen; the claimer can add the after photo from the
  infraction card too.
- Claim votes use the same colour pair as infraction votes, explain what
  each choice does, name the reviewers, and hide once the vote closes.
- Photo viewer switches between before and after; broken or expired
  photos retry once, then show a fallback.
- History totals follow the real penalty status, outcome chips wrap, and
  missed chores use the coral icon.
- Claim deadlines are correct in time zones that skip midnight.
@AshtonLong
AshtonLong requested review from OneFourBrandon and a balanced review from Copilot November 4, 2026 01:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An approved claim now moves the full penalty from the assignee to the
roommate who covered it. The $10 cap is gone and the household fund
gets nothing from a covered chore. Covered penalties no longer count
toward the infractions history's unpaid total, since nothing is owed to
the fund for them.
@AshtonLong
AshtonLong merged commit 45f59fb into master Nov 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants