From 276545fb45d170a8fd28e860b08a7b9e8bca7e11 Mon Sep 17 00:00:00 2001 From: atlas Date: Thu, 15 Oct 2026 10:24:26 +0200 Subject: [PATCH] review-classifier: say the 25-line context shows a gate only when it's within 25 lines --- docs/swarm/review-classifier.md | 7 ++++--- swarm-controller/src/forge/pull_diff.rs | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/swarm/review-classifier.md b/docs/swarm/review-classifier.md index e2f0a342..4ded2895 100644 --- a/docs/swarm/review-classifier.md +++ b/docs/swarm/review-classifier.md @@ -289,9 +289,10 @@ 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 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 +rather than the 3 of the forge's `.diff`. An enclosing gate, such as a +`config = lib.mkIf …` or an option's `default`, is in view when it is within +25 lines of the change, so a move that restates it doesn't read as adding one. +A gate further away is still out of view. The controller sends the forge's `.diff` instead when the PR changes more than 100 files, when the forge names no merge base, when reading a changed file fails, or when the wide diff is over 256 KiB. The review then says so, with diff --git a/swarm-controller/src/forge/pull_diff.rs b/swarm-controller/src/forge/pull_diff.rs index 15456697..79b397ea 100644 --- a/swarm-controller/src/forge/pull_diff.rs +++ b/swarm-controller/src/forge/pull_diff.rs @@ -1,8 +1,8 @@ //! The diff the review classifier reads, built from both sides of each //! changed file rather than taken from the forge's `.diff`, whose context is -//! fixed at 3 lines. With [`CONTEXT_LINES`] of context a moved block keeps -//! its enclosing gate (a `config = lib.mkIf …`, an option's `default`) in -//! view, so a move that restates that gate does not read as adding one. +//! fixed at 3 lines. [`CONTEXT_LINES`] of context shows an enclosing gate (a +//! `config = lib.mkIf …`, an option's `default`) only when it is within that +//! many lines of the change; a gate further away is still out of view. use std::fmt::{self, Write as _};