-
Notifications
You must be signed in to change notification settings - Fork 92
refactor(accounts): remove Accounts module and related files #2804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
db68014 to
4ac8dae
Compare
|
@claude review |
|
Claude finished @PooyaRaki's task —— View job PR Review: Remove Accounts ModuleReview Summary: This is a comprehensive removal of the Accounts feature with mostly clean execution. Here are the key findings: Issues to Address:
Positive Aspects:✅ Clean Module Removal: All accounts modules, controllers, services, and repositories properly removed Minor Observations:
Recommendations:
Overall, this is a well-executed large-scale refactoring with only minor cleanup items remaining. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
| const last = await this.getLastRunMigration(); | |
| const remaining = migrations.slice(last?.id ?? 0); |
After removing the numbering consistency check, migrate() still uses migrations.slice(last?.id ?? 0), treating the last migration ID as an array index. With the current deprecated migrations now jumping from 00001 to 00005 and up to 00015, the migrations array has 9 entries while the recorded last ID is 15. On subsequent runs (or when a new 00016 migration is added), slice(15) returns an empty array, so no further migrations execute on already-migrated installations. This breaks future migrations whenever IDs contain gaps. Consider deriving the slice start from the index of the last run migration (or filtering by id > last.id) instead of using the ID as an index.
ℹ️ 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".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bug: Migration slice uses ID as index causing runtime failures
The migrate method uses migrations.slice(last?.id ?? 0) which treats the migration ID as an array index. After removing account-related migrations (00002-00004, 00009-00011), gaps exist in migration numbering. If a database previously ran migration ID=4, calling slice(4) on an array with only 3 elements returns empty, skipping migrations 00005 and 00006. Similarly, if last.id exceeds the current migration array length, remaining migrations won't run. The consistency check removal compounds this by allowing gaps without validating the slice logic.
src/datasources/db/v1/postgres-database.migrator.ts#L50-L51
| const last = await this.getLastRunMigration(); | |
| const remaining = migrations.slice(last?.id ?? 0); |
src/datasources/db/v1/postgres-database.migrator.ts#L148-L152
safe-client-gateway/src/datasources/db/v1/postgres-database.migrator.ts
Lines 148 to 152 in 4ac8dae
| return { | |
| path: join(path, file), | |
| id: parseInt(file.slice(0, 5)), | |
| name: file.slice(6), | |
| }; |
|
@claude review |
|
Claude finished @PooyaRaki's task —— View job PR Review: Accounts Module RemovalTodo List:
Critical Issues🚨 Migration Logic Bug const remaining = migrations.filter(
(migration) => migration.id > (last?.id ?? 0),
);This correctly filters by ID comparison, but the old slice-based approach was removed. However, if a database previously ran migration ID 15 and now only has migrations 1, 5, 6, 7, 8, 12, 13, 14, 15, 16 (with gaps), future migrations after 16 will work correctly. The current implementation looks correct - it filters by Verification needed: The integration test on lines 170-261 appears to validate gap handling correctly, but the existing reviews suggest there may still be an issue. The code should be tested with a real database that has run higher-numbered migrations to ensure new migrations execute properly. Cleanup ItemsOrphaned Configuration Schema
VS Code Configuration
Positive Aspects✅ Constant Migration: Recommendations
The refactoring is well-executed overall but needs the configuration cleanup and migration logic verification. |
LucieFaire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok, but i would maybe address the concerns mentioned by Claude about some unused code still present
9eb0564 to
2255616
Compare
|
@claude review |
|
Claude finished @PooyaRaki's task —— View job PR Review: Accounts Module RemovalTodo List:
Critical Issues🚨 Migration Logic Bug const remaining = migrations.filter(
(migration) => migration.id > (last?.id ?? 0),
);This correctly filters by ID comparison, but the old slice-based approach was removed. However, if a database previously ran migration ID 15 and now only has migrations 1, 5, 6, 7, 8, 12, 13, 14, 15, 16 (with gaps), future migrations after 16 will work correctly. The current implementation looks correct - it filters by Verification needed: The integration test on lines 170-261 appears to validate gap handling correctly, but the existing reviews suggest there may still be an issue. The code should be tested with a real database that has run higher-numbered migrations to ensure new migrations execute properly. Cleanup ItemsOrphaned Configuration Schema
VS Code Configuration
Positive Aspects✅ Constant Migration: Recommendations
The refactoring is well-executed overall but needs the configuration cleanup and migration logic verification. |
|
@claude review |
|
Claude finished @PooyaRaki's task —— View job PR Review: Accounts Module RemovalTodo List:
Issues Found🚨 Critical Issue: Orphaned Configuration Schema
Verified Fixes ✅Migration Logic Bug
VS Code Configuration Migration Structure Recommendations
Overall AssessmentThe refactoring is well-executed with proper cleanup of the accounts module. The critical migration logic bug has been fixed, and most configuration cleanup is complete. Only one minor orphaned configuration entry remains. |
2255616 to
bc0c52e
Compare
|
@claude review |
|
Claude finished @PooyaRaki's task —— View job PR Review: Accounts Module RemovalTodo List:
✅ Excellent Cleanup - All Issues ResolvedVerified Fixes:
Final AssessmentThis is a comprehensive and well-executed refactoring. The critical migration logic issue has been resolved, all configuration cleanup is complete, and no accounts-related references remain in the codebase. The migration gap handling is now robust and will work correctly in production environments. Result: ✅ APPROVED - Ready to merge |
LucieFaire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Summary
Remove all accounts-related logic and dependencies from the codebase, including the accounts module, interfaces, configuration, feature flags, and related migrations.
Changes
src/modules/accounts/module and all accounts datasource interfacesconfiguration.tsADDRESS_BOOK_NAME_MAX_LENGTHconstant from accounts module to spaces moduleNote
Removes the entire Accounts feature (modules, datasources, routes, tests, configs) and updates the DB migrator to support non-sequential migration IDs, with address-book constants moved under Spaces.
src/modules/accounts/**(datasources, repositories, routes/services/controllers, encryption APIs, domain entities, tests).src/domain/interfaces/**.update_updated_at_column()function inmigrations/deprecated/00001_accounts.FF_ACCOUNTSand associated feature handling fromconfiguration.tsand tests.RootConfigurationSchemato remove accounts encryption type.AppModuleto stop importingAccountsModulebased on feature flags.id > last.id); remove strict numbering check.ADDRESS_BOOK_NAME_MAX_LENGTHtospacesaddress-book entities; update imports.FF_ACCOUNTSfrom.vscode/launch.jsonenv.Written by Cursor Bugbot for commit bc0c52e. This will update automatically on new commits. Configure here.