Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

fix(workspace-name): carry the linked GitHub issue/PR number into derived names - #88

Merged
64ix merged 1 commit into
mainfrom
64ix/issue-83-workspace-name-issue-number
Aug 26, 2026
Merged

64ix merged 1 commit into
mainfrom
64ix/issue-83-workspace-name-issue-number

Conversation

@64ix

@64ix 64ix commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

getLinkedWorkItemWorkspaceName derived workspace display/seed names from the linked work item's title only. Linear/Jira items already led with their identifier (ENG-42 Ship parity), but GitHub/GitLab issues and PRs have no such identifier — and the title-strip logic (getLinkedWorkItemTitleSubject) actively removes any #<n> from the title — so the number never made it into the sidebar/board name or the derived branch/folder seed.

This change leads the display name with workItemIdentity(item) (Issue 42, PR 12, MR 7) for items without a Linear/Jira identifier, mirroring the identifier-leading convention already used elsewhere in this file (getWorkspaceIntentName). Before prepending it, a bare #<n>/<n> token matching the item's own number is stripped from the subject so a title that already mentions the number isn't doubled.

Closes #83

Acceptance Criteria

Criterion Verdict Evidence
Workspace from a linked GitHub issue shows its number in the display name and derived seed ✅ getLinkedWorkItemWorkspaceName({ type: 'issue', number: 42, title: 'Spec - Clore et celebrer' }) → { displayName: 'Issue 42 Spec - Clore et celebrer', seedName: 'issue-42-spec-clore-et-celebrer' } (test in src/shared/workspace-name.test.ts)
Same for linked PRs ✅ getLinkedWorkItemWorkspaceName({ type: 'pr', number: 2049, title: '...' }) → displayName: 'PR 2049 ...'; GitLab MR case also covered (MR 77 ...)
Linear/Jira-derived names unchanged ✅ Existing jira test kept byte-identical (PROJ-7 Fix flaky import); added a Linear identifier test (ENG-42 Ship Linear parity) proving the identifier branch is untouched
Titles already containing "#42" don't get doubled ✅ getLinkedWorkItemWorkspaceName({ type: 'issue', number: 42, title: 'Fix #42 regression' }) → displayName: 'Issue 42 Fix regression' (not Issue 42 Fix #42 regression)

QA Plan

  • ./node_modules/.bin/vitest run --config config/vitest.config.ts src/shared/workspace-name.test.ts passes (24/24)
  • ./node_modules/.bin/vitest run --config config/vitest.config.ts src/renderer/src/lib/smart-github-submit.test.ts passes — smart GitHub submit resolution now surfaces PR 2049 ... / Issue 2050 ... style names
  • ./node_modules/.bin/vitest run --config config/vitest.config.ts src/renderer/src/hooks/useComposerState-host-context-boundaries.test.ts passes — auto-managed-name detection matches the new seed format
  • In the app, link a GitHub issue with no Linear/Jira tracker (e.g. via Cmd+J or Task page "Create workspace") and confirm the prefilled name/branch reads issue-<n>-... and the sidebar/board card shows Issue <n> — ...
  • Same check for a linked GitHub PR (pr-<n>-... / PR <n> — ...)
  • Link a Linear or Jira issue and confirm the name is unchanged from current main (e.g. eng-42-...)

Notes

  • Problem -> Resolution: The upstream getLinkedWorkItemTitleSubject regex only strips #<n> when it's glued to a preceding word char (\b#\d+\b never matches a boundary on the # side when preceded by whitespace), so a title like "Fix #42 regression" survives that strip untouched. Rather than touch that shared, non-surgical regex, getLinkedWorkItemWorkspaceName now does its own targeted strip of a bare #<item.number>/<item.number> token — consistent with the existing per-number stripping already done in compactWorkItemTitle in the same file — before prepending the identity. This keeps the upstream title-strip regex untouched (upstreamable) while still satisfying the "no doubling" acceptance criterion.
  • Kept the change scoped to getLinkedWorkItemWorkspaceName (the function multiple consumers — TaskPage, useComposerState, WorktreeJumpPalette, smart-github-submit, workspace-source — funnel through); getLinkedWorkItemSuggestedName (title-only, no number available) and mobile/src/tasks/mobile-workspace-name.ts (separate mobile-only slugger) were left untouched as out of scope.
  • Updated three pre-existing test expectations (smart-github-submit.test.ts x2 in one describe block context, useComposerState-host-context-boundaries.test.ts) that had asserted the old (numberless) GitHub name shape — this is the intended behavior change the issue asks for, not a regression.

…ived names

getLinkedWorkItemWorkspaceName previously dropped the work-item number for
GitHub/GitLab items (no Linear/Jira identifier), so a workspace created from
a linked issue/PR had no number in its sidebar/board name or seeded
folder/branch slug. Lead the name with workItemIdentity() (e.g. "Issue 42")
the same way Linear/Jira identifiers already lead, and strip a bare
matching #<n>/<n> token from the subject first so a title that already
mentions the number isn't doubled.

Closes #83
@64ix
64ix merged commit ace1101 into main Aug 26, 2026
0 of 2 checks passed
64ix added a commit that referenced this pull request Aug 27, 2026
#88 made getWorkspaceSourceName carry the linked issue/PR number into the
derived name, and #92 updated the desktop expectations but missed mobile — these
five assertions have been red on main ever since. Mobile's resolveWorkItemAutoName
is a thin delegate to that same shared function, and desktop now expects exactly
this shape ('Issue 42 …', 'PR 91 …'), so the behaviour is intended and only the
expectations were stale.

Refs #71
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include the linked GitHub issue/PR number in derived workspace names

1 participant