feat: show internal team members note in meeting briefing emails#1199
feat: show internal team members note in meeting briefing emails#1199
Conversation
Add a note at the bottom of meeting briefing emails listing internal team members who are also attending the meeting, clarifying that briefings are only generated for external guests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds detection and propagation of internal team members into meeting briefing data and email content: introduces Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Job as Briefing Job
participant Gather as gatherContextForEvent
participant Processor as runMeetingBrief
participant Sender as sendBriefingEmail
participant Template as MeetingBriefingEmail
Note over Job,Gather: Start briefing generation
Job->>Gather: request meeting context (attendees, user)
Gather-->>Job: MeetingBriefingData (includes internalTeamMembers)
Job->>Processor: runMeetingBrief(with briefingData)
Processor->>Sender: sendBriefingEmail(briefingContent, internalTeamMembers, ...)
Sender->>Template: render email with briefingContent + internalTeamMembers
Template-->>Sender: rendered HTML/email payload
Sender-->>Processor: email sent / result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (15)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)
Files:
apps/web/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/security.mdc)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Files:
**/*.{tsx,ts,css}📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
!(pages/_document).{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Files:
**/{utils,helpers,lib}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
Files:
apps/web/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/**/*.{ts,tsx,js,jsx,json,css}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/**/*.{example,ts,json}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Files:
**/*.{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
🧠 Learnings (4)📓 Common learnings📚 Learning: 2026-01-05T13:44:53.648ZApplied to files:
📚 Learning: 2026-01-05T13:44:53.648ZApplied to files:
📚 Learning: 2025-07-17T04:19:57.099ZApplied to files:
🧬 Code graph analysis (2)apps/web/utils/meeting-briefs/gather-context.ts (3)
packages/resend/emails/meeting-briefing.tsx (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add internal team member note to meeting briefing emails by passing
|
| <Section className="px-8 pb-4"> | ||
| {renderGuestBriefings(briefingContent.guests)} | ||
| {briefingContent.internalTeamMembers && | ||
| renderInternalTeamNote(briefingContent.internalTeamMembers)} |
There was a problem hiding this comment.
Would it make sense to call renderInternalTeamNote(briefingContent.internalTeamMembers ?? []) unconditionally here? The helper already returns null for empty arrays, so the extra guard just adds noise without changing the rendered output.
| <Section className="px-8 pb-4"> | |
| {renderGuestBriefings(briefingContent.guests)} | |
| {briefingContent.internalTeamMembers && | |
| renderInternalTeamNote(briefingContent.internalTeamMembers)} | |
| <Section className="px-8 pb-4"> | |
| {renderGuestBriefings(briefingContent.guests)} | |
| {renderInternalTeamNote(briefingContent.internalTeamMembers ?? [])} |
Finding type: Conciseness
There was a problem hiding this comment.
Good suggestion! Applied the change - now calling renderInternalTeamNote(briefingContent.internalTeamMembers ?? []) unconditionally since the helper already returns null for empty arrays.
There was a problem hiding this comment.
Commit 36a3cc7 addressed this comment. The conditional guard briefingContent.internalTeamMembers && was removed, and the function is now called unconditionally with renderInternalTeamNote(briefingContent.internalTeamMembers ?? []), exactly as suggested. This improves code conciseness while maintaining the same rendered output.
| return event.attendees.filter((attendee) => { | ||
| const normalizedAttendeeEmail = attendee.email.trim().toLowerCase(); | ||
| const attendeeDomain = extractDomainFromEmail(normalizedAttendeeEmail); | ||
|
|
||
| if (!attendeeDomain) return false; | ||
|
|
||
| // Internal team members share the same domain but are not the user themselves | ||
| return ( | ||
| attendeeDomain === normalizedUserDomain && | ||
| normalizedAttendeeEmail !== normalizedUserEmail | ||
| ); |
There was a problem hiding this comment.
Since extractDomainFromEmail can return undefined, the guard (if (!attendeeDomain) return false;) seems redundant—could we just return the boolean expression directly and flatten the function?
| return event.attendees.filter((attendee) => { | |
| const normalizedAttendeeEmail = attendee.email.trim().toLowerCase(); | |
| const attendeeDomain = extractDomainFromEmail(normalizedAttendeeEmail); | |
| if (!attendeeDomain) return false; | |
| // Internal team members share the same domain but are not the user themselves | |
| return ( | |
| attendeeDomain === normalizedUserDomain && | |
| normalizedAttendeeEmail !== normalizedUserEmail | |
| ); | |
| return event.attendees.filter((attendee) => { | |
| const normalizedAttendeeEmail = attendee.email.trim().toLowerCase(); | |
| const attendeeDomain = extractDomainFromEmail(normalizedAttendeeEmail); | |
| // Internal team members share the same domain but are not the user themselves | |
| return ( | |
| attendeeDomain && | |
| attendeeDomain === normalizedUserDomain && | |
| normalizedAttendeeEmail !== normalizedUserEmail | |
| ); |
Finding type: Conciseness
There was a problem hiding this comment.
Applied! Flattened the filter to include attendeeDomain && in the return expression rather than using a separate guard clause.
There was a problem hiding this comment.
Actionable comments posted: 1
Fix all issues with AI Agents 🤖
In @apps/web/utils/meeting-briefs/send-briefing.ts:
- Around line 41-45: The returned Zod type from generate-briefing.ts (used by
aiGenerateMeetingBriefing) only defines BriefingContent as { guests:
GuestBriefing[] } while sendBriefingEmail expects the email package
BriefingContent which includes optional internalTeamMembers; fix by either
updating the Zod schema in generate-briefing.ts to include internalTeamMembers?:
InternalTeamMember[] so the generated BriefingContent matches the email package,
or if the separation is intentional, explicitly cast the value when calling
sendBriefingEmail (e.g., assert/convert the Zod result to the email package
BriefingContent) and keep the merge of internalTeamMembers in send-briefing.ts
to satisfy the parameter type.
🧹 Nitpick comments (4)
packages/resend/emails/meeting-briefing.tsx (1)
19-22: Type duplication: InternalTeamMember defined in multiple locations.The
InternalTeamMembertype is defined here and also inapps/web/utils/meeting-briefs/gather-context.ts(lines 26-29). While the definitions currently match, maintaining identical types in multiple locations risks drift over time.Consider keeping a single source of truth for this type. Since
send-briefing.tsalready imports it from this email package, you could remove the duplicate definition fromgather-context.tsand import from here instead.🔎 Recommended approach
Keep the type definition here in the email package and import it in
gather-context.ts:+import type { InternalTeamMember } from "@inboxzero/resend/emails/meeting-briefing"; + -export interface InternalTeamMember { - email: string; - name?: string; -}apps/web/__tests__/ai-meeting-briefing.test.ts (1)
40-51: LGTM: Test fixture properly initialized with new field.The
internalTeamMembers: []initialization is appropriate for the test fixture, providing a valid default value.Consider adding a test case that verifies the internal team members flow (e.g., ensuring they're properly excluded from briefing generation but included in the email context). However, this can be deferred as the existing tests cover the core briefing functionality.
apps/web/utils/meeting-briefs/gather-context.ts (2)
26-29: Type duplication: See comment in packages/resend/emails/meeting-briefing.tsx.This
InternalTeamMemberinterface duplicates the type defined inpackages/resend/emails/meeting-briefing.tsx. Please see the review comment on lines 19-22 of that file for the recommended approach.
184-204: LGTM: Logic correctly identifies internal team members.The function properly:
- Normalizes email addresses for comparison
- Filters attendees by matching domain
- Excludes the user themselves from the internal team list
getInternalTeamMembersandgetExternalAttendees(lines 163-182) share significant logic: email normalization, domain extraction, and filtering patterns. Consider extracting common logic into a shared helper function to reduce duplication:function filterAttendeesByDomain( event: CalendarEvent, userEmail: string, userDomain: string, includeSameDomain: boolean ): CalendarEventAttendee[] { // Shared normalization and filtering logic }This is a maintainability improvement that can be deferred.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
.claude/commands/address-pr-comments.md.claude/commands/create-pr.md.claude/commands/next-step.md.claude/commands/polish.md.claude/commands/review.md.claude/commands/step-by-step.mdapps/web/__tests__/ai-meeting-briefing.test.tsapps/web/utils/meeting-briefs/gather-context.tsapps/web/utils/meeting-briefs/process.tsapps/web/utils/meeting-briefs/send-briefing.tspackages/resend/emails/meeting-briefing.tsx
🧰 Additional context used
📓 Path-based instructions (23)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)
**/*.{ts,tsx}: For API GET requests to server, use theswrpackage
Useresult?.serverErrorwithtoastErrorfrom@/components/Toastfor error handling in async operations
**/*.{ts,tsx}: Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls
**/*.{ts,tsx}: For early access feature flags, create hooks using the naming conventionuse[FeatureName]Enabledthat return a boolean fromuseFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming conventionuse[FeatureName]Variantthat define variant types, useuseFeatureFlagVariantKey()with type casting, and provide a default "control" fallback
Use kebab-case for PostHog feature flag keys (e.g.,inbox-cleaner,pricing-options-2)
Always define types for A/B test variant flags (e.g.,type PricingVariant = "control" | "variant-a" | "variant-b") and provide type safety through type casting
**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use empty type parameters in type aliases and interfaces
Don't use this and super in static contexts
Don't use any or unknown as type constraints
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Don't export imported variables
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions
Don't use TypeScript namespaces
Don't use non-null assertions with the!postfix operator
Don't use parameter properties in class constructors
Don't use user-defined types
Useas constinstead of literal types and type annotations
Use eitherT[]orArray<T>consistently
Initialize each enum member value explicitly
Useexport typefor types
Use `impo...
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)
Always import Prisma enums from
@/generated/prisma/enumsinstead of@/generated/prisma/clientto avoid Next.js bundling errors in client componentsImport Prisma using the project's centralized utility:
import prisma from '@/utils/prisma'
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
apps/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Import specific lodash functions rather than entire lodash library to minimize bundle size (e.g.,
import groupBy from 'lodash/groupBy')
apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Do not export types/interfaces that are only used within the same file. Export later if needed
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tsapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/security.mdc)
**/*.ts: ALL database queries MUST be scoped to the authenticated user/account by including user/account filtering in WHERE clauses to prevent unauthorized data access
Always validate that resources belong to the authenticated user before performing operations, using ownership checks in WHERE clauses or relationships
Always validate all input parameters for type, format, and length before using them in database queries
Use SafeError for error responses to prevent information disclosure. Generic error messages should not reveal internal IDs, logic, or resource ownership details
Only return necessary fields in API responses using Prisma'sselectoption. Never expose sensitive data such as password hashes, private keys, or system flags
Prevent Insecure Direct Object References (IDOR) by validating resource ownership before operations. AllfindUnique/findFirstcalls MUST include ownership filters
Prevent mass assignment vulnerabilities by explicitly whitelisting allowed fields in update operations instead of accepting all user-provided data
Prevent privilege escalation by never allowing users to modify system fields, ownership fields, or admin-only attributes through user input
AllfindManyqueries MUST be scoped to the user's data by including appropriate WHERE filters to prevent returning data from other users
Use Prisma relationships for access control by leveraging nested where clauses (e.g.,emailAccount: { id: emailAccountId }) to validate ownership
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tsapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI and Tailwind for components and styling
Usenext/imagepackage for images
For API GET requests to server, use theswrpackage with hooks likeuseSWRto fetch data
For text inputs, use theInputcomponent withregisterPropsfor form integration and error handling
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/*.{tsx,ts,css}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Implement responsive design with Tailwind CSS using a mobile-first approach
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{js,jsx,ts,tsx}: Don't useaccessKeyattribute on any HTML element
Don't setaria-hidden="true"on focusable elements
Don't add ARIA roles, states, and properties to elements that don't support them
Don't use distracting elements like<marquee>or<blink>
Only use thescopeprop on<th>elements
Don't assign non-interactive ARIA roles to interactive HTML elements
Make sure label elements have text content and are associated with an input
Don't assign interactive ARIA roles to non-interactive HTML elements
Don't assigntabIndexto non-interactive HTML elements
Don't use positive integers fortabIndexproperty
Don't include "image", "picture", or "photo" in img alt prop
Don't use explicit role property that's the same as the implicit/default role
Make static elements with click handlers use a valid role attribute
Always include atitleelement for SVG elements
Give all elements requiring alt text meaningful information for screen readers
Make sure anchors have content that's accessible to screen readers
AssigntabIndexto non-interactive HTML elements witharia-activedescendant
Include all required ARIA attributes for elements with ARIA roles
Make sure ARIA properties are valid for the element's supported roles
Always include atypeattribute for button elements
Make elements with interactive roles and handlers focusable
Give heading elements content that's accessible to screen readers (not hidden witharia-hidden)
Always include alangattribute on the html element
Always include atitleattribute for iframe elements
AccompanyonClickwith at least one of:onKeyUp,onKeyDown, oronKeyPress
AccompanyonMouseOver/onMouseOutwithonFocus/onBlur
Include caption tracks for audio and video elements
Use semantic elements instead of role attributes in JSX
Make sure all anchors are valid and navigable
Ensure all ARIA properties (aria-*) are valid
Use valid, non-abstract ARIA roles for elements with ARIA roles
Use valid AR...
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
!(pages/_document).{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Don't use the next/head module in pages/_document.js on Next.js projects
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts,jsx,tsx}: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size (e.g.,import groupBy from 'lodash/groupBy')
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tspackages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
**/{utils,helpers,lib}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
Logger should be passed as a parameter to helper functions instead of creating their own logger instances
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
apps/web/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
apps/web/**/*.{ts,tsx,js,jsx}: Use@/path aliases for imports from project root
Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments
Add helper functions to the bottom of files, not the top
All imports go at the top of files, no mid-file dynamic imports
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tsapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
apps/web/**/*.{ts,tsx,js,jsx,json,css}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Format code with Prettier
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tsapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
apps/web/**/*.{example,ts,json}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Add environment variables to
.env.example,env.ts, andturbo.json
Files:
apps/web/utils/meeting-briefs/gather-context.tsapps/web/__tests__/ai-meeting-briefing.test.tsapps/web/utils/meeting-briefs/send-briefing.tsapps/web/utils/meeting-briefs/process.ts
apps/web/__tests__/**/*.test.ts
📄 CodeRabbit inference engine (.cursor/rules/llm-test.mdc)
apps/web/__tests__/**/*.test.ts: Place all LLM-related tests inapps/web/__tests__/directory
Use vitest imports (describe,expect,test,vi,beforeEach) in LLM test files
Mock 'server-only' module with empty object in LLM test files:vi.mock("server-only", () => ({}))
Set timeout constantconst TIMEOUT = 15_000;for LLM tests
Usedescribe.runIf(isAiTest)with environment variableRUN_AI_TESTS === "true"to conditionally run LLM tests
Useconsole.debug()for outputting generated LLM content in tests, e.g.,console.debug("Generated content:\n", result.content);
Prefer using existing helpers from@/__tests__/helpers.ts(getEmailAccount,getEmail,getRule,getMockMessage,getMockExecutedRule) instead of creating custom test data helpers
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
apps/web/{utils/ai,utils/llms,__tests__}/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/llm.mdc)
LLM-related code must be organized in specific directories:
apps/web/utils/ai/for main implementations,apps/web/utils/llms/for core utilities and configurations, andapps/web/__tests__/for LLM-specific tests
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
**/*.{test,spec}.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{test,spec}.{js,jsx,ts,tsx}: Don't nest describe() blocks too deeply in test files
Don't use callbacks in asynchronous tests and hooks
Don't have duplicate hooks in describe blocks
Don't use export or module.exports in test files
Don't use focused tests
Make sure the assertion function, like expect, is placed inside an it() function call
Don't use disabled tests
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
**/{scripts,tests,__tests__}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
Use createScopedLogger only for code that doesn't run within a middleware chain, such as standalone scripts or tests
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
apps/web/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Co-locate test files next to source files (e.g.,
utils/example.test.ts). Only E2E and AI tests go in__tests__/
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
**/*.test.{ts,tsx}: Usevitestas the testing framework
Colocate test files next to the tested file with.test.tsor.test.tsxnaming convention (e.g.,dir/format.tsanddir/format.test.ts)
Mockserver-onlyusingvi.mock("server-only", () => ({}))
Mock Prisma usingvi.mock("@/utils/prisma")and the provided mock from@/utils/__mocks__/prisma
Use test helper functionsgetEmail,getEmailAccount, andgetRulefrom@/__tests__/helpersfor creating mock data
Clear all mocks between tests usingbeforeEach(() => { vi.clearAllMocks(); })
Use descriptive test names that clearly indicate what is being tested
Do not mock the Logger in tests
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
**/__tests__/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
Place AI tests in the
__tests__directory and do not run them by default as they use a real LLM
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
**/*.test.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/notes.mdc)
Co-locate test files next to source files (e.g.,
utils/example.test.ts). Only E2E and AI tests go in__tests__/
Files:
apps/web/__tests__/ai-meeting-briefing.test.ts
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
**/*.tsx: Use theLoadingContentcomponent to handle loading states instead of manual loading state management
For text areas, use theInputcomponent withtype='text',autosizeTextareaprop set to true, andregisterPropsfor form integration
Files:
packages/resend/emails/meeting-briefing.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{jsx,tsx}: Don't use unnecessary fragments
Don't pass children as props
Don't use the return value of React.render
Make sure all dependencies are correctly specified in React hooks
Make sure all React hooks are called from the top level of component functions
Don't forget key props in iterators and collection literals
Don't define React components inside other components
Don't use event handlers on non-interactive elements
Don't assign to React component props
Don't use bothchildrenanddangerouslySetInnerHTMLprops on the same element
Don't use dangerous JSX props
Don't use Array index in keys
Don't insert comments as text nodes
Don't assign JSX properties multiple times
Don't add extra closing tags for components without children
Use<>...</>instead of<Fragment>...</Fragment>
Watch out for possible "wrong" semicolons inside JSX elements
Make sure void (self-closing) elements don't have children
Don't usetarget="_blank"withoutrel="noopener"
Don't use<img>elements in Next.js projects
Don't use<head>elements in Next.js projects
Files:
packages/resend/emails/meeting-briefing.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-17T04:19:57.099Z
Learnt from: edulelis
Repo: elie222/inbox-zero PR: 576
File: packages/resend/emails/digest.tsx:78-83
Timestamp: 2025-07-17T04:19:57.099Z
Learning: In packages/resend/emails/digest.tsx, the DigestEmailProps type uses `[key: string]: DigestItem[] | undefined | string | Date | undefined` instead of intersection types like `& Record<string, DigestItem[] | undefined>` due to implementation constraints. This was the initial implementation approach and cannot be changed to more restrictive typing.
Applied to files:
packages/resend/emails/meeting-briefing.tsxapps/web/utils/meeting-briefs/send-briefing.ts
🧬 Code graph analysis (2)
apps/web/utils/meeting-briefs/gather-context.ts (3)
packages/resend/emails/meeting-briefing.tsx (1)
InternalTeamMember(19-22)apps/web/utils/calendar/event-types.ts (2)
CalendarEvent(6-16)CalendarEventAttendee(1-4)apps/web/utils/email.ts (1)
extractDomainFromEmail(86-104)
packages/resend/emails/meeting-briefing.tsx (2)
apps/web/utils/meeting-briefs/gather-context.ts (1)
InternalTeamMember(26-29)apps/web/utils/ai/meeting-briefs/generate-briefing.ts (1)
BriefingContent(41-41)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Baz Reviewer
- GitHub Check: cubic · AI code reviewer
- GitHub Check: test
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
packages/resend/emails/meeting-briefing.tsx (2)
60-72: LGTM: Clean implementation of internal team note rendering.The
renderInternalTeamNotefunction properly handles the empty case, uses appropriate fallback logic (member.name || member.email), and renders a clear, visually distinct note.
122-123: LGTM: Conditional rendering correctly guards against missing data.apps/web/utils/meeting-briefs/process.ts (1)
209-218: LGTM: Properly forwards internal team members through the pipeline.The change correctly passes
briefingData.internalTeamMemberstosendBriefingEmail, maintaining the data flow from context gathering to email sending.apps/web/utils/meeting-briefs/gather-context.ts (1)
55-59: LGTM: Internal team members correctly identified and included.The logic properly retrieves internal attendees using domain matching and excludes the user themselves. The mapping to the expected interface shape is correct.
Also applies to: 106-109
apps/web/utils/meeting-briefs/send-briefing.ts (1)
16-34: LGTM: Function signature correctly extended with internal team members.The parameter addition is properly typed and documented through the function signature.
| // Merge internal team members into briefing content for the email | ||
| const briefingContentWithTeam: BriefingContent = { | ||
| ...briefingContent, | ||
| internalTeamMembers, | ||
| }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify that the Zod schema in generate-briefing.ts includes internalTeamMembers
echo "=== Checking briefingSchema definition in generate-briefing.ts ==="
rg -A 20 "briefingSchema\s*=" --type ts apps/web/utils/ai/meeting-briefs/generate-briefing.ts
echo -e "\n=== Checking BriefingContent type export ==="
rg "export type BriefingContent" --type ts apps/web/utils/ai/meeting-briefs/
echo -e "\n=== Checking send-briefing.ts imports ==="
rg -A 5 "^import" --type ts apps/web/utils/meeting-briefs/send-briefing.ts | head -20Repository: elie222/inbox-zero
Length of output: 2054
🏁 Script executed:
#!/bin/bash
# Check the sendBriefingEmail function signature
echo "=== Function signature and briefingContent source ==="
rg -B 5 "briefingContentWithTeam" --type ts apps/web/utils/meeting-briefs/send-briefing.ts
echo -e "\n=== Check if aiGenerateMeetingBriefing is called in this file ==="
rg "aiGenerateMeetingBriefing" --type ts apps/web/utils/meeting-briefs/
echo -e "\n=== Check email package BriefingContent definition ==="
rg "type BriefingContent" --type ts --type tsxRepository: elie222/inbox-zero
Length of output: 1011
🏁 Script executed:
#!/bin/bash
# Get the full function signature with parameter types
echo "=== Full sendBriefingEmail function signature ==="
rg -B 2 "export async function sendBriefingEmail" --type ts apps/web/utils/meeting-briefs/send-briefing.ts
echo -e "\n=== Where sendBriefingEmail is called from ==="
rg "sendBriefingEmail" --type ts apps/web/utils/meeting-briefs/process.ts -B 2 -A 2
echo -e "\n=== Check BriefingContent in email package (search broader) ==="
find . -name "*.ts" -o -name "*.tsx" | xargs grep -l "type BriefingContent" 2>/dev/null | head -10Repository: elie222/inbox-zero
Length of output: 915
🏁 Script executed:
#!/bin/bash
# Get full function signature with parameter types
echo "=== Full sendBriefingEmail function with all parameters ==="
rg -A 15 "export async function sendBriefingEmail" --type ts apps/web/utils/meeting-briefs/send-briefing.ts
echo -e "\n=== BriefingContent definition in email package ==="
cat packages/resend/emails/meeting-briefing.tsx | head -100
echo -e "\n=== Full process.ts flow with briefingContent ==="
rg -A 10 "const briefingContent = await aiGenerateMeetingBriefing" --type ts apps/web/utils/meeting-briefs/process.tsRepository: elie222/inbox-zero
Length of output: 3430
Clarify BriefingContent type mismatch between Zod schema and email package.
The code is functionally correct, but there's a type annotation issue to address:
aiGenerateMeetingBriefing(process.ts) returnsBriefingContentfrom the Zod schema in generate-briefing.ts, which only includes{ guests: GuestBriefing[] }sendBriefingEmailexpectsbriefingContent: BriefingContentfrom the email package, which is{ guests: GuestBriefing[]; internalTeamMembers?: InternalTeamMember[] }
The spread merge at lines 41-45 correctly produces the email package shape by explicitly adding internalTeamMembers. However, the mismatch between the Zod schema type and the function parameter type should be resolved—either by:
- Updating the Zod schema in generate-briefing.ts to include the optional
internalTeamMembersfield, or - Explicitly casting the type if the separation is intentional for architectural reasons
🤖 Prompt for AI Agents
In @apps/web/utils/meeting-briefs/send-briefing.ts around lines 41-45, The
returned Zod type from generate-briefing.ts (used by aiGenerateMeetingBriefing)
only defines BriefingContent as { guests: GuestBriefing[] } while
sendBriefingEmail expects the email package BriefingContent which includes
optional internalTeamMembers; fix by either updating the Zod schema in
generate-briefing.ts to include internalTeamMembers?: InternalTeamMember[] so
the generated BriefingContent matches the email package, or if the separation is
intentional, explicitly cast the value when calling sendBriefingEmail (e.g.,
assert/convert the Zod result to the email package BriefingContent) and keep the
merge of internalTeamMembers in send-briefing.ts to satisfy the parameter type.
There was a problem hiding this comment.
Commit 36a3cc7 addressed this comment by adding an expanded explanatory comment that clarifies the intentional architectural separation: the AI generates only {guests} while internalTeamMembers comes from gather-context.ts via domain-based filtering. This documentation addresses the "clarify" request in the comment title by explaining why the type mismatch exists and that the separation is by design.
There was a problem hiding this comment.
Skipped: comment is from another GitHub bot.
There was a problem hiding this comment.
The type separation is intentional by design:
- The Zod schema in
generate-briefing.tsonly has{guests}because the AI only generates guest briefings internalTeamMemberscomes from domain-based filtering ingather-context.ts(not AI-researched)- The merge at lines 41-45 correctly combines them for the email
Added a clarifying comment explaining this separation. Keeping the Zod schema focused on what the AI actually generates seems cleaner than having it include a field the AI doesn't populate.
There was a problem hiding this comment.
@elie222, thank you for the clarification! That makes perfect sense. Keeping the Zod schema focused strictly on what the AI generates (guest briefings) and handling the domain-filtered data (internalTeamMembers) separately is a clean architectural separation. The merge in send-briefing.ts correctly combines both data sources for the email template.
The added comment in the code will help future reviewers understand this intentional design choice. Appreciate the explanation!
🐰💭
Architectural clarity
is a gift—
thank you!
✏️ Learnings added
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1199
File: apps/web/utils/meeting-briefs/send-briefing.ts:0-0
Timestamp: 2026-01-05T13:44:53.648Z
Learning: In apps/web/utils/meeting-briefs/, the Zod schema in generate-briefing.ts intentionally only includes `{guests: GuestBriefing[]}` because the AI only generates guest briefings. The `internalTeamMembers` field comes from domain-based filtering in gather-context.ts (not AI-researched) and is merged into the BriefingContent in send-briefing.ts before sending the email. This separation keeps the Zod schema focused on what the AI actually generates.
<!-- [add_learning]
In the meeting briefing feature (apps/web/utils/meeting-briefs/), there's an intentional type separation: the Zod schema BriefingContent type from generate-briefing.ts differs from the email package BriefingContent type in packages/resend/emails/meeting-briefing.tsx. The AI-generated content uses a narrower type while the email content includes additional domain-filtered data merged in send-briefing.ts.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: edulelis
Repo: elie222/inbox-zero PR: 576
File: packages/resend/emails/digest.tsx:78-83
Timestamp: 2025-07-17T04:19:57.099Z
Learning: In packages/resend/emails/digest.tsx, the DigestEmailProps type uses `[key: string]: DigestItem[] | undefined | string | Date | undefined` instead of intersection types like `& Record<string, DigestItem[] | undefined>` due to implementation constraints. This was the initial implementation approach and cannot be changed to more restrictive typing.
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : LLM feature functions must import from `zod` for schema validation, use `createScopedLogger` from `@/utils/logger`, `chatCompletionObject` and `createGenerateObject` from `@/utils/llms`, and import `EmailAccountWithAI` type from `@/utils/llms/types`
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : Always define a Zod schema for LLM response validation and make schemas as specific as possible to guide the LLM output
- Simplify renderInternalTeamNote call by removing redundant guard - Flatten getInternalTeamMembers filter logic - Add clarifying comment about BriefingContent type separation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
User description
Summary
Adds a note to meeting briefing emails that lists internal team members who are also attending the meeting, clarifying that briefings are only generated for external guests.
InternalTeamMembertype andgetInternalTeamMembers()function to identify attendees from the same domainMeetingBriefingDatato includeinternalTeamMembersTest plan
pnpm email🤖 Generated with Claude Code
Generated description
Below is a concise technical summary of the changes proposed in this PR:
graph LR subgraph "inbox-zero-ai" ["inbox-zero-ai"] gatherContextForEvent_("gatherContextForEvent"):::modified getInternalTeamMembers_("getInternalTeamMembers"):::added MeetingBriefingData_("MeetingBriefingData"):::modified InternalTeamMember_("InternalTeamMember"):::added runMeetingBrief_("runMeetingBrief"):::modified sendBriefingEmail_("sendBriefingEmail"):::modified RESEND_EMAILS_MEETING_BRIEFING_("RESEND_EMAILS_MEETING_BRIEFING"):::modified gatherContextForEvent_ -- "Adds call to obtain internal team members filtering by domain." --> getInternalTeamMembers_ gatherContextForEvent_ -- "Includes internalTeamMembers in returned briefing payload." --> MeetingBriefingData_ gatherContextForEvent_ -- "Introduces InternalTeamMember type shaping internal entries." --> InternalTeamMember_ runMeetingBrief_ -- "Now receives internalTeamMembers when gathering briefing context." --> gatherContextForEvent_ runMeetingBrief_ -- "Propagates internalTeamMembers through MeetingBriefingData downstream." --> MeetingBriefingData_ runMeetingBrief_ -- "Passes gathered internalTeamMembers to sendBriefingEmail." --> sendBriefingEmail_ sendBriefingEmail_ -- "Merges InternalTeamMember entries into briefingContent before sending." --> InternalTeamMember_ sendBriefingEmail_ -- "Sends briefing API payload now including internalTeamMembers." --> RESEND_EMAILS_MEETING_BRIEFING_ classDef added stroke:#15AA7A classDef removed stroke:#CD5270 classDef modified stroke:#EDAC4C linkStyle default stroke:#CBD5E1,font-size:13px end subgraph "@inboxzero/resend" ["@inboxzero/resend"] MeetingBriefingEmail_("MeetingBriefingEmail"):::modified renderGuestBriefings_("renderGuestBriefings"):::modified renderInternalTeamNote_("renderInternalTeamNote"):::added BriefingContent_("BriefingContent"):::modified InternalTeamMember_("InternalTeamMember"):::added MeetingBriefingEmail_ -- "Unchanged: renders guest briefings from briefingContent.guests" --> renderGuestBriefings_ MeetingBriefingEmail_ -- "Appends internal team note listing names/emails" --> renderInternalTeamNote_ MeetingBriefingEmail_ -- "Now includes optional internalTeamMembers array of InternalTeamMember" --> BriefingContent_ renderInternalTeamNote_ -- "Displays member.name or member.email when rendering attendees" --> InternalTeamMember_ BriefingContent_ -- "Defines optional internalTeamMembers array containing InternalTeamMember entries" --> InternalTeamMember_ classDef added stroke:#15AA7A classDef removed stroke:#CD5270 classDef modified stroke:#EDAC4C linkStyle default stroke:#CBD5E1,font-size:13px endEnhances meeting briefing emails by identifying and listing internal team members who are also attending, ensuring that briefings are only generated for external guests. This involves updating data structures across the
meeting-briefsutility functions to propagate internal attendee information and integrating a new rendering component within theMeetingBriefingEmailtemplate.Modified files (6)
Latest Contributors(0)
InternalTeamMembertype, creatinggetInternalTeamMembersto filter attendees by domain, updatingMeetingBriefingDataandBriefingContentinterfaces, and integrating therenderInternalTeamNotecomponent into the email template.Modified files (5)
Latest Contributors(1)