Skip to content
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

chore: Google sheet shared drive support added behind a flag #37776

Merged
merged 6 commits into from
Nov 28, 2024

Conversation

sneha122
Copy link
Contributor

@sneha122 sneha122 commented Nov 27, 2024

Description

This PR hides shared drive support for Google Sheets Integration behind a feature flag as we need to do thorough testing for it.

The feature flag implementation done in this PR involves passing feature flags from server to google sheets plugin module. This temporary feature flagging solution tech debt can be removed once the testing is done and once we would release this feature to all.

Why feature flags are only available at server module?
Because they have a dependency on UserIdentifierService, SessionUserService, TenantService etc which exists at server module. Supporting feature flags out of the box at plugin module level would require significant efforts to migrate these dependencies.

Fixes #37714
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.Authentication, @tag.Datasource"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12063930619
Commit: 47f08f9
Cypress dashboard.
Tags: @tag.Authentication, @tag.Datasource
Spec:


Thu, 28 Nov 2024 07:38:58 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced support for Google Sheets shared drive through feature flags.
    • Added new methods to handle feature flags in plugin execution and triggering processes.
    • Enhanced action execution and triggering logic to utilize feature flags for dynamic behavior.
  • Bug Fixes

    • Improved error handling for plugin execution processes.
  • Tests

    • Integrated FeatureFlagService into the testing framework for enhanced test coverage.
    • Expanded test scenarios to include various response types and error conditions.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2024

Walkthrough

The changes in this pull request enhance the Google Sheets integration by introducing feature flag support for shared drive access. Key modifications include renaming and updating methods in the FileListMethod, ExecutionMethod, and TriggerMethod classes to accommodate a new parameter for feature flags. A new feature flag, release_google_sheets_shared_drive_support_enabled, is added to manage shared drive functionality. Additionally, various classes, including PluginTriggerSolutionCEImpl and ActionExecutionSolutionCEImpl, are updated to utilize the FeatureFlagService, allowing for conditional execution based on feature availability.

Changes

File Change Summary
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java Updated getExecutionClient to getExecutionClientWithFlags, added featureFlagMap parameter, and introduced SHARED_DRIVE_PARAMS. Renamed getTriggerClient to getTriggerClientWithFlags.
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/enums/FeatureFlagEnum.java Added new feature flag release_google_sheets_shared_drive_support_enabled.
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java Added three new default methods for executing actions with feature flags: executeParameterizedWithFlags, executeParameterizedWithMetricsAndFlags, and triggerWithFlags.
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ExecutionMethod.java Changed getExecutionClient to a default method returning null and added getExecutionClientWithFlags.
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/TriggerMethod.java Changed getTriggerClient to a default method returning null and added getTriggerClientWithFlags.
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/plugins/GoogleSheetsPlugin.java Renamed executeParameterized to executeParameterizedWithFlags, updated executeCommon, and renamed trigger to triggerWithFlags to include feature flags.
app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java Added FeatureFlagService as a dependency and updated trigger method to utilize feature flags.
app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionImpl.java Updated constructor to include FeatureFlagService.
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ActionExecutionSolutionImpl.java Updated constructor to include FeatureFlagService.
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceTriggerSolutionImpl.java Updated constructor to include FeatureFlagService.
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java Added FeatureFlagService, updated verifyDatasourceAndMakeRequest method to utilize feature flags, and renamed executeParameterizedWithMetrics to executeParameterizedWithMetricsAndFlags.
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java Added FeatureFlagService, updated trigger method to utilize feature flags for triggerWithFlags.
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java Added FeatureFlagService as a @SpyBean and updated the constructor to include it.

Assessment against linked issues

