From df867483568d23314f2e6a621db4eee24e6ca7e1 Mon Sep 17 00:00:00 2001 From: NagyVikt Date: Tue, 21 Apr 2026 15:03:42 +0200 Subject: [PATCH] Keep CI test expectations aligned with current guardrail flows The failing GitHub Actions run was caused by stale test assumptions rather than a CLI regression. The install suite now seeds repo-local git identity before helper commits, the codex-agent no-merge assertion no longer hardcodes the role segment, and the metadata suite accepts the current doctor dry-run variable name. Constraint: CI runners do not provide global git author identity for nested test repos Rejected: Change runtime branch naming or doctor output to satisfy stale tests | behavior already matches the intended contract Confidence: high Scope-risk: narrow Directive: Keep tests focused on user-visible behavior instead of local variable names or fixed role prefixes Tested: npm test Not-tested: live GitHub Actions rerun after merge --- test/install.test.js | 15 ++++++++++----- test/metadata.test.js | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/test/install.test.js b/test/install.test.js index 9fb8e05..ce6d2f1 100644 --- a/test/install.test.js +++ b/test/install.test.js @@ -134,10 +134,7 @@ function initRepo() { let result = runCmd('git', ['init', '-b', 'dev'], repoDir); assert.equal(result.status, 0, result.stderr); - result = runCmd('git', ['config', 'user.email', 'bot@example.com'], repoDir); - assert.equal(result.status, 0, result.stderr); - result = runCmd('git', ['config', 'user.name', 'Bot'], repoDir); - assert.equal(result.status, 0, result.stderr); + configureGitIdentity(repoDir); if (withPackageJson) { fs.writeFileSync( @@ -174,7 +171,15 @@ function createGuardexCompanionHome({ cavekit = false, caveman = false } = {}) { return homeDir; } +function configureGitIdentity(repoDir) { + let result = runCmd('git', ['config', 'user.email', 'bot@example.com'], repoDir); + assert.equal(result.status, 0, result.stderr || result.stdout); + result = runCmd('git', ['config', 'user.name', 'Bot'], repoDir); + assert.equal(result.status, 0, result.stderr || result.stdout); +} + function seedCommit(repoDir) { + configureGitIdentity(repoDir); let result = runCmd('git', ['add', '.'], repoDir); assert.equal(result.status, 0, result.stderr); result = runCmd('git', ['commit', '-m', 'seed'], repoDir); @@ -3417,7 +3422,7 @@ exit 1 assert.equal(launch.status, 0, launch.stderr || launch.stdout); const combinedOutput = `${launch.stdout}\n${launch.stderr}`; assert.match(combinedOutput, /\[codex-agent\] Auto-finish enabled: commit -> push\/PR -> wait for merge -> cleanup\./); - assert.match(combinedOutput, /\[codex-agent\] Auto-finish skipped for 'agent\/codex\/autofinish-task-/); + assert.match(combinedOutput, /\[codex-agent\] Auto-finish skipped for 'agent\/[^/]+\/autofinish-task-/); assert.equal(fs.existsSync(ghMergeState), false, 'merge should not be attempted without a mergeable remote context'); const launchedCwd = fs.readFileSync(cwdMarker, 'utf8').trim(); diff --git a/test/metadata.test.js b/test/metadata.test.js index 61b8668..db5c8b5 100644 --- a/test/metadata.test.js +++ b/test/metadata.test.js @@ -121,7 +121,7 @@ test('active doctor command remains single-source and runs the repair-first path const cliSource = fs.readFileSync(cliPath, 'utf8'); const doctorDefs = cliSource.match(/function doctor\(rawArgs\)/g) || []; assert.equal(doctorDefs.length, 1, 'doctor() must not be duplicated'); - assert.match(cliSource, /printOperations\('Doctor\/fix', fixPayload, singleRepoOptions\.dryRun\);/); + assert.match(cliSource, /printOperations\('Doctor\/fix', fixPayload, (?:singleRepoOptions|options)\.dryRun\);/); }); test('worktree-change detection uses normal untracked-file mode', () => {