Persist pending actions to MongoDB#36
Conversation
ActionService previously stored pending actions in a Map, losing all data on server restart. This wires up the existing PendingActionRepository to MongoDB so actions survive restarts. - Added user_id and description fields to PendingActionRepository schema - Added findPendingByUserId query and (user_id, status) index - Rewrote ActionService to delegate all CRUD to PendingActionRepository - Made all ActionService methods async (getPendingActions, getAction, createAction, rejectAction, _clear) - Updated controller, chat service, and all test files to await the now-async methods 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Persist pending actions to MongoDBI've reviewed the code changes. The implementation is solid overall, but there are 2 critical security/reliability issues that need to be addressed: 🔴 Critical Issue #1: Race Condition in
|
Summary
ActionServiceto usePendingActionRepository(MongoDB) instead of an in-memoryMapuser_idanddescriptionfields to thepending_actionscollection schemafindPendingByUserIdquery with a(user_id, status)compound indexActionServicemethods are now async; updated controller, chat service, and all test files accordinglyTest plan
npm test— all existing integration tests should pass🤖 Generated with Claude Code