Skip to content

feat: enable oauthV2 by removing oauthV2enabled variable - #6175

Merged
ItsSudip merged 11 commits into
release/1.57.xfrom
feature/INT-3972-cleanup-oauthv2enabled-variable
Aug 18, 2025
Merged

ItsSudip merged 11 commits into
release/1.57.xfrom
feature/INT-3972-cleanup-oauthv2enabled-variable

Conversation

@ItsSudip

Copy link
Copy Markdown
Member

What are the changes introduced in this PR?

This PR removes the oauthV2Enabled feature flag and its associated conditional logic from the router and related components. The primary goal is to standardize on the OAuth v2 implementation, eliminating the legacy code path for OAuth v1.

The changes include:

  • Removing the oauthV2Enabled variable from reloadableConfig and its initialization.
  • Updating the transformer.NewTransformer function to remove the oauthV2Enabled parameter.
  • Simplifying the logic in router/worker.go to always use the OAuth v2 path for OAuth destinations.
  • Updating all related test files to reflect these changes.

What is the related Linear task?

INT-3972: Clean up oauthv2enabled variable from router

Please explain the objectives of your changes below

The main objective is to eliminate technical debt by removing a redundant feature flag. With all integrations now migrated to OAuth v2, the oauthV2Enabled flag is no longer necessary. This change simplifies the codebase, makes it easier to maintain, and reduces the risk of production incidents caused by misconfiguration.

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

  • The router will no longer have a configurable switch to fall back to the legacy OAuth v1 implementation. OAuth v2 is now the single, non-configurable standard for all OAuth-based destinations. This is an intentional change to remove obsolete code.

Any new dependencies introduced with this change?

No, this PR does not introduce any new dependencies. It is purely a code cleanup and refactoring effort.

Any new generic utility introduced or modified. Please explain the changes.

No new generic utilities have been introduced or modified.

Any technical or performance related pointers to consider with the change?

  • Maintainability: The removal of a major feature flag and its associated conditional logic significantly improves the readability and maintainability of the router's codebase.
  • Performance: While not the primary goal, removing a conditional check from the event processing path may result in a minor, but positive, impact on performance due to a more streamlined execution path.

@coderabbitai review

Developer checklist

  • My code follows the style guidelines of this project
  • No breaking changes are being introduced.
  • All related docs linked with the PR?
  • All changes manually tested?
  • Any documentation changes needed with this change?
  • Is the PR limited to 10 file changes?
  • Is the PR limited to one linear task?
  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?
  • Verified that there are no credentials or confidential data exposed with the changes.

@ItsSudip
ItsSudip force-pushed the feature/INT-3972-cleanup-oauthv2enabled-variable branch from 299619c to dcdd6d5 Compare July 25, 2025 04:33
@ItsSudip
ItsSudip force-pushed the feature/INT-3972-cleanup-oauthv2enabled-variable branch from dbf9c2c to afcb3b3 Compare July 25, 2025 07:17
@codecov

codecov Bot commented Jul 25, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.49123% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/1.57.x@d1d64bc). Learn more about missing BASE report.

Files with missing lines Patch % Lines
router/handle_lifecycle.go 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/1.57.x    #6175   +/-   ##
=================================================
  Coverage                  ?   76.86%           
=================================================
  Files                     ?      521           
  Lines                     ?    70748           
  Branches                  ?        0           
=================================================
  Hits                      ?    54380           
  Misses                    ?    13483           
  Partials                  ?     2885           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ItsSudip ItsSudip self-assigned this Jul 29, 2025

@koladilip koladilip left a comment

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.

Mostly looks good, do good testing

Comment thread router/handle.go
// NO-OP
}

func (rt *Handle) handleOAuthDestResponse(params *HandleDestOAuthRespParams, authErrorCategory string) (int, string, string) {

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.

related to v1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. In OAuth v1, we need to handle the response to determine whether we need to refresh the event or fail it. But in OAuth v2, it is done through the interceptor.

rt.transformer = transformer.NewTransformer(rt.netClientTimeout, rt.transformerTimeout,
backendConfig, rt.reloadableConfig.oauthV2Enabled,
backendConfig,
rt.reloadableConfig.oauthV2ExpirationTimeDiff,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit-pick]

Suggested change
rt.reloadableConfig.oauthV2ExpirationTimeDiff,
rt.reloadableConfig.oauthExpirationTimeDiff,

rt.reloadableConfig.failingJobsPenaltySleep = config.GetReloadableDurationVar(2000, time.Millisecond, getRouterConfigKeys("failingJobsPenaltySleep", rt.destType)...)
rt.reloadableConfig.failingJobsPenaltyThreshold = config.GetReloadableFloat64Var(0.6, getRouterConfigKeys("failingJobsPenaltyThreshold", rt.destType)...)
rt.reloadableConfig.oauthV2Enabled = config.GetReloadableBoolVar(false, getRouterConfigKeys("oauthV2Enabled", rt.destType)...)
rt.reloadableConfig.oauthV2ExpirationTimeDiff = config.GetReloadableDurationVar(5, time.Minute, getRouterConfigKeys("oauth.expirationTimeDiff", rt.destType)...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
rt.reloadableConfig.oauthV2ExpirationTimeDiff = config.GetReloadableDurationVar(5, time.Minute, getRouterConfigKeys("oauth.expirationTimeDiff", rt.destType)...)
rt.reloadableConfig.oauthExpirationTimeDiff = config.GetReloadableDurationVar(5, time.Minute, getRouterConfigKeys("oauth.expirationTimeDiff", rt.destType)...)

} else {
resp, err = trans.client.Do(req)

destinationInfo := &oauthv2.DestinationInfo{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit-pick]

Suggested change
destinationInfo := &oauthv2.DestinationInfo{
destinationInfo := &oauth.DestinationInfo{

ID: transformMessageCopy.Data[0].Destination.ID,
}
req = req.WithContext(cntx.CtxWithDestInfo(req.Context(), destinationInfo))
resp, err = trans.clientOAuthV2.Do(req)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit-pick]

Suggested change
resp, err = trans.clientOAuthV2.Do(req)
resp, err = trans.clientOAuth.Do(req)

} else {
resp, err = trans.proxyClient.Do(req)
}
trans.logger.Debugn("[router delivery]", logger.NewBoolField("oauthV2Enabled", true))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit-pick]

Suggested change
trans.logger.Debugn("[router delivery]", logger.NewBoolField("oauthV2Enabled", true))
trans.logger.Debugn("[router delivery]", logger.NewBoolField("oauthEnabled", true))

trans.logger.Debugn("[router delivery]", logger.NewBoolField("oauthV2Enabled", true))
req = req.WithContext(cntx.CtxWithDestInfo(req.Context(), proxyReqParams.DestInfo))
req = req.WithContext(cntx.CtxWithSecret(req.Context(), proxyReqParams.ResponseData.Metadata[0].Secret))
resp, err = trans.proxyClientOAuthV2.Do(req)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[nit-pick]

Suggested change
resp, err = trans.proxyClientOAuthV2.Do(req)
resp, err = trans.proxyClientOAuth.Do(req)

ResponseData: tc.postParameters,
DestName: "not_found_dest",
Adapter: &mockAdapter{url: srv.URL},
DestInfo: &v2.DestinationInfo{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
DestInfo: &v2.DestinationInfo{
DestInfo: &v2.DestinationInfo{

similarily here it need not be v2

Comment thread router/types.go
skipRtAbortAlertForTransformation config.ValueLoader[bool] // represents if event delivery(via transformerProxy) should be alerted via router-aborted-count alert def
skipRtAbortAlertForDelivery config.ValueLoader[bool] // represents if transformation(router or batch) should be alerted via router-aborted-count alert def
oauthV2Enabled config.ValueLoader[bool]
oauthV2ExpirationTimeDiff config.ValueLoader[time.Duration]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
oauthV2ExpirationTimeDiff config.ValueLoader[time.Duration]
oauthExpirationTimeDiff config.ValueLoader[time.Duration]

@ItsSudip
ItsSudip changed the base branch from master to release/1.57.x August 18, 2025 12:17
@ItsSudip
ItsSudip merged commit caad8f0 into release/1.57.x Aug 18, 2025
@ItsSudip
ItsSudip deleted the feature/INT-3972-cleanup-oauthv2enabled-variable branch August 18, 2025 13:45
ItsSudip pushed a commit that referenced this pull request Aug 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0-rc.2](v1.56.0...v1.57.0-rc.2)
(2025-08-19)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* enable oauthV2 by removing oauthV2enabled variable
([#6175](#6175))
([caad8f0](caad8f0))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
mihir20 pushed a commit that referenced this pull request Aug 19, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0](v1.56.0...v1.57.0)
(2025-08-19)


### Features

* add support for manual sync mode in warehouse
([#6199](#6199))
([6f87119](6f87119))
* enable oauthV2 by removing oauthV2enabled variable
([#6175](#6175))
([caad8f0](caad8f0))
* **router:** support different throttler per event type
([#6181](#6181))
([12254bb](12254bb))
* warehouse grpc API to get namespace mappings of a destination
([#6200](#6200))
([9613236](9613236))


### Bug Fixes

* adaptive throttling not applying dynamic throttling limits
consistently
([#6219](#6219))
([478b2e1](478b2e1))
* error extractor to handle nested JSON responses
([#6209](#6209))
([ffc0d7a](ffc0d7a))
* getting occasional unauthenticated errors from googlepubsub
([#6228](#6228))
([cc39306](cc39306))
* handle snowpipe service restarts in destination polling logic
([#6236](#6236))
([b76bc7f](b76bc7f))
* handling empty schema for table level schemas
([#6233](#6233))
([cc39306](cc39306))
* histogram buckets for schema snapshots
([#6234](#6234))
([cc39306](cc39306))
* warehouse source empty jobs
([#6204](#6204))
([42f5ae4](42f5ae4))


### Miscellaneous

* bump the go-dependencies group with 12 updates
([#6189](#6189))
([e6e2bcd](e6e2bcd))
* enforcing non-sugared logger
([#6066](#6066))
([b24ded8](b24ded8))
* force new MTU metrics from 1st September 2025 onwards
([#6227](#6227))
([154d2c3](154d2c3))
* implement configurable deduplication mirror mode
([#6224](#6224))
([c97ad7a](c97ad7a))
* refactor Google Pub/Sub to add retry logic for auth errors
([#6229](#6229))
([cc39306](cc39306))
* remove enableV2NotifierJob flag support
([#6196](#6196))
([8be54bf](8be54bf))
* remove event blocking flag
([#6240](#6240))
([e668e14](e668e14))
* remove queryWithUploadId flag support for load files
([#6192](#6192))
([e6e2bcd](e6e2bcd))
* revert "fix: snowpipe events getting duplicated if status API fails"
([#6211](#6211))
([777b08e](777b08e))
* skip warehouse destinations from version deprecation error extraction
([#6226](#6226))
([87c3320](87c3320))
* stop collecting errors in proc_error jobsdb
([#6232](#6232))
([c600968](c600968))
* throttler should emit no warning if not enabled
([#6223](#6223))
([0773168](0773168))
* update keydb dependency
([#6222](#6222))
([d1d64bc](d1d64bc))
* use harbor to pull docker images
([#6210](#6210))
([6c324cf](6c324cf))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

4 participants