Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review: Add structured meta chat with feedback, instrumentation, and updated product messagingThis is a substantial feature addition — well-structured, with good test coverage and a clear product intent. The findings below are meant to help harden it before merge. 🔴 Critical1. Unauthenticated writes allowed when thread doesn't exist yet (
async function validateThreadAccess(threadId: string, resourceId: string) {
const thread = await getThread(threadId);
if (thread && thread.resourceId && thread.resourceId !== resourceId) {
return false;
}
return true; // ← allows any request when thread is null
}For the feedback and events endpoints, a null thread should be a rejection, not a pass. Any caller can submit arbitrary feedback/events for a guessed 2. Resource ID cookie is not validated as a UUID (
Fix: Validate with 🟠 Major3. Wrong agent used in
4. Unbounded SQL query with no indexes in SELECT id, event_type, thread_id, message_id, task_type, metadata, created_at
FROM chat_eventsNo 5. let initPromise: Promise<void> | null = null;
if (!initPromise) {
initPromise = client.execute(`CREATE TABLE IF NOT EXISTS ...`).then(...);
}
return initPromise;If the DB call fails on first execution, 6. const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
setInput(''); // cleared before send
await sendMessage({ text: messageText }); // errors go nowhere
};If the request fails after 7. The function sends a 8. Regex word-boundary bug in /\bchoose|decision|trade[- ]?off|compare|which should\b/i
🟡 Minor9. messages: normalizedMessages as never,
stream: streamWithMetadata as never,These suppress TypeScript rather than resolving the actual type mismatch between Mastra SDK and AI SDK message shapes. Should be tracked as tech debt and replaced with a proper adapter. 10. PRD.md contains hardcoded local machine paths These paths only work on the author's machine and shouldn't be in a committed document. 11. This is a developer automation loop script. It also references 12. Only "helpful" is counted as positive. "Needs more depth" is constructive, not negative, and will skew the metric. Worth a comment at minimum to document the intent. 🔵 Nits
|
Summary
/chatexperience with hydrated history loading and improved onboardingTesting
npm test -- mastra/workflows/meta-chat-workflow.test.ts app/api/chat/route.test.ts app/chat/_components/chat-message.test.tsxnpm test -- lib/chat/history.test.ts app/api/chat/route.test.tsnpm test -- app/chat/_components/chat-message-list.test.tsxnpm run ts-checknpm run test:e2e -- e2e/chat.spec.ts --project=chromiumnpm run test:e2e -- e2e/landing-page.spec.ts e2e/button-interactions.spec.ts --project=chromium