Setup Guide — sentry-find-bugs
Generated by melleafy 4.3.2 on 2026-04-30.
§1 Install
From the skill root (skills/sentry-find-bugs/):
pip install -e .Verify the install:
sentry-find-bugs --helpExpected output includes usage: sentry-find-bugs [--diff DIFF] [--output-format {json,text}].
§3 Model backend
This package targets ollama with model granite4.1:3B.
Install and start ollama (if not already running):
# macOS
brew install ollama
ollama serve &
# Pull the required model
ollama pull granite4.1:3BVerify the model is available:
ollama list | grep granite4.1:3BThese values are baked into config.py:
BACKEND = 'ollama'MODEL_ID = 'granite4.1:3B'
To use a different backend or model, edit config.py or re-run melleafy with --backend and --model-id overrides.
§8 Generated stubs to implement
This package was generated in auto mode. Two C6 tool stubs require implementation before the full verification pipeline runs. Without them, the pipeline falls back to diff-only analysis (stubs raise NotImplementedError which is caught and ignored).
constrained_slots.py:search_fn
Source element: elem_013 — spec.md:46 — "Search for existing tests covering the scenario"
Signature: search_fn(pattern: str) -> list[str]
Purpose: Searches the repository for test files or symbols matching pattern. Used in Phase 4 to check whether an existing test already covers a detected vulnerability scenario.
Suggested implementation:
import subprocess
def search_fn(pattern: str) -> list[str]:
result = subprocess.run(
["grep", "-r", "--include=*.py", "-l", pattern, "."],
capture_output=True, text=True
)
return [line.strip() for line in result.stdout.splitlines() if line.strip()]Replace the NotImplementedError body in constrained_slots.py with this implementation (or your preferred search approach).
constrained_slots.py:read_file_fn
Source element: elem_014 — spec.md:47 — "Read surrounding context to verify the issue is real"
Signature: read_file_fn(file_path: str, start_line: int, end_line: int) -> str
Purpose: Reads lines start_line..end_line (1-indexed, inclusive) from file_path. Used in Phase 4 to supply surrounding code context for issue confirmation.
Suggested implementation:
def read_file_fn(file_path: str, start_line: int, end_line: int) -> str:
try:
with open(file_path, "r", encoding="utf-8", errors="replace") as f:
lines = f.readlines()
return "".join(lines[start_line - 1:end_line])
except OSError:
return ""Replace the NotImplementedError body in constrained_slots.py with this implementation.
§9 Fixtures and smoke test
Run fixtures from the skill root:
python -m pytest sentry_find_bugs_mellea/fixtures/ -vOr run individual fixtures:
python -m pytest sentry_find_bugs_mellea/fixtures/positive_sql_injection.py -v
python -m pytest sentry_find_bugs_mellea/fixtures/clean_secure_parameterized.py -vAvailable fixtures:
| Fixture ID | Expected behaviour |
|---|---|
positive_sql_injection |
Detects SQL injection (Critical) in api/views.py |
positive_missing_authz |
Detects Authorization/IDOR (High) in api/admin_actions.py |
clean_secure_parameterized |
Returns no issues — well-written parameterized code |
edge_empty_diff |
Returns empty FindingsReport with no modified files |
edge_comments_only |
Returns no issues — comment-only changes |
mixed_partial_csrf_fix |
Detects CSRF (Medium) on new endpoint; notes webhook exemption is intentional |
Prerequisites for fixtures:
- ollama running with
granite4.1:3Bloaded constrained_slots.pystubs may raiseNotImplementedError— the pipeline handles this gracefully, so fixtures run without implementing stubs