Repository navigation
Add 'Has Workspace' mode to show Linear issues linked to local worktrees - #12632
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (20)
📝 WalkthroughWalkthroughThe change adds the 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 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: 6
🧹 Nitpick comments (3)
src/renderer/src/lib/linear-issue-workspace-open.test.ts (1)
76-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd cases for the
startedandfailedbranches.The suite covers only the
openedoutcome. Two branches stay untested: the no-attachment path that must callstartWorkspaceand return'started', and the activation-failure path that must emit the toast and return'failed'. Both are cheap to add with the existing mocks.💚 Proposed additional tests
+ it('starts a new workspace when no linked workspace exists', () => { + const startWorkspace = vi.fn() + + expect(openLinearIssueWorkspaceOrStart({ identifier: 'ENG-1' }, startWorkspace)).toBe('started') + expect(startWorkspace).toHaveBeenCalledTimes(1) + }) + + it('reports failure when activation is refused', () => { + mocks.worktrees = [worktree()] + mocks.activateAndRevealWorktree.mockReturnValue(false) + + expect(openLinearIssueWorkspaceOrStart({ identifier: 'ENG-1' }, vi.fn())).toBe('failed') + })src/renderer/src/components/task-page-linear-in-orca-issues.ts (1)
77-117: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the scope key so it is computed once per candidate.
This block builds the same
workspaceId::orgKey::sourceScopestring in three places and callsgetTaskSourceCacheScopeinside two separate scans ofexisting. A small helper makes the dedupe rule readable and removes the repeated scope computation.♻️ Proposed helper extraction
+function refScopeKey(ref: LinkedLinearIssueRef): string { + const sourceScope = ref.sourceContext ? getTaskSourceCacheScope(ref.sourceContext) : '' + return `${ref.workspaceId ?? ''}::${ref.organizationUrlKey?.toLowerCase() ?? ''}::${sourceScope}` +}src/renderer/src/components/LinearIssueWorkspace.tsx (1)
530-535: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated attachment derivation into one hook. Both components subscribe to
allWorktreesandfolderWorkspaces, build the same merged list withfolderWorkspaceToWorktree, then deriveattachedWorkspaceandattachedWorkspaceLabelwith identical code. A shared hook next tolinear-issue-workspace-attachment.tskeeps the two surfaces from drifting.
src/renderer/src/components/LinearIssueWorkspace.tsx#L530-L535: replace the memo and the derivation at Lines 671-677 with the shared hook.src/renderer/src/components/LinearItemDrawer.tsx#L1253-L1258: replace the memo and the derivation at Lines 1382-1388 with the same hook.♻️ Proposed shared hook
// src/renderer/src/lib/use-linear-issue-workspace-attachment.ts export function useLinearIssueWorkspaceAttachment(issue: LinearIssueAttachmentRef | null): { attachedWorkspace: Worktree | null attachedWorkspaceLabel: string | null } { const allWorktrees = useAllWorktrees() const folderWorkspaces = useAppStore((s) => s.folderWorkspaces) const workspaces = useMemo( () => [...allWorktrees, ...folderWorkspaces.map(folderWorkspaceToWorktree)], [allWorktrees, folderWorkspaces] ) const attachedWorkspace = useMemo( () => (issue ? findLinearIssueWorkspaceAttachment(workspaces, issue) : null), [workspaces, issue] ) return { attachedWorkspace, attachedWorkspaceLabel: attachedWorkspace ? getLinearIssueWorkspaceAttachmentLabel(attachedWorkspace) : null } }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 303a036a-e1f1-400d-a96c-b61063019bf4
📥 Commits
Reviewing files that changed from the base of the PR and between 9507cbc and 3e2337e4a516a9f8f2b1e4f83f86a6a4669412d0.
📒 Files selected for processing (20)
src/main/runtime/rpc/methods/task-resume-state-schema.tssrc/renderer/src/components/LinearIssueWorkspace.tsxsrc/renderer/src/components/LinearItemDrawer.tsxsrc/renderer/src/components/TaskPage.tsxsrc/renderer/src/components/task-page-linear-in-orca-issues.test.tssrc/renderer/src/components/task-page-linear-in-orca-issues.tssrc/renderer/src/components/task-page-localized-options.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/github-work-item-workspace-attachment.tssrc/renderer/src/lib/linear-issue-workspace-attachment.test.tssrc/renderer/src/lib/linear-issue-workspace-attachment.tssrc/renderer/src/lib/linear-issue-workspace-open.test.tssrc/renderer/src/lib/linear-issue-workspace-open.tssrc/renderer/src/lib/worktree-attachment-label.tssrc/renderer/src/store/slices/ui.tssrc/shared/types.ts
|
@coderabbitai Fixing. Will be in the next commit |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/lib/linear-issue-workspace-open.test.ts (1)
112-119: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert that activation was attempted.
This test configures
activateAndRevealWorktreeto returnfalsebut never verifies that the function called it. Add a call assertion so the test fails if the implementation returnsfailedwithout attempting activation.Suggested assertion
expect(openLinearIssueWorkspaceOrStart({ identifier: 'ENG-1' }, startWorkspace)).toBe('failed') + expect(mocks.activateAndRevealWorktree).toHaveBeenCalledTimes(1) expect(startWorkspace).not.toHaveBeenCalled()
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fd0afda6-72be-4208-96c8-8838fc0323ac
📥 Commits
Reviewing files that changed from the base of the PR and between 3e2337e4a516a9f8f2b1e4f83f86a6a4669412d0 and 459c33095fe3527ae99db1e9dd4c543b923a8504.
📒 Files selected for processing (7)
src/renderer/src/components/LinearIssueWorkspace.tsxsrc/renderer/src/components/TaskPage.tsxsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/linear-issue-workspace-open.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/components/LinearIssueWorkspace.tsx
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/components/TaskPage.tsx
Enable users to view and open existing workspaces attached to Linear issues instead of accidentally starting duplicates. Includes shared worktree attachment labeling for consistent UX across GitHub and Linear surfaces.
- Apply search filter in 'in-orca' mode even without active context label to prevent team filters from silently hiding linked tickets (no "Fetch more" recovery path) - Add aria-label to workspace-open button for accessibility - Update tooltip from "local worktree" to "Orca workspace" - Reorganize i18n: move workspace.open from lib.linear to components.issue - Expand test coverage for workspace start and activation scenarios
459c330 to
c5083eb
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
React Doctor fails static analysis when refs are written during render. Keep the latest linked refs in an effect so the in-orca loader can still read them without re-running on identity-only worktree churn.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
…ees (stablyai#12632) * feat(linear): add 'Has Workspace' mode to show issues linked to local wo Enable users to view and open existing workspaces attached to Linear issues instead of accidentally starting duplicates. Includes shared worktree attachment labeling for consistent UX across GitHub and Linear surfaces. * fix(linear): apply search filter in 'in-orca' mode to prevent drops - Apply search filter in 'in-orca' mode even without active context label to prevent team filters from silently hiding linked tickets (no "Fetch more" recovery path) - Add aria-label to workspace-open button for accessibility - Update tooltip from "local worktree" to "Orca workspace" - Reorganize i18n: move workspace.open from lib.linear to components.issue - Expand test coverage for workspace start and activation scenarios * fix(linear): avoid mutating in-orca linked refs during render React Doctor fails static analysis when refs are written during render. Keep the latest linked refs in an effect so the in-orca loader can still read them without re-running on identity-only worktree churn.
Summary
Introduces a new Linear task view mode—'Has Workspace'—that displays only Linear issues already linked to local Orca worktrees or folder workspaces. Users can quickly open an attached workspace from the issue drawer or task list, or start a new one with a fallback option.
Changes
Core Feature
linearMode: 'in-orca'view that collects linked Linear identifiers from all worktrees and fetches their current issue statelinkedLinearIssueWorkspaceIdand inferred workspace scope from provider contextUI & UX
→(start) to📁(open) when workspace is attached; shows workspace name inlineLocalization
Added ~12 translation keys per language (en, es, ja, ko, zh) for the new mode, button labels, empty states, and error messages.
Implementation Details
task-page-linear-in-orca-issues.ts: Collects refs from worktrees with dedup, filters, and concurrent read pooling (6 concurrent fetches by default)linear-issue-workspace-attachment.ts: Finds and indexes workspace attachments; handles scope matching (workspace ID, org URL key, provider context)linear-issue-workspace-open.ts: Opens attached workspace viaactivateAndRevealWorktree/activateAndRevealFolderWorkspace, or calls fallback to start a new oneworktree-attachment-label.ts: Shared label generation (display name → branch name → path tail) for consistent labeling across GitHub, Linear, and future work-item surfacesTesting
Verification
useAllWorktrees) and activation utilities