Skip to content

Moved transactioner interface to pkg - #4359

Merged
senthalan merged 1 commit into
thunder-id:mainfrom
anushasunkada:local_main
Jul 26, 2026
Merged

Moved transactioner interface to pkg#4359
senthalan merged 1 commit into
thunder-id:mainfrom
anushasunkada:local_main

Conversation

@anushasunkada

@anushasunkada anushasunkada commented Jul 26, 2026

Copy link
Copy Markdown
Member

Purpose

Moved transactioner interface to pkg

Approach

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • New Features

    • Added support for injecting a transaction provider during engine initialization.
    • Introduced a shared transaction interface with automatic nested-transaction handling.
  • Refactor

    • Standardized transaction handling across database, runtime, entity, flow, identity, authorization, notification, and other services.
    • Existing transaction behavior and business logic remain unchanged.

Signed-off-by: anushasunkada <anushasunkada@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The transaction abstraction is moved from the internal transaction package to providers.Transactioner. The new provider interface is wired through transaction constructors, database providers, engine initialization, runtime stores, OAuth paths, and internal domain services without changing transaction execution logic.

Changes

Transactioner provider migration

Layer / File(s) Summary
Provider contract and engine injection
backend/pkg/thunderidengine/providers/interface.go, backend/internal/system/transaction/*, backend/pkg/thunderidengine/engine.go
Adds providers.Transactioner, updates transaction constructors and tests, and adds WithTransactioner to engine options.
Database transaction provider wiring
backend/internal/system/database/provider/*
Updates database client and provider interfaces and implementations to return providers.Transactioner.
Domain store and service migration
backend/internal/{cert,consent,entity,entitytype,flow,group,idp,inboundclient,notification}/...
Replaces internal transactioner field, constructor, and store return types with providers.Transactioner.
OAuth, resource, role, and runtime migration
backend/internal/{oauth,ou,resource,role,runtimestore}/...
Propagates the provider transactioner type through initialization and service wiring while preserving existing control flow.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: senthalan, rajithacharith, thiva-k

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is mostly a skeleton: Approach is empty, checklist/security items are unchecked, and breaking changes details are missing. Add a real Approach summary, a breaking-changes section with impact and migration guidance, and complete the checklist/security items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: relocating the transactioner interface into pkg.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/pkg/thunderidengine/providers/interface.go`:
- Around line 259-266: Update docs/content/apis.mdx to document the public
providers.Transactioner contract, including migration from the former internal
transaction interface, and document WithTransactioner as the engine injection
option with its expected lifecycle and configuration. Apply the documentation
changes for the interface in backend/pkg/thunderidengine/providers/interface.go
and the injection option in backend/pkg/thunderidengine/engine.go; no code
changes are required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f682237-2640-4c4e-b644-1837029a16ae

📥 Commits

Reviewing files that changed from the base of the PR and between abf7e4c and 87a0025.

⛔ Files ignored due to path filters (2)
  • backend/tests/mocks/database/providermock/DBClientInterface_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/database/providermock/DBProviderInterface_mock.go is excluded by !**/*_mock.go
📒 Files selected for processing (60)
  • backend/internal/cert/service.go
  • backend/internal/consent/service.go
  • backend/internal/consent/store.go
  • backend/internal/entity/init.go
  • backend/internal/entity/service.go
  • backend/internal/entity/store.go
  • backend/internal/entitytype/file_based_store.go
  • backend/internal/entitytype/init.go
  • backend/internal/entitytype/service.go
  • backend/internal/entitytype/store.go
  • backend/internal/flow/flowexec/init.go
  • backend/internal/flow/flowexec/service.go
  • backend/internal/flow/mgt/cache_backed_store.go
  • backend/internal/flow/mgt/file_based_store.go
  • backend/internal/flow/mgt/init.go
  • backend/internal/flow/mgt/service.go
  • backend/internal/flow/mgt/store.go
  • backend/internal/flow/session/service.go
  • backend/internal/group/file_based_store.go
  • backend/internal/group/init.go
  • backend/internal/group/service.go
  • backend/internal/group/service_test.go
  • backend/internal/idp/file_based_store.go
  • backend/internal/idp/init.go
  • backend/internal/idp/service.go
  • backend/internal/idp/store.go
  • backend/internal/inboundclient/init.go
  • backend/internal/inboundclient/service.go
  • backend/internal/inboundclient/store.go
  • backend/internal/notification/file_based_store.go
  • backend/internal/notification/init.go
  • backend/internal/notification/mgt_service.go
  • backend/internal/notification/store.go
  • backend/internal/oauth/init.go
  • backend/internal/oauth/oauth2/authz/init.go
  • backend/internal/oauth/oauth2/authz/service.go
  • backend/internal/oauth/oauth2/dcr/service.go
  • backend/internal/ou/file_based_store.go
  • backend/internal/ou/init.go
  • backend/internal/ou/service.go
  • backend/internal/ou/store.go
  • backend/internal/resource/file_based_store.go
  • backend/internal/resource/init.go
  • backend/internal/resource/init_test.go
  • backend/internal/resource/service.go
  • backend/internal/resource/store.go
  • backend/internal/role/assignment_service.go
  • backend/internal/role/file_based_store.go
  • backend/internal/role/init.go
  • backend/internal/role/service.go
  • backend/internal/role/store.go
  • backend/internal/runtimestore/dbstore/init.go
  • backend/internal/runtimestore/init.go
  • backend/internal/runtimestore/redisstore/init.go
  • backend/internal/system/database/provider/dbclient.go
  • backend/internal/system/database/provider/dbprovider.go
  • backend/internal/system/transaction/transactioner.go
  • backend/internal/system/transaction/transactioner_test.go
  • backend/pkg/thunderidengine/engine.go
  • backend/pkg/thunderidengine/providers/interface.go

Comment on lines +259 to +266

// Transactioner provides transaction management with automatic nesting detection.
type Transactioner interface {
// Transact executes the given function within a transaction.
// If a transaction already exists in the context, it reuses it.
// Otherwise, it creates a new transaction and commits/rolls back automatically.
Transact(ctx context.Context, txFunc func(context.Context) error) error
}

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.

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

🔴 Documentation Required
This PR introduces user-facing changes that are not covered by documentation updates under docs/.
Please update the relevant documentation before merging.

Missing documentation:

  • providers.Transactioner: Document the new public transaction provider contract and migration from the internal transaction interface in docs/content/apis.mdx.
  • WithTransactioner: Document the public engine injection option and its expected lifecycle/configuration in docs/content/apis.mdx.

As per path instructions, exported client-facing interface changes require documentation under docs/.

📍 Affects 2 files
  • backend/pkg/thunderidengine/providers/interface.go#L259-L266 (this comment)
  • backend/pkg/thunderidengine/engine.go#L491-L495
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/pkg/thunderidengine/providers/interface.go` around lines 259 - 266,
Update docs/content/apis.mdx to document the public providers.Transactioner
contract, including migration from the former internal transaction interface,
and document WithTransactioner as the engine injection option with its expected
lifecycle and configuration. Apply the documentation changes for the interface
in backend/pkg/thunderidengine/providers/interface.go and the injection option
in backend/pkg/thunderidengine/engine.go; no code changes are required.

Source: Path instructions

@senthalan senthalan added Type/Improvement trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes labels Jul 26, 2026
@senthalan
senthalan added this pull request to the merge queue Jul 26, 2026
Merged via the queue into thunder-id:main with commit 3666339 Jul 26, 2026
49 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes Type/Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants