Extract the finding portion from a learning line. Given `"- src/auth.rs:42 — Wrong timezone [bug]"`, returns `"Wrong timezone"`. Given `"- Auth uses RS256"`, returns `"Auth uses RS256"`.
(line: &str)
| 285 | /// Given `"- src/auth.rs:42 — Wrong timezone [bug]"`, returns `"Wrong timezone"`. |
| 286 | /// Given `"- Auth uses RS256"`, returns `"Auth uses RS256"`. |
| 287 | fn extract_finding(line: &str) -> String { |
| 288 | let stripped = line.strip_prefix("- ").unwrap_or(line); |
| 289 | |
| 290 | // Code learnings have " — " separator |
| 291 | if let Some(idx) = stripped.find(" — ") { |
| 292 | let after = &stripped[idx + 4..]; // skip " — " |
| 293 | // Strip category suffix like " [bug]" |
| 294 | if let Some(bracket) = after.rfind(" [") { |
| 295 | return after[..bracket].trim().to_string(); |
| 296 | } |
| 297 | return after.trim().to_string(); |
| 298 | } |
| 299 | |
| 300 | // Repo/workflow learnings are just the text |
| 301 | stripped.trim().to_string() |
| 302 | } |
| 303 | |
| 304 | // Deduplication |
| 305 |