fix: handle LLM issue_type output variations#22
Conversation
LLMs return various forms (bugs, security, etc.) that don't match the strict enum variants. Switch issue_type to Option<String> with serde aliases for both 'type' and 'issue_type' JSON fields. Also adds from_str_lossy() for manual parsing when needed.
|
Warning Review limit reached
More reviews will be available in 37 minutes and 43 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* perf: resolve scan/review pipeline performance bottlenecks (P2) Fix 10 performance issues — all 'repeated work in loops' patterns: #41 - Pre-compile regex patterns once per rule instead of per line #5 - Batch DB queries in handle_find_affected_tests (single IN clause) #13 - Batch symbol fetch for Affected command (single query) #14 - Prepare SQL statement once outside test-pattern loop #59 - Early cutoff in secrets scanner when max_findings reached #70 - Break out of all loops when symbol cap hit per file #67 - Cache file reads during sibling search in resolver #3 - Reuse single Tokio runtime for MCP tool calls (static LazyLock) #22 - Static LazyLock regexes in detect_function_entry #24 - Single transaction for prune_deleted instead of per-file Refs #335 * fix(ci): resolve clippy + security audit failures - clippy: remove redundant borrow in format! arg (llm.rs:456 &user_prompt) - security: bump anyhow 1.0.102 -> 1.0.103 (RUSTSEC-2026-0190, downcast_mut unsoundness) - security: bump crossbeam-epoch 0.9.18 -> 0.9.20 (RUSTSEC-2026-0204, fmt::Pointer null deref) Refs #335 --------- Co-authored-by: ajianaz <ajianaz@users.noreply.github.com>
Problem
LLMs return issue_type values like
bugs(plural) instead ofbug, which fails enum deserialization.Fix
issue_typefromOption<IssueType>toOption<String>typeandissue_typeJSON keysfrom_str_lossy()helper for manual parsingVerified