Skip to content

Conversation

scastlara
Copy link
Collaborator

@scastlara scastlara commented Sep 5, 2025

Looking at the manual failing cases for GitHub comment suggestions, I saw that we were failing cause the AI was deciding to create the multi-line comment outside of the diff hunk displayed in the diff (see picture). This is not allowed on GitHub.

The AI had no information to make a better decision for this, so I gave it that information in this PR.

The likelyhood of this happening will never be 0 (cause AIs are dumb), but we have a fallback with no suggestions for that scenario. On GitLab, this is not an issue because suggestions are simply markdown, and in the worse case scenario there it renders like a normal code block.

image

closes #97 closes #24

@github-actions github-actions bot added the fix Fixes an issue or a bug label Sep 5, 2025
@scastlara scastlara self-assigned this Sep 5, 2025
Copy link
Contributor

github-actions bot commented Sep 5, 2025

Coverage

Coverage for Python 3.13 •
FileStmtsMissCoverMissing
lgtm_ai/ai
   prompts.py130100% 
lgtm_ai/formatters
   markdown.py470100% 
lgtm_ai/git_parser
   parser.py52296%85–86
TOTAL158711093% 

Tests Skipped Failures Errors Time
188 0 💤 0 ❌ 0 🔥 7.971s ⏱️

Copy link
Contributor

github-actions bot commented Sep 5, 2025

Coverage

Coverage for Python 3.12 •
FileStmtsMissCoverMissing
lgtm_ai/ai
   prompts.py130100% 
lgtm_ai/formatters
   markdown.py470100% 
lgtm_ai/git_parser
   parser.py52296%85–86
TOTAL158711093% 

Tests Skipped Failures Errors Time
188 0 💤 0 ❌ 0 🔥 9.135s ⏱️

@@ -26,5 +26,7 @@
- **File**: `{{ new_path }}`
- **Line**: `{{ line_number }}`
- **Relative line**: `{{ relative_line_number }}`
- **With suggestion**: `{{ 'Yes' if with_suggestion else 'No' }}`
- **Suggestion ready for replacement**: `{{ 'Yes' if is_suggestion_ready else 'No' }}`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New metadata to comments for future debugging.

@github-actions github-actions bot added fix Fixes an issue or a bug and removed fix Fixes an issue or a bug labels Sep 5, 2025
@scastlara scastlara changed the title fix(#97): prevent suggestions on GitHub to start outside of diff hunk fix(#97): prevent suggestions on GitHub from starting outside of diff hunk Sep 6, 2025
@github-actions github-actions bot added fix Fixes an issue or a bug and removed fix Fixes an issue or a bug labels Sep 6, 2025
@scastlara scastlara merged commit a2a3dfb into main Sep 8, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fixes an issue or a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use code suggestions in GitHub Use code suggestions feature instead of just comments
2 participants