Repository navigation
fix(workspaces): recognize pasted Linear issue URLs - #14190
Conversation
📝 WalkthroughWalkthroughAdds Linear and GitHub task URL parsing, organization-aware lookup, stale-status refresh, and worktree matching. Updates the workspace composer and Cmd+J palette with asynchronous previews, delayed loading feedback, stale-request protection, linked-worktree selection, repository context, and task metadata. Adds a dedicated creation row, localization strings, unit tests, component tests, and end-to-end coverage. Mergeability Score: 🟡 Moderate · up to Pasted issue URLs now select existing workspaces or open creation previews, but non-English users can still receive English-only preview and accessibility labels, while editing a pasted URL may trigger repeated provider lookups and one focus test may be timing-sensitive. Merge should wait for these bounded issues to be fixed or explicitly accepted by the owner. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/renderer/src/lib/linear-issue-url-lookup.test.ts (1)
72-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the refreshed workspace ID that the second lookup used.
workspaceId: 'stably-workspace'is a constant of theissue()fixture, so it does not prove which workspace the refresh path queried. The call-count assertion is the only real evidence. Add an explicit assertion on the second call arguments.♻️ Proposed assertion
).resolves.toMatchObject({ workspaceId: 'stably-workspace' }) expect(fetchLinearIssue).toHaveBeenCalledTimes(2) + expect(fetchLinearIssue).toHaveBeenLastCalledWith('STA-4084', 'remote-stably-workspace', { + sourceContext: null + })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 593161f4-6191-4a0a-bfff-194c6be572b4
📒 Files selected for processing (17)
src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsxsrc/renderer/src/components/WorktreeJumpPalette.tsxsrc/renderer/src/components/cmd-j/PaletteCreateWorktreeRow.tsxsrc/renderer/src/components/new-workspace/SmartWorkspaceNameField-source-boundaries.test.tssrc/renderer/src/components/new-workspace/SmartWorkspaceNameField.ime-enter.test.tsxsrc/renderer/src/components/new-workspace/SmartWorkspaceNameField.tsxsrc/renderer/src/components/new-workspace/smart-workspace-command-value.test.tssrc/renderer/src/components/new-workspace/smart-workspace-source-results.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/cmd-j-linear-issue-intent.test.tssrc/renderer/src/lib/linear-issue-url-lookup.test.tssrc/renderer/src/lib/linear-issue-url-lookup.tssrc/shared/linear-links.tssrc/shared/new-workspace/smart-workspace-linear-intent.tssrc/shared/new-workspace/smart-workspace-source-query.tssrc/shared/new-workspace/smart-workspace-source-results.tstests/e2e/linear-url-workspace-entry.spec.ts
| await act(async () => { | ||
| issueLookup.resolve(makeLinearIssue()) | ||
| await issueLookup.promise | ||
| await new Promise((resolve) => window.setTimeout(resolve, 50)) | ||
| }) | ||
|
|
||
| expect(document.activeElement).toBe(focusTarget) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
Does Vitest expect.poll support a timeout option?
💡 Result:
Yes, Vitest's expect.poll supports a timeout option [1][2][3]. You can provide a timeout in milliseconds as an option to expect.poll to specify how long Vitest should retry the assertion before failing [1][2][3]. Usage example: await expect.poll( => condition, { timeout: 2000 }).toBe(true); Key details regarding the timeout option: - Default Value: The default timeout is 1000ms, which can also be configured globally via the Vitest config [4][1][3]. - Functionality: The timeout applies to the entire polling operation, which includes the execution of the polling callback and any associated asynchronous matcher execution [2]. - AbortSignal: The callback function provided to expect.poll can receive an AbortSignal as an argument, which is triggered when the specified timeout is reached [2]. This allows the polling callback to abort its own internal operations (like long-running requests) if the poll timeout has elapsed [2][5].
Citations:
- 1: https://vitest.dev/api/expect.html
- 2: https://github.com/vitest-dev/vitest/blob/206e8cff/docs/api/expect.md
- 3: https://vitest.dev/api/browser/assertions
- 4: https://vitest.dev/config/expect
- 5:
expect.poll(.., { timeout })doesn't fail early on giventimeoutvitest-dev/vitest#9844
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx"
printf '%s\n' '--- relevant test ---'
sed -n '450,535p' "$file"
printf '%s\n' '--- focusFallbackSurface references ---'
rg -n -C 5 "focusFallbackSurface|requestAnimationFrame|activeElement" src/renderer/src/components src/renderer/src -g '*.ts' -g '*.tsx' | head -240
printf '%s\n' '--- Vitest configuration and versions ---'
rg -n -C 3 '"vitest"|expect\.poll|testTimeout|fakeTimers' package.json pnpm-lock.yaml yarn.lock package-lock.json vitest.config.* src -g '*' 2>/dev/null | head -240Repository: stablyai/orca
Length of output: 29796
🏁 Script executed:
#!/bin/bash
set -u
printf '%s\n' '--- locate focusFallbackSurface ---'
rg -n -C 8 --hidden --glob '!node_modules' --glob '!dist' --glob '!build' "focusFallbackSurface" . || true
printf '%s\n' '--- locate nested animation-frame focus scheduling ---'
rg -n -C 8 --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
"requestAnimationFrame.*requestAnimationFrame|requestAnimationFrame" \
src/renderer/src/components/WorktreeJumpPalette* \
src/renderer/src/components 2>/dev/null | head -300
printf '%s\n' '--- test setup and timer configuration ---'
sed -n '1,120p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
rg -n -C 4 --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
"useFakeTimers|useRealTimers|stubGlobal.*requestAnimationFrame|setTimeout" \
src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx \
src/renderer/src/components/WorktreeJumpPalette* 2>/dev/null || trueRepository: stablyai/orca
Length of output: 50369
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
source = Path("src/renderer/src/components/WorktreeJumpPalette.tsx").read_text()
test = Path("src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx").read_text()
start = source.index("const focusFallbackSurface = useCallback")
end = source.index("const handleCloseAutoFocus", start)
implementation = source[start:end]
assert implementation.count("requestAnimationFrame") >= 2
assert "resolvePaletteFocusRestoreTarget(preferredTarget ?? null)?.focus" in implementation
assert "setTimeout(resolve, 50)" in test
assert "useFakeTimers" not in test
print("focusFallbackSurface uses nested requestAnimationFrame callbacks")
print("test uses a fixed 50 ms setTimeout")
print("test does not configure fake timers")
PY
printf '%s\n' '--- exact implementation ---'
sed -n '2120,2134p' src/renderer/src/components/WorktreeJumpPalette.tsx
printf '%s\n' '--- existing expect.poll usage ---'
rg -n -m 5 "expect\.poll\(" src/renderer/src --glob '*.test.ts' --glob '*.test.tsx'Repository: stablyai/orca
Length of output: 240
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
source = Path("src/renderer/src/components/WorktreeJumpPalette.tsx").read_text()
test = Path("src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx").read_text()
start = source.index("const focusFallbackSurface = useCallback")
end = source.index("const handleCloseAutoFocus", start)
implementation = source[start:end]
assert implementation.count("requestAnimationFrame") >= 2
assert "resolvePaletteFocusRestoreTarget(preferredTarget ?? null)?.focus" in implementation
assert "window.setTimeout(resolve, 50)" in test
assert "useFakeTimers" not in test
print("nested_raf_focus=True")
print("fixed_50ms_wait=True")
print("fake_timers_in_test=False")
PY
sed -n '2122,2131p' src/renderer/src/components/WorktreeJumpPalette.tsx
sed -n '500,518p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
rg -n -m 5 "expect\.poll\(" src/renderer/src --glob '*.test.ts' --glob '*.test.tsx'Repository: stablyai/orca
Length of output: 240
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- timer references in the test file ---'
rg -n -C 2 "useFakeTimers|useRealTimers|setTimeout|requestAnimationFrame" \
src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx || true
printf '%s\n' '--- focus scheduling implementation ---'
sed -n '2122,2132p' src/renderer/src/components/WorktreeJumpPalette.tsx
printf '%s\n' '--- target test ---'
sed -n '495,520p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
printf '%s\n' '--- repository expect.poll examples ---'
rg -n -m 5 "expect\.poll\(" src/renderer/src --glob '*.test.ts' --glob '*.test.tsx'Repository: stablyai/orca
Length of output: 3052
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- lifecycle hooks and first fake-timer test ---'
sed -n '200,285p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
printf '%s\n' '--- test boundaries around the target and later fake-timer test ---'
sed -n '430,585p' src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsx
printf '%s\n' '--- all timer lifecycle calls in this file ---'
rg -n -C 3 "beforeEach|afterEach|useFakeTimers|useRealTimers" \
src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsxRepository: stablyai/orca
Length of output: 10007
Poll for the focus target instead of sleeping for 50 ms. focusFallbackSurface uses two nested requestAnimationFrame callbacks, so the fixed delay can expire before focus is restored under CI load.
| const linearIssueUrlIntent = useMemo( | ||
| () => (isWorktreePaletteQueryTooLarge(query) ? null : parseLinearIssueUrlIntent(query)), | ||
| [query] | ||
| ) | ||
| const createWorktreeName = linearIssueUrlIntent ? query.trim() : deferredCreateWorktreeName | ||
| const showCreateAction = deferredShowCreateAction || linearIssueUrlIntent !== null | ||
| const prioritizeLinearCreateAction = linearIssueUrlIntent !== null | ||
|
|
||
| // Why: arm the lookup before Enter can target the newly rendered Linear row. | ||
| useLayoutEffect(() => { | ||
| const generation = ++linearIssueLookupGenerationRef.current | ||
| linearIssueLookupRef.current = null | ||
| if (!visible || !linearIssueUrlIntent) { | ||
| setLinearIssuePreview(null) | ||
| return | ||
| } | ||
|
|
||
| const state = useAppStore.getState() | ||
| const workspaceTarget = getComposerDefaultWorkspaceTarget(state) | ||
| const initialRepoId = workspaceTarget?.repoId ?? null | ||
| const sourceContext = workspaceTarget | ||
| ? buildTaskSourceContextFromRepo({ | ||
| provider: 'linear', | ||
| projectId: workspaceTarget.projectId, | ||
| repo: workspaceTarget.repo, | ||
| projectHostSetupId: workspaceTarget.projectHostSetupId | ||
| }) | ||
| : null | ||
| const pendingPreview: CmdJLinearIssuePreview = { | ||
| query: createWorktreeName, | ||
| issue: null, | ||
| loading: true, | ||
| initialRepoId, | ||
| sourceContext | ||
| } | ||
| setLinearIssuePreview(pendingPreview) | ||
|
|
||
| const promise = lookupLinearIssueUrl({ | ||
| intent: linearIssueUrlIntent, | ||
| knownStatus: state.linearStatus, | ||
| sourceContext, | ||
| fetchLinearIssue: state.fetchLinearIssue | ||
| }) | ||
| .catch(() => null) | ||
| .then( | ||
| (issue): CmdJLinearIssuePreview => ({ | ||
| ...pendingPreview, | ||
| issue, | ||
| loading: false | ||
| }) | ||
| ) | ||
| linearIssueLookupRef.current = { query: createWorktreeName, promise } | ||
| void promise.then((preview) => { | ||
| if (linearIssueLookupGenerationRef.current === generation) { | ||
| setLinearIssuePreview(preview) | ||
| } | ||
| }) | ||
|
|
||
| return () => { | ||
| if (linearIssueLookupGenerationRef.current === generation) { | ||
| linearIssueLookupGenerationRef.current += 1 | ||
| } | ||
| } | ||
| }, [createWorktreeName, linearIssueUrlIntent, visible]) |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift
Key the lookup effect on the parsed intent, not the raw query.
createWorktreeName is query.trim(), and linearIssueUrlIntent is a new object for every distinct query. Both are effect dependencies. Every keystroke inside an already-valid Linear URL therefore re-runs the effect, clears linearIssueLookupRef, and starts a new lookupLinearIssueUrl call. Editing the slug tail of a pasted URL issues one Linear provider request per character, and each request can also trigger a readLinearStatus refresh.
The parsed identifier and organization key are what the lookup actually depends on. Derive a stable key from them, use that key as the effect dependency, and store the key in the preview so the staleness comparisons at Line 1734, Line 2435, and Line 2437 stay meaningful.
♻️ Proposed direction
const createWorktreeName = linearIssueUrlIntent ? query.trim() : deferredCreateWorktreeName
const showCreateAction = deferredShowCreateAction || linearIssueUrlIntent !== null
const prioritizeLinearCreateAction = linearIssueUrlIntent !== null
+ // Why: the lookup only varies by identifier and organization, so slug edits must not refetch.
+ const linearIssueLookupKey = linearIssueUrlIntent
+ ? `${linearIssueUrlIntent.organizationUrlKey.toLowerCase()}/${linearIssueUrlIntent.identifier}`
+ : nullThen replace the createWorktreeName / linearIssueUrlIntent dependencies with linearIssueLookupKey, and record lookupKey: linearIssueLookupKey on CmdJLinearIssuePreview and on linearIssueLookupRef.current in place of the raw query.
| async function fetchMatchingLinearIssue( | ||
| intent: LinearIssueUrlIntent, | ||
| workspaceId: string, | ||
| sourceContext: TaskSourceContext | null, | ||
| fetchLinearIssue: FetchLinearIssue | ||
| ): Promise<LinearIssue | null> { | ||
| try { | ||
| const issue = await fetchLinearIssue(intent.identifier, workspaceId, { sourceContext }) | ||
| return issue && isLinearIssueUrlResolutionMatch(intent, issue) ? issue : null | ||
| } catch { | ||
| return null | ||
| } | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check whether the Linear renderer client and store action bound their IPC requests.
set -euo pipefail
fd -t f 'runtime-linear-client' --exec ast-grep outline {} --items all
fd -t f 'runtime-linear-client' --exec rg -n -C4 'timeout|Timeout|AbortController|withTimeout'
# fetchLinearIssue store action definition and any timeout wrapper around it.
ast-grep run --pattern 'fetchLinearIssue: async ($$$) => { $$$ }' --lang typescript src/renderer/src || true
rg -n -C6 --type=ts 'fetchLinearIssue\s*[:=]' src/renderer/src/storeRepository: stablyai/orca
Length of output: 18560
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- target files ---'
fd -t f 'linear-issue-url-lookup|WorktreeJumpPalette|runtime-linear-client|linear\.ts$' src/renderer/src src/main
printf '%s\n' '--- lookup and status symbols ---'
rg -n -C12 --type ts 'fetchMatchingLinearIssue|readLinearStatus|fetchLinearIssue|linearStatus|lookup\.promise|handleCreateWorktree' \
src/renderer/src/lib src/renderer/src/components src/renderer/src/runtime src/renderer/src/store
printf '%s\n' '--- Linear IPC registrations/handlers ---'
rg -n -C8 --type ts 'linear\.(status|getIssue)|linearStatus|linearGetIssue|ipcMain\.handle|handle.*Linear' src/main src/preload src/renderer/src
printf '%s\n' '--- timeout primitives ---'
rg -n -C4 --type ts 'callRuntimeRpc|timeoutMs|withTimeout|AbortController|Promise\.race' src/renderer/src/runtime src/renderer/src/lib src/renderer/src/store src/main | rg -i 'linear|runtime|timeout|abort|promise'Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- exact files ---'
fd -t f . src/renderer/src src/main src/preload | rg '/(linear-issue-url-lookup\.ts|WorktreeJumpPalette\.tsx|runtime-linear-client\.ts|linear\.ts)$'
printf '%s\n' '--- target symbol locations ---'
rg -n 'fetchMatchingLinearIssue|readLinearStatus|fetchLinearIssue|linearStatus|lookup\.promise|handleCreateWorktree' \
src/renderer/src/lib/linear-issue-url-lookup.ts \
src/renderer/src/components \
src/renderer/src/runtime/runtime-linear-client.ts \
src/renderer/src/store/slices/linear.ts
printf '%s\n' '--- focused source excerpts ---'
python3 - <<'PY'
from pathlib import Path
needles = (
'fetchMatchingLinearIssue', 'readLinearStatus', 'fetchLinearIssue',
'linearStatus', 'lookup.promise', 'handleCreateWorktree',
)
files = []
for root in ('src/renderer/src', 'src/main', 'src/preload'):
p = Path(root)
if p.exists():
files.extend(p.rglob('linear-issue-url-lookup.ts'))
files.extend(p.rglob('WorktreeJumpPalette.tsx'))
files.extend(p.rglob('runtime-linear-client.ts'))
files.extend(p.rglob('linear.ts'))
for path in sorted(set(files)):
lines = path.read_text(errors='replace').splitlines()
hits = [i for i, line in enumerate(lines) if any(n in line for n in needles)]
if not hits:
continue
ranges = []
for i in hits:
lo, hi = max(0, i-10), min(len(lines), i+20)
if not ranges or lo > ranges[-1][1]:
ranges.append([lo, hi])
else:
ranges[-1][1] = max(ranges[-1][1], hi)
print(f'--- {path} ---')
for lo, hi in ranges:
for i in range(lo, hi):
print(f'{i+1}:{lines[i]}')
print()
PY
printf '%s\n' '--- local Linear API and handler references ---'
rg -n -C5 'linear\.status|linear\.getIssue|linear\.searchIssues|linearStatus|linearGetIssue|linearSearchIssues' \
src/main src/preload src/renderer/src | head -n 400Repository: stablyai/orca
Length of output: 50370
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- fetchLinearIssue implementation ---'
sed -n '880,985p' src/renderer/src/store/slices/linear.ts
printf '%s\n' '--- handleCreateWorktree continuation ---'
sed -n '2407,2495p' src/renderer/src/components/WorktreeJumpPalette.tsx
printf '%s\n' '--- local Linear IPC module ---'
sed -n '1,260p' src/main/ipc/linear.ts
printf '%s\n' '--- local runtime Linear methods ---'
rg -n -C12 'async linearStatus|linearStatus\(|async linearGetIssue|linearGetIssue\(|linearSearchIssues|linear\.status|linear\.getIssue' \
src/main/runtime src/main/ipc src/preload | head -n 500
printf '%s\n' '--- API declarations and timeout-capable provider calls ---'
rg -n -C8 'linear:\s*\{|status:\s*\(|getIssue:\s*\(|searchIssues:\s*\(|timeoutMs|withTimeout' \
src/preload src/main/ipc src/main/providers src/main | rg -i 'linear|timeout|status|getIssue|searchIssues' | head -n 500Repository: stablyai/orca
Length of output: 50369
Bound local Linear lookups before opening the composer
The environment runtime path has a timeout, but local window.api.linear.status() and window.api.linear.getIssue() calls do not. A stalled local IPC call leaves Enter waiting indefinitely in handleCreateWorktree. Add a timeout around the issue and status lookups, and treat expiry as null so the name-only composer fallback opens.
Source: Learnings
Saved API-key Linear workspaces often omit organizationUrlKey, so pasted issue URLs never called fetchLinearIssue. Probe those unknown-org workspaces and accept only a matching issue URL. Keep "Use … as workspace name" visible in Smart Entry when a Linear URL owns the results. sourceIntent still focuses the issue row. Co-authored-by: Orca <[email protected]>
Cmd+J now treats GitHub, GitLab, Jira, and Linear issue/PR URLs as decisive search, so pasting one lists already-linked worktrees first and keeps a create preview underneath. GitHub/GitLab/Jira still hand the raw URL to the composer for cross-project detection. Co-authored-by: Orca <[email protected]>
Pasted GitHub issue/PR URLs now fetch the title for the create preview, same as Linear. Existing linked worktrees stay selected first so Enter jumps; create still hands the raw URL to the composer. Co-authored-by: Orca <[email protected]>
Pasting a GitHub issue/PR URL into Cmd+J already previewed the title, but Enter still opened the composer with the raw URL. Await the in-flight lookup and hand the linked work item through, matching Linear and Task page create. Also fix CI type, lint, and focus-routing source checks. Co-authored-by: Orca <[email protected]>
Unblock PR CI localization catalog checks and make the Linear lookup-miss e2e wait out the resolving state before advancing to the agent field. Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
src/renderer/src/lib/cmd-j-github-url-lookup.test.ts (1)
32-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the omitted-
hostbranch.The module spreads
hostconditionally so that a slug without a host does not sendhost: undefined. No test exercises that branch. Add a case withslug: { owner, repo }and assert the forwarded argument has nohostkey.♻️ Proposed addition
lookupGitHubWorkItemByOwnerRepoForSource.mockRejectedValue(new Error('offline')) expect( await lookupCmdJGitHubUrlWorkItem({ link, repo: { id: 'repo-1', path: '/repos/repo-1' }, sourceContext: null }) ).toBeNull() + + lookupGitHubWorkItemByOwnerRepoForSource.mockReset() + lookupGitHubWorkItemByOwnerRepoForSource.mockResolvedValue(item) + await lookupCmdJGitHubUrlWorkItem({ + link: { slug: { owner: 'stablyai', repo: 'orca' }, type: 'issue' as const, number: 14198 }, + repo: { id: 'repo-1', path: '/repos/repo-1' }, + sourceContext: null + }) + expect(lookupGitHubWorkItemByOwnerRepoForSource.mock.calls[0]?.[0]).not.toHaveProperty('host') })src/renderer/src/components/cmd-j/PaletteCreateWorktreeRow.tsx (1)
67-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate the two delayed-loading implementations.
This component now owns a 200 ms delay for the task-URL preview. The parent already owns an identical 200 ms delay for the Linear preview and passes the result down as
showLinearLoadingFeedback(WorktreeJumpPalette.tsx, Lines 1827-1842). The same debounce and the same constant now exist in two places for two branches of one row.Pick one owner. Moving the Linear delay into this component keeps the loading policy next to the markup that renders it and removes the
showLinearLoadingFeedbackprop.src/renderer/src/lib/worktree-palette-task-url-match.test.ts (1)
93-180: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd GitLab and Jira worktree-matching tests.
matchWorktreePaletteTaskUrlhas four provider branches. This suite covers GitHub and Linear only.worktreeMatchesGitLabUrlandworktreeMatchesJiraUrlare untested, and both contain normalization that a regression would break silently: GitLab lowercases host and path and discriminatesmrfromissueon the same number; Jira comparesjiraIdentifiercase-insensitively and then requiresoriginandsitePathto agree.These matchers place rows above the create action, so a false positive sends Enter to the wrong workspace. Mirror the GitHub type-collision case for GitLab.
💚 Proposed additions
+ it('matches a GitLab MR URL and does not match the same issue number', () => { + const intent = parseCmdJTaskSourceUrl('https://gitlab.com/acme/orca/-/merge_requests/17') + expect( + matchWorktreePaletteTaskUrl({ worktree: makeWorktree({ linkedGitLabMR: 17 }), intent: intent! }) + ).toMatchObject({ matchedField: 'pr', supportingText: { labelKind: 'mr' } }) + expect( + matchWorktreePaletteTaskUrl({ + worktree: makeWorktree({ linkedGitLabIssue: 17 }), + intent: intent! + }) + ).toBeNull() + }) + + it('matches a Jira URL by identifier and rejects another site', () => { + const intent = parseCmdJTaskSourceUrl('https://company.atlassian.net/browse/ORCA-123') + expect( + matchWorktreePaletteTaskUrl({ + worktree: makeWorktree({ + linkedWorkItem: { + provider: 'jira', + type: 'issue', + number: 123, + title: 'Fix', + url: 'https://company.atlassian.net/browse/ORCA-123', + jiraIdentifier: 'orca-123' + } + }), + intent: intent! + }) + ).toMatchObject({ supportingText: { text: 'ORCA-123' } }) + expect( + matchWorktreePaletteTaskUrl({ + worktree: makeWorktree({ + linkedWorkItem: { + provider: 'jira', + type: 'issue', + number: 123, + title: 'Fix', + url: 'https://other.atlassian.net/browse/ORCA-123' + } + }), + intent: intent! + }) + ).toBeNull() + })The lowercase
jiraIdentifierin the first case also probes whetherworktreeMatchesJiraUrlnormalizes both sides; it currently uppercases only the stored value.As per coding guidelines, "Source-control and review changes must support GitLab and other supported providers, keep provider-specific behavior behind explicit checks, and avoid GitHub-only generic terminology."
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0ba1051a-5a47-46fb-8712-72d59f0801ab
📒 Files selected for processing (13)
src/renderer/src/components/WorktreeJumpPalette.linear-url.test.tsxsrc/renderer/src/components/WorktreeJumpPalette.tsxsrc/renderer/src/components/cmd-j/PaletteCreateWorktreeRow.tsxsrc/renderer/src/components/cmd-j/palette-activation-focus-routing.test.tssrc/renderer/src/components/worktree-jump-palette-source-context-boundary.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/cmd-j-github-url-lookup.test.tssrc/renderer/src/lib/cmd-j-github-url-lookup.tssrc/renderer/src/lib/worktree-palette-search.test.tssrc/renderer/src/lib/worktree-palette-search.tssrc/renderer/src/lib/worktree-palette-task-url-match.test.tssrc/renderer/src/lib/worktree-palette-task-url-match.tstests/e2e/linear-url-workspace-entry.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/i18n/locales/en.json
- tests/e2e/linear-url-workspace-entry.spec.ts
| it('attaches a resolved GitHub URL entity and leaves GitLab/Jira as raw URLs', () => { | ||
| // Why: GitHub create reuses the Cmd+J preview (lookup lives in the effect, | ||
| // not Case 1). GitLab/Jira still hand the raw URL to the composer. | ||
| const githubLinkSection = sourceBetween( | ||
| '// Case 1: user pasted a GH issue/PR URL.', | ||
| '// Case 1: user pasted a GH/GitLab/Jira URL.', | ||
| '// Case 2: user typed a raw issue number.' | ||
| ) | ||
| expect(githubLinkSection).toContain('linkedWorkItem') | ||
| expect(githubLinkSection).toContain('initialGitHubWorkItem: item') |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the GitLab/Jira half that the title claims.
The test name states that GitLab and Jira stay raw URLs. Both assertions only cover the GitHub attachment. The GitLab/Jira guarantee is unverified, so a future change that attaches an entity for those providers would still pass.
Add an assertion that the GitLab/Jira branch passes only prefilledName.
💚 Proposed addition
expect(githubLinkSection).toContain('linkedWorkItem')
expect(githubLinkSection).toContain('initialGitHubWorkItem: item')
+ // Why: GitLab/Jira must reach the composer as a raw name, with no resolved entity attached.
+ const taskUrlSection = sourceBetween(
+ 'if (taskUrlCreatePreview) {',
+ '// Case 2: user typed a raw issue number.'
+ )
+ expect(taskUrlSection).toContain('prefilledName: trimmed')
+ expect(taskUrlSection).not.toContain('linkedWorkItem')| export function getCmdJTaskUrlCreatePreview( | ||
| intent: CmdJTaskSourceUrl | ||
| ): CmdJTaskUrlCreatePreview | null { | ||
| if (intent.provider === 'linear') { | ||
| return null | ||
| } | ||
| if (intent.provider === 'github') { | ||
| const { slug, number, type } = intent.link | ||
| const repo = `${slug.owner}/${slug.repo}` | ||
| const kindLabel = type === 'pr' ? 'GitHub pull request' : 'GitHub issue' | ||
| return { | ||
| provider: 'github', | ||
| identifier: `#${number}`, | ||
| subtitle: repo, | ||
| kindLabel, | ||
| createLabel: `Create worktree from ${kindLabel} ${repo}#${number}` | ||
| } | ||
| } | ||
| if (intent.provider === 'gitlab') { | ||
| const { slug, number, type } = intent.link | ||
| const project = `${slug.host}/${slug.path}` | ||
| const kindLabel = type === 'mr' ? 'GitLab merge request' : 'GitLab issue' | ||
| const identifier = type === 'mr' ? `!${number}` : `#${number}` | ||
| return { | ||
| provider: 'gitlab', | ||
| identifier, | ||
| subtitle: project, | ||
| kindLabel, | ||
| createLabel: `Create worktree from ${kindLabel} ${project}${identifier}` | ||
| } | ||
| } | ||
| return { | ||
| provider: 'jira', | ||
| identifier: intent.parsed.issueKey, | ||
| subtitle: intent.parsed.origin.replace(/^https?:\/\//, ''), | ||
| kindLabel: 'Jira issue', | ||
| createLabel: `Create worktree from Jira issue ${intent.parsed.issueKey}` | ||
| } | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Localize the preview labels.
getCmdJTaskUrlCreatePreview returns English-only kindLabel and createLabel. Both reach the UI unchanged. PaletteCreateWorktreeRow sets aria-label={previewLabel} from createLabel, and it interpolates kindLabel into the translated hint Create worktree from {{value0}}. A non-English user therefore sees a translated sentence with an English provider label inside it, and a fully English accessible label.
Return translation keys or provider tokens here, and resolve the display text in the row component with translate().
♻️ Proposed direction
export type CmdJTaskUrlCreatePreview = {
provider: 'github' | 'gitlab' | 'jira'
identifier: string
subtitle: string
- createLabel: string
- kindLabel: string
+ // Why: the row localizes these; keeping them as tokens stops English leaking into translated hints.
+ kind: 'github-issue' | 'github-pr' | 'gitlab-issue' | 'gitlab-mr' | 'jira-issue'
loading?: boolean
}Then derive kindLabel and createLabel inside PaletteCreateWorktreeRow with translate(), and apply the resolved-title suffix there as well.
* fix(workspaces): recognize pasted Linear issue URLs * fix(workspaces): resolve legacy Linear URLs and keep typed-name fallback Saved API-key Linear workspaces often omit organizationUrlKey, so pasted issue URLs never called fetchLinearIssue. Probe those unknown-org workspaces and accept only a matching issue URL. Keep "Use … as workspace name" visible in Smart Entry when a Linear URL owns the results. sourceIntent still focuses the issue row. Co-authored-by: Orca <[email protected]> * fix(workspaces): jump to existing worktrees from pasted task URLs Cmd+J now treats GitHub, GitLab, Jira, and Linear issue/PR URLs as decisive search, so pasting one lists already-linked worktrees first and keeps a create preview underneath. GitHub/GitLab/Jira still hand the raw URL to the composer for cross-project detection. Co-authored-by: Orca <[email protected]> * fix(workspaces): resolve GitHub issue titles in Cmd+J URL paste Pasted GitHub issue/PR URLs now fetch the title for the create preview, same as Linear. Existing linked worktrees stay selected first so Enter jumps; create still hands the raw URL to the composer. Co-authored-by: Orca <[email protected]> * fix(workspaces): attach resolved GitHub items from Cmd+J create Pasting a GitHub issue/PR URL into Cmd+J already previewed the title, but Enter still opened the composer with the raw URL. Await the in-flight lookup and hand the linked work item through, matching Linear and Task page create. Also fix CI type, lint, and focus-routing source checks. Co-authored-by: Orca <[email protected]> * fix(workspaces): add Cmd+J task-URL locale keys Unblock PR CI localization catalog checks and make the Linear lookup-miss e2e wait out the resolving state before advancing to the agent field. Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Orca <[email protected]>
ELI5
Pasting a Linear, GitHub, GitLab, or Jira issue/PR URL now does two things:
In Smart Entry, a pasted Linear URL still selects that issue automatically. You can still pick "use this as a workspace name" if you want the URL as text instead.
What Changed
linear.app/<org>/issue/<key>[/slug]URLs as decisive issue intent.organizationUrlKey. Accept the result only when the fetched issue URL is in the same org. This is whyhttps://linear.app/stably/issue/STA-4052/...failed against a "Saved Linear workspace".#14198 Agent terminals…) and still hand the raw URL to the composer so Cmd+N cross-project detection runs. GitLab/Jira stay parse-only.Why
A pasted issue/PR URL is unambiguous. Smart Entry previously armed the arbitrary-name row, and Cmd+J treated the URL as plain text — so GitHub issue/PR pastes did not preview, and existing linked worktrees were invisible because a full URL never matched
#14198orSTA-4052. This makes the obvious intent the default: jump if you already have that worktree, create if you don't.Follow-up on review: legacy API-key workspaces often have no stored org key, so lookup never called Linear. And exclusive Linear-only results hid the typed-name fallback.
Linked Issue
No linked issue — reported directly during this worktree task.
STA-4084is fixture/example data only.STA-4052was the URL used to reproduce the legacy-workspace miss. GitHub examples:https://github.com/stablyai/orca/issues/14198andhttps://github.com/stablyai/orca/pull/12789.Visual Proof
Smart Entry: exact issue selected after paste
Cmd+J: resolved Linear preview selected
Linked composer after Enter
GitHub/GitLab/Jira Cmd+J preview + existing-worktree selection is covered by focused Vitest (no new screenshots).
Testing
Validated on macOS:
AI Disclosure
Implemented with OpenAI Codex assistance and reviewed with parallel Codex agents. Follow-up fixes (legacy lookup + typed-name fallback, Cmd+J GitHub/existing-worktree matching) implemented with Claude Code.
Review
Reviewed for strict URL handling, stale async results, lookup failure recovery, cross-platform paste modifiers, remote/folder workspace ownership, query bounds, mixed-version Linear status data, and legacy workspaces that omit
organizationUrlKey. GitHub URL create still defers resolution to the composer. No dependencies or wire contracts changed.Checklist
N/Awith reasonAuthor