Skip to content

Add an Application/User sub-tab split to the application token tab - #4333

Merged
brionmario merged 1 commit into
thunder-id:mainfrom
Dilusha-Madushan:feature/app-edit-token-grant-parity
Jul 27, 2026
Merged

Add an Application/User sub-tab split to the application token tab#4333
brionmario merged 1 commit into
thunder-id:mainfrom
Dilusha-Madushan:feature/app-edit-token-grant-parity

Conversation

@Dilusha-Madushan

@Dilusha-Madushan Dilusha-Madushan commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Purpose

Bring the agent edit page's token and grant-type experience to the application
edit page.

Previously the application Token tab exposed only user-token config, while the
agent Token tab already had a separate Application (client_credentials) token
tab, grant-type-aware locking of user-facing settings, and named save-time
validation. This PR gives applications the same behavior:

  • A two sub-tab Token view: Application (client_credentials token) and User.
    The Application tab lets you add optional ouHandle, ouId, ouName, roles,
    and groups claims to the client access token and configure its own validity
    period, independent of the user token.
  • Grant-type gating: the User token, Flows, Customization, and the general Access
    section (allowed user types, redirect URIs) are frozen or hidden when no
    user-facing grant (authorization_code, CIBA, password) is selected, and the
    Application token tab is frozen when client_credentials is not selected.
  • Named save-time validation: the save bar now lists the exact required items to
    fix (e.g. "Before saving, add a redirect URI and select at least one allowed
    user type") instead of a generic message, matching the agent edit page.

Approach

The change is frontend only. The data model already supported it
(AccessTokenConfig carries separate userConfig and clientConfig, each with
its own validityPeriod and attributes).

Key design decisions:

  • Share, don't duplicate. Following the existing agent → application import
    convention, the client-credentials token section was extracted into a shared
    ClientAccessTokenSection (in applications/.../token-settings/), parameterized
    by attribute source and display copy. The agent tab now consumes it, passing its
    type-schema attributes merged with the agent system/OU/role attributes; the
    application tab passes the fixed OU/roles/groups claim list. The agent-only
    DelegationLockNotice was promoted to a shared, domain-neutral
    SettingsLockNotice used by both features.
  • Grant helpers. hasUserAccess / hasClientAccess were added to
    oauth2Rules so the page and token container derive tab locking from grant
    types in one place. User access = authorization_code, CIBA, or password.
  • Locked, not hidden, tabs. Tabs whose grant is absent stay visible but frozen
    (dimmed, non-interactive) via SettingsLockNotice plus a forced isReadOnly,
    mirroring the agent UX. Only the user-oriented fields inside the general Access
    section are hidden outright, since they are meaningless for a machine client.
  • Page-level validation. Required checks (redirect URI, allowed user type,
    certificate) are computed in ApplicationEditPage from state and gated on the
    grant types they apply to, so inactive/unmounted tabs still contribute. MCP
    clients keep their own McpConnectTab validation and single token view and are
    left unchanged to keep the scope focused.

Note: applications with a user-facing grant but no allowed user type now require one before saving (parity with the agent page). This is a UX validation change, not an API/config breaking change.

Related Issues

Related PRs

Summary by CodeRabbit

Summary

  • New Features
    • Added grant-based locking and read-only gating for user-facing application settings, flows, and token tabs (Application vs User).
    • Introduced client access token claim selection, JWT preview, and validity-period validation guidance.
  • Bug Fixes
    • Improved validation/save behavior for missing redirect URIs and required certificates, with errors suppressed when user-facing config is hidden.
  • Tests
    • Added/updated coverage for lock notices, token settings, redirect URI format validation, and save-state scenarios.
  • Documentation
    • Updated application settings guidance and UI text for the new access/token behavior.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Application and agent edit flows now use shared settings lock notices. Application token settings add grant-aware Application/User tabs and client-token claim configuration, while application pages gate user-facing settings and validate required OAuth configuration before saving.

Changes

Access and token settings

Layer / File(s) Summary
Shared settings lock integration
frontend/apps/console/src/features/applications/components/common/*, frontend/apps/console/src/features/agents/components/edit-agent/{flows,tokens}/*
Renames the shared lock component to SettingsLockNotice and updates its tests and agent settings consumers.
Client access-token configuration
frontend/apps/console/src/features/applications/components/edit-application/token-settings/*, frontend/apps/console/src/features/applications/constants/token-constants.ts, frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
Centralizes optional claims, JWT preview, validity validation, and OAuth2 client configuration updates, then reuses the component for agent tokens.
Grant-aware token tabs
frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx, frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/EditTokenSettingsTabs.test.tsx
Adds Application and User token tabs with grant-based locking, read-only behavior, and validation propagation.
Application access gating and validation
frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx, frontend/apps/console/src/features/applications/components/edit-application/general-settings/*, frontend/apps/console/src/features/applications/utils/*, frontend/packages/i18n/src/locales/en-US.ts, docs/content/guides/applications/application-settings.mdx
Adds grant helpers, shared redirect URI validation, hides user-access fields when unavailable, locks Flows and Customization settings, updates guidance, and blocks saving when required OAuth configuration is missing.

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

Sequence Diagram(s)

sequenceDiagram
  participant ApplicationEditPage
  participant oauth2Rules
  participant EditTokenSettingsTabs
  participant SettingsLockNotice
  participant ClientAccessTokenSection
  ApplicationEditPage->>oauth2Rules: evaluate OAuth2 grant types
  ApplicationEditPage->>EditTokenSettingsTabs: pass OAuth2 configuration
  EditTokenSettingsTabs->>SettingsLockNotice: pass tab lock state and message
  EditTokenSettingsTabs->>ClientAccessTokenSection: render client-token settings
  ClientAccessTokenSection->>ApplicationEditPage: report token changes and validation
Loading

Possibly related PRs

Suggested reviewers: donomalvindula, brionmario, jeradrutnam

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.92% 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 clearly matches the main change: adding Application/User sub-tabs to the application token tab.
Description check ✅ Passed The description covers purpose, approach, related issues, and related PRs, but it omits the checklist and security sections.
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

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.

docs/content/guides/applications/application-settings.mdx

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/agents/components/edit-agent/flows/EditFlowsSettings.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/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx

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

  • 18 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.

@Dilusha-Madushan

Copy link
Copy Markdown
Contributor Author

Here is the new app token config section:
image

@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/applications/components/edit-application/general-settings/AccessSection.tsx`:
- Around line 324-361: Update the user-access validation flow associated with
showUserAccessConfig so uriErrors and postLogoutUriErrors are cleared or
excluded whenever user access is disabled. Ensure the validation callback and
save-state logic no longer report errors from hidden, no-longer-applicable URI
fields, including the related section around the additional marked lines.

In
`@frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx`:
- Around line 238-246: Update the redirect validation in ApplicationEditPage’s
hasValidRedirectUri calculation to reuse the shared wildcard-aware URI-format
check used by AccessSection, rather than calling new URL(uri) directly. Preserve
trimming, invalid-URI rejection, and the existing isMissingRedirectUri behavior.
🪄 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: 5b599a6f-f3b3-4f3f-8ca3-2f1d82b2e6bc

📥 Commits

Reviewing files that changed from the base of the PR and between 7461821 and cb5e7a5.

📒 Files selected for processing (18)
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/components/common/__tests__/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/__tests__/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/pages/__tests__/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/applications/utils/__tests__/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/packages/i18n/src/locales/en-US.ts

Comment thread frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx Outdated
Comment thread frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx Outdated
@Dilusha-Madushan
Dilusha-Madushan force-pushed the feature/app-edit-token-grant-parity branch from cb5e7a5 to b3dc7a3 Compare July 24, 2026 17:11
@rajithacharith rajithacharith added the trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes label Jul 24, 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: 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
`@frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx`:
- Around line 146-152: Add fallback default strings to every listed t() call in
AccessSection, including those in validateUri and the other referenced
validation, label, and message paths. Use the corresponding English/user-facing
text as each call’s default while preserving the existing translation keys and
behavior.
🪄 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: 606ea60c-9d1d-46a5-9e56-25b6c72a047b

📥 Commits

Reviewing files that changed from the base of the PR and between cb5e7a5 and b3dc7a3.

📒 Files selected for processing (20)
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/components/common/__tests__/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/__tests__/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/pages/__tests__/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/applications/utils/__tests__/isValidRedirectUriFormat.test.ts
  • frontend/apps/console/src/features/applications/utils/__tests__/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/utils/isValidRedirectUriFormat.ts
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/packages/i18n/src/locales/en-US.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/tests/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/utils/tests/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/components/common/tests/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/pages/tests/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.19277% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...cation/token-settings/ClientAccessTokenSection.tsx 97.05% 2 Missing ⚠️
...eatures/applications/pages/ApplicationEditPage.tsx 93.75% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

JayaShakthi97
JayaShakthi97 previously approved these changes Jul 24, 2026
@brionmario

Copy link
Copy Markdown
Member

Here is the new app token config section: image

Lets do another UI iteration to get rid of the nested tabs. We can merge this for now.

@Dilusha-Madushan

Copy link
Copy Markdown
Contributor Author

Here is the new app token config section:

Lets do another UI iteration to get rid of the nested tabs. We can merge this for now.

Here is the new app token config section: image

Lets do another UI iteration to get rid of the nested tabs. We can merge this for now.

Here is the finalized new design:

image

cc: @brionmario

@coderabbitai create new git issue to track this (add the new UI design preview in the issue description)

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="thunder-id/thunderid"
pr_url="https://github.com/thunder-id/thunderid/pull/4333"
preview_url="https://github.com/user-attachments/assets/2598c8c0-b959-45df-911d-1dad8671520b"

body="$(cat <<EOF
## Summary

Replace the nested **Application** and **User** token-settings tabs with the finalized audience-selector design.

## Rationale

The current nested tabs add unnecessary navigation within the Application edit page. The finalized design keeps the top-level **Token** tab and presents the token audience through a compact left-side selector.

## Scope

- Update the Application edit Token settings UI to use a left-side audience selector for **Application** and **User**.
- Preserve independent token-claim configuration and validity settings for each audience.
- Keep the Application audience claims configuration and decoded JWT payload preview accessible.
- Maintain the existing grant-type locking behavior and read-only states.
- Update affected UI tests and documentation as needed.

## Design preview

![Finalized token settings UI design](${preview_url})

## Acceptance criteria

- [ ] The Token page no longer contains nested Application/User tabs.
- [ ] Application and User audiences can be selected from the new side navigation.
- [ ] The selected audience clearly indicates its purpose and preserves the existing configuration behavior.
- [ ] Existing grant-based locks, validation, and read-only behavior continue to work.
- [ ] Relevant automated tests are updated or added.

## References

- Originating pull request: ${pr_url}
- Requested by: `@Dilusha-Madushan`
EOF
)"

issue_url="$(gh issue create \
  --repo "$repo" \
  --title "Redesign application token settings to replace nested audience tabs" \
  --body "$body" \
  --assignee "Dilusha-Madushan")"

echo "Created issue: $issue_url"

Length of output: 2049


The Comment image shows the finalized Token settings design with a left-side Application/User audience selector, an Access token claims panel, selectable claims, and a decoded payload preview.

@Dilusha-Madushan, created follow-up issue #4357 to track this UI iteration. It includes the finalized design preview, scope, acceptance criteria, and a backlink to PR #4333.

@Dilusha-Madushan
Dilusha-Madushan force-pushed the feature/app-edit-token-grant-parity branch from 80d3bec to 6940ea1 Compare July 27, 2026 03:03

@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

🧹 Nitpick comments (2)
frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx (2)

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

Cross-feature deep relative import into applications internals.

AgentAccessTokenSection now reaches four levels up into the applications feature for ClientAccessTokenSection and TokenConstants. Since this component is genuinely shared between agents and applications, consider promoting it (and the constants) to a shared location (e.g. a common components/constants module or a package) so the feature boundary isn't inverted.

🤖 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/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`
around lines 22 - 23, Promote ClientAccessTokenSection and TokenConstants from
the applications feature into an appropriate shared components/constants
location, then update AgentAccessTokenSection and existing application consumers
to import them from that shared module. Remove the deep relative imports into
applications internals while preserving the current behavior and public
interfaces.

63-65: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Avoid converting the inbound auth config type through unknown.

AgentInboundAuthConfig and InboundAuthConfig already represent the same OAuth2 inbound shape, so preserve type safety by reusing a shared inbound auth config type instead of casting through unknown as InboundAuthConfig[]. This keeps future model drift from bypassing edit-state type checks.

🤖 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/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`
around lines 63 - 65, Update the inboundAuthConfig declaration in
AgentAccessTokenSection to use the shared inbound auth configuration type
directly, removing the unknown-to-InboundAuthConfig[] cast. Preserve the
existing editedAgent fallback to agent and then an empty array while retaining
type-safe edit-state checks.
🤖 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/applications/pages/ApplicationEditPage.tsx`:
- Around line 226-227: Update the userAccessUnlocked calculation in
ApplicationEditPage to call hasUserAccess with the optional
oauth2Config?.grantTypes directly, removing the !oauth2Config fallback. Preserve
the existing userGatedApplication behavior so applications without OAuth2
configuration remain read-only.
- Around line 255-256: Update the unsavedChangesMessage expression in
ApplicationEditPage to pass the required fallback default string to the t call
for applications:edit.page.unsavedChanges, while preserving the existing
validationIssues.join(' ') behavior.

---

Nitpick comments:
In
`@frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`:
- Around line 22-23: Promote ClientAccessTokenSection and TokenConstants from
the applications feature into an appropriate shared components/constants
location, then update AgentAccessTokenSection and existing application consumers
to import them from that shared module. Remove the deep relative imports into
applications internals while preserving the current behavior and public
interfaces.
- Around line 63-65: Update the inboundAuthConfig declaration in
AgentAccessTokenSection to use the shared inbound auth configuration type
directly, removing the unknown-to-InboundAuthConfig[] cast. Preserve the
existing editedAgent fallback to agent and then an empty array while retaining
type-safe edit-state checks.
🪄 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: d8c2bc68-e87c-451a-a247-33695cf9b7a1

📥 Commits

Reviewing files that changed from the base of the PR and between 80d3bec and 6940ea1.

📒 Files selected for processing (20)
  • docs/content/guides/applications/application-settings.mdx
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/components/common/__tests__/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/__tests__/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/pages/__tests__/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/applications/utils/__tests__/isValidRedirectUriFormat.test.ts
  • frontend/apps/console/src/features/applications/utils/__tests__/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/utils/isValidRedirectUriFormat.ts
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
🚧 Files skipped from review as they are similar to previous changes (18)
  • frontend/apps/console/src/features/applications/utils/tests/isValidRedirectUriFormat.test.ts
  • frontend/apps/console/src/features/applications/components/common/tests/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/utils/isValidRedirectUriFormat.ts
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/tests/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • docs/content/guides/applications/application-settings.mdx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/tests/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx
  • frontend/apps/console/src/features/applications/utils/tests/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/tests/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/pages/tests/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx

Comment on lines +226 to +227
const userAccessUnlocked = !oauth2Config || hasUserAccess(oauth2Config.grantTypes);
const userGatedApplication = userAccessUnlocked ? application : {...application, isReadOnly: true};

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 | ⚡ Quick win

Lock applications with no OAuth2 configuration.

hasUserAccess(undefined) is false, but !oauth2Config makes these applications unlocked. This exposes user-only Access, Flows, and Customization settings without any user-facing grant, unlike the Token tab’s lock behavior. Use hasUserAccess(oauth2Config?.grantTypes) directly.

🤖 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/applications/pages/ApplicationEditPage.tsx`
around lines 226 - 227, Update the userAccessUnlocked calculation in
ApplicationEditPage to call hasUserAccess with the optional
oauth2Config?.grantTypes directly, removing the !oauth2Config fallback. Preserve
the existing userGatedApplication behavior so applications without OAuth2
configuration remain read-only.

Comment on lines +255 to +256
const unsavedChangesMessage =
validationIssues.length > 0 ? validationIssues.join(' ') : t('applications:edit.page.unsavedChanges');

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 | 🟡 Minor | ⚡ Quick win

Add the required translation fallback.

The new t() call has no default string.

Proposed fix
-    validationIssues.length > 0 ? validationIssues.join(' ') : t('applications:edit.page.unsavedChanges');
+    validationIssues.length > 0
+      ? validationIssues.join(' ')
+      : t('applications:edit.page.unsavedChanges', 'You have unsaved changes.');

As per coding guidelines, “Every t('key') call must provide a fallback default string.”

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const unsavedChangesMessage =
validationIssues.length > 0 ? validationIssues.join(' ') : t('applications:edit.page.unsavedChanges');
const unsavedChangesMessage =
validationIssues.length > 0
? validationIssues.join(' ')
: t('applications:edit.page.unsavedChanges', 'You have unsaved changes.');
🤖 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/applications/pages/ApplicationEditPage.tsx`
around lines 255 - 256, Update the unsavedChangesMessage expression in
ApplicationEditPage to pass the required fallback default string to the t call
for applications:edit.page.unsavedChanges, while preserving the existing
validationIssues.join(' ') behavior.

Source: Coding guidelines

@rajithacharith rajithacharith added Type/Improvement trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes and removed 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
@rajithacharith

Copy link
Copy Markdown
Contributor

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai fix-ci to automatically fix failing CI checks by creating a stacked PR with fixes.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@rajithacharith

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

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

♻️ Duplicate comments (2)
frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx (2)

255-256: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Unresolved from a prior review round: missing t() fallback.

t('applications:edit.page.unsavedChanges') still has no default string, so an incomplete locale would show the raw key. This is the same gap flagged previously in this file with no visible fix.

💚 Proposed fix
   const unsavedChangesMessage =
-    validationIssues.length > 0 ? validationIssues.join(' ') : t('applications:edit.page.unsavedChanges');
+    validationIssues.length > 0
+      ? validationIssues.join(' ')
+      : t('applications:edit.page.unsavedChanges', 'You have unsaved changes.');
As per coding guidelines, "Every `t('key')` call must provide a fallback default string."
🤖 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/applications/pages/ApplicationEditPage.tsx`
around lines 255 - 256, Update the fallback branch in the unsavedChangesMessage
construction to pass the English default text to t() for
applications:edit.page.unsavedChanges, ensuring incomplete locales display the
message instead of the translation key. Preserve the validationIssues.join(' ')
behavior when issues exist.

Source: Coding guidelines


226-227: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Unresolved from a prior review round: no-OAuth2 apps bypass the user-access lock.

This exact pattern was previously flagged as a major issue: hasUserAccess(undefined) is false, but the !oauth2Config || short-circuit unlocks Flows/Customization/Access for applications with no OAuth2 config at all, regardless of whether they actually support any user-facing grant. No fix or dismissal is visible for this thread (unlike the other two threads in this file, which show "✅ Addressed").

That said, EditGeneralSettings.tsx's isFlowNativeClient comment ("embedded apps with no OAuth profile") suggests some apps intentionally have no oauth2Config yet still rely on Flows/Customization via the Flow Execution API — so blindly switching to hasUserAccess(oauth2Config?.grantTypes) (the originally suggested fix) could lock those apps out incorrectly. Please confirm the intended behavior for no-OAuth2-config apps before resolving this.

#!/bin/bash
set -euo pipefail
rg -n -C6 'isFlowNativeClient|embedded app|no OAuth profile|Flow Secret' frontend/apps/console/src/features/applications
🤖 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/applications/pages/ApplicationEditPage.tsx`
around lines 226 - 227, The no-oauth2 branch in the user-access gating logic is
ambiguous and must not unlock applications by default. Inspect the existing
`isFlowNativeClient` behavior and related Flow Execution API handling, then
update `userAccessUnlocked` so no-`oauth2Config` applications follow the
established intended access policy: preserve access for supported
embedded/Flow-native apps while locking other apps, and keep OAuth2 grant checks
unchanged.
🤖 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.

Duplicate comments:
In
`@frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx`:
- Around line 255-256: Update the fallback branch in the unsavedChangesMessage
construction to pass the English default text to t() for
applications:edit.page.unsavedChanges, ensuring incomplete locales display the
message instead of the translation key. Preserve the validationIssues.join(' ')
behavior when issues exist.
- Around line 226-227: The no-oauth2 branch in the user-access gating logic is
ambiguous and must not unlock applications by default. Inspect the existing
`isFlowNativeClient` behavior and related Flow Execution API handling, then
update `userAccessUnlocked` so no-`oauth2Config` applications follow the
established intended access policy: preserve access for supported
embedded/Flow-native apps while locking other apps, and keep OAuth2 grant checks
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b97d3b5-6d79-4c36-8c40-a1383952e6fd

📥 Commits

Reviewing files that changed from the base of the PR and between d155167 and 6940ea1.

📒 Files selected for processing (21)
  • docs/content/guides/applications/application-settings.mdx
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/components/common/__tests__/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/__tests__/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/pages/__tests__/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/applications/utils/__tests__/isValidRedirectUriFormat.test.ts
  • frontend/apps/console/src/features/applications/utils/__tests__/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/utils/isValidRedirectUriFormat.ts
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/packages/i18n/src/locales/en-US.ts

@Dilusha-Madushan
Dilusha-Madushan force-pushed the feature/app-edit-token-grant-parity branch from 6940ea1 to 2dec469 Compare July 27, 2026 09:02

@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

🧹 Nitpick comments (1)
frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx (1)

63-65: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Use AgentInboundAuthConfig for AgentAccessTokenSection's inbound config typing

AgentInboundAuthConfig explicitly matches InboundAuthConfig for the OAuth2 entry, so there’s no real shape divergence to suppress with as unknown as InboundAuthConfig[]. Type the fallback list as AgentInboundAuthConfig[] and either omit the cast here or make the cast explicit.

🤖 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/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`
around lines 63 - 65, Update the inboundAuthConfig fallback in
AgentAccessTokenSection to use AgentInboundAuthConfig[] instead of casting
through unknown to InboundAuthConfig[]. Remove the unnecessary cast when the
values already have the expected type, or use a direct explicit cast to
AgentInboundAuthConfig[] if required by the existing types.
🤖 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/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`:
- Around line 20-25: Update the AgentEditPage lazy route in App.tsx to await the
monaco-setup import before importing AgentEditPage, preserving the existing lazy
loading behavior while gating Monaco-dependent code behind initialization.

---

Nitpick comments:
In
`@frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`:
- Around line 63-65: Update the inboundAuthConfig fallback in
AgentAccessTokenSection to use AgentInboundAuthConfig[] instead of casting
through unknown to InboundAuthConfig[]. Remove the unnecessary cast when the
values already have the expected type, or use a direct explicit cast to
AgentInboundAuthConfig[] if required by the existing types.
🪄 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: 14526752-ce0c-447c-becd-153d69aaeaff

📥 Commits

Reviewing files that changed from the base of the PR and between 6940ea1 and 2dec469.

📒 Files selected for processing (21)
  • docs/content/guides/applications/application-settings.mdx
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/components/common/__tests__/SettingsLockNotice.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/__tests__/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/__tests__/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/pages/__tests__/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/applications/utils/__tests__/isValidRedirectUriFormat.test.ts
  • frontend/apps/console/src/features/applications/utils/__tests__/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/utils/isValidRedirectUriFormat.ts
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/packages/i18n/src/locales/en-US.ts
🚧 Files skipped from review as they are similar to previous changes (18)
  • frontend/apps/console/src/features/applications/constants/token-constants.ts
  • frontend/apps/console/src/features/applications/utils/isValidRedirectUriFormat.ts
  • frontend/apps/console/src/features/applications/utils/oauth2Rules.ts
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/tests/ClientAccessTokenSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/EditGeneralSettings.tsx
  • frontend/apps/console/src/features/applications/pages/ApplicationEditPage.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/tests/EditTokenSettingsTabs.test.tsx
  • frontend/apps/console/src/features/applications/utils/tests/oauth2Rules.test.ts
  • frontend/apps/console/src/features/applications/components/common/SettingsLockNotice.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/ClientAccessTokenSection.tsx
  • frontend/packages/i18n/src/locales/en-US.ts
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/tests/AccessSection.test.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/token-settings/EditTokenSettingsTabs.tsx
  • frontend/apps/console/src/features/applications/pages/tests/ApplicationEditPage.test.tsx
  • frontend/apps/console/src/features/agents/components/edit-agent/flows/EditFlowsSettings.tsx
  • docs/content/guides/applications/application-settings.mdx
  • frontend/apps/console/src/features/agents/components/edit-agent/tokens/EditTokensSettings.tsx
  • frontend/apps/console/src/features/applications/components/edit-application/general-settings/AccessSection.tsx

Comment on lines +20 to +25
import {type JSX} from 'react';
import {useTranslation} from 'react-i18next';
import JwtPreview from '../../../../applications/components/edit-application/token-settings/JwtPreview';
import ClientAccessTokenSection from '../../../../applications/components/edit-application/token-settings/ClientAccessTokenSection';
import TokenConstants from '../../../../applications/constants/token-constants';
import type {OAuth2Config} from '../../../../applications/models/oauth';
import type {Agent, AgentInboundAuthConfig, OAuthAgentConfig} from '../../../models/agent';
import type {InboundAuthConfig} from '../../../../applications/models/inbound-auth';
import type {Agent, OAuthAgentConfig} from '../../../models/agent';

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate the app router and inspect lazy imports for agent/application edit pages
fd -t f 'App.tsx' frontend/apps/console/src | xargs -r rg -n -C2 'lazy\(\s*\(\)\s*=>'
# Confirm monaco-setup exists and where it is chained
fd -t f 'monaco-setup*' frontend/apps/console/src
rg -n 'monaco-setup' frontend/apps/console/src

Repository: thunder-id/thunderid

Length of output: 7944


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== AgentAccessTokenSection =="
fd -t f 'AgentAccessTokenSection.tsx' frontend/apps/console/src | while read -r f; do
  echo "-- $f --"
  cat -n "$f"
done

echo
echo "== JwtPreview references =="
rg -n "function JwtPreview|const JwtPreview|class JwtPreview|JwtPreview|monaco" frontend/apps/console/src -g '*.{ts,tsx}' | head -200

echo
echo "== Edit agent page =="
fd -t f 'AgentEditPage.tsx' frontend/apps/console/src | while read -r f; do
  echo "-- $f --"
  rg -n "AgentAccessTokenSection|accessToken|AgentAccessToken" "$f" -C 4
done

Repository: thunder-id/thunderid

Length of output: 21007


Gate the agent edit lazy import behind monaco-setup.

AgentEditPage includes AgentAccessTokenSection, which branches through ClientAccessTokenSection into JwtPreview and Monaco. Update the router path in frontend/apps/console/src/App.tsx:

const AgentEditPage = lazy(() =>
  import('./lib/monaco-setup').then(() => import('./features/agents/pages/AgentEditPage')),
);

This keeps Monaco offline / strict-CSP safe when the agent edit route is loaded.

🤖 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/agents/components/edit-agent/tokens/AgentAccessTokenSection.tsx`
around lines 20 - 25, Update the AgentEditPage lazy route in App.tsx to await
the monaco-setup import before importing AgentEditPage, preserving the existing
lazy loading behavior while gating Monaco-dependent code behind initialization.

Sources: Path instructions, Learnings

@brionmario

Copy link
Copy Markdown
Member

Here is the new app token config section:

Lets do another UI iteration to get rid of the nested tabs. We can merge this for now.

Here is the new app token config section: image

Lets do another UI iteration to get rid of the nested tabs. We can merge this for now.

Here is the finalized new design:

image cc: @brionmario

@coderabbitai create new git issue to track this (add the new UI design preview in the issue description)

+1 Lets implement this in a follow up PR.

@brionmario
brionmario added this pull request to the merge queue Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@brionmario, the Comment image shows the finalized Token settings layout: a left-side audience selector with Application selected and User beneath it; the main panel contains Access token claims, selectable claims (groups, ouHandle, ouId, ouName, roles), and a dark Decoded payload preview JSON panel.

Agreed—this is tracked in #4357 and can be delivered in a follow-up PR, replacing the nested tabs while preserving the existing claims, validity, grant-locking, validation, and read-only behavior.

🐇✨


✏️ Learnings added
Learnt from: brionmario
URL: https://github.com/thunder-id/thunderid/pull/4333

Timestamp: 2026-07-27T10:27:05.435Z
Learning: For the Application edit Token settings UI, replace nested Application/User tabs with the finalized left-side audience selector design in a follow-up PR tracked by GitHub issue `#4357`. Preserve the existing audience-specific token configuration, grant-based locks, validation, and read-only behavior.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Merged via the queue into thunder-id:main with commit b71ad8a Jul 27, 2026
24 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.

4 participants