-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: checkout the base branch instead of release in cyclic deps check #39057
base: release
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@dvj1988 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 5 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (1)
WalkthroughThe CI workflow for cyclic dependency checks has been modified to reference the base branch instead of the release branch. This change affects the checkout step, naming of subsequent steps, output variables, and file naming for dependency reports. The cyclic dependency count and comparison now refer to the pull request's base branch, with the generated comment message updated accordingly. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
This reverts commit c012a8f.
@@ -108,7 +108,7 @@ jobs: | |||
github-token: ${{secrets.GITHUB_TOKEN}} | |||
script: | | |||
const prNumber = context.payload.pull_request.number; | |||
const message = `🔴🔴🔴 Cyclic Dependency Check:\n\nThis PR has increased the number of cyclic dependencies by ${{steps.compare-deps.outputs.diff}}, when compared with the release branch.\n\nRefer [this document](https://appsmith.notion.site/How-to-check-cyclic-dependencies-c47b08fe5f2f4261a3a234b19e13f2db) to identify the cyclic dependencies introduced by this PR.`; | |||
const message = `🔴🔴🔴 Cyclic Dependency Check:\n\nThis PR has increased the number of cyclic dependencies by ${{steps.compare-deps.outputs.diff}}, when compared with the ${{github.event.pull_request.base.ref}} branch.\n\nRefer [this document](https://appsmith.notion.site/How-to-check-cyclic-dependencies-c47b08fe5f2f4261a3a234b19e13f2db) to identify the cyclic dependencies introduced by this PR.`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dvj1988 Can we also list the new added cyclic dependencies? Maybe not in the message, but at least in the log.
There was a problem hiding this 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
♻️ Duplicate comments (1)
.github/workflows/ci-client-cyclic-deps-check.yml (1)
106-121
: 🛠️ Refactor suggestion
⚠️ Potential issuePortability Concerns in Log Circular Dependencies Step
The inlinesed -i ''
commands on lines 110 and 111 use syntax that is typical on macOS but may fail on Ubuntu (the workflow’s runtime). In GNU sed (default on Ubuntu), the correct usage is simplysed -i
. Additionally, ensure that the logging clearly shows both removed and added dependencies as requested in previous review feedback.Diff suggestions:
- sed -i '' '10,14d' pr_circular_deps.txt + sed -i '10,14d' pr_circular_deps.txt- sed -i '' '20,29d' base_branch_circular_deps.txt + sed -i '20,29d' base_branch_circular_deps.txt
🧹 Nitpick comments (1)
.github/workflows/ci-client-cyclic-deps-check.yml (1)
58-60
: Trailing Whitespace & Command Formatting in Dependency Count (PR branch)
There are extra trailing spaces on line 58 that could lead to formatting inconsistencies. Please remove these trailing spaces to improve readability and maintainability.Diff suggestion:
- npx dpdm "./src/**/*.{js,jsx,ts,tsx}" --circular --warning=false --tree=false \ + npx dpdm "./src/**/*.{js,jsx,ts,tsx}" --circular --warning=false --tree=false \🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 58-58: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-client-cyclic-deps-check.yml
(2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-client-cyclic-deps-check.yml
[error] 58-58: trailing spaces
(trailing-spaces)
[error] 84-84: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: perform-test / client-build / client-build
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-lint / client-lint
- GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
- GitHub Check: client-build / client-build
- GitHub Check: client-prettier / prettier-check
🔇 Additional comments (3)
.github/workflows/ci-client-cyclic-deps-check.yml (3)
67-72
: Updated Checkout for Base Branch
The checkout step now correctly references the pull request’s base branch using${{ github.event.pull_request.base.ref }}
withclean: false
, ensuring that the proper branch is checked out. This meets the PR objective.
97-99
: Variable Substitution in Comparison Step
The updated substitution ofbase_branch_count
and calculation ofdiff
in the comparison step look correct and better aligned with the base branch change objectives.
129-130
: Descriptive PR Comment Message
The PR comment message now clearly states the dependency difference and references the base branch. This makes it easier for reviewers and contributors to understand the comparison context.
npx dpdm "./src/**/*.{js,jsx,ts,tsx}" --circular --warning=false --tree=false \ | ||
| sed '1d; s/^[[:space:]]*[0-9]\{4\})[[:space:]]*/• /; /^[[:space:]]*$/d' \ | ||
| sort | sed '/^[[:space:]]*$/d' > > base_branch_circular_deps.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Fix Redirection Operator in Base Branch Dependency Count
There is an extra >
in the redirection operator on line 86 (> > base_branch_circular_deps.txt
), which will cause a syntax error during execution. Please remove the duplicate redirection symbol. Also, note there is trailing whitespace on line 84 per static analysis.
Diff suggestion:
- | sort | sed '/^[[:space:]]*$/d' > > base_branch_circular_deps.txt
+ | sort | sed '/^[[:space:]]*$/d' > base_branch_circular_deps.txt
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
npx dpdm "./src/**/*.{js,jsx,ts,tsx}" --circular --warning=false --tree=false \ | |
| sed '1d; s/^[[:space:]]*[0-9]\{4\})[[:space:]]*/• /; /^[[:space:]]*$/d' \ | |
| sort | sed '/^[[:space:]]*$/d' > > base_branch_circular_deps.txt | |
npx dpdm "./src/**/*.{js,jsx,ts,tsx}" --circular --warning=false --tree=false \ | |
| sed '1d; s/^[[:space:]]*[0-9]\{4\})[[:space:]]*/• /; /^[[:space:]]*$/d' \ | |
| sort | sed '/^[[:space:]]*$/d' > base_branch_circular_deps.txt |
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 84-84: trailing spaces
(trailing-spaces)
There was a problem hiding this 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
♻️ Duplicate comments (1)
.github/workflows/ci-client-cyclic-deps-check.yml (1)
84-86
:⚠️ Potential issueFix Extra Redirection Operator and Trailing Whitespace in Base Branch Dependency Command
An extra redirection operator (
> >
) is detected on line 86, which will cause a syntax error. Also, trailing whitespace is present on line 84. Please remove the extra>
and any undesired whitespace.- | sort | sed '/^[[:space:]]*$/d' > > base_branch_circular_deps.txt + | sort | sed '/^[[:space:]]*$/d' > base_branch_circular_deps.txt🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 84-84: trailing spaces
(trailing-spaces)
🧹 Nitpick comments (1)
.github/workflows/ci-client-cyclic-deps-check.yml (1)
58-60
: Remove Trailing Whitespace in PR Branch Dependency CommandThere are trailing spaces at the end of the command on line 58 which could lead to formatting inconsistencies. Please remove any extra whitespace.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 58-58: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-client-cyclic-deps-check.yml
(2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-client-cyclic-deps-check.yml
[error] 58-58: trailing spaces
(trailing-spaces)
[error] 84-84: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-lint / client-lint
- GitHub Check: client-build / client-build
🔇 Additional comments (1)
.github/workflows/ci-client-cyclic-deps-check.yml (1)
110-111
:⚠️ Potential issueEnsure Cross-Platform Compatibility for Inline Sed Editing
The commands using
sed -i ''
(BSD-style inline editing) on lines 110 and 111 may not work as expected on the Ubuntu runner (which uses GNU sed). Consider switching to GNU sed syntax, for example by usingsed -i
without the empty string.- sed -i '' '10,14d' pr_circular_deps.txt + sed -i '10,14d' pr_circular_deps.txt- sed -i '' '20,29d' base_branch_circular_deps.txt + sed -i '20,29d' base_branch_circular_deps.txt
There was a problem hiding this 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
🧹 Nitpick comments (2)
.github/workflows/ci-client-cyclic-deps-check.yml (2)
73-77
: Review Commented-out CodeThe commented-out dependency installation step (lines 73–77) could lead to future confusion if left in the file without context. Consider either removing it or adding a clarifying comment explaining its purpose.
103-103
: Remove Trailing WhitespaceYAMLlint has flagged trailing whitespace on line 103. Removing the extra spaces will keep the file clean and adhere to style guidelines.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 103-103: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-client-cyclic-deps-check.yml
(3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-client-cyclic-deps-check.yml
[error] 103-103: trailing spaces
(trailing-spaces)
🔇 Additional comments (9)
.github/workflows/ci-client-cyclic-deps-check.yml (9)
43-47
: Ensure Consistency for dpdm Global Install StepThe step installs the dpdm package globally using version 3.14. Please confirm that this is the intended version for your dependency graph analysis.
48-53
: Review Dependencies Installation StepThe command to install dependencies with
yarn install --immutable
is straightforward and looks correct.
58-59
: Verify dpdm Command Pipeline for PR BranchThe dpdm command piped through
sed
andsort
properly formats the output intopr_circular_deps.txt
. The regular expression and pipeline are a bit complex, so consider an inline comment or a note for future maintainers if any troubleshooting is required later.
66-72
: Ensure Correct Base Branch CheckoutThe checkout step now uses the pull request’s base branch via
${{ github.event.pull_request.base.ref }}
withclean: false
. Please verify that retaining the working directory state (i.e. not cleaning) is intentional and does not cause unintended side effects in later steps.
78-90
: Assess Base Branch Dependency Count StepThe base branch dependency count step clears the
node_modules
directory before executing dpdm, which helps ensure a clean analysis. Confirm that removingnode_modules
here will not affect any subsequent steps in the workflow.
91-97
: Validation of Circular Dependency Comparison LogicThe arithmetic subtraction to compute the diff (
diff="$((pr_count - base_branch_count))"
) appears correct. If there's any possibility that the base branch could have more circular dependencies than the PR branch, you might consider whether a negative diff should be explicitly handled.
104-108
: Confirm Diff Save FunctionalitySaving the unified diff using the
diff -u
command todiff_output.txt
is clear and effective. This prepares the data for the subsequent logging step.
109-121
: Log Diff Extraction is ClearThe block that logs dependency changes—by echoing removed dependencies (lines starting with a single hyphen) and added ones (lines starting with a single plus)—is well structured. Consider handling the case where no changes are detected to avoid empty logs.
130-130
: Update PR Comment Message TemplateThe PR comment message template correctly uses template literals to reference the evaluated diff and the base branch name, ensuring that the information is dynamic and accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/ci-client-cyclic-deps-check.yml (1)
43-47
: Installation of Global Dependency (dpdm
) Added
A new step to globally install[email protected]
has been introduced. This appropriately ensures that the required version is available before later steps run.Suggestion: Consider caching the npm modules if CI speed becomes a concern.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-client-cyclic-deps-check.yml
(3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-client-cyclic-deps-check.yml
[error] 103-103: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
- GitHub Check: client-lint / client-lint
- GitHub Check: client-prettier / prettier-check
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-build / client-build
🔇 Additional comments (8)
.github/workflows/ci-client-cyclic-deps-check.yml (8)
48-53
: Installing Dependencies Step Added
The step to install dependencies using Yarn is clear and placed after installingdpdm
. This ensures the workspace is correctly set up before running dependency analysis.
58-59
: Formatting of dpdm Output for PR Branch Analysis
The dpdm command is piped throughsed
andsort
to filter and format the circular dependencies list. Please verify that the regular expression fits all expected output cases from dpdm.Suggestion: If the sed pattern needs future adjustments or becomes too hard to maintain, consider moving the formatting logic into a helper script.
66-72
: Checkout Base Branch Step Updated
The checkout step now uses the pull request’s base branch (${{ github.event.pull_request.base.ref }}
) withclean: false
, which aligns with the PR objectives. This change ensures subsequent dependency checks operate on the correct branch.
82-89
: Counting Circular Dependencies on Base Branch
This step removes thenode_modules
directory and then processes the circular dependency check with dpdm on the base branch. The use of a similar sed/ sort pipeline maintains consistency with the PR branch check.Note: Ensure that the removal of
node_modules
does not have unintended side effects on subsequent steps.
91-98
: Comparing Circular Dependencies Between PR and Base Branch
The subtraction ofbase_branch_count
frompr_count
via arithmetic expansion is correct. This step now accurately computes the difference in circular dependencies.Note: Double-check that both output variables are being set correctly by the previous steps.
104-107
: Saving Diff Output of Circular Dependencies
A step has been added to save the unified diff between the base branch and PR circular dependencies. The use of|| true
prevents failures due to non-zero diff exit codes, which is appropriate here.
109-121
: Logging the Diff of Circular Dependencies
The newly added logging step neatly separates “Dependencies removed” and “Dependencies added” using grep filters on the diff output. This will help in quickly identifying changes.Suggestion: Consider handling the case when no diff exists, for better logging clarity.
129-129
: Updated PR Comment Message Reflecting Base Branch Usage
The comment generated on the pull request now correctly references the base branch (${{github.event.pull_request.base.ref}}
) instead of the outdated release branch. This improves clarity for contributors reviewing the cyclic dependency results.
if [ "$diff" -gt 0 ]; then | ||
echo "has_more_cyclic_deps=true" >> "$GITHUB_OUTPUT" | ||
echo "diff=$diff" >> "$GITHUB_OUTPUT" | ||
fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Detected
Static analysis flagged trailing spaces on line 103. Please remove the extra whitespace to comply with YAML formatting standards.
Diff suggestion:
-
+
(Ensure there are no spaces after the line break.)
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 103-103: trailing spaces
(trailing-spaces)
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 71, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. |
There was a problem hiding this 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
🧹 Nitpick comments (3)
.github/workflows/ci-client-cyclic-deps-check.yml (3)
58-64
: PR Branch Dependency Count Command
The command usingnpx dpdm
piped into a series ofsed
andsort
commands effectively processes the circular dependency output. Ensure that the sed expressions remain valid as the output format of dpdm might evolve. Also, consider incorporating error-checking for the dpdm command to handle any unforeseen failures.
73-77
: Commented-out Dependency Installation Code
There is an entire section of commented-out code for reinstalling dependencies. Consider removing these comments if they are no longer necessary to keep the workflow file clean and maintainable.
103-103
: Trailing Whitespace Detected
Static analysis flagged trailing whitespace on this line. Please remove any extra spaces to comply with YAML formatting guidelines and avoid linting errors.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 103-103: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/ci-client-cyclic-deps-check.yml
(3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/ci-client-cyclic-deps-check.yml
[error] 103-103: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-lint / client-lint
- GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
- GitHub Check: client-build / client-build
- GitHub Check: client-prettier / prettier-check
🔇 Additional comments (8)
.github/workflows/ci-client-cyclic-deps-check.yml (8)
43-43
: Global dpdm Installation Comment
The comment clearly states that the dpdm package is being installed globally (with a pinned version of 3.14). This is clear and useful for understanding the intent of the step.
48-48
: Install Dependencies Step Annotation
The added comment in the "Install dependencies" step provides clarity on the purpose of the step. The use ofyarn install --immutable
appears consistent with dependency management best practices.
70-71
: Checkout Base Branch Update
Updating the checkout step to use${{ github.event.pull_request.base.ref }}
correctly switches the context from a static release branch to the dynamic base branch. The explicit setting ofclean: false
is noted—please verify that residual workspace changes do not affect subsequent steps.
82-89
: Base Branch Dependency Count Command and Environment Reset
The base branch dependency check mirrors the PR branch step but begins with an explicit removal of thenode_modules
directory. This ensures a clean state, which is good for reproducibility. Double-check that removingnode_modules
does not interfere with other steps that may depend on installed packages later in the workflow.
95-97
: Dependency Comparison Logic
The logic that calculates the difference betweenpr_count
andbase_branch_count
correctly references the updated outputs. The subtraction and conditional check ensure that the workflow only flags an increase in cyclic dependencies. Verify that negative differences (if any) are intentionally ignored by the current if-condition.
104-108
: Diff Saving Step
The step capturing the diff between the base branch and PR circular dependency files is well implemented by using a subshell with a fallback (|| true
). This prevents the step from failing if the diff command returns a non-zero exit code due to no differences.
110-119
: Log Diff in Circular Dependencies
The grep commands in this step extract the removed and added dependencies effectively from the diff output. The approach is clear and the logging is helpful for debugging dependency changes. Consider adding error handling ifdiff.txt
turns out empty, although the current implementation with|| true
provides a safeguard.
128-128
: PR Comment Message Update
The updated message now correctly references the base branch and provides a clear summary of the cyclic dependency changes along with a link to further documentation. This enhances transparency for reviewers and contributors.
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 71, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. |
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 71, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. |
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 71, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. |
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 71, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. |
🔴🔴🔴 Cyclic Dependency Check: This PR has increased the number of cyclic dependencies by 71, when compared with the release branch. Refer this document to identify the cyclic dependencies introduced by this PR. You can view the dependency diff in the run log. |
Description
The CI workflow for cyclic dependency checks has been modified to reference the base branch instead of the release branch.
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=""
🔍 Cypress test results
Warning
Tests have not run on the HEAD fb993f8 yet
Thu, 06 Feb 2025 11:37:50 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Summary by CodeRabbit