Reviewer: Claude Fable 5.1 (claude-fable-5-1) — review @ 2106519
APPROVED. No blockers. Scratch worktree of origin/inapp-reminders @ 2106519 on origin/main 937b7ac; make ci green here (vet incl. browser tag, gofmt, every package, migration check). Read spec §7 "In-app reminders", AGENTS.md row T2 and the Team mode section, and Home's one rule. Fifteen mutations of my own below.
Drain correctness
- Standing at fire time.
reminderDelivery(teamjobs.go:77) is unchanged except that the no-address short-circuit now applies only to a rule with an email half, so a Home-only in-app rule falls through to the roster: NotMember →settleDormant(fired, held underteam:dormant, nothing queued — N2 holds), Unknown →deferReminderFor(standingRetry), which touches only `retryat(attempts stay 0), out of reach → settled and the next queued.deliverInAppruns only aftersettleWithoutSending` said "deliver", in both the tick's loop (handlersjobs.go:131–140) and the page-view drain (handlersjobs.go:254–263). Mutations: Unknown→deliverNow, NotMember→deliverNever, in-app marked before standing, deferral counting an attempt, no-address exemption dropped — all killed. - Marking inside the claim.
MarkReminderNotice(storeremindernotice.go:74) is oneINSERT … SELECT … WHERE EXISTS (queue row with this id AND claim_id), so a reschedule that cleared the claim marks nothing (killed: claim condition dropped). The upsert'sWHERE occurrence_key <> excluded.occurrence_keymakes a re-fire of the same occurrence a no-op and keepsdismissed_at(killed: dropped). One row per rule by the unique index, so a forever series is one row. - Mark and complete are two transactions (mark, then
CompleteReminder). The window is the same one the email path already has: a reschedule landing between them leaves a notice naming the old time, as the mail would have named it, and the next fire replaces it. A lease that expires between them is harmless: the second worker's mark is the same-occurrence no-op and it completes. No duplicate notice is possible (one row per rule); no reminder is lost (whoever holds the claim completes). Not a change request; worth one sentence in theMarkReminderNoticecomment. - The double-claim guard, now keyed by rule + occurrence (handlers_jobs.go:121). Correct: the guard's intent is "this worker re-claimed what it just finished", and two rules on one occurrence (two people on a team meeting, or 10-minute and 1-hour) were each owed once. I also verified the case only the finer key protects: ONE daily rule whose next occurrence is already due inside the pass (series starting in five minutes, drain with now+24h) delivers both,
sent == 2, no 5xx. A key by rule alone would trip there — see N1. - Ruling on the rewritten
TestRepeatedOccurrenceGuardFailsEvenAfterASuccessfulSend: accepted. The old test forged two rules with one key, which is now a legitimate case. The new one re-arms the SAME rule's SAME occurrence through a trigger ondue_at(the forgeddue_atmakes the completion's reschedule write a futuredue_at, which the trigger pulls back) and still requires the 5xx and the back-off. I checked that it fails (204) without its trigger, so it is testing what it says, and that it also passes against main's drain, as it should.
Privacy
reminder_noticesholdsreminder_id, person_id, event_id, occurrence_key, start_utc, fired_at, dismissed_at: references and the same shape of time the queue holds (§1.1). The title is opened fromevents.title_sealedat render throughgrantJoin(storeremindernotice.go:124), and the raw DB+WAL is grepped for it inTestTeamInAppReminderFiresUnreadForAHomeOnlyMember. No address anywhere;people.reminder_channelis three enumerated words.- Logs: the new lines carry
stageandscrubErr(err)or a count. Nothing names a title, an address, or a person. The native endpoint returns titles to the person's own signed-in app over a member route — delivery, asnativeEventsis.
Team mode
/remindersisneedListing(routes.go:137); under Unknown the store withholds the rung (reachesfalse →AND 0), the page carries the partial notice and the template withholds the empty state ({{else if not .Partial}}). The chrome count goes through the same join on the request's Access, so under Unknown it is "Reminders" with no number (reminderLink, handlersreminders.go:146). Dismiss and Dismiss all arememberRouteswrites insides.guarded, both inTestTeamEveryWriteRouteRefusesALapseBeforeCommitwith `remindernoticesin the snapshot (killed: dismiss unguarded).GET /api/native/remindersasksrequestUnknownafter building, asnativeEvents` does; the 40-step lease-edge sweep sees whole and unavailable, never short.
Team mode off: identical
- Email rule:
settleWithoutSendingisdeliverNowwithh.team == nil,deliverInAppreturns before touching anything for a channel without an in-app half, andsendReminder/CompleteReminderare byte-for-byte what main has.ClaimDueReminderonly addsChannelto the payload.SaveSettingswritesreminder_channelonly for a valid value, so an older form keeps the choice. The event template's{{if NoAddress}}…{{end}}rewrite emits the same bytes as before for anyone with an address, andchannelLabel "email"is "Email". The only new per-page cost is one indexed count query. Settings and/remindersare the only differences, as described. Fine for calendar.oficina.works.
The seam (reminder_seam.go)
- Sound shape for a pull that stores nothing: unread count, per notice an opaque
noticeID:startUTC(new when the rule fires for a newer occurrence —TestTheSeamNamesEachOccurrenceAfresh), an absolute on-origin link, the start; no title. It carries the verified subject's roster Access on the context, reads, then asksPartial()once after the read, exactly asdashboardEventsdoes; NotMember reaches nothing and counts nothing. Safe left unmounted: unexported, no route, called only by tests. Mutations killed: Partial check dropped, rung ignored. - One wording fix (N2): it cannot be "passed as
Read" as the spec and comment say —dashboard.ProviderConfig.Readreturnsdashboard.Response, this returnsNoticeSummary, andnowis unused. A provider for Home's kind will wrap it. Say "wrapped by", not "passed as".
The deviation and the three questions
- Deviation accepted. A sibling
reminder_noticeskeyed byreminder_idis the right shape, not a flag onreminder_queues: the queue row moves (or is deleted) in the transaction that fires it, so a flag there is gone as it is made. Same bound (one row per rule), and the EXISTS-on-claim keeps the mark inside the claim's meaning. My sketch was wrong on this; yours is right. - Q1 — retro-update existing rules on a Settings change: no, not now. The channel is a property of the rule, the event page names each rule's channel, and a per-rule choice made on the event page must never be silently rewritten by a preference. If Paul finds the "new rules only" rule annoying in use, the later shape is an explicit, unticked checkbox on Settings ("Change my existing reminders too") that rewrites only rules still on the PREVIOUS preference, never ones chosen per-rule, and never for a Home-only member. Keep it under "Not built".
- Q2 — Nav link, not a bar Action: yes. Reminders is a place you go, not a verb; the bar has no actions by calendar.md §B2; the count is text in the label, so it is not colour alone and reads the same in the narrow Menu sheet (estilo
bar.htmlrenders.Navthere). Appended after Calendars, so nothing else shifts when it appears. - Q3 — hidden, not deleted: yes. The notice's lifetime is the rule's, and
deleteEventOnalready leaves rules in place on a soft-deleted event, so hiding adds no new growth. Reach can come back (a re-added member's dormant rule wakes, a grant returns, a cancellation is reverted) and the notice is then simply there again. Deleting on a read path would be a write nobody asked for; a sweep is a job nobody needs yet.
Mutations run by me (15)
Claim key by occurrence only — killed (TestTwoRulesOnOneOccurrence…). Claim key by RULE only — survived the whole suite, killed only by my probe (N1). Mark without the claim condition — killed. Re-fire resets dismissed — killed. Unknown delivers — killed. NotMember settles instead of dormant — killed. In-app marked before standing — killed. Unknown deferral counts an attempt — killed. No-address exemption for in-app dropped — killed. Seam ignores Partial — killed. Dismiss unguarded — killed (lapse test). both completes without mailing — killed. Notice read ignores deleted/cancelled events — killed. Notice read ignores the rung — killed. Plus the guard test without its trigger — fails as it should.
Notes (none blocking)
- N1 (test). Add the one-rule-two-occurrences case beside
TestTwoRulesOnOneOccurrenceAreBothDeliveredInOnePass: in-app person, daily series starting in five minutes,h.drain(ctx, time.Now().Add(24*time.Hour)), expectsent == 2. It is the case the finer key protects, and today a key by rule alone passes everything. - N2 (spec +
reminder_seam.gocomment). "passes this function asRead" → "wraps this in a provider for its kind"; the return type differs andnowis unused. - N3 (comment). One sentence on
MarkReminderNoticethat the mark and the completion are two transactions and what the window costs (a notice naming a time a reschedule just moved, replaced by the next fire), asCompleteReminder's comment does for mail. - Bare
go testfailsTestCreditsMatchProductionDependencieshere as always;make ciis the gate and is green. - I did not open
/remindersin a browser; it is plain rastrillo rows and forms, so eyeball it on the canary before deploying.
Not deployed, not merged, nothing edited by me. Worktree removed.