-
Notifications
You must be signed in to change notification settings - Fork 50
fix(backend): update 410 error handling with force flag #1425
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
Conversation
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.
Pull request overview
This PR enhances Google Calendar sync handling, particularly for 410 GONE / fullSyncRequired scenarios, by adding a “forced” restart path and wiring it into relevant error flows so that a full resync actually runs even when metadata indicates a completed import.
Changes:
- Updated
UserService.restartGoogleCalendarSyncto accept an optional{ force?: boolean }parameter and adjusted its internal gating to allow forced restarts except when an import is already in progress. - Modified sync maintenance (
refreshWatch),SyncControllerwebhook handling, and the Express error handler to callrestartGoogleCalendarSyncwith{ force: true }whenisFullSyncRequiredis detected. - Extended
UserServicetests to verify behavior for completed imports in both forced and non-forced restart scenarios.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/backend/src/user/services/user.service.ts |
Adds a force option to restartGoogleCalendarSync and adjusts the decision logic for when to perform a full Google Calendar import. |
packages/backend/src/user/services/user.service.test.ts |
Introduces tests validating that restarts are skipped for completed imports when not forced, and executed when forced, while preserving metadata semantics. |
packages/backend/src/sync/services/maintain/sync.maintenance.ts |
On fullSyncRequired during watch refresh, now triggers a forced Google Calendar resync for the affected user. |
packages/backend/src/sync/controllers/sync.controller.ts |
When webhook handling detects fullSyncRequired, it now initiates a forced Google Calendar resync. |
packages/backend/src/common/errors/handlers/error.express.handler.ts |
For Google API errors requiring full sync, now triggers a forced resync via restartGoogleCalendarSync and returns an appropriate response. |
…option - Updated `restartGoogleCalendarSync` method to accept an options parameter for forced synchronization. - Modified error handling in `SyncController` and `error.express.handler` to utilize the new forced restart functionality. - Enhanced tests to cover scenarios for both forced and non-forced sync operations, ensuring correct behavior based on user import status. This change improves the flexibility of the Google Calendar synchronization process, allowing for more robust handling of sync operations in various states.
94435e4 to
6039660
Compare
|
Looks good, logs working in prod |
Closes #1422
restartGoogleCalendarSyncmethod to accept an options parameter for forced synchronization.SyncControlleranderror.express.handlerto utilize the new forced restart functionality.This change improves the flexibility of the Google Calendar synchronization process, allowing for more robust handling of sync operations in various states.
Note
Medium Risk
Changes affect Google Calendar sync control flow and can trigger additional stop/start imports under error conditions; incorrect forcing logic could cause unnecessary resyncs or load, but is scoped and covered by tests.
Overview
Google Calendar sync restarts can now be forced.
restartGoogleCalendarSyncaccepts an options arg ({ force?: boolean }) and will skip restarts when the user’s import is alreadycompleted, unlessforceis set (still avoids interrupting an activeimportingrun).Error paths that detect
isFullSyncRequired(Express Google error handler, sync notification controller, and watch maintenance refresh) now trigger a forced restart to ensure a full resync proceeds even if metadata says import previously finished. Tests add coverage for forced vs non-forced restart behavior.Written by Cursor Bugbot for commit 6039660. This will update automatically on new commits. Configure here.