mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-19 14:44:44 +01:00
fix: keep every review_exclude_paths candidate when the gate scan is unknown; docs example names its version
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
7e226680d1
commit
31fb896ca1
4 files changed
+24
-6
No files matched your search
@@ -8,7 +8,8 @@ import { spawnSync } from 'node:child_process';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { EXIT } from '../lib/headless-artifacts';
|
||||
import { KEEP_ARG_MAX_BYTES, readSelection, tooLargeLine, unreadableLine } from '../lib/review-exclude';
|
||||
import { KEEP_ARG_MAX_BYTES, readSelection, reviewExclude, tooLargeLine, unreadableLine } from '../lib/review-exclude';
|
||||
import { collectCommit } from '../lib/review-collect';
|
||||
import { extractReceipt } from '../lib/ship-receipt';
|
||||
import { bindShippedReceipt } from '../lib/ship-receipt-depth';
|
||||
import { REVIEW_EXCLUDE_KEY_VERSION, isUnavailable, loadPolicyAt } from '../lib/ship-policy';
|
||||
@@ -308,5 +309,20 @@ describe('a branch cannot hide code under a base pattern', () => {
|
||||
expect(p.review_exclude.content).toMatchObject({ binary: 1 });
|
||||
expect(p).toMatchObject({ depth: 'full', errors: expect.arrayContaining([expect.objectContaining({ code: 'binary_code_path', input: 'assets/loader.js' })]) });
|
||||
}, 120_000);
|
||||
|
||||
test('an unavailable gate scan keeps every candidate instead of excluding it', () => {
|
||||
const repo = census();
|
||||
const head = repo.git('rev-parse', 'HEAD');
|
||||
const baseSha = repo.git('rev-parse', 'origin/main');
|
||||
const c = collectCommit(repo.work, baseSha, head);
|
||||
const at = (gateTagged: ReadonlySet<string> | null) => reviewExclude({ root: repo.work, baseSha, ref: 'origin/main', mergeBase: c.mergeBase!, head, perPath: c.perPath, added: c.added, classRoot: c.root ?? [], gateTagged, context: 'test' });
|
||||
const scanned = at(new Set());
|
||||
expect(scanned.state === 'active' && [...scanned.excluded].sort()).toEqual([...EXCLUDED].sort());
|
||||
const blind = at(null);
|
||||
expect(blind.state).toBe('active');
|
||||
if (blind.state !== 'active') return;
|
||||
expect(blind.excluded.size).toBe(0);
|
||||
expect(blind.kept.filter(k => k.reason === 'gate-scan-unavailable').map(k => k.path).sort()).toEqual([...EXCLUDED, 'receipts/b/result.json', 'receipts/d/fixture.json'].sort());
|
||||
}, 120_000);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user