mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-25 01:21:24 +01:00
/ship reruns the test gate when its record was taken against a different base branch (GST-3493) (#4706)
/ship no longer accepts a test-gate record taken against a different base branch: it reruns the gate against the base it ships to. Why: a record cleared while a pull request was stacked on another branch still verified after the pull request was retargeted at main with the same code, though it used the other branch's policy and CI run profiles. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#2 reader=testing Review-Finding: p1/outside-voice#1 reader=outside-voice Review-Finding: p1/specialist-batched#1 reader=security Review-Finding: p1/adversarial-native#1 reader=adversarial-native Review-Finding: p1/outside-voice#2 reader=outside-voice
This commit is contained in:
1 parent
45e33b5e7b
commit
17afb6831b
11 files changed
+187
-17
No files matched your search
@@ -224,10 +224,13 @@ export interface Verification { ok: boolean; code?: 'PREGATE_STALE' | 'PREGATE_R
|
||||
* user-owned policy behind the run (or its absence, under the defaults) must
|
||||
* still hold, since it lives outside the tree.
|
||||
*/
|
||||
export function verifyPregate(repoRoot: string, file: PregateFile, treeNow: WtreeResult = wtreeFingerprint({ cwd: repoRoot })): Verification {
|
||||
export function verifyPregate(repoRoot: string, file: PregateFile, treeNow: WtreeResult = wtreeFingerprint({ cwd: repoRoot }), base?: string): Verification {
|
||||
const uncleared = (file.requires_remote ?? []).filter(r => !r.receipt);
|
||||
const treeCurrent = 'tree' in treeNow && treeNow.tree === file.tree;
|
||||
if (!treeCurrent) return { ok: false, code: 'PREGATE_STALE', message: `pregate.json was recorded against tree ${file.tree.slice(0, 12)}; ${'tree' in treeNow ? `the tree is now ${treeNow.tree.slice(0, 12)}` : `the tree cannot be fingerprinted now (${treeNow.error})`}`, current: false, uncleared };
|
||||
const recordedBase = base === undefined ? null : baseBranchOf(file.base);
|
||||
const shipBase = base?.replace(/^origin\//, '');
|
||||
if (recordedBase && recordedBase !== shipBase) return { ok: false, code: 'PREGATE_STALE', message: `pregate.json was recorded against origin/${recordedBase}, but this ships against origin/${shipBase}; its checks and clears used origin/${recordedBase}'s policy and run profiles`, current: false, uncleared };
|
||||
const policyChange = userPolicyChange(file);
|
||||
if (policyChange) return { ok: false, code: 'PREGATE_STALE', message: policyChange, current: false, uncleared };
|
||||
const current = true;
|
||||
|
||||
+1
-1
@@ -383,7 +383,7 @@ export function ready(ctx: QueueContext, o: { pr: string; pregate?: string; gate
|
||||
if (fs.existsSync(pregateFile)) {
|
||||
const read = readPregateFile(pregateFile);
|
||||
if (read.file) {
|
||||
const v = verifyPregate(ctx.repoRoot, read.file, treeNow);
|
||||
const v = verifyPregate(ctx.repoRoot, read.file, treeNow, ctx.base);
|
||||
pregateOk = v.ok;
|
||||
if (v.ok) accepted = read.file;
|
||||
useMirror = !v.ok && v.code !== 'PREGATE_LANE_FAILED' && v.code !== 'PREGATE_INCOMPLETE' && v.code !== 'PREGATE_ENVIRONMENT';
|
||||
|
||||
+1
-1
@@ -672,7 +672,7 @@ async function finishStages(argv: readonly string[], cwd: string): Promise<Repor
|
||||
if (!/^(pass|warn)/.test(verdict)) return r.stop(`pregate preflight ${verdict} on the stamped tree: fix it, then rerun finish`);
|
||||
return r.next(`Step 16 stage 5, then Step 17's guard block and gstack-ship-release push; then gstack-ship-release accept --base ${base} ${laneArgs} carries ${deferred.join(', ')} from CI at the pushed head${loop ? '; Step 18 records the same exception with gstack-ship-receipt write --review-loop-exception' : ''}`);
|
||||
}
|
||||
const v = bin(cwd, 'gstack-pregate', ['verify'], 60_000);
|
||||
const v = bin(cwd, 'gstack-pregate', ['verify', '--base', base], 60_000);
|
||||
if (v.status === 0) r.add('PREGATE: verify ok on the stamped tree');
|
||||
else {
|
||||
const policy = lanesOnlyHeadPolicy(cwd, base);
|
||||
|
||||
Reference in new issue
Block a user