feat(opencode-config): redact secrets and add MCP listing to the internal config API (#366)

This commit is contained in:
Chris Scott authored and GitHub committed 2026-09-28 23:52:41 -04:00
1 parent 68b13c8e35
commit a1b7f58aae
31 files changed
+1238 -181

No files matched your search

@@ -8,11 +8,9 @@ import { makeOpenCodeConfigFile } from '@/test/fixtures/opencode-config'
const {
mockGetOpenCodeConfig,
mockUpdateOpenCodeConfig,
mockAddServerAsync,
} = vi.hoisted(() => ({
mockGetOpenCodeConfig: vi.fn(),
mockUpdateOpenCodeConfig: vi.fn(),
mockAddServerAsync: vi.fn(),
}))
vi.mock('@/api/settings', () => ({
@@ -22,10 +20,6 @@ vi.mock('@/api/settings', () => ({
},
}))
vi.mock('@/hooks/useMcpServers', () => ({
useMcpServers: () => ({ addServerAsync: mockAddServerAsync, isAddingServer: false }),
}))
vi.mock('@/lib/toast', () => ({
showToast: { success: vi.fn(), error: vi.fn(), info: vi.fn(), loading: vi.fn(), warning: vi.fn(), dismiss: vi.fn() },
}))
@@ -53,7 +47,6 @@ describe('AddMcpServerDialog', () => {
vi.clearAllMocks()
mockGetOpenCodeConfig.mockResolvedValue(config)
mockUpdateOpenCodeConfig.mockResolvedValue(config)
mockAddServerAsync.mockResolvedValue(undefined)
})
it('issues exactly one config update through the owner callback and never writes directly', async () => {
@@ -78,7 +71,6 @@ describe('AddMcpServerDialog', () => {
},
},
})
expect(mockAddServerAsync).toHaveBeenCalledTimes(1)
})
it('writes a remote server with V2 OAuth keys and the Manager callback', async () => {
@@ -107,7 +99,6 @@ describe('AddMcpServerDialog', () => {
timeout: { catalog: 9000, execution: 9000 },
}
expect(onUpdate).toHaveBeenCalledWith({ mcp: { servers: { 'remote-tools': serverConfig } } })
expect(mockAddServerAsync).toHaveBeenCalledWith({ name: 'remote-tools', config: serverConfig })
})
it('passes only the merged content to onUpdate', async () => {