Skip to content

feat(source-control): make group order configurable - #2188

Merged
brennanb2025 merged 12 commits into
stablyai:mainfrom
leynier:staged-changes-first
Jun 20, 2026
Merged

brennanb2025 merged 12 commits into
stablyai:mainfrom
leynier:staged-changes-first

Conversation

@leynier

@leynier leynier commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds a Git setting for Source Control group order: Changes first, Staged first, or Untracked first.
  • Keeps conflicts pinned above normal groups while preserving existing git row actions.
  • Routes the pinned Conflicts section to conflict review and gives conflict tree folders distinct collapse keys.

Closes #2178

Testing

  • git diff --check
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/right-sidebar/source-control-section-order.test.ts src/renderer/src/components/right-sidebar/source-control-tree.test.ts src/renderer/src/components/right-sidebar/useSourceControlSelection.test.ts src/renderer/src/components/settings/GitPane.test.tsx src/shared/constants.test.ts
  • pnpm typecheck
    • Passed. Existing engine warning: repo wants Node 24; this shell is Node v26.0.0.

AI Review Report

Reviewed the diff against AGENTS.md, .github/CONTRIBUTING.md, and docs/STYLEGUIDE.md.

Main risks checked:

  • Conflict visibility: conflicts stay pinned above the configured group order.
  • Conflict review flow: the pinned Conflicts section opens conflict review instead of the normal Changes combined diff.
  • Tree collapse behavior: conflict tree directory keys use a distinct namespace so they do not share collapse state with Changes.
  • SSH behavior: ordering is renderer-side over existing git status entries and does not add local-only assumptions.
  • Design-system compliance: the Git setting uses the existing segmented-button style and token classes already used in Git settings.

Security Audit

  • No new IPC channels were added.
  • No new shell command construction was added.
  • No filesystem, network, auth, or secret access was expanded.
  • The setting only changes renderer-side ordering of already-loaded Source Control entries.

Risk: medium

Historic risk metadata backfill based on the existing risk:medium label.

# Conflicts:
#	src/renderer/src/components/right-sidebar/SourceControl.tsx
@AmethystLiang
AmethystLiang requested review from AmethystLiang and removed request for brennanb2025 May 23, 2026 05:40
leynier and others added 4 commits May 28, 2026 19:23
# Conflicts:
#	src/renderer/src/components/settings/GitPane.tsx
- add testable routing for conflict section review actions

- cover group-order setting updates and persistence reloads
@nwparker

Copy link
Copy Markdown
Contributor

Thanks again! Made a few review tweaks but otherwise looks good:

  • moved the Conflicts section Review all decision into source-control-section-order so it is covered as behavior, not only JSX
  • added tests for conflict pinning ahead of configured order, conflict review routing, resolved-local-only conflicts, settings clicks, and persistence reload
  • merged forward to current main and pushed with a lease after confirming leynier/staged-changes-first was still at a112b38
  • checked focused vitest, typecheck, lint, git diff --check, and merge-tree; Electron dev proof showed Staged Changes above Changes with sourceControlGroupOrder=staged-first

GitHub is reporting the branch mergeable, but no checks are present in the check rollup yet.

# Conflicts:
#	src/renderer/src/components/right-sidebar/SourceControl.tsx
#	src/renderer/src/components/settings/GitPane.tsx
@brennanb2025

Copy link
Copy Markdown
Contributor

Really sorry about the delay here, I'll take a look at this tomorrow. Appreciate the patience!

# Conflicts:
#	src/main/persistence.test.ts
#	src/renderer/src/components/editor/RichMarkdownEditor.tsx
#	src/renderer/src/components/right-sidebar/SourceControl.tsx
#	src/shared/constants.ts
@leynier

leynier commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Really sorry about the delay here, I'll take a look at this tomorrow. Appreciate the patience!

Dont worry

leynier and others added 2 commits June 9, 2026 17:50
# Conflicts:
#	src/renderer/src/components/right-sidebar/SourceControl.tsx
#	src/renderer/src/components/settings/GitPane.tsx
#	src/renderer/src/components/settings/git-search.ts
#	src/shared/constants.test.ts
Resolve conflicts and keep the source-control group-order patch scoped.
@ghost

ghost commented Jun 20, 2026 •

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0f9a195e-7db3-4089-8caf-6d5b4f406015

📥 Commits

Reviewing files that changed from the base of the PR and between 61553ab and 253dfee.

