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: Add worklow to check cyclic deps in a PR #33197

Open
wants to merge 23 commits into
base: release
Choose a base branch
from

Conversation

dvj1988
Copy link
Contributor

@dvj1988 dvj1988 commented May 6, 2024

Description

Tip

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

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

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9228474130
Commit: c93f3e5
Cypress dashboard url: Click here!

Communication

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

  • Yes
  • No

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label May 6, 2024
Copy link

github-actions bot commented May 6, 2024

🔄 Cyclic Dependency Check:

You PR has more cyclic depdencies than the release branch.

Copy link

github-actions bot commented May 6, 2024

🔄 Cyclic Dependency Check:

You PR has more cyclic depdencies than the release branch.

Resolve any new cyclic dependencies your PR has introduced.

Copy link

github-actions bot commented May 6, 2024

⚠️ Cyclic Dependency Check:

You PR has more cyclic depdencies than the release branch.

Resolve any new cyclic dependencies your PR has introduced.

@dvj1988 dvj1988 requested a review from riodeuno May 6, 2024 09:17
@dvj1988 dvj1988 marked this pull request as ready for review May 6, 2024 09:17
Copy link
Contributor

coderabbitai bot commented May 6, 2024

Warning

Rate Limit Exceeded

@dvj1988 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 38 minutes and 13 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between d3ad2a1 and c93f3e5.

Walkthrough

Enhancements have been made to streamline cyclic dependency management in a client application. These updates automate cyclic dependency checks via GitHub Actions, integrating them into quality assurance processes and ESLint configurations for improved development practices.

Changes

File Path Change Summary
.github/workflows/.../ci-client-cyclic-deps-check.yml Introduced a GitHub Actions workflow for checking cyclic dependencies in the client application.
.github/workflows/.../quality-checks.yml Added a job to trigger cyclic dependency checks under specific conditions.
app/client/.eslintrc.base.json Updated ESLint configuration to include the circular dependency checking script.
app/client/scripts/circular_deps_check.js Enhanced script functionality for parsing and identifying circular dependencies.

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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

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

Out of diff range and nitpick comments (2)
app/client/scripts/circular_deps_check.js (1)

3-3: Consider documenting the significance of the CIRCULAR_DEPS_IN_RELEASE constant.

Adding a comment explaining why the value is set to 2965 and how it should be maintained or updated could improve maintainability.

.github/workflows/ci-client-cyclic-deps-check.yml (1)

89-95: Review the message format in the PR comment for clarity and correctness.

Consider revising the message to include more details about the detected issues and possibly steps on how to resolve them. This would provide more value to the PR author.

Comment on lines 5 to 11
parseDependencyTree("./src", {}).then((tree) => {
const circulars = parseCircular(tree);
if (circulars.length > CIRCULAR_DEPS_IN_RELEASE) {
console.log("More deps than release!");
}
console.log(prettyCircular(circulars));
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle potential errors from the parseDependencyTree function.

- parseDependencyTree("./src", {}).then((tree) => {
+ parseDependencyTree("./src", {}).then((tree) => {
  const circulars = parseCircular(tree);
  if (circulars.length > CIRCULAR_DEPS_IN_RELEASE) {
    console.log("More deps than release!");
  }
  console.log(prettyCircular(circulars));
- });
+ }).catch(error => {
+   console.error("Failed to parse dependency tree:", error);
+ });

This modification ensures that any errors during the dependency tree parsing are caught and logged, preventing possible unhandled promise rejections.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
parseDependencyTree("./src", {}).then((tree) => {
const circulars = parseCircular(tree);
if (circulars.length > CIRCULAR_DEPS_IN_RELEASE) {
console.log("More deps than release!");
}
console.log(prettyCircular(circulars));
});
parseDependencyTree("./src", {}).then((tree) => {
const circulars = parseCircular(tree);
if (circulars.length > CIRCULAR_DEPS_IN_RELEASE) {
console.log("More deps than release!");
}
console.log(prettyCircular(circulars));
}).catch(error => {
console.error("Failed to parse dependency tree:", error);
});

Copy link

github-actions bot commented May 6, 2024

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies, when compared with the release branch.

Refer this document to check the cyclic dependencies.

Copy link

github-actions bot commented May 6, 2024

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

@dvj1988 dvj1988 added the ok-to-test Required label for CI label May 6, 2024
@dvj1988 dvj1988 requested a review from riodeuno May 6, 2024 10:13
riodeuno
riodeuno previously approved these changes May 6, 2024
@riodeuno
Copy link
Contributor

riodeuno commented May 6, 2024

@dvj1988 The cyclic deps has responded to this PR. Are these false positives?

@dvj1988
Copy link
Contributor Author

dvj1988 commented May 6, 2024

@dvj1988 The cyclic deps has responded to this PR. Are these false positives?

@riodeuno Ah, my bad! No its not a false positive. I reduced the number to test the comment. I have reverted it back to the correct threshold in this commit

@dvj1988 dvj1988 requested a review from riodeuno May 6, 2024 11:39
riodeuno
riodeuno previously approved these changes May 6, 2024
@dvj1988 dvj1988 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 6, 2024
@@ -0,0 +1,11 @@
const { parseDependencyTree, parseCircular, prettyCircular } = require("dpdm");

const CIRCULAR_DEPS_IN_RELEASE = 2965;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having a constant will not be very convenient for us in the future. Especially when we start working on reducing the number of dependencies and we have to edit it manually every time. I think we could checkout to the release branch to get the number of dependencies and then compare them with the number of dependencies in the current branch. WDYT?

@dvj1988 @riodeuno

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KelvinOm Understood. Let me update the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KelvinOm Please re-review. This workflow checks out the release branch and compares the cyclic dependencies with the current branch.

This is the sample comment.

Comment on lines 32 to 47
# In case this is second attempt try restoring status of the prior attempt from cache
- name: Restore the previous run result
uses: actions/cache@v3
with:
path: |
~/run_result
key: ${{ github.run_id }}-${{ github.job }}-client

# Fetch prior run result
- name: Get the previous run result
id: run_result
run: cat ~/run_result 2>/dev/null || echo 'default'

# In case of prior failure run the job
- if: steps.run_result.outputs.run_result != 'success'
run: echo "I'm alive!" && exit 0
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Recommend removing these steps as it's not required in this particular job. We use this for long running jobs (like Cypress test etc) to prevent re-running of the same job after a failure. In this particular case, I don't think this is required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed them.

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label May 20, 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

.github/workflows/ci-client-cyclic-deps-check.yml Outdated Show resolved Hide resolved
Copy link

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 1, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

@dvj1988 dvj1988 requested review from KelvinOm and riodeuno May 24, 2024 18:19
@dvj1988 dvj1988 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants