refactor(client): name the compile face in every client test filename

A test file under packages/client now says which face it covers:
`*.client.spec.{ts,tsx}` and its `*.client.{ts,tsx}` helpers belong to the
Client aggregate, `*.host.spec.ts` to the host aggregate. The carrier's four
node-half specs take the Host suffix.

The two suffixes are mutually exclusive, so each aggregate excludes the
other's and both keep one broad test glob: `exclude` wins over `include`, and
`packages/client/**` no longer has to be excluded wholesale from the host
program with per-file `files` entries carved back out of it. A Host-face spec
that reaches only Host source therefore needs no cross-face project
reference, which the split-project rule rejects.

vitest still discovers every file through `**/*.spec.{ts,tsx}`.
This commit is contained in:
imccyu
2026-08-12 01:41:40 +08:00
parent 7c3bd75bcc
commit 7ad54e7791
246 changed files with 47 additions and 35 deletions
@@ -10,7 +10,7 @@ import { describe, expect, it, vi } from 'vitest'
import type { SessionId } from '../src/client/api.ts' import type { SessionId } from '../src/client/api.ts'
import type { ConnectionState } from '../src/client/connection.ts' import type { ConnectionState } from '../src/client/connection.ts'
import { ConnectionController } from '../src/client/connection.ts' import { ConnectionController } from '../src/client/connection.ts'
import { FakeApiClient, deferred, ok } from './fake-api.ts' import { FakeApiClient, deferred, ok } from './fake-api.client.ts'
const SID = 'fk-c1' as SessionId const SID = 'fk-c1' as SessionId
const FAST = { backoffBaseMs: 10, backoffFactor: 1, backoffMaxMs: 10, streamOpenTimeoutMs: 500 } const FAST = { backoffBaseMs: 10, backoffFactor: 1, backoffMaxMs: 10, streamOpenTimeoutMs: 500 }
@@ -14,7 +14,7 @@ import type { ConversationNodeDefinition } from '../src/client/contract/conversa
import { Session } from '../src/client/sessions/session.ts' import { Session } from '../src/client/sessions/session.ts'
import type { SessionsService } from '../src/client/sessions/service.ts' import type { SessionsService } from '../src/client/sessions/service.ts'
import type { WorkspacesService } from '../src/client/workspaces/service.ts' import type { WorkspacesService } from '../src/client/workspaces/service.ts'
import { FakeApiClient, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, fakeRemote, ok } from './fake-api.client.ts'
interface Bench { interface Bench {
ctx: Context ctx: Context
@@ -8,7 +8,7 @@ import type {
} from '../src/client/contract/conversation.ts' } from '../src/client/contract/conversation.ts'
import { Session } from '../src/client/sessions/session.ts' import { Session } from '../src/client/sessions/session.ts'
import { SessionsService } from '../src/client/sessions/service.ts' import { SessionsService } from '../src/client/sessions/service.ts'
import { FakeApiClient, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, fakeRemote, ok } from './fake-api.client.ts'
function eventDefinition(kind: string): ConversationNodeDefinition<null> { function eventDefinition(kind: string): ConversationNodeDefinition<null> {
return { return {
@@ -6,8 +6,8 @@
import { describe, expect, it, vi } from 'vitest' import { describe, expect, it, vi } from 'vitest'
import type { SessionId } from '@deepseek-ai/dsh-api-remotes/client' import type { SessionId } from '@deepseek-ai/dsh-api-remotes/client'
import { SessionManager } from '../src/client/sessions/manager.ts' import { SessionManager } from '../src/client/sessions/manager.ts'
import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.client.ts'
import { entries, plainTurn } from './event-script.ts' import { entries, plainTurn } from './event-script.client.ts'
const S1 = 'fk-m1' as SessionId const S1 = 'fk-m1' as SessionId
const S2 = 'fk-m2' as SessionId const S2 = 'fk-m2' as SessionId
@@ -12,8 +12,8 @@ import type { SessionId } from '@deepseek-ai/dsh-api-remotes/client'
import { ProjectionValueStore } from '../src/client/sessions/projection-store.ts' import { ProjectionValueStore } from '../src/client/sessions/projection-store.ts'
import { Session } from '../src/client/sessions/session.ts' import { Session } from '../src/client/sessions/session.ts'
import { SessionManager } from '../src/client/sessions/manager.ts' import { SessionManager } from '../src/client/sessions/manager.ts'
import { FakeApiClient, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, fakeRemote, ok } from './fake-api.client.ts'
import { entries, plainTurn } from './event-script.ts' import { entries, plainTurn } from './event-script.client.ts'
// Test-domain keys merged into the projection map (the Service Definition package's // Test-domain keys merged into the projection map (the Service Definition package's
// pure-type outlet), the same way domain host plugins merge theirs. // pure-type outlet), the same way domain host plugins merge theirs.
@@ -10,7 +10,7 @@ import type { SessionEvent } from '@deepseek-ai/dsh-session/types'
import type { MessageId, MuxFrame, RpcId, SessionId } from '@deepseek-ai/dsh-api-remotes/client' import type { MessageId, MuxFrame, RpcId, SessionId } from '@deepseek-ai/dsh-api-remotes/client'
import { Session } from '../src/client/sessions/session.ts' import { Session } from '../src/client/sessions/session.ts'
import { SessionManager } from '../src/client/sessions/manager.ts' import { SessionManager } from '../src/client/sessions/manager.ts'
import { FakeApiClient, fakeRemote } from './fake-api.ts' import { FakeApiClient, fakeRemote } from './fake-api.client.ts'
const SID = 'fk-q1' as SessionId const SID = 'fk-q1' as SessionId
const text = (value: string): ContentBlock[] => [{ type: 'text', text: value }] const text = (value: string): ContentBlock[] => [{ type: 'text', text: value }]
@@ -17,8 +17,8 @@ import type {
ConversationRuntime, ConversationSnapshot, ConversationTimelineSnapshot, ConversationRuntime, ConversationSnapshot, ConversationTimelineSnapshot,
ConversationViewDefinition, ConversationViewDefinition,
} from '../src/client/index.ts' } from '../src/client/index.ts'
import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.client.ts'
import { entries, ev, plainTurn } from './event-script.ts' import { entries, ev, plainTurn } from './event-script.client.ts'
const SID = 'fk-s1' as SessionId const SID = 'fk-s1' as SessionId
const PARENT = 'fk-parent' as SessionId const PARENT = 'fk-parent' as SessionId
@@ -10,7 +10,7 @@ import { Context } from '@deepseek-ai/cordis'
import { afterEach, describe, expect, it, vi } from 'vitest' import { afterEach, describe, expect, it, vi } from 'vitest'
import type { SessionId } from '@deepseek-ai/dsh-api-remotes/client' import type { SessionId } from '@deepseek-ai/dsh-api-remotes/client'
import { SessionCreateError, SessionsService, scopeOf } from '../src/client/sessions/service.ts' import { SessionCreateError, SessionsService, scopeOf } from '../src/client/sessions/service.ts'
import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.client.ts'
const sid = (s: string): SessionId => s as SessionId const sid = (s: string): SessionId => s as SessionId
@@ -13,7 +13,7 @@ import TypertRegistry from '@deepseek-ai/dsh-typert-registry'
// key face and per-event listener signatures. // key face and per-event listener signatures.
import type {} from '@deepseek-ai/dsh-api-remotes/client' import type {} from '@deepseek-ai/dsh-api-remotes/client'
import * as RuntimeClient from '../src/client/index.ts' import * as RuntimeClient from '../src/client/index.ts'
import { FakeApiClient, fakeRemote } from './fake-api.ts' import { FakeApiClient, fakeRemote } from './fake-api.client.ts'
/** /**
* Compile-time face of `ctx.remote.$on`, asserted by type-checking this file * Compile-time face of `ctx.remote.$on`, asserted by type-checking this file
@@ -4,7 +4,7 @@ import type { SessionId, WorkspaceId, WorkspaceView } from '@deepseek-ai/dsh-api
import { SessionsService } from '../src/client/sessions/service.ts' import { SessionsService } from '../src/client/sessions/service.ts'
import { WorkspaceManager } from '../src/client/workspaces/manager.ts' import { WorkspaceManager } from '../src/client/workspaces/manager.ts'
import { DirectoryBrowseError, WorkspaceCreateError, WorkspacesService } from '../src/client/workspaces/service.ts' import { DirectoryBrowseError, WorkspaceCreateError, WorkspacesService } from '../src/client/workspaces/service.ts'
import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.ts' import { FakeApiClient, deferred, err, fakeRemote, ok } from './fake-api.client.ts'
const sid = (id: string): SessionId => id as SessionId const sid = (id: string): SessionId => id as SessionId
const wid = (id: string): WorkspaceId => id as WorkspaceId const wid = (id: string): WorkspaceId => id as WorkspaceId
@@ -24,7 +24,7 @@ import {
import { AssistantMarkdown } from '../src/client/chat/AssistantMarkdown.tsx' import { AssistantMarkdown } from '../src/client/chat/AssistantMarkdown.tsx'
import { StatsLine, type StatsLineProps } from '../src/client/chat/StatsLine.tsx' import { StatsLine, type StatsLineProps } from '../src/client/chat/StatsLine.tsx'
import { zh } from '../src/client/locales.ts' import { zh } from '../src/client/locales.ts'
import { chatSnapshotFixture } from './chat-snapshot-fixture.ts' import { chatSnapshotFixture } from './chat-snapshot-fixture.client.ts'
/** jsdom has no ResizeObserver; StatsLine watches its row for ellipsis truncation through one. */ /** jsdom has no ResizeObserver; StatsLine watches its row for ellipsis truncation through one. */
class ResizeObserverStub { class ResizeObserverStub {
@@ -14,7 +14,7 @@ import { en as commonEn } from '@deepseek-ai/dsh-client-locale/src/locales/en.ts
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts' import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
import { StatsLine, contextOccupancy, deriveStats, formatDuration, formatTokens, type StatsLineProps } from '../src/client/chat/StatsLine.tsx' import { StatsLine, contextOccupancy, deriveStats, formatDuration, formatTokens, type StatsLineProps } from '../src/client/chat/StatsLine.tsx'
import { en, zh } from '../src/client/locales.ts' import { en, zh } from '../src/client/locales.ts'
import { chatSnapshotFixture } from './chat-snapshot-fixture.ts' import { chatSnapshotFixture } from './chat-snapshot-fixture.client.ts'
// Mirrors the real lookup chain (conversation namespace, then common). // Mirrors the real lookup chain (conversation namespace, then common).
const t: StatsLineProps['t'] = makeTranslate(zh, commonZh) const t: StatsLineProps['t'] = makeTranslate(zh, commonZh)
@@ -32,7 +32,7 @@ import {
} from '../src/client/chat/MessageItem.tsx' } from '../src/client/chat/MessageItem.tsx'
import { TurnTailNodeView } from '../src/client/chat/TurnTailNodeView.tsx' import { TurnTailNodeView } from '../src/client/chat/TurnTailNodeView.tsx'
import { formatRunDuration } from '../src/client/chat/message-chrome.ts' import { formatRunDuration } from '../src/client/chat/message-chrome.ts'
import { chatSnapshotFixture } from './chat-snapshot-fixture.ts' import { chatSnapshotFixture } from './chat-snapshot-fixture.client.ts'
afterEach(() => { afterEach(() => {
cleanup() cleanup()
@@ -17,7 +17,7 @@ import { AssistantMarkdown, type AssistantMarkdownProps } from '../src/client/ch
import { StatsLine } from '../src/client/chat/StatsLine.tsx' import { StatsLine } from '../src/client/chat/StatsLine.tsx'
import { DetailsPanel } from '../src/client/skeleton/DetailsPanel.tsx' import { DetailsPanel } from '../src/client/skeleton/DetailsPanel.tsx'
import { zh } from '../src/client/locales.ts' import { zh } from '../src/client/locales.ts'
import { chatSnapshotFixture } from './chat-snapshot-fixture.ts' import { chatSnapshotFixture } from './chat-snapshot-fixture.client.ts'
// Mirrors the real lookup chain (conversation namespace, then common). // Mirrors the real lookup chain (conversation namespace, then common).
const t: AssistantMarkdownProps['t'] = makeTranslate(zh, commonZh) const t: AssistantMarkdownProps['t'] = makeTranslate(zh, commonZh)
@@ -16,7 +16,7 @@ import {
} from '@deepseek-ai/dsh-client-runtime/client' } from '@deepseek-ai/dsh-client-runtime/client'
import { SlashService } from '@deepseek-ai/dsh-client-ui-slash/client' import { SlashService } from '@deepseek-ai/dsh-client-ui-slash/client'
import type { ClientSessionContext, CommandClaim, PickOutcome, SubmitOutcome } from '@deepseek-ai/dsh-client-ui-slash/client' import type { ClientSessionContext, CommandClaim, PickOutcome, SubmitOutcome } from '@deepseek-ai/dsh-client-ui-slash/client'
import { FakeApiClient, fakeRemote, ok } from '../../runtime/tests/fake-api.ts' import { FakeApiClient, fakeRemote, ok } from '../../runtime/tests/fake-api.client.ts'
import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts' import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
import { SessionInputShell } from '../src/client/input/facade.ts' import { SessionInputShell } from '../src/client/input/facade.ts'

Some files were not shown because too many files have changed in this diff Show More