ai-summary: move crash/timeout detection regexes to analysis.yaml#135
Open
ppetrovicTT wants to merge 1 commit into
Open
ai-summary: move crash/timeout detection regexes to analysis.yaml#135ppetrovicTT wants to merge 1 commit into
ppetrovicTT wants to merge 1 commit into
Conversation
2e5019d to
b881057
Compare
has_crash / has_timeout patterns were hardcoded in extract.py. Move them to analysis.yaml under detection_patterns (groups: crash, crash_python, crash_killed, timeout), so projects can extend each group additively like test_patterns. extract_log() falls back to the bundled set when none is passed, keeping direct callers unchanged. Behavior-neutral — a golden test locks the bundled patterns to the previous literals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
b881057 to
2cd0ec4
Compare
Contributor
There was a problem hiding this comment.
✅ Ready to approve
Only a minor documentation nit was found; the functional refactor is behavior-locked by a golden test and well-covered by new and existing tests.
Note: this review does not count toward required approvals for merging.
Pull request overview
This PR refactors has_crash / has_timeout detection in the ai_job_summary tool by moving the hardcoded regex literals out of extract.py and into config/analysis.yaml, while keeping behavior stable and making the patterns project-extensible via config overlays.
Changes:
- Added a new
detection_patternssection toconfig/analysis.yamlwith grouped regexes (crash, crash_python, crash_killed, timeout). - Updated
extract_log()to accept optionaldetection_patternsand to default to the bundled config when not provided. - Added a new test suite (
test_detection_patterns.py) to golden-lock the bundled patterns and validate overlay and case-sensitivity behavior.
File summaries
| File | Description |
|---|---|
.github/actions/ai_summary/tool/ai_job_summary/tests/test_detection_patterns.py |
Adds golden + behavior tests ensuring detection patterns remain behavior-neutral and overlays work additively. |
.github/actions/ai_summary/tool/ai_job_summary/extract.py |
Switches crash/timeout detection to config-driven regex groups and adds a cached default loader. |
.github/actions/ai_summary/tool/ai_job_summary/config/analysis.yaml |
Introduces the bundled detection_patterns groups used by extraction. |
.github/actions/ai_summary/tool/ai_job_summary/config.py |
Adds additive merge behavior for detection_patterns in project overlays and ensures the key is always present. |
.github/actions/ai_summary/tool/ai_job_summary/cli.py |
Passes merged detection_patterns from loaded config into extract_log(). |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 1
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+357
to
360
| detection_patterns: dict | None = None, | ||
| ) -> ExtractedLog: | ||
| """ | ||
| Extract important parts from a CI log. |
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.
Stacked on #134.
What
has_crash/has_timeoutdetection regexes were hardcoded inextract.py. This moves them intoanalysis.yamlunder a newdetection_patternssection, with four groups preserving the original case-sensitivity:crashTT_FATAL,panic,SIGSEGV, …)crash_pythoncrash_killed<PID> Killed,SIGKILL,SIGTERM)timeoutProjects extend each group additively (same model as
test_patterns).extract_log()falls back to the bundled set when none is passed, so direct callers (and the existing extraction tests) are unchanged.Behavior-neutral
A golden test asserts the bundled
detection_patternsequal the exact pre-refactor literals. The existing fixture-based extraction tests (which exercise crash/timeout on real logs) all still pass.Testing
test_detection_patterns.py: golden lock, case-sensitivity per group, lookbehind, additive overlay, custom-pattern detection.🤖 Generated with Claude Code