Skip to content

chore: Disable default fallback when the form login enabled is null for org config #40304

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 17, 2025

Conversation

abhvsn
Copy link
Contributor

@abhvsn abhvsn commented Apr 17, 2025

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

/test Settings

🔍 Cypress test results

Tip

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


Thu, 17 Apr 2025 11:55:36 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of the form login configuration fallback behavior for organizations.
  • Tests
    • Temporarily disabled a test related to form login configuration updates.

Copy link
Contributor

coderabbitai bot commented Apr 17, 2025

Walkthrough

This change updates the logic in the copyNonSensitiveValues method of the OrganizationConfigurationCE class, specifically altering how the isFormLoginEnabled property is assigned. The update removes a custom helper method and replaces it with a standard null-check utility. Additionally, a related test in OrganizationServiceCETest is now disabled and marked with a TODO for future fixing due to a side-effect related to the default fallback logic.

Changes

File(s) Change Summary
.../domains/ce/OrganizationConfigurationCE.java Replaced the assignment of isFormLoginEnabled in copyNonSensitiveValues to use ObjectUtils.defaultIfNull instead of a custom helper.
.../services/ce/OrganizationServiceCETest.java Disabled the test updateOrganizationConfiguration_updateFormLoginEnabled_success and added a TODO comment.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant OrganizationConfigurationCE

    Caller->>OrganizationConfigurationCE: copyNonSensitiveValues(updatedConfig)
    OrganizationConfigurationCE->>OrganizationConfigurationCE: isFormLoginEnabled = defaultIfNull(updatedConfig.isFormLoginEnabled, this.isFormLoginEnabled)
    Note right of OrganizationConfigurationCE: No custom helper logic, only defaultIfNull
    OrganizationConfigurationCE-->>Caller: updated OrganizationConfigurationCE
Loading

Possibly related PRs

  • appsmithorg/appsmith#40154: Modifies the same logic in OrganizationConfigurationCE.java, specifically concerning the assignment of isFormLoginEnabled.

Suggested labels

skip-changelog, ok-to-test

Suggested reviewers

  • NilanshBansal

Poem

Logic swapped with a gentle sweep,
Custom helpers now asleep.
Nulls checked with simple grace,
Default values in their place.
A test on pause, it takes a rest—
Soon to return, at its best!
🛠️✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ 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 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.

@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 17, 2025
@abhvsn abhvsn added the ok-to-test Required label for CI label Apr 17, 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: 1

🧹 Nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/OrganizationConfigurationCE.java (1)

96-101: Consider removing unused helper method

The getComputedValue method is no longer used for isFormLoginEnabled and might be unused elsewhere. If this method is no longer needed, consider removing it to reduce maintenance overhead.

#!/bin/bash
# Check if the getComputedValue method is still being used in the codebase

echo "Searching for usages of getComputedValue method in the codebase:"
rg "getComputedValue\(" --type java
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 14c7a41 and 86104a1.

📒 Files selected for processing (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/OrganizationConfigurationCE.java (1 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/OrganizationServiceCETest.java (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/OrganizationConfigurationCE.java (1)
app/client/src/ce/selectors/organizationSelectors.tsx (1)
  • getIsFormLoginEnabled (48-49)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • 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: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (2)
app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/OrganizationServiceCETest.java (2)

176-179: Appropriate disabling of test due to behavior change

Good call on disabling the test with a clear TODO comment explaining why. The behavior change in copyNonSensitiveValues (removing default fallback to true) causes side effects that need to be addressed.

In the future, update the test to account for the new behavior without relying on the removed fallback mechanism.


182-189: Test assumes form login is enabled by default

This part of the test assumes form login is enabled by default. With the behavior change in copyNonSensitiveValues, this assumption may no longer be valid when using a fresh organization configuration.

When fixing the test, verify if this assertion should be modified to check for null or if the test setup should explicitly enable form login.

Comment on lines 83 to +84
isFormLoginEnabled =
getComputedValue(true, organizationConfiguration.getIsFormLoginEnabled(), isFormLoginEnabled);
ObjectUtils.defaultIfNull(organizationConfiguration.getIsFormLoginEnabled(), isFormLoginEnabled);
Copy link
Contributor

@coderabbitai coderabbitai bot Apr 17, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Removed default fallback behavior for form login

The change removes the usage of the custom getComputedValue helper method which would default to true when both current and updated values were null. Now using ObjectUtils.defaultIfNull directly, which simply returns the current value if the updated value is null, without providing a fallback value.

This change aligns with the PR objective but affects the behavior when both values are null.


🏁 Script executed:

#!/bin/bash
# Check where the getComputedValue method is still being used in the codebase

echo "Searching for usages of getComputedValue method in the codebase:"
rg "getComputedValue\(" --type java

Length of output: 375


Review: Updated Fallback Logic for Form Login

The change replaces the custom getComputedValue helper with ObjectUtils.defaultIfNull, which means when both organizationConfiguration.getIsFormLoginEnabled() and the current isFormLoginEnabled are null, it will now return the existing isFormLoginEnabled (rather than defaulting to true). Please:

  • Confirm that this revised fallback behavior matches the intended requirements.
  • Remove the now-unused getComputedValue method declaration, as it has no other usages.

Affected file:

  • app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/OrganizationConfigurationCE.java

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm planning to come back to this again as we are seeing some unintended updates because of the fallback.

Copy link
Contributor

Choose a reason for hiding this comment

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

@abhvsn Understood. Changing fallback behavior can sometimes lead to unexpected side effects in different parts of the system. When you're ready to revisit this issue, feel free to tag me, and I'd be happy to help analyze the unintended updates you're seeing.

(_/)
(•ㅅ•)
/ づ~

@abhvsn abhvsn changed the title chore: Remove the enabled fallback when the form login is null for org config chore: Disable default fallback when the form login enabled is null for org config Apr 17, 2025
@abhvsn abhvsn requested a review from nidhi-nair April 17, 2025 11:46
Copy link

Failed server tests

  • com.appsmith.server.helpers.UserUtilsTest#makeInstanceAdministrator_WhenUserAlreadyAdmin_MaintainsPermissionsSuccessfully

@abhvsn abhvsn merged commit 60d5bcd into release Apr 17, 2025
53 checks passed
@abhvsn abhvsn deleted the chore/remove-default-fallback-for-form-login branch April 17, 2025 12:08
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