Skip to content

chore: Hiding git author settings for AI instances #40210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Apr 10, 2025

Description

Hiding git author settings for AI instances as workflows is no longer supported on those instances and so in turn Git is not supported.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Settings"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14375296937
Commit: 4ef0db7
Cypress dashboard.
Tags: @tag.Settings
Spec:


Thu, 10 Apr 2025 08:21:57 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Streamlined the Profile settings by conditionally displaying the Git author section. When AI agent functionality is enabled, the Git author inputs and heading are no longer visible, reducing clutter in the interface.

Copy link
Contributor

coderabbitai bot commented Apr 10, 2025

Walkthrough

This update in the AdminSettings Profile introduces a new selector, getIsAiAgentFlowEnabled, to determine if the AI agent flow is active. A state variable, isAIAgentFlowEnabled, is set based on this selector and is used to conditionally render the "Git author" section. If AI agent flow is enabled, the section is hidden; otherwise, it is displayed.

Changes

Files Change Summary
app/client/.../Profile/index.tsx Added getIsAiAgentFlowEnabled selector and a new state variable isAIAgentFlowEnabled. Wrapped the "Git author" section with a conditional to hide it when AI agent flow is enabled.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ProfileComponent
    participant Selector

    User->>ProfileComponent: Load profile page
    ProfileComponent->>Selector: getIsAiAgentFlowEnabled()
    Selector-->>ProfileComponent: Return AI agent flow state (boolean)
    ProfileComponent->>ProfileComponent: Conditionally render "Git author" section
Loading

Possibly related PRs

Suggested labels

skip-changelog, ok-to-test

Suggested reviewers

  • albinAppsmith

Poem

In a world of code so bright,
A new selector takes flight.
The Git author's hidden with care,
As AI flows through the air.
Let our code sail with delight!
🚀✨ Enjoy the magic in every commit!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR 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 summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ankitakinger ankitakinger added the ok-to-test Required label for CI label Apr 10, 2025
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Apr 10, 2025
Copy link
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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
app/client/src/pages/AdminSettings/Profile/index.tsx (2)

280-322: Consider refactoring conditional rendering.

The Git author section uses two separate conditionals for the heading and form fields. Consider wrapping both in a single conditional to improve code maintainability.

-{!isAIAgentFlowEnabled && (
-  <SubCategory kind="heading-s" renderAs="p">
-    Git author
-  </SubCategory>
-)}
-{!isAIAgentFlowEnabled && (
-  <Flex flexDirection="column" gap="spaces-5">
-    <FieldWrapper>
-      {isFetching && <Loader className={Classes.SKELETON} />}
-      {!isFetching && (
-        <Input
-          data-testid="t--git-author-name"
-          isRequired
-          label={createMessage(AUTHOR_NAME)}
-          labelPosition="top"
-          onChange={setAuthorNameInState}
-          placeholder={createMessage(AUTHOR_NAME)}
-          renderAs="input"
-          size="md"
-          type="text"
-          value={authorName}
-        />
-      )}
-    </FieldWrapper>
-    <FieldWrapper>
-      {isFetching && <Loader className={Classes.SKELETON} />}
-      {!isFetching && (
-        <Input
-          data-testid="t--git-author-email"
-          isRequired
-          label={createMessage(AUTHOR_EMAIL)}
-          labelPosition="top"
-          onChange={setAuthorEmailInState}
-          placeholder={createMessage(AUTHOR_EMAIL)}
-          renderAs="input"
-          size="md"
-          type="text"
-          value={authorEmail}
-        />
-      )}
-    </FieldWrapper>
-  </Flex>
-)}
+{!isAIAgentFlowEnabled && (
+  <>
+    <SubCategory kind="heading-s" renderAs="p">
+      Git author
+    </SubCategory>
+    <Flex flexDirection="column" gap="spaces-5">
+      <FieldWrapper>
+        {isFetching && <Loader className={Classes.SKELETON} />}
+        {!isFetching && (
+          <Input
+            data-testid="t--git-author-name"
+            isRequired
+            label={createMessage(AUTHOR_NAME)}
+            labelPosition="top"
+            onChange={setAuthorNameInState}
+            placeholder={createMessage(AUTHOR_NAME)}
+            renderAs="input"
+            size="md"
+            type="text"
+            value={authorName}
+          />
+        )}
+      </FieldWrapper>
+      <FieldWrapper>
+        {isFetching && <Loader className={Classes.SKELETON} />}
+        {!isFetching && (
+          <Input
+            data-testid="t--git-author-email"
+            isRequired
+            label={createMessage(AUTHOR_EMAIL)}
+            labelPosition="top"
+            onChange={setAuthorEmailInState}
+            placeholder={createMessage(AUTHOR_EMAIL)}
+            renderAs="input"
+            size="md"
+            type="text"
+            value={authorEmail}
+          />
+        )}
+      </FieldWrapper>
+    </Flex>
+  </>
+)}

131-146: Consider adding AI agent flow checks in Git author update/save functions.

While the UI elements are hidden, the code still maintains the state for Git author fields and might attempt to update them. Consider adding checks in updateConfig, onSave, and onClear functions to prevent unnecessary Git author operations when dealing with AI agents.

const updateConfig = () => {
+  if (isAIAgentFlowEnabled) return;
  
  if (authorName && authorEmail && emailValidator(authorEmail).isValid) {
    // Existing code
  }
};

const onSave = () => {
  if (user?.name !== name) {
    setIsSaving(true);
    saveName();
  }

+  if (!isAIAgentFlowEnabled && 
    (gitConfig?.authorName !== authorName ||
    gitConfig?.authorEmail !== authorEmail)
  ) {
    setIsSaving(true);
    updateConfig();
  }
};

const onClear = () => {
  setName(user?.name || "");
+  if (!isAIAgentFlowEnabled) {
    setAuthorNameInState(gitConfig?.authorName);
    setAuthorEmailInState(gitConfig?.authorEmail);
+  }
  setAreFormValuesUpdated(false);
};

Also applies to: 180-193, 195-200

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82f061a and 4ef0db7.

📒 Files selected for processing (1)
  • app/client/src/pages/AdminSettings/Profile/index.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (4)
app/client/src/pages/AdminSettings/Profile/index.tsx (4)

53-53: Import for new AI agent flow selector added correctly.

The new import for getIsAiAgentFlowEnabled is appropriately added to determine if the AI agent flow is enabled.


98-98: State variable for AI agent flow correctly implemented.

The selector is properly used to create a state variable that will control the conditional rendering of the Git author section.


280-284: Git author heading is properly hidden for AI agents.

The heading section is correctly wrapped in a conditional that checks isAIAgentFlowEnabled.


285-322: Git author form fields properly hidden for AI agents.

The implementation correctly hides the Git author form fields when an AI agent flow is enabled.

@ankitakinger ankitakinger merged commit d532020 into release Apr 10, 2025
47 checks passed
@ankitakinger ankitakinger deleted the chore/hide-git-author branch April 10, 2025 08:22
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
## Description

Hiding git author settings for AI instances

Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Settings"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14375296937>
> Commit: 4ef0db7
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14375296937&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Settings`
> Spec:
> <hr>Thu, 10 Apr 2025 08:21:57 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Streamlined the Profile settings by conditionally displaying the Git
author section. When AI agent functionality is enabled, the Git author
inputs and heading are no longer visible, reducing clutter in the
interface.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants