Skip to content

Adaptive notification#427

Merged
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
gloskull:adaptive-notification
May 28, 2026
Merged

Adaptive notification#427
RUKAYAT-CODER merged 3 commits into
rinafcode:mainfrom
gloskull:adaptive-notification

Conversation

@gloskull
Copy link
Copy Markdown
Contributor

Motivation

  • Reduce notification fatigue and battery usage by adapting delivery cadence to recent user activity instead of using a fixed frequency.
  • Enforce per-notification-type throttling so noisy channels (e.g. messages) don’t overwhelm inactive users.

Description

  • Added engagement tracking fields to the notification store: lastEngagedAt and lastNotificationSentAtByType and persisted them in storage (src/store/notificationStore.ts).
  • Implemented helper actions recordEngagement(), getNotificationThrottleMinutes() (returns 5/30/180 minutes based on inactivity), and shouldThrottleNotification(type, now?) to enforce per-type throttling and update last-sent timestamps (src/store/notificationStore.ts).
  • Wired behavior into notification handling: tapping a notification now calls recordEngagement(), and foreground notifications call shouldThrottleNotification() and are dropped (with a log) if they fall within the adaptive throttle window (src/utils/notificationHandlers.ts).
  • Added unit test coverage for engagement-aware throttling and updated existing notification store tests to initialize the new fields (src/__tests__/store/notificationStore.test.ts, tests/store/notificationStore.test.ts).
  • Documented the thresholds and behavior in README.md under "Adaptive Notification Throttling".

Testing

  • Attempted to run the modified tests with npm test -- src/__tests__/store/notificationStore.test.ts src/__tests__/utils/notificationHandlers.test.ts tests/store/notificationStore.test.ts which failed because the jest binary is not available in the environment (error: sh: 1: jest: not found).
  • Attempted to run tests with npx jest ... but fetching test runner failed due to registry access being blocked (npm error code E403), so tests could not be executed in this environment.
  • No automated test failures were observed in-repo (tests were added/updated), but the execution attempts above were blocked by the environment and therefore test results are inconclusive.

Closes #404

gloskull added 2 commits May 27, 2026 16:46
…pting delivery cadence to recent user activity instead of using a fixed frequency. - Enforce per-notification-type throttling so noisy channels (e.g. messages) don’t overwhelm inactive users. ### Description - Added engagement tracking fields to the notification store: `lastEngagedAt` and `lastNotificationSentAtByType` and persisted them in storage (`src/store/notificationStore.ts`). - Implemented helper actions `recordEngagement()`, `getNotificationThrottleMinutes()` (returns 5/30/180 minutes based on inactivity), and `shouldThrottleNotification(type, now?)` to enforce per-type throttling and update last-sent timestamps (`src/store/notificationStore.ts`). - Wired behavior into notification handling: tapping a notification now calls `recordEngagement()`, and foreground notifications call `shouldThrottleNotification()` and are dropped (with a log) if they fall within the adaptive throttle window (`src/utils/notificationHandlers.ts`). - Added unit test coverage for engagement-aware throttling and updated existing notification store tests to initialize the new fields (`src/__tests__/store/notificationStore.test.ts`, `tests/store/notificationStore.test.ts`). - Documented the thresholds and behavior in `README.md` under "Adaptive Notification Throttling". ### Testing - Attempted to run the modified tests with `npm test -- src/__tests__/store/notificationStore.test.ts src/__tests__/utils/notificationHandlers.test.ts tests/store/notificationStore.test.ts` which failed because the `jest` binary is not available in the environment (error: `sh: 1: jest: not found`). - Attempted to run tests with `npx jest ...` but fetching test runner failed due to registry access being blocked (`npm error code E403`), so tests could not be executed in this environment. - No automated test failures were observed in-repo (tests were added/updated), but the execution attempts above were blocked by the environment and therefore test results are inconclusive. ------ Closes rinafcode#404

feat: adaptive notification throttling based on user engagement
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@gloskull Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

kindly resolve conflict.

@RUKAYAT-CODER RUKAYAT-CODER merged commit b9eddb6 into rinafcode:main May 28, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement adaptive notification throttling based on user engagement

2 participants