Objective Addressed Explanation
Enable access to Google Sheets shared drive files (Issue #37714)

Possibly related PRs

Suggested labels

Bug, High, Integrations Pod General, Task

Suggested reviewers

  • ApekshaBhosale
  • rishabhrathod01
  • nidhi-nair

In code we trust, with flags we play,
Google Sheets now brightens our day!
Shared drives are here, no need to fear,
With each new method, our goals are clear.
So let’s embrace this change with cheer,
For seamless access, the time is near! 🎉📊


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 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.

@sneha122 sneha122 marked this pull request as draft November 27, 2024 07:29
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Nov 27, 2024
@sneha122
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12045677715.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37776.
recreate: .

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

🧹 Outside diff range and nitpick comments (1)
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (1)

42-45: Consider pagination for large result sets

With the expanded search scope across all drives, the API might return a large number of spreadsheets. Consider implementing pagination to handle large result sets efficiently.

Consider adding a pageSize parameter and handling nextPageToken in the response:

 UriComponentsBuilder uriBuilder = getBaseUriBuilder(
         this.BASE_DRIVE_API_URL,
-        "?includeItemsFromAllDrives=true&supportsAllDrives=true&corpora=allDrives&orderBy=name&q=mimeType%3D'application%2Fvnd.google-apps.spreadsheet'%20and%20trashed%3Dfalse",
+        "?includeItemsFromAllDrives=true&supportsAllDrives=true&corpora=allDrives&orderBy=name&pageSize=100&q=mimeType%3D'application%2Fvnd.google-apps.spreadsheet'%20and%20trashed%3Dfalse",
         true);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 381dcaa and f6c8748.

📒 Files selected for processing (2)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (1 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json (1 hunks)
🔇 Additional comments (2)
app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json (1)

41-52: Well-structured permission levels with clear labeling.

The new permission options follow a clear progression from most restrictive to least restrictive access, with descriptive labels that help users make informed decisions.

app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (1)

43-43: Verify permissions and performance impact of all-drives search

The addition of includeItemsFromAllDrives=true&supportsAllDrives=true&corpora=allDrives significantly expands the search scope. This change:

  1. May require additional Google Workspace API permissions
  2. Could impact response times when dealing with large organizations
  3. Might return more results than before
✅ Verification successful

Change is safe with existing permission model and test coverage

The expanded search scope is already covered by the existing permission model:

  • The form.json shows two permission levels: file-specific and all-sheets access
  • The test suite demonstrates proper handling of both permission scopes through userAuthorizedSheetIds
  • Response transformation is well-tested for both all-sheets and specific-sheets scenarios
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the permissions are properly documented in form.json
rg -A 10 "scope" app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json

# Check if there are any related performance tests
rg -l "FileListMethod" app/server/appsmith-plugins/googleSheetsPlugin/src/test/java

Length of output: 802


Script:

#!/bin/bash
# Check the test file to understand the test coverage for all-drives functionality
cat app/server/appsmith-plugins/googleSheetsPlugin/src/test/java/com/external/config/FileListMethodTest.java

# Check if there are any existing performance-related configurations or timeouts
rg -A 3 "timeout|performance" app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java

Length of output: 10187

Copy link

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

@sneha122 sneha122 added the ok-to-test Required label for CI label Nov 27, 2024
@github-actions github-actions bot added Bug Something isn't working Google Sheets Issues related to Google Sheets Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage Production Query & JS Pod Issues related to the query & JS Pod Release Blocker This issue must be resolved before the release labels Nov 27, 2024
@sneha122 sneha122 marked this pull request as ready for review November 27, 2024 14:46
@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels Nov 27, 2024
@sneha122
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@sneha122 sneha122 requested a review from abhvsn November 27, 2024 14:49
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12052747236.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37776.
recreate: .

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: 4

🧹 Outside diff range and nitpick comments (14)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/enums/FeatureFlagEnum.java (1)

17-17: Add documentation for the feature flag.

Consider adding a brief comment explaining the flag's purpose and its temporary nature. This will help with future maintenance.

+    // Controls access to shared drive functionality in Google Sheets integration
+    // Note: Temporary flag for testing - can be removed once feature is fully tested
     release_google_sheets_shared_drive_support_enabled,
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/TriggerMethod.java (1)

25-27: Consider documenting the default null return

The default implementation returning null is a good backward compatibility approach, but it would be helpful to document why it returns null.

+    /**
+     * Default implementation returns null. Implementations should override this
+     * or use getTriggerClientWithFlags for feature flag support.
+     */
     default WebClient.RequestHeadersSpec<?> getTriggerClient(WebClient webClient, MethodConfig methodConfig) {
         return null;
     }
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (1)

42-51: Consider defining feature flag key as a constant

While the implementation is solid, consider extracting the feature flag key to a constant to prevent typos and enable easier refactoring.

+ private static final String SHARED_DRIVE_FEATURE_FLAG = 
+         FeatureFlagEnum.release_google_sheets_shared_drive_support_enabled.toString();

  Boolean isSharedDriveSupportEnabled = featureFlagMap.getOrDefault(
-         FeatureFlagEnum.release_google_sheets_shared_drive_support_enabled.toString(),
+         SHARED_DRIVE_FEATURE_FLAG,
          Boolean.FALSE);
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ExecutionMethod.java (1)

108-111: Consider adding documentation for feature flags

The new method provides good backward compatibility, but lacks documentation about expected feature flags and their effects.

Add Javadoc explaining:

  • Available feature flags
  • Their impact on execution
  • Example usage
+    /**
+     * Executes the client request with feature flag support.
+     * @param featureFlagMap Map of feature flags including:
+     *                       - release_google_sheets_shared_drive_support_enabled
+     * @return RequestHeadersSpec for the execution
+     */
     default WebClient.RequestHeadersSpec<?> getExecutionClientWithFlags(
             WebClient webClient, MethodConfig methodConfig, Map<String, Boolean> featureFlagMap) {
         return getExecutionClient(webClient, methodConfig);
     }
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (1)

109-111: Track technical debt removal

The comment indicates this is temporary, but there's no tracking mechanism.

Consider adding a TODO with a JIRA/issue reference for removing this feature flag once testing is complete.

-    // Flags are needed here for google sheets integration to support shared drive behind a flag
-    // Once thoroughly tested, this flag can be removed
+    // TODO(ISSUE-XXX): Remove feature flag for Google Sheets shared drive support once testing is complete
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java (1)

Line range hint 1-391: Add test cases for feature flag scenarios

Given that this PR introduces feature flag support for shared drive functionality, we should add test cases to verify the behavior when the feature flag is enabled/disabled.

Consider adding tests like:

@Test
public void testExecuteAction_whenSharedDriveFeatureFlagEnabled_shouldAllowAccess() {
    // Setup
    doReturn(true)
            .when(featureFlagService)
            .isFeatureEnabled(FieldName.GOOGLE_SHEETS_SHARED_DRIVE_SUPPORT);
    
    // Test implementation
}

@Test
public void testExecuteAction_whenSharedDriveFeatureFlagDisabled_shouldRestrictAccess() {
    // Setup
    doReturn(false)
            .when(featureFlagService)
            .isFeatureEnabled(FieldName.GOOGLE_SHEETS_SHARED_DRIVE_SUPPORT);
    
    // Test implementation
}
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java (4)

250-261: Fix typo in documentation

There's a typo in the word "thorogh" which should be "thorough".

-// Once thorogh testing of shared drive support is done, we can remove this tech debt of passing feature flags like
+// Once thorough testing of shared drive support is done, we can remove this tech debt of passing feature flags like

262-269: Consider adding null check for featureFlagMap

The method should handle cases where featureFlagMap is null to prevent potential NullPointerException in implementing classes.

    default Mono<ActionExecutionResult> executeParameterizedWithFlags(
            C connection,
            ExecuteActionDTO executeActionDTO,
            DatasourceConfiguration datasourceConfiguration,
            ActionConfiguration actionConfiguration,
            Map<String, Boolean> featureFlagMap) {
+       if (featureFlagMap == null) {
+           featureFlagMap = Map.of();
+       }
        return this.executeParameterized(connection, executeActionDTO, datasourceConfiguration, actionConfiguration);
    }

285-291: Consider adding null check for featureFlagMap

Similar to executeParameterizedWithFlags, add null safety for the feature flag map.

    default Mono<TriggerResultDTO> triggerWithFlags(
            C connection,
            DatasourceConfiguration datasourceConfiguration,
            TriggerRequestDTO request,
            Map<String, Boolean> featureFlagMap) {
+       if (featureFlagMap == null) {
+           featureFlagMap = Map.of();
+       }
        return this.trigger(connection, datasourceConfiguration, request);
    }

250-291: Technical Debt: Consider timeline for refactoring

While the current implementation is a valid temporary solution, consider creating a timeline for moving the feature flag service to the shared interface module to prevent this pattern from becoming permanent.

app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java (1)

83-84: Consider handling potential exceptions when fetching feature flags

When retrieving feature flags using featureFlagService.getCachedTenantFeatureFlags().getFeatures(), ensure that the service handles any possible exceptions or null values to prevent runtime errors.

app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/plugins/GoogleSheetsPlugin.java (3)

79-84: Add @Override Annotation to executeParameterizedWithFlags Method

Since executeParameterizedWithFlags overrides a method from the PluginExecutor interface, it's good practice to annotate it with @Override to enhance readability and catch potential errors at compile time.

Apply this diff to add the @Override annotation:

+    @Override
     public Mono<ActionExecutionResult> executeParameterizedWithFlags(
         Void connection,
         ExecuteActionDTO executeActionDTO,
         DatasourceConfiguration datasourceConfiguration,
         ActionConfiguration actionConfiguration,
         Map<String, Boolean> featureFlagMap) {

143-144: Add @Override Annotation to executeCommon Method

If executeCommon overrides a method from a superclass or interface, consider adding the @Override annotation for better clarity and error checking.

Apply this diff if applicable:

+    @Override
     public Mono<ActionExecutionResult> executeCommon(
         Void connection,
         DatasourceConfiguration datasourceConfiguration,
         ActionConfiguration actionConfiguration,
         Map<String, Boolean> featureFlagMap) {

324-328: Add @Override Annotation to triggerWithFlags Method

Since triggerWithFlags likely overrides a method from the PluginExecutor interface, adding the @Override annotation improves code clarity and helps prevent mistakes.

Apply this diff to include the @Override annotation:

+    @Override
     public Mono<TriggerResultDTO> triggerWithFlags(
         Void connection,
         DatasourceConfiguration datasourceConfiguration,
         TriggerRequestDTO request,
         Map<String, Boolean> featureFlagMap) {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f6c8748 and 703dce1.

📒 Files selected for processing (13)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/enums/FeatureFlagEnum.java (1 hunks)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java (1 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ExecutionMethod.java (2 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (4 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/TriggerMethod.java (2 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/plugins/GoogleSheetsPlugin.java (5 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java (4 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionImpl.java (2 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ActionExecutionSolutionImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceTriggerSolutionImpl.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (5 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (3 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java (3 hunks)
🔇 Additional comments (23)
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/enums/FeatureFlagEnum.java (1)

17-17: LGTM! Feature flag follows naming conventions and is correctly placed.

The flag is appropriately positioned in the product features section and follows the established naming pattern.

app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionImpl.java (2)

6-6: LGTM! Clean implementation of feature flag service integration.

The addition of FeatureFlagService follows proper dependency injection patterns and maintains consistent code style.

Also applies to: 18-26


20-26: Verify feature flag handling in parent class.

Let's confirm the parent class properly handles the feature flag service for Google Sheets shared drive support.

✅ Verification successful

Let me search for more specific information about the feature flag usage in the parent class.


Let me check one more thing to verify how the feature flags are actually used in the Google Sheets plugin.


Feature flag handling is properly implemented

The parent class PluginTriggerSolutionCEImpl correctly injects and stores the FeatureFlagService. The Google Sheets shared drive feature flag is defined in FeatureFlagEnum and is used appropriately in FileListMethod. The feature flag service is accessible through the inheritance chain.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check parent class implementation for feature flag handling
# Expected: Find feature flag usage in parent class related to Google Sheets

# Search for the parent class implementation
ast-grep --pattern 'class PluginTriggerSolutionCEImpl {
  $$$
}'

# Search for Google Sheets related feature flag usage
rg -A 5 "release_google_sheets_shared_drive_support_enabled" 

Length of output: 1941


Script:

#!/bin/bash
# Search for the parent class implementation and its constructor
ast-grep --pattern 'class PluginTriggerSolutionCEImpl {
  $$$
  PluginTriggerSolutionCEImpl($$$) {
    $$$
  }
  $$$
}'

# Search for methods in parent class that might use feature flags
rg -A 10 "featureFlagService" app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java

Length of output: 2120


Script:

#!/bin/bash
# Search for the complete implementation of FileListMethod to understand feature flag usage
ast-grep --pattern 'class FileListMethod {
  $$$
}'

# Search for any other Google Sheets related feature flag usage
rg -A 5 "googleSheetsPlugin.*FeatureFlagService"

Length of output: 104

app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/TriggerMethod.java (2)

6-7: LGTM: Clean import additions

The new imports for Map and Set are necessary for the feature flag implementation.


29-35: LGTM: Well-designed feature flag integration

The new method follows good interface evolution practices:

  • Maintains backward compatibility
  • Provides sensible default implementation
  • Well-documented
  • Properly typed parameters

Let's verify if all implementations properly override this method:

✅ Verification successful

The previous ast-grep pattern might not have matched due to syntax variations. Let's try using ripgrep to find the implementations of the TriggerMethod interface.


Let's verify if any of the implementations override the default method. This will help us confirm if the interface evolution is being properly handled.


Default implementation is sufficient, no overrides needed

The interface provides a default implementation that delegates to the existing getTriggerClient method, making it backward compatible. Since none of the implementing classes (RowsGetMethod, FileListMethod, GetStructureMethod, FileInfoMethod) override this method, they correctly inherit the default behavior. This is the intended design pattern for interface evolution.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find all implementations of TriggerMethod to ensure they're updated
ast-grep --pattern 'class $_ implements $$$TriggerMethod$$$'

Length of output: 62


Script:

#!/bin/bash
# Let's try a different approach to find implementations
# First, find the interface file
fd "TriggerMethod.java" --type f

# Then use ripgrep to find implementations
rg "implements.*TriggerMethod" --type java -l

Length of output: 587


Script:

#!/bin/bash
# Let's check if any of these implementations override the new method
rg "getTriggerClientWithFlags.*WebClient.*MethodConfig.*featureFlagMap" --type java -A 2 -B 2

Length of output: 95

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/DatasourceTriggerSolutionImpl.java (2)

10-10: LGTM! Clean implementation of feature flag service injection.

The addition of FeatureFlagService follows Spring DI best practices and maintains consistency with existing code structure.

Also applies to: 32-33, 45-46


Line range hint 32-46: Verify feature flag handling in parent class.

Let's ensure the parent class properly utilizes the injected feature flag service.

✅ Verification successful

Let me search for the parent class implementation to verify feature flag usage.


Let me try a different search pattern to find the feature flag usage.


Feature flag service is properly utilized in the parent class

The parent class DatasourceTriggerSolutionCEImpl correctly uses the feature flag service to get tenant features and pass them to the plugin executor during trigger execution. The implementation follows the same pattern as other solution classes like ActionExecutionSolutionCEImpl.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for feature flag usage in the parent class
ast-grep --pattern 'class DatasourceTriggerSolutionCEImpl {
  $$$
  featureFlagService.$$$
  $$$
}'

# Backup: Search using ripgrep if parent class is not in the current state
rg -A 5 "featureFlagService" --type java

Length of output: 63274


Script:

#!/bin/bash
# Search for DatasourceTriggerSolutionCEImpl class implementation
ast-grep --pattern 'class DatasourceTriggerSolutionCEImpl {
  $$$
  featureFlagService.$$$
  $$$
}'

# Search for specific feature flag usage in the parent class
rg -A 5 "DatasourceTriggerSolutionCEImpl.*featureFlagService" --type java

Length of output: 177


Script:

#!/bin/bash
# Search for the parent class implementation and feature flag usage
rg -l "class DatasourceTriggerSolutionCEImpl" --type java | xargs rg -A 10 "featureFlagService"

# Backup: Search for any feature flag usage in datasource trigger related files
rg -A 5 "getCachedTenantFeatureFlags|getTenantFeatures" --type java app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/

Length of output: 3804

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ActionExecutionSolutionImpl.java (2)

16-16: LGTM! Clean implementation of feature flag service.

The addition of FeatureFlagService follows proper dependency injection patterns and maintains consistent parameter ordering.

Also applies to: 46-47, 68-69


46-47: Verify ActionExecutionSolutionImpl instantiation.

Since we've added a new required constructor parameter, we should verify all instantiations of this class are updated.

✅ Verification successful

Constructor change is safe - Spring handles dependency injection

The class is annotated with @Service and is component-scanned via the root @ComponentScan({"com.appsmith"}) configuration. Spring's dependency injection will automatically handle the new constructor parameter, making this change safe.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for ActionExecutionSolutionImpl instantiations
rg -l "new ActionExecutionSolutionImpl\(" | xargs rg -A 10 "new ActionExecutionSolutionImpl\("

# Search for Spring @Autowired usages
ast-grep --pattern 'class $_ {
  $$$
  @Autowired
  $$$ActionExecutionSolutionImpl$$$
  $$$
}'

Length of output: 193


Script:

#!/bin/bash
# Search for ActionExecutionSolutionImpl instantiations with more context
rg "ActionExecutionSolutionImpl" -B 2 -A 2

# Search for Spring configuration files that might wire this bean
fd "configuration" -e java -e xml | xargs rg "ActionExecutionSolutionImpl"

# Search for Spring component scan configurations
fd -e java | xargs rg "@ComponentScan|@Configuration.*ActionExecutionSolution"

# Search for any test configurations
fd "test" -e java | xargs rg "ActionExecutionSolutionImpl"

Length of output: 1351

app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (2)

29-30: LGTM: Well-defined constant for shared drive parameters

The constant effectively encapsulates the query parameters required for shared drive support.


85-87: LGTM: Clean delegation pattern

The trigger client correctly delegates to the execution client, maintaining consistency in feature flag handling.

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (1)

20-20: LGTM: Clean dependency injection setup

The FeatureFlagService integration follows proper dependency injection patterns.

Also applies to: 57-57

app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImplTest.java (2)

27-27: LGTM: FeatureFlagService integration

The addition of FeatureFlagService as a SpyBean is correctly implemented, allowing for proper testing of feature flag behavior.

Also applies to: 140-142


174-175: LGTM: Constructor dependency injection

The featureFlagService is properly injected into the constructor, maintaining consistent ordering with other dependencies.

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java (1)

271-283: LGTM!

The implementation correctly combines metrics observation with feature flags while maintaining the existing metrics pattern.

app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java (2)

39-40: Constructor updated with FeatureFlagService injection


95-96: Verify that PluginExecutor implementations handle null parameters

Passing null for datasourceContext and datasourceConfiguration in triggerWithFlags is acceptable here. Please confirm that all PluginExecutor implementations can handle null values without issues.

app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/plugins/GoogleSheetsPlugin.java (3)

137-137: Code Change Looks Good

Passing featureFlagMap to executeCommon ensures that feature flags are consistently handled throughout the execution flow.


190-190: Ensure Implementation of getExecutionClientWithFlags

Verify that getExecutionClientWithFlags is properly implemented to handle feature flags as intended. This is crucial for the correct functioning of feature flag-dependent logic.


351-351: Validate getTriggerClientWithFlags Method

Ensure that getTriggerClientWithFlags correctly incorporates feature flags and that its behavior aligns with the expected functionality, especially regarding shared drive support.

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (3)

48-48: Properly imported and declared FeatureFlagService.

The FeatureFlagService is correctly imported and declared as a final class member for dependency injection.

Also applies to: 126-126


Line range hint 155-177: Constructor updated to include FeatureFlagService.

The constructor parameters and assignment correctly include the new FeatureFlagService dependency.


Line range hint 733-749: Ensure all PluginExecutor implementations support the new method.

Since the new method executeParameterizedWithMetricsAndFlags is introduced, all implementations of the PluginExecutor interface need to be updated to include this method to prevent potential runtime issues.

Run the following script to verify that all implementations of PluginExecutor have the new method:

Copy link

Failed server tests

  • com.external.plugins.GraphQLPluginTest#
  • com.external.plugins.SnowflakePluginTest#
  • com.external.plugins.SmtpPluginTest#
  • com.external.plugins.VisionCommandTest#
  • com.external.plugins.EmbeddingCommandTest#
  • com.external.plugins.ChatCommandTest#
  • com.external.plugins.OpenAIPluginTest#
  • com.external.plugins.AnthropicPluginTest#
  • com.external.plugins.GoogleAiPluginTest#
  • com.external.plugins.GenerateContentCommandTest#
  • com.external.plugins.services.FieldValidationHelperTest#
  • com.external.plugins.services.features.ImageClassificationServiceImplTest#
  • com.external.plugins.services.features.TextEntityExtractionServiceImplTest#
  • com.external.plugins.services.features.TextSummarizationServiceImplTest#
  • com.external.plugins.services.features.ImageCaptioningServiceImplTest#
  • com.external.plugins.services.features.TextGenerationServiceImplTest#
  • com.external.plugins.services.features.TextClassificationServiceImplTest#
  • com.external.plugins.services.features.ImageEntityExtractionServiceImplTest#
  • com.external.plugins.services.HeadersUtilTest#
  • com.external.plugins.services.AiFeatureServiceFactoryTest#
  • com.external.plugins.AwsLambdaPluginTest#
  • com.external.plugins.DatabricksPluginTest#
  • com.appsmith.git.converters.GsonDoubleToLongConverterTest#
  • com.appsmith.git.helpers.DSLTransformerHelperTest#
  • com.appsmith.git.helpers.FileUtilsImplTest#
  • GsonUnorderedToOrderedSerializationTest#
  • com.external.config.RowsUpdateMethodTest#testRowUpdateMethodWithEmptyBody

@sneha122
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12063169922.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 37776.
recreate: .

@github-actions github-actions bot removed the Bug Something isn't working label Nov 28, 2024
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

🧹 Outside diff range and nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (1)

110-114: Consider using Optional for cleaner null handling

The null check could be more elegant using Optional.

-    Map<String, Boolean> featureFlagMap = featureFlagService.getCachedTenantFeatureFlags() != null
-            ? featureFlagService.getCachedTenantFeatureFlags().getFeatures()
-            : Collections.emptyMap();
+    Map<String, Boolean> featureFlagMap = Optional.ofNullable(featureFlagService.getCachedTenantFeatureFlags())
+            .map(flags -> flags.getFeatures())
+            .orElse(Collections.emptyMap());
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 20a1754 and b5c702f.

📒 Files selected for processing (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (6 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (4 hunks)
🔇 Additional comments (5)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (3)

20-20: LGTM: Clean dependency injection

The FeatureFlagService integration follows proper dependency injection patterns.

Also applies to: 58-58


110-114: Consider using reactive feature flag retrieval

The synchronous getCachedTenantFeatureFlags() call could impact performance in this reactive flow.


123-127: Add error handling for feature flags

The feature flag integration still lacks error handling.

app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (2)

48-48: LGTM: Clean dependency injection implementation

The FeatureFlagService integration follows the standard dependency injection pattern.

Also applies to: 127-127, 156-157, 178-178


734-747: Track technical debt: Feature flag for Google Sheets shared drive

The comment indicates this is a temporary solution. Let's ensure this technical debt is tracked.

Let's verify the PluginExecutor interface changes:

✅ Verification successful

Feature flag integration is properly implemented

The code follows the correct pattern for feature flag integration:

  • The executeParameterizedWithMetricsAndFlags method is properly defined in the PluginExecutor interface
  • The Google Sheets plugin correctly implements the interface and handles the feature flags parameter
  • The implementation includes proper null checks and fallback to empty map
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if executeParameterizedWithMetricsAndFlags is properly defined in the interface
ast-grep --pattern 'interface PluginExecutor {
  $$$
  executeParameterizedWithMetricsAndFlags($$$) {
    $$$
  }
  $$$
}'

Length of output: 124


Script:

#!/bin/bash
# Let's search for the PluginExecutor interface definition
rg -t java "interface PluginExecutor" -A 10

# Also search for executeParameterizedWithMetricsAndFlags method references
rg -t java "executeParameterizedWithMetricsAndFlags"

Length of output: 2483


Script:

#!/bin/bash
# Let's check the implementation details of executeParameterizedWithMetricsAndFlags
rg -t java -A 15 "default Mono<ActionExecutionResult> executeParameterizedWithMetricsAndFlags"

# Also check for any Google Sheets specific implementations
rg -t java "class GoogleSheetsPlugin" -A 20

Length of output: 7680


Script:

#!/bin/bash
# Let's check the implementation of executeParameterizedWithFlags in GoogleSheetsPlugin
rg -t java -A 10 "executeParameterizedWithFlags.*GoogleSheetsPlugin" 

# Also check for any shared drive related code
rg -t java "sharedDrive" -B 2 -A 2

Length of output: 105

Copy link

Deploy-Preview-URL: https://ce-37776.dp.appsmith.com

Copy link

Failed server tests

  • com.appsmith.server.solutions.ce.ActionExecutionSolutionCETest#testActionExecute

@github-actions github-actions bot added the Bug Something isn't working label Nov 28, 2024
Copy link
Contributor

@abhvsn abhvsn left a comment

Choose a reason for hiding this comment

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

Is it possible to add the tests specifically for the feature flag scenario?

@github-actions github-actions bot removed the Bug Something isn't working label Nov 28, 2024
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

🧹 Outside diff range and nitpick comments (6)
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java (6)

330-331: Consolidate mock configurations

Both executeParameterizedWithMetrics and executeParameterizedWithMetricsAndFlags are mocked to return mockResult. If only one of these methods is actually used in this test, consider removing the unnecessary mock to keep the test clean.


532-533: Remove redundant exception mocks

You're mocking both executeParameterizedWithMetrics and executeParameterizedWithMetricsAndFlags to throw pluginException. If the old method is deprecated or unused here, removing its mock can enhance readability.


591-592: Avoid duplicating mocks

Mocking both methods to throw the same pluginException may be unnecessary. Verify if both mocks are required for this test case, and eliminate any redundant ones.


644-646: Simplify mocked exceptions

Both methods are set up to throw StaleConnectionException(). If the test only requires one method to simulate this exception, consider removing the extra mock for clarity.


698-699: Streamline mock delays

In this timeout test, both methods are mocked to introduce a delay. If only one method is under test, it might be clearer to mock only that method.


730-732: Clarify exception handling in mocks

Both executeParameterizedWithMetrics and executeParameterizedWithMetricsAndFlags are throwing StaleConnectionException(). Confirm if it's necessary to mock exceptions for both methods in this test, and remove any that are not needed.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b5c702f and f39e6e6.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java (6 hunks)

@github-actions github-actions bot added the Bug Something isn't working label Nov 28, 2024
@sneha122
Copy link
Contributor Author

Is it possible to add the tests specifically for the feature flag scenario?

Can I add test cases for this in a separate PR? As this is a release blocker I would like to get this merged ASAP, WDYT?

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

🧹 Outside diff range and nitpick comments (6)
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (1)

44-51: Add tracking issue reference to TODO comment

The implementation looks good, but the TODO comment should reference a tracking issue for future cleanup.

-        // TODO: Flags are needed here for google sheets integration to support shared drive behind a flag
-        // Once thoroughly tested, this flag can be removed
+        // TODO: #ISSUE_NUMBER Remove feature flag once shared drive support is thoroughly tested
app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java (2)

83-84: Consider caching feature flags at instance level

The feature flags are retrieved on every trigger call. Consider caching the flags at the instance level and implementing a refresh mechanism to improve performance.


95-96: LGTM: Consider enhancing type safety

The implementation is correct, but consider using a generic type parameter for better type safety instead of casting to PluginExecutor<Object>.

-((PluginExecutor<Object>) pluginExecutor)
+pluginExecutor
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (1)

110-111: Track technical debt: TODO comment needs follow-up

The TODO comment indicates this is temporary. Consider creating a tracking issue for removing the feature flag once testing is complete.

Would you like me to create a GitHub issue to track the removal of this feature flag?

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java (2)

263-270: Add JavaDoc for the new method.

Please add proper JavaDoc documentation including:

  • @SInCE tag for version tracking
  • @param documentation for featureFlagMap parameter
+    /**
+     * Executes an action with feature flags support.
+     * @since 1.0.0
+     * @param connection Connection object
+     * @param executeActionDTO Action execution data
+     * @param datasourceConfiguration Datasource configuration
+     * @param actionConfiguration Action configuration
+     * @param featureFlagMap Map of feature flag names to their enabled status
+     * @return Action execution result
+     */

286-292: Add JavaDoc for consistency.

Please add JavaDoc documentation to maintain consistency with other interface methods.

+    /**
+     * Triggers an action with feature flags support.
+     * @since 1.0.0
+     * @param connection Connection object
+     * @param datasourceConfiguration Datasource configuration
+     * @param request Trigger request data
+     * @param featureFlagMap Map of feature flag names to their enabled status
+     * @return Trigger result
+     */
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f39e6e6 and 47f08f9.

📒 Files selected for processing (5)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java (1 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (4 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java (4 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java (6 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java
🔇 Additional comments (10)
app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/FileListMethod.java (2)

3-3: LGTM! Good encapsulation of shared drive parameters.

The constant effectively isolates the shared drive query parameters, making the code more maintainable.

Also applies to: 29-30


87-87: LGTM! Good reuse of logic.

Appropriate delegation ensures consistent feature flag handling between trigger and execution paths.

app/server/appsmith-server/src/main/java/com/appsmith/server/plugins/solutions/PluginTriggerSolutionCEImpl.java (2)

12-12: LGTM: Clean dependency injection implementation

The FeatureFlagService integration follows proper dependency injection patterns and immutability principles.

Also applies to: 32-32, 39-40, 46-46


81-82: Enhance TODO comment with specific removal criteria

The TODO comment should include specific criteria for when this technical debt can be removed, such as test coverage thresholds or specific test scenarios that need to pass.

-// TODO: Flags are needed here for google sheets integration to support shared drive behind a flag
-// Once thoroughly tested, this flag can be removed
+// TODO: Remove feature flag once shared drive support is thoroughly tested with:
+// 1. 100% test coverage for shared drive scenarios
+// 2. Successful QA validation in staging environment
+// 3. No reported issues after 2 weeks in production
+// Tracking issue: #37714
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (4)

20-20: LGTM: Clean dependency injection

The FeatureFlagService integration follows proper dependency injection patterns.

Also applies to: 58-58


110-114: Consider using reactive feature flag retrieval

The synchronous getCachedTenantFeatureFlags() call breaks the reactive pattern.


123-127: Add error handling for feature flags

The feature flag integration lacks error handling for the triggerWithFlags call.


123-127: Verify plugin executor compatibility

Ensure all plugin executors implement the new triggerWithFlags method correctly.

✅ Verification successful

Plugin executors are compatible with triggerWithFlags

The triggerWithFlags method is properly defined in the PluginExecutor interface with a default implementation that falls back to the regular trigger method. The GoogleSheetsPlugin has already implemented this method, and other plugins will automatically use the default implementation, ensuring backward compatibility.

  • The interface provides a default implementation in PluginExecutor.java
  • GoogleSheetsPlugin.java has a custom implementation
  • Other plugins will use the default implementation that calls trigger()
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for implementations of triggerWithFlags across plugin executors
ast-grep --pattern 'class $_ implements PluginExecutor {
  $$$
  triggerWithFlags($$$) {
    $$$
  }
  $$$
}'

Length of output: 111


Script:

#!/bin/bash
# Let's try a different approach to find triggerWithFlags implementations
# First, let's find all files containing "triggerWithFlags"
rg "triggerWithFlags" -l

# Then let's see the actual implementations with context
rg "triggerWithFlags" -A 5 -B 2

# Also search for the interface definition
rg "interface.*PluginExecutor" -A 10

Length of output: 12623

app/server/appsmith-interfaces/src/main/java/com/appsmith/external/plugins/PluginExecutor.java (2)

250-262: Well-documented technical debt!

The TODO comment clearly explains the rationale, limitations, and future plans for handling feature flags in plugin modules.


272-284: LGTM!

The implementation correctly combines metrics and feature flags support while maintaining the existing metrics observation pattern.

Copy link

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

Copy link

Failed server tests

  • com.appsmith.server.services.ce.ActionServiceCE_Test#findByIdAndBranchName_forGitConnectedAction_getBranchedAction

@sneha122 sneha122 merged commit 8d32ee8 into release Nov 28, 2024
42 checks passed
@sneha122 sneha122 deleted the chore/gs-check-all-drives branch November 28, 2024 08:10
sneha122 pushed a commit that referenced this pull request Nov 28, 2024
This PR hides shared drive support for Google Sheets Integration behind
a feature flag as we need to do thorough testing for it.

The feature flag implementation done in this PR involves passing feature
flags from server to google sheets plugin module. This temporary feature
flagging solution tech debt can be removed once the testing is done and
once we would release this feature to all.

**Why feature flags are only available at server module?**
Because they have a dependency on UserIdentifierService,
SessionUserService, TenantService etc which exists at server module.
Supporting feature flags out of the box at plugin module level would
require significant efforts to migrate these dependencies.

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

/ok-to-test tags="@tag.Authentication, @tag.Datasource"

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12063930619>
> Commit: 47f08f9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12063930619&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Authentication, @tag.Datasource`
> Spec:
> <hr>Thu, 28 Nov 2024 07:38:58 UTC
<!-- end of auto-generated comment: Cypress test results  -->

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

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

- **New Features**
- Introduced support for Google Sheets shared drive through feature
flags.
- Added new methods to handle feature flags in plugin execution and
triggering processes.
- Enhanced action execution and triggering logic to utilize feature
flags for dynamic behavior.

- **Bug Fixes**
	- Improved error handling for plugin execution processes.

- **Tests**
- Integrated `FeatureFlagService` into the testing framework for
enhanced test coverage.
- Expanded test scenarios to include various response types and error
conditions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“[email protected]”>
sneha122 added a commit that referenced this pull request Nov 28, 2024
## Description
Failing server unit test fixed, This test started failing due to changes
in this PR: #37776, for some
reason it did not show up on this Pr in failed test cases


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.IconButton"

### 🔍 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/12066311357>
> Commit: f915b4f
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12066311357&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IconButton`
> Spec:
> <hr>Thu, 28 Nov 2024 09:59:28 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

- **Bug Fixes**
- Improved error handling for stale connections during action execution,
allowing the system to recover and continue executing actions after an
initial failure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“[email protected]”>
sneha122 pushed a commit that referenced this pull request Nov 28, 2024
Failing server unit test fixed, This test started failing due to changes
in this PR: #37776, for some
reason it did not show up on this Pr in failed test cases

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

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

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12066311357>
> Commit: f915b4f
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12066311357&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IconButton`
> Spec:
> <hr>Thu, 28 Nov 2024 09:59:28 UTC
<!-- end of auto-generated comment: Cypress test results  -->

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

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

- **Bug Fixes**
- Improved error handling for stale connections during action execution,
allowing the system to recover and continue executing actions after an
initial failure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“[email protected]”>
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 2, 2024
…horg#37776)

## Description
This PR hides shared drive support for Google Sheets Integration behind
a feature flag as we need to do thorough testing for it.

The feature flag implementation done in this PR involves passing feature
flags from server to google sheets plugin module. This temporary feature
flagging solution tech debt can be removed once the testing is done and
once we would release this feature to all.

**Why feature flags are only available at server module?**
Because they have a dependency on UserIdentifierService,
SessionUserService, TenantService etc which exists at server module.
Supporting feature flags out of the box at plugin module level would
require significant efforts to migrate these dependencies.


Fixes appsmithorg#37714 
_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.Authentication, @tag.Datasource"

### 🔍 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/12063930619>
> Commit: 47f08f9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12063930619&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Authentication, @tag.Datasource`
> Spec:
> <hr>Thu, 28 Nov 2024 07:38:58 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

## Summary by CodeRabbit

- **New Features**
- Introduced support for Google Sheets shared drive through feature
flags.
- Added new methods to handle feature flags in plugin execution and
triggering processes.
- Enhanced action execution and triggering logic to utilize feature
flags for dynamic behavior.

- **Bug Fixes**
	- Improved error handling for plugin execution processes.

- **Tests**
- Integrated `FeatureFlagService` into the testing framework for
enhanced test coverage.
- Expanded test scenarios to include various response types and error
conditions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“[email protected]”>
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 2, 2024
## Description
Failing server unit test fixed, This test started failing due to changes
in this PR: appsmithorg#37776, for some
reason it did not show up on this Pr in failed test cases


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.IconButton"

### 🔍 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/12066311357>
> Commit: f915b4f
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12066311357&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IconButton`
> Spec:
> <hr>Thu, 28 Nov 2024 09:59:28 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

- **Bug Fixes**
- Improved error handling for stale connections during action execution,
allowing the system to recover and continue executing actions after an
initial failure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“[email protected]”>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Google Sheets Issues related to Google Sheets Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production Query & JS Pod Issues related to the query & JS Pod Release Blocker This issue must be resolved before the release 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.

[Bug]: Unable to access the google sheet shared drive files in app.appsmith.com
2 participants