Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4b3d1a8
Keep opened GitHub work items bound to their exact repository
brennanb2025 Oct 29, 2026
4d11b1f
Bind GitHub work item ownership through consumers and dispatch
brennanb2025 Oct 30, 2026
099e5d0
Keep empty mention lists from consuming selection keys
brennanb2025 Oct 30, 2026
81c83f4
Preserve GitHub action and consumer ownership across resource changes
brennanb2025 Oct 30, 2026
b212ba0
Exercise repository account updates through their production store ac…
brennanb2025 Oct 30, 2026
d9cf450
Exercise account publication and cache settlement through GitHub cons…
brennanb2025 Oct 30, 2026
15ff00a
Simplify fork PR contract verification
brennanb2025 Oct 31, 2026
d9680e4
Merge origin/main into fork PR identity branch
brennanb2025 Oct 31, 2026
b37b7b4
Make contract verification imports and clocks deterministic
brennanb2025 Oct 31, 2026
15793f6
Correct mobile task test fixtures and model types
brennanb2025 Oct 31, 2026
50d0203
Correct task recording fixtures and CI types
brennanb2025 Oct 31, 2026
94f0171
Correct task fixture types and static checks
brennanb2025 Oct 31, 2026
937641b
Consolidate replay test RPC imports
brennanb2025 Oct 31, 2026
f3dd6f6
Separate GitHub metadata imports from Linear hooks
brennanb2025 Oct 31, 2026
3d49c84
Scope mobile PR sidebar reads to the selected resource
brennanb2025 Oct 31, 2026
f2bee63
Separate desktop GitHub changes from phone updates
brennanb2025 Oct 31, 2026
0c73076
Fix relay authority probe census across topology cases
brennanb2025 Oct 31, 2026
ec3e5db
Repair repository owner proof fixtures and compiler allocation
brennanb2025 Oct 31, 2026
a311f1a
Preserve repository row observation in host lookup
brennanb2025 Oct 31, 2026
b390ab5
Seed metadata fixture before server-side store acquisition
brennanb2025 Oct 31, 2026
4d1cd3a
Preserve nullable fixture settings and discover mixed test types
brennanb2025 Oct 31, 2026
baa9887
Merge main into repository identity branch
brennanb2025 Oct 31, 2026
bac5082
Merge main into repository identity branch
brennanb2025 Oct 31, 2026
43ade10
Merge main into repository identity branch
brennanb2025 Nov 2, 2026
57871fe
Merge main into repository identity branch
brennanb2025 Nov 2, 2026
ce1f2cb
Merge main and preserve GitHub detail read intent
brennanb2025 Nov 2, 2026
b0d8d3d
Preserve GitHub detail argument types and optional capabilities
brennanb2025 Nov 2, 2026
fa44a08
Let keyed details queries own pending read replacement
brennanb2025 Nov 2, 2026
e5eada9
Repair GitHub RPC and relay test fixture boundaries
brennanb2025 Nov 2, 2026
c3c3e33
Verify expected GitHub account at repository execution capture
brennanb2025 Nov 2, 2026
12cf608
Preserve captured GitHub account expectations through client dispatch
brennanb2025 Nov 2, 2026
dff18b9
Retain observed runtime status after switching environments
brennanb2025 Nov 2, 2026
7c570f1
Merge main into fork pull request identity repair
brennanb2025 Nov 2, 2026
8991ba1
Fix account contract fixture types and RPC setup timing
brennanb2025 Nov 2, 2026
f17e9cc
Restore the negative-capability switch probe assertion
brennanb2025 Nov 2, 2026
b12b03a
Align account fixtures with runtime identity and configured origin
brennanb2025 Nov 2, 2026
89c7b8f
Consolidate details test imports
brennanb2025 Nov 2, 2026
8310b1d
Drop duplicate fork pull request identity tests
brennanb2025 Nov 2, 2026
d388639
Merge main into fork pull request identity repair
brennanb2025 Nov 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 51 additions & 23 deletions config/scripts/github-opened-issue-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { join } from 'node:path'
import { tmpdir } from 'node:os'
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import type * as ReactModule from 'react'
import { create } from 'zustand'
import type { AppState } from '../../src/renderer/src/store/types'
import type * as GhUtils from '../../src/main/github/gh-utils'
import type * as IssueMetadata from '../../src/renderer/src/hooks/useIssueMetadata'
import type { GitHubWorkItem } from '../../src/shared/github/work-item-types'
Expand All @@ -22,20 +23,11 @@ const fixture = vi.hoisted(() => {
return state
})

vi.mock('react', async (original) => ({
...(await original<typeof ReactModule>()),
useState: (initial: unknown) => [typeof initial === 'function' ? initial() : initial, vi.fn()],
useMemo: <T>(value: () => T) => value(),
useCallback: <T>(value: T) => value,
useRef: <T>(initial: T) => ({ current: initial }),
useEffect: vi.fn()
}))
vi.mock('zustand/react/shallow', () => ({ useShallow: <T>(value: T) => value }))
vi.mock('@/store', () => ({
useAppStore: Object.assign(
(selector: (state: unknown) => unknown) =>
selector({ patchWorkItem: vi.fn(), patchProjectRowContent: vi.fn() }),
{ getState: () => ({ recordFeatureInteraction: vi.fn() }) }
(selector: (state: ReturnType<typeof metadataStore.getState>) => unknown) =>
metadataStore(selector),
{ getState: () => metadataStore.getState() }
)
}))
vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback }))
Expand Down Expand Up @@ -80,18 +72,14 @@ import { workItemsCacheKey } from '../../src/renderer/src/store/github/cache-ide
import { createTestStore } from '../../src/renderer/src/store/slices/github-slice-test-harness'
import { getTaskSourceCacheScope } from '../../src/shared/task-source-context'
import { listLabels, listAssignableUsers } from '../../src/main/github/issue-field-options'
import { useRepoLabels, useRepoAssignees } from '../../src/renderer/src/hooks/useIssueMetadata'
import { useRepoLabels, useRepoAssignees } from '../../src/renderer/src/hooks/useGitHubRepoMetadata'
import { updateIssue } from '../../src/main/github/issue-update'
import { materializeTaskPageItemList } from '../../src/renderer/src/components/task-page/github/task-page-github-work-item-mutation-pages'
import {
resetTaskPageGitHubMutationRegistryForTests,
setTaskPageGitHubMutationQueryKey
} from '../../src/renderer/src/components/task-page/github/task-page-github-work-item-mutation-registry'

function renderEditSection(props: Parameters<typeof GHEditSection>[0]): void {
renderToStaticMarkup(createElement(GHEditSection, props))
}

