mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
* test: reproduce accumulated-workspace typing latency through real PTYs * test: make the bench harness self-checks falsifiable Review found four assertions that could not fail and one fixture gap: - `missingPtyArrivalCount`/`missingEchoCount` were hardcoded `0` and `validateExpectedSeqs` throws before them, so every assertion on them was vacuous and every report read `0`. The throw is the real guard and is already covered; drop the vestigial fields. - An absent status controller returned an all-zero result, which satisfied its own accepted-equals-generated equality. Assert presence first. - The byte-pacing control had only an upper bound, so a generator emitting no stream bytes passed. Add the lower bound. - `lineageEvery: 1` built zero lineage: no ordinal satisfies `% 1 === 1`. Offset the interval and cover the densest setting. - The documented control command never set ORCA_TYPING_BENCH, so it skipped instead of running.
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
export type AccumulatedWorkspaceFixtureOptions = {
|
|
repositories?: number
|
|
worktrees?: number
|
|
terminalTabs?: number
|
|
unifiedTabs?: number
|
|
panesPerTab?: number
|
|
sleepingRecords?: number
|
|
liveStatuses?: number
|
|
lineageEvery?: number
|
|
statusHistoryEntries?: number
|
|
}
|
|
|
|
export type NormalizedAccumulatedWorkspaceFixtureOptions =
|
|
Required<AccumulatedWorkspaceFixtureOptions>
|
|
|
|
const defaults: NormalizedAccumulatedWorkspaceFixtureOptions = {
|
|
repositories: 27,
|
|
worktrees: 870,
|
|
terminalTabs: 1_410,
|
|
unifiedTabs: 2_000,
|
|
panesPerTab: 1,
|
|
sleepingRecords: 857,
|
|
liveStatuses: 177,
|
|
lineageEvery: 8,
|
|
statusHistoryEntries: 3
|
|
}
|
|
|
|
function positiveInteger(value: number, fallback: number): number {
|
|
return Number.isInteger(value) && value > 0 ? value : fallback
|
|
}
|
|
|
|
export function normalizeAccumulatedWorkspaceFixtureOptions(
|
|
options: AccumulatedWorkspaceFixtureOptions
|
|
): NormalizedAccumulatedWorkspaceFixtureOptions {
|
|
const merged = { ...defaults, ...options }
|
|
const worktrees = positiveInteger(merged.worktrees, defaults.worktrees)
|
|
const repositories = Math.min(
|
|
worktrees,
|
|
positiveInteger(merged.repositories, defaults.repositories)
|
|
)
|
|
const terminalTabs = Math.max(
|
|
worktrees,
|
|
positiveInteger(merged.terminalTabs, defaults.terminalTabs)
|
|
)
|
|
const panesPerTab = positiveInteger(merged.panesPerTab, defaults.panesPerTab)
|
|
const paneCount = terminalTabs * panesPerTab
|
|
const sleepingRecords = Math.min(paneCount, Math.max(0, Math.floor(merged.sleepingRecords)))
|
|
return {
|
|
repositories,
|
|
worktrees,
|
|
terminalTabs,
|
|
unifiedTabs: Math.max(terminalTabs, positiveInteger(merged.unifiedTabs, defaults.unifiedTabs)),
|
|
panesPerTab,
|
|
sleepingRecords,
|
|
liveStatuses: Math.min(
|
|
paneCount - sleepingRecords,
|
|
Math.max(0, Math.floor(merged.liveStatuses))
|
|
),
|
|
lineageEvery: positiveInteger(merged.lineageEvery, defaults.lineageEvery),
|
|
statusHistoryEntries: positiveInteger(
|
|
merged.statusHistoryEntries,
|
|
defaults.statusHistoryEntries
|
|
)
|
|
}
|
|
}
|