Results PRs with large agent transcripts can be reviewed again (GST-3273) (#4574)

Results PRs that commit captured agent sessions no longer stop at the 2
MB review limit: a data file kept in review only because a session
quotes a lint pragma, an env check or a `--no-verify` push now reaches
readers as those lines with context.

Why: harness-evals#494 (25 transcripts, 11.3 MB) could not be reviewed
at all. Only a strict set of files is cut, so anything in doubt still
goes to readers whole.

Nothing to do: the gate review still runs, and the change follows the
review policy you already have.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-20 21:34:22 +00:00
1 parent 593d7e1634
commit ad65f62edf
12 files changed
+468 -52

No files matched your search

+4 -3
View File
@@ -212,13 +212,14 @@ export function unquoteGitPath(p: string): string {
return Buffer.from(bytes).toString('utf-8');
}
/** A ---/+++ path; the caller drops the tab git appends after an unquoted name holding a space. */
function stripPrefix(p: string, prefix: 'a/' | 'b/'): string {
const u = unquoteGitPath(p);
return u.startsWith(prefix) ? u.slice(2) : u;
}
/** Split `diff --git a/x b/y` into (x, y); equal paths resolve exactly, renames with spaces fall back to the middle ` b/`. */
function splitDiffGitLine(rest: string): [string, string] {
export function splitDiffGitLine(rest: string): [string, string] {
if (rest.startsWith('"')) {
const m = /^("(?:[^"\\]|\\.)*") ("(?:[^"\\]|\\.)*")$/.exec(rest);
if (m) return [stripPrefix(m[1], 'a/'), stripPrefix(m[2], 'b/')];
@@ -284,8 +285,8 @@ function sectionToFile(sec: Section): FileDiff {
else if (h.startsWith('copy to ')) { newPath = unquoteGitPath(h.slice(8)); status = 'copied'; }
else if (h.startsWith('new file mode')) status = 'added';
else if (h.startsWith('deleted file mode')) status = 'deleted';
else if (h.startsWith('--- ') && !h.startsWith('--- /dev/null')) oldPath = stripPrefix(h.slice(4), 'a/');
else if (h.startsWith('+++ ') && !h.startsWith('+++ /dev/null')) newPath = stripPrefix(h.slice(4), 'b/');
else if (h.startsWith('--- ') && !h.startsWith('--- /dev/null')) oldPath = stripPrefix(h.slice(4).replace(/\t$/, ''), 'a/');
else if (h.startsWith('+++ ') && !h.startsWith('+++ /dev/null')) newPath = stripPrefix(h.slice(4).replace(/\t$/, ''), 'b/');
if (/\b120000\b/.test(h) && /mode/.test(h)) unsupported = 'symlink';
if (/^index [0-9a-f]+\.\.[0-9a-f]+ 160000$/.test(h) || /\b160000\b/.test(h) && /mode/.test(h)) unsupported = 'submodule';
if (h.startsWith('Binary files ')) unsupported = unsupported ?? 'binary';
+18 -2
View File
@@ -103,8 +103,8 @@ function anyMatch(lines: string[], idioms: RegExp[]): boolean {
return lines.some((l) => idioms.some((re) => re.test(l)));
}
/** Multi-line empty catch / `except:` + `pass` across consecutive added lines. */
function swallowsAcrossLines(adds: string[]): boolean {
/** Multi-line empty catch / `except:` + `pass` across consecutive added lines: the one detector off the floor that reads more than one added line. */
export function swallowsAcrossLines(adds: string[]): boolean {
for (let i = 0; i + 1 < adds.length; i++) {
const a = adds[i].trim();
const b = adds[i + 1].trim();
@@ -274,6 +274,22 @@ export function tagHunk(h: Hunk, ctx: TagContext): TagResult {
return { tags: sorted, notes, citation: sorted.length ? findCitation(adds) : null };
}
/** Every idiom one added line can carry a tag by on its own (the floor-free part of tagHunk): where a tagged line's matches sit. */
const LINE_IDIOMS = [...SKIP_IDIOMS, ...PLACEHOLDER_IDIOMS, ...ENV_SNIFF_IDIOMS, ...SUPPRESSION_IDIOMS, ...BYPASS_IDIOMS, ...SWALLOW_SINGLE_LINE].map((r) => new RegExp(r.source, r.flags.includes('g') ? r.flags : r.flags + 'g'));
/**
* The tags one added line carries alone, outside the floor (tagHunk on a one-line hunk), and the spans its idioms matched:
* what a gate-tagged data excerpt shows (lib/review-secret-excerpt.ts, GST-3273). A tag no single line carries (RH-1's
* removed declarations, RH-3, RH-15, RH-16 across lines) never appears here, so a file holding one is never cut.
*/
export function lineTags(text: string, path: string): { tags: string[]; spans: Array<[number, number]> } {
const tags = tagHunk({ header: '', lines: [{ kind: 'add', text }] }, { floor: null, path, allPaths: new Set([path]) }).tags;
if (!tags.length) return { tags, spans: [] };
const spans: Array<[number, number]> = [];
for (const r of LINE_IDIOMS) for (const m of text.matchAll(r)) if (m[0]) spans.push([m.index ?? 0, (m.index ?? 0) + m[0].length]);
return { tags, spans };
}
/** RH ids in numeric order; a `?` variant follows its base. */
export function compareTags(a: string, b: string): number {
const num = (t: string) => Number.parseInt(t.replace(/^RH-/, ''), 10);