Skip to content

docs: update AGENTS and backend error handling documentation; add README for backend#1573

Merged
tyler-dane merged 2 commits intomainfrom
fix/pw-flow
Mar 27, 2026
Merged

docs: update AGENTS and backend error handling documentation; add README for backend#1573
tyler-dane merged 2 commits intomainfrom
fix/pw-flow

Conversation

@tyler-dane
Copy link
Copy Markdown
Contributor

@tyler-dane tyler-dane commented Mar 27, 2026

  • Added a new instruction to run ESLint on changed files as a required validation step in AGENTS.md.
  • Enhanced backend error handling documentation with principles to minimize try/catch blocks.
  • Introduced a README for the backend, outlining its current integration with Google Calendar and the need for decoupling from it for future flexibility.

Note

Medium Risk
Touches authentication sign-out and Google sync watch cleanup paths; mistakes could leave stale watch records or skip expected metadata resets, though changes are covered by new/updated unit tests.

Overview
Centralizes backend logout cleanup by routing SuperTokens signOutPOST through a new userService.handleLogoutCleanup() (now wrapped in try/catch so sign-out still succeeds if cleanup fails), and updates tests to assert correct delegation and context preservation.

Hardens Google sync/watch behavior by adding shared isMissingGoogleRefreshToken() helper, validating importGCal requests with zod (ImportGCalRequestSchema), and making syncService.stopWatches() return early (and avoid creating a GCal client) when no watches exist or when the user lacks a refresh token (deleting local watch records instead). Also tightens sync maintenance logging counts.

Docs updates: adds backend README, expands backend error-handling principles, and updates AGENTS.md workflow to require running eslint on changed implementation files and to alphabetize new functions.

Written by Cursor Bugbot for commit 9fe30d0. This will update automatically on new commits. Configure here.

…DME for backend

- Added a new instruction to run ESLint on changed files as a required validation step in AGENTS.md.
- Enhanced backend error handling documentation with principles to minimize `try/catch` blocks.
- Introduced a README for the backend, outlining its current integration with Google Calendar and the need for decoupling from it for future flexibility.
Comment thread packages/backend/src/common/middleware/supertokens.middleware.ts Outdated
return this.startWatchingGcalCalendars(userId, params, gcal);
default:
return this.startWatchingGcalEvents(userId, params, gcal);
if (params.gCalendarId === "calendarlist") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded string replaces imported constant for calendar check

Low Severity

The comparison uses the hardcoded string "calendarlist" instead of the already-imported Resource_Sync.CALENDAR constant. Every other reference in this file (lines 522, 527, 549) and across the codebase uses the constant. This introduces a maintenance risk — if Resource_Sync.CALENDAR changes, this check silently breaks.

Fix in Cursor Fix in Web

…in sync service

- Updated the `signOutPOST` function in the supertokens middleware to utilize a marker for response consistency.
- Refactored the session sign-out handling to improve clarity and maintainability.
- Enhanced logging in the `SyncService` to provide more informative debug messages when stopping Google Calendar event watches.
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.

Comment thread packages/backend/src/user/types/user.types.ts
@tyler-dane tyler-dane merged commit 3523c3f into main Mar 27, 2026
10 checks passed
@tyler-dane tyler-dane deleted the fix/pw-flow branch March 27, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant