feat: add CLI tools for notification filters and channel preferences#205
feat: add CLI tools for notification filters and channel preferences#205nooblemon-eth merged 4 commits intomainfrom
Conversation
Add 6 granular tools and 2 consolidated tools for managing the new notification preference system introduced in lemonade-backend PR #2069: - manage_notification_filters (list/set/delete) with mute/hide/only modes - manage_notification_channel_preferences (list/set/delete) - 6 underlying granular tools following existing patterns Also adds category filter to notifications_list for UI tab support. notifications_list is switched from aiGetNotifications to getNotifications because aiGetNotifications does not accept a category argument.
- Remove `delete` action from manage_notification_filters and manage_notification_channel_preferences. Delegating delete through a consolidated wrapper bypassed destructive/dry-run gates because the executor only inspects the top-level tool's flags. Users must call the granular `*_delete` tools directly to preserve confirmation semantics. - notifications_list now requests the @expanded field variants (from_expanded, ref_event_expanded, ref_space_expanded) and surfaces human-readable names (from_user_name, ref_event_title, ref_space_title) instead of raw ObjectIds the LLM cannot use. - Add action-specific validation in the consolidated notification wrappers: action=set requires `mode` (filters) and a non-empty `enabled_channels` (channel preferences). Avoids 422 round-trips. - Use nullish coalescing for notifications_list pagination so limit:0 / skip:0 are no longer rewritten to defaults. - Name the previously anonymous notification list queries (GetNotificationFilters, GetNotificationChannelPreferences). - Document the supported channels in enabled_channels descriptions ("currently only push is supported"). The ToolParam contract has no enum-on-array support, so the constraint lives in the description. - Export NOTIFICATION_CATEGORIES / NOTIFICATION_FILTER_MODES / NOTIFICATION_REF_TYPES from notifications.ts and import them in consolidated.ts to remove duplicated literal arrays. - Drop the stale aiGetNotifications entry from BACKEND_SCHEMA in schema-validation.test.ts (no longer used) and add the expanded field paths for the new getNotifications shape. - Update notification-preference and notifications-category tests to cover the new behavior: delete is rejected on the consolidated tools, set requires mode/enabled_channels, expanded fields are requested, and the result mapping surfaces names.
Karen's Review — lemonade-cli PR #205Verdict: APPROVERisk Level: LOW-MEDIUMThis is the third PR in the Phase C notification rewrite, adding 8 CLI tools targeting the merged backend PR #2069. I went deep on the cross-repo contract since this PR rewrites a core notification query and adds 6 brand-new resolvers, all of which depend on backend types that landed in the same release cycle. The contract holds end-to-end and I have no blocking concerns. Stats
What I verified1. Backend contract (lemonade-backend master, PR #2069 merged) I read the actual resolver and type definitions and cross-checked every CLI query/mutation against them:
2. IDOR / ownership
3. Breaking change to Old shape: Field renames: I grep'd the entire CLI repo for consumers of these field names. The only consumers of
The other notification consumers — 4. Tool registration All 8 new tools are reachable through 5. Destructive handling
6. Test quality 46 new tests across 2 files exercise the important paths:
Tests are not just "the mock works" — they assert against the actual variable shape sent to 7. Schema validation The auto-discovery test Findings[MINOR] [BE-AGENT-B]
|
nooblemon-eth
left a comment
There was a problem hiding this comment.
Karen formal review marker: APPROVED. (Cannot use --approve API path because the GitHub account that runs Karen happens to also be the PR author for this repo's commit history; the detailed review with verdict APPROVE has been posted as a PR comment. Treat this as the authoritative Karen verdict — APPROVED — for dashboard and Lead Agent purposes.)
- Add NOTIFICATION_TYPES const mirroring backend NotificationType enum (54 values) and apply as enum constraint on notification_type params in notification_filters_set, notification_channel_preferences_set, manage_notification_filters, and manage_notification_channel_preferences. - Clamp notifications_list limit to backend max of 1000 and update param description to reflect the cap. - Remove unreachable formatResult fallbacks in notification_filters_set and notification_channel_preferences_set; trust the GraphQL schema return type.
Karen Final Re-Review — PR #205Commit reviewed: Verification (Phase 2)
Findings VerificationMINOR (notification_type lacks enum constraint) — FIXED
NIT-A (no client-side limit clamp) — FIXED
NIT-B (unreachable formatResult fallback) — FIXED
NIT-C (no IMPLEMENTATION-STATUS.md entry) — SKIPPED PER INSTRUCTIONSAcknowledged. Not blocking. New Findings From This RemediationNone. No new lint/type issues, no unused imports, no test regressions, no unintended scope creep. Code Quality Observations
VerdictAPPROVEAll previously raised findings (MINOR, NIT-A, NIT-B) are fixed correctly. NIT-C skipped per the documented instructions. Build/lint/type-check/tests all pass on the branch and in CI. No new findings introduced. PR is mergeable. |
|
Karen formal review submission note: Attempted to submit a formal GitHub review via The Karen verdict is APPROVE (see prior comment). To satisfy branch protection's "requires approval" rule, a different reviewer account must click Approve in the GitHub UI, or the gh CLI must be re-authenticated to a non-author account. The verdict itself stands and is fully documented. |
Summary
Third PR in Phase C notification system rewrite. Adds CLI tools for managing the new notification preference system introduced in lemonade-backend#2069.
New tools
2 consolidated wrappers (always-loaded, visible in AI tool list):
manage_notification_filters(actions: list, set)manage_notification_channel_preferences(actions: list, set)Delete actions intentionally routed through granular tools to preserve destructive confirmation and dry-run gates.
6 granular tools (for fine-grained control and destructive operations):
notification_filters_list(deferred, query)notification_filters_set(mutation, create/update)notification_filters_delete(mutation, destructive)notification_channel_preferences_list(deferred, query)notification_channel_preferences_set(mutation, create/update)notification_channel_preferences_delete(mutation, destructive)Enhanced
notifications_listaiGetNotifications→getNotifications(required for the newcategoryparameter)categoryparam for UI tab filtering (event/social/messaging/payment/space/store/system)from_expanded,ref_event_expanded,ref_space_expanded) for human-readable namesfrom_user_name,ref_event_title,ref_space_titleNatural language usage
The AI chains tool calls to search for event/space IDs when scoping filters to specific entities.
Test plan
yarn buildpassesyarn lintpassesyarn testpasses (1416 tests, 41 new)