Skip to content

Commit 3489157

Browse files
committed
Keep default pre-push checks fast for contributors
The pre-push hook already treats live model smoke as optional at runtime, but an existing local config can keep it enabled after reinstalling the hook. Default hook installation now writes the fast local setting explicitly unless a provider selector is supplied, so fresh forks and repeated installs stay on the PR gate path by default while release maintainers can still opt into live smoke. Constraint: Daily contributor pushes should not depend on real provider access or long desktop smoke runs Rejected: Remove live smoke lanes entirely | release and provider changes still need an explicit high-confidence validation path Confidence: high Scope-risk: narrow Directive: Keep live provider and desktop smoke opt-in for push hooks; use quality:smoke or baseline gates for release validation Tested: bun test scripts/git-hooks/install.test.ts Tested: bun run check:policy Not-tested: Full bun run verify before commit; push hook will run the non-live PR gate
1 parent fdfe3b0 commit 3489157

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

‎scripts/git-hooks/install.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,29 @@ describe('installPrePushHook', () => {
6969
}
7070
})
7171

72+
test('disables stale live smoke settings during default install', () => {
73+
const tempDir = mkdtempSync(join(tmpdir(), 'git-hook-install-test-'))
74+
try {
75+
runGit(tempDir, ['init'])
76+
runGit(tempDir, ['config', '--local', 'quality.prePushLive', 'true'])
77+
runGit(tempDir, ['config', '--local', 'quality.prePushProviderModels', 'codingplan:main:codingplan-main'])
78+
const sourcePath = join(tempDir, 'source-pre-push')
79+
writeFileSync(sourcePath, '#!/usr/bin/env bash\necho default\n')
80+
81+
const result = installPrePushHook({
82+
rootDir: tempDir,
83+
sourcePath,
84+
})
85+
86+
expect(result.liveConfigured).toBe(false)
87+
expect(readFileSync(result.hookPath, 'utf8')).toContain('echo default')
88+
expect(runGit(tempDir, ['config', '--local', '--get', 'quality.prePushLive'])).toBe('false')
89+
expect(runGit(tempDir, ['config', '--local', '--get', 'quality.prePushProviderModels'])).toBe('codingplan:main:codingplan-main')
90+
} finally {
91+
rmSync(tempDir, { recursive: true, force: true })
92+
}
93+
})
94+
7295
test('stores live gate settings in local git config', () => {
7396
const tempDir = mkdtempSync(join(tmpdir(), 'git-hook-install-test-'))
7497
try {

‎scripts/git-hooks/install.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ export function installPrePushHook(options: InstallPrePushHookOptions = {}): Ins
8282
gitConfig(rootDir, 'quality.allowMissingTests', 'true')
8383
}
8484

85-
if (options.live === false) {
86-
gitConfig(rootDir, 'quality.prePushLive', 'false')
87-
}
85+
const shouldWriteGitConfig = !options.hookPath
86+
const shouldEnableLive = options.live !== false && Boolean(options.liveProviderModels?.length)
8887

89-
if (options.liveProviderModels && options.liveProviderModels.length > 0) {
88+
if (shouldWriteGitConfig && shouldEnableLive) {
9089
gitConfig(rootDir, 'quality.prePushLive', 'true')
91-
gitConfig(rootDir, 'quality.prePushProviderModels', options.liveProviderModels.join(' '))
90+
gitConfig(rootDir, 'quality.prePushProviderModels', options.liveProviderModels?.join(' ') ?? '')
91+
} else if (shouldWriteGitConfig) {
92+
gitConfig(rootDir, 'quality.prePushLive', 'false')
9293
}
9394

9495
if (options.liveMode) {
@@ -162,11 +163,12 @@ function printHelp() {
162163
console.log(`Install the repository pre-push quality gate.
163164
164165
Usage:
165-
bun run hooks:install [-- --force] [-- --live-provider-model <selector>] [-- --live-mode smoke|baseline]
166+
bun run hooks:install [-- --force] [-- --no-live] [-- --live-provider-model <selector>] [-- --live-mode smoke|baseline]
166167
bun run hooks:install -- --allow-cli-core-change --allow-coverage-baseline-change
167168
168169
Examples:
169170
bun run hooks:install
171+
bun run hooks:install -- --no-live
170172
bun run quality:providers
171173
bun run hooks:install -- --live-provider-model codingplan:main:codingplan-main
172174
bun run hooks:install -- --live-provider-model codingplan:main:codingplan-main --live-mode baseline

0 commit comments

Comments
 (0)