Repository navigation
fix(backend): keep memories user_review list filter in Python - #11915
Conversation
Firestore cannot express user_review is not False without dropping legacy docs that omit the field (#4498). Document that constraint, share one visibility helper for list paths, and assert the scoring query omits unsafe user_review/invalid_at FieldFilters. Failure-Class: none Co-authored-by: Max Carter 祁明思 <[email protected]>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_05547b8a-f406-454f-a508-c8f7064ae720) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db47a543d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def where(self, *args, **kwargs): | ||
| filt = kwargs.get('filter') or (args[0] if args else None) | ||
| q = _RecordingQuery(self._db, self._docs, self._filters + [filt]) | ||
| q._limit = self._limit | ||
| q._offset = self._offset |
There was a problem hiding this comment.
Exercise Firestore query semantics in the regression
Because this regression is specifically about which Firestore predicates preserve missing-field documents, a fake whose where() only records predicates cannot validate the behavior it claims: a positional where('user_review', '!=', False) would still return keep-missing, and the later object-attribute check would not detect the field. Cover this query behavior with the Firestore emulator or a fake that enforces Firestore's constraint semantics.
AGENTS.md reference: backend/AGENTS.md:L214-L214
Useful? React with 👍 / 👎.
What changed and why
Investigated moving the
user_reviewlist filter inbackend/database/memories.pyinto Firestore. Firestore cannot expressuser_review is not Falsewithout dropping legacy docs that omit the field (#4498): inequality /not-in/!=exclude missing fields, and== Noneonly matches explicit null. Closest safe query remains category/date bounds + scoring order + limit/offset, with visibility applied in Python via a shared helper (same semantics as before).Product invariants affected
How it was verified
External API results unchanged: still includes missing/
None/Trueuser_review, excludesFalse, and keeps defaultinvalid_atexclusion.Tests
tests/unit/test_memories_user_review.pyto exercise production_memory_passes_list_visibilityuser_review/invalid_atFieldFilter while Python still filters correctlyFailure class (fixes)
Failure-Class: none