Skip to content

Resolve runtime product name in passkey flow templates#2996

Closed
RushanNanayakkara wants to merge 4 commits into
thunder-id:mainfrom
RushanNanayakkara:claude/identity-platform-rebrand-audit
Closed

Resolve runtime product name in passkey flow templates#2996
RushanNanayakkara wants to merge 4 commits into
thunder-id:mainfrom
RushanNanayakkara:claude/identity-platform-rebrand-audit

Conversation

@RushanNanayakkara
Copy link
Copy Markdown
Contributor

@RushanNanayakkara RushanNanayakkara commented May 26, 2026

Summary

Fixes #2995.

Resolves the only end-user-visible surface that the existing configuration.brand.productName mechanism could not previously reach: the WebAuthn passkey relying-party name shipped in the flow-builder seed JSON.

What changed

  • Replaced the literal "ThunderID" with the "{{productName}}" placeholder in 12 lines across 4 seed JSON files (flows/data/templates.json, login-flow/data/{templates,executors,widgets}.json).
  • useGetFlowBuilderCoreResources and useGetLoginFlowBuilderResources now resolve the placeholder at load time using the existing updateTemplatePlaceholderReferences util and config.brand.product_name from useConfig().
  • Updated existing tests to mock useConfig, and added a substitution assertion in useGetFlowBuilderCoreResources.test.ts.

No new util, no new placeholder syntax — reuses the {{key}} mechanism already present for ID generation and i18n. Hook return shapes are unchanged.

Test plan

  • pnpm test useGetFlowBuilderCoreResources useGetLoginFlowBuilderResources — 38/38 passing
  • Full pnpm test and pnpm lint in frontend/apps/console — covered by CI
  • Manual: with configuration.brand.productName overridden in Helm values, instantiate a passkey-based template and verify the relying-party-name field defaults to the configured product name in the Passkey properties panel.
  • Manual: register a passkey using the resulting flow and confirm the OS-rendered passkey dialog reads the configured product name (not the literal "ThunderID").

Replaces the hardcoded "ThunderID" relyingPartyName string in flow
builder seed JSON with a {{productName}} placeholder, and resolves
it at hook-load time from config.brand.product_name. This is the
only end-user-visible surface that the existing brand configuration
mechanism could not previously reach -- the WebAuthn browser dialog
now reads the deployment's configured product name instead of the
literal "ThunderID".

Reuses the existing updateTemplatePlaceholderReferences util so no
new placeholder syntax or substitution machinery is introduced. The
hooks' return shapes are unchanged, and the admin-facing Passkey
properties panel continues to surface the resolved value as the
default (admins can still override it).
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR replaces hardcoded "ThunderID" with a {{productName}} placeholder in passkey JSON resources and resolves that placeholder at runtime from config.brand.product_name in both flow-builder and login-flow resource hooks; tests mock useConfig and assert substitution.

Changes

Dynamic Brand Resolution Across Flow Resources

Layer / File(s) Summary
Flow Builder Core Resources Placeholder Resolution
frontend/apps/console/src/features/flows/api/useGetFlowBuilderCoreResources.ts, frontend/apps/console/src/features/flows/api/__tests__/useGetFlowBuilderCoreResources.test.ts, frontend/apps/console/src/features/flows/data/templates.json
Hook now calls useConfig() to read brand.product_name and passes it to updateTemplatePlaceholderReferences to resolve {{productName}} placeholders in imported elements, steps, templates, and widgets JSON bundles, returning the resolved result in a memoized computation. Tests mock useConfig with a product name and verify placeholder substitution and that returned templates/widgets are non-empty. templates.json updated: six passkey-related nodes change relyingPartyName from "ThunderID" to {{productName}}.
Login Flow Resources Placeholder Resolution
frontend/apps/console/src/features/login-flow/api/useGetLoginFlowBuilderResources.ts, frontend/apps/console/src/features/login-flow/api/__tests__/useGetLoginFlowBuilderResources.test.ts, frontend/apps/console/src/features/login-flow/data/templates.json, frontend/apps/console/src/features/login-flow/data/executors.json, frontend/apps/console/src/features/login-flow/data/widgets.json
Hook reads core resources and config.brand.product_name via useConfig(), resolves local resources (steps, templates, widgets, executors) via updateTemplatePlaceholderReferences, then memoizes and returns the merged resolved resources. Test module mocks useConfig to provide a stub product name. Data files updated: templates.json (2 occurrences), executors.json (2 occurrences), and widgets.json (2 occurrences) change passkey executor relyingPartyName / properties.relyingPartyName from "ThunderID" to {{productName}}.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

