From fd92805fdabc6db58c434e0acd3d4f0ea508a2e2 Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:11:21 -0500 Subject: [PATCH] test(governance): stop background git gc from racing the fixture cleanup The pinned-helpers test commits several times into a throwaway repo under the workspace, then rmSync()s it. git commit may fork 'git gc --auto' into the background, and when that process is still writing under .git the cleanup fails with ENOTEMPTY. On a persistent self-hosted runner the half-removed fixture then trips the next run's 'must not overwrite another workspace' precondition. Disable auto gc/maintenance for the fixture's git calls and let rmSync retry transient errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .github/scripts/integration-governance.test.cjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/scripts/integration-governance.test.cjs b/.github/scripts/integration-governance.test.cjs index 1ff95c6708..5884d0ba43 100644 --- a/.github/scripts/integration-governance.test.cjs +++ b/.github/scripts/integration-governance.test.cjs @@ -79,7 +79,12 @@ test('real pinned helpers enforce each original member and reject missing signof const root = process.cwd(), workspace = path.join(root, '.integration-governance-fixture'); const helper = path.join(root, '.github/scripts/integration-governance.cjs'); const env = {...process.env, GITHUB_TOKEN: '', GH_TOKEN: '', GITHUB_REPOSITORY: '', DCO_GITHUB_REPOSITORY: ''}; - const git = (...args) => cp.execFileSync('git', ['-c', 'core.hooksPath=/dev/null', ...args], + // gc.auto/maintenance.auto off: a background `git gc --auto` forked by one of + // the fixture commits can still be writing under .git while the cleanup below + // removes it, and on a persistent self-hosted workspace the resulting + // ENOTEMPTY leaves a fixture behind that fails the next run's precondition. + const git = (...args) => cp.execFileSync('git', + ['-c', 'core.hooksPath=/dev/null', '-c', 'gc.auto=0', '-c', 'maintenance.auto=false', ...args], {cwd: workspace, env, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe']}).trim(); const check = (kind, manifest, members, knownAuthor = true) => cp.execFileSync(process.execPath, ['-e', `const subject = ${JSON.stringify(manifest)}; @@ -141,5 +146,5 @@ test('real pinned helpers enforce each original member and reject missing signof const forgedSource = structuredClone(bad); forgedSource.preparedBy.sourceSHA = git('rev-parse', 'HEAD'); assert.throws(() => check('dco', forgedSource, [pr]), /closure unavailable/); - } finally { fs.rmSync(workspace, {recursive: true, force: true}); } + } finally { fs.rmSync(workspace, {recursive: true, force: true, maxRetries: 10, retryDelay: 100}); } });