Disable experimental new worktree card style by default (#7977)

This commit is contained in:
Jinjing
2026-07-09 14:52:03 -07:00
committed by GitHub
parent 33f59ad99e
commit ad43dd19ed
4 changed files with 26 additions and 54 deletions
+7 -7
View File
@@ -92,32 +92,32 @@ describe('agent hooks CLI handler', () => {
rmSync(userDataPath, { recursive: true, force: true })
})
it('keeps the fresh-profile new card style default when creating offline settings', async () => {
it('keeps new card style off when creating offline settings for a fresh profile', async () => {
await runAgentHooksOff(userDataPath)
const persisted = readDataFile(userDataPath)
expect(persisted.settings.experimentalNewWorktreeCardStyle).toBe(true)
expect(persisted.settings.experimentalNewWorktreeCardStyle).toBe(false)
expect(persisted.settings.agentStatusHooksEnabled).toBe(false)
})
it('defaults missing new card style on while offline-updated onboarding is open', async () => {
it('keeps missing new card style off when updating offline settings', async () => {
const existing = getDefaultPersistedState(userDataPath)
delete existing.settings.experimentalNewWorktreeCardStyle
writeDataFile(userDataPath, existing)
await runAgentHooksOff(userDataPath)
expect(readDataFile(userDataPath).settings.experimentalNewWorktreeCardStyle).toBe(true)
expect(readDataFile(userDataPath).settings.experimentalNewWorktreeCardStyle).toBe(false)
})
it('preserves an existing explicit new card style opt-out when updating offline settings', async () => {
it('preserves an existing explicit new card style opt-in when updating offline settings', async () => {
const existing = getDefaultPersistedState(userDataPath)
existing.settings.experimentalNewWorktreeCardStyle = false
existing.settings.experimentalNewWorktreeCardStyle = true
writeDataFile(userDataPath, existing)
await runAgentHooksOff(userDataPath)
expect(readDataFile(userDataPath).settings.experimentalNewWorktreeCardStyle).toBe(false)
expect(readDataFile(userDataPath).settings.experimentalNewWorktreeCardStyle).toBe(true)
})
})
+1 -15
View File
@@ -31,16 +31,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function readPersistedState(dataPath: string): PersistedState {
if (!existsSync(dataPath)) {
const defaults = getDefaultPersistedState(homedir())
return {
...defaults,
settings: {
...defaults.settings,
// Why: offline CLI can create the first profile before desktop load;
// match the Store fresh-install default instead of pinning old cards.
experimentalNewWorktreeCardStyle: true
}
}
return getDefaultPersistedState(homedir())
}
try {
const parsed = JSON.parse(readFileSync(dataPath, 'utf-8'))
@@ -83,14 +74,9 @@ function readEnabledFromDisk(): boolean {
function updateEnabledOnDisk(enabled: boolean): string {
const dataPath = getDataPath()
const state = readPersistedState(dataPath)
const experimentalNewWorktreeCardStyle =
state.settings?.experimentalNewWorktreeCardStyle ?? state.onboarding?.closedAt === null
state.settings = {
...getDefaultPersistedState(homedir()).settings,
...state.settings,
// Why: offline CLI can run before Store.load(); mirror its open-onboarding
// default without overriding a saved user opt-out.
experimentalNewWorktreeCardStyle,
agentStatusHooksEnabled: enabled
}
writePersistedState(dataPath, state)