Skip to content

Conversation

@mikeallisonJS
Copy link
Collaborator

@mikeallisonJS mikeallisonJS commented Jan 27, 2026

Summary by CodeRabbit

  • New Features

    • Added OAuth state tracking to better manage authorization refresh failures and require re-authorization when necessary.
  • Bug Fixes

    • Improved handling of OAuth token refresh by automatically clearing the stale authorization flag upon successful updates.

✏️ Tip: You can customize this high-level summary in your review settings.

…Spaces types

This update introduces the oauthStale field to the IntegrationGoogle and IntegrationGrowthSpaces types in the GraphQL schema, indicating whether OAuth credentials are stale. Additionally, the field is integrated into the relevant resolvers and service logic to manage OAuth token refresh states effectively.
This update introduces the StaleOAuthError class to manage scenarios where Google integration OAuth credentials are stale, requiring re-authorization. The error is integrated into the getTeamGoogleAccessToken and getIntegrationGoogleAccessToken functions, preventing token refresh attempts when the integration is marked as stale. Additionally, the appendEventToGoogleSheets function is updated to skip syncing silently when a StaleOAuthError is encountered.
…logic

This update removes the StaleOAuthError class and its associated handling from the Google authentication functions. The logic for marking integrations as stale and throwing errors has been eliminated, simplifying the getTeamGoogleAccessToken and getIntegrationGoogleAccessToken functions. The appendEventToGoogleSheets function has also been adjusted to directly retrieve the access token without handling stale integration scenarios.
@mikeallisonJS mikeallisonJS requested a review from tanflem January 27, 2026 02:14
@mikeallisonJS mikeallisonJS self-assigned this Jan 27, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Walkthrough

A new oauthStale boolean field is added to the Integration model with a default value of false. The database schema, migration, and Google integration update mutation are updated to support this field, which tracks OAuth token refresh failures. Test fixtures are updated to include the new field.

Changes

Cohort / File(s) Summary
Schema & Database
libs/prisma/journeys/db/schema.prisma, libs/prisma/journeys/db/migrations/20260119200000_add_oauth_stale_to_integration/migration.sql
Added new oauthStale Boolean @default(false) field to Integration model; created SQL migration to add the column to the database table.
Google Integration Update
apis/api-journeys-modern/src/schema/integration/google/googleUpdate.mutation.ts, apis/api-journeys-modern/src/schema/integration/google/googleUpdate.mutation.spec.ts
Updated mutation to set oauthStale: false in the update payload when refreshing Google integration; test updated with matching field.
Test Fixtures
apis/api-journeys/src/app/modules/integration/growthSpaces/growthSpaces.resolver.spec.ts, apis/api-journeys/src/app/modules/integration/growthSpaces/growthSpaces.service.spec.ts, libs/yoga/src/crypto/crypto.spec.ts
Added oauthStale: false field to Integration test objects.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • tanflem
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: google stale prisma' is vague and doesn't clearly convey the purpose of the changes. While it mentions 'google' and 'stale' and 'prisma', it lacks specificity about what is being added or why the oauthStale field is being introduced. Consider a more descriptive title such as 'feat: add oauthStale field to Integration model' or 'feat: track OAuth token staleness in Google integration' that clearly explains the feature being added.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 00-00-MA-feat-google-stale-prisma

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Jan 27, 2026

View your CI Pipeline Execution ↗ for commit e3d6924

Command Status Duration Result
nx run watch-e2e:e2e ✅ Succeeded 18s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 39s View ↗
nx run resources-e2e:e2e ✅ Succeeded 13s View ↗
nx run short-links-e2e:e2e ✅ Succeeded 3s View ↗
nx run player-e2e:e2e ✅ Succeeded 3s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=vercel-alias --projects=re... ✅ Succeeded 2s View ↗
Additional runs (16) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-01-27 20:32:54 UTC

@github-actions github-actions bot requested a deployment to Preview - journeys-admin January 27, 2026 02:16 Pending
@github-actions github-actions bot requested a deployment to Preview - videos-admin January 27, 2026 02:16 Pending
@github-actions github-actions bot requested a deployment to Preview - short-links January 27, 2026 02:16 Pending
@github-actions github-actions bot requested a deployment to Preview - resources January 27, 2026 02:16 Pending
@mikeallisonJS mikeallisonJS changed the title 00 00 ma feat google stale prisma feat: google stale prisma Jan 27, 2026
@github-actions github-actions bot temporarily deployed to Preview - resources January 27, 2026 02:20 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin January 27, 2026 02:20 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin January 27, 2026 02:20 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys January 27, 2026 02:20 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links January 27, 2026 02:20 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
short-links ✅ Ready short-links preview Wed Jan 28 09:29:04 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Wed Jan 28 09:01:08 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
player ✅ Ready player preview Wed Jan 28 09:29:07 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Wed Jan 28 09:29:15 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Wed Jan 28 09:29:07 NZDT 2026

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin January 27, 2026 19:58 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin January 27, 2026 19:58 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links January 27, 2026 19:58 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys January 27, 2026 19:58 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources January 27, 2026 19:58 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin January 27, 2026 20:21 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links January 27, 2026 20:21 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin January 27, 2026 20:21 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources January 27, 2026 20:21 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin January 27, 2026 20:27 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin January 27, 2026 20:27 Inactive
@github-actions github-actions bot temporarily deployed to Preview - short-links January 27, 2026 20:27 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources January 27, 2026 20:27 Inactive
@stage-branch-merger
Copy link

I see you added the "on stage" label, I'll get this merged to the stage branch!

@mikeallisonJS mikeallisonJS added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit 4878292 Jan 27, 2026
38 checks passed
@mikeallisonJS mikeallisonJS deleted the 00-00-MA-feat-google-stale-prisma branch January 27, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants