Skip to content

Commit 3ffc369

Browse files
run release build on this branch
1 parent 3272e7b commit 3ffc369

File tree

4 files changed

+466
-0
lines changed

4 files changed

+466
-0
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- release/**
7+
# Make release builds so we can test the PoC
8+
pull_request:
79

810
jobs:
911
linux:

dev-docs/implementation-notes.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Implementation Notes: `sentry-cli review` Command
2+
3+
This document captures implementation details, edge cases, and notes for the `sentry-cli review` PoC.
4+
5+
## Current Implementation
6+
7+
The `review` command sends the diff of the most recent commit (HEAD vs HEAD~1) to Sentry's bug prediction API for AI-powered code review.
8+
9+
### Endpoint
10+
11+
`POST /api/0/bug-prediction/cli/`
12+
13+
### Request Format
14+
15+
```json
16+
{
17+
"remote_url": "[email protected]:owner/repo.git",
18+
"base_commit_sha": "abc123...",
19+
"diff": "<unified diff output>"
20+
}
21+
```
22+
23+
### Response Format
24+
25+
```json
26+
{
27+
"predictions": [
28+
{
29+
"file_path": "src/example.rs",
30+
"line_number": 42,
31+
"description": "Potential null pointer dereference",
32+
"severity": "high",
33+
"suggested_fix": "Add null check before accessing"
34+
}
35+
]
36+
}
37+
```
38+
39+
## Edge Cases
40+
41+
### Handled (with errors)
42+
43+
| Edge Case | Behavior |
44+
|-----------|----------|
45+
| Initial commit (no parent) | Error: "HEAD has no parent commit - cannot review initial commit" |
46+
| Merge commits | Error: "HEAD is a merge commit. Merge commits are not supported for review." |
47+
| Large diffs (>500KB) | Error with size details |
48+
| No remote configured | Error: "No remote URL found for 'origin' or 'upstream'" |
49+
| Empty diff | Error: "No changes found between HEAD and HEAD~1" |
50+
| Not in a git repository | Error: "Failed to open git repository from current directory" |
51+
52+
### Handled (silently)
53+
54+
| Edge Case | Behavior |
55+
|-----------|----------|
56+
| Binary files in diff | Skipped (not included in diff) |
57+
58+
### Not Handled (future work)
59+
60+
| Edge Case | Notes |
61+
|-----------|-------|
62+
| Detached HEAD state | Currently works (uses commit SHA) but could be more user-friendly |
63+
| Rate limiting | No retry logic or rate limit handling |
64+
| Network timeouts | Uses 10-minute timeout, no retry on failure |
65+
| Partial/interrupted response | No streaming support |
66+
| Multiple remotes | Currently only checks "origin" then "upstream" |
67+
| Shallow clones | May fail if parent commit is not available |
68+
69+
## Configuration
70+
71+
| Setting | Value | Notes |
72+
|---------|-------|-------|
73+
| Timeout | 10 minutes | API response expected to take a long time |
74+
| Max diff size | 500 KB | Per API spec |
75+
76+
## API Changes
77+
78+
Added `with_timeout()` method to `ApiRequest` in `src/api/mod.rs` to support long-running requests.
79+
80+
## Future Considerations
81+
82+
1. **Selecting commits to review**: Currently reviews HEAD vs HEAD~1. Future versions could allow specifying a commit range or reviewing uncommitted changes.
83+
84+
2. **Output formats**: Currently outputs human-readable text. Future versions could support JSON output for machine consumption.
85+
86+
3. **Integration with CI**: Could add options for failing the build based on severity of issues found.
87+
88+
4. **Caching**: Could cache results for the same commit SHA to avoid redundant API calls.

dev-docs/poc.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
The idea is to do a fast PoC, throw away code is OK. To see what we can put together and learn from it. Test the idea out there via GitHub discussion/Discord/Twitter (I'm curious what the community will say/react).. and then we can make a proper plan of how we'd do this "for real"
2+
the story is: Skill that instructs your coding agent to "check with Sentry for bugs" before opening a PR. So your agent still commits locally, but then calls sentry-cli with the diff, and automatically works on the review comments
3+
4+
Goals:
5+
6+
Understand what changes will be needed for the ideal design in the backend
7+
8+
Authentication alternatives
9+
10+
Async vs sync workflows
11+
12+
Rate limiting
13+
14+
Accessing the source code to run the full bug prediction server-side
15+
16+
Assess if the sentry-cli is the right choice. Some trade offs to take into account:
17+
18+
Pros:
19+
20+
sentry-cli is the CLI of Sentry. That's easier for customers to understand
21+
22+
Already has auth built-in
23+
24+
Battle tested, security reviews
25+
26+
Already in customers machines, bundled via build plugins etc.
27+
28+
Cons:
29+
30+
Build servers download the CLI and its size impact build times. Customers are sensitive to the CLI ever growing size
31+
32+
Doesn't require a completely new implementation of CLI, documentation, new repo/release flows, security review, transport and authentication
33+
34+
The main use case of the CLI today is to run in build servers (release, sourcemap/debug file upload) or production servers ( send-event, cron and log capture). By adding PR review we're adding a development time workflow

0 commit comments

Comments
 (0)