mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(mobile): compare branches and show diffs with desktop's base-ref and whitespace settings Base-ref resolution moves to src/shared and the host publishes the compare-against-upstream and show-whitespace settings, so the phone's branch compare and diffs match desktop. * fix(mobile): use the upstream compare policy on the review screen and rebuild diffs when whitespace changes * fix(mobile): reread Source Control settings on Refresh and restart diffs loading under the old whitespace setting * test(mobile): cover diffs dropped when desktop's whitespace setting arrives * refactor(mobile): share one Source Control settings read per host across screens
77 lines
3.0 KiB
TypeScript
77 lines
3.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { RuntimeClientSettingsController } from './runtime-client-settings'
|
|
import { createGlobalSettingsFixture } from '../../shared/global-settings-test-fixture'
|
|
import type { GlobalSettings } from '../../shared/global-settings-types'
|
|
import { getDefaultSourceControlAiSettings } from '../../shared/source-control-ai'
|
|
|
|
// settings.get is an allowlist: omitted per-action agent recipes look unsaved to paired AI buttons.
|
|
function projectionOf(settings: Partial<GlobalSettings>) {
|
|
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: get() reads nothing but store.getSettings(); every other RuntimeStore member is unreachable from that path.
|
|
return new RuntimeClientSettingsController({ getSettings: () => settings } as never).get()
|
|
}
|
|
|
|
function hostSettings(sourceControlAi: GlobalSettings['sourceControlAi']): Partial<GlobalSettings> {
|
|
return { ...createGlobalSettingsFixture({ workspaceDir: '/w' }), sourceControlAi }
|
|
}
|
|
|
|
describe('RuntimeClientSettingsController source control launch recipes', () => {
|
|
it('publishes the recipe saved for a launch action', () => {
|
|
const projected = projectionOf(
|
|
hostSettings({
|
|
...getDefaultSourceControlAiSettings(),
|
|
actions: { fixChecks: { agentId: 'codex', agentArgs: '--fast' } }
|
|
})
|
|
)
|
|
expect(projected.sourceControlAi.actions.fixChecks).toMatchObject({
|
|
agentId: 'codex',
|
|
agentArgs: '--fast'
|
|
})
|
|
})
|
|
|
|
it('publishes a recipe saved under the legacy launch defaults key', () => {
|
|
const projected = projectionOf(
|
|
hostSettings({
|
|
...getDefaultSourceControlAiSettings(),
|
|
actions: undefined,
|
|
launchActionDefaults: { resolveConflicts: { agentId: 'claude' } }
|
|
})
|
|
)
|
|
expect(projected.sourceControlAi.actions.resolveConflicts).toMatchObject({ agentId: 'claude' })
|
|
})
|
|
|
|
it('publishes launch actions only, not the text generation recipes', () => {
|
|
const projected = projectionOf(hostSettings(getDefaultSourceControlAiSettings()))
|
|
expect(Object.keys(projected.sourceControlAi.actions).sort()).toEqual([
|
|
'fixChecks',
|
|
'fixCommitFailure',
|
|
'fixPushFailure',
|
|
'resolveComments',
|
|
'resolveConflicts'
|
|
])
|
|
})
|
|
})
|
|
|
|
describe('RuntimeClientSettingsController source control list order', () => {
|
|
it('publishes the group order so paired clients list changes the same way', () => {
|
|
expect(projectionOf({ sourceControlGroupOrder: 'staged-first' }).sourceControlGroupOrder).toBe(
|
|
'staged-first'
|
|
)
|
|
expect(projectionOf({}).sourceControlGroupOrder).toBe('changes-first')
|
|
})
|
|
|
|
it('publishes the compare base and whitespace choices desktop diffs use', () => {
|
|
const projected = projectionOf({
|
|
sourceControlCompareAgainstUpstream: true,
|
|
diffShowWhitespace: true
|
|
})
|
|
expect(projected).toMatchObject({
|
|
sourceControlCompareAgainstUpstream: true,
|
|
diffShowWhitespace: true
|
|
})
|
|
expect(projectionOf({})).toMatchObject({
|
|
sourceControlCompareAgainstUpstream: false,
|
|
diffShowWhitespace: false
|
|
})
|
|
})
|
|
})
|