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

fix: Remove Gsheets unauth method #36125

Merged
merged 7 commits into from
Sep 10, 2024

Conversation

rishabhrathod01
Copy link
Contributor

@rishabhrathod01 rishabhrathod01 commented Sep 5, 2024

Description

This PR temporarily removes the unauthorised Google Sheets method to ensure users are only shown methods that would work and avoid causing confusion.

  • The feature flag wasn't used here as the form JSON config's method field does not support hidden fields using feature flag and we avoided writing a logic specifically to remove the field from JSON before sending it as once the other methods get authorised again, we won't need the feature flag again

Fixes #35523

Automation

/test gsheet

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10789501829
Commit: 040643a
Cypress dashboard.
Tags: @tag.GSheet
Spec:


Tue, 10 Sep 2024 09:37:24 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Simplified authorization options for Google Sheets integration, now limited to read and write access for selected sheets only.
  • Bug Fixes

    • Updated integration tests to reflect the removal of outdated Google Sheets permission options, ensuring tests align with current authorization constraints.
  • Tests

    • Temporarily skipped multiple test suites related to Google Sheets functionality to streamline testing and focus on relevant tests.

Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Walkthrough

The recent changes involve modifications to the Google Sheets integration within the application, specifically focusing on the authorization scopes and the corresponding tests. Certain permissions have been removed from both the testing framework and the JSON configuration, streamlining the available options to enhance user experience and align with current authorization requirements.

Changes

Files Change Summary
app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts
app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json
Removed various Google Sheets permission options due to authorization constraints, simplifying the available scopes to only allow read/write access to selected sheets.
app/client/cypress/e2e/GSheet/AllAccess_Spec.ts
app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts
app/client/cypress/e2e/GSheet/ReadNWrite_Access_Spec.ts
app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts
app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts
Changed describe to describe.skip for multiple test suites, preventing their execution during testing.

Assessment against linked issues

