mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-23 16:41:35 +01:00
Pull requests get a Test changes summary of deleted or skipped tests and edits to their own checks (GST-3386) (#4645)
Every gstack pull request now gets a flag-only Test changes check listing removed or skipped tests, loosened limits and edits to the files that run its own checks. Why: agents write most of our tests, and a pull request shouldn't be able to quietly weaken them or grade itself with an edited checker; this two-week trial measures how often that happens. Nothing to do: the check isn't required, and a flag never turns it red. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/red-team#1 reader=red-team Review-Finding: lib/gate-diff/git.ts:314:stale-comment reader=core Review-Finding: p3/outside-voice#1 reader=outside-voice
This commit is contained in:
1 parent
abdc09dad1
commit
973b49eabb
11 files changed
+451
-15
No files matched your search
@@ -311,6 +311,13 @@ function decode(buf: Buffer): string {
|
||||
return new TextDecoder('utf-8', { fatal: false }).decode(buf);
|
||||
}
|
||||
|
||||
/** fromSha → toSha from commit objects alone, never the working tree (with rename detection). */
|
||||
export function diffRange(fromSha: string, toSha: string, cwd: string): FileDiff[] {
|
||||
const r = runGit([...DIFF_FLAGS, fromSha, toSha, '--'], cwd);
|
||||
if (r.status !== 0) throw new Error(`git diff failed: ${r.stderr.trim() || `exit ${r.status}`}`);
|
||||
return parseUnifiedDiff(decode(r.stdout));
|
||||
}
|
||||
|
||||
/** merge-base → working tree (tracked changes, staged and unstaged, with rename detection). */
|
||||
export function diffWorkingTree(mergeBaseSha: string, cwd: string): FileDiff[] {
|
||||
const r = runGit([...DIFF_FLAGS, mergeBaseSha, '--'], cwd);
|
||||
@@ -382,8 +389,9 @@ export function untrackedAsAdded(cwd: string, root: string): FileDiff[] {
|
||||
return out;
|
||||
}
|
||||
|
||||
export function commitsInRange(fromExclusive: string, toInclusive: string, cwd: string): CommitInfo[] {
|
||||
export function commitsInRange(fromExclusive: string, toInclusive: string, cwd: string, strict = false): CommitInfo[] {
|
||||
const r = runGit(['log', '--format=%H%x00%B%x00', `${fromExclusive}..${toInclusive}`, '--'], cwd);
|
||||
if (r.status !== 0 && strict) throw new Error(`git log failed: ${r.stderr.toString().trim() || `exit ${r.status}`}`);
|
||||
if (r.status !== 0) return [];
|
||||
const parts = r.stdout.toString('utf-8').split('\0');
|
||||
const out: CommitInfo[] = [];
|
||||
|
||||
Reference in new issue
Block a user