mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-16 05:17:24 +01:00
Let /ship render its second-model review on its own for PRs over 2 MB again (GST-2632) (#4361)
The standalone render now passes the requested role to the review-size ceiling, so the outside voice keeps its exemption there as it does in the pass manifest. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
3b650356f3
commit
3c15b7210b
3 files changed
+41
-1
No files matched your search
@@ -167,7 +167,7 @@ function render(): number {
|
||||
const sel = base && diffBase ? standaloneSelection(readerKey(role, name), base, diffBase, readers) : { reader: readerKey(role, name), exclude: flag('--exclude'), keep: parseTail(flag('--keep')).filter(s => s !== '--'), disclosure: flag('--disclosure') };
|
||||
const policyItems = parseTail(sel.exclude).filter(s => s.startsWith(':(top,exclude,glob)'));
|
||||
if (base && diffBase) {
|
||||
const over = ceiling('gstack-review-dispatch render', base, out, [sel], diffBase, undefined);
|
||||
const over = ceiling('gstack-review-dispatch render', base, out, [{ ...sel, role }], diffBase, undefined);
|
||||
if (over) { process.stderr.write(over.line + '\n'); return over.exit; }
|
||||
settleExcerpt(sel, diffBase, path.resolve(out));
|
||||
if (role === 'outside-voice') diff = branchDiff(diffBase, sel);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
important: regression
|
||||
---
|
||||
- **/ship's second-model review can be rendered on its own for a PR whose diff is over 2 MB again.** Since the cyber_policy retry change (#4350), the 2 MB review-size ceiling exempts the outside voice by its role, but `gstack-review-dispatch render` built its reader without one, so `render --role outside-voice` on a large PR stopped at `REVIEW_DIFF_TOO_LARGE` instead of writing its brief with a sliced diff. The standalone render now passes the role it was asked for. The ceiling's size, which readers it exempts and the pass manifest's own stages are unchanged, and every other reader on the standalone path is still refused over the ceiling.
|
||||
@@ -185,3 +185,39 @@ describe('every reader path builds its diff from the base policy\'s selection',
|
||||
expect(sub).toBe(root);
|
||||
}, 120_000);
|
||||
});
|
||||
|
||||
describe('the review-size ceiling on a standalone render', () => {
|
||||
/** A plain change beside about 2.5 MB of data with no base policy, so every reader's selection is over the 2 MB ceiling. */
|
||||
function large() {
|
||||
const repo = makeFixtureRepo({ prefix: 'gstack-sel-big-' });
|
||||
repos.push(repo);
|
||||
const files: Record<string, string> = { 'lib/a.ts': 'export const a = 1;\n' };
|
||||
for (let k = 0; k < 6; k++) files['data/t' + k + '.json'] = ('{"x": "' + 'y'.repeat(200) + '"}\n').repeat(2000);
|
||||
commit(repo, files);
|
||||
return { repo, mb: repo.git('merge-base', 'origin/main', 'HEAD') };
|
||||
}
|
||||
|
||||
// Value: protects=the outside voice rendered on its own keeps its exemption from the 2 MB ceiling and gets a sliced diff;
|
||||
// fails_when=render's selection carries no role, so the ceiling's outside-voice exemption never matches and the render
|
||||
// stops at REVIEW_DIFF_TOO_LARGE (#4350 regression, GST-2632); why_new=GST-2632; seam=gstack-review-dispatch render on a
|
||||
// real repository; no_claim=the pass manifest's voices stage
|
||||
test('the outside voice renders over the ceiling with a sliced diff', () => {
|
||||
const { repo, mb } = large();
|
||||
const out = path.join(repo.root, 'ov');
|
||||
const r = render(repo, mb, out, 'outside-voice');
|
||||
expect({ status: r.status, err: r.err }).toEqual({ status: EXIT.ok, err: '' });
|
||||
expect(fs.statSync(path.join(out, 'outside-voice.diff')).size).toBeLessThanOrEqual(REVIEW_DIFF_MAX_BYTES);
|
||||
}, 120_000);
|
||||
|
||||
// Value: protects=every other reader on the same standalone path is still refused over the ceiling; fails_when=the
|
||||
// outside voice's exemption widens to the reader rendered beside it; why_new=GST-2632; seam=gstack-review-dispatch render
|
||||
// on a real repository; no_claim=the wording of the refusal
|
||||
test('a reader that is not the outside voice is still refused over the ceiling', () => {
|
||||
const { repo, mb } = large();
|
||||
const out = path.join(repo.root, 'rt');
|
||||
const r = render(repo, mb, out, 'red-team', ['--findings-file', empty(repo), '--specialists', '1']);
|
||||
expect(r.status).toBe(EXIT.refused);
|
||||
expect(r.err).toContain('REVIEW_DIFF_TOO_LARGE');
|
||||
expect(fs.existsSync(path.join(out, 'red-team.prompt.md'))).toBe(false);
|
||||
}, 120_000);
|
||||
});
|
||||
Reference in new issue
Block a user