Repository navigation
fix(chat): prevent crash when sending attachment without text (#725) - #736
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
📝 WalkthroughWalkthroughThis pull request adds comprehensive test coverage for the Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@services/platform/convex/lib/message_deduplication.test.ts`:
- Around line 33-38: Add an assertion to the existing test that verifies the
trimmedMessage value produced by computeDeduplicationState: inside the 'detects
duplicate when same user message is latest' test (where createMessages and
computeDeduplicationState are used), add
expect(result.trimmedMessage).toBe('Hello') to ensure trimming consistency when
a duplicate is detected and lastUserMessage is defined.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 11d43252-2504-4b5a-854d-3fb5d4d15796
📒 Files selected for processing (2)
services/platform/convex/lib/message_deduplication.test.tsservices/platform/convex/lib/message_deduplication.ts
| it('detects duplicate when same user message is latest', () => { | ||
| const messages = createMessages([{ role: 'user', content: 'Hello' }]); | ||
| const result = computeDeduplicationState(messages, 'Hello'); | ||
| expect(result.messageAlreadyExists).toBe(true); | ||
| expect(result.lastUserMessage).toBeDefined(); | ||
| }); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider adding an assertion for trimmedMessage consistency.
For completeness, you might consider adding expect(result.trimmedMessage).toBe('Hello') to verify trimming also works correctly in duplicate scenarios. This is optional.
♻️ Optional enhancement
it('detects duplicate when same user message is latest', () => {
const messages = createMessages([{ role: 'user', content: 'Hello' }]);
const result = computeDeduplicationState(messages, 'Hello');
expect(result.messageAlreadyExists).toBe(true);
expect(result.lastUserMessage).toBeDefined();
+ expect(result.trimmedMessage).toBe('Hello');
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('detects duplicate when same user message is latest', () => { | |
| const messages = createMessages([{ role: 'user', content: 'Hello' }]); | |
| const result = computeDeduplicationState(messages, 'Hello'); | |
| expect(result.messageAlreadyExists).toBe(true); | |
| expect(result.lastUserMessage).toBeDefined(); | |
| }); | |
| it('detects duplicate when same user message is latest', () => { | |
| const messages = createMessages([{ role: 'user', content: 'Hello' }]); | |
| const result = computeDeduplicationState(messages, 'Hello'); | |
| expect(result.messageAlreadyExists).toBe(true); | |
| expect(result.lastUserMessage).toBeDefined(); | |
| expect(result.trimmedMessage).toBe('Hello'); | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@services/platform/convex/lib/message_deduplication.test.ts` around lines 33 -
38, Add an assertion to the existing test that verifies the trimmedMessage value
produced by computeDeduplicationState: inside the 'detects duplicate when same
user message is latest' test (where createMessages and computeDeduplicationState
are used), add expect(result.trimmedMessage).toBe('Hello') to ensure trimming
consistency when a duplicate is detected and lastUserMessage is defined.
2b98c55 to
a8df593
Compare
Summary
Test plan
Closes #725
Summary by CodeRabbit
Bug Fixes
Tests