const registeredRepo: Repo = {
id: 'repo-1',
path: join(tmpdir(), 'orca-opened-issue-repository-fixture'),
Expand All @@ -101,6 +89,19 @@ const registeredRepo: Repo = {
upstream: { owner: 'upstream-owner', repo: 'widgets', host: 'github.com' }
}

const metadataStore = create<
Pick<AppState, 'repos' | 'patchWorkItem' | 'patchProjectRowContent' | 'recordFeatureInteraction'>
>()(() => ({
repos: [registeredRepo],
patchWorkItem: vi.fn(),
patchProjectRowContent: vi.fn(),
recordFeatureInteraction: vi.fn()
}))

function renderEditSection(props: Parameters<typeof GHEditSection>[0]): void {
renderToStaticMarkup(createElement(GHEditSection, props))
}

function sourceFor(preference: 'origin' | 'upstream'): TaskSourceContext {
const source = getTaskPageRepoSourceContext(
{ ...registeredRepo, issueSourcePreference: preference },
Expand Down Expand Up @@ -136,6 +137,7 @@ type MetadataArgs = { repoPath: string; ownerRepo?: GitHubOwnerRepo }

beforeEach(() => {
fixture.preference = 'upstream'
metadataStore.setState({ repos: [registeredRepo] })
fixture.loads = []
fixture.requests = []
resetTaskPageGitHubMutationRegistryForTests()
Expand Down Expand Up @@ -316,20 +318,46 @@ it('keeps ordinary metadata caches distinct by canonical repository and host', (
{ ...issueRepo, host: 'ghe.example:8443' }
]
for (const ownerRepo of identities) {
useRepoLabels(registeredRepo.path, registeredRepo.id, { ownerRepo })
useRepoAssignees(registeredRepo.path, registeredRepo.id, { ownerRepo })
function Metadata() {
useRepoLabels(registeredRepo.path, registeredRepo.id, { ownerRepo })
useRepoAssignees(registeredRepo.path, registeredRepo.id, { ownerRepo })
return null
}
renderToStaticMarkup(createElement(Metadata))
}
expect(new Set(fixture.loads.filter((_, i) => i % 2 === 0).map((load) => load.key)).size).toBe(3)
expect(new Set(fixture.loads.filter((_, i) => i % 2 === 1).map((load) => load.key)).size).toBe(3)
})

it('keeps metadata requests without an explicit target compatible', async () => {
useRepoLabels(registeredRepo.path, registeredRepo.id)
useRepoAssignees(registeredRepo.path, registeredRepo.id)
function Metadata() {
useRepoLabels(registeredRepo.path, registeredRepo.id)
useRepoAssignees(registeredRepo.path, registeredRepo.id)
return null
}
renderToStaticMarkup(createElement(Metadata))
for (const request of fixture.loads) {
await request.load()
}
expect(fixture.loads.map((load) => load.key)).toEqual([registeredRepo.id, registeredRepo.id])
const scope = JSON.stringify([
'local',
null,
registeredRepo.id,
registeredRepo.path,
registeredRepo.id,
registeredRepo.path,
null,
null,
null,
null,
null,
null,
null
])
expect(fixture.loads.map((load) => load.key)).toEqual([
`${registeredRepo.id}::${scope}`,
`${registeredRepo.id}::${scope}`
])
expect(
fixture.requests.map((request) => request.args.find((arg) => arg.startsWith('repos/')))
).toEqual([
Expand Down
37 changes: 34 additions & 3 deletions config/scripts/github-pr-assignee-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ vi.mock('@/components/ui/popover', () => ({
PopoverContent: vi.fn(),
PopoverTrigger: vi.fn()
}))
vi.mock('@/hooks/useGitHubRepoMetadata', () => ({
useRepoAssignees: () => ({ data: [], loading: false, error: null })
}))
vi.mock('@/hooks/useIssueMetadata', () => ({
useRepoAssignees: () => ({ data: [], loading: false, error: null }),
useImmediateMutation: () => ({
isPending: () => false,
run: (_key: string, spec: { mutate: () => Promise<unknown> }) => {
Expand Down Expand Up @@ -92,8 +94,12 @@ vi.mock('../../src/main/git/remote-name-listing', () => ({
import { PRAssigneesPanel } from '../../src/renderer/src/components/github/PRAssigneesPanel'
import { updateIssue } from '../../src/main/github/issue-update'
import { _resetOriginGitHubApiRepositoryCache } from '../../src/main/github/github-api-repository'
import { onGitHubWorkItemDetailsCacheMutation } from '../../src/renderer/src/lib/github-work-item-details-cache-events'

const repoPath = join(tmpdir(), 'orca-pr-assignee-repository-fixture')
const notifyWorkItemMutated = vi.fn(async () => {})
const localMutation = vi.fn()
let stopListening: (() => void) | undefined

beforeEach(() => {
fixture.callbacks = []
Expand Down Expand Up @@ -137,10 +143,22 @@ beforeEach(() => {
args.ownerRepo
)
)
vi.stubGlobal('window', { api: { gh: { updateIssue: fixture.apiUpdate } } })
notifyWorkItemMutated.mockClear()
localMutation.mockClear()
vi.stubGlobal(
'window',
Object.assign(new EventTarget(), {
api: { gh: { updateIssue: fixture.apiUpdate, notifyWorkItemMutated } }
})
)
stopListening = onGitHubWorkItemDetailsCacheMutation(localMutation)
})

afterEach(() => vi.unstubAllGlobals())
afterEach(() => {
stopListening?.()
stopListening = undefined
vi.unstubAllGlobals()
})

it.each([
{ owner: 'upstream-owner', preference: 'origin', assigned: false, legacy: false },
Expand Down Expand Up @@ -174,6 +192,19 @@ it.each([
}
toggleAssignee('octo')
await fixture.mutation
expect(localMutation).toHaveBeenCalledExactlyOnceWith({
repoPath,
repoId: item.repoId,
sourceContext: undefined,
type: 'pr',
number: 5
})
expect(notifyWorkItemMutated).toHaveBeenCalledExactlyOnceWith({
repoPath,
repoId: item.repoId,
type: 'pr',
number: 5
})
expect(fixture.requests).toEqual([
{
args: [
Expand Down
22 changes: 14 additions & 8 deletions config/scripts/typecheck-project-coverage.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ describe('typecheck project coverage', () => {
expect(tests.filter((file) => !project.files.has(resolve(root, file)))).toEqual([])
})

it('assigns the combined pane launch integration to its typed cross-process project', () => {
const suite = resolve(
root,
'src/renderer/src/components/terminal-pane/pty-agent-pane-launch.test.ts'
)
expect(
projects.filter((project) => project.files.has(suite)).map((project) => project.config)
).toEqual(['config/tsconfig.test.pane-launch.json'])
it('assigns cross-process integrations to the scheduled mixed project', () => {
const suites = [
'src/renderer/src/components/terminal-pane/pty-agent-pane-launch.test.ts',
'src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-contract.test.tsx',
'src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-isolation.test.tsx',
'src/renderer/src/hooks/useGitHubRepoMetadata.target-sharing.test.tsx'
]
for (const suite of suites) {
expect(
projects
.filter((project) => project.files.has(resolve(root, suite)))
.map((project) => project.config)
).toEqual(['config/tsconfig.test.pane-launch.json'])
}
const combined = projects.find(
(project) => project.config === 'config/tsconfig.test.pane-launch.json'
)
Expand Down
3 changes: 3 additions & 0 deletions config/tsconfig.tc.web.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"extends": "./tsconfig.web.json",
"exclude": [
"../src/renderer/src/components/terminal-pane/pty-agent-pane-launch.test.ts",
"../src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-contract.test.tsx",
"../src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-isolation.test.tsx",
"../src/renderer/src/hooks/useGitHubRepoMetadata.target-sharing.test.tsx",
"../src/shared/**/*.test.ts",
"../src/shared/**/*.test.tsx",
"../src/shared/**/*.spec.ts",
Expand Down
3 changes: 3 additions & 0 deletions config/tsconfig.test.pane-launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"extends": "./tsconfig.web.json",
"include": [
"../src/renderer/src/components/terminal-pane/pty-agent-pane-launch.test.ts",
"../src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-contract.test.tsx",
"../src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-isolation.test.tsx",
"../src/renderer/src/hooks/useGitHubRepoMetadata.target-sharing.test.tsx",
"../src/renderer/src/env.d.ts",
"../src/types/build-constants.d.ts",
"../src/shared/**/*"
Expand Down
7 changes: 6 additions & 1 deletion config/tsconfig.web.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
"../src/preload/api/**/*",
"../src/shared/**/*"
],
"exclude": ["../src/renderer/src/components/terminal-pane/pty-agent-pane-launch.test.ts"],
"exclude": [
"../src/renderer/src/components/terminal-pane/pty-agent-pane-launch.test.ts",
"../src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-contract.test.tsx",
"../src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-target-isolation.test.tsx",
"../src/renderer/src/hooks/useGitHubRepoMetadata.target-sharing.test.tsx"
],
"compilerOptions": {
"composite": true,
"jsx": "react-jsx",
Expand Down
23 changes: 12 additions & 11 deletions src/main/github/work-item-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,38 +72,38 @@ export async function getWorkItemDetails(
repositoryOverride?: unknown
): Promise<GitHubWorkItemDetails | null> {
return withGitHubRepoExecution(repoPath, connectionId, localGitOptions, async () => {
let issueRepositoryOverride: GitHubApiRepository | null = null
if (type === 'issue' && repositoryOverride != null) {
let repositoryTarget: GitHubApiRepository | null = null
if (type && repositoryOverride != null) {
if (!isValidGitHubApiRepository(repositoryOverride)) {
return null
}
issueRepositoryOverride = (
repositoryTarget = (
await resolveGitHubRepoExecution(
repoPath,
repositoryOverride,
connectionId,
localGitOptions
)
).ownerRepo
if (!issueRepositoryOverride) {
if (!repositoryTarget) {
return null
}
}
const {
item,
repository: selectedRepository,
issueDetails
} = issueRepositoryOverride
} = repositoryTarget
? {
item: await getWorkItemByOwnerRepo(
repoPath,
issueRepositoryOverride,
repositoryTarget,
number,
'issue',
type === 'pr' ? 'pr' : 'issue',
connectionId,
localGitOptions
),
repository: issueRepositoryOverride,
repository: repositoryTarget,
issueDetails: undefined
}
: await getWorkItemWithRepository(
Expand All @@ -119,12 +119,13 @@ export async function getWorkItemDetails(
return null
}

// Keep the conversation in the same repository as the selected issue.
// The clone selects execution; an addressed item selects every detail read.
const resolvedRepository =
item.type === 'issue'
repositoryTarget ??
(item.type === 'issue'
? selectedRepository
: (await resolveGitHubRepoExecution(repoPath, item.prRepo, connectionId, localGitOptions))
.ownerRepo
.ownerRepo)

if (item.type === 'issue') {
return withWorkItemDetailsPermit(async () => {
Expand Down
Loading
Loading