1
0
Эх сурвалжийг харах

refactor(client): remove fixture-only API residue

imccyu 4 өдөр өмнө
parent
commit
c0e8252afe

+ 2 - 2
packages/client/connection/src/client/api.ts

@@ -16,8 +16,8 @@ export type { ContentBlock, StreamChunk } from '@deepseek-ai/dsh-llm/types'
 import type { RpcResponse, RpcResult } from '../rpc.ts'
 
 /**
- * Return the business result carried by a narrow fixture response.
- * @param response - fixture response to unwrap.
+ * Return the business result carried by an RPC response.
+ * @param response - RPC response to unwrap.
  * @returns the response's business result.
  */
 export function resultOf<T>(response: RpcResponse<T>): RpcResult<T> {

+ 0 - 2
packages/client/file-upload/src/client/contract.ts

@@ -13,8 +13,6 @@ export interface FileUploadProgress {
 
 /** Browser upload service addressed by one Session identity. */
 export interface FileUploadService {
-  /** Whether this page has a Host-backed background upload carrier. */
-  readonly available: boolean
   /**
    * Store one file for a Session. Blob and stream bodies use
    * the background carrier; exact bytes use Remote.

+ 0 - 1
packages/client/file-upload/src/client/runtime.ts

@@ -160,7 +160,6 @@ interface FileUploadTransport {
 
 /** Cordis service that owns one background carrier per upload operation. */
 export class FileUploadRuntime extends Service implements FileUploadService {
-  readonly available = true
   private readonly transport: FileUploadTransport
 
   /** @param ctx - providing Client context. */

+ 0 - 1
packages/client/ui-conversation/tests/apply-inject.client.spec.tsx

@@ -42,7 +42,6 @@ async function bench() {
     },
   }))
   const uploads = new Map<SessionId, (...args: unknown[]) => Promise<unknown>>([[ROOT, rootUpload]])
-  runtime.fileUpload.available = true
   runtime.fileUpload.upload = (sessionId: SessionId, ...args: unknown[]) => {
     const upload = uploads.get(sessionId)
     if (upload === undefined) throw new Error('test file upload has no Session fixture')

+ 0 - 1
packages/client/ui-conversation/tests/service-orchestration.client.spec.ts

@@ -17,7 +17,6 @@ import { zh } from '../src/client/locales.ts'
 
 async function bench(maxConcurrentFileUploads = 2) {
   const runtime = await SlotTestRuntime.create()
-  runtime.fileUpload.available = true
   runtime.fileUpload.upload = (sessionId: SessionId, ...args: unknown[]) => {
     const session = runtime.sessions.behavior(sessionId) as {
       uploadFile?: (...input: unknown[]) => Promise<unknown>

+ 2 - 2
packages/test-support/client-runtime/README.i18n.yaml

@@ -2,5 +2,5 @@
 # side as of the last confirmed-consistent state. Both languages carry equal authority;
 # after editing either side, bring the other along and re-record with:
 #   pnpm run verify-translation-pairing --write packages/test-support/client-runtime/README.md
-README.md: 64a686f08ec2778de941bedfb70b3a1de2d542b9
-README.zh.md: a9c85ca3b281f62dc57bffdaf705ea3b33e84941
+README.md: 014bcbf8bc0ed9be596e2a20c07f57c80aaaf7dc
+README.zh.md: a14a5281c58a5ea4a8a49e1a826397ae91e5f115

+ 1 - 1
packages/test-support/client-runtime/README.md

@@ -40,7 +40,7 @@ expect(view.container).toMatchSnapshot()
 await runtime.dispose()
 ```
 
-`mount` prechecks required services and fails loud when one is missing — `provide(name, value)` supplies an extra service first. The runtime provides an unavailable `fileUpload` stub so assemblies can mount; replace `runtime.fileUpload.upload` before mounting when a test exercises upload behavior. `storeOf(key, scopeKey)` returns the live store instance the renderer hands a slot's component for identity and action-driven-write assertions.
+`mount` prechecks required services and fails loud when one is missing — `provide(name, value)` supplies an extra service first. The runtime provides a `fileUpload` stub that rejects every call until a suite replaces `runtime.fileUpload.upload`. `storeOf(key, scopeKey)` returns the live store instance the renderer hands a slot's component for identity and action-driven-write assertions.
 
 The optional render options select a keyed entry with `entryKey` or a list item with `only`; `view.update(owner)` retains that selection. `runtime.panelInfo` supplies the default `usePanelInfo` source with no global panel selected. Release it with `releasePanelInfoSource()` before mounting the production Layout owner. `dispose()` releases both default Workspace and panel-info root sources; early release is idempotent and does not remove replacement owners.
 

+ 1 - 1
packages/test-support/client-runtime/README.zh.md

@@ -40,7 +40,7 @@ expect(view.container).toMatchSnapshot()
 await runtime.dispose()
 ```
 
-`mount` 会预检必需服务,缺失时自明报错——先用 `provide(name, value)` 提供额外服务。运行时会提供不可用的 `fileUpload` 替身,使装配可以挂载;测试上传行为时,需要在挂载前替换 `runtime.fileUpload.upload`。`storeOf(key, scopeKey)` 返回渲染器交给 slot 组件的实时存储实例,用于身份与动作驱动写入断言。
+`mount` 会预检必需服务,缺失时自明报错——先用 `provide(name, value)` 提供额外服务。运行时提供的 `fileUpload` 替身会拒绝每次调用,直到测试套件替换 `runtime.fileUpload.upload`。`storeOf(key, scopeKey)` 返回渲染器交给 slot 组件的实时存储实例,用于身份与动作驱动写入断言。
 
 可选渲染参数通过 `entryKey` 选择 keyed 条目,或通过 `only` 选择 list 条目;`view.update(owner)` 保留该选择。`runtime.panelInfo` 提供默认的 `usePanelInfo` 数据源,初始不选中全局面板。挂载生产 Layout 所有者之前,先调用 `releasePanelInfoSource()` 释放该数据源。`dispose()` 同时释放默认的工作区与面板信息根数据源;提前释放是幂等的,不会移除替代它们的所有者。
 

+ 2 - 2
packages/test-support/client-runtime/src/assembly/test-client.ts

@@ -164,7 +164,7 @@ export class TestClient {
    * boot graph; afterwards optionally mount and wait for the connection. The
    * bound row replaces only the page-global input adapter: both paths call
    * `installConnection`, while this path supplies the mock carrier, uses
-   * default recovery timings, and captures the current page location once for
+   * default recovery timings, and captures the current page hostname once for
    * later reloads. A caller-provided Connection row remains unchanged and owns
    * its readiness behavior. The `@deepseek-ai/dsh-api-remotes` row is
    * dropped from the roster: its generated Remote clients exist only in built
@@ -194,7 +194,7 @@ export class TestClient {
     const ctx = new Context()
     const pageLocation = typeof location === 'undefined'
       ? undefined
-      : { hostname: location.hostname, search: location.search }
+      : { hostname: location.hostname }
     let mountPoint: MountPoint = { element: undefined, owned: false }
     let release: (() => void) | undefined
     const restore = (): void => {

+ 0 - 3
packages/test-support/client-runtime/src/index.ts

@@ -113,8 +113,6 @@ export interface FeatureHandle {
 
 /** Mutable fail-loud file-upload stub installed by {@link SlotTestRuntime}. */
 export interface TestFileUpload {
-  /** Availability reported to the feature under test. */
-  available: boolean
   /** Test-supplied upload behavior; the default rejects every call. */
   upload: (sessionId: SessionId, ...args: unknown[]) => Promise<unknown>
 }
@@ -245,7 +243,6 @@ export class SlotTestRuntime {
     this.sessions = new TestSessions(this.stabilizer, ctx)
     this.workspaces = new TestWorkspaces(this.stabilizer)
     this.fileUpload = {
-      available: false,
       upload: () => Promise.reject(new Error('client test runtime: file upload is not stubbed')),
     }
     ctx.provide('sessions', this.sessions)

+ 0 - 1
packages/test-support/client-runtime/tests/helpers.client.spec.tsx

@@ -105,7 +105,6 @@ describe('fixture helpers', () => {
 
   it('rejects an upload until a suite replaces the default stub', async () => {
     const runtime = await SlotTestRuntime.create()
-    expect(runtime.fileUpload.available).toBe(false)
     await expect(runtime.fileUpload.upload('fixture-session' as SessionId)).rejects.toThrow('file upload is not stubbed')
     await runtime.dispose()
   })