Skip to content

Make the confirmation prompt action type generic - #4519

Merged
ThaminduDilshan merged 1 commit into
thunder-id:mainfrom
madurangasiriwardena:flows/generic-confirm-action-type
Aug 3, 2026
Merged

Make the confirmation prompt action type generic#4519
ThaminduDilshan merged 1 commit into
thunder-id:mainfrom
madurangasiriwardena:flows/generic-confirm-action-type

Conversation

@madurangasiriwardena

@madurangasiriwardena madurangasiriwardena commented Aug 3, 2026

Copy link
Copy Markdown
Member

Purpose

Follow-up to @ThaminduDilshan's review comment on #4480: SIGN_OUT_CONFIRM ties the prompt action type to a single use case. This renames it to CONFIRM in the backend constant, the console's PromptActionTypes, the Conditional Sign Out Flow template, and the flow editor's Action selector option and its i18n key.

Forwarding a prompt action's type to the next node's executor is a generic mechanism, so naming the value after one use case would push every executor that routes to a confirmation prompt to add a near-identical constant of its own (DELETE_ACCOUNT_CONFIRM, CONSENT_CONFIRM, and so on). CONFIRM is the vocabulary; the session sign-out executor is its first consumer, not its only possible one.

Approach

A rename: common.ActionTypeSignOutConfirm becomes common.ActionTypeConfirm with the value CONFIRM, PromptActionTypes.SignOutConfirm becomes PromptActionTypes.Confirm, and both occurrences in the sign-out template are updated. The doc comments now state that the value is deliberately not tied to one use case. What the executor does, and what the console persists, are unchanged; the only user-visible change is the selector option's label.

Related Issues

  • N/A

Related PRs

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
    • Replaced the sign-out-specific action with a reusable Confirm action for flow buttons and prompts.
    • Updated confirmation controls, labels, templates, and validation to use the new action.
  • Bug Fixes
    • Confirmation selections now correctly preserve required submit settings and clear when switching to a standard action.
  • Documentation
    • Updated action descriptions and examples to reflect broader confirmation use.

Rename the prompt action type the session sign-out executor reads from
SIGN_OUT_CONFIRM to CONFIRM, in the backend constant and in the console's
PromptActionTypes, and update the Conditional Sign Out Flow template.

Forwarding a prompt action's type to the next node's executor is a generic
mechanism, so naming the value after one use case would push every executor
that routes to a confirmation prompt to add a near-identical constant of its
own. CONFIRM is the vocabulary rather than SIGN_OUT_CONFIRM; the session
sign-out executor is its first consumer, not its only possible one.

Rename the Action selector's option to match, from Sign Out Action under
core.buttonExtendedProperties.action.signOut to Confirm Action under
core.buttonExtendedProperties.action.confirm. Leaving it named for signing out
while it writes the generic type would offer no option an author could pick to
confirm anything else.

The sign-out validation rule keeps its own notification identifiers and its
sign-out wording: it checks that a confirmation button leads to a session
sign-out step, which stays specific to sign-out flows even though the action
type it looks for no longer is.

Refs thunder-id#4299
@madurangasiriwardena madurangasiriwardena 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 Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Confirmation action generalization

Layer / File(s) Summary
Backend confirmation contract and execution
backend/internal/flow/common/constants.go, backend/internal/flow/executor/*
The backend replaces ActionTypeSignOutConfirm with ActionTypeConfirm and uses CONFIRM for session sign-out confirmation.
Frontend confirmation action contract and editor
frontend/apps/console/src/features/flows/models/*, frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/*, frontend/apps/console/src/features/flows/data/templates.json, frontend/apps/console/src/features/flows/validation/validation-rules.ts, frontend/packages/i18n/src/locales/en-US.ts
The frontend replaces SignOutConfirm with Confirm, updates button selection and persistence, changes templates and validation, and renames the translation key.
Frontend transformation and validation coverage
frontend/apps/console/src/features/flows/components/resource-property-panel/__tests__/*, frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/__tests__/*, frontend/apps/console/src/features/flows/utils/__tests__/*, frontend/apps/console/src/features/flows/validation/__tests__/*
Tests now use CONFIRM and verify rendering, persistence, transformation, restoration, serialization, and validation behavior.

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

Possibly related PRs

Suggested reviewers: sahandilshan, donomalvindula, thamindudilshan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the generic confirmation prompt action type change.
Description check ✅ Passed The description includes the purpose, approach, related PRs, checklist, and security sections, and accurately explains the scope of the rename.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

frontend/apps/console/src/features/flows/components/resource-property-panel/__tests__/CommonResourceProperties.test.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/ButtonExtendedProperties.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/__tests__/ButtonExtendedProperties.test.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 8 others

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.

@ThaminduDilshan ThaminduDilshan added the skip-changelog Skip generating changelog for a particular PR label Aug 3, 2026
@ThaminduDilshan
ThaminduDilshan added this pull request to the merge queue Aug 3, 2026

@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: 2

🤖 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 `@frontend/apps/console/src/features/flows/models/elements.ts`:
- Around line 138-144: Preserve backward compatibility for existing
SIGN_OUT_CONFIRM values in the prompt action flow. Update the
PromptActionTypes/extraction and signOutConfirmActionRule path so saved
definitions using SIGN_OUT_CONFIRM are normalized or treated as equivalent to
PromptActionTypes.Confirm at read time, while new writes continue using CONFIRM.

In `@frontend/apps/console/src/features/flows/validation/validation-rules.ts`:
- Line 349: Update signOutConfirmActionRule’s collection of
PromptActionTypes.Confirm elements to include only confirmations belonging to
session sign-out flows, or separate validation by target executor so
non-sign-out confirmations bypass sign-out checks. Preserve the existing
SessionSignOut connection and target validation, and add coverage for a
non-sign-out CONFIRM action.
🪄 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: 6a724678-d32d-45b1-a898-cd64ff1eda4f

📥 Commits

Reviewing files that changed from the base of the PR and between f33cf78 and 6915b92.

📒 Files selected for processing (15)
  • backend/internal/flow/common/constants.go
  • backend/internal/flow/executor/session_signout_executor.go
  • backend/internal/flow/executor/session_signout_executor_test.go
  • frontend/apps/console/src/features/flows/components/resource-property-panel/__tests__/CommonResourceProperties.test.tsx
  • frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/ButtonExtendedProperties.tsx
  • frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/__tests__/ButtonExtendedProperties.test.tsx
  • frontend/apps/console/src/features/flows/data/templates.json
  • frontend/apps/console/src/features/flows/models/elements.ts
  • frontend/apps/console/src/features/flows/models/responses.ts
  • frontend/apps/console/src/features/flows/utils/__tests__/flowToCanvasTransformer.test.ts
  • frontend/apps/console/src/features/flows/utils/__tests__/reactFlowTransformer.test.ts
  • frontend/apps/console/src/features/flows/utils/reactFlowTransformer.ts
  • frontend/apps/console/src/features/flows/validation/__tests__/computeValidationNotifications.test.ts
  • frontend/apps/console/src/features/flows/validation/validation-rules.ts
  • frontend/packages/i18n/src/locales/en-US.ts

Comment on lines +138 to +144
*
* The values are deliberately not tied to a single use case: `Confirm` is read
* by the session sign-out executor today, but any executor that routes to a
* confirmation prompt can consume it.
*/
export const PromptActionTypes = {
SignOutConfirm: 'SIGN_OUT_CONFIRM',
Confirm: 'CONFIRM',

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Expect old references only in migration or compatibility code.
rg -n 'SIGN_OUT_CONFIRM|SignOutConfirm' .

Repository: thunder-id/thunderid

Length of output: 1903


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files matching elements/validation tests =="
git ls-files | grep -E 'frontend/apps/console/src/features/flows/(elements\.ts|validation/(validation-rules\.ts|__tests__/computeValidationNotifications\.test\.ts))$' || true

echo "== outline elements =="
ast-grep outline frontend/apps/console/src/features/flows/models/elements.ts --view compact || true

echo "== relevant elements.ts =="
sed -n '120,165p' frontend/apps/console/src/features/flows/models/elements.ts

echo "== validation rule relevant sections =="
sed -n '320,405p' frontend/apps/console/src/features/flows/validation/validation-rules.ts

echo "== test relevant sections =="
sed -n '580,670p' frontend/apps/console/src/features/flows/validation/__tests__/computeValidationNotifications.test.ts

echo "== all PromptActionTypes references (excluding generated/build-looking if any) =="
rg -n 'PromptActionTypes|Confirm:|actionType|SIGN_OUT_CONFIRM|SignOutConfirm' frontend/apps/console/src/features/flows -g '*.ts' -g '*.tsx'

Repository: thunder-id/thunderid

Length of output: 17953


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== flow transformers relevant sections =="
sed -n '340,385p' frontend/apps/console/src/features/flows/utils/reactFlowTransformer.ts
sed -n '100,125p' frontend/apps/console/src/features/flows/utils/flowToCanvasTransformer.ts

echo "== button extended properties relevant section =="
sed -n '1,90p' frontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/ButtonExtendedProperties.tsx

echo "== response/action model relevant section =="
sed -n '130,150p' frontend/apps/console/src/features/flows/models/responses.ts

echo "== broader FlowAction/SessionSignOutExecutor references =="
rg -n 'FlowAction|HandlePayload|action.type|NextExecutor|SessionSignOutExecutor|signOut|SignOut' frontend backend -g '*.ts' -g '*.tsx' -g '*.go' -g '*.java' -g '*.js' -g '*.jsx' 2>/dev/null | head -n 200

Repository: thunder-id/thunderid

Length of output: 33789


Preserve compatibility for existing SIGN_OUT_CONFIRM flow data.

PromptActionTypes now only exports CONFIRM, the button selector writes CONFIRM, extractActionFromComponent forwards component.actionType as prompts[].action.type, and signOutConfirmActionRule reads PromptActionTypes.Confirm. Existing definitions can still contain the old SIGN_OUT_CONFIRM value, so they can fail sign-out validation or stop sign-out validation from running. Keep a read-time alias, normalize saved definitions, or migrate stored flows before writing only CONFIRM.

🤖 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 `@frontend/apps/console/src/features/flows/models/elements.ts` around lines 138
- 144, Preserve backward compatibility for existing SIGN_OUT_CONFIRM values in
the prompt action flow. Update the PromptActionTypes/extraction and
signOutConfirmActionRule path so saved definitions using SIGN_OUT_CONFIRM are
normalized or treated as equivalent to PromptActionTypes.Confirm at read time,
while new writes continue using CONFIRM.

...((element as FlowElement & {actionType?: string}).actionType === PromptActionTypes.SignOutConfirm
? [element]
: []),
...((element as FlowElement & {actionType?: string}).actionType === PromptActionTypes.Confirm ? [element] : []),

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Scope this rule to sign-out confirmation flows.

Line 349 now collects every PromptActionTypes.Confirm element, but signOutConfirmActionRule still requires each element to connect to a SessionSignOut node. When another executor uses CONFIRM, valid buttons will receive sign-out-specific confirmNotConnected or confirmInvalidTarget notifications.

Scope collection to session sign-out context, or split validation by target executor. Add a test for a non-sign-out CONFIRM action.

🤖 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 `@frontend/apps/console/src/features/flows/validation/validation-rules.ts` at
line 349, Update signOutConfirmActionRule’s collection of
PromptActionTypes.Confirm elements to include only confirmations belonging to
session sign-out flows, or separate validation by target executor so
non-sign-out confirmations bypass sign-out checks. Preserve the existing
SessionSignOut connection and target validation, and add coverage for a
non-sign-out CONFIRM action.

Merged via the queue into thunder-id:main with commit 76ddbd4 Aug 3, 2026
62 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Skip generating changelog for a particular PR 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.

3 participants