fix: improve notification preferences and delivery workers - #1415
Open
Shindy-Ship wants to merge 4 commits into
Open
Conversation
Author
|
@StellarLend Hi! This PR is open and ready for review — happy to address any feedback. Thanks! |
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.
Overview
This PR hardens the notification preferences and delivery-worker surface by codifying explicit invariants for state, data, authorization, and failure handling. It adds focused unit/integration tests covering success, failure, loading, empty, retry, and permission states, plus keyboard/focus/screen-reader/responsive/reduced-motion verification for
NotificationPreferences.tsx. The supported API and component contracts are documented to prevent accidental breaking changes to existing consumers.Related Issue
Refs #
Changes
🧱 Invariant Enforcement
[MODIFY]
app/api/notifications/route.tslimit,offset,type, andreadfilters; returns400with structured error codes for boundary-violating input.[MODIFY]
app/api/notifications/[id]/route.ts404without leaking existence.[MODIFY]
app/api/notifications/stream/route.ts[MODIFY]
components/features/account/components/NotificationPreferences.tsxaria-liveregions, keyboard-accessible toggles, visible focus rings, responsive layout, andprefers-reduced-motionaware busy indicators.🧪 Test Coverage
[ADD]
src/__tests__/features/notifications/NotificationPreferences.test.tsx[ADD]
src/__tests__/app/api/notifications/route.test.ts[ADD]
src/__tests__/app/api/notifications/[id]/route.test.ts[ADD]
src/__tests__/app/api/notifications/stream/route.test.ts📚 API/Component Contract
NotificationPreferencesprops:Verification Results
Validation commands:
npm test,npm run test:accessibility,npm run lint,npm run typecheck.Design tradeoffs: ownership is enforced in the API routes rather than only in the UI so unauthorized reads/writes are blocked even if a client bypasses the component; idempotent mutations trade slightly larger request-handling logic for safe retries. Remaining limitations: stream heartbeats use a fixed interval; future work could make the interval configurable. No known pre-existing CI failures.
NotificationPreferencesRefs #<issue-number>Closes #1371