diff --git a/docs/swarm/review-classifier.md b/docs/swarm/review-classifier.md index 73054e05..e2f0a342 100644 --- a/docs/swarm/review-classifier.md +++ b/docs/swarm/review-classifier.md @@ -288,7 +288,7 @@ description and the task to classify the PR against it. The identical prefix lets the runtime's prompt cache reuse it across questions. The controller builds the diff itself, from each changed file at the PR's -merge base and at its head, with 200 lines of context around each change +merge base and at its head, with 25 lines of context around each change rather than the 3 of the forge's `.diff`. That keeps a moved block's enclosing gate in view, such as a `config = lib.mkIf …` or an option's `default`, so a move that restates the gate doesn't read as adding one. The diff --git a/swarm-controller/src/forge/pull_diff.rs b/swarm-controller/src/forge/pull_diff.rs index 406929fe..15456697 100644 --- a/swarm-controller/src/forge/pull_diff.rs +++ b/swarm-controller/src/forge/pull_diff.rs @@ -10,9 +10,10 @@ use std::time::Duration; use similar::TextDiff; -/// Lines of context around each change. In this repo's Nix modules a block's -/// enclosing `config = lib.mkIf …` sits up to 191 lines above it. -pub const CONTEXT_LINES: usize = 200; +/// Lines of context around each change. A block's enclosing +/// `config = lib.mkIf …` is in view when it opens within this many lines above +/// the block. +pub const CONTEXT_LINES: usize = 25; /// The largest wide diff sent, in bytes, about 64k tokens of code. A larger /// one gives way to the forge's `.diff`. @@ -172,8 +173,8 @@ mod tests { change("nix/host-modules/glue-nats-wireguard.nix", None, Some(glue)), change( "nix/host-modules/swarm-nats.nix", - Some(&module(47, true)), - Some(&module(47, false)), + Some(&module(20, true)), + Some(&module(20, false)), ), ] } diff --git a/swarm-controller/src/review_classifier/review.rs b/swarm-controller/src/review_classifier/review.rs index a771befc..5e698ec0 100644 --- a/swarm-controller/src/review_classifier/review.rs +++ b/swarm-controller/src/review_classifier/review.rs @@ -2033,7 +2033,7 @@ mod tests { let body = narrowed(reason(), true).await; assert!( body.ends_with( - "\nThe classifier read the forge's diff, with 3 lines of context, not 200: \ + "\nThe classifier read the forge's diff, with 3 lines of context, not 25: \ the PR changes 101 files.\n" ), "{body}"