refactor: improve IPC handler structure and validation#96
Conversation
- Refactored `SearchController` to utilize dedicated methods for resolving copyright tags and handling tag type resolution, enhancing code clarity and maintainability. - Simplified the `MaintenanceController` by directly accepting the `AutoBackupInterval` parameter, removing unnecessary argument parsing. - Introduced `createValidatedHandler` in `updates.ts` to streamline validation and error handling for the `GET_TOTAL_UNREAD_COUNT` IPC call, ensuring consistent input validation across handlers. - Cleaned up unused imports and ensured adherence to strict coding standards throughout the changes.
🛡️ Архитектор (AI Review)Это Code Review. Пристегнись, будет больно. Ты называешь это «рефакторингом», я называю это «попыткой протащить блокирующие вызовы и небезопасный ввод в Main-процесс». 🚨 Критично1. Блокировка Main-процесса (Performance) const row = getDb()
.select({ value: count() })
.from(posts)
.where(whereClause)
.get(); // <--- СМЕРТЬТы используешь 2. Слепое доверие к типам в MaintenanceController - const interval = AutoBackupIntervalSchema.parse(args[0]);
+ interval: AutoBackupIntervalТы удалил валидацию
|
SearchControllerto utilize dedicated methods for resolving copyright tags and handling tag type resolution, enhancing code clarity and maintainability.MaintenanceControllerby directly accepting theAutoBackupIntervalparameter, removing unnecessary argument parsing.createValidatedHandlerinupdates.tsto streamline validation and error handling for theGET_TOTAL_UNREAD_COUNTIPC call, ensuring consistent input validation across handlers.