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: Error Tab changes for Debugger #37684

Draft
wants to merge 13 commits into
base: release
Choose a base branch
from

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Nov 25, 2024

Description

Fixes Parts of #37676

Automation

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

🔍 Cypress test results

Warning

Tests have not run on the HEAD 9d53255 yet


Wed, 27 Nov 2024 13:13:16 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a new DebugIcon for enhanced visual representation.
  • Improvements
    • Updated the label for debugging messages from "Errors" to "Linter" for clarity.
    • Enhanced the Debugger interface by simplifying tab options, removing the INSPECT_TAB.
    • Improved the display of error counts in the Debugger button.
  • Bug Fixes
    • Streamlined error handling and logging in plugin action execution and JavaScript actions, reducing verbosity.

Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes in this pull request introduce a new DebugIcon to the icon management system, update terminology in error messages, and simplify the debugger interface by removing the INSPECT_TAB. Additionally, modifications are made to the Debugger component to enhance the button rendering and error count display. Other updates include refining error handling in various sagas and adjusting function signatures within the JavaScript pane. These changes collectively aim to streamline the debugging experience while maintaining existing functionality.

Changes

File Path Change Summary
.../Icon/Icon.provider.tsx Added DebugIcon and updated ICON_LOOKUP with a new entry for debug.
.../constants/messages.ts Updated DEBUGGER_ERRORS label from "Errors" to "Linter".
.../Debugger/DebuggerTabs.tsx Removed INSPECT_TAB from DEBUGGER_TABS array.
.../Debugger/index.tsx Updated DebuggerTrigger to replace styled button with a standard Button, added error count display.
.../Debugger/styles.ts Removed DebuggerTriggerButton styled component.
.../DataSourceEditor/Debugger.tsx Removed INSPECT_TAB entry from DEBUGGER_TABS array.
.../ActionExecution/PluginActionSaga.ts Simplified error logging; removed structured error messages and currentEnvDetails variable.
.../JSPaneSagas.ts Adjusted imports and refined error logging; updated multiple function signatures.

Possibly related PRs

Suggested labels

Bug, IDE Product, IDE Pod, Query & JS Pod, Task, ok-to-test

Suggested reviewers

  • ankitakinger
  • albinAppsmith
  • ayushpahwa
  • sagar-qa007

🎉 In the land of code where icons play,
A DebugIcon joins the fray!
With tabs that simplify and messages clear,
Debugging's now a joy, oh dear!
So let’s code and cheer, for changes are here! 🎈


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.

@hetunandu hetunandu added the ok-to-test Required label for CI label Nov 25, 2024
@hetunandu
Copy link
Member Author

/build-deploy-preview

@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 25, 2024
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12011682403.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 37684.
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 (3)
app/client/src/components/editorComponents/Debugger/index.tsx (1)

34-39: Consider using a more declarative approach.

The logic is correct, but could be more readable using early returns.

-  const countContent =
-    messageCounters.errors !== 0
-      ? messageCounters.errors > 99
-        ? "(99+)"
-        : `(${messageCounters.errors})`
-      : "";
+  const countContent = (() => {
+    if (messageCounters.errors === 0) return "";
+    if (messageCounters.errors > 99) return "(99+)";
+    return `(${messageCounters.errors})`;
+  })();
app/client/src/sagas/JSPaneSagas.ts (1)

Line range hint 632-633: Address technical debt

There are several TODO comments and disabled eslint rules that should be addressed:

  • // TODO: Fix this the next time the file is edited
  • // eslint-disable-next-line @typescript-eslint/no-explicit-any

Consider using proper typing instead of any to improve type safety.

Would you like me to help create proper TypeScript interfaces for these cases?

app/client/src/sagas/ActionExecution/PluginActionSaga.ts (1)

Line range hint 1-1200: Consider splitting complex sagas into smaller, focused functions

The file contains several long saga functions that handle multiple responsibilities. Consider breaking down functions like executePluginActionSaga and runActionSaga into smaller, more focused functions to improve maintainability.

For example:

  • Extract error handling logic into a separate helper
  • Split action execution validation into its own function
  • Move analytics logging to a dedicated helper

This would make the code easier to test and maintain.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d0fc6d7 and 1f152e3.

