Skip to content

ai-summary: move crash/timeout detection regexes to analysis.yaml#135

Open
ppetrovicTT wants to merge 1 commit into
mainfrom
ppetrovic/ai-summary-detection-patterns-yaml
Open

ai-summary: move crash/timeout detection regexes to analysis.yaml#135
ppetrovicTT wants to merge 1 commit into
mainfrom
ppetrovic/ai-summary-detection-patterns-yaml

Conversation

@ppetrovicTT

Copy link
Copy Markdown
Contributor

Stacked on #134.

What

has_crash / has_timeout detection regexes were hardcoded in extract.py. This moves them into analysis.yaml under a new detection_patterns section, with four groups preserving the original case-sensitivity:

group case purpose
crash insensitive tt-metal/native (TT_FATAL, panic, SIGSEGV, …)
crash_python sensitive uncaught Python errors + pytest collection errors
crash_killed sensitive bash signal-death (<PID> Killed, SIGKILL, SIGTERM)
timeout insensitive timeout events (past tense), not config values

Projects 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_patterns equal the exact pre-refactor literals. The existing fixture-based extraction tests (which exercise crash/timeout on real logs) all still pass.

Testing

  • New test_detection_patterns.py: golden lock, case-sensitivity per group, lookbehind, additive overlay, custom-pattern detection.
  • Full suite: 245 passed.

🤖 Generated with Claude Code

@ppetrovicTT ppetrovicTT requested a review from a team as a code owner June 15, 2026 15:12
@ppetrovicTT ppetrovicTT force-pushed the ppetrovic/ai-summary-detection-patterns-yaml branch from 2e5019d to b881057 Compare June 17, 2026 08:35
@ppetrovicTT ppetrovicTT changed the base branch from ppetrovic/ai-summary-log-finish-line to main June 17, 2026 08:35
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>
Copilot AI review requested due to automatic review settings June 17, 2026 08:42
@ppetrovicTT ppetrovicTT force-pushed the ppetrovic/ai-summary-detection-patterns-yaml branch from b881057 to 2cd0ec4 Compare June 17, 2026 08:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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_patterns section to config/analysis.yaml with grouped regexes (crash, crash_python, crash_killed, timeout).
  • Updated extract_log() to accept optional detection_patterns and 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants