Skip to content

Prop based intent - #14

Closed
haddybhaiya wants to merge 3 commits into
mainfrom
prop-based-intent
Closed

Prop based intent#14
haddybhaiya wants to merge 3 commits into
mainfrom
prop-based-intent

Conversation

@haddybhaiya

Copy link
Copy Markdown
Member

No description provided.

actions-user and others added 3 commits April 1, 2026 16:25
Co-authored-by: deoxyforge dipudeeva@gmail.com
Co-authored-by: deoxygfx dipudeeva@gmail.com
 Co-authored-by: Dipesh Kumar dipudeeva@gmail.com
@haddybhaiya haddybhaiya closed this Apr 1, 2026
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

Automated Code Review Comment:

Bugs

  • The infer_intent function does not handle cases where the model's response is not in the expected JSON format.
  • The generate_tests function does not validate if the intent parameter is a valid dictionary before trying to access its keys.
  • The generate_review function is not included in the diff, but it is called in the context. It should be reviewed for any potential bugs.

Improvements

  • The code quality can be improved by adding type hints for the function parameters and return types.
  • The code can be made more readable by adding comments to explain the purpose of each section.
  • The INTENT_PROMPT can be refactored to make it more flexible and reusable.

Suggestions

  • Consider adding logging to handle exceptions and errors in a more robust way.
  • The generate_tests function can be optimized by using a more efficient way to extract the code from the markdown.
  • The code can be made more maintainable by breaking down long functions into smaller, more manageable functions.
  • Consider using a linter to enforce code style and catch potential bugs.

Overall, the code looks good ✅. However, addressing the mentioned bugs and improvements can make the code more robust and maintainable.


Suggested Tests

def test_infer_intent_empty_diff():
assert infer_intent("") == {"purpose": "", "properties": [], "edge_cases": [], "error": ""}

def test_infer_intent_short_diff():
diff = "diff --git a/file.py b/file.py"
intent = infer_intent(diff)
assert "purpose" in intent
assert "properties" in intent
assert "edge_cases" in intent

def test_infer_intent_long_diff():
diff = "diff --git a/file.py b/file.py" * 10000
intent = infer_intent(diff)
assert "purpose" in intent
assert "properties" in intent
assert "edge_cases" in intent

def test_generate_tests_no_context_no_intent():
diff = "diff --git a/file.py b/file.py"
tests = generate_tests(diff)
assert tests.strip() != ""

def test_generate_tests_with_context_and_intent():
diff = "diff --git a/file.py b/file.py"
context = ["context1", "context2"]
intent = {"purpose": "test", "properties": ["prop1", "prop2"], "edge_cases": ["case1", "case2"]}
tests = generate_tests(diff, context, intent)
assert tests.strip() != ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants