mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 09:37:33 +00:00
refactor(ipc): group Linear handlers with direct owner imports (#31673)
* refactor(ipc): group Linear handlers with direct owner imports * chore: keep module organization progress local
This commit is contained in:
@@ -104,7 +104,7 @@ export { githubPrMutationConfirmationSchema as taskMutationConfirmationSchema }
|
||||
* The reply body is unread: use-mobile-tasks-github-reply-merge-actions.tsx:199 calls `interpret`
|
||||
* and discards what it returns, so there is no member to declare. The body is also where this
|
||||
* method refuses — the host answers a rejected update with an in-band `{ ok: false, error }` on an
|
||||
* otherwise successful envelope (src/main/ipc/linear-issue-handlers.ts:117), and
|
||||
* otherwise successful envelope (src/main/ipc/linear/issue-handlers.ts:117), and
|
||||
* `require-result-or-throw-message` throws only on an outer refusal (rpc-operation.ts:129), so that
|
||||
* refusal reaches no `catch` and the screen moves the issue anyway. Main does the same: it read the
|
||||
* identical payload through `rpcUncheckedPayloadReader` and dropped it on the floor.
|
||||
|
||||
+5
-5
@@ -4,15 +4,15 @@ import {
|
||||
listCustomViewIssues,
|
||||
listCustomViewProjects,
|
||||
listCustomViews
|
||||
} from '../linear/projects'
|
||||
} from '../../linear/linear-custom-view-queries'
|
||||
import {
|
||||
normalizeConcreteWorkspaceId,
|
||||
normalizeCustomViewModel,
|
||||
normalizeWorkspaceSelection
|
||||
} from './linear-ipc-args'
|
||||
import { clampLinearIssueListLimit } from '../../shared/linear/issue-read-limits'
|
||||
import type { LinearCustomViewModel } from '../../shared/linear/project-types'
|
||||
import type { LinearWorkspaceSelection } from '../../shared/linear/workspace-types'
|
||||
} from './ipc-args'
|
||||
import { clampLinearIssueListLimit } from '../../../shared/linear/issue-read-limits'
|
||||
import type { LinearCustomViewModel } from '../../../shared/linear/project-types'
|
||||
import type { LinearWorkspaceSelection } from '../../../shared/linear/workspace-types'
|
||||
|
||||
export function registerLinearCustomViewHandlers(): void {
|
||||
ipcMain.handle(
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LinearCustomViewModel } from '../../shared/linear/project-types'
|
||||
import type { LinearWorkspaceSelection } from '../../shared/linear/workspace-types'
|
||||
import type { LinearCustomViewModel } from '../../../shared/linear/project-types'
|
||||
import type { LinearWorkspaceSelection } from '../../../shared/linear/workspace-types'
|
||||
|
||||
export function normalizeWorkspaceId(value: unknown): string | undefined {
|
||||
return typeof value === 'string' && value.trim() ? value.trim() : undefined
|
||||
@@ -1,13 +1,13 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { getIssue, searchIssues } from '../linear/linear-issue-lookups'
|
||||
import { listIssues, type LinearListFilter } from '../linear/linear-issue-listing'
|
||||
import { createIssue, updateIssue } from '../linear/linear-issue-mutations'
|
||||
import { addIssueComment, getIssueComments } from '../linear/linear-issue-comments'
|
||||
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './linear-ipc-args'
|
||||
import { clampLinearIssueListLimit } from '../../shared/linear/issue-read-limits'
|
||||
import { optionalParsedLinearIssueAttributeFilter } from '../../shared/linear/issue-attribute-filter'
|
||||
import type { LinearIssueUpdate } from '../../shared/issue-mutation-types'
|
||||
import type { LinearWorkspaceSelection } from '../../shared/linear/workspace-types'
|
||||
import { getIssue, searchIssues } from '../../linear/linear-issue-lookups'
|
||||
import { listIssues, type LinearListFilter } from '../../linear/linear-issue-listing'
|
||||
import { createIssue, updateIssue } from '../../linear/linear-issue-mutations'
|
||||
import { addIssueComment, getIssueComments } from '../../linear/linear-issue-comments'
|
||||
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './ipc-args'
|
||||
import { clampLinearIssueListLimit } from '../../../shared/linear/issue-read-limits'
|
||||
import { optionalParsedLinearIssueAttributeFilter } from '../../../shared/linear/issue-attribute-filter'
|
||||
import type { LinearIssueUpdate } from '../../../shared/issue-mutation-types'
|
||||
import type { LinearWorkspaceSelection } from '../../../shared/linear/workspace-types'
|
||||
|
||||
const VALID_FILTERS = new Set<LinearListFilter>(['assigned', 'created', 'all', 'completed'])
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { createProject, getProject, listProjectIssues, listProjects } from '../linear/projects'
|
||||
import { createProject, getProject, listProjects } from '../../linear/linear-project-queries'
|
||||
import { listProjectIssues } from '../../linear/linear-project-issue-queries'
|
||||
import {
|
||||
normalizeConcreteWorkspaceId,
|
||||
normalizeIdList,
|
||||
normalizeOptionalDate,
|
||||
normalizeWorkspaceId,
|
||||
normalizeWorkspaceSelection
|
||||
} from './linear-ipc-args'
|
||||
import { clampLinearIssueListLimit } from '../../shared/linear/issue-read-limits'
|
||||
import type { LinearWorkspaceSelection } from '../../shared/linear/workspace-types'
|
||||
} from './ipc-args'
|
||||
import { clampLinearIssueListLimit } from '../../../shared/linear/issue-read-limits'
|
||||
import type { LinearWorkspaceSelection } from '../../../shared/linear/workspace-types'
|
||||
|
||||
export function registerLinearProjectHandlers(): void {
|
||||
ipcMain.handle(
|
||||
@@ -28,7 +28,7 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('../linear/client', () => ({
|
||||
vi.mock('../../linear/client', () => ({
|
||||
connect: connectMock,
|
||||
disconnect: disconnectMock,
|
||||
getStatus: getStatusMock,
|
||||
@@ -36,44 +36,50 @@ vi.mock('../linear/client', () => ({
|
||||
testConnection: testConnectionMock
|
||||
}))
|
||||
|
||||
vi.mock('../linear/linear-issue-lookups', () => ({
|
||||
vi.mock('../../linear/linear-issue-lookups', () => ({
|
||||
getIssue: vi.fn(),
|
||||
searchIssues: vi.fn()
|
||||
}))
|
||||
vi.mock('../linear/linear-issue-listing', () => ({
|
||||
vi.mock('../../linear/linear-issue-listing', () => ({
|
||||
listIssues: listIssuesMock
|
||||
}))
|
||||
vi.mock('../linear/linear-issue-mutations', () => ({
|
||||
vi.mock('../../linear/linear-issue-mutations', () => ({
|
||||
createIssue: vi.fn(),
|
||||
updateIssue: vi.fn()
|
||||
}))
|
||||
vi.mock('../linear/linear-issue-comments', () => ({
|
||||
vi.mock('../../linear/linear-issue-comments', () => ({
|
||||
addIssueComment: vi.fn(),
|
||||
getIssueComments: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('../linear/projects', () => ({
|
||||
vi.mock('../../linear/linear-custom-view-queries', () => ({
|
||||
getCustomView: vi.fn(),
|
||||
getProject: vi.fn(),
|
||||
listCustomViewIssues: listCustomViewIssuesMock,
|
||||
listCustomViewProjects: vi.fn(),
|
||||
listCustomViews: vi.fn(),
|
||||
listProjectIssues: listProjectIssuesMock,
|
||||
listCustomViews: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('../../linear/linear-project-queries', () => ({
|
||||
getProject: vi.fn(),
|
||||
listProjects: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('../linear/teams', () => ({
|
||||
vi.mock('../../linear/linear-project-issue-queries', () => ({
|
||||
listProjectIssues: listProjectIssuesMock
|
||||
}))
|
||||
|
||||
vi.mock('../../linear/teams', () => ({
|
||||
listTeams: vi.fn(),
|
||||
getTeamStates: vi.fn(),
|
||||
getTeamLabels: vi.fn(),
|
||||
getTeamMembers: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('../preflight/agent-detection', () => ({
|
||||
vi.mock('../../preflight/agent-detection', () => ({
|
||||
_resetPreflightCache: vi.fn()
|
||||
}))
|
||||
|
||||
import { registerLinearHandlers } from './linear'
|
||||
import { registerLinearHandlers } from './register-handlers'
|
||||
|
||||
type HandlerMap = Record<string, (_event: unknown, args: unknown) => unknown>
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { connect, disconnect, getStatus, selectWorkspace, testConnection } from '../linear/client'
|
||||
import { _resetPreflightCache } from '../preflight/agent-detection'
|
||||
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './linear-ipc-args'
|
||||
import { registerLinearIssueHandlers } from './linear-issue-handlers'
|
||||
import { registerLinearProjectHandlers } from './linear-project-handlers'
|
||||
import { registerLinearCustomViewHandlers } from './linear-custom-view-handlers'
|
||||
import { registerLinearTeamHandlers } from './linear-team-handlers'
|
||||
import {
|
||||
connect,
|
||||
disconnect,
|
||||
getStatus,
|
||||
selectWorkspace,
|
||||
testConnection
|
||||
} from '../../linear/client'
|
||||
import { _resetPreflightCache } from '../../preflight/agent-detection'
|
||||
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './ipc-args'
|
||||
import { registerLinearIssueHandlers } from './issue-handlers'
|
||||
import { registerLinearProjectHandlers } from './project-handlers'
|
||||
import { registerLinearCustomViewHandlers } from './custom-view-handlers'
|
||||
import { registerLinearTeamHandlers } from './team-handlers'
|
||||
|
||||
export function registerLinearHandlers(): void {
|
||||
ipcMain.handle('linear:connect', async (_event, args: { apiKey: string }) => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { listTeams, getTeamStates, getTeamLabels, getTeamMembers } from '../linear/teams'
|
||||
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './linear-ipc-args'
|
||||
import type { LinearWorkspaceSelection } from '../../shared/linear/workspace-types'
|
||||
import { listTeams, getTeamStates, getTeamLabels, getTeamMembers } from '../../linear/teams'
|
||||
import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './ipc-args'
|
||||
import type { LinearWorkspaceSelection } from '../../../shared/linear/workspace-types'
|
||||
|
||||
export function registerLinearTeamHandlers(): void {
|
||||
ipcMain.handle(
|
||||
@@ -399,7 +399,7 @@ vi.mock('../terminal-render-desync-evidence', () => ({
|
||||
registerTerminalRenderDesyncEvidenceHandler: registerTerminalRenderDesyncEvidenceHandlerMock
|
||||
}))
|
||||
|
||||
vi.mock('../linear', () => ({
|
||||
vi.mock('../linear/register-handlers', () => ({
|
||||
registerLinearHandlers: registerLinearHandlersMock
|
||||
}))
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { registerUsageProviderHandlers } from '../usage-provider-handlers'
|
||||
import { registerGitHubHandlers } from '../github'
|
||||
import { registerGitLabHandlers } from '../gitlab'
|
||||
import { registerHostedReviewHandlers } from '../hosted-review'
|
||||
import { registerLinearHandlers } from '../linear'
|
||||
import { registerLinearHandlers } from '../linear/register-handlers'
|
||||
import { registerJiraHandlers } from '../jira'
|
||||
import { registerJiraIssueSummaryGenerationHandlers } from '../jira-issue-summary-generation'
|
||||
import { registerBitbucketHandlers } from '../bitbucket'
|
||||
|
||||
Reference in New Issue
Block a user