Files
orca/src/main/runtime/runtime-linear-command-base.ts
T
Neil 121eb3bc84 fix(runtime): resolve folder workspaces wherever a command can be given one (#35223)
* fix(runtime): resolve workspaces, not only Git worktrees, wherever a folder id can arrive

The Git-only selector resolver never matches project-group folder
workspaces (no repo row), so worktree show/sleep, terminal list by
workspace key, the active-terminal fallback, scrollback reads, Kitty file
reads, Linear --current, browser commands, plugin context and the session
tab fallbacks failed with selector_not_found for them. Route those
callers through resolveWorkspaceSelector and rename the Git-only resolver
to resolveGitWorktreeSelector so it reads as the repo-backed catalog only.

Refs STA-12562

* test(runtime): follow the workspace resolver rename in host fakes

Refs STA-12562

* test(runtime): keep partial browser host fakes and mail-routing stubs on the renamed resolver

Refs STA-12562

* test(runtime): drop an accidental copy of the folder selector suite

Refs STA-12562

* fix(runtime): keep folder workspaces off the skill worktree fence and the Linear meta backfill

Skill installs fence a worktreeId by repo rows, so a folder id there must
come through folderWorkspaceId, where its own host fence applies. Linear
--current answers a folder's legacy link without writing a worktreeMeta
row keyed by the folder id.

Refs STA-12562
2026-10-28 10:52:37 -07:00

57 lines
1.9 KiB
TypeScript

import type { RuntimeTerminalShow } from '../../shared/runtime-types'
import type { ResolvedWorktree } from './runtime-worktree-path-identity'
import type { LinearLinkedIssueUpdatedEvent } from './runtime-linear-command-dependencies'
import { RuntimeLinearBrowseCommands } from './runtime-linear-browse-commands'
export type RuntimeLinearCommandPorts = {
runtimeAvailable: () => boolean
showTerminal: (handle: string) => Promise<RuntimeTerminalShow>
resolveWorkspaceSelector: (selector: string) => Promise<ResolvedWorktree>
listResolvedWorktrees: () => Promise<ResolvedWorktree[]>
setWorktreeMeta: (
worktree: Pick<ResolvedWorktree, 'id' | 'hostId'>,
meta: {
linkedLinearIssueWorkspaceId: string
linkedLinearIssueOrganizationUrlKey: string | null
}
) => void
emitClientEvent: (event: LinearLinkedIssueUpdatedEvent) => void
}
// Root browse reads so write commands can reenter through this, preserving facade dispatch.
export class RuntimeLinearCommandBase extends RuntimeLinearBrowseCommands {
constructor(private readonly ports: RuntimeLinearCommandPorts) {
super()
}
protected runtimeAvailable(): boolean {
return this.ports.runtimeAvailable()
}
protected showTerminal(handle: string): Promise<RuntimeTerminalShow> {
return this.ports.showTerminal(handle)
}
protected resolveWorkspaceSelector(selector: string): Promise<ResolvedWorktree> {
return this.ports.resolveWorkspaceSelector(selector)
}
protected listResolvedWorktrees(): Promise<ResolvedWorktree[]> {
return this.ports.listResolvedWorktrees()
}
protected setWorktreeMeta(
worktree: Pick<ResolvedWorktree, 'id' | 'hostId'>,
meta: {
linkedLinearIssueWorkspaceId: string
linkedLinearIssueOrganizationUrlKey: string | null
}
): void {
this.ports.setWorktreeMeta(worktree, meta)
}
protected emitClientEvent(event: LinearLinkedIssueUpdatedEvent): void {
this.ports.emitClientEvent(event)
}
}