fix: scope GET /agentmemory/memories by the project query param (#918)#988
fix: scope GET /agentmemory/memories by the project query param (#918)#988ShubhamArora073 wants to merge 1 commit into
Conversation
…tg00#918) The memories list endpoint advertised no project filter, so multi-project installs got the entire corpus back regardless of `?project=` and had to filter client-side. Honor `project` the same way `agentId` is honored, applying it to both the list payload and the `?count=true` totals so the counts match the list scope, consistent with POST /agentmemory/search. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@shubhamarora0 is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe Project filter for memories list endpoint
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/triggers/api.ts (1)
1851-1853: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDrop the WHAT-comment here.
projectFilterplus the predicate already make this self-explanatory, so the new comment just restates the code and conflicts with the TS comment guideline. As per coding guidelines, "In TypeScript source code, avoid code comments explaining WHAT — use clear naming instead".🤖 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 `@src/triggers/api.ts` around lines 1851 - 1853, Remove the WHAT-style comment in the project filtering logic and rely on the existing naming and predicate structure to make it clear; update the relevant section in api.ts around projectFilter so the code remains self-explanatory without a redundant explanatory comment.Source: Coding guidelines
🤖 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 `@src/triggers/api.ts`:
- Around line 1851-1853: Remove the WHAT-style comment in the project filtering
logic and rely on the existing naming and predicate structure to make it clear;
update the relevant section in api.ts around projectFilter so the code remains
self-explanatory without a redundant explanatory comment.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 993af871-481b-4577-b752-cd4da659aa21
📒 Files selected for processing (2)
src/triggers/api.tstest/memories-project-filter.test.ts
Summary
Fixes #918.
GET /agentmemory/memoriesadvertised no project filter, so on multi-project installs it returned the entire corpus regardless of?project=and clients had to over-fetch and filter client-side.This honors
projectthe same way the existingagentIdfilter works:projectquery param.m.project === project.?count=truetotals (they reuse the samefilteredarray), so counts match the list scope — consistent withPOST /agentmemory/search.projectis ignored (returns all), preserving back-compat with the no-param behavior.Behavior
?project=wittowitto?project=nonexistent-xyz0?count=true&project=foofooTest plan
test/memories-project-filter.test.tsdrives the realapi::memorieshandler with the issue's fixture (9 memories acrosswitto/_shared), covering project match, nonexistent project,?count=truescoping, and blank-param back-compat. Mirrors the existingcross-project-isolation.test.ts/remember-project-scope.test.tspattern.npm test→ 1420 passing.Made with Cursor
Summary by CodeRabbit