Make the confirmation prompt action type generic - #4519
Conversation
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
📝 WalkthroughWalkthroughChangesConfirmation action generalization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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
frontend/apps/console/src/features/flows/components/resource-property-panel/__tests__/CommonResourceProperties.test.tsxESLint 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.tsxESLint 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.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (15)
backend/internal/flow/common/constants.gobackend/internal/flow/executor/session_signout_executor.gobackend/internal/flow/executor/session_signout_executor_test.gofrontend/apps/console/src/features/flows/components/resource-property-panel/__tests__/CommonResourceProperties.test.tsxfrontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/ButtonExtendedProperties.tsxfrontend/apps/console/src/features/flows/components/resource-property-panel/extended-properties/__tests__/ButtonExtendedProperties.test.tsxfrontend/apps/console/src/features/flows/data/templates.jsonfrontend/apps/console/src/features/flows/models/elements.tsfrontend/apps/console/src/features/flows/models/responses.tsfrontend/apps/console/src/features/flows/utils/__tests__/flowToCanvasTransformer.test.tsfrontend/apps/console/src/features/flows/utils/__tests__/reactFlowTransformer.test.tsfrontend/apps/console/src/features/flows/utils/reactFlowTransformer.tsfrontend/apps/console/src/features/flows/validation/__tests__/computeValidationNotifications.test.tsfrontend/apps/console/src/features/flows/validation/validation-rules.tsfrontend/packages/i18n/src/locales/en-US.ts
| * | ||
| * 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', |
There was a problem hiding this comment.
🗄️ 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 200Repository: 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] : []), |
There was a problem hiding this comment.
🎯 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.
Purpose
Follow-up to @ThaminduDilshan's review comment on #4480:
SIGN_OUT_CONFIRMties the prompt action type to a single use case. This renames it toCONFIRMin the backend constant, the console'sPromptActionTypes, 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).CONFIRMis the vocabulary; the session sign-out executor is its first consumer, not its only possible one.Approach
A rename:
common.ActionTypeSignOutConfirmbecomescommon.ActionTypeConfirmwith the valueCONFIRM,PromptActionTypes.SignOutConfirmbecomesPromptActionTypes.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
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit