Skip to content

Test#101

Merged
sweetmantech merged 8 commits intomainfrom
test
Jan 8, 2026
Merged

Test#101
sweetmantech merged 8 commits intomainfrom
test

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Jan 8, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved room ID extraction from emails by checking chat links first and falling back to message references when needed.
  • Tests

    • Added comprehensive test suite for email room ID extraction with coverage for valid and invalid inputs.
  • Refactor

    • Enhanced email message processing to properly extract text content from multi-part email components.
  • Chores

    • Removed debug logging statements from email validation.

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

sweetmantech and others added 8 commits January 8, 2026 09:03
Primary check now looks for Recoup chat link in email body text:
https://chat.recoupable.com/chat/{uuid}

Falls back to references header lookup if not found in text.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract roomId from email text before checking headers
- Convert stored UI parts (step-start, dynamic-tool, reasoning) to
  simple text-based ModelMessages for AI SDK compatibility
- Fixes AI_InvalidPromptError when replying to email threads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename extractText to extractTextFromParts
- Move to lib/emails/inbound/extractTextFromParts.ts
- Add SRP/DRY/KISS principles to CLAUDE.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add comprehensive tests for extractRoomIdFromText covering valid chat links,
  edge cases (undefined, empty string, invalid UUIDs), and wrong domains
- Add tests for getEmailRoomId covering primary text extraction, fallback to
  references header, and various undefined scenarios
- Verify priority: chat link in email text takes precedence over headers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-email-webhook-before-checking

feat: extract roomId from email text before checking headers
@vercel
Copy link
Contributor

vercel bot commented Jan 8, 2026

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

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces utility functions for parsing chat links and email parts, adds comprehensive test coverage for room ID and message extraction, refactors email room ID resolution to prioritize text-based chat links, and removes debug logging.

Changes

Cohort / File(s) Summary
Documentation & Configuration
CLAUDE.md
Updated section header from "Key Patterns" to "Code Principles" and added three principle definitions (SRP, DRY, KISS).
New Utility Functions
lib/emails/inbound/extractRoomIdFromText.ts, lib/emails/inbound/extractTextFromParts.ts
Two new utilities added: extractRoomIdFromText extracts room IDs from Recoup chat links via regex; extractTextFromParts filters and joins text-type UIParts. Both are foundational for email parsing.
Test Suites
lib/emails/inbound/__tests__/extractRoomIdFromText.test.ts, lib/emails/inbound/__tests__/getEmailRoomId.test.ts
Comprehensive tests for room ID extraction (valid/invalid links, case handling) and email room ID resolution (chat link priority, References header fallback, memory email lookup).
Modified Email Processing
lib/emails/inbound/getEmailRoomId.ts, lib/emails/inbound/getEmailRoomMessages.ts, lib/emails/inbound/validateCcReplyExpected.ts
getEmailRoomId now prioritizes chat link extraction; getEmailRoomMessages refactored to validate and iterate memories with extractTextFromParts; debug console.log statements removed from validateCcReplyExpected.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Test #93 — Refactors control flow and imports in validateCcReplyExpected.ts alongside main PR's debug log removal in the same file.
  • Test #88 — Modifies getEmailRoomId.ts References header parsing while main PR adds primary chat-link extraction to the same function.
  • Sweetmantech/myc 3851 api cc logic #86 — Implements original validateCcReplyExpected functionality that main PR now maintains with logging cleanup.

Poem

🐰 Through emails I've hopped with delight,
Extracting chat rooms, left and right!
With links and with text all sorted with care,
My utilities dance through the parsing air! ✨

✨ 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 f75b30c and 6d79478.

📒 Files selected for processing (8)
  • CLAUDE.md
  • lib/emails/inbound/__tests__/extractRoomIdFromText.test.ts
  • lib/emails/inbound/__tests__/getEmailRoomId.test.ts
  • lib/emails/inbound/extractRoomIdFromText.ts
  • lib/emails/inbound/extractTextFromParts.ts
  • lib/emails/inbound/getEmailRoomId.ts
  • lib/emails/inbound/getEmailRoomMessages.ts
  • lib/emails/inbound/validateCcReplyExpected.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.

@sweetmantech sweetmantech merged commit b90ec3a into main Jan 8, 2026
2 of 3 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 13, 2026
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