Skip to content

Improve handling flow configurations#4371

Open
ThaminduDilshan wants to merge 1 commit into
thunder-id:mainfrom
ThaminduDilshan:thamindu-flow-config
Open

Improve handling flow configurations#4371
ThaminduDilshan wants to merge 1 commit into
thunder-id:mainfrom
ThaminduDilshan:thamindu-flow-config

Conversation

@ThaminduDilshan

@ThaminduDilshan ThaminduDilshan commented Jul 27, 2026

Copy link
Copy Markdown
Member

Purpose

This pull request introduces a new, unified server configuration section for flow management, allowing per-flow-type default handles and expiry times to be centrally managed. The changes refactor how default flow handles and expiry values are resolved, making them configurable via server settings instead of hardcoded values. The flow execution service is updated to read these values from the new configuration source. Additionally, new mock types are added to support testing of these changes.


⚠️ Breaking Changes

🔧 Summary of Breaking Changes

Describe what is changing

💥 Impact

What will break? Who is affected?

🔄 Migration Guide

How should users update their code/configuration to adapt to the breaking changes? Include examples if helpful


Approach

Configuration and Flow Management Improvements:

  • Added a new flow section to the server configuration, supporting per-flow-type default handles and expiry times via FlowSectionConfig and FlowTypeConfig structs (backend/cmd/server/bootstrap/02-server-configurations.yaml, backend/internal/flow/config/config.go) [1] [2].
  • Refactored the initialization and wiring of flow management and execution services to use a new serverConfigProvider interface for reading flow configuration, replacing hardcoded defaults (backend/cmd/server/servicemanager.go, backend/internal/flow/flowexec/init.go, backend/internal/flow/flowexec/service.go) [1] [2] [3] [4] [5] [6] [7] [8] [9].

Code Simplification and Test Support:

  • Removed the old getFlowExpirySeconds method in favor of reading expiry values from configuration, and updated all usages accordingly (backend/internal/flow/flowexec/service.go) [1] [2].
  • Added mock implementations for the new provider interfaces to facilitate testing (backend/internal/flow/flowexec/flowDefaultsProvider_mock_test.go, backend/internal/flow/flowexec/serverConfigProvider_mock_test.go) [1] [2].

Other Updates:

  • Updated constants and test cases to align with the new configuration-driven approach (backend/internal/flow/flowexec/constants.go, backend/internal/flow/config/config_test.go) [1] [2] [3].

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 server-configurable flow defaults and per-flow context expiration for authentication, registration, user onboarding, recovery, and sign-out.
    • Organization units can now store a dedicated user onboarding flow.
    • Flow selection now resolves using organization-unit overrides with server-level fallbacks.
    • Declarative agents can specify registration and recovery flow identifiers.
  • Bug Fixes
    • Validates user onboarding flow references and prevents invalid flow configurations.
    • Improved optional flow handling and sign-out default expiration (30 minutes).
  • Documentation
    • Updated flow configuration documentation and added migration guidance away from old deployment defaults.
  • Chores
    • Adjusted development bootstrap seeding/packaging and updated related test coverage.

@ThaminduDilshan ThaminduDilshan added Type/Improvement breaking change The feature/ improvement will alter the existing behaviour trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes labels Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ece01e3f-9ab6-4015-8b68-5e67525fdd75

📥 Commits

Reviewing files that changed from the base of the PR and between 24ea4b6 and 7e3fdf1.

