Skip to content

Conversation

@JeethJJ
Copy link
Contributor

@JeethJJ JeethJJ commented Jan 26, 2026

Purpose

As we have introduced the transection architecture, we are adapting our services to use transections starting with user service. In this PR we have updated the user service and co-relevant services to use transactions.

Sub Issue : #1107
Parent issue : #282

Copilot AI review requested due to automatic review settings January 26, 2026 10:06
Copy link
Contributor

Copilot AI left a 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 threads context.Context through OAuth2 / authn / notification / flow / authz services and handlers to support the new transaction-based architecture.

Changes:

  • Updated backend service interfaces to accept context.Context and propagated request contexts from HTTP handlers.
  • Updated JWT/token-related utilities/builders/validators to pass context into downstream dependencies.
  • Updated unit tests and generated mocks to match the new context-aware method signatures.

Reviewed changes

Copilot reviewed 85 out of 156 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/internal/oauth/oauth2/userinfo/userInfoServiceInterface_mock_test.go Regenerated userinfo service mock to include context.Context in method signature.
backend/internal/oauth/oauth2/userinfo/service.go Added context-aware GetUserInfo flow and propagated ctx to JWT/user lookups.
backend/internal/oauth/oauth2/userinfo/handler_test.go Updated handler tests to expect ctx argument in mock calls.
backend/internal/oauth/oauth2/userinfo/handler.go Passed r.Context() into GetUserInfo.
backend/internal/oauth/oauth2/tokenservice/validator.go Added ctx to token validator methods and JWT verification calls.
backend/internal/oauth/oauth2/tokenservice/utils_test.go Updated tokenservice utils tests to pass ctx and match ctx-aware user service calls.
backend/internal/oauth/oauth2/tokenservice/utils.go Added ctx to FetchUserAttributesAndGroups and propagated to user service calls.
backend/internal/oauth/oauth2/tokenservice/builder.go Updated token builder interface/impl to accept ctx and pass it into JWT generation.
backend/internal/oauth/oauth2/token/token_handler_test.go Updated token handler tests for ctx-aware grant handler and refresh token issuance.
backend/internal/oauth/oauth2/token/token_handler.go Passed r.Context() to grant validation/handling and refresh token issuance.
backend/internal/oauth/oauth2/introspect/service_test.go Updated introspection service tests to pass ctx and match ctx-aware JWT verification mocks.
backend/internal/oauth/oauth2/introspect/service.go Added ctx to introspection service and propagated to JWT verification.
backend/internal/oauth/oauth2/introspect/handler_test.go Updated introspection handler tests to expect ctx argument in mock calls.
backend/internal/oauth/oauth2/introspect/handler.go Passed r.Context() into IntrospectToken.
backend/internal/oauth/oauth2/introspect/TokenIntrospectionServiceInterface_mock_test.go Regenerated introspection service mock to include context.Context.
backend/internal/oauth/oauth2/granthandlers/token_exchange.go Added ctx to grant handler interface methods and propagated to validator/builder.
backend/internal/oauth/oauth2/granthandlers/refresh_token_test.go Updated refresh token grant tests to include ctx in calls/mocks.
backend/internal/oauth/oauth2/granthandlers/refresh_token.go Added ctx to refresh token grant handler and propagated to validator/builder.
backend/internal/oauth/oauth2/granthandlers/grant_handler.go Updated grant handler interfaces to accept ctx and refresh issuance to accept ctx.
backend/internal/oauth/oauth2/granthandlers/client_credentials_test.go Updated client credentials tests for ctx-aware grant handler and builder calls.
backend/internal/oauth/oauth2/granthandlers/client_credentials.go Added ctx to grant handling and propagated to token builder.
backend/internal/oauth/oauth2/granthandlers/authorization_code.go Propagated ctx into user attribute/group fetch and token building.
backend/internal/oauth/oauth2/authz/handler_test.go Updated authz handler tests to pass ctx and expect ctx-aware JWT verification.
backend/internal/oauth/oauth2/authz/handler.go Propagated ctx through authorization response/assertion verification flow.
backend/internal/notification/otp_service_test.go Updated OTP service tests to pass ctx and match ctx-aware JWT mocks.
backend/internal/notification/otp_service.go Added ctx to OTP service interface and propagated to JWT generation/verification.
backend/internal/notification/message_handler_test.go Updated notification handler tests for ctx-aware OTP service calls.
backend/internal/notification/message_handler.go Passed r.Context() into OTP send/verify service calls.
backend/internal/notification/OTPServiceInterface_mock_test.go Regenerated OTP service mock to include context.Context.
backend/internal/group/handler_test.go Updated group handler tests to expect ctx argument in service methods.
backend/internal/group/handler.go Passed r.Context() into group service calls.
backend/internal/flow/executor/sms_auth_executor.go Propagated node context into user/OTP service calls in SMS OTP executor.
backend/internal/flow/executor/provisioning_executor.go Propagated node context into user/group/role service calls and tweaked messages.
backend/internal/flow/executor/oidc_auth_executor.go Added ctx-aware executor interface methods and propagated ctx to auth service calls.
backend/internal/flow/executor/oidcAuthExecutorInterface_mock_test.go Updated executor mock for ctx-aware method signatures.
backend/internal/flow/executor/oauth_executor.go Propagated node context into OAuth auth service calls and internal user resolution.
backend/internal/flow/executor/oAuthExecutorInterface_mock_test.go Updated OAuth executor mock for ctx-aware internal user method signature.
backend/internal/flow/executor/identifying_executor_test.go Updated identifying executor tests to pass ctx and match ctx-aware user service calls.
backend/internal/flow/executor/identifying_executor.go Added ctx to IdentifyUser and propagated it to user service.
backend/internal/flow/executor/identifyingExecutorInterface_mock_test.go Updated identifying executor mock for ctx-aware signature.
backend/internal/flow/executor/basic_auth_executor_test.go Updated basic auth executor tests to expect ctx-aware user/creds calls.
backend/internal/flow/executor/basic_auth_executor.go Propagated node context into IdentifyUser and credential authentication calls.
backend/internal/flow/executor/authz_executor.go Propagated node context into authorization service call.
backend/internal/flow/executor/auth_assert_executor_test.go Updated auth assertion tests for ctx-aware JWT generation and ctx-aware user service calls.
backend/internal/flow/executor/auth_assert_executor.go Propagated ctx into JWT generation and user/OU lookups.
backend/internal/flow/executor/attribute_collector_test.go Updated attribute collector tests for ctx-aware user service calls.
backend/internal/flow/executor/attribute_collector.go Propagated node context into user retrieval/update calls.
backend/internal/authz/service_test.go Updated authorization service tests to pass ctx and match ctx-aware engine calls.
backend/internal/authz/service.go Added ctx to authorization service and propagated to engine.
backend/internal/authz/engine/rbacengine_test.go Updated RBAC engine tests to pass ctx and match ctx-aware role service calls.
backend/internal/authz/engine/rbacengine.go Added ctx to RBAC engine and propagated to role service.
backend/internal/authz/engine/engine.go Updated authorization engine interface to accept ctx.
backend/internal/authn/passkey/service.go Added ctx to passkey service and propagated to user service credential operations.
backend/internal/authn/otp/service_test.go Updated OTP authn service tests to pass ctx and match ctx-aware notification/user calls.
backend/internal/authn/otp/service.go Added ctx to OTP authn service methods and propagated to notification/user services.
backend/internal/authn/oidc/service.go Added ctx to OIDC authn service core API and propagated to internal/jwt calls.
backend/internal/authn/oauth/service_test.go Updated OAuth authn service tests to pass ctx and match ctx-aware service calls.
backend/internal/authn/oauth/service.go Added ctx to OAuth authn service core API and propagated to user/idp operations.
backend/internal/authn/handler_test.go Updated authn handler tests to include ctx parameter in mocked service calls.
backend/internal/authn/handler.go Passed r.Context() into authn service calls (credentials/OTP/IDP/passkey).
backend/internal/authn/google/service.go Added ctx to Google authn service methods and propagated to internal/jwt calls.
backend/internal/authn/github/service_test.go Updated GitHub authn service tests to pass ctx and match ctx-aware OAuth service calls.
backend/internal/authn/github/service.go Added ctx to GitHub authn service methods and propagated to internal OAuth calls.
backend/internal/authn/credentials/service_test.go Updated credentials authn tests to pass ctx and match ctx-aware user service calls.
backend/internal/authn/credentials/service.go Added ctx to credentials authn service and propagated to user service calls.


func (s *UserInfoHandlerTestSuite) SetupTest() {
s.mockService = new(userInfoServiceInterfaceMock)
s.mockService = new(UserInfoServiceInterfaceMock)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The test suite initializes the mock with new(UserInfoServiceInterfaceMock), which bypasses the generated NewUserInfoServiceInterfaceMock(t) helper that registers mock.Mock.Test(t) and a Cleanup assertion for expectations. Consider switching to the helper (e.g., s.mockService = NewUserInfoServiceInterfaceMock(s.T())) so unmet expectations are reliably reported.

Suggested change
s.mockService = new(UserInfoServiceInterfaceMock)
s.mockService = NewUserInfoServiceInterfaceMock(s.T())

Copilot uses AI. Check for mistakes.
attributesJSON, err := json.Marshal(userAttributes)
if err != nil {
return nil, fmt.Errorf("failed to marshal user attributes: %w", err)
return nil, fmt.Errorf("failed to marshal attributes: %w", err)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

This error message became less specific after the refactor. Since the marshaling here is specifically for user attributes, keeping the original context (e.g., 'failed to marshal user attributes') would make logs and debugging clearer.

Suggested change
return nil, fmt.Errorf("failed to marshal attributes: %w", err)
return nil, fmt.Errorf("failed to marshal user attributes: %w", err)

Copilot uses AI. Check for mistakes.
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 224889f to 2b0818d Compare January 26, 2026 10:17
Copilot AI review requested due to automatic review settings January 26, 2026 10:27
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 2b0818d to 1661dfc Compare January 26, 2026 10:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 88 out of 159 changed files in this pull request and generated 9 comments.

Comment on lines 194 to +196
// Start passkey authentication
// TODO: Remove context.TODO() when context is available
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

These calls use context.TODO() even though this executor already receives a *core.NodeContext (and other executors in this PR propagate ctx.Context). This breaks cancellation/deadline propagation and may bypass transaction scoping. Prefer passing the existing node/request context (e.g., ctx.Context) rather than context.TODO().

Copilot uses AI. Check for mistakes.
RelyingPartyID: relyingPartyID,
}
startData, svcErr := p.passkeyService.StartAuthentication(startReq)
startData, svcErr := p.passkeyService.StartAuthentication(context.TODO(), startReq)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

These calls use context.TODO() even though this executor already receives a *core.NodeContext (and other executors in this PR propagate ctx.Context). This breaks cancellation/deadline propagation and may bypass transaction scoping. Prefer passing the existing node/request context (e.g., ctx.Context) rather than context.TODO().

Suggested change
startData, svcErr := p.passkeyService.StartAuthentication(context.TODO(), startReq)
startData, svcErr := p.passkeyService.StartAuthentication(ctx.Context, startReq)

Copilot uses AI. Check for mistakes.
SessionToken: sessionToken,
}
authResp, svcErr := p.passkeyService.FinishAuthentication(finishReq)
authResp, svcErr := p.passkeyService.FinishAuthentication(context.TODO(), finishReq)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

These calls use context.TODO() even though this executor already receives a *core.NodeContext (and other executors in this PR propagate ctx.Context). This breaks cancellation/deadline propagation and may bypass transaction scoping. Prefer passing the existing node/request context (e.g., ctx.Context) rather than context.TODO().

Suggested change
authResp, svcErr := p.passkeyService.FinishAuthentication(context.TODO(), finishReq)
authResp, svcErr := p.passkeyService.FinishAuthentication(ctx.Context, finishReq)

Copilot uses AI. Check for mistakes.

// Get user details from user service
user, svcErr := p.userService.GetUser(userID)
user, svcErr := p.userService.GetUser(context.TODO(), userID)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

These calls use context.TODO() even though this executor already receives a *core.NodeContext (and other executors in this PR propagate ctx.Context). This breaks cancellation/deadline propagation and may bypass transaction scoping. Prefer passing the existing node/request context (e.g., ctx.Context) rather than context.TODO().

Suggested change
user, svcErr := p.userService.GetUser(context.TODO(), userID)
user, svcErr := p.userService.GetUser(ctx.Context, userID)

Copilot uses AI. Check for mistakes.

// Start passkey registration
startData, svcErr := p.passkeyService.StartRegistration(regReq)
startData, svcErr := p.passkeyService.StartRegistration(context.TODO(), regReq)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

These calls use context.TODO() even though this executor already receives a *core.NodeContext (and other executors in this PR propagate ctx.Context). This breaks cancellation/deadline propagation and may bypass transaction scoping. Prefer passing the existing node/request context (e.g., ctx.Context) rather than context.TODO().

Suggested change
startData, svcErr := p.passkeyService.StartRegistration(context.TODO(), regReq)
startData, svcErr := p.passkeyService.StartRegistration(ctx.Context, regReq)

Copilot uses AI. Check for mistakes.

// Call passkey service to finish registration
finishData, svcErr := p.passkeyService.FinishRegistration(finishReq)
finishData, svcErr := p.passkeyService.FinishRegistration(context.TODO(), finishReq)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

These calls use context.TODO() even though this executor already receives a *core.NodeContext (and other executors in this PR propagate ctx.Context). This breaks cancellation/deadline propagation and may bypass transaction scoping. Prefer passing the existing node/request context (e.g., ctx.Context) rather than context.TODO().

Copilot uses AI. Check for mistakes.
Comment on lines 97 to +102
// Try to identify the user
// TODO: Remove context.TODO() when context is available
filters := map[string]interface{}{userAttributeUsername: username}
userID, err := i.IdentifyUser(filters, execResp)
userID, err := i.IdentifyUser(context.TODO(), filters, execResp)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Similar to other flow executors updated in this PR, this should propagate the existing execution/request context instead of using context.TODO(). Using TODO here undermines the goal of making services transaction/context aware.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +140
// TODO: Remove context.TODO() when context is available
svcErr := e.userService.UpdateUserCredentials(context.TODO(), userID, credentials)
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

This is another context.TODO() usage in a request-driven code path. Since the executor already has access to ctx *core.NodeContext, it should pass through the real context (e.g., ctx.Context) so downstream services can participate in cancellation/transactions.

Copilot uses AI. Check for mistakes.
if err := s.jwtService.VerifyJWT(token, "", ""); err != nil {
func (s *tokenIntrospectionService) validateToken(ctx context.Context, logger *log.Logger, token string) bool {
if err := s.jwtService.VerifyJWT(ctx, token, "", ""); err != nil {
logger.Debug("Failed to verify refresh token", log.String("error", err.Error))
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The log message says "Failed to verify refresh token" but this code validates the introspected token (which can be access token, refresh token, etc.). This looks like a copy/paste message and makes troubleshooting misleading. Update the message to refer to the generic token being introspected.

Suggested change
logger.Debug("Failed to verify refresh token", log.String("error", err.Error))
logger.Debug("Failed to verify token", log.String("error", err.Error))

Copilot uses AI. Check for mistakes.
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 1661dfc to 7970db5 Compare January 26, 2026 12:52
Copilot AI review requested due to automatic review settings January 27, 2026 06:39
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 7970db5 to 7bdb515 Compare January 27, 2026 06:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 92 out of 163 changed files in this pull request and generated 2 comments.


// userInfoServiceInterfaceMock is an autogenerated mock type for the userInfoServiceInterface type
type userInfoServiceInterfaceMock struct {
// UserInfoServiceInterfaceMock is an autogenerated mock type for the UserInfoServiceInterface type
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

This comment references UserInfoServiceInterface, but the actual interface in service.go is named userInfoServiceInterface (unexported). Update the comment to match the real interface name (or align the interface/type naming consistently) to avoid confusion when navigating generated mocks.

Suggested change
// UserInfoServiceInterfaceMock is an autogenerated mock type for the UserInfoServiceInterface type
// UserInfoServiceInterfaceMock is an autogenerated mock type for the userInfoServiceInterface type

Copilot uses AI. Check for mistakes.
RelyingPartyID: relyingPartyID,
}
startData, svcErr := p.passkeyService.StartAuthentication(startReq)
startData, svcErr := p.passkeyService.StartAuthentication(context.TODO(), startReq)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

In this method you already have access to the flow/request context via the *core.NodeContext parameter. Using context.TODO() prevents cancellation, deadlines, and transaction-scoped values (likely the purpose of this refactor) from flowing into the passkey service. Pass ctx.Context instead and remove the TODO comment.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 46.91076% with 232 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.86%. Comparing base (32f6da4) to head (33d8881).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
backend/internal/authn/service.go 41.33% 25 Missing and 19 partials ⚠️
backend/internal/group/service.go 18.42% 4 Missing and 27 partials ⚠️
backend/internal/group/store.go 33.33% 6 Missing and 20 partials ⚠️
backend/internal/authn/passkey/service.go 32.25% 14 Missing and 7 partials ⚠️
backend/internal/authn/oidc/service.go 44.44% 5 Missing and 5 partials ⚠️
backend/internal/authn/otp/service.go 28.57% 5 Missing and 5 partials ⚠️
backend/internal/authn/oauth/service.go 35.71% 4 Missing and 5 partials ⚠️
backend/internal/authn/handler.go 60.00% 0 Missing and 8 partials ⚠️
...kend/internal/oauth/oauth2/tokenservice/builder.go 80.00% 2 Missing and 6 partials ⚠️
backend/internal/authn/google/service.go 66.66% 4 Missing and 2 partials ⚠️
... and 21 more

❗ There is a different number of reports uploaded between BASE (32f6da4) and HEAD (33d8881). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (32f6da4) HEAD (33d8881)
backend-integration-sqlite 1 0
backend-integration-postgres 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1176       +/-   ##
===========================================
- Coverage   88.72%   77.86%   -10.87%     
===========================================
  Files         586      587        +1     
  Lines       39058    39477      +419     
  Branches     1998     1995        -3     
===========================================
- Hits        34653    30737     -3916     
- Misses       2629     5783     +3154     
- Partials     1776     2957     +1181     
Flag Coverage Δ
backend-integration-postgres ?
backend-integration-sqlite ?
backend-unit 74.60% <46.91%> (-5.89%) ⬇️
frontend-apps-develop-unit 89.07% <ø> (+2.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 7bdb515 to 28cd5be Compare January 27, 2026 08:07
Copilot AI review requested due to automatic review settings January 27, 2026 09:15
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 28cd5be to 6c5b882 Compare January 27, 2026 09:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 92 out of 167 changed files in this pull request and generated 2 comments.

Comment on lines 177 to 190
func (tv *tokenValidator) verifyTokenSignatureByIssuer(
ctx context.Context,
token string,
issuer string,
oauthApp *appmodel.OAuthAppConfigProcessedDTO,
) error {
issuers := getValidIssuers(oauthApp)
if issuers[issuer] {
svcErr := tv.jwtService.VerifyJWTSignature(token)
svcErr := tv.jwtService.VerifyJWTSignature(ctx, token)
if svcErr != nil {
return fmt.Errorf("failed to verify token signature: %v", svcErr)
}
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

If issuer is not in the allow-list (issuers[issuer] is false), the function returns nil without verifying the subject token signature, effectively allowing untrusted issuers to bypass signature verification. Consider explicitly rejecting unknown issuers (e.g., return an error when issuer is not allowed) so every accepted token has its signature verified.

Copilot uses AI. Check for mistakes.
if err := s.jwtService.VerifyJWT(token, "", ""); err != nil {
func (s *tokenIntrospectionService) validateToken(ctx context.Context, logger *log.Logger, token string) bool {
if err := s.jwtService.VerifyJWT(ctx, token, "", ""); err != nil {
logger.Debug("Failed to verify refresh token", log.String("error", err.Error))
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

This method validates any introspected token, but the log message says "refresh token". Consider changing it to a neutral message like "Failed to verify token" to avoid misleading debugging output.

Suggested change
logger.Debug("Failed to verify refresh token", log.String("error", err.Error))
logger.Debug("Failed to verify token", log.String("error", err.Error()))

Copilot uses AI. Check for mistakes.
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 6c5b882 to 41edaf1 Compare January 27, 2026 09:44
Copilot AI review requested due to automatic review settings January 27, 2026 11:10
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 41edaf1 to 33d8881 Compare January 27, 2026 11:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 92 out of 167 changed files in this pull request and generated 5 comments.

Comment on lines +196 to +201
// TODO: Remove context.TODO() when context is available
startReq := &passkey.PasskeyAuthenticationStartRequest{
UserID: userID,
RelyingPartyID: relyingPartyID,
}
startData, svcErr := p.passkeyService.StartAuthentication(startReq)
startData, svcErr := p.passkeyService.StartAuthentication(context.TODO(), startReq)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The executor already receives ctx *core.NodeContext, so ctx.Context is available here. Using context.TODO() drops cancellation/deadline/trace propagation. Pass ctx.Context instead (and remove the TODO comment).

Copilot uses AI. Check for mistakes.
Comment on lines 97 to +102
// Try to identify the user
// TODO: Remove context.TODO() when context is available
filters := map[string]interface{}{userAttributeUsername: username}
userID, err := i.IdentifyUser(filters, execResp)
userID, err := i.IdentifyUser(context.TODO(), filters, execResp)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Execute already has access to ctx *core.NodeContext, so ctx.Context can be used instead of context.TODO() to preserve request-scoped cancellation and tracing.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +140
// TODO: Remove context.TODO() when context is available
svcErr := e.userService.UpdateUserCredentials(context.TODO(), userID, credentials)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Since this executor has ctx *core.NodeContext, it should pass ctx.Context into UpdateUserCredentials instead of context.TODO() to keep context propagation consistent across the flow.

Copilot uses AI. Check for mistakes.
// BuildAuthorizeURL constructs the authorization request URL for Google OIDC authentication.
func (g *googleOIDCAuthnService) BuildAuthorizeURL(idpID string) (string, *serviceerror.ServiceError) {
return g.internal.BuildAuthorizeURL(idpID)
// BuildAuthorizeURL constructs the authorization request URL for Google OIDC authentication.
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Duplicate comment line (same sentence appears twice). Remove one to keep docs clean.

Suggested change
// BuildAuthorizeURL constructs the authorization request URL for Google OIDC authentication.

Copilot uses AI. Check for mistakes.
Comment on lines +23 to 25
"github.com/stretchr/testify/mock"
"testing"

Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The import block isn’t gofmt-compliant (missing standard/third-party grouping and ordering). Running gofmt would reorder/group these imports correctly (e.g., testing with stdlib, then third-party packages in a separate group).

Suggested change
"github.com/stretchr/testify/mock"
"testing"
"testing"
"github.com/stretchr/testify/mock"

Copilot uses AI. Check for mistakes.
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 33d8881 to 9afb707 Compare January 28, 2026 04:06
Copilot AI review requested due to automatic review settings January 28, 2026 05:54
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 9afb707 to 6622e62 Compare January 28, 2026 05:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 92 out of 167 changed files in this pull request and generated no new comments.

@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 6622e62 to 41edaf1 Compare January 28, 2026 06:12
Copilot AI review requested due to automatic review settings January 28, 2026 06:24
@JeethJJ JeethJJ force-pushed the db-transaction-mgt branch from 41edaf1 to 6622e62 Compare January 28, 2026 06:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 92 out of 167 changed files in this pull request and generated 1 comment.

}

// Start passkey authentication
// TODO: Remove context.TODO() when context is available
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

passkey_executor.go is still using context.TODO() even though a request/node context is available in this execution path. With the new transaction architecture, using context.TODO() will drop any request-scoped transaction/cancellation/deadlines and can cause operations to run outside the intended transaction. Pass ctx.Context (from *core.NodeContext) into these service calls instead of context.TODO() (same applies to the other context.TODO() passkey/user service calls in this file).

Copilot uses AI. Check for mistakes.
@JeethJJ JeethJJ marked this pull request as draft January 28, 2026 08:06
@JeethJJ JeethJJ changed the title Refactor user service and co-relevant services to use transactions [WIP] Refactor user service and co-relevant services to use transactions Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant