Saved-search email notifications are a mock: sendEmailNotification logs and returns true without sending
Labels / Complexity: Frontend · Medium Complexity — Medium
Problem
src/lib/notificationService.ts sendEmailNotification is documented as a mock:
/**
* Send email notification (mock implementation)
*/
async sendEmailNotification(email, alert, savedSearch): Promise<boolean> {
// In a real implementation, this would call an email service API
logger.info('Sending email notification:', { ... });
// Simulate API delay
await this.delay(500);
// Mock success
return true;
}
The function is wired into the product: src/hooks/useNotificationChecker.ts calls it (line 43) after checkForNewMatches(searches) finds new properties, so users who save searches are told a notification was sent when no email is ever delivered. checkForNewMatches itself reads saved searches from localStorage (line 163-172), meaning the entire saved-search alert pipeline is local-only and the "email sent" outcome is fabricated. There is no mail service call, no delivery status, and no failure path — the promise resolves true unconditionally.
Root cause
src/lib/notificationService.ts sendEmailNotification (line ~66): log + delay(500) + return true, no transport.
Why this is architecturally hard
- The delivery contract must be defined. A real implementation needs a mail provider, template, and from-address — a third-party service decision the contributor must make (or gate behind an env-configured provider), plus a defined failure surface (
false on error) that callers must handle.
- Callers assume success.
useNotificationChecker.ts treats the return value as delivery; the fix must decide whether failures surface to the user or are retried, and the local-storage-only search source (line 163) means alerts only fire on the device where the search was saved — a separate limitation that interacts with any real mail path.
Acceptance criteria
sendEmailNotification either sends mail through a real, env-configured transport or returns false with a logged error; no unconditional true.
- A test asserts a transport failure returns
false and a success returns true, without sending real mail.
- The mock comment and
delay(500) simulation are removed.
npm run lint and npm test pass.
Out of scope
Syncing saved searches server-side (a separate product decision).
Getting started
Files: src/lib/notificationService.ts, src/hooks/useNotificationChecker.ts. Commands: npm run lint, npm test. Good first files to read: src/lib/notificationService.ts, src/hooks/useNotificationChecker.ts.
Saved-search email notifications are a mock: sendEmailNotification logs and returns true without sending
Labels / Complexity: Frontend · Medium Complexity — Medium
Problem
src/lib/notificationService.tssendEmailNotificationis documented as a mock:The function is wired into the product:
src/hooks/useNotificationChecker.tscalls it (line 43) aftercheckForNewMatches(searches)finds new properties, so users who save searches are told a notification was sent when no email is ever delivered.checkForNewMatchesitself reads saved searches fromlocalStorage(line 163-172), meaning the entire saved-search alert pipeline is local-only and the "email sent" outcome is fabricated. There is no mail service call, no delivery status, and no failure path — the promise resolvestrueunconditionally.Root cause
src/lib/notificationService.tssendEmailNotification(line ~66): log +delay(500)+return true, no transport.Why this is architecturally hard
falseon error) that callers must handle.useNotificationChecker.tstreats the return value as delivery; the fix must decide whether failures surface to the user or are retried, and the local-storage-only search source (line 163) means alerts only fire on the device where the search was saved — a separate limitation that interacts with any real mail path.Acceptance criteria
sendEmailNotificationeither sends mail through a real, env-configured transport or returnsfalsewith a logged error; no unconditionaltrue.falseand a success returnstrue, without sending real mail.delay(500)simulation are removed.npm run lintandnpm testpass.Out of scope
Syncing saved searches server-side (a separate product decision).
Getting started
Files:
src/lib/notificationService.ts,src/hooks/useNotificationChecker.ts. Commands:npm run lint,npm test. Good first files to read:src/lib/notificationService.ts,src/hooks/useNotificationChecker.ts.