Skip to content

Conversation

@sweetmantech
Copy link
Contributor

Summary

  • Fixes foreign key constraint error when a roomId is provided to setupConversation but the room doesn't actually exist in the database
  • Now checks if the room exists when roomId is provided, and creates it if needed
  • Adds test coverage for the new behavior

Problem

The error occurred because:

  1. Client sends a request with a roomId that doesn't exist in the database
  2. setupConversation assumed if roomId is provided, the room exists
  3. It skipped room creation and tried to insert a memory
  4. Foreign key constraint failed: Key (room_id)=(...) is not present in table "rooms"

Test plan

  • Existing tests pass
  • New test case: "creates a room when roomId is provided but room does NOT exist"
  • Updated test case: "does NOT create a room when roomId is provided and room exists"

🤖 Generated with Claude Code

When a roomId is provided to setupConversation but the room doesn't
actually exist in the database, we now check and create it instead
of failing with a foreign key constraint error on the memories table.

This fixes the error:
  Error creating memory: Key (room_id)=(...) is not present in table "rooms"

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@vercel
Copy link

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
recoup-api Ready Ready Preview Jan 19, 2026 8:24pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@sweetmantech sweetmantech merged commit f2bb9d2 into test Jan 19, 2026
3 of 4 checks passed
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.

2 participants