-
Notifications
You must be signed in to change notification settings - Fork 47
(Chore): Fix repo tests #1027
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): Fix repo tests #1027
Conversation
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.
Hello @TylerJang27, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request addresses some test failures and updates dependencies. Specifically, it updates Jest snapshots for cfnlint
, pmd
, and squawk
linters, disables caching for semgrep
tests, and bumps the known good version of Node.js from 18.20.5 to 20.19.1, and sourcery from 1.2.0 to 1.4.0.
Highlights
- Snapshot Updates: Jest snapshots for
cfnlint
,pmd
, andsquawk
linters have been updated to reflect changes in their output. - Semgrep Test Modification: The
semgrep
test has been modified to disable caching, likely to ensure consistent test results. - Node.js Version Bump: The known good version of Node.js has been updated from 18.20.5 to 20.19.1 in
runtimes/node/plugin.yaml
andtests/driver/lint_driver.ts
. - Sourcery Version Bump: The known good version of Sourcery has been updated from 1.2.0 to 1.4.0 in
tools/sourcery/plugin.yaml
.
Changelog
Click here to see the changelog
- linters/cfnlint/test_data/cfnlint_v1.35.1_basic.check.shot
- Updated Jest snapshot for
cfnlint
linter.
- Updated Jest snapshot for
- linters/pmd/test_data/pmd_v7.13.0_CUSTOM.check.shot
- Updated Jest snapshot for
pmd
linter.
- Updated Jest snapshot for
- linters/semgrep/semgrep.test.ts
- Disabled caching for
semgrep
tests by adding--cache=false
argument.
- Disabled caching for
- linters/squawk/test_data/squawk_v1.5.3_basic.check.shot
- Removed trunk-upgrade-validation comment.
- linters/squawk/test_data/squawk_v2.4.0_basic.check.shot
- Updated Jest snapshot for
squawk
linter.
- Updated Jest snapshot for
- runtimes/node/plugin.yaml
- Bumped known good version of Node.js from 18.20.5 to 20.19.1.
- tests/driver/lint_driver.ts
- Bumped known good version of Node.js from 18.20.5 to 20.19.1.
- tools/sourcery/plugin.yaml
- Bumped known good version of Sourcery from 1.2.0 to 1.4.0.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
The tests did fail,
Snapshots needed to prevail,
Node version bumped,
Cache was trumped,
Now all the checks set sail.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
The pull request updates snapshots and bumps the node version. The changes seem straightforward and necessary for keeping the tests up-to-date. However, I have a few observations regarding the semgrep test and squawk snapshots.
Summary of Findings
- Semgrep Caching: The
--cache=false
argument in the semgrep test disables caching, which may significantly increase test execution time. Consider adding a comment explaining why caching is disabled or exploring alternative solutions. - Removed trunk-upgrade-validation line: The line
// trunk-upgrade-validation:RELEASE
was removed fromlinters/squawk/test_data/squawk_v1.5.3_basic.check.shot
. Verify that this was intentional. known_good_version
Updates: For allknown_good_version
updates, it would be helpful to add a comment explaining why this version was chosen and what testing was done to validate it.
Merge Readiness
The pull request seems mostly ready for merging, but I recommend addressing the comments regarding semgrep caching and the removed trunk-upgrade-validation line. Adding comments to the known_good_version
updates would also be beneficial. I am unable to approve this pull request, and recommend that others review and approve this code before merging.
customLinterCheckTest({ linterName: "semgrep", args: TEST_DATA, skipTestIf: skipOS(["win32"]) }); | ||
customLinterCheckTest({ | ||
linterName: "semgrep", | ||
args: `${TEST_DATA} --cache=false`, |
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.
Adding --cache=false
disables caching for semgrep. While this ensures the test always fetches the latest rules, it significantly increases test execution time. Consider adding a comment explaining why caching is disabled, or explore alternative solutions like invalidating the cache when necessary. Otherwise, consider removing this argument to improve test performance.
args: `${TEST_DATA} --cache=false`, | |
args: `${TEST_DATA} --cache=false`, // Disables caching to ensure latest rules are always fetched |
Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information. |
Based on the file changes, the PR seems to be focused on updating test snapshots and versions for various linters. The description mentions "aligning snapshots to match the test versions for cleanliness". Since I couldn't retrieve the test logs, I'll make some educated guesses about potential flaky tests based on the changed files. It's possible that the tests for Summary: Root Cause Analysis: Resolution Plan:
Since I cannot access the test logs, the user should investigate the tests mentioned above. Is this helpful? Click the 👍/👎 buttons below to let us know! Icons by Icons8 |
|
tldr; The tests are failing due to snapshot mismatches caused by version changes in the PR. Update the snapshots by running the tests with the Detailed AnalysisSummarySeveral tests are failing with snapshot mismatches. These failures are related to the changes made in this PR, particularly:
Root Cause AnalysisThis is a case of Intentional Code Change where the PR has deliberately updated versions and configurations, but the test snapshots haven't been updated to match the new expected output. The main issues are:
Resolution Plan
These changes are expected when updating dependencies and configurations, and the solution is to update the test snapshots to match the new expected behavior. |
tldr; Your PR is failing because you've updated Node.js and tool versions which has changed the output format of several linters, causing snapshot test failures. You need to update the test snapshots to match the new output format. ## Detailed AnalysisSummaryYour PR #1027 "(Chore): Fix repo tests" is failing several snapshot tests. The failures are related to changes in the output format of various linters after you updated Node.js from v18.20.5 to v20.19.1 and updated the sourcery tool from v1.2.0 to v1.4.0. Root Cause AnalysisThe primary issue is that you've made version updates to Node.js and tools, which has changed the output format of several linters. The test suite compares the current output against stored snapshots, and these snapshots no longer match the new output format. Specifically:
Resolution Plan
Additional Notes
|
f51e438
to
38d5727
Compare
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.
The verbose output of semgrep includes this bit:
Skipped by --include patterns:
• test_data/basic.go
• test_data/element.ts
• test_data/empty_go.go
• test_data/empty_js.js
• test_data/empty_py.py
• test_data/request.py
despite the includes having those exact files. Subsequent runs do not have this problem. I tried getting around this with various flags like --no-git-ignore --verbose
but to no avail. I don't have a more isolate repro handy since this seems to happen only after startup/with fresh test dirs, but it should probs be reported to semgrep eventually
Additional cleanup as follow-up to #1032.
Mostly aligning snapshots to match the test versions for cleanliness. Other notes: