Habits: goals, weekly schedules, tentative entries and undo #2

Merged
alex merged 9 commits from feat/habits-goals into chore/repo-bootstrap 2026-10-30 19:23:14 +01:00
Owner
  • Three kinds of goal: check (N times), amount (a target in a unit), avoid (no slip).
  • Daily, weekday and N-times-per-week schedules, with periods that start on the week start.
  • Entries are tentative while their day is open and can be undone until it closes. Entry ids come from the client, so commands replayed from the offline queue stay idempotent.
  • API endpoints for check-ins, progress, slips and undo; the web page has an undo button and predicts the result locally.

🤖 Generated with Claude Code

- Three kinds of goal: check (N times), amount (a target in a unit), avoid (no slip). - Daily, weekday and N-times-per-week schedules, with periods that start on the week start. - Entries are tentative while their day is open and can be undone until it closes. Entry ids come from the client, so commands replayed from the offline queue stay idempotent. - API endpoints for check-ins, progress, slips and undo; the web page has an undo button and predicts the result locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Habits now follow the context document: a Goal (check N times, reach an
amount, or avoid) over a Schedule (daily, weekdays or weekly), entries
that stay tentative in open periods and can be undone until their day
closes, and closeDay judging each period as met, missed or not due,
moving the streak and announcing milestones. Vacation days close as not
due, and a partial first week never counts against a new habit.

The API gains progress, slip and undo endpoints; the read model exposes
the closed streak and open periods so the web client predicts offline,
and the rule vectors now describe the displayed streak.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tracker aggregate holds each user's time zone, week start and
vacations, and closes days in order once local midnight plus the grace
period has passed. A recurring job (habits.close_days, every 5 minutes,
on a new pg-boss platform library) runs the closing process: close the
day on the tracker, judge every habit in its own transaction, then
record the summary that announces DayClosed. Every step is idempotent
and an interrupted day is resumed before the next one is closed.

The web app sets its tracker up from the device's zone and locale,
follows the device across time zones, and uses the real week start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The alias was missing from the previous commit, so the branch did not
build on a clean checkout. Also records Nx's analytics opt-out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The relay drains the outbox in commit order under an advisory lock, hands each
entry to its own context's projections and, when the context's publisher
translates it, to every subscriber as an integration event. A failing entry
holds later ones back and is set aside after five attempts. Consumers
deduplicate through platform.inbox inside their own unit of work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ledger and Vitality aggregates fed by Habits' integration events through an
anti-corruption layer; one versioned balance policy; a projection of granted
rewards; GET /api/rewards/ledger and /api/rewards/vitality.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/4
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/3
alex merged commit 9ba2d4e7cc into chore/repo-bootstrap 2026-10-30 19:23:14 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Habitea/App!2
No description provided.