feat: family opt-in to plan alerts (alert_subscribers) — PR 1/2#10
Merged
Conversation
Plan alerts (DOWN/BACK UP, storm, low-wait) had exactly one hard-wired recipient — the shared-partition owner. Adds per-plan opt-in: - `alert_subscribers`: DDB String Set of ADDITIONAL recipient ids on each PLAN# row. Owner stays implicit and always alerted; absent attribute = owner-only (pre-feature behavior, zero migration). Mutated ONLY via atomic ADD/DELETE so web/MCP edits can't race (and they never touch the attributes the plan-edit tools rewrite). - Poller: build_active_plan_ride_index emits per-recipient entries on both fanout surfaces (per-ride index for DOWN/UP/low-wait; active_plans for weather). Existing resolver/cooldown/window gates unchanged. - New MCP tool set_plan_alert_subscription(member, subscribed, trip_id/ date), both transports: resolves member → the USER#<id>/PROFILE the poller alerts on (friendly-name→sub map on HTTP), trip-wide or per-day, errors with instructions when the member has no /me profile, warns when the profile lacks a Pushover key. - HTTP record_plan/create_trip seed the creator's sub (owner excepted) — a family member's own plans alert them by default. - record_plan's upsert merge carries alert_subscribers forward (the same wipe hazard that once ate completed_rides). - _convert_decimals converts sets → sorted lists (SS isn't JSON- serializable; raw rows appear in tool returns). Tests: 15 new (tool add/remove/errors/warning, upsert carry + seed-merge, poller fanout expansion incl. owner-dedup, http creator seed). Web self-serve toggle on /trips is PR 2. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Adds
alert_subscribers(atomic String Set) on plan rows, per-recipient poller fanout on all plan-alert surfaces, theset_plan_alert_subscriptionMCP tool (both transports), creator auto-seed on HTTP, and the upsert carry-forward. Owner stays implicit — absent attribute is exactly the old behavior. Web self-serve toggle is PR 2.🤖 Generated with Claude Code