Class: Aidp::Watch::CiLogExtractor
- Inherits:
-
Object
- Object
- Aidp::Watch::CiLogExtractor
- Defined in:
- lib/aidp/watch/ci_log_extractor.rb
Overview
Intelligently extracts relevant failure information from CI logs to reduce token usage when analyzing failures with AI.
Instead of feeding full CI output to AI, this creates a tailored extraction script for each failure type, runs it, and provides only the relevant excerpts.
Constant Summary collapse
- MAX_EXTRACTED_SIZE =
Maximum size for extracted log content (in characters)
10_000
Instance Method Summary collapse
-
#extract_failure_info(check:, check_run_url: nil) ⇒ Hash
Extract relevant failure information from a CI check.
-
#initialize(provider_manager:) ⇒ CiLogExtractor
constructor
A new instance of CiLogExtractor.
Constructor Details
#initialize(provider_manager:) ⇒ CiLogExtractor
Returns a new instance of CiLogExtractor.
19 20 21 |
# File 'lib/aidp/watch/ci_log_extractor.rb', line 19 def initialize(provider_manager:) @provider_manager = provider_manager end |
Instance Method Details
#extract_failure_info(check:, check_run_url: nil) ⇒ Hash
Extract relevant failure information from a CI check
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/aidp/watch/ci_log_extractor.rb', line 28 def extract_failure_info(check:, check_run_url: nil) Aidp.log_debug("ci_log_extractor", "extract_start", check_name: check[:name], has_output: !check[:output].nil?) # If we have structured output from the check, use it if check[:output] && check[:output]["summary"] return extract_from_structured_output(check) end # If we have a check run URL, fetch the logs if check_run_url raw_logs = fetch_check_logs(check_run_url) return extract_from_raw_logs(check: check, raw_logs: raw_logs) if raw_logs end # Fallback: minimal information { summary: "Check '#{check[:name]}' failed", details: check[:output]&.dig("text") || "No additional details available", extraction_method: "fallback" } end |