diff --git a/pk-cli/src/main.rs b/pk-cli/src/main.rs index f1cfea6..1e85ee1 100644 --- a/pk-cli/src/main.rs +++ b/pk-cli/src/main.rs @@ -299,17 +299,16 @@ async fn main() -> Result<()> { tags, } = &cli.command { - return run_context( + let request = ContextRequest { query, scopes, - *limit, - *max_candidates, - *max_bytes, - *format, + limit: *limit, + max_candidates: *max_candidates, + max_bytes: *max_bytes, + format: *format, tags, - cli.kb_dir.as_deref(), - ) - .await; + }; + return run_context(request, cli.kb_dir.as_deref()).await; } if let Cmd::Snapshot { scopes } = &cli.command { return run_snapshot(scopes, cli.kb_dir.as_deref()).await; @@ -699,16 +698,27 @@ struct ContextItem { score: f32, } -async fn run_context( - query: &str, - requested_scopes: &[ContextScope], +/// Options for a single `pk context` invocation, borrowed from the parsed CLI. +struct ContextRequest<'a> { + query: &'a str, + scopes: &'a [ContextScope], limit: usize, max_candidates: usize, max_bytes: usize, format: ContextFormat, - required_tags: &[String], - explicit_project_kb: Option<&str>, -) -> Result<()> { + tags: &'a [String], +} + +async fn run_context(request: ContextRequest<'_>, explicit_project_kb: Option<&str>) -> Result<()> { + let ContextRequest { + query, + scopes: requested_scopes, + limit, + max_candidates, + max_bytes, + format, + tags: required_tags, + } = request; let scopes = if requested_scopes.is_empty() { vec![ ContextScope::Project, diff --git a/pk-learning-worker/src/main.rs b/pk-learning-worker/src/main.rs index 801855b..603f121 100644 --- a/pk-learning-worker/src/main.rs +++ b/pk-learning-worker/src/main.rs @@ -1675,6 +1675,9 @@ mod tests { captured_at: "2026-08-03T00:00:00Z".to_owned(), payload_digest: "fixture".to_owned(), scope: LearningScope::Project, + project_id: None, + team_id: None, + role_id: None, attempt: 0, } }