⛔ Files ignored due to path filters (5)
  • backend/tests/mocks/flow/flowexecmock/flowDefaultsProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowexecmock/serverConfigProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/FlowMgtServiceInterface_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/ouProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/serverConfigProvider_mock.go is excluded by !**/*_mock.go
📒 Files selected for processing (39)
  • .gitignore
  • backend/cmd/server/bootstrap/02-server-configurations.yaml
  • backend/cmd/server/config/default.json
  • backend/cmd/server/servicemanager.go
  • backend/internal/flow/config/config.go
  • backend/internal/flow/config/config_test.go
  • backend/internal/flow/flowexec/constants.go
  • backend/internal/flow/flowexec/flowDefaultsProvider_mock_test.go
  • backend/internal/flow/flowexec/init.go
  • backend/internal/flow/flowexec/serverConfigProvider_mock_test.go
  • backend/internal/flow/flowexec/service.go
  • backend/internal/flow/flowexec/service_test.go
  • backend/internal/flow/mgt/FlowMgtServiceInterface_mock_test.go
  • backend/internal/flow/mgt/init.go
  • backend/internal/flow/mgt/ouProvider_mock_test.go
  • backend/internal/flow/mgt/serverConfigProvider_mock_test.go
  • backend/internal/flow/mgt/server_config.go
  • backend/internal/flow/mgt/server_config_test.go
  • backend/internal/flow/mgt/service.go
  • backend/internal/flow/mgt/service_test.go
  • backend/internal/inboundclient/ouProvider_mock_test.go
  • backend/internal/inboundclient/service.go
  • backend/internal/inboundclient/service_test.go
  • backend/internal/ou/error_constants.go
  • backend/internal/ou/handler.go
  • backend/internal/ou/model.go
  • backend/internal/ou/service.go
  • backend/internal/ou/store.go
  • backend/internal/ou/store_test.go
  • backend/internal/serverconfig/constants.go
  • backend/internal/system/i18n/core/defaults.go
  • backend/pkg/thunderidengine/config/config.go
  • backend/pkg/thunderidengine/engine.go
  • backend/pkg/thunderidengine/providers/model.go
  • build.ps1
  • build.sh
  • docs/content/deployment/configuration.mdx
  • tests/integration/resources/declarative_resources/agents/agent-declarative-1.yaml
  • tests/integration/resources/declarative_resources/agents/agent-declarative-confidential.yaml
 __________________
< Zero bugs given. >
 ------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
📝 Walkthrough

Walkthrough

This change moves flow defaults and expiry settings into a server-configured flow section, adds effective flow resolution across overrides, organization units, and server defaults, updates inbound flow handling, and persists organization-unit user onboarding flow IDs.

Changes

Flow defaults and resolution

Layer / File(s) Summary
Flow configuration contract and service wiring
backend/internal/flow/config/*, backend/internal/flow/mgt/server_config.*, backend/internal/serverconfig/*, backend/cmd/server/*, build.*, .gitignore
Adds flow configuration types, decoding, validation, merging, bootstrap data, service registration, and development packaging updates.
Effective flow ID resolution
backend/internal/flow/mgt/*
Resolves flow IDs from explicit overrides, organization-unit defaults, and server-level flow handles.
Runtime flow defaults and expiry
backend/internal/flow/flowexec/*, backend/pkg/thunderidengine/*
Reads default handles and expiry values from merged server configuration and updates flow execution initialization and tests.
Inbound client flow defaults
backend/internal/inboundclient/*
Uses effective flow resolution for authentication, registration, recovery, and optional sign-out flows.
Organization-unit onboarding flow persistence
backend/internal/ou/*, backend/pkg/thunderidengine/providers/model.go, backend/internal/system/i18n/core/defaults.go
Carries, validates, stores, retrieves, and reports errors for organization-unit user onboarding flow IDs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant inboundClientService
  participant flowMgtService
  participant serverConfigService
  participant OUService
  Client->>inboundClientService: Resolve flow defaults
  inboundClientService->>flowMgtService: ResolveEffectiveFlowID
  flowMgtService->>OUService: GetOrganizationUnit
  OUService-->>flowMgtService: OU flow default
  flowMgtService->>serverConfigService: GetMergedConfig("flow")
  serverConfigService-->>flowMgtService: Server flow default
  flowMgtService-->>inboundClientService: Effective flow ID
  inboundClientService-->>Client: Resolved flow defaults
Loading

Possibly related PRs

Suggested reviewers: darshanasbg, rajithacharith, brionmario, anushasunkada, nutharanr

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change to flow configuration handling.
Description check ✅ Passed The description is mostly complete and matches the template with Purpose, Approach, Issues, Checklist, and Security sections filled.
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: 6

🧹 Nitpick comments (4)
backend/internal/ou/store_test.go (1)

726-771: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover non-empty onboarding flow IDs in persistence tests.

Both the create and update “design fields” cases leave UserOnboardingFlowID empty, so these tests would pass even if a real value were dropped or serialized incorrectly. Set a non-empty ID in each fixture and assert that the metadata JSON contains that exact value.

Based on the supplied store implementation and test cases, the new persistence path is not currently exercised with a real onboarding flow ID.

🤖 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/internal/ou/store_test.go` around lines 726 - 771, Update the
“success with design fields” fixtures in backend/internal/ou/store_test.go lines
726-771 and 1406-1448 for both create and update cases: assign a non-empty
UserOnboardingFlowID and assert that the expected metadata JSON contains that
exact value, exercising persistence and serialization of onboarding flow IDs.
backend/internal/flow/flowexec/service_test.go (1)

1757-1757: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer named constants over magic-number literals in expiry assertions.

mock.MatchedBy(func(exp int64) bool { return exp == int64(1800) }) and s.Equal(int64(1800), ...) hardcode the fallback expiry instead of referencing defaultAuthFlowExpiry/defaultRecoveryFlowExpiry. If the constants ever change, these assertions silently stop verifying the actual default and just re-encode a stale expectation.

Also applies to: 2332-2332, 650-666

🤖 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/internal/flow/flowexec/service_test.go` at line 1757, Replace the
hardcoded 1800 expiry literals in the affected assertions, including the
mock.MatchedBy callbacks and s.Equal checks, with the appropriate named
constants defaultAuthFlowExpiry or defaultRecoveryFlowExpiry. Preserve the
existing assertion behavior while ensuring each test references the
corresponding default expiry constant.
backend/internal/flow/flowexec/service.go (1)

923-923: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use a shared logger component-name constant for FlowExecService.

service.go repeats "FlowExecService" across multiple logger initializations. Define and use one loggerComponentNameFlowExecService constant in this package so future renames stay localized and consistent.

🤖 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/internal/flow/flowexec/service.go` at line 923, Define a
package-level loggerComponentNameFlowExecService constant in the flow execution
service package, then replace every hard-coded "FlowExecService" component name
used by logger initializations in service.go with that constant, including the
shown With call.
backend/internal/flow/flowexec/flowDefaultsProvider_mock_test.go (1)

1-166: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the orphaned flowDefaultsProvider mock artifact.

flowDefaultsProvider has no non-mock references, while the implementation calls private flowExecService methods directly (resolveDefaultFlowHandle returns (string, *common.ServiceError) in mgt/service.go, and flowexec/service.go private resolveDefaultFlowHandle returns only string). Keep the mock if the public interface is intended, or drop the mock-generated types if it was discarded.

🤖 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/internal/flow/flowexec/flowDefaultsProvider_mock_test.go` around
lines 1 - 166, Remove the orphaned generated flowDefaultsProvider mock artifact,
including newFlowDefaultsProviderMock, flowDefaultsProviderMock, and its
expectation/helper methods, because the implementation uses private
flowExecService methods directly. Do not alter the flowExecService
implementations or their return contracts; retain the mock only if a live public
interface reference is restored.
🤖 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/internal/flow/flowexec/service.go`:
- Around line 919-942: Update getFlowSectionConfig to log an error when the
merged "flow" configuration fails the flowconfig.FlowSectionConfig type
assertion before returning the zero FlowSectionConfig. Include enough context to
identify the unexpected type, while preserving the existing fallback behavior.

In `@backend/internal/flow/mgt/service.go`:
- Around line 697-703: Log a warning when s.ouSvc.GetOrganizationUnit in the
OU-resolution block fails, including the OU identifier and error details, before
continuing to server-level default resolution. Preserve the existing successful
lookup and fallback behavior.
- Around line 738-782: Propagate the server-config read failure from
getFlowSectionConfig instead of logging a warning and returning an empty
configuration with nil error. Return the svcErr from GetMergedConfig so
resolveDefaultFlowHandle and ResolveEffectiveFlowID can surface infrastructure
failures while preserving the empty-config behavior when no service is
configured or the merged value is not a FlowSectionConfig.

In `@backend/internal/inboundclient/service.go`:
- Around line 618-622: After resolving the authentication flow in the
inbound-client acceptance path, explicitly reject an empty c.AuthFlowID before
assigning or accepting it. Update the logic around resolveFlowDefaults and
validateAuthFlowID so empty values produce the required validation error, while
valid resolved flow IDs continue through the existing assignment path.

In `@backend/internal/serverconfig/constants.go`:
- Around line 32-41: Update the documentation under docs/content/guides/ to
cover the new flow configuration represented by ConfigNameFlow, including
per-flow default handles, expiry settings, resolution precedence (override,
organization unit, then server default), and migration from prior hardcoded
defaults. For backend/internal/serverconfig/constants.go:32-41,
backend/cmd/server/bootstrap/02-server-configurations.yaml:1-13, and
backend/internal/inboundclient/service_test.go:1565-1633, add or link
documentation describing the flow section, bootstrap defaults and supported
keys, and inbound-client default resolution behavior respectively.

In `@backend/pkg/thunderidengine/engine.go`:
- Around line 172-178: The embedded-engine initialization in
`flowexec.Initialize` passes a nil server-config provider while default flow
handles are now resolved through it. Add an embedded-engine provider or option
supplying `DefaultAuthFlowHandle`, `DefaultSignOutFlowHandle`, and
`UserOnboardingFlowHandle`, or otherwise preserve an executable fallback path,
and pass it from `engine.go` so auth fallback and onboarding flow resolution
never use empty handles.

---

Nitpick comments:
In `@backend/internal/flow/flowexec/flowDefaultsProvider_mock_test.go`:
- Around line 1-166: Remove the orphaned generated flowDefaultsProvider mock
artifact, including newFlowDefaultsProviderMock, flowDefaultsProviderMock, and
its expectation/helper methods, because the implementation uses private
flowExecService methods directly. Do not alter the flowExecService
implementations or their return contracts; retain the mock only if a live public
interface reference is restored.

In `@backend/internal/flow/flowexec/service_test.go`:
- Line 1757: Replace the hardcoded 1800 expiry literals in the affected
assertions, including the mock.MatchedBy callbacks and s.Equal checks, with the
appropriate named constants defaultAuthFlowExpiry or defaultRecoveryFlowExpiry.
Preserve the existing assertion behavior while ensuring each test references the
corresponding default expiry constant.

In `@backend/internal/flow/flowexec/service.go`:
- Line 923: Define a package-level loggerComponentNameFlowExecService constant
in the flow execution service package, then replace every hard-coded
"FlowExecService" component name used by logger initializations in service.go
with that constant, including the shown With call.

In `@backend/internal/ou/store_test.go`:
- Around line 726-771: Update the “success with design fields” fixtures in
backend/internal/ou/store_test.go lines 726-771 and 1406-1448 for both create
and update cases: assign a non-empty UserOnboardingFlowID and assert that the
expected metadata JSON contains that exact value, exercising persistence and
serialization of onboarding flow IDs.
🪄 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: f8d6528c-6678-4f6e-9f93-5fa25201fbbe

📥 Commits

Reviewing files that changed from the base of the PR and between f117301 and d175790.

⛔ Files ignored due to path filters (5)
  • backend/tests/mocks/flow/flowexecmock/flowDefaultsProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowexecmock/serverConfigProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/FlowMgtServiceInterface_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/ouProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/serverConfigProvider_mock.go is excluded by !**/*_mock.go
