feat(walkthrough): end guided tour on chat page with pre-seeded welcome message#1287
Conversation
…me message The final tour step now navigates to /chat and seeds a welcome message from the AI assistant into a new thread, so users land on a warm first conversation instead of an empty chat page. Closes tinyhumansai#1217
📝 WalkthroughWalkthroughThe guided walkthrough is extended from 9 to 10 steps, adding a final step that creates a new chat thread with a pre-seeded welcome message from the AI assistant, then navigates to the chat page. Redux mocks and comprehensive tests verify the thread creation, message seeding, and navigation behavior. ChangesGuided Tour Final Step with Welcome Message
Sequence DiagramsequenceDiagram
participant User as User / Tour Step
participant Store as Redux Store
participant ThreadSlice as threadSlice Actions
participant Nav as Navigation
participant Chat as Chat Page
User->>Store: dispatch createNewThread()
Store->>ThreadSlice: createNewThread (async)
ThreadSlice-->>Store: unwrap() → thread.id
User->>ThreadSlice: addMessageLocal(threadId, welcomeMessage)
ThreadSlice-->>Store: message added to cache
User->>ThreadSlice: setSelectedThread(threadId)
ThreadSlice-->>Store: thread selected
User->>Nav: navigate("/chat")
Nav-->>Chat: route to chat page
Chat->>Chat: display thread with pre-seeded message
alt Thread creation fails
Store-->>User: dispatch rejects
User->>Nav: navigate("/chat") fallback
Nav-->>Chat: route to chat page (empty or existing)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/components/walkthrough/__tests__/AppWalkthrough.test.tsx (1)
613-616: ⚡ Quick winAssert the seeded message payload here, not just that the helper ran.
This still passes if the wrong content or sender is dispatched. Lock the feature down by checking the
addMessageLocalpayload includes the new thread id plus the expected assistant message.Example assertion upgrade
expect(store.dispatch).toHaveBeenCalled(); expect(createNewThread).toHaveBeenCalled(); - expect(addMessageLocal).toHaveBeenCalled(); + expect(addMessageLocal).toHaveBeenCalledWith( + expect.objectContaining({ + threadId: 'thread-welcome-123', + message: expect.objectContaining({ + content: TOUR_WELCOME_MESSAGE, + sender: 'agent', + }), + }) + ); expect(setSelectedThread).toHaveBeenCalledWith('thread-welcome-123'); expect(navigate).toHaveBeenCalledWith('/chat');You'd also need to import
TOUR_WELCOME_MESSAGEinto this test file. As per coding guidelines, "Prefer testing behavior over implementation details."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/components/walkthrough/__tests__/AppWalkthrough.test.tsx` around lines 613 - 616, Update the test to assert the actual seeded message payload instead of only that addMessageLocal ran: import TOUR_WELCOME_MESSAGE into the test, and replace or augment the existing expectation on addMessageLocal by checking it was called with an object whose threadId equals 'thread-welcome-123' (or contains that id) and whose message content/sender matches TOUR_WELCOME_MESSAGE (assistant content and correct sender), while keeping the existing assertions for createNewThread and setSelectedThread; reference the addMessageLocal, createNewThread, setSelectedThread, and TOUR_WELCOME_MESSAGE symbols when making these assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/src/components/walkthrough/__tests__/AppWalkthrough.test.tsx`:
- Around line 613-616: Update the test to assert the actual seeded message
payload instead of only that addMessageLocal ran: import TOUR_WELCOME_MESSAGE
into the test, and replace or augment the existing expectation on
addMessageLocal by checking it was called with an object whose threadId equals
'thread-welcome-123' (or contains that id) and whose message content/sender
matches TOUR_WELCOME_MESSAGE (assistant content and correct sender), while
keeping the existing assertions for createNewThread and setSelectedThread;
reference the addMessageLocal, createNewThread, setSelectedThread, and
TOUR_WELCOME_MESSAGE symbols when making these assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f6dfa137-2d39-4654-8688-dbb027aa8dc5
📒 Files selected for processing (3)
app/src/components/walkthrough/__tests__/AppWalkthrough.test.tsxapp/src/components/walkthrough/walkthroughSteps.tsapp/src/constants/onboardingChat.ts
Summary
/chatand seeds a welcome message from the AI assistant into a new thread/chatChanges
app/src/constants/onboardingChat.tsTOUR_WELCOME_MESSAGEconstantapp/src/components/walkthrough/walkthroughSteps.ts/chatwithbeforehook that creates thread + seeds agent messageapp/src/components/walkthrough/__tests__/AppWalkthrough.test.tsxTest plan
pnpm typecheck— cleanpnpm lint— clean (0 errors)pnpm format:check— cleanpnpm build— succeedsCloses #1217
Summary by CodeRabbit
New Features
Tests