refactor: organize sidebar inputs by concrete owners

This commit is contained in:
Neil
2026-11-12 15:37:22 -08:00
parent c702d7e20c
commit 2fa7068646
67 changed files with 318 additions and 499 deletions
+1 -1
View File
@@ -55,7 +55,7 @@
1 src/main/runtime/rpc/transports/websocket/remote-runtime-server-heartbeat.ts
1 src/main/runtime/rpc/server/runtime-metadata-ownership-watch.ts
1 src/main/runtime/rpc/transports/unix-socket-transport.ts
1 src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts
1 src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.ts
1 src/main/runtime/terminal/input/agent-prompt-permission-hold.ts
1 src/main/runtime/terminal/output/terminal-derived-agent-facts.ts
1 src/main/runtime/terminal/wait/terminal-idle-polls.ts
@@ -3545,30 +3545,30 @@
"src/main/runtime/session-tabs/session-tabs-windowed-main-change.test.ts": 4444,
"src/main/runtime/orchestration/terminal-authority/settled-worker-process-replacement.test.ts": 5013,
"src/main/runtime/sidebar-inputs/cached-scan.test.ts": 106,
"src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts": 378,
"src/main/runtime/sidebar-inputs/orca-runtime-closed-tab-retention.test.ts": 5233,
"src/main/runtime/sidebar-inputs/orca-runtime-project-catalog.test.ts": 4975,
"src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.test.ts": 378,
"src/main/runtime/sidebar-inputs/temporal/orca-runtime-closed-tab-retention.test.ts": 5233,
"src/main/runtime/sidebar-inputs/catalog/orca-runtime-project-catalog.test.ts": 4975,
"src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts": 3968,
"src/main/runtime/sidebar-inputs/orca-runtime-sort-stamps.test.ts": 3799,
"src/main/runtime/sidebar-inputs/orca-runtime-terminal-use.test.ts": 4460,
"src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.test.ts": 3633,
"src/main/runtime/sidebar-inputs/orca-runtime-workspace-unread.test.ts": 4608,
"src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts": 340,
"src/main/runtime/sidebar-inputs/repo-icon-data-urls.test.ts": 250,
"src/main/runtime/sidebar-inputs/temporal/orca-runtime-sort-stamps.test.ts": 3799,
"src/main/runtime/sidebar-inputs/temporal/orca-runtime-terminal-use.test.ts": 4460,
"src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.test.ts": 3633,
"src/main/runtime/sidebar-inputs/temporal/orca-runtime-workspace-unread.test.ts": 4608,
"src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts": 340,
"src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.test.ts": 250,
"src/main/runtime/sidebar-inputs/repo-icon-remote-fetch.test.ts": 101,
"src/main/runtime/sidebar-inputs/sidebar-clock.test.ts": 45,
"src/main/runtime/sidebar-inputs/sidebar-inputs-feed-announcements.test.ts": 1954,
"src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.test.ts": 496,
"src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.test.ts": 162,
"src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test.ts": 387,
"src/main/runtime/sidebar-inputs/sidebar-project-catalog.test.ts": 416,
"src/main/runtime/sidebar-inputs/sidebar-retention-owner.test.ts": 77,
"src/main/runtime/sidebar-inputs/sort-stamp-records-twins.test.ts": 246,
"src/main/runtime/sidebar-inputs/sort-stamps-producer.test.ts": 813,
"src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.test.ts": 696,
"src/main/runtime/sidebar-inputs/workspace-git-identity.test.ts": 50,
"src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts": 4181,
"src/main/runtime/sidebar-inputs/workspace-viewers.test.ts": 65,
"src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.test.ts": 162,
"src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.test.ts": 387,
"src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.test.ts": 416,
"src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.test.ts": 77,
"src/main/runtime/workspaces/metadata/workspace-activity-records-twins.test.ts": 246,
"src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.test.ts": 813,
"src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.test.ts": 696,
"src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.test.ts": 50,
"src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.test.ts": 4181,
"src/main/runtime/sidebar-inputs/temporal/workspace-viewers.test.ts": 65,
"src/main/runtime/terminal/output/stale-title-display-surfaces.test.ts": 4456,
"src/main/runtime/agent-session/lifecycle/structured-agent-cli-writers.test.ts": 140,
"src/main/runtime/agent-session/lifecycle/structured-agent-session-history-close-race.test.ts": 5020,
+6 -6
View File
@@ -43,13 +43,13 @@
"../src/main/source-control/hosted-review-provider-read.ts",
"../src/main/persistence/profile-state-cutover-fixture.ts",
"../src/main/runtime/sidebar-inputs/sidebar-clock.ts",
"../src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts",
"../src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.ts",
"../src/main/runtime/sidebar-inputs/producer-revision.ts",
"../src/main/runtime/sidebar-inputs/sidebar-inputs-feed.ts",
"../src/main/runtime/sidebar-inputs/sidebar-inputs-feed-log.ts",
"../src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.ts",
"../src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pins.ts",
"../src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture.ts",
"../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.ts",
"../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-log.ts",
"../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.ts",
"../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pins.ts",
"../src/main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture.ts",
"../src/main/jira/adf-markdown.ts",
"../src/main/jira/adf-text-marks.ts",
"../src/main/jira/adf-media-destination.ts",
@@ -17,7 +17,7 @@ import {
readWorkspaceRecord,
writeWorkspaceRecord,
type WorkspaceRecordStore
} from '../runtime/sidebar-inputs/sort-stamp-records'
} from '../runtime/workspaces/metadata/workspace-activity-records'
import { CONNECTOR_AGENTS } from './connector-agents'
import type { ConversationKey } from './external-conversation-types'
+1 -1
View File
@@ -16,7 +16,7 @@ import { ORCHESTRATION_CONTRACT_VERSION } from '../../shared/orchestration/orche
import { ALL_RPC_METHODS } from '../runtime/rpc/methods/rpc-method-registry'
import { DesktopRuntimeSenderLifecycle } from './desktop-runtime-sender-lifecycle'
import { toWorkspaceLifecycleResult } from '../ephemeral-vm/workspace-lifecycle-result'
import { publishMobileProjectSections } from '../runtime/sidebar-inputs/mobile-project-sections-snapshot'
import { publishMobileProjectSections } from '../runtime/sidebar-inputs/catalog/mobile-project-sections-snapshot'
function boundTerminalFitRestore(pending: Promise<boolean>): Promise<boolean> {
let timer: ReturnType<typeof setTimeout> | undefined
@@ -1,9 +1,9 @@
import { isDeepStrictEqual } from 'node:util'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { PersistedUIState } from '../../../shared/persisted-ui-state-types'
import { ALL_WORKSPACE_VIEW_UI_FIELDS } from '../../../shared/workspace-view/workspace-view-ui-fields'
import type { RuntimeStore } from '../construction/runtime-store-contract'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types'
import { ALL_WORKSPACE_VIEW_UI_FIELDS } from '../../../../shared/workspace-view/workspace-view-ui-fields'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
/** The settings a phone's workspace list mirrors: Card layout, card style and pinned placement. */
const WORKSPACE_VIEW_SETTINGS: readonly (keyof GlobalSettings)[] = [
@@ -1,8 +1,8 @@
import type { PersistedUIState } from '../../../shared/persisted-ui-state-types'
import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types'
import type {
SetCollapsedRequest,
SetCollapsedResult
} from '../../../shared/rpc-contract/workspace-view-collapse-params'
} from '../../../../shared/rpc-contract/workspace-view-collapse-params'
// Far above writers x sections in use; an evicted entry only lets a very old retry apply again.
const MAX_TRACKED_WRITES = 4096
@@ -7,9 +7,9 @@ import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-cont
import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id'
import { OrcaRuntimeWithWindowlessTerminalActivity } from '../sidebar-inputs/orca-runtime-windowless-terminal-activity'
import { OrcaRuntimeWithWindowlessTerminalActivity } from '../sidebar-inputs/temporal/orca-runtime-windowless-terminal-activity'
import { getRuntimeDesktopSurface } from './runtime-desktop-surface'
import type { AgentStatusStoreView } from '../sidebar-inputs/workspace-activity-facts-producer'
import type { AgentStatusStoreView } from '../sidebar-inputs/workspace-facts/workspace-activity-facts-producer'
import { subscribeHookStatusTitles } from '../terminal/layout/hook-status-title-subscription'
import {
resolveTerminalWorkerDispatch,
@@ -11,7 +11,7 @@ import type { SshConnectionState } from '../../../shared/ssh-types'
import type { MobileDesktopRelayHosts } from './mobile-desktop-relay-hosts'
import { MobileRelayHostCatalog } from './mobile-relay-host-catalog'
import { PairedServerRowsProducer } from '../sidebar-inputs/paired-server-rows-producer'
import { PairedServerRowsProducer } from '../sidebar-inputs/workspace-rows/paired-server-rows-producer'
function answer(capable: boolean): RuntimeStatus {
return {
+7 -7
View File
@@ -4,7 +4,7 @@ import type { RuntimeLinearCommandSurface } from './integrations/linear/runtime-
import { installRuntimeLinearCommandSurface } from './integrations/linear/runtime-linear-command-surface'
import { publishNativeChatPreferenceChanges } from './agent-session/launch/runtime-native-chat-preference-events'
import { publishSettingsChanges } from './client/settings/runtime-settings-change-events'
import { publishWorkspaceViewChanges } from './sidebar-inputs/runtime-workspace-view-change-events'
import { publishWorkspaceViewChanges } from './client/settings/runtime-workspace-view-change-events'
import {
OrcaRuntimeWithSidebarTemporal,
sidebarFactsRuntime
@@ -49,15 +49,15 @@ import {
installStructuredAgentAvailability as installAvailability,
type StructuredAgentAvailabilityReader as AvailabilityReader
} from './agent-session/launch/structured-agent-availability'
import { PairedServerRowsProducer } from './sidebar-inputs/paired-server-rows-producer'
import { RepoIconDataUrls } from './sidebar-inputs/repo-icon-data-urls'
import { WorkspaceRowsProducer } from './sidebar-inputs/workspace-rows-producer'
import { PairedServerRowsProducer } from './sidebar-inputs/workspace-rows/paired-server-rows-producer'
import { RepoIconDataUrls } from './sidebar-inputs/repo-icons/repo-icon-data-urls'
import { WorkspaceRowsProducer } from './sidebar-inputs/workspace-rows/workspace-rows-producer'
import { getMainHttpClient } from '../network/http-client'
import { getRuntimeDesktopSurface } from './construction/runtime-desktop-surface'
import { CollapseWriteOrder } from './sidebar-inputs/workspace-view-collapse-writes'
import { SidebarInputsFeed } from './sidebar-inputs/sidebar-inputs-feed'
import { CollapseWriteOrder } from './client/settings/workspace-view-collapse-writes'
import { SidebarInputsFeed } from './sidebar-inputs/feed/sidebar-inputs-feed'
import { sidebarInputsFeedDomains } from './sidebar-inputs/sidebar-inputs-feed-domains'
import { requireSwitchedOn } from './sidebar-inputs/require-switched-on'
import { requireSwitchedOn } from './construction/require-sidebar-inputs-enabled'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../shared/runtime-session-contracts'
import { getHostDisplayLabelOverrides } from '../../shared/host-setting-overrides'
import type { OrchestrationDb } from './orchestration/db/orchestration-db'
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
import { getDefaultUIState } from '../../../../../shared/constants'
import type { PersistedUIState } from '../../../../../shared/persisted-ui-state-types'
import type { OrcaRuntimeService } from '../../../orca-runtime'
import { CollapseWriteOrder } from '../../../sidebar-inputs/workspace-view-collapse-writes'
import { CollapseWriteOrder } from '../../../client/settings/workspace-view-collapse-writes'
import type { RpcRequest } from '../../core'
import { RpcDispatcher } from '../../dispatcher'
import type { RpcDispatchStreamingOptions } from '../../dispatch/dispatcher-stream-options'
@@ -1,9 +1,9 @@
import { defineMethod } from '../../core'
import { MOBILE_PROJECT_SECTIONS_METHOD } from '../../../../../shared/mobile-project-sections-contract'
import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../../shared/sidebar-inputs-switch'
import { readMobileProjectSections } from '../../../sidebar-inputs/mobile-project-sections-snapshot'
import { requireSwitchedOn } from '../../../sidebar-inputs/require-switched-on'
import { readSidebarProjectCatalog } from '../../../sidebar-inputs/sidebar-project-catalog'
import { readMobileProjectSections } from '../../../sidebar-inputs/catalog/mobile-project-sections-snapshot'
import { requireSwitchedOn } from '../../../construction/require-sidebar-inputs-enabled'
import { readSidebarProjectCatalog } from '../../../sidebar-inputs/catalog/sidebar-project-catalog'
export const MOBILE_PROJECT_SECTIONS_METHODS = [
defineMethod({
@@ -1,12 +1,12 @@
import { defineMethod } from '../../core'
import { requireSwitchedOn } from '../../../sidebar-inputs/require-switched-on'
import { requireSwitchedOn } from '../../../construction/require-sidebar-inputs-enabled'
import { readRuntimeDesktopSidebarFacts } from '../../../sidebar-inputs/sidebar-inputs-feed-domains'
import { isHostOwnPhone } from '../../callers/host-own-phone'
import { SidebarInputsReadParams } from '../../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import { SidebarSessionBeginParams } from '../../../../../shared/rpc-contract/sidebar-session-params'
import { RepoIconDataUrlsParams } from '../../../../../shared/sidebar-list/repo-icon-data-urls-contract'
import { SetCollapsedParams } from '../../../../../shared/rpc-contract/workspace-view-collapse-params'
import { setCollapsedSection } from '../../../sidebar-inputs/workspace-view-collapse-writes'
import { setCollapsedSection } from '../../../client/settings/workspace-view-collapse-writes'
import { ClientWorkspaceViewParams } from '../../../../../shared/rpc-contract/client-workspace-view-params'
// Registered only with ORCA_SIDEBAR_INPUTS=main, so the producers below always exist.
@@ -40,16 +40,6 @@ describe('CachedScan', () => {
expect(pending).toHaveLength(0)
})
it('scans for a first reader and serves later readers from the cache', async () => {
const { cache, pending, finish } = scanner(false)
const ready = cache.ready()
expect(pending).toHaveLength(1)
await finish()
await ready
await cache.ready()
expect(pending).toHaveLength(0)
})
it('runs no scan without demand, but makes the next reader scan again', async () => {
const { cache, pending, finish } = scanner(false)
const first = cache.ready()
@@ -1,11 +1,11 @@
// Runs on plain Node, as orcad does: the reader imports no Electron.
import { describe, expect, it } from 'vitest'
import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types'
import type { ProjectGroup } from '../../../shared/project-group-types'
import type { Repo } from '../../../shared/repo-types'
import type { ExecutionHostId } from '../../../shared/execution-host'
import type { ManualRepoOrderEntry } from '../../../shared/ui-chrome-types'
import type { WorktreeMeta } from '../../../shared/worktree/meta-types'
import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types'
import type { ProjectGroup } from '../../../../shared/project-group-types'
import type { Repo } from '../../../../shared/repo-types'
import type { ExecutionHostId } from '../../../../shared/execution-host'
import type { ManualRepoOrderEntry } from '../../../../shared/ui-chrome-types'
import type { WorktreeMeta } from '../../../../shared/worktree/meta-types'
import { readDesktopSidebarFacts, type DesktopSidebarFactSources } from './desktop-sidebar-facts'
function repo(id: string, connectionId: string | null = null): Repo {
@@ -6,22 +6,22 @@ import {
toRuntimeExecutionHostId,
toSshExecutionHostId,
type ExecutionHostId
} from '../../../shared/execution-host'
import { applyManualRepoOrder } from '../../../shared/manual-repo-order'
import type { DesktopSidebarFacts } from '../../../shared/sidebar-list/desktop-sidebar-facts'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import { getHostDisplayLabelOverrides } from '../../../shared/host-setting-overrides'
import type { SshConnectionState, SshTarget } from '../../../shared/ssh-types'
import type { WslHostStatus } from '../../../shared/wsl-host-types'
import type { PersistedUIState } from '../../../shared/persisted-ui-state-types'
import type { WorkspaceSessionState } from '../../../shared/workspace-session/workspace-session-state-types'
import { folderWorkspaceKey } from '../../../shared/workspace-scope'
import { readAllWorktreeMetaForHost } from '../../persistence/host-qualified-worktree-meta'
import type { RuntimeStore } from '../construction/runtime-store-contract'
} from '../../../../shared/execution-host'
import { applyManualRepoOrder } from '../../../../shared/manual-repo-order'
import type { DesktopSidebarFacts } from '../../../../shared/sidebar-list/desktop-sidebar-facts'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import { getHostDisplayLabelOverrides } from '../../../../shared/host-setting-overrides'
import type { SshConnectionState, SshTarget } from '../../../../shared/ssh-types'
import type { WslHostStatus } from '../../../../shared/wsl-host-types'
import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types'
import type { WorkspaceSessionState } from '../../../../shared/workspace-session/workspace-session-state-types'
import { folderWorkspaceKey } from '../../../../shared/workspace-scope'
import { readAllWorktreeMetaForHost } from '../../../persistence/host-qualified-worktree-meta'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
import {
runtimeVisibleFolderWorkspaces,
runtimeVisibleRepos
} from '../workspaces/catalog/runtime-visible-catalog'
} from '../../workspaces/catalog/runtime-visible-catalog'
export type DesktopSidebarFactSources = {
store: Pick<
@@ -2,7 +2,7 @@ import { isDeepStrictEqual } from 'node:util'
import type {
MobileProjectSectionCatalog,
MobileProjectSectionsResult
} from '../../../shared/mobile-project-sections-contract'
} from '../../../../shared/mobile-project-sections-contract'
// Retain the last catalog after window close; stale grouping is better than none.
let latestCatalog: MobileProjectSectionCatalog | null = null
@@ -1,27 +1,27 @@
// Runs on plain Node, as orcad does: the catalog comes from main's own store, no window publishes it.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { ProjectGroup } from '../../../shared/project-group-types'
import type { ProjectGroup } from '../../../../shared/project-group-types'
import type { Repo } from '../../../shared/repo-types'
import type { Repo } from '../../../../shared/repo-types'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import { readSidebarFeedDomains } from '../../../shared/sidebar-list/sidebar-feed-domains'
import { readSidebarFeedDomains } from '../../../../shared/sidebar-list/sidebar-feed-domains'
import '../../../shared/mobile-project-sections-contract'
import { OrcaRuntimeService } from '../orca-runtime'
import '../../../../shared/mobile-project-sections-contract'
import { OrcaRuntimeService } from '../../orca-runtime'
import '../rpc/methods/rpc-method-registry'
import type { RuntimeStore } from '../construction/runtime-store-contract'
import '../../rpc/methods/rpc-method-registry'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
import { requireSwitchedOn } from './require-switched-on'
import { requireSwitchedOn } from '../../construction/require-sidebar-inputs-enabled'
import { TestPhone } from './sidebar-inputs-feed.test-fixture'
import { TestPhone } from '../feed/testing/sidebar-inputs-feed.test-fixture'
import { partialRuntimeStore } from '../orca-runtime-tests/runtime-store-partial-fixture'
import { partialRuntimeStore } from '../../orca-runtime-tests/runtime-store-partial-fixture'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
function group(id: string): ProjectGroup {
return {
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import type { ProjectGroup } from '../../../shared/project-group-types'
import { projectHostSetupProjectionFromRepos } from '../../../shared/project-host-setup-projection'
import type { Repo } from '../../../shared/repo-types'
import type { ProjectGroup } from '../../../../shared/project-group-types'
import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection'
import type { Repo } from '../../../../shared/repo-types'
import {
readSidebarProjectCatalog,
type SidebarProjectCatalogStore
@@ -1,15 +1,15 @@
import type { MobileProjectSectionCatalog } from '../../../shared/mobile-project-sections-contract'
import type { PersistedUIState } from '../../../shared/persisted-ui-state-types'
import type { MobileProjectSectionCatalog } from '../../../../shared/mobile-project-sections-contract'
import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types'
import {
buildSidebarProjectCatalog,
type PairedServerCatalog
} from '../../../shared/sidebar-list/sidebar-project-catalog'
import type { RuntimeStore } from '../construction/runtime-store-contract'
} from '../../../../shared/sidebar-list/sidebar-project-catalog'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
import {
runtimeVisibleProjectGroups,
runtimeVisibleProjectHostSetups,
runtimeVisibleRepos
} from '../workspaces/catalog/runtime-visible-catalog'
} from '../../workspaces/catalog/runtime-visible-catalog'
export type SidebarProjectCatalogStore = Pick<
RuntimeStore,
@@ -4,7 +4,7 @@ import {
SIDEBAR_INPUTS_PAGE_MIN_BYTES,
SIDEBAR_INPUTS_SCHEMA_VERSION,
SIDEBAR_INPUTS_SEMANTICS_VERSION
} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract'
} from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import {
feedEntityFromJson,
paginateFeedChanges,
@@ -1,4 +1,4 @@
import type { SidebarInputsDomainChange } from '../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import type { SidebarInputsDomainChange } from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
/** One published entity: its value and that value's JSON, which the feed diffs and measures. */
export type FeedEntity = { value: unknown; json: string; bytes: number }
@@ -1,4 +1,4 @@
import type { SidebarInputsReadResult } from '../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import type { SidebarInputsReadResult } from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
/** A multi-page batch stays readable this long after its last page read. */
export const FEED_PIN_IDLE_MS = 30_000
@@ -2,12 +2,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type {
SidebarInputsChangedEvent,
SidebarInputsReadResult
} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import '../../../shared/sidebar-list/sidebar-inputs-feed-installer'
} from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import '../../../../shared/sidebar-list/sidebar-inputs-feed-installer'
import { SidebarInputsFeed } from './sidebar-inputs-feed'
import { FEED_LOG_MAX_REVISIONS } from './sidebar-inputs-feed-log'
import { FEED_PIN_IDLE_MS, FEED_PIN_MAX_BATCHES } from './sidebar-inputs-feed-pins'
import { TestPhone, testDomain, truthOf } from './sidebar-inputs-feed.test-fixture'
import { TestPhone, testDomain, truthOf } from './testing/sidebar-inputs-feed.test-fixture'
// Three ~100 KiB entities: a snapshot of them spans two 256 KiB pages.
const BIG = 'x'.repeat(100 * 1024)
@@ -127,26 +127,6 @@ describe('sidebar inputs feed', () => {
expect(phone.view()).toEqual(host.truth())
})
it('serves two phones from one session, which ends with the last of them', async () => {
const host = makeHost()
const first = new TestPhone(host.feed, 'conn-1')
const second = new TestPhone(host.feed, 'conn-2')
first.refresh()
second.refresh()
await Promise.all([first.settle(), second.settle()])
expect(host.rows.reads()).toBe(1)
first.disconnect()
host.rows.set('a', 2)
await flush()
second.notice(host.lastEvent())
await second.settle()
expect(second.view()).toEqual(host.truth())
second.disconnect()
expect(host.rows.watchers()).toBe(0)
})
it('replaces everything after a runtime restart, whose generation is new', async () => {
const host = makeHost()
const phone = new TestPhone(host.feed, 'conn-1')
@@ -201,41 +181,6 @@ describe('sidebar inputs feed', () => {
expect(phone.view().rows).toEqual({ a: 1 })
})
it('re-reads a failed domain on the next read without retrying on its own', async () => {
const host = makeHost()
const phone = new TestPhone(host.feed, 'conn-1')
phone.refresh()
await phone.settle()
host.rows.fail(true)
host.rows.set('a', 2)
await flush()
const failedReads = host.rows.reads()
await vi.advanceTimersByTimeAsync(10_000)
expect(host.rows.reads()).toBe(failedReads)
host.rows.fail(false)
phone.refresh()
await phone.settle()
expect(host.rows.reads()).toBe(failedReads + 1)
expect(phone.view()).toEqual(host.truth())
})
it('re-reads a failed domain with the next flush another domain causes', async () => {
const host = makeHost()
const phone = new TestPhone(host.feed, 'conn-1')
phone.refresh()
await phone.settle()
host.rows.fail(true)
host.rows.set('a', 2)
await flush()
host.rows.fail(false)
host.view.set('sort', 'recent')
await flush()
phone.notice(host.lastEvent())
await phone.settle()
expect(phone.view()).toEqual(host.truth())
})
it('bounds pinned batches, evicting the oldest', async () => {
const host = makeHost({ a: BIG, b: BIG, c: BIG })
host.feed.acquire('conn-1')
@@ -7,7 +7,7 @@ import {
type SidebarInputsChangedEvent,
type SidebarInputsReadParams,
type SidebarInputsReadResult
} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract'
} from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import {
feedEntityFromJson,
paginateFeedChanges,
@@ -1,7 +1,7 @@
import type {
SidebarInputsChangedEvent,
SidebarInputsReadResult
} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract'
} from '../../../../../shared/sidebar-list/sidebar-inputs-feed-contract'
import {
INITIAL_SIDEBAR_INPUTS_FEED_STATE,
refreshSidebarInputs,
@@ -10,12 +10,12 @@ import {
type SidebarInputsFeedRequest,
type SidebarInputsFeedState,
type SidebarInputsFeedStep
} from '../../../shared/sidebar-list/sidebar-inputs-feed-installer'
} from '../../../../../shared/sidebar-list/sidebar-inputs-feed-installer'
import type {
SidebarInputsFeed,
SidebarInputsFeedChange,
SidebarInputsFeedDomain
} from './sidebar-inputs-feed'
} from '../sidebar-inputs-feed'
/** A domain whose entities a test edits; counts its reads and live watchers. */
export function testDomain(name: string, initial: Record<string, unknown> = {}) {
@@ -2,8 +2,8 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import { OrcaRuntimeService } from '../orca-runtime'
import { requireSwitchedOn } from './require-switched-on'
import { TestPhone } from './sidebar-inputs-feed.test-fixture'
import { requireSwitchedOn } from '../construction/require-sidebar-inputs-enabled'
import { TestPhone } from './feed/testing/sidebar-inputs-feed.test-fixture'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
@@ -1,6 +1,6 @@
import { getRepoRegistrationHostIds } from '../../../shared/repo-host-identity'
import { isRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id'
import { OrcaRuntimeWithDetectedCheckoutsAndLiveContent } from './orca-runtime-detected-checkouts-live-content'
import { OrcaRuntimeWithDetectedCheckoutsAndLiveContent } from './workspace-facts/orca-runtime-detected-checkouts-live-content'
import type { OrcaRuntimeWithAgentTransitions } from '../construction/orca-runtime-agent-transitions'
import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../shared/sidebar-inputs-switch'
import { DEFAULT_HIDE_SLEEPING_WORKSPACES } from '../../../shared/constants'
@@ -12,15 +12,18 @@ import {
type ExecutionHostId
} from '../../../shared/execution-host'
import type { SidebarTemporalSnapshot } from '../../../shared/sidebar-list/sidebar-temporal-snapshot'
import type { WorkspaceRowsProducer } from './workspace-rows-producer'
import { SidebarRetentionOwner, type SidebarRetentionCandidates } from './sidebar-retention-owner'
import type { AgentStatusStoreView } from './workspace-activity-facts-producer'
import { SortStampsProducer } from './sort-stamps-producer'
import { writeUnreadFlag } from './sort-stamp-records'
import { WorkspaceViewers } from './workspace-viewers'
import type { WorkspaceRowsProducer } from './workspace-rows/workspace-rows-producer'
import {
SidebarRetentionOwner,
type SidebarRetentionCandidates
} from './temporal/sidebar-retention-owner'
import type { AgentStatusStoreView } from './workspace-facts/workspace-activity-facts-producer'
import { SortStampsProducer } from './temporal/sort-stamps-producer'
import { writeUnreadFlag } from '../workspaces/metadata/workspace-activity-records'
import { WorkspaceViewers } from './temporal/workspace-viewers'
import { clientRaisesUnreadFlagItself } from '../../../shared/workspace-unread-raise-capability'
import type { RuntimeCapability } from '../../../shared/protocol-version'
import { TerminalUseProducer } from './terminal-use-producer'
import { TerminalUseProducer } from './temporal/terminal-use-producer'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import { getRepoIdFromWorktreeId, worktreeIdentityKey } from '../../../shared/worktree/id'
import {
@@ -1,9 +1,9 @@
import { describe, expect, it, vi } from 'vitest'
import type { RepoIcon } from '../../../shared/repo-icon'
import type { Repo } from '../../../shared/repo-types'
import type { RepoIcon } from '../../../../shared/repo-icon'
import type { Repo } from '../../../../shared/repo-types'
import { RepoIconDataUrls, repoIconId, type RepoIconPngEncoder } from './repo-icon-data-urls'
import type { RepoIconFetch } from './repo-icon-remote-fetch'
import { pngHeader } from './repo-icon-image-fixture'
import { pngHeader } from './testing/repo-icon-image-fixture'
const AVATAR: RepoIcon = {
type: 'image',
@@ -34,42 +34,6 @@ function setup(
return { icons, fetch, advance: (ms: number) => (now += ms) }
}
describe('RepoIconDataUrls caps', () => {
it('runs at most four fetches at once', async () => {
const releases: (() => void)[] = []
let active = 0
let peak = 0
const avatars = Array.from({ length: 10 }, (_, index): RepoIcon => ({
...AVATAR,
src: `https://github.com/owner${index}.png`
}))
const { icons } = setup(
avatars.map((icon, index) => repo(`r${index}`, icon)),
{
fetch: () => {
active += 1
peak = Math.max(peak, active)
return new Promise((resolve) =>
releases.push(() => {
active -= 1
resolve(pngResponse())
})
)
}
}
)
const reply = icons.read(avatars.map((icon) => repoIconId(icon)!))
for (let settled = 0; settled < avatars.length; settled += 1) {
await vi.waitFor(() => expect(releases.length).toBeGreaterThan(settled))
releases[settled]()
}
expect((await reply).icons.every((icon) => icon.dataUrl !== null)).toBe(true)
expect(peak).toBe(4)
})
})
describe('RepoIconDataUrls cache', () => {
it('retries a failed fetch after five minutes, a success only after an hour', async () => {
let fail = true
@@ -1,18 +1,18 @@
import { createHash } from 'node:crypto'
import type { RepoIcon } from '../../../shared/repo-icon'
import type { Repo } from '../../../shared/repo-types'
import { readRasterImageDimensions } from '../../../shared/file-preview/raster-image-dimensions'
import type { RepoIcon } from '../../../../shared/repo-icon'
import type { Repo } from '../../../../shared/repo-types'
import { readRasterImageDimensions } from '../../../../shared/file-preview/raster-image-dimensions'
import {
MAX_REPO_ICON_DATA_URL_BYTES,
repoIconFeedKey,
type RepoIconDataUrlsReply
} from '../../../shared/sidebar-list/repo-icon-data-urls-contract'
} from '../../../../shared/sidebar-list/repo-icon-data-urls-contract'
import {
fetchRemoteRepoIcon,
type FetchedRepoIcon,
type RepoIconFetch
} from './repo-icon-remote-fetch'
import type { RuntimeDesktopSurface } from '../construction/runtime-desktop-surface'
import type { RuntimeDesktopSurface } from '../../construction/runtime-desktop-surface'
export type RepoIconPngEncoder = NonNullable<RuntimeDesktopSurface['encodeRepoIconPng']>
@@ -1,4 +1,4 @@
import { isKnownRasterImageMimeType } from '../../../shared/file-preview/raster-image-preview-limits'
import { isKnownRasterImageMimeType } from '../../../../shared/file-preview/raster-image-preview-limits'
export const REPO_ICON_FETCH_MAX_BYTES = 64 * 1024
export const REPO_ICON_FETCH_MAX_REDIRECTS = 3
@@ -12,15 +12,15 @@ import {
} from '../../persistence/profile-save-domains'
import type { PersistedUIState } from '../../../shared/persisted-ui-state-types'
import type { OrcaRuntimeWithSidebarTemporal } from './orca-runtime-sidebar-temporal'
import type { PairedServerRowsProducer } from './paired-server-rows-producer'
import type { PairedServerRowsProducer } from './workspace-rows/paired-server-rows-producer'
import type { WorkspaceLifecycleQueue } from '../workspaces/lifecycle/workspace-lifecycle-queue'
import type { WorkspaceRowsProducer } from './workspace-rows-producer'
import type { RepoIconDataUrls } from './repo-icon-data-urls'
import type { SidebarInputsFeedDomain } from './sidebar-inputs-feed'
import { readDesktopSidebarFacts } from './desktop-sidebar-facts'
import type { WorkspaceRowsProducer } from './workspace-rows/workspace-rows-producer'
import type { RepoIconDataUrls } from './repo-icons/repo-icon-data-urls'
import type { SidebarInputsFeedDomain } from './feed/sidebar-inputs-feed'
import { readDesktopSidebarFacts } from './catalog/desktop-sidebar-facts'
import { readStoreInstallationId } from '../hosts/platform-probe/host-descriptor'
import { getCanonicalUserDataPath } from '../../persistence/loading-store/user-data-path'
import { readSidebarProjectCatalog } from './sidebar-project-catalog'
import { readSidebarProjectCatalog } from './catalog/sidebar-project-catalog'
import {
buildPairedServerReviewFacts,
buildWorkspaceReviewFacts
@@ -1,12 +1,12 @@
// Runs on plain Node, as orcad does: main's "Hide sleeping" retention reads the runtime's own facts.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { OrcaRuntimeService } from '../orca-runtime'
import type { RuntimeStore } from '../construction/runtime-store-contract'
import type { PersistedUIState } from '../../../shared/persisted-ui-state-types'
import type { ResolvedWorktreeSnapshot } from '../workspaces/catalog/runtime-resolved-worktree-cache'
import type { ResolvedWorktree } from '../workspaces/catalog/runtime-worktree-path-identity'
import { OrcaRuntimeService } from '../../orca-runtime'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types'
import type { ResolvedWorktreeSnapshot } from '../../workspaces/catalog/runtime-resolved-worktree-cache'
import type { ResolvedWorktree } from '../../workspaces/catalog/runtime-worktree-path-identity'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
const repo = { id: 'repo-1', path: '/r', displayName: 'r', badgeColor: 'blue', addedAt: 1 }
const WT = 'repo-1::/r/a'
@@ -1,22 +1,22 @@
// Runs on plain Node, as orcad does: a paired server stamps its own rows through this same wiring.
import { describe, expect, it, vi } from 'vitest'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts'
import type { WorktreeMeta } from '../../../shared/worktree/meta-types'
import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types'
import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server'
import { OrcaRuntimeService } from '../orca-runtime'
import { folderWorkspaceKey } from '../../../shared/workspace-scope'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts'
import type { WorktreeMeta } from '../../../../shared/worktree/meta-types'
import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types'
import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import { OrcaRuntimeService } from '../../orca-runtime'
import { folderWorkspaceKey } from '../../../../shared/workspace-scope'
import {
hostWorktreeTarget,
type HostWorktreeTarget
} from '../../../shared/worktree/host-qualified-identity'
} from '../../../../shared/worktree/host-qualified-identity'
import {
partialRuntimeStore,
storeRepo,
storeWorktreeMeta
} from '../orca-runtime-tests/runtime-store-partial-fixture'
} from '../../orca-runtime-tests/runtime-store-partial-fixture'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
const WT = 'repo-1::/tmp/worktree-a'
const FOLDER_ID = 'fw-1'
@@ -1,22 +1,22 @@
// Runs on plain Node, as orcad does: the host that owns a workspace records its terminal use.
import { describe, expect, it, vi } from 'vitest'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts'
import type { WorktreeMeta } from '../../../shared/worktree/meta-types'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts'
import type { WorktreeMeta } from '../../../../shared/worktree/meta-types'
import {
WORKSPACE_CLEANUP_IDLE_MS,
getPersistedWorkspaceCleanupActivityAt,
isWorkspaceOldForCleanup
} from '../../../shared/workspace-cleanup/workspace-cleanup'
import { OrcaRuntimeService } from '../orca-runtime'
import type { HostWorktreeTarget } from '../../../shared/worktree/host-qualified-identity'
} from '../../../../shared/workspace-cleanup/workspace-cleanup'
import { OrcaRuntimeService } from '../../orca-runtime'
import type { HostWorktreeTarget } from '../../../../shared/worktree/host-qualified-identity'
import {
partialRuntimeStore,
storeRepo,
storeWorktreeMeta,
type PartialRuntimeStore
} from '../orca-runtime-tests/runtime-store-partial-fixture'
} from '../../orca-runtime-tests/runtime-store-partial-fixture'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
const WT = 'repo-1::/tmp/phone-only'
const DAY_MS = 24 * 60 * 60 * 1000
@@ -24,7 +24,6 @@ const DAY_MS = 24 * 60 * 60 * 1000
function createHeadlessRuntime(ptyId = 'pty-1') {
// Untouched for 45 days: no agent ran, so no Recent stamp moved.
const meta: Record<string, WorktreeMeta> = { [WT]: storeWorktreeMeta({ lastActivityAt: 1 }) }
const writes: Partial<WorktreeMeta>[] = []
const repo = storeRepo({ id: 'repo-1', path: '/tmp/repo-1', connectionId: null })
const store: PartialRuntimeStore = {
// An unstamped row's writes resolve their host from its repo's only registration.
@@ -34,7 +33,6 @@ function createHeadlessRuntime(ptyId = 'pty-1') {
getWorktreeMeta: (id: string) => meta[id],
getAllWorktreeMeta: () => meta,
setWorktreeMeta: ({ id }: HostWorktreeTarget, updates: Partial<WorktreeMeta>) => {
writes.push(updates)
meta[id] = { ...meta[id], ...updates }
return meta[id]
}
@@ -54,7 +52,7 @@ function createHeadlessRuntime(ptyId = 'pty-1') {
}
]
})
return { runtime, meta, writes }
return { runtime, meta }
}
describe('host-written terminal use', () => {
@@ -81,22 +79,4 @@ describe('host-written terminal use', () => {
vi.useRealTimers()
}
})
it('app-written launch input never counts', () => {
const launch = createHeadlessRuntime()
launch.runtime.terminalRunFacts.recordInput('pty-1', 'launch', 'claude\r', 1_000)
expect(launch.writes).toEqual([])
})
it("a paired server's terminal is not this host's to record", () => {
const mirrored = createHeadlessRuntime('remote:server-pty')
mirrored.runtime.terminalRunFacts.recordInput('remote:server-pty', 'driving', 'ls\r', 1_000)
expect(mirrored.writes).toEqual([])
})
it('output never counts as use', () => {
const { runtime, writes } = createHeadlessRuntime()
runtime.onPtyData('pty-1', 'lots of output\r\n', 1)
expect(writes.filter((w) => 'lastTerminalUseAt' in w)).toEqual([])
})
})
@@ -1,23 +1,26 @@
import { OrcaRuntimeWithWslMoveTerminalFacts } from '../workspaces/metadata/runtime-wsl-move-terminal-facts'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts'
import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../shared/sidebar-inputs-switch'
import { isRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id'
import type { RuntimeTerminalSplit } from '../../../shared/runtime-terminal-contracts'
import { parseExecutionHostId } from '../../../shared/execution-host'
import { isRestoreSpawnIntent } from '../../../shared/terminal/pty/admission/spawn-admission-contract'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id'
import { readWorkspaceRecord, writeWorkspaceRecord } from './sort-stamp-records'
import { createKeyedTrailingEdgeCoalescer } from '../client/events/keyed-trailing-edge-coalescer'
import { OrcaRuntimeWithWslMoveTerminalFacts } from '../../workspaces/metadata/runtime-wsl-move-terminal-facts'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts'
import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../shared/sidebar-inputs-switch'
import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime/remote-runtime-pty-id'
import type { RuntimeTerminalSplit } from '../../../../shared/runtime-terminal-contracts'
import { parseExecutionHostId } from '../../../../shared/execution-host'
import { isRestoreSpawnIntent } from '../../../../shared/terminal/pty/admission/spawn-admission-contract'
import { parseWorkspaceKey } from '../../../../shared/workspace-scope'
import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id'
import {
readWorkspaceRecord,
writeWorkspaceRecord
} from '../../workspaces/metadata/workspace-activity-records'
import { createKeyedTrailingEdgeCoalescer } from '../../client/events/keyed-trailing-edge-coalescer'
import {
agentPaneWorkspace,
type AgentPaneWorkspace
} from '../../agent-hooks/observations/agent-transition-detector'
import type { RuntimePtyWorktreeRecord } from '../terminal/records/runtime-terminal-state-records'
} from '../../../agent-hooks/observations/agent-transition-detector'
import type { RuntimePtyWorktreeRecord } from '../../terminal/records/runtime-terminal-state-records'
import {
isWslMoveProjectBlocked,
wslMoveProjectRefForWorkspace
} from '../../persistence/moving-wsl-projects/quiescence/wsl-move-scope-guard'
} from '../../../persistence/moving-wsl-projects/quiescence/wsl-move-scope-guard'
type Runtime = OrcaRuntimeWithWslMoveTerminalFacts
@@ -1,15 +1,15 @@
// Runs on plain Node, as orcad does: a host with no window raises and clears its own unread flags.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts'
import { folderWorkspaceKey } from '../../../shared/workspace-scope'
import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server'
import { OrcaRuntimeService } from '../orca-runtime'
import { RpcDispatcher } from '../rpc/dispatcher'
import type { RpcDispatchStreamingOptions } from '../rpc/dispatch/dispatcher-stream-options'
import { SESSION_TAB_METHODS } from '../rpc/methods/session-tabs/session-tabs'
import { SIDEBAR_INPUT_METHODS } from '../rpc/methods/sidebar-inputs/sidebar-inputs'
import type { HostWorktreeTarget } from '../../../shared/worktree/host-qualified-identity'
import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts'
import { folderWorkspaceKey } from '../../../../shared/workspace-scope'
import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import { OrcaRuntimeService } from '../../orca-runtime'
import { RpcDispatcher } from '../../rpc/dispatcher'
import type { RpcDispatchStreamingOptions } from '../../rpc/dispatch/dispatcher-stream-options'
import { SESSION_TAB_METHODS } from '../../rpc/methods/session-tabs/session-tabs'
import { SIDEBAR_INPUT_METHODS } from '../../rpc/methods/sidebar-inputs/sidebar-inputs'
import type { HostWorktreeTarget } from '../../../../shared/worktree/host-qualified-identity'
import {
partialRuntimeStore,
storeFolderWorkspace,
@@ -17,11 +17,11 @@ import {
storeRepo,
storeWorktreeMeta,
type PartialRuntimeStore
} from '../orca-runtime-tests/runtime-store-partial-fixture'
import type { WorktreeMeta } from '../../../shared/worktree/meta-types'
import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types'
} from '../../orca-runtime-tests/runtime-store-partial-fixture'
import type { WorktreeMeta } from '../../../../shared/worktree/meta-types'
import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
const WT = 'repo-1::/tmp/worktree-a'
const SSH_WT = 'repo-ssh::/home/me/worktree-b'
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { Worktree } from '../../../shared/worktree/types'
import { getWorktreeHostIdentity } from '../../../shared/worktree/host-qualified-identity'
import { SidebarClock } from './sidebar-clock'
import type { Worktree } from '../../../../shared/worktree/types'
import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity'
import { SidebarClock } from '../sidebar-clock'
import { SidebarRetentionOwner } from './sidebar-retention-owner'
function worktree(id: string, overrides: Partial<Worktree> = {}): Worktree {
@@ -1,17 +1,17 @@
import { ProducerRevision } from './producer-revision'
import { ProducerRevision } from '../producer-revision'
import {
getWorktreeIdFromHostIdentity,
type HostScopedWorktreeKey
} from '../../../shared/worktree/host-qualified-identity'
} from '../../../../shared/worktree/host-qualified-identity'
import {
createSleepingSweepRetentionState,
updateSleepingSweepRetention
} from '../../../shared/sidebar-list/sleeping-sweep-retention'
} from '../../../../shared/sidebar-list/sleeping-sweep-retention'
import type {
SidebarRetention,
SidebarTemporalSnapshot
} from '../../../shared/sidebar-list/sidebar-temporal-snapshot'
import type { SidebarClock } from './sidebar-clock'
} from '../../../../shared/sidebar-list/sidebar-temporal-snapshot'
import type { SidebarClock } from '../sidebar-clock'
/** This host's activity by bare id, read for each listed row: its session names no host. */
export type SidebarRetentionCandidates = {
@@ -1,23 +1,23 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server'
import type { AgentStatusStoreView } from './workspace-activity-facts-producer'
import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import type { AgentStatusStoreView } from '../workspace-facts/workspace-activity-facts-producer'
import '../../../shared/agent-status/contracts/agent-status-subject'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import type { TerminalSideEffectFact } from '../../../shared/terminal/output/terminal-side-effect-facts'
import type { ExecutionHostId } from '../../../shared/execution-host'
import type { Repo } from '../../../shared/repo-types'
import '../../../shared/sidebar-list/sort-stamps'
import type { SmartStampFields } from '../../../shared/sidebar-list/sort-stamps'
import '../../../shared/agent-status/lifecycle/agent-transitions.test-fixture'
import type { AgentTransitionStep } from '../../../shared/agent-status/lifecycle/agent-transitions.test-fixture'
import { AgentTransitionDetector } from '../../agent-hooks/observations/agent-transition-detector'
import '../../../shared/sidebar-list/stamp-order'
import '../../../../shared/agent-status/contracts/agent-status-subject'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import type { TerminalSideEffectFact } from '../../../../shared/terminal/output/terminal-side-effect-facts'
import type { ExecutionHostId } from '../../../../shared/execution-host'
import type { Repo } from '../../../../shared/repo-types'
import '../../../../shared/sidebar-list/sort-stamps'
import type { SmartStampFields } from '../../../../shared/sidebar-list/sort-stamps'
import '../../../../shared/agent-status/lifecycle/agent-transitions.test-fixture'
import type { AgentTransitionStep } from '../../../../shared/agent-status/lifecycle/agent-transitions.test-fixture'
import { AgentTransitionDetector } from '../../../agent-hooks/observations/agent-transition-detector'
import '../../../../shared/sidebar-list/stamp-order'
import { SortStampsProducer, type StoredTierEvidence } from './sort-stamps-producer'
import type { SortStampsStore } from './sort-stamp-records'
import type { SortStampsStore } from '../../workspaces/metadata/workspace-activity-records'
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
vi.mock('../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn(() => ({})) }))
vi.mock('../../../telemetry/client', () => ({ track: vi.fn() }))
vi.mock('../../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn(() => ({})) }))
const WT = 'repo-1::/tmp/a'
const FOLDER_ID = '11111111-1111-4111-8111-111111111111'
@@ -1,9 +1,9 @@
import { parseExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import { parseExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import type {
AgentPhase,
AgentTransition
} from '../../../shared/agent-status/lifecycle/agent-transitions'
} from '../../../../shared/agent-status/lifecycle/agent-transitions'
import {
classifySortStampEvent,
enterAgentPaneState,
@@ -11,15 +11,15 @@ import {
REST_PANE,
type AgentPaneState,
type SortStampEvent
} from '../../../shared/sidebar-list/sort-stamps'
import type { TerminalSideEffectBatch } from '../../../shared/terminal/output/terminal-side-effect-facts'
} from '../../../../shared/sidebar-list/sort-stamps'
import type { TerminalSideEffectBatch } from '../../../../shared/terminal/output/terminal-side-effect-facts'
import {
agentPaneWorkspace,
sameAgentPaneWorkspace,
type AgentPaneChange,
type AgentPaneWorkspace,
type AgentTransitionDetector
} from '../../agent-hooks/observations/agent-transition-detector'
} from '../../../agent-hooks/observations/agent-transition-detector'
import {
listTieredWorkspaces,
readSortStamps,
@@ -27,7 +27,7 @@ import {
writeSortStamps,
writeUnreadFlag,
type SortStampsStore
} from './sort-stamp-records'
} from '../../workspaces/metadata/workspace-activity-records'
/** What the startup reconcile asks of the host, once its hook rows and PTYs have settled. */
export type StoredTierEvidence = {
@@ -2,8 +2,8 @@ import {
readWorkspaceRecord,
writeWorkspaceRecord,
type WorkspaceRecordStore
} from './sort-stamp-records'
import type { AgentPaneWorkspace } from '../../agent-hooks/observations/agent-transition-detector'
} from '../../workspaces/metadata/workspace-activity-records'
import type { AgentPaneWorkspace } from '../../../agent-hooks/observations/agent-transition-detector'
/** At most one write per workspace per minute; cleanup judges idleness in days. */
export const TERMINAL_USE_THROTTLE_MS = 60_000
@@ -1,6 +1,6 @@
import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id'
import { worktreeIdentityKey } from '../../../shared/worktree/id'
import type { ClientWorkspaceView } from '../../../shared/rpc-contract/client-workspace-view-params'
import { parsePaneKey } from '../../../../shared/workspace-layout/stable-pane-id'
import { worktreeIdentityKey } from '../../../../shared/worktree/id'
import type { ClientWorkspaceView } from '../../../../shared/rpc-contract/client-workspace-view-params'
type ClientView = { workspaceKeys: Set<string>; tabIds: Set<string>; presentUntil: number }
@@ -1,9 +1,9 @@
import { OrcaRuntimeWithWorkspaceReviewFacts } from './orca-runtime-workspace-review-facts'
import { isFolderRepo } from '../../../shared/repo-kind'
import { worktreeIdsEqual } from '../../../shared/worktree/id'
import type { WorkspaceLiveContent } from '../../../shared/sidebar-list/workspace-live-content'
import { runtimeVisibleRepos } from '../workspaces/catalog/runtime-visible-catalog'
import { DetectedCheckoutsProducer } from './detected-checkouts-producer'
import { isFolderRepo } from '../../../../shared/repo-kind'
import { worktreeIdsEqual } from '../../../../shared/worktree/id'
import type { WorkspaceLiveContent } from '../../../../shared/sidebar-list/workspace-live-content'
import { runtimeVisibleRepos } from '../../workspaces/catalog/runtime-visible-catalog'
import { DetectedCheckoutsProducer } from '../workspace-rows/detected-checkouts-producer'
import { WorkspaceLiveContentProducer } from './workspace-live-content-producer'
/** Two producers published for readers still to come: detected checkouts and live terminal content. */
@@ -1,10 +1,10 @@
// Runs on plain Node, as orcad does: the producer and its runtime wiring import no Electron.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { RuntimeMobileSessionTabsSnapshot } from '../../../shared/runtime-session-contracts'
import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server'
import { OrcaRuntimeService } from '../orca-runtime'
import type { RuntimeMobileSessionTabsSnapshot } from '../../../../shared/runtime-session-contracts'
import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import { OrcaRuntimeService } from '../../orca-runtime'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
const WT = 'repo-1::/tmp/worktree-a'
const LEAF = '22222222-2222-4222-8222-222222222222'
@@ -1,11 +1,11 @@
import { OrcaRuntimeWithAgentTransitions } from '../construction/orca-runtime-agent-transitions'
import type { PtyLivenessVerdict } from '../../../shared/terminal/pty/lifecycle/pty-liveness-verdict'
import { OrcaRuntimeWithAgentTransitions } from '../../construction/orca-runtime-agent-transitions'
import type { PtyLivenessVerdict } from '../../../../shared/terminal/pty/lifecycle/pty-liveness-verdict'
import type {
WorkspaceActivityFactsSnapshot,
WorkspaceTerminalLiveness
} from '../../../shared/sidebar-list/workspace-activity-facts'
import { worktreeIdentityKey } from '../../../shared/worktree/id'
import { SidebarClock } from './sidebar-clock'
} from '../../../../shared/sidebar-list/workspace-activity-facts'
import { worktreeIdentityKey } from '../../../../shared/worktree/id'
import { SidebarClock } from '../sidebar-clock'
import {
WorkspaceActivityFactsProducer,
type WorkspaceSurfaceActivity
@@ -2,7 +2,7 @@ import { OrcaRuntimeWithWorkspaceActivityFacts } from './orca-runtime-workspace-
import {
buildWorkspaceReviewFacts,
type WorkspaceReviewFactsSnapshot
} from '../../../shared/sidebar-list/workspace-review-facts'
} from '../../../../shared/sidebar-list/workspace-review-facts'
/** Read host-persisted PR facts on demand; windows save cache updates within a second, while orcad uses its existing profile. */
export abstract class OrcaRuntimeWithWorkspaceReviewFacts extends OrcaRuntimeWithWorkspaceActivityFacts {
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { SidebarClock } from './sidebar-clock'
import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server'
import { AGENT_STATUS_STALE_AFTER_MS } from '../../../shared/agent-status/contracts/agent-status-freshness'
import { SidebarClock } from '../sidebar-clock'
import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import { AGENT_STATUS_STALE_AFTER_MS } from '../../../../shared/agent-status/contracts/agent-status-freshness'
import {
WorkspaceActivityFactsProducer,
type WorkspaceSurfaceActivity
@@ -1,12 +1,12 @@
import { ProducerRevision } from './producer-revision'
import { ProducerRevision } from '../producer-revision'
import {
AGENT_STATUS_STALE_AFTER_MS,
isFreshNonDoneAgentStatus,
agentStatusEvidenceObservedAt
} from '../../../shared/agent-status/contracts/agent-status-freshness'
import type { AgentStatusIpcPayload } from '../../../shared/agent-status/contracts/agent-status-ipc-payload'
} from '../../../../shared/agent-status/contracts/agent-status-freshness'
import type { AgentStatusIpcPayload } from '../../../../shared/agent-status/contracts/agent-status-ipc-payload'
import { resolveAgentStatusWorktreeId } from '../../../shared/agent-status/identity/agent-status-worktree-attribution'
import { resolveAgentStatusWorktreeId } from '../../../../shared/agent-status/identity/agent-status-worktree-attribution'
import {
IDLE_WORKSPACE_ACTIVITY,
isIdleWorkspaceActivity,
@@ -16,9 +16,9 @@ import {
type LiveAgentWorktreeStatus,
type WorkspaceActivityFacts,
type WorkspaceActivityFactsSnapshot
} from '../../../shared/sidebar-list/workspace-activity-facts'
import type { AgentHookServer } from '../../agent-hooks/server/agent-hook-server'
import type { SidebarClock } from './sidebar-clock'
} from '../../../../shared/sidebar-list/workspace-activity-facts'
import type { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import type { SidebarClock } from '../sidebar-clock'
export type WorkspaceSurfaceActivity = Omit<WorkspaceActivityFacts, 'agent'>
@@ -1,8 +1,8 @@
import {
workspaceLiveContentEqual,
type WorkspaceLiveContent
} from '../../../shared/sidebar-list/workspace-live-content'
import { ProducerRevision } from './producer-revision'
} from '../../../../shared/sidebar-list/workspace-live-content'
import { ProducerRevision } from '../producer-revision'
/** Refresh live terminal content through the activity producer's per-workspace funnel, including PTY binds, exits and verdicts. */
export class WorkspaceLiveContentProducer {
@@ -1,10 +1,10 @@
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import type { Repo } from '../../../shared/repo-types'
import type { DetectedWorktreeListResult } from '../../../shared/worktree/types'
import { getRepoExecutionHostId } from '../../../shared/execution-host'
import { getRepoHostIdentityForParts } from '../../../shared/repo-host-identity'
import { CachedScan } from './cached-scan'
import { ProducerRevision } from './producer-revision'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import type { Repo } from '../../../../shared/repo-types'
import type { DetectedWorktreeListResult } from '../../../../shared/worktree/types'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import { getRepoHostIdentityForParts } from '../../../../shared/repo-host-identity'
import { CachedScan } from '../cached-scan'
import { ProducerRevision } from '../producer-revision'
export type DetectedCheckoutsSources = {
/** The git repos to list, as worktree.detectedList resolves them. */
@@ -1,12 +1,12 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/protocol-version'
import { RUNTIME_PROTOCOL_VERSION } from '../../../../shared/protocol-version'
import {
runtimeEnvironmentStatusFromSnapshot,
type RuntimeHostStatusSnapshot
} from '../../../shared/remote-runtime/host-status/runtime-host-status'
import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope'
import type { SshConnectionState } from '../../../shared/ssh-types'
import type { MobileDesktopRelayHosts } from '../mobile-desktop-relay/mobile-desktop-relay-hosts'
} from '../../../../shared/remote-runtime/host-status/runtime-host-status'
import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope'
import type { SshConnectionState } from '../../../../shared/ssh-types'
import type { MobileDesktopRelayHosts } from '../../mobile-desktop-relay/mobile-desktop-relay-hosts'
import { PairedServerRowsProducer } from './paired-server-rows-producer'
function snapshot(environmentId: string, live: boolean): RuntimeHostStatusSnapshot {
@@ -271,23 +271,4 @@ describe('PairedServerRowsProducer', () => {
rows: [{ worktreeId: 'current' }]
})
})
it('opens a new watch once the old one ends with its transport, even without a close notice', () => {
const { hosts, watches, publishStatus } = fakeHosts([{ id: 'box', live: true }])
const producer = new PairedServerRowsProducer({
hasDemand: () => true,
hostLabelOverrides: () => new Map()
})
producer.attach(hosts)
const first = watches.get('box')
publishStatus()
expect(watches.get('box')).toBe(first)
if (first) {
first.ended = true
}
publishStatus()
expect(watches.get('box')).not.toBe(first)
expect(first?.closed).toBe(true)
})
})
@@ -1,28 +1,28 @@
import { ProducerRevision } from './producer-revision'
import { toRuntimeExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host'
import { describePairedServerHosts } from '../../../shared/remote-runtime/host-catalog/paired-server-hosts'
import type { MobileRelayServerWorktreeRow } from '../../../shared/remote-runtime/relay/mobile-relay-hosts-contract'
import { ProducerRevision } from '../producer-revision'
import { toRuntimeExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host'
import { describePairedServerHosts } from '../../../../shared/remote-runtime/host-catalog/paired-server-hosts'
import type { MobileRelayServerWorktreeRow } from '../../../../shared/remote-runtime/relay/mobile-relay-hosts-contract'
import {
normalizePairedServerRow,
type PairedServerRowsSnapshot
} from '../../../shared/sidebar-list/paired-server-rows'
} from '../../../../shared/sidebar-list/paired-server-rows'
import type {
MobileDesktopRelayHostListing,
MobileDesktopRelayHosts,
MobileDesktopRelayHostWatch
} from '../mobile-desktop-relay/mobile-desktop-relay-hosts'
} from '../../mobile-desktop-relay/mobile-desktop-relay-hosts'
import {
describeRelayHosts,
relayHostFence
} from '../mobile-desktop-relay/mobile-relay-host-descriptions'
import type { ServerWorktreeRows } from '../mobile-desktop-relay/mobile-relay-host-catalog'
} from '../../mobile-desktop-relay/mobile-relay-host-descriptions'
import type { ServerWorktreeRows } from '../../mobile-desktop-relay/mobile-relay-host-catalog'
import {
SERVER_WORKTREE_LIMIT,
WorktreePsReplySchema,
stampServerWorktreeRows
} from '../mobile-desktop-relay/server-worktree-fetch'
import type { PairedServerCatalog } from '../../../shared/sidebar-list/sidebar-project-catalog'
import { fetchPairedServerCatalog } from '../../../shared/sidebar-list/paired-server-catalog'
} from '../../mobile-desktop-relay/server-worktree-fetch'
import type { PairedServerCatalog } from '../../../../shared/sidebar-list/sidebar-project-catalog'
import { fetchPairedServerCatalog } from '../../../../shared/sidebar-list/paired-server-catalog'
// Owner-approved fallback for changes a server announces no event for (status-only, older servers).
export const FALLBACK_REFRESH_MS = 30_000
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { getRepoHostIdentityForParts } from '../../../shared/repo-host-identity'
import { getRepoHostIdentityForParts } from '../../../../shared/repo-host-identity'
import { WorkspaceGitIdentity, type ScannedIdentityRow } from './workspace-git-identity'
const REPO = getRepoHostIdentityForParts('repo-1', 'local')
@@ -1,21 +1,21 @@
import type { Worktree } from '../../../shared/worktree/types'
import type { Worktree } from '../../../../shared/worktree/types'
import {
composeWorktreeHostIdentity,
hostWorktreeTarget,
type HostScopedWorktreeKey,
type HostWorktreeTarget
} from '../../../shared/worktree/host-qualified-identity'
import type { HOSTED_REVIEW_LINK_KEYS } from '../../../shared/worktree/hosted-review-links'
} from '../../../../shared/worktree/host-qualified-identity'
import type { HOSTED_REVIEW_LINK_KEYS } from '../../../../shared/worktree/hosted-review-links'
import {
branchHostedReviewOwner,
hostedReviewClearUpdates,
type HostedReviewClearUpdates,
type HostedReviewOwner
} from '../../../shared/worktree/hosted-review-branch-ownership'
} from '../../../../shared/worktree/hosted-review-branch-ownership'
import {
getRepoHostIdentityForParts,
type HostScopedRepoKey
} from '../../../shared/repo-host-identity'
} from '../../../../shared/repo-host-identity'
type IdentityRow = Pick<
Worktree,
@@ -1,32 +1,32 @@
// Runs on plain Node, as orcad does: rows come from the runtime's own listing and store.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../../shared/repo-types'
import type { Repo } from '../../../../shared/repo-types'
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import { OrcaRuntimeService } from '../orca-runtime'
import { OrcaRuntimeService } from '../../orca-runtime'
import type { ResolvedWorktreeSnapshot } from '../workspaces/catalog/runtime-resolved-worktree-cache'
import type { ResolvedWorktreeSnapshot } from '../../workspaces/catalog/runtime-resolved-worktree-cache'
import type { RuntimeStore } from '../construction/runtime-store-contract'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
import type { ResolvedWorktree } from '../workspaces/catalog/runtime-worktree-path-identity'
import type { ResolvedWorktree } from '../../workspaces/catalog/runtime-worktree-path-identity'
import { requireSwitchedOn } from './require-switched-on'
import { requireSwitchedOn } from '../../construction/require-sidebar-inputs-enabled'
import { TestPhone } from './sidebar-inputs-feed.test-fixture'
import { TestPhone } from '../feed/testing/sidebar-inputs-feed.test-fixture'
import type {
ResolvedWorktreeRepoScans,
ResolvedWorktreeScanJoin
} from '../workspaces/catalog/resolved-worktree-scan-join'
} from '../../workspaces/catalog/resolved-worktree-scan-join'
import { composeWorktreeHostIdentity } from '../../../shared/worktree/host-qualified-identity'
import { composeWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity'
import { getRepoHostIdentityForParts } from '../../../shared/repo-host-identity'
import { getRepoHostIdentityForParts } from '../../../../shared/repo-host-identity'
vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
const localRepo: Repo = {
id: 'repo-1',
@@ -118,7 +118,6 @@ function setup(repos: Repo[] = [localRepo, sshRepo]) {
let scans = 0
// A new object per scan that really ran git; a cached scan repeats the last one.
let gitRun: object = {}
let freshGitRuns = true
let scanGate: Promise<void> | null = null
// The real listing cache and visibility filter run; only the scan and merge are stubbed.
class Probe extends OrcaRuntimeService {
@@ -129,7 +128,7 @@ function setup(repos: Repo[] = [localRepo, sshRepo]) {
protected override async scanResolvedWorktreeRepos(): Promise<ResolvedWorktreeRepoScans> {
scans += 1
await scanGate
gitRun = freshGitRuns ? {} : gitRun
gitRun = {}
return new Map()
}
@@ -162,10 +161,6 @@ function setup(repos: Repo[] = [localRepo, sshRepo]) {
runtime,
setWorktreeMeta,
scans: () => scans,
/** Whether the next scans run git again or answer from the scan cache. */
setFreshGitRuns: (fresh: boolean) => {
freshGitRuns = fresh
},
/** Holds every scan until the returned release runs. */
holdScans(): () => void {
let release = (): void => {}
@@ -281,24 +276,4 @@ describe('WorkspaceRowsProducer', () => {
expect(rows.snapshot()?.rows['local|repo-1::/r/a']).toMatchObject({ displayName: 'b' })
detach()
})
it('keeps a PR linked after a branch switch that a cached rescan did not see yet', async () => {
const { runtime, rows, listing, write, setWorktreeMeta, setFreshGitRuns } = setup()
const detach = rows.revision.onChange(() => {})
listing.worktrees[0] = { ...listing.worktrees[0], instanceId: 'i-1' }
await rows.settled()
// `git checkout -b b`; the scan cache still answers with branch a.
setFreshGitRuns(false)
listing.worktrees[0] = { ...listing.worktrees[0], linkedPR: 9 }
write(['worktreeMeta'])
runtime.emit({ type: 'worktreesChanged', repoId: 'repo-1' })
await rows.settled()
// Git runs again and reports the new branch: the new branch's PR stays.
setFreshGitRuns(true)
listing.worktrees[0] = { ...listing.worktrees[0], branch: 'refs/heads/b' }
runtime.emit({ type: 'worktreesChanged', repoId: 'repo-1' })
await rows.settled()
expect(setWorktreeMeta).not.toHaveBeenCalled()
detach()
})
})
@@ -1,26 +1,26 @@
import type { RuntimeClientEvent } from '../../../shared/runtime-client-events'
import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events'
import {
buildWorkspaceRows,
type WorkspaceRowsSnapshot
} from '../../../shared/sidebar-list/workspace-rows'
import { composeWorktreeHostIdentity } from '../../../shared/worktree/host-qualified-identity'
import type { ResolvedWorktree } from '../workspaces/catalog/runtime-worktree-path-identity'
import type { ResolvedWorktreeSnapshot } from '../workspaces/catalog/runtime-resolved-worktree-cache'
import type { RuntimeStore } from '../construction/runtime-store-contract'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import { runtimeVisibleFolderWorkspaces } from '../workspaces/catalog/runtime-visible-catalog'
} from '../../../../shared/sidebar-list/workspace-rows'
import { composeWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity'
import type { ResolvedWorktree } from '../../workspaces/catalog/runtime-worktree-path-identity'
import type { ResolvedWorktreeSnapshot } from '../../workspaces/catalog/runtime-resolved-worktree-cache'
import type { RuntimeStore } from '../../construction/runtime-store-contract'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import { runtimeVisibleFolderWorkspaces } from '../../workspaces/catalog/runtime-visible-catalog'
import type {
ResolvedWorktreeRepoScans,
ResolvedWorktreeScanJoin
} from '../workspaces/catalog/resolved-worktree-scan-join'
} from '../../workspaces/catalog/resolved-worktree-scan-join'
import {
savedWorkspaceCatalog,
WORKTREE_METADATA_DOMAINS
} from '../../persistence/profile-save-domains'
import { ProducerRevision } from './producer-revision'
} from '../../../persistence/profile-save-domains'
import { ProducerRevision } from '../producer-revision'
import { WorkspaceGitIdentity } from './workspace-git-identity'
import { CachedScan } from './cached-scan'
import type { WorkspaceLifecycleQueue } from '../workspaces/lifecycle/workspace-lifecycle-queue'
import { CachedScan } from '../cached-scan'
import type { WorkspaceLifecycleQueue } from '../../workspaces/lifecycle/workspace-lifecycle-queue'
// The settings the visibility filter reads: the defaults, and the layouts that classify a checkout.
const VISIBILITY_SETTINGS = [
@@ -1,11 +1,11 @@
import { describe, expect, it } from 'vitest'
import type { ExecutionHostId } from '../../../shared/execution-host'
import type { Repo } from '../../../shared/repo-types'
import type { ExecutionHostId } from '../../../../shared/execution-host'
import type { Repo } from '../../../../shared/repo-types'
import {
hostWorktreeTarget,
type HostWorktreeTarget
} from '../../../shared/worktree/host-qualified-identity'
import { readSortStamps, writeSortStamps, writeUnreadFlag } from './sort-stamp-records'
} from '../../../../shared/worktree/host-qualified-identity'
import { readSortStamps, writeSortStamps, writeUnreadFlag } from './workspace-activity-records'
const WT = 'dup::/wt'
type Row = { lastActivityAt: number; isUnread?: boolean; hostId?: ExecutionHostId }
@@ -1,19 +1,19 @@
import { getRepoRegistrationHostIds } from '../../../shared/repo-host-identity'
import type { AgentPaneWorkspace } from '../../agent-hooks/observations/agent-transition-detector'
import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host'
import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id'
import { getRepoRegistrationHostIds } from '../../../../shared/repo-host-identity'
import type { AgentPaneWorkspace } from '../../../agent-hooks/observations/agent-transition-detector'
import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../../shared/execution-host'
import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id'
import type {
SmartStampFields,
SmartTier,
SortStamps
} from '../../../shared/sidebar-list/sort-stamps'
import { folderWorkspaceKey, parseWorkspaceKey } from '../../../shared/workspace-scope'
import type { Repo } from '../../../shared/repo-types'
} from '../../../../shared/sidebar-list/sort-stamps'
import { folderWorkspaceKey, parseWorkspaceKey } from '../../../../shared/workspace-scope'
import type { Repo } from '../../../../shared/repo-types'
import {
hostWorktreeTarget,
type HostWorktreeTarget
} from '../../../shared/worktree/host-qualified-identity'
import { resolveWorktreeMetaOwner } from '../../persistence/host-qualified-worktree-meta'
} from '../../../../shared/worktree/host-qualified-identity'
import { resolveWorktreeMetaOwner } from '../../../persistence/host-qualified-worktree-meta'
type StampedRecord = {
lastActivityAt: number
@@ -12,7 +12,7 @@ import type { RuntimeRpcResponse } from '../../../../../../shared/runtime-rpc-en
import { buildSidebarProjectCatalog } from '../../../../../../shared/sidebar-list/sidebar-project-catalog'
import { fetchPairedServerCatalog } from '../../../../../../shared/sidebar-list/paired-server-catalog'
import { group, mainWt, repo } from './sidebar-list-golden-factories.test-fixture'
import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/sidebar-inputs-feed'
import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/feed/sidebar-inputs-feed'
const ENVIRONMENT_ID = 'env-1'
const SERVER_HOST_ID = toRuntimeExecutionHostId(ENVIRONMENT_ID)
@@ -39,7 +39,7 @@ import {
readWindowPairedServerHosts,
readWindowPairedServerRows
} from '@/components/sidebar/worktree-list/parity/sidebar-paired-server-rows.test-fixture'
import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/sidebar-inputs-feed'
import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/feed/sidebar-inputs-feed'
import type { SidebarFeedDomains } from '../../../../../../shared/sidebar-list/sidebar-feed-domains'
import { buildSidebarFeedCatalog } from '../../../../../../shared/sidebar-list/sidebar-feed-catalog'
import {
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest'
import { SidebarInputsFeed } from '../../main/runtime/sidebar-inputs/sidebar-inputs-feed'
import { testDomain } from '../../main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture'
import { SidebarInputsFeed } from '../../main/runtime/sidebar-inputs/feed/sidebar-inputs-feed'
import { testDomain } from '../../main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture'
import type {
SidebarInputsChangedEvent,
SidebarInputsReadParams
@@ -113,28 +113,6 @@ describe('SidebarFeedReader', () => {
}
})
it('stops retrying a host that keeps failing, and when the screen lets go', async () => {
vi.useFakeTimers()
try {
const host = hostWithFeed()
host.transport.mockRejectedValue(new Error('Request timed out: sidebarInputs.read'))
host.reader.refresh()
await vi.advanceTimersByTimeAsync(10 * 60_000)
const attempts = host.transport.mock.calls.length
expect(attempts).toBeGreaterThan(1)
expect(attempts).toBeLessThan(10)
// A fresh trigger gets a fresh budget, which disposal cancels.
host.reader.refresh()
await vi.advanceTimersByTimeAsync(0)
host.reader.dispose()
await vi.advanceTimersByTimeAsync(10 * 60_000)
expect(host.transport.mock.calls.length).toBe(attempts + 1)
} finally {
vi.useRealTimers()
}
})
it('stays bounded when a batch’s first page answers but a later page keeps failing', async () => {
vi.useFakeTimers()
try {
+1 -1
View File
@@ -3,7 +3,7 @@ import { z } from 'zod'
import { test, expect } from './helpers/orca-app'
import { SIDEBAR_INPUTS_BUILD } from './helpers/sidebar-inputs-build'
import { waitForActiveWorktree, waitForSessionReady } from './helpers/store'
import { repoIconId } from '../../src/main/runtime/sidebar-inputs/repo-icon-data-urls'
import { repoIconId } from '../../src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls'
import { readRasterImageDimensions } from '../../src/shared/file-preview/raster-image-dimensions'
test.skip(