Feature chore bug 005 #19

Merged
iamdoubz merged 106 commits from feature_chore_bug_005 into main 2026-07-07 22:02:41 -05:00
Showing only changes of commit 4fc3df504a - Show all commits
+41 -42
View File
@@ -222,6 +222,17 @@ fn context_excerpts(
.collect()
}
/// Transcript-derived inputs `distill` needs — bundled into one struct so the
/// function stays under clippy's argument-count lint rather than taking each
/// field positionally.
struct MeetingContext<'a> {
title: &'a str,
participants: &'a [String],
transcript_md: &'a str,
segments: &'a [TranscriptSegment],
speakers: &'a [SpeakerInfo],
}
/// Core distillation: prompt -> LLM round trip -> parse -> ground. Takes
/// transcript data directly rather than a `MeetingId`, so it needs no
/// `Store` — `LlmFeatureBriefBuilder::build` below is the `Store`-aware
@@ -229,18 +240,14 @@ fn context_excerpts(
async fn distill(
llm: &dyn LlmProvider,
meeting_id: &MeetingId,
meeting_title: &str,
participants: &[String],
target_repo: Option<&str>,
transcript_md: &str,
segments: &[TranscriptSegment],
speakers: &[SpeakerInfo],
ctx: &MeetingContext<'_>,
) -> Result<FeatureBrief, BriefError> {
let (system, user) =
build_brief_messages(meeting_title, participants, target_repo, transcript_md);
build_brief_messages(ctx.title, ctx.participants, target_repo, ctx.transcript_md);
let reply = llm.complete(&system, &user).await?;
let fields = parse_brief(&reply, meeting_title);
let context_excerpts = context_excerpts(&fields, segments, speakers);
let fields = parse_brief(&reply, ctx.title);
let context_excerpts = context_excerpts(&fields, ctx.segments, ctx.speakers);
Ok(FeatureBrief {
id: uuid::Uuid::new_v4().to_string(),
meeting_id: meeting_id.clone(),
@@ -273,17 +280,14 @@ impl FeatureBriefBuilder for LlmFeatureBriefBuilder {
.iter()
.map(|s| s.display_name.clone().unwrap_or_else(|| s.label.clone()))
.collect();
distill(
self.llm.as_ref(),
meeting_id,
&meeting.title,
&participants,
target_repo,
&meeting.notes_markdown,
&meeting.segments,
&meeting.speakers,
)
.await
let ctx = MeetingContext {
title: &meeting.title,
participants: &participants,
transcript_md: &meeting.notes_markdown,
segments: &meeting.segments,
speakers: &meeting.speakers,
};
distill(self.llm.as_ref(), meeting_id, target_repo, &ctx).await
}
}
@@ -501,18 +505,16 @@ mod tests {
.collect::<Vec<_>>()
.join("\n");
let brief = distill(
&llm,
&"m1".to_string(),
"Reporting sync",
&participants,
Some("acme/reporting-web"),
&transcript_md,
&segments,
&speakers,
)
.await
.expect("distill should succeed against the mock provider");
let ctx = MeetingContext {
title: "Reporting sync",
participants: &participants,
transcript_md: &transcript_md,
segments: &segments,
speakers: &speakers,
};
let brief = distill(&llm, &"m1".to_string(), Some("acme/reporting-web"), &ctx)
.await
.expect("distill should succeed against the mock provider");
assert_eq!(brief.meeting_id, "m1");
assert_eq!(brief.title, "Bulk CSV export for the reporting view");
@@ -559,17 +561,14 @@ mod tests {
}
}
let result = distill(
&FailingProvider,
&"m1".to_string(),
"Meeting",
&[],
None,
"transcript",
&[],
&[],
)
.await;
let ctx = MeetingContext {
title: "Meeting",
participants: &[],
transcript_md: "transcript",
segments: &[],
speakers: &[],
};
let result = distill(&FailingProvider, &"m1".to_string(), None, &ctx).await;
assert!(matches!(result, Err(BriefError::Llm(_))));
}
}