Skip scoring for existing contributors#40
Conversation
Add a lightweight pre-check that short-circuits the full scoring pipeline when the PR author already has merged PRs in the target repo. This avoids fetching all PRs and building a contribution graph for established contributors. - Add EXISTING_CONTRIBUTOR trust level to TrustLevel enum - Add skip_known_contributors config field (default: true) with GOOD_EGG_SKIP_KNOWN_CONTRIBUTORS env var override - Add check_existing_contributor() GraphQL method on GitHubClient - Short-circuit in score_pr_author() and action entry point - Add --force-score CLI flag and force_score MCP parameter - Handle new trust level in all formatters (markdown, CLI, check run) - Add skip-known-contributors action input and skipped output
🥚 Better Egg: HIGH TrustScore: 80% Score Breakdown
Top Contributions
|
Summary of ChangesHello @jeffreyksmithjr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant optimization to the trust scoring system by recognizing and handling existing contributors more efficiently. By performing a quick check for prior merged pull requests, the system can now bypass the extensive scoring process for trusted users, leading to faster results and reduced resource consumption. This enhancement improves the overall user experience for established contributors while maintaining the integrity of the trust assessment for new or less familiar users. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable optimization by skipping the full scoring pipeline for existing contributors. The implementation is comprehensive, adding new configuration options, API parameters, and updating all output formats. The changes are also well-covered by new tests.
I've identified a couple of areas for improvement:
- There's some code duplication for the scoring logic that could be refactored for better maintainability.
- There's an opportunity to improve type safety when parsing GraphQL responses to make the code more robust.
Overall, this is a solid contribution that improves the efficiency of the tool. My comments are aimed at further improving the code's long-term quality.
Good Egg eats its own dogfood, so always run full scoring to exercise the complete pipeline on every PR.
- Eliminate scoring logic duplication: action.py now calls score_pr_author() instead of reimplementing the short-circuit inline. The skipped flag is derived from score.flags. - Replace search-based GraphQL query with repository.pullRequests filterBy, which is a single-field query and more efficient. - Use isinstance checks instead of type:ignore for GraphQL response parsing in check_existing_contributor. - Extract _existing_contributor_context() helper in formatter.py to share PR count / plural logic across all three format functions. - Set scoring_model on the skipped TrustScore so it reflects the configured model rather than defaulting to v1. - Add boundary test for count == 1 in check_existing_contributor. - Update docs: github-action.md, configuration.md, library.md, mcp-server.md, README.md, CLAUDE.md, examples/.good-egg.yml.
- Action "Acting on Trust Level" example now treats EXISTING_CONTRIBUTOR the same as HIGH for auto-approve - Library usage example and docs check scoring_skipped flag before printing score/PR fields that would be zero when skipped
Summary
EXISTING_CONTRIBUTORtrust level,skip_known_contributorsconfig toggle (default: true),--force-scoreCLI flag, andforce_scoreMCP parameterCloses #39
Test plan
uv run ruff check src/ tests/ scripts/passesuv run mypy src/good_egg/passesuv run pytest --cov=good_egg -v— 293 tests pass, 94% coverage