refactor(types): streamline interface definitions for better readability#1535
Open
tyler-dane wants to merge 6 commits intomainfrom
Open
refactor(types): streamline interface definitions for better readability#1535tyler-dane wants to merge 6 commits intomainfrom
tyler-dane wants to merge 6 commits intomainfrom
Conversation
…mination - Renamed `reconnectGoogleForSession` to `repairGoogleConnection` to better reflect its purpose in handling Google connection repairs. - Enhanced the logic for determining the auth mode based on server-side state, replacing reliance on frontend intent. - Updated documentation to clarify the new auth mode classification and deprecated fields. - Refactored related tests to align with the new method names and logic, ensuring comprehensive coverage of the updated functionality.
- Updated various interface definitions across the codebase to improve formatting and readability by aligning type extensions and removing unnecessary line breaks. - Adjusted interfaces in event, user, and component types to follow a consistent style, enhancing maintainability and clarity.
Contributor
Author
|
@cursoragent Please pick up where I left off by implementing the plan in the issue body and using your best judgement until it's at a satisfactory level |
Contributor
Implementation summaryCore changes
Testing
Documentation
StatusThe implementation follows the plan:
The code is ready for review and testing. All tests pass, and the changes have been committed and pushed to the |
packages/backend/src/auth/services/google/google.auth.success.service.ts
Show resolved
Hide resolved
- Add explicit handling for undefined/empty events arrays - Add comprehensive JSDoc documentation - Ensure function returns false when sync data is missing or incomplete - This ensures reconnect_repair path is correctly triggered when sync is unhealthy Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
packages/backend/src/auth/services/google/google.auth.success.service.ts
Show resolved
Hide resolved
Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Four unused imports left after removing determineAuthMethod
- Removed the four unused imports (error, getSync, canDoIncrementalSync, findCompassUserBy) that were left behind after determineAuthMethod was removed.
Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



claude/cursor's version
Plan
Plan: Server-Driven Auth Classification for Google Reconnect
Problem Statement
After Google Calendar access revocation, re-consent is incorrectly routed through
googleSignin()(incremental sync) instead ofreconnectGoogleForSession()(full restart sync). This happens because:resolveGoogleSessionUserId()runs before user data is availablegoogleAuthIntentwhich may not reflect actual server stateProposed Solution
Move auth-path classification server-side using persisted user state, not frontend intent.
Three Auth Modes
signupgoogleSignup()signin_incrementalgoogleSignin()reconnect_repairrepairGoogleConnection()Decision Logic (Pseudocode)
Key Files to Modify
Backend
packages/backend/src/auth/services/google/google.auth.success.service.tspackages/backend/src/common/middleware/supertokens.middleware.util.tsresolveGoogleSessionUserId()or simplify to session-onlypackages/backend/src/auth/services/compass.auth.service.tsreconnectGoogleForSession()→repairGoogleConnection(), takecompassUserIdpackages/backend/src/sync/util/sync.util.tscanDoIncrementalSync()returns false after revoke/pruneFrontend (Minimal Changes)
packages/web/src/auth/hooks/oauth/useConnectGoogle.tsgoogleAuthIntentas hint (non-authoritative), consider deprecation.claude/plans/refactored-swimming-whisper.md" 92L, 4489B
Plan: Server-Driven Auth Classification for Google Reconnect
Problem Statement
After Google Calendar access revocation, re-consent is incorrectly routed through
googleSignin()(incremental sync) instead ofreconnectGoogleForSession()(full restart sync). This happens because:resolveGoogleSessionUserId()runs before user data is availablegoogleAuthIntentwhich may not reflect actual server stateProposed Solution
Move auth-path classification server-side using persisted user state, not frontend intent.
Three Auth Modes
signupgoogleSignup()signin_incrementalgoogleSignin()reconnect_repairrepairGoogleConnection()Decision Logic (Pseudocode)
Key Files to Modify
Backend
packages/backend/src/auth/services/google/google.auth.success.service.tspackages/backend/src/common/middleware/supertokens.middleware.util.tsresolveGoogleSessionUserId()or simplify to session-onlypackages/backend/src/auth/services/compass.auth.service.tsreconnectGoogleForSession()→repairGoogleConnection(), takecompassUserIdpackages/backend/src/sync/util/sync.util.tscanDoIncrementalSync()returns false after revoke/pruneFrontend (Minimal Changes)
packages/web/src/auth/hooks/oauth/useConnectGoogle.tsgoogleAuthIntentas hint (non-authoritative), consider deprecationNote
Medium Risk
Changes the Google OAuth success routing and reconnect/repair behavior based on persisted user/sync state, which can affect login and sync restart paths. Risk is mitigated by added unit tests but still touches auth + sync decision logic.
Overview
Moves Google OAuth routing to server-driven auth mode classification.
handleGoogleAuthnow looks up the Compass user by Google ID, checks stored refresh-token presence and sync health (canDoIncrementalSync), logs the decision, and routes togoogleSignup,googleSignin(incremental), or a new repair path.Replaces session-based reconnect with an explicit repair flow. Renames
reconnectGoogleForSessiontorepairGoogleConnection(takescompassUserId), updates param parsing, and expands tests to cover missing-token/unhealthy-sync/no-sync scenarios.Tightens incremental-sync eligibility and documents the lifecycle.
canDoIncrementalSyncnow returns false when there are no Google events/calendars, and docs/types markgoogleAuthIntentand related middleware helpers as deprecated; remaining PR changes are formatting-only interface/type readability tweaks.Written by Cursor Bugbot for commit 073bfda. This will update automatically on new commits. Configure here.