Skip to content

feat(worktree): let Jira-linked workspace names keep the uppercase issue key - #28557

Closed
chucoding wants to merge 1 commit into
stablyai:mainfrom
chucoding:feat/jira-key-casing-18183
Closed

chucoding wants to merge 1 commit into
stablyai:mainfrom
chucoding:feat/jira-key-casing-18183

Conversation

@chucoding

Copy link
Copy Markdown
Contributor

ELI5

When you start a workspace from a Jira issue, Orca names the folder and branch like proj-123-android-feature — it lowercases the Jira key too. Teams whose convention is the real key (PROJ-123-android-feature) had to rename every branch by hand. This adds a setting so they don't have to; the default stays exactly as today.

What Changed

  • New setting — Settings → Git → Jira Key Casing: Lowercase (default, current behavior) or Uppercase key.
  • Before (and still the default): a Jira-linked workspace for PROJ-123 Android login feature is suggested and created as proj-123-android-login-feature (directory and branch).
  • After, with Uppercase key: the same workspace is suggested and created as PROJ-123-android-login-feature. "Copy suggested branch name" follows the same setting.
  • Mechanism: names are still built by slugifyForWorkspaceName (which lowercases everything). A new applyJiraIssueKeyCasing step then restores the canonical uppercase key only at the start of the generated seed, and only when the item has a valid Jira key ([A-Z][A-Z0-9_]*-\d+, so any project key works — no allowlist). That one seed feeds the directory and the branch, so they cannot drift apart.
  • The policy is threaded into every place a Jira seed is produced or compared: the Jira task page, the composer's Jira pick, the composer's "is this name still Orca-generated?" check, and the submit path that recomputes the seed (otherwise an auto-managed PROJ-123-… would silently revert to lowercase on create).
  • Not changed: names the user types, existing workspaces/branches, and GitHub / GitLab / Linear naming.

Why

Renaming a branch after creation doesn't fix the worktree directory, which is already created with the lowercase name, and a repo-level AI prompt can't control deterministic naming — so the choice has to happen when the seed is generated.

Re-uppercasing after slugify (instead of teaching slugify about casing) keeps one shared slug rule for every provider and limits the change to the Jira key itself; the key's characters always survive the slug's strip, so restoring the case is lossless.

Scope note: #18183 also asks for an uppercase Jira-key prefix on GitHub PR / GitLab MR titles (including AI-generated titles). That lives in a different subsystem (review creation), so I kept it out of this PR to keep it small; happy to follow up separately.

Linked Issue

Fixes #18183

Visual Proof

Settings → Git

Before (default: Lowercase) After (Uppercase key)

New workspace composer for a Jira issue PROJ-123 Android login feature

Before (default: Lowercase) After (Uppercase key)

Created workspace with Uppercase key (branch and directory are both PROJ-123-android-login-feature)

Testing

  • Unit: src/shared/workspace-name.test.ts (both policies, ALT-42 / TEAM_ALPHA9-7 key shapes, non-leading / prefix-collision keys, non-Jira items untouched), jira-issue-workspace-actions.test.ts (Copy suggested branch name), useComposerState-host-context-boundaries.test.ts (auto-managed name detection), composer-name-ownership.test.ts (submit keeps the uppercase key; verified it fails without the fix).

  • Related suites: 415 files / 2830 tests pass; pnpm tc passes; check:code-quality:changed passes (0 findings, incl. design system); localization catalog/extraction/coverage checks pass.

  • E2E (macOS, headless Electron via Playwright, throwaway spec not committed): with Uppercase key, creating a workspace from a Jira-linked composer produced git branch → PROJ-123-android-login-feature and worktree directory …/PROJ-123-android-login-feature; with the default it produced the lowercase name.

  • Platforms: macOS only. Linux / Windows / SSH not run; the change is a pure string transform in shared code plus a renderer setting, and the main-process sanitizer already preserves case.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Implemented with Claude Code (Claude Opus 5.5); I reviewed the diff and the test/E2E results.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Backwards compatibility / mixed versions: jiraIssueKeyCasing is a new settings field defaulting to lowercase; a missing or unknown value is treated as lowercase, so older clients and stores keep current behavior.
  • Case-insensitive filesystems (macOS/Windows): if a lowercase proj-123-x worktree already exists, creating PROJ-123-x after switching the policy collides only by case. This PR doesn't change collision handling (related: [Bug]: worktree create uses the GitHub login verbatim as a branch prefix, colliding with the lowercase namespace on case-insensitive filesystems #15857).
  • Translations: only English strings were added; other locales fall back to English until the next translation pass.
  • Security / performance: no new inputs reach git beyond the existing sanitizer; the key is validated against the Jira key pattern before re-casing.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