📒 Files selected for processing (2)
  • src/renderer/src/components/right-sidebar/SourceControl.tsx
  • src/renderer/src/components/settings/GitPane.test.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/components/settings/GitPane.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/right-sidebar/SourceControl.tsx

📝 Walkthrough

Walkthrough

This PR introduces a sourceControlGroupOrder user preference (changes-first, staged-first, untracked-first) to GlobalSettings. A new normalizeSourceControlGroupOrder utility validates and coerces the value, and persistence.ts normalizes it on load and in updateSettings. A new source-control-section-order.ts module computes ordered display sections, pins unresolved and locally-resolved conflicts into a dedicated conflicts section, and selects per-section view actions (conflict-review or combined-diff). Two new tree helpers (namespaceSourceControlTreeDirectoryKeys, applyGitStatusEntryAreasToSourceControlTree) support conflict tree key namespacing. SourceControl.tsx is refactored from an area-indexed to a section-id-driven render pipeline using these utilities. openAllDiffs gains an optional entriesSnapshot parameter. A SourceControlGroupOrderSetting segmented control is added to the Git settings pane with search metadata and localized strings across five locales.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description covers the main feature and testing checklist, but is missing Screenshots and AI Review Report sections that are required by the template. Add Screenshots section (or state 'No visual change') and provide detailed AI Review Report with cross-platform compatibility checks as specified in the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat(source-control): make group order configurable' accurately describes the main feature: making Source Control group order user-configurable.
Linked Issues check ✅ Passed All coding requirements from issue #2178 are met: configurable group order with three options (Changes/Staged/Untracked first), default preserved as Changes-first, conflicts pinned above configured order, and conflict review routing implemented with distinct collapse keys.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the configurable Source Control group order feature. Localization strings, UI components, settings persistence, and section ordering logic all support the main objective without introducing unrelated functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/renderer/src/components/right-sidebar/SourceControl.tsx (1)

1527-1530: ⚡ Quick win

Document why conflict directory keys are namespaced.

This conflict-specific branch encodes a non-obvious collapse-state isolation rule; add a short “Why” comment so it is not removed during future tree refactors.

📝 Proposed comment
       roots[section.id] =
         section.id === 'conflicts'
           ? applyGitStatusEntryAreasToSourceControlTree(
+              // Why: conflict sections can mirror normal directory paths; keep
+              // their collapse keys isolated from the original area sections.
               namespaceSourceControlTreeDirectoryKeys(sectionRoots, 'conflicts')
             )
           : sectionRoots

As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7d01bf03-6f1f-42a5-83e8-3dd2bc13de6e

📥 Commits

Reviewing files that changed from the base of the PR and between 8ef8596 and 61553ab.

📒 Files selected for processing (24)
  • src/main/codex-accounts/runtime-home-service.test.ts
  • src/main/codex-accounts/service.test.ts
  • src/main/persistence.test.ts
  • src/main/persistence.ts
  • src/renderer/src/components/right-sidebar/SourceControl.tsx
  • src/renderer/src/components/right-sidebar/source-control-section-order.test.ts
  • src/renderer/src/components/right-sidebar/source-control-section-order.ts
  • src/renderer/src/components/right-sidebar/source-control-tree.test.ts
  • src/renderer/src/components/right-sidebar/source-control-tree.ts
  • src/renderer/src/components/settings/GitPane.test.ts
  • src/renderer/src/components/settings/GitPane.tsx
  • src/renderer/src/components/settings/git-search.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/store/slices/editor.test.ts
  • src/renderer/src/store/slices/editor.ts
  • src/shared/constants.test.ts
  • src/shared/constants.ts
  • src/shared/source-control-group-order.test.ts
  • src/shared/source-control-group-order.ts
  • src/shared/types.ts

Comment thread src/renderer/src/i18n/locales/es.json Resolved
Resolve conflicts and keep the source-control group-order patch scoped.
@brennanb2025
brennanb2025 merged commit 067c88f into stablyai:main Jun 20, 2026
1 check passed
@brennanb2025

Copy link
Copy Markdown
Contributor

@leynier sorry for the delay here, appreciate the patience and the PR!

@leynier

leynier commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

@leynier sorry for the delay here, appreciate the patience and the PR!

Don't worry, and thank you for your work on Orca. It's awesome!

@leynier
leynier deleted the staged-changes-first branch July 15, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium Medium risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Make Source Control group order configurable

3 participants