⛔ Files ignored due to path filters (1)
  • app/client/packages/design-system/ads/src/__assets__/icons/ads/debug.svg is excluded by !**/*.svg
📒 Files selected for processing (8)
  • app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx (2 hunks)
  • app/client/src/ce/constants/messages.ts (1 hunks)
  • app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx (0 hunks)
  • app/client/src/components/editorComponents/Debugger/index.tsx (2 hunks)
  • app/client/src/components/editorComponents/Debugger/styles.ts (0 hunks)
  • app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx (0 hunks)
  • app/client/src/sagas/ActionExecution/PluginActionSaga.ts (2 hunks)
  • app/client/src/sagas/JSPaneSagas.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • app/client/src/components/editorComponents/Debugger/DebuggerTabs.tsx
  • app/client/src/components/editorComponents/Debugger/styles.ts
  • app/client/src/pages/Editor/DataSourceEditor/Debugger.tsx
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/ce/constants/messages.ts
🧰 Additional context used
🪛 Biome (1.9.4)
app/client/src/sagas/JSPaneSagas.ts

[error] 540-540: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

🔇 Additional comments (5)
app/client/src/components/editorComponents/Debugger/index.tsx (2)

6-6: LGTM! Good use of design system components.

Using the standard Button component from @appsmith/ads ensures UI consistency.


43-51: Verify the "debug" icon availability.

The Button implementation looks good, but let's verify the "debug" icon exists in the icon system.

✅ Verification successful

Let me check the actual icon definition to verify its availability.


The "debug" icon is available in the icon system.

The icon is properly defined in the icon provider as:

const DebugIcon = importSvg(
  async () => import("../__assets__/icons/ads/debug.svg"),
);

And registered in the lookup:

const ICON_LOOKUP = {
  // ...
  debug: DebugIcon,
  // ...
};
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for debug icon definition in the codebase
rg -l "debug.*Icon" --type ts

Length of output: 716


Script:

#!/bin/bash
# Check the icon provider file for debug icon definition
cat app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx

Length of output: 48910

app/client/src/sagas/JSPaneSagas.ts (1)

75-75: Verify error handling after import removals

The removal of error-related imports suggests changes in error handling strategy. Let's verify that all error cases are still properly handled.

app/client/src/sagas/ActionExecution/PluginActionSaga.ts (1)

893-893: Verify error object structure consistency across consumers

The direct passing of the error object to the payload could affect error display in the UI. Let's verify the error object structure is consistent with what consumers expect.

✅ Verification successful

Let me check the error handling implementation in the reducer to verify the error object structure.


Let me check how the error object is being used in the reducers and action handlers.


Let me try a different search pattern to find the error handling implementation.


Let me check how the error is consumed in the reducers to verify the error handling consistency.


Direct error object usage is consistent with consumer expectations

The error handling implementation is consistent across the codebase. The error object is properly consumed in both reducers:

  • actionsReducer uses it to update loading state
  • pluginEditorReducer extracts error message for display
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check error object usage in UI components
# Search for components that consume action errors
rg -A 5 'RUN_ACTION_ERROR'

Length of output: 4978


Script:

#!/bin/bash
# Check the error handling implementation in the reducer
ast-grep --pattern 'error: Error' 

Length of output: 110980


Script:

#!/bin/bash
# Search for RUN_ACTION_ERROR usage in reducers and action handlers
rg -A 5 "RUN_ACTION_ERROR.*payload" 

Length of output: 37


Script:

#!/bin/bash
# Search for RUN_ACTION_ERROR type and payload structure
rg -A 10 "type: ReduxActionErrorTypes.RUN_ACTION_ERROR"

Length of output: 1942


Script:

#!/bin/bash
# Search for RUN_ACTION_ERROR handling in reducers
rg -A 10 "\[ReduxActionErrorTypes.RUN_ACTION_ERROR\]"

Length of output: 2127

app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx (1)

1075-1077: LGTM! The changes follow the established icon management patterns.

The addition of the DebugIcon and its corresponding entry in the ICON_LOOKUP object follows the codebase conventions.

Also applies to: 1120-1120

app/client/src/sagas/JSPaneSagas.ts Outdated Show resolved Hide resolved
Copy link

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

@hetunandu hetunandu marked this pull request as draft November 26, 2024 06:10
@hetunandu hetunandu removed the ok-to-test Required label for CI label Nov 26, 2024
@hetunandu
Copy link
Member Author

/build-deploy-preview

Copy link

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

Copy link

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

@hetunandu
Copy link
Member Author

/build-deploy-preview

Copy link

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

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

1 participant