-
Notifications
You must be signed in to change notification settings - Fork 107
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
#267: Added intents depth and size limit #543
base: main
Are you sure you want to change the base?
Conversation
WalkthroughWalkthroughThe changes introduce a new mechanism for analyzing and validating the nesting depth of functions within an abstract syntax tree (AST). A dedicated validation function ensures that function calls do not exceed a specified maximum depth, significantly improving code robustness. This is complemented by a set of unit tests that verify the correct implementation of the analysis and validation processes. Changes
Sequence Diagram(s)sequenceDiagram
participant Parser
participant Validator
participant Analyzer
participant AST
Parser->>AST: Generate AST
Parser->>Validator: Validate(AST, MaxNestingDepth)
Validator->>Analyzer: AnalyzeFunctionsNesting(AST)
Analyzer-->>Validator: Return current nesting depth
Validator->>Parser: Return validation result (error or success)
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
This comment has been minimized.
This comment has been minimized.
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
Outside diff range, codebase verification and nitpick comments (1)
shield/internal/validation/validation_test.go (1)
12-24
: Enhance error message for better debugging.Consider adding the input string to the error message for better debugging context.
- require.FailNow(t, "Parser finished with errors", err) + require.FailNow(t, "Parser finished with errors for input: " + input, err)
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (4)
- shield/internal/validation/functions_nesting_analyzer.go (1 hunks)
- shield/internal/validation/validation.go (1 hunks)
- shield/internal/validation/validation_test.go (1 hunks)
- shield/shield.go (2 hunks)
Additional context used
Path-based instructions (4)
shield/internal/validation/validation.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.shield/internal/validation/functions_nesting_analyzer.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.shield/shield.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.shield/internal/validation/validation_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"
Additional comments not posted (12)
shield/internal/validation/validation.go (1)
8-15
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
Validate
match the new logic.Verification successful
LGTM! The function usage in the codebase matches the new logic.
The code changes are approved.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `Validate` match the new logic. # Test: Search for the function usage. Expect: Only occurances of the new logic. rg --type go -A 5 $'Validate'Length of output: 22689
shield/internal/validation/functions_nesting_analyzer.go (5)
7-22
: LGTM!The code changes are approved.
24-30
: LGTM!The code changes are approved.
33-35
: LGTM!The code changes are approved.
38-42
: LGTM!The code changes are approved.
45-46
: LGTM!The code changes are approved.
shield/shield.go (3)
14-14
: LGTM!The code changes are approved.
21-21
: LGTM!The code changes are approved.
33-35
: LGTM!The code changes are approved.
shield/internal/validation/validation_test.go (3)
26-43
: LGTM!The test cases cover various scenarios of function nesting and the function appears to be comprehensive.
45-61
: LGTM!The test cases cover various scenarios where the validation should fail and the function appears to be comprehensive.
63-81
: LGTM!The test cases cover various scenarios where the validation should succeed and the function appears to be comprehensive.
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- CHANGELOG.md (1 hunks)
Additional context used
Path-based instructions (1)
CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"
Additional comments not posted (1)
CHANGELOG.md (1)
45-46
: Entry is clear and follows the changelog format.The new entry under "Consensus Breaking Changes" is clear and adheres to the changelog format. No grammatical errors or ambiguities were found.
for me this doesn't really solve the first point described in #267 the solution would be to stop the parsing if we reach the max depth, while with this implementation does the parsing and then calculates the depth reached - still leading to potential heavyweight transactions i'd put this issue on hold for a second, since Informal Systems is taking a look at our shield language right now, I'll give them a chance to say whether this is a problem and if they have suggestions :) |
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.
marking this as "request changes" to put this on hold
That's a simplest solution I came up with. I think we can discuss it. We actually can gather info about depth and anything else during
Parsing
phase, but I'm not sure about that.#267
Summary by CodeRabbit
New Features
Chores
Tests