Conversation
Summary of ChangesHello @jaskfla, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses technical debt by eliminating an unused Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request starts the process of removing the unused recentEntities user preference by adding a data migration and updating related tests. However, the removal is incomplete, as several parts of the codebase still reference recentEntities. I've provided a detailed comment on where to find these references to ensure a complete cleanup and avoid leaving dead code. I also suggested an improvement to the migration file to make its down method explicitly irreversible, which is a good practice for maintainability.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/database/src/core/modelClasses/User/User.js (346-349)
Removing this logic for recentEntities is a good step. However, the feature seems to be incompletely removed. Several other parts of the code still reference recentEntities:
USER_PREFERENCES_FIELDSinpackages/constants/src/user.ts- The
addRecentEntities.jsfile and its usage inUser.js getRecentEntitiesandgetRecentEntityIdsmethods inUser.js
To fully deprecate this feature and avoid dead code, these other occurrences should also be removed. Leaving them could lead to confusion and potential bugs if the 'unused' feature is accidentally used again.
packages/database/src/core/migrations/20260212041501-CleanUpUnusedUserAccountPreferencesUserEntities-modifies-data.js (25-27)
The down migration is currently irreversible, which is acceptable for this kind of data cleanup. However, simply returning null can be ambiguous. It's better practice to make the irreversibility explicit by throwing an error. This prevents accidental rollbacks and clearly communicates the intent.
exports.down = function (db) {
throw new Error('This migration is irreversible and cannot restore the "recentEntities" user preference.');
};
6577500 to
d85d4ab
Compare
| /** @type {UserAccountPreferences} */ | ||
| const updatedPreferenceFields = updatedUserPreferences.reduce((obj, [key, value]) => { | ||
| obj[key] = value; | ||
| return obj; | ||
| }, preferences); | ||
| // If we change the selected project, we clear out the recent entities | ||
| if (updatedPreferenceFields.project_id) { | ||
| updatedPreferenceFields.recentEntities = {}; | ||
| } |
There was a problem hiding this comment.
The reducer’s initial accumulator value is the user’s existing preferences, which means project_id is almost always truthy
⟹ This if block almost always runs, but the property was always wrong. The real property is recent_entities, not recentEntities
⟹ But it also means that if we swapped this for recent_entities, it would get wiped very time we updat the user
Resolved in Slack that we actually want to preserve recent entities across projects anyway
d85d4ab to
19f8ada
Compare
| UPDATE user_account | ||
| SET preferences = preferences - 'recentEntities' | ||
| WHERE preferences ? 'recentEntities'; | ||
| `); |
There was a problem hiding this comment.
Migration ? operator conflicts with parameter placeholder
High Severity
The JSONB ? operator in preferences ? 'recentEntities' will be interpreted by db.runSql as a parameter placeholder (as seen in other migrations like SET type = ? WHERE code = ?), causing the migration to fail at runtime. Using jsonb_exists(preferences, 'recentEntities') or an equivalent function form avoids the ambiguity.
19f8ada to
f44d219
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
94eb9fd to
539e953
Compare


No description provided.