…sue key

Orca lowercases the whole generated name for Jira-linked workspaces, so teams whose branch convention requires the canonical key (PROJ-123-...) rename every branch by hand, and renaming later cannot fix the already-created worktree directory. A Jira Key Casing setting (default: lowercase, unchanged) now restores the canonical key at the start of the generated seed, which feeds both the directory and the branch, and the same policy applies to "Copy suggested branch name". The key is re-uppercased after slugify rather than changing slugify itself, so non-Jira providers and user-typed names keep their current behavior.

Refs stablyai#18183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 274ef4d4-dbde-42f3-a45b-58a2973ef9b0
📥 Commits

Reviewing files that changed from the base of the PR and between 04b4e96 and 6cbb121.

📒 Files selected for processing: 19
  • src/renderer/src/components/jira-issue-workspace-actions.test.ts
  • src/renderer/src/components/jira-issue-workspace-actions.ts
  • src/renderer/src/components/settings/GitPane.tsx
  • src/renderer/src/components/settings/JiraIssueKeyCasingSetting.tsx
  • src/renderer/src/components/settings/git-search.ts
  • src/renderer/src/components/task-page-source-context.tsx
  • src/renderer/src/hooks/composer-state/async-composer-state.ts
  • src/renderer/src/hooks/composer-state/composer-decisions.ts
  • src/renderer/src/hooks/composer-state/composer-name-ownership.test.ts
  • src/renderer/src/hooks/composer-state/issue-source-actions.ts
  • src/renderer/src/hooks/composer-state/quick-submit-source-preparation.ts
  • src/renderer/src/hooks/useComposerState-host-context-boundaries.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/lib/jira-issue-key-casing.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/ui-chrome-types.ts
  • src/shared/workspace-name.test.ts
  • src/shared/workspace-name.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The change adds a global setting for Jira issue-key casing, with lowercase as the default and an option to preserve uppercase keys. Workspace-name generation and suggested Jira branch names receive the selected setting. Existing names and user-entered names are not rewritten. Tests cover casing behavior and auto-managed workspace-name decisions.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 6cbb1

This adds an opt-in Jira key casing setting with lowercase as the default, so existing behavior is unchanged. No merge-blocking risk was found in the supplied changes.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning The PR implements the workspace and branch naming requirements in #18183. It adds Lowercase and Uppercase key policies, keeps lowercase as the default, supports arbitrary Jira key shapes, applies the … Implement the #18183 review-title requirement in the GitHub PR and GitLab MR creation flows. Add the canonical uppercase Jira key prefix for new, AI-generated, and regenerated titles, while preserving manually edited titles and applying the…
Docstring Coverage Warning Docstring coverage is 8.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 18 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: preserving uppercase Jira keys in Jira-linked workspace names. It is concise and specific.
Description check Passed The description is mostly complete. It includes the required explanation, change details, rationale, linked issue, testing information, scope limitations, compatibility notes, and checklist. Visual pr…
Out of Scope Changes check Passed The changed files support the Jira key casing setting, generated Jira-linked workspace and branch names, suggested branch copying, composer name ownership and submit behavior, localization, and focuse…
Full details: Linked Issues check

Explanation

The PR implements the workspace and branch naming requirements in #18183. It adds Lowercase and Uppercase key policies, keeps lowercase as the default, supports arbitrary Jira key shapes, applies the policy to suggested branch copying and composer submit/name detection, and uses one seed for the directory and branch. However, #18183 also requires the canonical uppercase Jira key as the exact prefix for GitHub PR and GitLab MR titles, including AI-generated or regenerated titles and existing lowercase Jira branches. The PR description states that this behavior is omitted, and the listed changes contain no review-title implementation or tests.

Resolution

Implement the #18183 review-title requirement in the GitHub PR and GitLab MR creation flows. Add the canonical uppercase Jira key prefix for new, AI-generated, and regenerated titles, while preserving manually edited titles and applying the prefix for existing lowercase Jira branches. Add automated tests for these cases.

Full details: Docstring Coverage

Explanation

Docstring coverage is 8.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 18 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@alvaromr

Copy link
Copy Markdown

Could this setting offer a third option, Key only, that names the branch and worktree just PROJ-123 (uppercase, no title slug)? Some teams name branches strictly by issue key; it fits the same applyJiraIssueKeyCasing step.

@nwparker

nwparker commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — the linked issue (#18183) has been resolved on main by #28596 (d194712952). Thanks for the contribution!

@nwparker nwparker closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Choose Jira issue-key formatting for generated branches

3 participants