Description
The POST /api/notifications/test and POST /api/notifications/test-all endpoints are completely commented out in backend/src/api/routes.ts (approximately 190 lines of dead code, lines 739–928). Both endpoints are:
- Fully documented in
docs/NOTIFICATIONS.md with example curl commands
- Listed in
docs/API.md
- Referenced in README.md
- Callable from the frontend (
NotificationTest.tsx component)
Any user following the documented flow receives a 404 Route not found response.
Steps to Reproduce
Following docs/NOTIFICATIONS.md:
# 1. First subscribe to notifications
curl -X POST http://localhost:3001/api/notifications/subscribe \
-H "Content-Type: application/json" \
-d '{
"userId": "GABC...",
"emailEnabled": true,
"emailAddress": "user@example.com",
"events": ["rebalance", "riskChange"]
}'
# Returns 200 OK ✓
# 2. Then test a notification (documented in NOTIFICATIONS.md)
curl -X POST http://localhost:3001/api/notifications/test \
-H "Content-Type: application/json" \
-d '{"userId": "GABC...", "eventType": "rebalance"}'
# Returns: 404 {"success":false,"error":"Route not found"} ✗
Root Cause
backend/src/api/routes.ts, lines 739–928 — the entire POST /api/notifications/test and POST /api/notifications/test-all route handlers are wrapped in a block comment:
/*
router.post('/notifications/test', async (req, res) => {
// ... full implementation ...
})
router.post('/notifications/test-all', async (req, res) => {
// ... full implementation ...
})
*/
The NotificationTest.tsx frontend component calls these endpoints, meaning the notification testing UI is also broken.
Impact
- Developers cannot verify their notification configuration works before going live
- Frontend
NotificationTest.tsx component displays a test button that silently fails
- Documentation (
NOTIFICATIONS.md lines 337–388) provides curl examples that return 404
- Creates user-facing confusion: users can subscribe but cannot confirm delivery
Proposed Fix
Uncomment lines 739–928 in backend/src/api/routes.ts. If there was a deliberate reason for disabling these routes (e.g., security concern, incomplete implementation), that reason should be documented and the corresponding documentation should be updated to remove the curl examples.
If the intent is to gate these routes, consider using the existing debugGate middleware rather than commenting out the code:
// Only available in non-production environments
router.post('/notifications/test', debugGate, async (req, res) => {
// implementation
})
Files Affected
backend/src/api/routes.ts — lines 739–928 (uncomment)
frontend/src/components/NotificationTest.tsx — downstream affected
docs/NOTIFICATIONS.md — if routes remain disabled, remove lines 337–388
Description
The
POST /api/notifications/testandPOST /api/notifications/test-allendpoints are completely commented out inbackend/src/api/routes.ts(approximately 190 lines of dead code, lines 739–928). Both endpoints are:docs/NOTIFICATIONS.mdwith example curl commandsdocs/API.mdNotificationTest.tsxcomponent)Any user following the documented flow receives a
404 Route not foundresponse.Steps to Reproduce
Following
docs/NOTIFICATIONS.md:Root Cause
backend/src/api/routes.ts, lines 739–928 — the entirePOST /api/notifications/testandPOST /api/notifications/test-allroute handlers are wrapped in a block comment:The
NotificationTest.tsxfrontend component calls these endpoints, meaning the notification testing UI is also broken.Impact
NotificationTest.tsxcomponent displays a test button that silently failsNOTIFICATIONS.mdlines 337–388) provides curl examples that return 404Proposed Fix
Uncomment lines 739–928 in
backend/src/api/routes.ts. If there was a deliberate reason for disabling these routes (e.g., security concern, incomplete implementation), that reason should be documented and the corresponding documentation should be updated to remove the curl examples.If the intent is to gate these routes, consider using the existing
debugGatemiddleware rather than commenting out the code:Files Affected
backend/src/api/routes.ts— lines 739–928 (uncomment)frontend/src/components/NotificationTest.tsx— downstream affecteddocs/NOTIFICATIONS.md— if routes remain disabled, remove lines 337–388