Skip to content

feat: extract structured data from notifications#617

Merged
sigvardt merged 5 commits intomainfrom
ai/issue-613-notifications-make-it-production-grade
Mar 25, 2026
Merged

feat: extract structured data from notifications#617
sigvardt merged 5 commits intomainfrom
ai/issue-613-notifications-make-it-production-grade

Conversation

@sigvardt
Copy link
Copy Markdown
Owner

@sigvardt sigvardt commented Mar 23, 2026

Summary

Hardens the notification extraction feature to production quality by fixing type safety issues, eliminating redundant work, removing dead code, adding CLI parity, and adding comprehensive unit test coverage.

Closes #613

Changes

Type Safety & Performance (linkedinNotifications.ts)

  • Cache extraction result: extractStructuredData(message) was called twice per notification (once for truthiness check, once for value). Now cached in a local variable.
  • Remove unsafe cast: Replaced Record<string, unknown> + as unknown as LinkedInNotification double-cast with a properly typed LinkedInNotification object built directly.
  • Remove dead filter: The isMatch() function checked n.extracted_data.notification_category but extractStructuredData() never sets that field. Removed the dead code path.
  • Testable export: Added module-level _extractNotificationStructuredData() mirror function following the existing _-prefix testing export convention (Playwright constraint: browser-evaluated functions must be self-contained, so the inline copy remains).

CLI Parity (cli/src/bin/linkedin.ts)

  • Added --types <types...> (-t) variadic option to notifications list command, matching the existing MCP tool parameter.

Test Coverage (__tests__/linkedinNotifications.test.ts)

  • 18 new unit tests covering all 9 regex parsers: post analytics, profile views, search appearances, mentions, connections, newsletter subscribers, job alerts, company posts, and trending.
  • Edge case coverage: unmatched messages, empty strings, whitespace normalization.

Verification

  • Lint: ✅ clean
  • Typecheck: ✅ clean
  • Build: ✅ clean
  • Tests: ✅ 1632 passed (120 files) — up from 1614

@github-actions
Copy link
Copy Markdown

⚠️ Auto-rebase failed due to merge conflicts. Issue #613 relabeled for the orchestrator to resolve conflicts on this branch.

@sigvardt sigvardt force-pushed the ai/issue-613-notifications-make-it-production-grade branch from a9434f5 to 5a6ce55 Compare March 23, 2026 18:07
…it tests

- Cache extractStructuredData result instead of calling twice per notification
- Replace unsafe double-cast (as unknown as LinkedInNotification) with properly typed object
- Remove dead notification_category filter condition from isMatch()
- Add module-level _extractNotificationStructuredData export for testing
- Add --types option to CLI notifications list command for parity with MCP
- Add 18 unit tests covering all 9 regex parsers and edge cases
@sigvardt sigvardt merged commit f2f5594 into main Mar 25, 2026
5 checks passed
@sigvardt sigvardt deleted the ai/issue-613-notifications-make-it-production-grade branch March 25, 2026 09:51
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.

Notifications: make it production-grade

1 participant