Skip to content

fix: Type error in inviteMember.handler test#23070

Merged
hariombalhara merged 2 commits intomainfrom
chore/fix-type-error-in-main
Aug 14, 2025
Merged

fix: Type error in inviteMember.handler test#23070
hariombalhara merged 2 commits intomainfrom
chore/fix-type-error-in-main

Conversation

@emrysal
Copy link
Contributor

@emrysal emrysal commented Aug 14, 2025

What does this PR do?

Type check should've failed here but didn't - this fixes that type error.

@emrysal emrysal requested a review from hariombalhara August 14, 2025 00:51
@graphite-app graphite-app bot requested a review from a team August 14, 2025 00:51
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

Walkthrough

The integration test file packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts updates the createTestTeam helper’s TypeScript signature. Within the optional organizationSettings object, orgAutoAcceptEmail is changed from optional to required (string). No runtime logic or other files are modified.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/fix-type-error-in-main

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@keithwillcode keithwillcode added core area: core, team members only foundation labels Aug 14, 2025
@dosubot dosubot bot added automated-tests area: unit tests, e2e tests, playwright teams area: teams, round robin, collective, managed event-types labels Aug 14, 2025
@graphite-app
Copy link

graphite-app bot commented Aug 14, 2025

Graphite Automations

"Add foundation team as reviewer" took an action on this PR • (08/14/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (08/14/25)

1 label was added to this PR based on Keith Williams's automation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1)

219-219: Boolean default bug: don’t override explicit false

Using || true coerces false to true. Use nullish coalescing to preserve false.

Apply this diff:

-      allowDynamicBooking: user.allowDynamicBooking || true,
+      allowDynamicBooking: user.allowDynamicBooking ?? true,
🧹 Nitpick comments (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1)

81-91: Optional: strengthen the input type with a discriminated union

You can make misuse impossible at the type level (e.g., prevent passing organizationSettings for non-org teams and require it for orgs).

Consider:

type OrganizationSettingsInput = {
  orgAutoAcceptEmail: string;
  isOrganizationVerified?: boolean;
};

type OrgTeamInput = {
  name: string;
  slug: string;
  isOrganization: true;
  parentId?: number; // if orgs should never have parent, set this to never
  metadata?: any;
  organizationSettings: OrganizationSettingsInput;
};

type NonOrgTeamInput = {
  name: string;
  slug: string;
  isOrganization?: false;
  parentId?: number;
  metadata?: any;
  organizationSettings?: never;
};

async function createTestTeam(
  data: OrgTeamInput | NonOrgTeamInput
): Promise<Team> {
  // ...
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0865104 and 4e3fdea.

📒 Files selected for processing (1)
  • packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts
🔇 Additional comments (1)
packages/trpc/server/routers/viewer/teams/inviteMember/inviteMember.handler.integration-test.ts (1)

88-90: LGTM: making orgAutoAcceptEmail required is the right fix

Tightening the type to require orgAutoAcceptEmail inside organizationSettings aligns with how the helper is used in this test and prevents the silent type hole that previously existed. No runtime impact.

@hariombalhara hariombalhara enabled auto-merge (squash) August 14, 2025 01:29
@vercel
Copy link

vercel bot commented Aug 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal ⬜️ Ignored Aug 14, 2025 1:29am
cal-eu ⬜️ Ignored Aug 14, 2025 1:29am

@hariombalhara hariombalhara merged commit 2d5a867 into main Aug 14, 2025
35 of 36 checks passed
@hariombalhara hariombalhara deleted the chore/fix-type-error-in-main branch August 14, 2025 01:48
@github-actions
Copy link
Contributor

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-tests area: unit tests, e2e tests, playwright core area: core, team members only foundation ready-for-e2e teams area: teams, round robin, collective, managed event-types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants