Skip to content

zidane-ui/settings/testing/contract

import { … } from 'zidane-ui/settings/testing/contract'ui/src/settings/testing/contract.ts

Functions#

describeSettingsAccountsContractFunction#

Declares the shared suite of the providers and mcp groups for one implementation.

TypeScript
function describeSettingsAccountsContract(
  name: string,
  makeHarness: SettingsAccountsHarnessFactory,
  capabilities: readonly SettingsAccountsCapability[],
): void
Parameters
NameTypeDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsAccountsHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

capabilitiesreadonly SettingsAccountsCapability[]

The groups and actions the host offers. Every other one must be undefined.

ui/src/settings/testing/accounts.contract.ts:162

describeSettingsClaudeImportContractFunction#

Declares the shared SettingsHost.claudeImport suite for one implementation.

TypeScript
function describeSettingsClaudeImportContract(
  name: string,
  makeHarness: SettingsClaudeImportHarnessFactory,
  offered: boolean,
): void
Parameters
NameTypeDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsClaudeImportHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

offeredboolean

Whether the host offers claudeImport.

ui/src/settings/testing/claude-import.contract.ts:57

describeSettingsExtensionOptionsContractFunction#

Declares the shared extension options suite for one implementation.

TypeScript
function describeSettingsExtensionOptionsContract(
  name: string,
  makeHarness: SettingsExtensionOptionsHarnessFactory,
  capabilities: readonly SettingsExtensionOptionsCapability[],
): void
Parameters
NameTypeDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsExtensionOptionsHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

capabilitiesreadonly SettingsExtensionOptionsCapability[]

The members the host offers. Every other one must be undefined.

ui/src/settings/testing/extension-options.contract.ts:104

describeSettingsHostContractFunction#

Declares the shared SettingsHost suite for one implementation.

TypeScript
function describeSettingsHostContract(
  name: string,
  makeHarness: SettingsHostHarnessFactory,
  capabilities: readonly SettingsHostCapability[],
  traits?: SettingsHostContractTraits,
): void
Parameters
NameTypeDefaultDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsHostHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

capabilitiesreadonly SettingsHostCapability[]

The optional members the host offers. Every other optional member must be undefined.

traits?SettingsHostContractTraits{}

The failures the backend can stage.

ui/src/settings/testing/contract.ts:95

describeSettingsModelsContractFunction#

Declares the shared SettingsHost.models suite for one implementation.

TypeScript
function describeSettingsModelsContract(
  name: string,
  makeHarness: SettingsModelsHarnessFactory,
  capabilities: readonly SettingsModelsCapability[],
): void
Parameters
NameTypeDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsModelsHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

capabilitiesreadonly SettingsModelsCapability[]

The members of models the host offers. Every other one must be undefined.

ui/src/settings/testing/models.contract.ts:72

describeSettingsPerformanceContractFunction#

Declares the shared SettingsHost.performance suite for one implementation.

TypeScript
function describeSettingsPerformanceContract(
  name: string,
  makeHarness: SettingsPerformanceHarnessFactory,
  capabilities: false | readonly SettingsPerformanceCapability[],
  options?: SettingsPerformanceContractOptions,
): void
Parameters
NameTypeDefaultDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsPerformanceHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

capabilitiesfalse | readonly SettingsPerformanceCapability[]

The optional members the host offers; false: no performance at all.

options?SettingsPerformanceContractOptions{}

What else to check (refused watches).

ui/src/settings/testing/performance.contract.ts:103

describeSettingsSectionsContractFunction#

Declares the shared suite of the catalog and diagnostics groups for one implementation.

TypeScript
function describeSettingsSectionsContract(
  name: string,
  makeHarness: SettingsSectionsHarnessFactory,
  capabilities: readonly SettingsSectionsCapability[],
): void
Parameters
NameTypeDescription
namestring

The implementation's name, shown in the suite title.

makeHarnessSettingsSectionsHarnessFactory

Builds a fresh host over a backend that holds what it is given, once per test.

capabilitiesreadonly SettingsSectionsCapability[]

The groups the host offers. Every other group must be undefined.

ui/src/settings/testing/sections.contract.ts:195

Constants#

ACCOUNTS_CONTRACT_CWDConstant#

The folder the suite's MCP calls name.

TypeScript
const ACCOUNTS_CONTRACT_CWD = '/work/app'

ui/src/settings/testing/accounts.contract.ts:84

Interfaces#

SettingsAccountsBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsAccountsBackend
SettingsAccountsBackend properties
NameTypeDescription
instancesSettingsMcpInstance[]

The running processes of those servers.

providersSettingsProvider[]

The providers and their credentials.

serversSettingsMcpServer[]

The MCP servers of the folder the suite names (ACCOUNTS_CONTRACT_CWD).

ui/src/settings/testing/accounts.contract.ts:47

SettingsAccountsControlInterface#

Reads the backend and acts on it from outside.

TypeScript
interface SettingsAccountsControl
SettingsAccountsControl properties
NameTypeDescription
credentials(provider: string) => readonly SettingsCredential[]

The stored credentials of a provider now (no env).

finishSignIn() => void | Promise<void>

The browser of the sign-in that waits came back: it finishes.

restarts?() => readonly string[]

The servers restarted, in order. Required with mcp.restart.

serverNames() => string[]

The servers held now, by name.

ui/src/settings/testing/accounts.contract.ts:57

SettingsAccountsHarnessInterface#

A host built over a backend, its control, and how to tear them down.

TypeScript
interface SettingsAccountsHarness
SettingsAccountsHarness properties
NameTypeDescription
controlSettingsAccountsControl

Reads and acts on the backend.

hostSettingsHost

The host under test.

dispose?() => void

Closes listeners after each test.

ui/src/settings/testing/accounts.contract.ts:69

SettingsClaudeImportBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsClaudeImportBackend
SettingsClaudeImportBackend properties
NameTypeDescription
detectSettingsClaudeImportDetect

What ~/.claude holds.

summarySettingsClaudeImportSummary

What an import answers.

ui/src/settings/testing/claude-import.contract.ts:19

SettingsClaudeImportHarnessInterface#

A host built over a backend, and how to tear it down.

TypeScript
interface SettingsClaudeImportHarness
SettingsClaudeImportHarness properties
NameTypeDescription
hostSettingsHost

The host under test.

dispose?() => void

Closes listeners after each test.

runs?() => SettingsClaudeImportSelection[]

The selections the backend imported, in order.

ui/src/settings/testing/claude-import.contract.ts:27

SettingsExtensionOptionsBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsExtensionOptionsBackend
SettingsExtensionOptionsBackend properties
NameTypeDescription
actionsSettingsExtensionAction[]

The action rows declared.

runsRecord<string, SettingsExtensionActionResult>

What running each action answers, keyed extension:key.

schemaWireExtensionConfigSchema

The options declared (for every folder).

statusesRecord<string, SettingsExtensionActionStatus>

The probes, keyed extension:key.

ui/src/settings/testing/extension-options.contract.ts:36

SettingsExtensionOptionsHarnessInterface#

A host built over a backend, and how to tear it down.

TypeScript
interface SettingsExtensionOptionsHarness
SettingsExtensionOptionsHarness properties
NameTypeDescription
hostSettingsHost

The host under test.

created?() => string[]

The extensions scaffolded, by name.

dispose?() => void

Closes listeners after each test.

ui/src/settings/testing/extension-options.contract.ts:48

SettingsHostContractBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsHostContractBackend
SettingsHostContractBackend properties
NameTypeDescription
unreadableboolean

Reads fail.

valuesPartial<Settings>

The stored settings (a partial document: the host fills the rest from DEFAULT_SETTINGS).

writableboolean

This connection may write.

ui/src/settings/testing/contract.ts:38

SettingsHostContractControlInterface#

Reads the backend and changes it from outside.

TypeScript
interface SettingsHostContractControl
SettingsHostContractControl properties
NameTypeDescription
refuse?(next: boolean) => void

Refuse the next writes (traits.refusedWrite).

store(patch: Partial<Settings>) => void

Another writer changed the stored settings. The host shows them after its next refresh (or sooner).

stored() => Partial<Settings>

The settings stored now.

ui/src/settings/testing/contract.ts:48

SettingsHostContractTraitsInterface#

Failures the backend can stage. Default: both.

TypeScript
interface SettingsHostContractTraits
SettingsHostContractTraits properties
NameTypeDescription
failedRead?boolean

A read can fail (the document lands on an error).

refusedWrite?boolean

A write can be refused (control.refuse).

ui/src/settings/testing/contract.ts:73

SettingsHostHarnessInterface#

A host built over a backend, the backend's control, and how to tear them down.

TypeScript
interface SettingsHostHarness
SettingsHostHarness properties
NameTypeDescription
controlSettingsHostContractControl

Reads and changes the backend.

hostSettingsHost

The host under test.

dispose?() => void

Closes listeners after each test.

ui/src/settings/testing/contract.ts:58

SettingsModelsBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsModelsBackend
SettingsModelsBackend properties
NameTypeDescription
decisionModelsSettingsDecisionModel[]

The decision models (for every folder).

lastUsedModelPickRef | null

The last model picked.

testsRecord<string, SettingsModelTest>

How a test of each model goes, by model setting ("provider/model"); a model left out fails.

ui/src/settings/testing/models.contract.ts:25

SettingsModelsHarnessInterface#

A host built over a backend, and how to tear it down.

TypeScript
interface SettingsModelsHarness
SettingsModelsHarness properties
NameTypeDescription
hostSettingsHost

The host under test.

dispose?() => void

Closes listeners after each test.

ui/src/settings/testing/models.contract.ts:35

SettingsPerformanceBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsPerformanceBackend
SettingsPerformanceBackend properties
NameTypeDescription
profilePerfProfileOutcome

What a profile answers.

reportPathstring

Where a report is written.

samplesPerfSample[]

The samples held, oldest first.

threadsRecord<number, PerfOsThread[]>

Each process's threads.

watchError?PerfWatchError

Set: the backend refuses every watch with this (only with watchErrors).

ui/src/settings/testing/performance.contract.ts:34

SettingsPerformanceContractOptionsInterface#

What the suite checks beyond the members.

TypeScript
interface SettingsPerformanceContractOptions
SettingsPerformanceContractOptions properties
NameTypeDescription
watchErrors?boolean

The host can refuse a watch: build it over backend.watchError.

ui/src/settings/testing/performance.contract.ts:48

SettingsPerformanceControlInterface#

Drives the backend and reads it back.

TypeScript
interface SettingsPerformanceControl
SettingsPerformanceControl properties
NameTypeDescription
emit(sample: PerfSample) => void

The backend takes a sample: every watcher gets it.

profiles() => { seconds: number; target: PerfProfileTarget }[]

Profiles the backend recorded, in order.

resets() => number

Counter resets the backend took.

watching() => number

How many watches are open on the backend (it samples only while one is).

ui/src/settings/testing/performance.contract.ts:54

SettingsPerformanceHarnessInterface#

A host built over a backend, its control, and how to tear them down.

TypeScript
interface SettingsPerformanceHarness
SettingsPerformanceHarness properties
NameTypeDescription
controlSettingsPerformanceControl

Drives the backend: pushes samples, fails calls.

hostSettingsHost

The host under test, its performance member over the backend.

dispose?() => void

Tears the host down after the test.

ui/src/settings/testing/performance.contract.ts:66

SettingsSectionsBackendInterface#

What the backend behind the host holds.

TypeScript
interface SettingsSectionsBackend
SettingsSectionsBackend properties
NameTypeDescription
environmentsEnvironmentDescriptor[]

The environment kinds.

extensionsSettingsExtension[]

The extensions on disk (for every folder).

hostCatalogFixtureHostCatalogs | null

null: the host can't list its catalogs (an older server).

instructionsRecord<string, ContextSegmentsReport>

Each session's prompt.

logsLogRecord[]

The log records held.

pluginsSettingsPlugin[]

The plugins (for every folder).

skillsSkillConfig[]

The skills on disk (for every folder).

ui/src/settings/testing/sections.contract.ts:46

SettingsSectionsControlInterface#

Reads the backend and changes it from outside.

TypeScript
interface SettingsSectionsControl
SettingsSectionsControl properties
NameTypeDescription
catalogChanged(kind: SettingsCatalogKind) => void

One of the host's catalogs changed there (another client installed something).

environmentChanges() => readonly EnvironmentSettingsChange[]

Environment edits the backend took, in order.

extensionNames() => string[]

The extensions held now (by name).

log(record: LogRecord) => void

The backend logs a record.

skillNames() => string[]

The skills held now (by name).

ui/src/settings/testing/sections.contract.ts:64

SettingsSectionsHarnessInterface#

A host built over a backend, its control, and how to tear them down.

TypeScript
interface SettingsSectionsHarness
SettingsSectionsHarness properties
NameTypeDescription
controlSettingsSectionsControl

Reads and changes the backend.

hostSettingsHost

The host under test.

dispose?() => void

Closes listeners after each test.

ui/src/settings/testing/sections.contract.ts:78

Types#

SettingsAccountsCapabilityType#

A group of SettingsHost this suite covers, or one of its optional actions.

TypeScript
type SettingsAccountsCapability =
  | 'providers'
  | 'providers.setApiKey'
  | 'providers.configure'
  | 'providers.clear'
  | 'providers.remove'
  | 'providers.setPreferred'
  | 'providers.rename'
  | 'providers.signIn'
  | 'mcp'
  | 'mcp.test'
  | 'mcp.signIn'
  | 'mcp.signOut'
  | 'mcp.add'
  | 'mcp.remove'
  | 'mcp.instances'
  | 'mcp.restart'

ui/src/settings/testing/accounts.contract.ts:25

SettingsAccountsHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsAccountsHarnessFactory = (backend: SettingsAccountsBackend) => SettingsAccountsHarness | Promise<SettingsAccountsHarness>

ui/src/settings/testing/accounts.contract.ts:79

SettingsClaudeImportHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsClaudeImportHarnessFactory = (backend: SettingsClaudeImportBackend) => SettingsClaudeImportHarness | Promise<SettingsClaudeImportHarness>

ui/src/settings/testing/claude-import.contract.ts:37

SettingsExtensionOptionsCapabilityType#

An extension options member of SettingsHost.extensions.

TypeScript
type SettingsExtensionOptionsCapability =
  | 'configSchema'
  | 'actions'
  | 'actionStatuses'
  | 'runAction'
  | 'create'

ui/src/settings/testing/extension-options.contract.ts:25

SettingsExtensionOptionsHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsExtensionOptionsHarnessFactory = (backend: SettingsExtensionOptionsBackend) => SettingsExtensionOptionsHarness | Promise<SettingsExtensionOptionsHarness>

ui/src/settings/testing/extension-options.contract.ts:58

SettingsHostCapabilityType#

An optional SettingsHost member.

TypeScript
type SettingsHostCapability = 'update' | 'writable'

ui/src/settings/testing/contract.ts:33

SettingsHostHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsHostHarnessFactory = (backend: SettingsHostContractBackend) => SettingsHostHarness | Promise<SettingsHostHarness>

ui/src/settings/testing/contract.ts:68

SettingsModelsCapabilityType#

A member of SettingsHost.models.

TypeScript
type SettingsModelsCapability = 'decisionModels' | 'test' | 'testDecision' | 'lastUsed'

ui/src/settings/testing/models.contract.ts:20

SettingsModelsHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsModelsHarnessFactory = (backend: SettingsModelsBackend) => SettingsModelsHarness | Promise<SettingsModelsHarness>

ui/src/settings/testing/models.contract.ts:43

SettingsPerformanceCapabilityType#

An optional member of SettingsHost.performance.

TypeScript
type SettingsPerformanceCapability =
  | 'threads'
  | 'resetCounters'
  | 'exportReport'
  | 'profile'

ui/src/settings/testing/performance.contract.ts:29

SettingsPerformanceHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsPerformanceHarnessFactory = (backend: SettingsPerformanceBackend) => SettingsPerformanceHarness | Promise<SettingsPerformanceHarness>

ui/src/settings/testing/performance.contract.ts:76

SettingsSectionsCapabilityType#

A catalog or diagnostics group of SettingsHost.

TypeScript
type SettingsSectionsCapability =
  | 'skills'
  | 'extensions'
  | 'plugins'
  | 'instructions'
  | 'environments'
  | 'logs'
  | 'hostCatalog'
  | 'paths'

ui/src/settings/testing/sections.contract.ts:31

SettingsSectionsHarnessFactoryType#

Builds a fresh host (and its backend) for one test.

TypeScript
type SettingsSectionsHarnessFactory = (backend: SettingsSectionsBackend) => SettingsSectionsHarness | Promise<SettingsSectionsHarness>

ui/src/settings/testing/sections.contract.ts:88