feat(guardian): polish AI code reviewer — ruff/mypy clean, real Gemini API#80
Merged
Conversation
- Add missing __init__.py for guardian and providers packages
- Fix all type annotations (-> None on __init__ methods)
- Fix TRY300: move return to else branch in collector.get_git_diff
- Fix RET504: inline returns in core.run_review
- Fix ARG002: remove unused system_prompt from mock base provider
- Fix EM101/TRY003: extract error message to variable in gemini provider
- Implement real google-generativeai API (lazy import, async call)
- Fix git diff to use origin/{base}...HEAD for proper branch comparison
- Add base_branch param to ContextCollector
- Remove duplicate GeminiProvider from base.py (keep only ABC)
- Add mypy override for optional google.* dependency
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
GuardianReviewer is library code — removed print from run_review. guardian_review.py now logs progress via structlog and owns the UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…comment - Triggers on issue_comment when body is exactly '/guardian review' on a PR - Validates PR number format before using in git ref (injection hardening) - Runs guardian_review.py with GEMINI_API_KEY secret - Posts result as PR comment via peter-evans/create-or-update-comment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add module-level docstrings to all guardian modules - Add method docstrings to __init__ and generate_content - Add commenter write-access gate to guardian.yml (Pwn Request fix) - Pin all third-party actions to full commit SHAs - Use structlog in guardian_review.py, remove prints from library code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…odel - guardian_review.py now accepts --output path and writes markdown directly to guardian_report.md, eliminating the fragile tail -n +4 stdout parsing - workflow uses body-path: guardian_report.md — special chars in review output can no longer break the GHA heredoc or GITHUB_OUTPUT multiline encoding - GeminiProvider default model: gemini-1.5-pro → gemini-2.0-flash Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
google-generativeaiasync API (was mock placeholder)__init__.pyfiles so the package is importableorigin/{base}...HEADinstead ofgit diff HEADbase_branchparameter toContextCollectorgoogle.*dep (installed viauv sync --extra guardian)Test plan
make format && make lint && make type-check— all pass (226 tests green)GEMINI_API_KEY=... uv run python scripts/guardian_review.pyon a feature branch to smoke-test the real API pathuv sync --extra guardianinstallsgoogle-generativeaicorrectly🤖 Generated with Claude Code