mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 09:01:28 +01:00
Land checks a PR whose base moved in a separate clone, then with full CI, before merging (GST-1766) (#4649)
When main has moved since a PR's last CI run, `gstack-ship-queue land` now runs its local merge checks in a throwaway clone and can then run the full CI suite on the merged code before it merges. Why: the old checks shared the checkout's git directory, so a PR's own test commands could plant a hook that later ran with land's tokens, and a PR could reach main on a base its full suite never saw. Nothing to do: gstack's own policy turns the CI run on; other repos opt in with `land.merged_ci`. 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: p1/specialist-batched#1 reader=security Review-Finding: p1/red-team#2 reader=red-team Review-Finding: p1/red-team#3 reader=red-team Review-Finding: p2/specialist-batched#1 reader=security Review-Finding: p2/red-team#1 reader=red-team Review-Finding: p2/red-team#2 reader=red-team Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice Review-Finding: p2/adversarial-native#1 reader=adversarial-native Review-Finding: p2/adversarial-native#2 reader=adversarial-native Review-Finding: p2/adversarial-native#3 reader=adversarial-native Review-Finding: p2/adversarial-native#4 reader=adversarial-native
This commit is contained in:
1 parent
d8abe59096
commit
abdc09dad1
12 files changed
+649
-60
No files matched your search
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* land.merged_ci (lib/land-merged-ci.ts): the CI run land dispatches on the merged commit when the base moved. Fake
|
||||
* dependencies stand in for git push, gh and lib/run-evidence.ts, so each verdict and the scratch branch's cleanup are
|
||||
* checked without a network.
|
||||
*/
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { bunIsolationArgs } from '../lib/bun-isolation';
|
||||
import { runMergedCi, type CiDeps } from '../lib/land-merged-ci';
|
||||
import { landPolicyErrors } from '../lib/land-merged-checks';
|
||||
import type { ApiRun } from '../lib/run-evidence';
|
||||
|
||||
const COMMIT = 'c'.repeat(40), TREE = 't'.repeat(40);
|
||||
const CI = { workflow: 'free-tests.yml', profile: 'ci-reuse/free-tests' };
|
||||
type Calls = string[];
|
||||
|
||||
function fake(o: { runs?: ApiRun[][]; verify?: ReturnType<CiDeps['verify']>; push?: string; dispatch?: string } = {}): { deps: CiDeps; calls: Calls } {
|
||||
const calls: Calls = [];
|
||||
let clock = 0, polls = 0;
|
||||
const runs = o.runs ?? [[{ id: 7, run_attempt: 1, status: 'completed', conclusion: 'success', event: 'workflow_dispatch', head_sha: COMMIT }]];
|
||||
const deps: CiDeps = {
|
||||
push: (c, b) => { calls.push(`push ${c.slice(0, 4)} ${b}`); return o.push ?? null; },
|
||||
remove: b => { calls.push(`remove ${b}`); },
|
||||
dispatch: (w, b) => { calls.push(`dispatch ${w} ${b}`); return o.dispatch ?? null; },
|
||||
runsAt: () => runs[Math.min(polls++, runs.length - 1)] ?? [],
|
||||
run: id => { const r = runs[Math.min(polls++, runs.length - 1)]?.[0]; return r ?? { id, run_attempt: 1, status: 'queued', conclusion: null, event: 'workflow_dispatch', head_sha: COMMIT }; },
|
||||
verify: () => o.verify ?? { ok: true, head: COMMIT, tree: TREE },
|
||||
sleep: ms => { clock += ms; },
|
||||
now: () => clock,
|
||||
url: id => `https://example.invalid/runs/${id}`,
|
||||
};
|
||||
return { deps, calls };
|
||||
}
|
||||
const run = (deps: CiDeps, timeoutMs?: number) => runMergedCi(deps, { pr: '42', commit: COMMIT, tree: TREE, ci: CI, timeoutMs });
|
||||
const queued: ApiRun = { id: 7, run_attempt: 1, status: 'in_progress', conclusion: null, event: 'workflow_dispatch', head_sha: COMMIT };
|
||||
|
||||
describe('land.merged_ci', () => {
|
||||
test('a green run that verifies the merged commit and tree passes; land pushes gstack-land/<pr>, dispatches there, waits, and deletes the branch', () => {
|
||||
const { deps, calls } = fake({ runs: [[], [queued], [queued], [{ ...queued, status: 'completed', conclusion: 'success' }]] });
|
||||
const r = run(deps);
|
||||
expect(r).toEqual({ ok: true, line: 'MERGED_CI: pass free-tests.yml run https://example.invalid/runs/7 on the merged tree tttttttttttt (profile ci-reuse/free-tests)' });
|
||||
expect(calls).toEqual(['push cccc gstack-land/42', 'dispatch free-tests.yml gstack-land/42', 'remove gstack-land/42']);
|
||||
});
|
||||
|
||||
test('a red run refuses as red, naming its conclusion, and the branch is still deleted', () => {
|
||||
const { deps, calls } = fake({ runs: [[{ ...queued, status: 'completed', conclusion: 'failure' }]] });
|
||||
const r = run(deps);
|
||||
expect(r).toMatchObject({ ok: false, red: true });
|
||||
expect(r.ok ? '' : r.detail).toContain('concluded failure');
|
||||
expect(calls.at(-1)).toBe('remove gstack-land/42');
|
||||
});
|
||||
|
||||
test('a green run the run profile does not accept, or one that tested another commit, is no proof: refused, not red', () => {
|
||||
const refused = run(fake({ verify: { ok: false, detail: 'job_missing: free-tests' } }).deps);
|
||||
expect(refused).toMatchObject({ ok: false, red: false });
|
||||
expect(refused.ok ? '' : refused.detail).toContain('does not prove the tree under ci-reuse/free-tests: job_missing: free-tests');
|
||||
const other = run(fake({ verify: { ok: true, head: 'd'.repeat(40), tree: TREE } }).deps);
|
||||
expect(other).toMatchObject({ ok: false, red: false });
|
||||
expect(other.ok ? '' : other.detail).toContain('not the merged commit cccccccccccc');
|
||||
});
|
||||
|
||||
test('no run by the timeout, a run still going at the timeout, a failed dispatch: refused, not red, and the branch is deleted; a failed push dispatches nothing', () => {
|
||||
const none = fake({ runs: [[]] });
|
||||
const r1 = run(none.deps, 60_000);
|
||||
expect(r1).toMatchObject({ ok: false, red: false });
|
||||
expect(r1.ok ? '' : r1.detail).toContain('no free-tests.yml run appeared on gstack-land/42');
|
||||
expect(none.calls.at(-1)).toBe('remove gstack-land/42');
|
||||
const slow = run(fake({ runs: [[queued]] }).deps, 60_000);
|
||||
expect(slow.ok ? '' : slow.detail).toContain('is still in_progress after');
|
||||
const sent = fake({ dispatch: 'HTTP 422' });
|
||||
expect(run(sent.deps)).toMatchObject({ ok: false, red: false, detail: 'gh workflow run free-tests.yml --ref gstack-land/42 failed: HTTP 422' });
|
||||
expect(sent.calls.at(-1)).toBe('remove gstack-land/42');
|
||||
const pushed = fake({ push: 'rejected' });
|
||||
expect(run(pushed.deps)).toMatchObject({ ok: false, red: false });
|
||||
expect(pushed.calls).toEqual(['push cccc gstack-land/42']);
|
||||
});
|
||||
|
||||
test('the policy key: { workflow, profile } only, a workflow file name and a run profile name; it may stand without merged_checks', () => {
|
||||
expect(landPolicyErrors({ merged_ci: CI })).toEqual([]);
|
||||
expect(landPolicyErrors({ merged_checks: ['true'], merged_ci: CI })).toEqual([]);
|
||||
for (const bad of [{ workflow: '../x.yml', profile: 'p' }, { workflow: 'free-tests.yml' }, { ...CI, extra: 1 }, 'free-tests.yml', null]) expect(landPolicyErrors({ merged_ci: bad }).map(e => e.path)).toContain('land.merged_ci');
|
||||
});
|
||||
|
||||
test('gstack\'s own base policy runs Free Tests on the merged tree under a run profile its pregate config declares', () => {
|
||||
const root = path.join(import.meta.dir, '..');
|
||||
const ci = JSON.parse(fs.readFileSync(path.join(root, '.gstack', 'ship-policy.json'), 'utf8')).land?.merged_ci;
|
||||
expect(ci).toEqual(CI);
|
||||
expect(JSON.parse(fs.readFileSync(path.join(root, '.gstack', 'pregate.json'), 'utf8')).run_profiles?.[ci.profile]?.workflow).toBe(ci.workflow);
|
||||
});
|
||||
});
|
||||
|
||||
describe('queue git hooks', () => {
|
||||
test.skipIf(process.platform === 'win32')('a queue git call runs the checkout\'s hooks until land turns them off, so wave and train pushes keep the managed pre-push guard', () => {
|
||||
const gate = JSON.stringify(path.join(import.meta.dir, '..', 'crew', 'lib', 'ship-queue-gate.ts'));
|
||||
const script = `const fs = await import('node:fs'); const os = await import('node:os'); const path = await import('node:path');
|
||||
const { git, queueHooksOff } = await import(${gate});
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'queue-hooks-'));
|
||||
const marker = path.join(dir, 'ran');
|
||||
const env = { ...process.env, GIT_AUTHOR_NAME: 't', GIT_AUTHOR_EMAIL: 't@t', GIT_COMMITTER_NAME: 't', GIT_COMMITTER_EMAIL: 't@t' };
|
||||
git(dir, ['init', '-q'], env);
|
||||
fs.writeFileSync(path.join(dir, '.git', 'hooks', 'pre-commit'), '#!/bin/sh\\necho x >> "' + marker + '"\\n', { mode: 0o755 });
|
||||
const runs = () => fs.existsSync(marker) ? fs.readFileSync(marker, 'utf8').split('\\n').filter(Boolean).length : 0;
|
||||
const before = git(dir, ['commit', '-q', '--allow-empty', '-m', 'a'], env).ok && runs();
|
||||
queueHooksOff();
|
||||
const after = git(dir, ['commit', '-q', '--allow-empty', '-m', 'b'], env).ok && runs();
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
console.log(JSON.stringify({ before, after }));`;
|
||||
const r = spawnSync(process.execPath, [...bunIsolationArgs(), '-e', script], { encoding: 'utf8', timeout: 60_000 });
|
||||
expect(r.stderr).toBe('');
|
||||
expect(JSON.parse(r.stdout)).toEqual({ before: 1, after: 1 });
|
||||
});
|
||||
});
|
||||
@@ -130,6 +130,8 @@ function runMergedChecks(root: string, base: string, pin: string, checks: string
|
||||
if (r.status !== 0) throw new Error(`runMergedChecks child exited ${r.status ?? r.signal}: ${r.stderr}`);
|
||||
return JSON.parse(r.stdout) as MergedRun;
|
||||
}
|
||||
/** A new base policy committed straight onto origin/main, for a policy whose commands name the fixture's own paths. */
|
||||
const writePolicy = (fx: Fx, policy: Record<string, unknown>) => moveMain(fx, '.gstack/ship-policy.json', JSON.stringify(policy, null, 2) + '\n');
|
||||
/** Commit a file straight onto origin/main (another PR that landed first). */
|
||||
function moveMain(fx: Fx, file: string, text: string): string {
|
||||
const { repo } = fx;
|
||||
@@ -340,6 +342,157 @@ describe('land --pin: direct merge at the PR\'s own green head', () => {
|
||||
}
|
||||
}, 90_000);
|
||||
|
||||
test('land.merged_checks that write .git hooks, .git config and node_modules in their own tree: the writes stay in the throwaway clone, no hook runs, and land merges', () => {
|
||||
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-land-clone-'));
|
||||
const marker = path.join(scratch, 'hook-ran');
|
||||
const write = `d=$(git rev-parse --path-format=absolute --git-common-dir); printf '#!/bin/sh\\ntouch ${marker}\\n' > $d/hooks/pre-push; chmod +x $d/hooks/pre-push; git config --file $d/config gstack.probe changed; mkdir -p node_modules && echo poison > node_modules/poison`;
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: [write] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
try {
|
||||
const pin = openPr(fx, '90');
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
const common = fx.repo.git('rev-parse', '--path-format=absolute', '--git-common-dir');
|
||||
const config = fs.readFileSync(path.join(common, 'config'), 'utf8');
|
||||
const ok = land(fx, '90', pin, ['--allow-repo-commands']);
|
||||
expect(ok.err).toBe('');
|
||||
expect(ok.status).toBe(EXIT.ok);
|
||||
expect(fx.read().mergeArgs).toBeDefined();
|
||||
expect(fs.existsSync(path.join(common, 'hooks', 'pre-push'))).toBe(false);
|
||||
expect(fs.readFileSync(path.join(common, 'config'), 'utf8')).toBe(config);
|
||||
expect(fs.existsSync(path.join(fx.repo.work, 'node_modules', 'poison'))).toBe(false);
|
||||
expect(fs.existsSync(marker)).toBe(false);
|
||||
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
||||
}, 90_000);
|
||||
|
||||
test('land.merged_checks that write the checkout\'s own git hooks or config by absolute path: land refuses with QUEUE_LAND_MERGED_CHECKS naming each path and a hold-and-inspect fix, runs no hook, pushes no lock release, and the unlock command releases the lock without running the checks', () => {
|
||||
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-land-gitdir-'));
|
||||
const marker = path.join(scratch, 'hook-ran');
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: ['true'] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
try {
|
||||
const common = fx.repo.git('rev-parse', '--path-format=absolute', '--git-common-dir');
|
||||
const write = `d=${common}; printf '#!/bin/sh\\ntouch ${marker}\\n' > $d/hooks/pre-push; chmod +x $d/hooks/pre-push; git config --file $d/config gstack.probe changed`;
|
||||
writePolicy(fx, { ...POLICY, land: { merged_checks: [write] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
const pin = openPr(fx, '95');
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
const config = fs.readFileSync(path.join(common, 'config'), 'utf8');
|
||||
const lock = () => JSON.parse(fx.repo.git('--git-dir', fx.repo.origin, 'show', 'refs/notes/gstack-land:lock.json'));
|
||||
const r = land(fx, '95', pin, ['--allow-repo-commands']);
|
||||
expect(r.status).not.toBe(EXIT.ok);
|
||||
expect(r.err).toContain('(QUEUE_LAND_MERGED_CHECKS)');
|
||||
expect(r.err).toContain('the checks changed .git/config, .git/hooks/pre-push, which land\'s later git and gh calls read');
|
||||
expect(r.err).toContain('restore it from a trusted copy (delete a hook the checks added)');
|
||||
expect(r.err).toContain('hold and inspect');
|
||||
expect(r.err).not.toContain('git merge origin/main');
|
||||
expect(r.out).toContain(`release the lock without running the checks: gstack-ship-queue land --pr 95 --pin ${pin} (without --allow-repo-commands)`);
|
||||
expect(fx.read().mergeArgs).toBeUndefined();
|
||||
expect(fs.existsSync(marker)).toBe(false);
|
||||
expect(lock().released).not.toBe(true);
|
||||
fs.rmSync(path.join(common, 'hooks', 'pre-push'));
|
||||
fs.writeFileSync(path.join(common, 'config'), config);
|
||||
const unlock = land(fx, '95', pin);
|
||||
expect(unlock.err).toContain('(REPO_COMMANDS_NOT_ALLOWED)');
|
||||
expect(fs.existsSync(path.join(common, 'hooks', 'pre-push'))).toBe(false);
|
||||
expect(fx.read().mergeArgs).toBeUndefined();
|
||||
expect(lock()).toMatchObject({ released: true });
|
||||
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
||||
}, 90_000);
|
||||
|
||||
test('a hook a merged check writes under the checkout\'s core.hooksPath never runs in land\'s git calls, and land still merges', () => {
|
||||
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-land-hookspath-'));
|
||||
const marker = path.join(scratch, 'hook-ran');
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: ['true'] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
try {
|
||||
const h = path.join(fx.repo.work, '.hooks');
|
||||
writePolicy(fx, { ...POLICY, land: { merged_checks: [`mkdir -p ${h} && printf '#!/bin/sh\\ntouch ${marker}\\n' > ${h}/pre-push && chmod +x ${h}/pre-push`] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
fx.repo.git('config', 'core.hooksPath', '.hooks');
|
||||
const pin = openPr(fx, '91');
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
const ok = land(fx, '91', pin, ['--allow-repo-commands']);
|
||||
expect(ok.err).toBe('');
|
||||
expect(ok.status).toBe(EXIT.ok);
|
||||
expect(fs.existsSync(path.join(h, 'pre-push'))).toBe(true);
|
||||
expect(fs.existsSync(marker)).toBe(false);
|
||||
expect(fx.read().mergeArgs).toBeDefined();
|
||||
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
||||
}, 90_000);
|
||||
|
||||
test('a merged check that points the checkout\'s .git/commondir at another directory: land refuses naming it and leaves the lock held', () => {
|
||||
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-land-commondir-'));
|
||||
const alt = path.join(scratch, 'alt');
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: ['true'] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
try {
|
||||
const d = fx.repo.git('rev-parse', '--path-format=absolute', '--git-common-dir');
|
||||
writePolicy(fx, { ...POLICY, land: { merged_checks: [`a=${alt}; mkdir -p $a && ln -s ${d}/objects ${d}/refs $a/ && cp ${d}/HEAD $a/ && printf '[core]\\n\\tsshCommand = false\\n' > $a/config && echo $a > ${d}/commondir`] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
const pin = openPr(fx, '92');
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
const r = land(fx, '92', pin, ['--allow-repo-commands']);
|
||||
expect(r.status).not.toBe(EXIT.ok);
|
||||
expect(r.err).toContain('(QUEUE_LAND_MERGED_CHECKS)');
|
||||
expect(r.err).toContain('the checks changed .git/commondir, which');
|
||||
expect(fx.read().mergeArgs).toBeUndefined();
|
||||
expect(JSON.parse(fx.repo.git('--git-dir', fx.repo.origin, 'show', 'refs/notes/gstack-land:lock.json')).released).not.toBe(true);
|
||||
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
||||
}, 90_000);
|
||||
|
||||
test('a merged check that repoints the middle link of a symlinked .git/config chain: land detects it and refuses naming the link', () => {
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: ['true'] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
const common = fx.repo.git('rev-parse', '--path-format=absolute', '--git-common-dir');
|
||||
writePolicy(fx, { ...POLICY, land: { merged_checks: [`d=${common}; printf '[core]\\n\\tsshCommand = false\\n' > $d/alt && ln -sfn alt $d/config.mid`] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
const pin = openPr(fx, '94');
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
fs.renameSync(path.join(common, 'config'), path.join(common, 'config.real'));
|
||||
fs.symlinkSync('config.real', path.join(common, 'config.mid'));
|
||||
fs.symlinkSync('config.mid', path.join(common, 'config'));
|
||||
const r = land(fx, '94', pin, ['--allow-repo-commands']);
|
||||
expect(r.status).not.toBe(EXIT.ok);
|
||||
expect(r.err).toContain('(QUEUE_LAND_MERGED_CHECKS)');
|
||||
expect(r.err).toContain('the checks changed .git/config.mid, which');
|
||||
expect(fx.read().mergeArgs).toBeUndefined();
|
||||
}, 90_000);
|
||||
|
||||
test('GST-1766: a merged check that edits a config file the checkout includes, creates a global git config, or rewrites the gh land runs: land refuses naming that file and merges nothing', () => {
|
||||
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-land-reads-'));
|
||||
try {
|
||||
const inc = path.join(scratch, 'inc.cfg');
|
||||
fs.writeFileSync(inc, '[gstack]\n\tprobe = 1\n');
|
||||
const cases: Array<[string, (fx: Fx) => string, (fx: Fx) => string]> = [
|
||||
['96', fx => { fx.repo.git('config', 'include.path', inc); return `printf '[core]\\n\\tsshCommand = false\\n' >> ${inc}`; }, () => inc],
|
||||
['97', fx => `printf '[credential]\\n\\thelper = !false\\n' >> ${fx.repo.env.GIT_CONFIG_GLOBAL}`, fx => fx.repo.env.GIT_CONFIG_GLOBAL],
|
||||
['98', fx => `echo '// changed' >> ${path.join(fx.repo.root, 'gh-shim', 'gh')}`, fx => path.join(fx.repo.root, 'gh-shim', 'gh')],
|
||||
];
|
||||
for (const [pr, arm, named] of cases) {
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: ['true'] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
const write = arm(fx);
|
||||
writePolicy(fx, { ...POLICY, land: { merged_checks: [write] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
const pin = openPr(fx, pr);
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
const r = land(fx, pr, pin, ['--allow-repo-commands']);
|
||||
expect(r.status, pr).not.toBe(EXIT.ok);
|
||||
expect(r.err, pr).toContain('(QUEUE_LAND_MERGED_CHECKS)');
|
||||
expect(r.err, pr).toContain(`the checks changed ${named(fx)}, which land's later git and gh calls read`);
|
||||
expect(fx.read().mergeArgs, pr).toBeUndefined();
|
||||
}
|
||||
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
||||
}, 120_000);
|
||||
|
||||
test('GST-1766: a git a merged check drops early on PATH never runs in land\'s later git or gh calls (land pinned git before the checks), and land merges', () => {
|
||||
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-land-shim-'));
|
||||
try {
|
||||
const early = path.join(scratch, 'early'), marker = path.join(scratch, 'shim-ran'), shim = path.join(scratch, 'git-shim');
|
||||
fs.mkdirSync(early);
|
||||
fs.writeFileSync(shim, `#!/bin/sh\ntouch ${marker}\nexec ${Bun.which('git')} "$@"\n`, { mode: 0o755 });
|
||||
const fx = setup({ ...POLICY, land: { merged_checks: [`cp ${shim} ${early}/git && chmod +x ${early}/git`] }, min_gstack_version: LAND_KEY_VERSION });
|
||||
fx.env.PATH = `${early}:${fx.env.PATH}`;
|
||||
const pin = openPr(fx, '99');
|
||||
moveMain(fx, 'other.txt', 'other\n');
|
||||
const ok = land(fx, '99', pin, ['--allow-repo-commands']);
|
||||
expect(ok.err).toBe('');
|
||||
expect(ok.status).toBe(EXIT.ok);
|
||||
expect(fs.existsSync(path.join(early, 'git'))).toBe(true);
|
||||
expect(fs.existsSync(marker)).toBe(false);
|
||||
expect(fx.read().mergeArgs).toBeDefined();
|
||||
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
||||
}, 90_000);
|
||||
|
||||
test('QUEUE_LAND_NOT_CLEAN: on a stale base the pin conflicts with main, so no merged check runs and nothing merges', () => {
|
||||
const fx = setup(CHECKED);
|
||||
const pin = openPr(fx, '83', { edit: w => fs.writeFileSync(path.join(w, 'other.txt'), 'pr\n') });
|
||||
|
||||
Reference in new issue
Block a user