mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
Reshape the goals feature to live on top of linked-account balances. A goal's balance is now the live balance of every depository account linked to it — no parallel ledger, no "log a contribution" step. The "Add contribution" affordance is replaced by a 7-day GoalPledge (kind: transfer | manual_save). GoalPledge::Reconciler matches incoming Transactions (via Account::ProviderImportAdapter) and Valuations (via Account::ReconciliationManager) against open pledges within ±5 days, ±$0.50, or ±1% — single hook covers every provider (Plaid, SimpleFIN, Lunchflow, Enable Banking, Brex, IBKR, Kraken, SnapTrade) plus manual balance edits. A 15-minute Sidekiq cron sweeps expired pledges. Goal model: balance derived from linked_accounts.sum(&:balance), new pace (90-day net non-transfer inflow), months_of_runway, last_matched_pledge_*, pledge_action_label_key (the "I just transferred…" vs "I just saved…" verb switch). UI: - Index gets a 3-card KPI strip (Contributed last 30d / Needs this month / On track) plus a pending-pledges callout. - Show page swaps the "Add contribution" CTA for the pledge modal, replaces the contribution list with a pending-pledge banner, and rebuilds the funding widget into per-account rows with a 12-bucket weekly sparkline and last-30 inflow. - Projection chart adds a required-line (dashed light from today → target) and a translucent pending-pledge bump at today's X. Schema (3 migrations): 1. goal_pledges table with PG enums (goal_pledge_kind, goal_pledge_status), open-by-expiry index, and unique-when-not-null matched_transaction_id. 2. Drop goal_contributions. 3. Partial unique index on transactions ((extra -> 'goal' ->> 'pledge_id')) built CONCURRENTLY so it doesn't block prod. After pulling: run bin/rails db:migrate, then commit the schema.rb sync separately (or let CI regenerate). Deferred to v1.1: allocation columns, contention/archived banners, "why is this behind?" diagnostic, reallocate flow, refresh-sync + Plaid throttle, unallocated-cash chip, joint-account approval, goal_activities log, polymorphic matched_entry_id/type for manual pledge audit.
51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
import_market_data:
|
|
cron: "0 22 * * 1-5" # 5:00 PM EST / 6:00 PM EDT (NY time) Monday through Friday
|
|
class: "ImportMarketDataJob"
|
|
queue: "scheduled"
|
|
description: "Imports market data daily at 5:00 PM EST (1 hour after market close)"
|
|
args:
|
|
mode: "full"
|
|
clear_cache: false
|
|
|
|
clean_syncs:
|
|
cron: "0 * * * *" # every hour
|
|
class: "SyncCleanerJob"
|
|
queue: "scheduled"
|
|
description: "Cleans up stale syncs"
|
|
|
|
run_security_health_checks:
|
|
cron: "0 2 * * 1-5" # 2:00 AM EST / 3:00 AM EDT (NY time) Monday through Friday
|
|
class: "SecurityHealthCheckJob"
|
|
queue: "scheduled"
|
|
description: "Runs security health checks to detect issues with security data"
|
|
|
|
sync_hourly:
|
|
cron: "0 * * * *" # every hour at the top of the hour
|
|
class: "SyncHourlyJob"
|
|
queue: "scheduled"
|
|
description: "Syncs provider items that opt-in to hourly syncing"
|
|
|
|
clean_data:
|
|
cron: "0 3 * * *" # daily at 3:00 AM
|
|
class: "DataCleanerJob"
|
|
queue: "scheduled"
|
|
description: "Cleans up old data (e.g., expired merchant associations, expired archived exports)"
|
|
|
|
clean_inactive_families:
|
|
cron: "0 4 * * *" # daily at 4:00 AM
|
|
class: "InactiveFamilyCleanerJob"
|
|
queue: "scheduled"
|
|
description: "Archives and destroys families that expired their trial without subscribing (managed mode only)"
|
|
|
|
refresh_demo_family:
|
|
cron: "0 5 * * *" # daily at 5:00 AM UTC
|
|
class: "DemoFamilyRefreshJob"
|
|
queue: "scheduled"
|
|
description: "Refreshes demo family data and emails super admins with daily usage summary"
|
|
|
|
sweep_expired_goal_pledges:
|
|
cron: "*/15 * * * *" # every 15 minutes
|
|
class: "SweepExpiredGoalPledgesJob"
|
|
queue: "scheduled"
|
|
description: "Marks goal pledges that passed their 7-day window as expired"
|