Merge master 7e2b049d8e2523127a3b4fba38cab4748ef0c72f, observed on 2026-09-19 at 07:38:37 UTC, into release/session-log-v4 at c4663e8671e33bc2cfdbc868b0b18d979508d39b. Keep this base integration separate from the five persistence repair PRs so their review diffs remain focused and can be rebased without moving their fixes here. Combine master's pin ordering and archived-session filter with V4's parent-owned direct child catalog. Both grouped and flat sidebar rows must pass the Session list to the V4 activity calculation; restoring master's summary-lineage traversal would reintroduce the removed subagent ownership and count unrelated descendants. Keep master's removal of the archived-session settings page. Its only release-side test change renamed a Session list fixture field, so no runtime behavior is lost by deleting that obsolete test. Adapt the release-side direct-child-status regression to the new row/filter arguments and preserve its assertions. Retain master's workspace ordering and row-motion documentation while keeping the V4 child-catalog wording. Reconcile the generated bilingual records against the merged documents. Frozen V0-V3 codecs, recorded Session JSONL inputs, and the current V4 persistence schema are unchanged. Refs #2692, #3273
101 lines
4.5 KiB
TypeScript
101 lines
4.5 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
|
import type { SessionListState } from '@deepseek-ai/dsh-api-session-controller/client'
|
|
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
|
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
|
import type { GlobalStandardProps } from '@deepseek-ai/dsh-client-ui-slots'
|
|
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
import { bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
|
import { TranscriptViewRow, type TranscriptViewRowProps } from '../src/client/settings/TranscriptViewRow.tsx'
|
|
import { PerformanceUsageRow } from '../src/client/settings/PerformanceUsageRow.tsx'
|
|
import type { PerformanceUsageMode } from '../src/chat-settings.ts'
|
|
import { en, zh } from '../src/client/locale.ts'
|
|
|
|
afterEach(cleanup)
|
|
|
|
function emptySessions() {
|
|
return bindSnapshotSelector(createSnapshotStore<SessionListState>({
|
|
ids: [], byId: {}, phase: 'ready', projectionsBySession: {}, jobsBySession: {},
|
|
}))
|
|
}
|
|
|
|
function emptyWorkspaces() {
|
|
return bindSnapshotSelector(createSnapshotStore<WorkspaceSnapshot>({
|
|
items: [], archivedSessionIds: [], pinnedSessionIds: [], state: 'idle', phase: 'ready', error: null,
|
|
}))
|
|
}
|
|
|
|
function noPendingInteraction() {
|
|
return bindSnapshotSelector(createSnapshotStore<SessionStatusSnapshot>(new Map()))
|
|
}
|
|
|
|
// The resource hook the resources plugin merges into GlobalStandardProps; this row reads no address.
|
|
const useResource = (() => ({ status: 'none' as const, value: undefined, failure: undefined })) as GlobalStandardProps['useResource']
|
|
|
|
function mount(mode: 'normal' | 'compact' = 'compact', dictionary: typeof en | typeof zh = en) {
|
|
const source = createSnapshotStore(mode)
|
|
const setTranscriptView = vi.fn((next: 'normal' | 'compact') => { source.set(next) })
|
|
const props: TranscriptViewRowProps = {
|
|
usePanelInfo: selector => selector({ activePanelId: null }),
|
|
useSessions: emptySessions(),
|
|
useSessionStatus: noPendingInteraction(),
|
|
useWorkspaces: emptyWorkspaces(),
|
|
useSessionRetainInfo: () => undefined,
|
|
useResource,
|
|
useTranscriptView: bindSnapshotSelector(source),
|
|
setTranscriptView,
|
|
t: makeTranslate(dictionary),
|
|
}
|
|
render(<TranscriptViewRow {...props} />)
|
|
return { setTranscriptView, props }
|
|
}
|
|
|
|
describe('TranscriptViewRow', () => {
|
|
it('explains the preference and shows Compact by default', () => {
|
|
mount()
|
|
expect(screen.getByText('Conversation display')).toBeDefined()
|
|
expect(screen.getByText('Controls process content in completed turns')).toBeDefined()
|
|
expect(screen.getByRole('button', { name: /Compact/ }).getAttribute('aria-expanded')).toBe('false')
|
|
})
|
|
|
|
it('selects Normal and follows the mirrored value', () => {
|
|
const b = mount()
|
|
fireEvent.click(screen.getByRole('button', { name: /Compact/ }))
|
|
fireEvent.click(screen.getByRole('menuitem', { name: 'Normal' }))
|
|
expect(b.setTranscriptView).toHaveBeenCalledWith('normal')
|
|
const trigger = screen.getByRole('button', { name: /Normal/ })
|
|
fireEvent.click(trigger)
|
|
expect(screen.getByRole('menuitem', { name: 'Compact' })).toBeDefined()
|
|
fireEvent.pointerDown(document.body)
|
|
expect(screen.queryByRole('menuitem', { name: 'Compact' })).toBeNull()
|
|
})
|
|
|
|
it('shows the conversation-display values in Chinese', () => {
|
|
mount('compact', zh)
|
|
fireEvent.click(screen.getByRole('button', { name: '紧凑' }))
|
|
fireEvent.click(screen.getByRole('menuitem', { name: '标准' }))
|
|
expect(screen.getByRole('button', { name: '标准' })).toBeDefined()
|
|
})
|
|
})
|
|
|
|
|
|
describe('PerformanceUsageRow', () => {
|
|
it('selects compact statistics independently of conversation display', () => {
|
|
const b = mount()
|
|
const source = createSnapshotStore<PerformanceUsageMode>('detailed')
|
|
const setPerformanceUsage = vi.fn((mode: PerformanceUsageMode) => { source.set(mode) })
|
|
render(<PerformanceUsageRow
|
|
{...b.props}
|
|
usePerformanceUsage={bindSnapshotSelector(source)}
|
|
setPerformanceUsage={setPerformanceUsage}
|
|
/>)
|
|
expect(screen.getByText('Performance & usage')).toBeDefined()
|
|
fireEvent.click(screen.getByRole('button', { name: 'Detailed' }))
|
|
fireEvent.click(screen.getByRole('menuitem', { name: 'Compact' }))
|
|
expect(setPerformanceUsage).toHaveBeenCalledWith('compact')
|
|
expect(screen.getAllByRole('button', { name: 'Compact' })).toHaveLength(2)
|
|
expect(b.setTranscriptView).not.toHaveBeenCalled()
|
|
})
|
|
})
|