Type/Bug

Suggested reviewers

  • DonOmalVindula
  • brionmario
  • jeradrutnam
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description is well-structured with clear purpose, approach, related issues/PRs, and comprehensive test plan details; however, the checklist is not completed (all items unchecked). Complete the checklist by marking relevant items as done (e.g., testing, documentation, security checks) to confirm pre-merge readiness and process compliance.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: resolving the runtime product name in passkey flow templates.
Linked Issues check ✅ Passed All code changes in the PR fully implement the requirements from issue #2995: placeholder substitution in 12 lines across 4 JSON files and hook updates to resolve the placeholder at load time using config.brand.product_name.
Out of Scope Changes check ✅ Passed All changes align with the stated objective of resolving passkey relyingPartyName from configured brand productName; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

The eslint-disable comment matches the established pattern in
ApplicationCreate/__tests__/useApplicationCreate.test.tsx. The
assertion is needed because vitest's importOriginal() returns
`unknown` and we spread it into the mock implementation.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/apps/console/src/features/login-flow/api/useGetLoginFlowBuilderResources.ts (1)

61-64: 💤 Low value

Consider extending Resources type to include executors.

The type assertion (coreResources as Resources & {executors?: unknown[]}) suggests the Resources type definition doesn't include an executors property. If executors are a legitimate part of the resources structure, updating the type would provide better type safety and eliminate the need for this assertion.

🤖 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/login-flow/api/useGetLoginFlowBuilderResources.ts`
around lines 61 - 64, The code is using a type assertion for coreResources to
add an executors property, which indicates Resources lacks that field; update
the Resources type definition to include executors?: ExecutorType[] (or
unknown[] if ExecutorType isn't defined) so coreResources naturally typesafe
contains executors, then remove the inline cast in
useGetLoginFlowBuilderResources.ts and rely on coreResources.executors together
with resolvedLocal.executors; ensure you update the Resources interface/ type
declaration where it's defined and adapt any imports/usages of Resources
accordingly.
🤖 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
`@frontend/apps/console/src/features/login-flow/api/useGetLoginFlowBuilderResources.ts`:
- Around line 61-64: The code is using a type assertion for coreResources to add
an executors property, which indicates Resources lacks that field; update the
Resources type definition to include executors?: ExecutorType[] (or unknown[] if
ExecutorType isn't defined) so coreResources naturally typesafe contains
executors, then remove the inline cast in useGetLoginFlowBuilderResources.ts and
rely on coreResources.executors together with resolvedLocal.executors; ensure
you update the Resources interface/ type declaration where it's defined and
adapt any imports/usages of Resources accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 08751a2f-a009-4b07-b54b-b52471fb39ee

📥 Commits

Reviewing files that changed from the base of the PR and between 1206582 and 71f9a04.

📒 Files selected for processing (1)
  • frontend/apps/console/src/features/login-flow/api/useGetLoginFlowBuilderResources.ts

The Resources interface already declares executors: Step[], so the
inline intersection cast was redundant. Removing it as suggested by
CodeRabbit.
@RushanNanayakkara RushanNanayakkara deleted the claude/identity-platform-rebrand-audit branch May 26, 2026 01:06
@RushanNanayakkara
Copy link
Copy Markdown
Contributor Author

Superseded by #2997 (squashed to a single commit on a renamed branch). Same diff.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

Passkey relying-party name should resolve from the configured brand productName

1 participant