Skip to content

Test#108

Merged
sweetmantech merged 9 commits intomainfrom
test
Jan 13, 2026
Merged

Test#108
sweetmantech merged 9 commits intomainfrom
test

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Jan 13, 2026

Summary by CodeRabbit

  • New Features

    • Enhanced room ID extraction from email messages with improved HTML content parsing capabilities
  • Tests

    • Added comprehensive unit test coverage for room ID extraction from email HTML content
    • Covers multiple email client formats and various edge cases including URL encoding and special formatting
    • Added tests for improved multi-source room ID lookup with HTML content verification

✏️ Tip: You can customize this high-level summary in your review settings.

sweetmantech and others added 9 commits January 8, 2026 10:56
The room_id parameter is now required to ensure all outbound emails
include the chat link footer, enabling email thread continuity.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-email-tool-room_id-required

feat: make room_id required in send_email tool
- Add createChatHandler in lib/chats/
- Add POST route at app/api/chats/
- Account ID inferred from API key
- Optional artistId and chatId params
- chatId auto-generated if not provided

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Document validate function pattern using Zod in CLAUDE.md
- Add validateCreateChatBody.ts for POST /api/chats
- Update createChatHandler to use the validate function

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create safeParseJson helper that returns {} if body is empty/invalid
- Use in createChatHandler so body is not required
- All params are optional, so empty body should work

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-rooms-post-chats

Add POST /api/chats endpoint
…107)

Superhuman email client inserts <wbr /> tags in link text which breaks
plain text extraction. Added extractRoomIdFromHtml function as secondary
fallback in getEmailRoomId to handle this case.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Jan 13, 2026

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

Project Deployment Review Updated (UTC)
recoup-api Building Building Preview Jan 13, 2026 1:28pm

@sweetmantech sweetmantech merged commit b12ebe8 into main Jan 13, 2026
1 of 2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Introduces a new extractRoomIdFromHtml function to extract room IDs from email HTML content, handling various email client formats and special characters like <wbr/> tags. Integrates this into the existing getEmailRoomId extraction flow between text-based and header-based fallback checks. Includes comprehensive unit tests for all scenarios.

Changes

Cohort / File(s) Summary
New room ID extraction from HTML
lib/emails/inbound/extractRoomIdFromHtml.ts
Exports extractRoomIdFromHtml(html) function with regex-based room UUID extraction. Handles URL-encoded redirects, <wbr/> tag stripping, and returns first valid UUID or undefined.
Integration into email room ID extraction
lib/emails/inbound/getEmailRoomId.ts
Imports and calls extractRoomIdFromHtml after text-based extraction but before References header fallback. Updates function documentation to reflect new extraction order.
Unit tests for HTML extraction
lib/emails/inbound/__tests__/extractRoomIdFromHtml.test.ts
Comprehensive test suite (+168 lines) covering Superhuman/Gmail reply formats, URL encoding, <wbr/> tags, case sensitivity, multiple links, and no-ID edge cases.
Integration tests for getEmailRoomId
lib/emails/inbound/__tests__/getEmailRoomId.test.ts
Adds 41 lines of tests under "secondary: extracting from email HTML" block, verifying HTML extraction with <wbr/> tags and text priority over HTML. Updates fallback tests for References header usage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

  • Test #88: Modifies getEmailRoomId.ts control flow for room-id extraction, affecting the same function's structure that this PR extends.
  • Test #101: Adds related room ID extraction utilities and modifies getEmailRoomId.ts, introducing similar email processing enhancements.

Poem

A rabbit hops through HTML's maze,
With <wbr/> tags in a tangled haze,
Finding room IDs, left and right,
Each regex pattern shining bright! ✨🐰

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dec68d0 and a84ec73.

📒 Files selected for processing (4)
  • lib/emails/inbound/__tests__/extractRoomIdFromHtml.test.ts
  • lib/emails/inbound/__tests__/getEmailRoomId.test.ts
  • lib/emails/inbound/extractRoomIdFromHtml.ts
  • lib/emails/inbound/getEmailRoomId.ts

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.

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.

1 participant

Comments