tooling: add deterministic CI state classifier command#4605
tooling: add deterministic CI state classifier command#4605davidahmann wants to merge 2 commits intogoogle:mainfrom
Conversation
Summary of ChangesHello @davidahmann, 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 addresses the issue of inconsistent interpretation of CI statuses across contributor workflows by introducing a new Python script. This script provides a standardized, machine-readable classification of GitHub PR checks into a set of deterministic states, which is crucial for reliable cross-repository automation and routing based on CI outcomes. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
|
Implemented issue #4604 by adding \ with deterministic CI state categories, fixture/live modes, and self-test coverage. Validation: self-test passed and changed-file \ passed. This contribution was informed by patterns from Wrkr. Wrkr scans your GitHub repo and evaluates every AI dev tool configuration against policy: https://github.com/Clyra-AI/wrkr |
There was a problem hiding this comment.
Code Review
The pull request introduces a new Python script ci_state_classifier.py to deterministically classify GitHub PR checks into states like passed, failed, pending, no_checks, and policy_blocked. The script is well-structured, includes self-tests, and handles both fixture and live data modes. Type hints are used effectively, and the overall logic for classification appears sound. I've identified a couple of minor improvements related to code clarity and error messaging that would enhance the script's robustness and maintainability.
| return payload | ||
| raise ValueError("Expected JSON list or object with statusCheckRollup list") |
There was a problem hiding this comment.
The or [] after payload.get("statusCheckRollup", []) is redundant. The get method with a default value already handles cases where the key is missing or its value is None by returning the default empty list.
| return payload | |
| raise ValueError("Expected JSON list or object with statusCheckRollup list") | |
| return payload.get("statusCheckRollup", []) |
| return rollup | ||
| if isinstance(payload, list): | ||
| return payload | ||
| raise ValueError("Expected JSON list or object with statusCheckRollup list") |
There was a problem hiding this comment.
The ValueError message could be more informative by including the actual type or structure of the payload that caused the error. This would greatly assist in debugging unexpected input formats.
| raise ValueError("Expected JSON list or object with statusCheckRollup list") | |
| raise ValueError(f"Expected JSON list or object with statusCheckRollup list, but found {type(payload).__name__}") |
|
Implementation summary: added scripts/ci_state_classifier.py with deterministic classifications and self-test. Validation: classifier self-test passed and changed-file pyink check passed for the added script. This contribution was informed by patterns from Wrkr. Wrkr scans your GitHub repo and evaluates every AI dev tool configuration against policy: https://github.com/Clyra-AI/wrkr |
Problem
Contributor workflows currently interpret CI status inconsistently, including
no checksand policy blockers.Why Now
Cross-repo execution depends on normalized state categories for deterministic routing.
What Changed
scripts/ci_state_classifier.py.passed,failed,pending,no_checks,policy_blocked.Validation
python3 scripts/ci_state_classifier.py --self-test✅uv run pyink --check --diff scripts/ci_state_classifier.py✅Refs #4604