feat(inbox): saved-market move alerts - #1007
Open
AntonioVentilii wants to merge 8 commits into
Open
AntonioVentilii wants to merge 8 commits into
AntonioVentilii wants to merge 8 commits into
Conversation
Replace the removed mock streak/level seed cards with producers derived from the live profile: a flame-milestone card (3/7/15/30 days) and a level-up card, gated by a persisted high-water marker so a returning user sees no retroactive backlog and a broken-then-rebuilt streak re-notifies. The streak card respects the streak-reminder preference.
Wire the previously-dormant market notification kind to the existing saved-markets feature: when a saved, open market's YES probability shifts by at least MARKET_MOVE_THRESHOLD since last seen, surface a move card, gated by the notify.marketAlerts preference. A persisted per-market baseline seeds on first observation (no card) and advances on a fired move so the same shift can't re-fire; alerts are capped and aged out.
# Conflicts: # docs/ai/PRODUCT.md # src/lib/stores/inbox.store.ts
…ications # Conflicts: # src/lib/stores/inbox.store.ts
Correct the STREAK_MILESTONES docstring (the VXP award ladder uses 14, not the flame-stage 15, so the two are intentionally not coupled); guard milestoneWhen against a non-finite persisted stamp; skip the localStorage write when the marker is unchanged; and reload the marker on owner change so a previous user's seen markers can't suppress the next user's cards.
AntonioVentilii
added a commit
that referenced
this pull request
Jun 26, 2026
# Motivation Two inbox notification kinds — `streak` and `level` — have no producer since the mock seed was removed, so they can never fire. This wires them to live profile data so a daily-flame milestone or a level-up actually surfaces in the inbox. Implements spec `docs/ai/spec-driven-development/specs/2026-06-23-feat-streak-level-inbox-notifications.md` (the `market` kind is the sibling spec / PR #1007). Branch is merged up to current `main` (which had already removed the mock seed entirely), so this change is purely additive. # Changes - New `streakInboxStore` / `levelInboxStore` derived sources in `inbox.store.ts`, merged into `combinedInboxStore` (badge, list, toast, mark-read, dismiss, mark-all all apply). The streak card fires on a flame-stage milestone (3/7/15/30 days), the level card on a profile-level increase. - New persisted high-water marker (`INBOX_PROGRESS_STORAGE_KEY` + `inboxProgressStore`): seeds to the current value on first observation (no retroactive backlog on a fresh device), advances on acknowledge, and lowers when a streak breaks so re-climbing re-notifies. Maintained by `initInboxProgress`, mounted in `NotifToastHost` beside `initInboxToasts`. - Streak card respects `preferences.notify.streakReminder`; both route to their kind-default surface (Flow / Profile). - `streakMilestone` helper added to `streak.utils.ts`. - Identity-storage reconcile clears the new progress key on account switch. - docs/ai meta-update: `PRODUCT.md` documents the new inbox milestones; spec authored under `docs/ai/spec-driven-development/specs/`. - No analytics change — `notification_opened` already carries the kind as its label; no satellite change. # Tests - `npm run check:i18n` → 7 live locales aligned; new keys added to all live catalogs + pt-BR. - `npm run check` (svelte-check) → 0 errors, 0 warnings. - `npx prettier --check` + `npx eslint` on changed files → clean.
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.
Motivation
The
marketinbox kind ("a market you follow moved") and thenotify.marketAlertspreference were stubbed alongside the saved-markets feature but never wired —marketAlertsdid nothing and the kind had no producer. This connects them: saving a market is the follow signal, and a material YES move now notifies you. Implements specdocs/ai/spec-driven-development/specs/2026-06-23-feat-market-move-inbox-notifications.md. Stacked on #1006 (streak/level), which it sharesinbox.store.tswith.Changes
marketMoveInboxStorederived source +initMarketMoveAlertseffect (mounted inNotifToastHost): snapshots the YES probability of each saved, open market; seeds a baseline on first observation (no card); when the probability moves at leastMARKET_MOVE_THRESHOLD(10 pts) it records a move alert and advances the baseline so the same move can't re-fire. Gated bypreferences.notify.marketAlerts.MARKET_ALERT_MAX), windowed (MARKET_ALERT_WINDOW_MS) alert list + per-market baseline map, with the new keys cleared on identity switch. Baselines for un-saved markets are pruned; one live alert per market.inbox.market.*i18n (title + up/down body) across all live catalogs + pt-BR.PRODUCT.mddocuments saved-market move alerts; spec authored underdocs/ai/spec-driven-development/specs/.notification_openedalready carries the kind).Tests
npm run check:i18n→ 7 live locales aligned (2461 keys).npm run check(svelte-check) → 0 errors, 0 warnings.npx prettier --check+npx eslinton all changed files → clean (incl.--max-warnings 0).