Objective Addressed Explanation
Cannot create Google Sheets datasource (Bug #35523)
Authorization scope should be limited (Bug #35523)

Possibly related issues

Poem

In the realm of sheets so bright,
Permissions trimmed, a clearer sight.
With scopes now neat, the path is clear,
Google’s grace, we hold so dear.
A simpler way, our tests align,
In the world of data, all will be fine! 🌟

Tip

Announcements
  • The review status is no longer posted as a separate comment when there are no actionable or nitpick comments. In such cases, the review status is included in the walkthrough comment.
  • We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs: Walkthrough comment now includes a list of potentially related PRs to help you recall past context. Please share any feedback in the discussion post on our Discord.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs in the walkthrough comment. You can also provide custom labeling instructions in the UI or configuration file.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 757d256 and 040643a.

Files selected for processing (1)
  • app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

@github-actions github-actions bot added Bug Something isn't working Critical This issue needs immediate attention. Drop everything else Google Sheets Issues related to Google Sheets Integrations Product Issues related to a specific integration Production Query & JS Pod Issues related to the query & JS Pod Stale labels Sep 5, 2024
@rishabhrathod01 rishabhrathod01 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 5, 2024
@rishabhrathod01 rishabhrathod01 self-assigned this Sep 5, 2024
@sneha122
Copy link
Contributor

sneha122 commented Sep 5, 2024

/build-deploy-preview skip-tests=true

sneha122
sneha122 previously approved these changes Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

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

Copy link

github-actions bot commented Sep 5, 2024

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

@rishabhrathod01 rishabhrathod01 marked this pull request as ready for review September 6, 2024 07:40
@github-actions github-actions bot added the Stale label Sep 6, 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: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 65eb854 and 60e41fa.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts (2 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json (1 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
Additional comments not posted (3)
app/server/appsmith-plugins/googleSheetsPlugin/src/main/resources/form.json (1)

Line range hint 1-30: Approval of Simplified Authorization Scopes

The changes to the JSON configuration effectively simplify the authorization options, aligning with the PR's objective to reduce user confusion during the authorization issues with Google. The remaining scope for "Read / Write / Delete | Selected google sheets" is correctly retained and should be thoroughly tested to ensure it functions as expected.

app/client/cypress/e2e/Regression/ServerSide/QueryPane/GoogleSheets_spec.ts (2)

23-26: Temporary Removal of Unauthorized Methods in Tests

The commenting out of certain dropdown options in the test is a necessary adjustment given the current authorization constraints with Google. This change aligns the tests with the actual state of the application, ensuring that only authorized options are tested.


23-26: Avoid Using agHelper.Sleep()

The use of agHelper.Sleep() in the test cases is not recommended as it introduces potential flakiness and makes the tests less reliable. Consider using Cypress's built-in wait mechanisms to wait for specific conditions or elements, which can provide a more robust and efficient testing approach.

Skipped due to learnings
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#34955
File: app/client/cypress/e2e/Regression/ClientSide/ActionExecution/General_settingsTe_Spec.ts:33-33
Timestamp: 2024-07-16T08:25:23.799Z
Learning: Avoid using sleep functions like `agHelper.Sleep` and `this.Sleep` in Cypress tests within the `app/client/cypress` directory to prevent non-deterministic behaviors and ensure tests are more reliable and maintainable.
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#34955
File: app/client/cypress/e2e/Regression/ClientSide/ActionExecution/General_settings_Spec.ts:14-56
Timestamp: 2024-07-16T06:44:55.263Z
Learning: Avoid using sleep functions like `agHelper.Sleep`, `this.Sleep` in Cypress tests within the `app/client/cypress` directory to prevent non-deterministic behaviors and ensure tests are more reliable and maintainable.
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#35412
File: app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts:99-99
Timestamp: 2024-08-06T05:59:19.000Z
Learning: In Cypress tests within the `app/client/cypress` directory, avoid using `agHelper.Sleep`, `this.Sleep`, and other related sleep functions to prevent non-deterministic behaviors and ensure tests are more reliable and maintainable. Instead, use Cypress methods like `cy.get()`, `cy.contains()`, and `cy.intercept()` to wait for specific conditions.
Learnt from: ApekshaBhosale
PR: appsmithorg/appsmith#35412
File: app/client/cypress/e2e/Regression/ClientSide/OneClickBinding/TableWidget/mysql_spec.ts:99-99
Timestamp: 2024-08-06T05:39:47.929Z
Learning: In Cypress tests, avoid using `agHelper.Sleep` as it can lead to flaky tests and unnecessary delays. Instead, use Cypress methods like `cy.get()`, `cy.contains()`, and `cy.intercept()` to wait for specific conditions.
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#34955
File: app/client/cypress/e2e/Regression/ClientSide/ActionExecution/General_settings_Spec.ts:14-56
Timestamp: 2024-07-16T06:48:43.110Z
Learning: Learnt from: sagar-qa007
PR: appsmithorg/appsmith#34955
File: app/client/cypress/e2e/Regression/ClientSide/ActionExecution/General_settings_Spec.ts:14-56
Timestamp: 2024-07-16T06:44:55.118Z
Learning: Avoid using sleep functions like `agHelper.Sleep`, `this.Sleep`, and other related sleep functions in Cypress tests within the `app/client/cypress` directory to prevent non-deterministic behaviors and ensure tests are more reliable and maintainable.
Learnt from: sagar-qa007
PR: appsmithorg/appsmith#34955
File: app/client/cypress/e2e/Regression/ClientSide/ActionExecution/General_settingsTe_Spec.ts:33-33
Timestamp: 2024-07-16T08:27:01.667Z
Learning: Follow best practices for Cypress code and e2e automation:
- Avoid using cy.wait in code.
- Avoid using cy.pause in code.
- Avoid using agHelper.sleep().
- Use locator variables for locators and do not use plain strings.
- Use data-* attributes for selectors.
- Avoid Xpaths, Attributes, and CSS path.
- Avoid selectors like .btn.submit or button[type=submit].
- Perform logins via API with LoginFromAPI.
- Perform logout via API with LogOutviaAPI.
- Perform signup via API with SignupFromAPI.
- Avoid using it.only.
- Avoid using after and aftereach in test cases.
- Use multiple assertions for expect statements.
- Avoid using strings for assertions.
- Do not use duplicate filenames even with different paths.
- Avoid using agHelper.Sleep, this.Sleep in any file in code.

Comment on lines +23 to +26
// Hiding below methods as they are not authorized at this state
// "Read / Write / Delete | All google sheets",
// "Read / Write | All google sheets",
// "Read | All google sheets",
Copy link
Contributor

Choose a reason for hiding this comment

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

Use Data Attributes for Selectors

To enhance the maintainability and readability of your test code, consider using data-* attributes for your selectors instead of relying on class names or other attributes. This practice helps decouple your tests from changes in the UI and makes your selectors more descriptive and easier to manage.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 60e41fa and 757d256.

Files selected for processing (5)
  • app/client/cypress/e2e/GSheet/AllAccess_Spec.ts (1 hunks)
  • app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts (1 hunks)
  • app/client/cypress/e2e/GSheet/ReadNWrite_Access_Spec.ts (1 hunks)
  • app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts (1 hunks)
  • app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts (1 hunks)
Files skipped from review due to trivial changes (5)
  • app/client/cypress/e2e/GSheet/AllAccess_Spec.ts
  • app/client/cypress/e2e/GSheet/GsheetMisc_Spec.ts
  • app/client/cypress/e2e/GSheet/ReadNWrite_Access_Spec.ts
  • app/client/cypress/e2e/GSheet/ReadOnly_Access_Spec.ts
  • app/client/cypress/e2e/GSheet/WidgetBinding_AllAccess_Spec.ts

Copy link

Failed server tests

  • com.appsmith.server.refactors.ce.RefactoringServiceTest#testIsNameAllowed_withRepeatedActionCollectionName_throwsError

@rishabhrathod01 rishabhrathod01 dismissed sagar-qa007’s stale review September 10, 2024 11:24

PR is ready to merge as the gheet specific test are changed to pass.

@NilanshBansal NilanshBansal self-requested a review September 10, 2024 11:46
@rishabhrathod01 rishabhrathod01 merged commit 294503b into release Sep 10, 2024
44 of 45 checks passed
@rishabhrathod01 rishabhrathod01 deleted the fix/remove-gsheets-unauth-methods branch September 10, 2024 11:51
@coderabbitai coderabbitai bot mentioned this pull request Sep 20, 2024
2 tasks
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
## Description

This PR temporarily removes the unauthorised Google Sheets method to
ensure users are only shown methods that would work and avoid causing
confusion.
- The feature flag wasn't used here as the form JSON config's method
field does not support hidden fields using feature flag and we avoided
writing a logic specifically to remove the field from JSON before
sending it as once the other methods get authorised again, we won't need
the feature flag again

Fixes appsmithorg#35523

## Automation

/test gsheet

### 🔍 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/10789501829>
> Commit: 040643a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10789501829&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.GSheet`
> Spec:
> <hr>Tue, 10 Sep 2024 09:37:24 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


- **New Features**
- Simplified authorization options for Google Sheets integration, now
limited to read and write access for selected sheets only.

- **Bug Fixes**
- Updated integration tests to reflect the removal of outdated Google
Sheets permission options, ensuring tests align with current
authorization constraints.

- **Tests**
- Temporarily skipped multiple test suites related to Google Sheets
functionality to streamline testing and focus on relevant tests.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
rishabhrathod01 added a commit that referenced this pull request Oct 3, 2024
sneha122 added a commit that referenced this pull request Dec 13, 2024
## Description
This PR adds back all sheets option which had been removed in PR:
#36125


Fixes #38002
_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.Datasource, @tag.Widget"

### 🔍 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/12311024852>
> Commit: e177b64
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12311024852&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Datasource, @tag.Widget`
> Spec:
> <hr>Fri, 13 Dec 2024 08:27:08 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

- **New Features**
- Added new options for Google Sheets permissions, enhancing user
selection capabilities.
- Introduced a feature flag to control the visibility of new Google
Sheets options.
	
- **Bug Fixes**
- Improved handling of feature flags in the datasource section
rendering, ensuring correct visibility based on flags.

- **Documentation**
- Updated test specifications for Google Sheets datasource to include
new dropdown options.

- **Chores**
- Enhanced the logic for setting default values in the
RadioButtonControl component.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Alex Golovanov <alex@appsmith.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Critical This issue needs immediate attention. Drop everything else Google Sheets Issues related to Google Sheets Integrations Product Issues related to a specific integration ok-to-test Required label for CI Production Query & JS Pod Issues related to the query & JS Pod Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: cannot create gsheets datasource, blocked by google
4 participants