📒 Files selected for processing (35)
  • .gitignore
  • backend/cmd/server/bootstrap/02-server-configurations.yaml
  • backend/cmd/server/config/default.json
  • backend/cmd/server/servicemanager.go
  • backend/internal/flow/config/config.go
  • backend/internal/flow/config/config_test.go
  • backend/internal/flow/flowexec/constants.go
  • backend/internal/flow/flowexec/flowDefaultsProvider_mock_test.go
  • backend/internal/flow/flowexec/init.go
  • backend/internal/flow/flowexec/serverConfigProvider_mock_test.go
  • backend/internal/flow/flowexec/service.go
  • backend/internal/flow/flowexec/service_test.go
  • backend/internal/flow/mgt/FlowMgtServiceInterface_mock_test.go
  • backend/internal/flow/mgt/init.go
  • backend/internal/flow/mgt/ouProvider_mock_test.go
  • backend/internal/flow/mgt/serverConfigProvider_mock_test.go
  • backend/internal/flow/mgt/server_config.go
  • backend/internal/flow/mgt/service.go
  • backend/internal/flow/mgt/service_test.go
  • backend/internal/inboundclient/ouProvider_mock_test.go
  • backend/internal/inboundclient/service.go
  • backend/internal/inboundclient/service_test.go
  • backend/internal/ou/error_constants.go
  • backend/internal/ou/handler.go
  • backend/internal/ou/model.go
  • backend/internal/ou/service.go
  • backend/internal/ou/store.go
  • backend/internal/ou/store_test.go
  • backend/internal/serverconfig/constants.go
  • backend/internal/system/i18n/core/defaults.go
  • backend/pkg/thunderidengine/config/config.go
  • backend/pkg/thunderidengine/engine.go
  • backend/pkg/thunderidengine/providers/model.go
  • build.ps1
  • build.sh
💤 Files with no reviewable changes (1)
  • backend/cmd/server/config/default.json

Comment thread backend/internal/flow/flowexec/service.go
Comment thread backend/internal/flow/mgt/service.go
Comment thread backend/internal/flow/mgt/service.go
Comment thread backend/internal/inboundclient/service.go Outdated
Comment thread backend/internal/serverconfig/constants.go
Comment thread backend/pkg/thunderidengine/engine.go
flowExecService := newFlowExecService(flowProvider, flowStore, flowEngine,
actorProvider, observabilitySvc, transactioner, cryptoSvc, attestationVerifier,
graphBuilder, cfg)
graphBuilder, serverConfigSvc, cfg)

@rajithacharith rajithacharith Jul 27, 2026

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.

Do we directly inject server config? or thought of having a proxy svc only to get default flows.
If we don't have any other data required from serverConfigs

FlowExec --> DefaultFlowProvider --> serverConfig 
                         |-> GetDefaultFlow(FlowType string) (flowId string)

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.

Is this proxy pattern something we're following in other places when accessing server config svc? I have defined a serverConfigProvider interface to downscope it only to the required method, but this doesn't restrict it to flow configurations.

type serverConfigProvider interface {
	GetMergedConfig(ctx context.Context, name string) (any, *tidcommon.ServiceError)
}

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

🧹 Nitpick comments (1)
backend/internal/flow/flowexec/service_test.go (1)

650-666: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded expiry literals replace named default constants, inconsistent with sibling test.

TestGetFlowExpirySeconds (Line 650-666), TestInitiateAndExecute_ZeroExpiryUsesDefault (Line 1757), and TestGetFlowExpirySeconds_RecoveryFlow (Line 2332) now assert raw literals (1800, 3600, 86400) instead of the named default constants (e.g., defaultRecoveryFlowExpiry), while TestGetFlowExpirySeconds_SignOutFallsBackToDefault (Line 3283) still references defaultSignOutFlowExpiry. Referencing constants keeps the tests tied to the actual source of truth and catches unintended default drift; literals can silently pass even if the underlying default constant changes.

♻️ Suggested fix (illustrative, using existing named constants)
 		{
 			name:     "Authentication flow",
 			flowType: providers.FlowTypeAuthentication,
-			expected: 1800,
+			expected: defaultAuthFlowExpiry,
 		},
 		{
 			name:     "Registration flow",
 			flowType: providers.FlowTypeRegistration,
-			expected: 3600,
+			expected: defaultRegistrationFlowExpiry,
 		},
 		{
 			name:     "User onboarding flow",
 			flowType: providers.FlowTypeUserOnboarding,
-			expected: 86400,
+			expected: defaultUserOnboardingFlowExpiry,
 		},
 		{
 			name:     "Unknown flow type (fallback)",
 			flowType: providers.FlowType("UNKNOWN_FLOW"),
-			expected: 1800,
+			expected: defaultAuthFlowExpiry,
 		},
-	mockStore.EXPECT().StoreFlowContext(mock.Anything, mock.Anything,
-		mock.MatchedBy(func(exp int64) bool { return exp == int64(1800) })).
+	mockStore.EXPECT().StoreFlowContext(mock.Anything, mock.Anything,
+		mock.MatchedBy(func(exp int64) bool { return exp == defaultAuthFlowExpiry })).
-	s.Equal(int64(1800), service.getFlowExpirySeconds(context.Background(), providers.FlowTypeRecovery))
+	s.Equal(defaultRecoveryFlowExpiry, service.getFlowExpirySeconds(context.Background(), providers.FlowTypeRecovery))

Also applies to: 1757-1757, 2332-2332

🤖 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/internal/flow/flowexec/service_test.go` around lines 650 - 666,
Replace the hardcoded expiry literals in TestGetFlowExpirySeconds,
TestInitiateAndExecute_ZeroExpiryUsesDefault, and
TestGetFlowExpirySeconds_RecoveryFlow with the corresponding named default
constants used by the implementation, matching
TestGetFlowExpirySeconds_SignOutFallsBackToDefault. Preserve each test’s
existing expected flow behavior while ensuring assertions track the
source-of-truth defaults.
🤖 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.

Nitpick comments:
In `@backend/internal/flow/flowexec/service_test.go`:
- Around line 650-666: Replace the hardcoded expiry literals in
TestGetFlowExpirySeconds, TestInitiateAndExecute_ZeroExpiryUsesDefault, and
TestGetFlowExpirySeconds_RecoveryFlow with the corresponding named default
constants used by the implementation, matching
TestGetFlowExpirySeconds_SignOutFallsBackToDefault. Preserve each test’s
existing expected flow behavior while ensuring assertions track the
source-of-truth defaults.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d5c2fd2-cb4a-4d54-9114-f9d09601d2ea

📥 Commits

Reviewing files that changed from the base of the PR and between d175790 and 24ea4b6.

⛔ Files ignored due to path filters (5)
  • backend/tests/mocks/flow/flowexecmock/flowDefaultsProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowexecmock/serverConfigProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/FlowMgtServiceInterface_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/ouProvider_mock.go is excluded by !**/*_mock.go
  • backend/tests/mocks/flow/flowmgtmock/serverConfigProvider_mock.go is excluded by !**/*_mock.go
📒 Files selected for processing (36)
  • .gitignore
  • backend/cmd/server/bootstrap/02-server-configurations.yaml
  • backend/cmd/server/config/default.json
  • backend/cmd/server/servicemanager.go
  • backend/internal/flow/config/config.go
  • backend/internal/flow/config/config_test.go
  • backend/internal/flow/flowexec/constants.go
  • backend/internal/flow/flowexec/flowDefaultsProvider_mock_test.go
  • backend/internal/flow/flowexec/init.go
  • backend/internal/flow/flowexec/serverConfigProvider_mock_test.go
  • backend/internal/flow/flowexec/service.go
  • backend/internal/flow/flowexec/service_test.go
  • backend/internal/flow/mgt/FlowMgtServiceInterface_mock_test.go
  • backend/internal/flow/mgt/init.go
  • backend/internal/flow/mgt/ouProvider_mock_test.go
  • backend/internal/flow/mgt/serverConfigProvider_mock_test.go
  • backend/internal/flow/mgt/server_config.go
  • backend/internal/flow/mgt/server_config_test.go
  • backend/internal/flow/mgt/service.go
  • backend/internal/flow/mgt/service_test.go
  • backend/internal/inboundclient/ouProvider_mock_test.go
  • backend/internal/inboundclient/service.go
  • backend/internal/inboundclient/service_test.go
  • backend/internal/ou/error_constants.go
  • backend/internal/ou/handler.go
  • backend/internal/ou/model.go
  • backend/internal/ou/service.go
  • backend/internal/ou/store.go
  • backend/internal/ou/store_test.go
  • backend/internal/serverconfig/constants.go
  • backend/internal/system/i18n/core/defaults.go
  • backend/pkg/thunderidengine/config/config.go
  • backend/pkg/thunderidengine/engine.go
  • backend/pkg/thunderidengine/providers/model.go
  • build.ps1
  • build.sh
💤 Files with no reviewable changes (1)
  • backend/cmd/server/config/default.json
🚧 Files skipped from review as they are similar to previous changes (30)
  • backend/pkg/thunderidengine/providers/model.go
  • backend/internal/flow/flowexec/constants.go
  • backend/cmd/server/bootstrap/02-server-configurations.yaml
  • backend/internal/system/i18n/core/defaults.go
  • backend/internal/ou/model.go
  • backend/pkg/thunderidengine/config/config.go
  • backend/internal/ou/error_constants.go
  • backend/internal/ou/store_test.go
  • backend/internal/flow/mgt/init.go
  • backend/internal/flow/flowexec/serverConfigProvider_mock_test.go
  • backend/internal/flow/config/config.go
  • backend/internal/serverconfig/constants.go
  • backend/internal/ou/handler.go
  • build.sh
  • backend/internal/ou/service.go
  • backend/pkg/thunderidengine/engine.go
  • backend/cmd/server/servicemanager.go
  • backend/internal/flow/mgt/server_config.go
  • backend/internal/flow/config/config_test.go
  • backend/internal/ou/store.go
  • backend/internal/inboundclient/ouProvider_mock_test.go
  • .gitignore
  • backend/internal/flow/mgt/serverConfigProvider_mock_test.go
  • backend/internal/flow/mgt/FlowMgtServiceInterface_mock_test.go
  • backend/internal/flow/mgt/service.go
  • backend/internal/flow/mgt/ouProvider_mock_test.go
  • backend/internal/inboundclient/service_test.go
  • backend/internal/flow/flowexec/service.go
  • backend/internal/inboundclient/service.go
  • backend/internal/flow/flowexec/init.go

return ErrFKFlowDefinitionRetrievalFailed
}
}
c.IsRegistrationFlowEnabled = c.RegistrationFlowID != ""

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.

If at app-level we set the IsRegistrationFlowEnabled to false, wont the defaults get applied and set it to true here?

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.

this is fixed

return err
}
c.RecoveryFlowID = recID
c.IsRecoveryFlowEnabled = c.RecoveryFlowID != ""

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.

Check here too

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.

this is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change The feature/ improvement will alter the existing behaviour 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.

Improve configuration experience of default flows Allow configuring flow expiry times

3 participants