Skip to content

feat(explorer): scope file trees to sparse checkout directories - #18750

Merged
nwparker merged 18 commits into
stablyai:mainfrom
blaksmatic:feat/sparse-explorer-root
Sep 29, 2026
Merged

nwparker merged 18 commits into
stablyai:mainfrom
blaksmatic:feat/sparse-explorer-root

Conversation

@blaksmatic

@blaksmatic blaksmatic commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Sparse workspaces open the explorer at a useful starting folder while keeping the repository reachable. Presets are edited inline, with room for directory paths and recoverable errors.

What Changed

  • One eligible sparse directory becomes the default explorer view; multiple directories start at the repository root. Saved choices and migrations are preserved.
  • Compact breadcrumb navigation replaces the full-width explorer selector. The repository icon returns to root, the current path opens a folder menu, and an inline Back arrow restores the previous folder after an outside-file reveal.
  • Names filters the displayed folder; Contents searches checked-out workspace files across folders. Optional scope guidance explains that omitted files are not searched.
  • Composer and repository settings share an inline preset editor and validation. Directories is a combobox that browses the repository's real folders and also accepts free-form paths; chosen folders appear as removable chips beneath it. Only Save/Cancel show during editing; project changes and Advanced collapse are disabled. Errors retain the draft, settings edits stay in their row, and failed preset loading offers Retry.
  • The preset chooser searches names and directories, labels the default “Full checkout,” and meets its trigger without a gap. Only results scroll, keeping search and New preset visible in long lists.
  • Added localized copy in all six languages and regression coverage for navigation, keyboard selection, validation, loading, saving, and scrolling.

Why

The old popover constrained editing, and separate settings validation could drift. A shared inline editor gives paths enough room while keeping the current workflow visible. Breadcrumb navigation reduces explorer chrome, and retaining the repository hierarchy for multiple folders preserves root files and clear create/drop destinations.

Linked Issue

Fixes #19227. Incorporates validation feedback from #19205 (mors119). Related: #254, #1131, #1290, #1316, #9921, #9922, #10537, #10547, #4174, #17859, #18050, #17932, #15866, #18352, #18389, #3443, #3446, #3572, #7564, #9139.

Visual Proof

Final UI screenshots only, captured from hidden Electron renderers on macOS. The breadcrumb detail is cropped; the remaining captures show the actual app window.

Explorer breadcrumb and return navigation

Compact breadcrumb with inline Back

Inline preset editing

Inline preset editor with six directories as chips

Final narrow layouts, preset search, scrolling, settings, and content search

220px explorer sidebar

Breadcrumb at the minimum sidebar width

800 × 640 dark editor

Dark editor with reachable Save and Cancel

Preset search by directory

Searchable preset chooser attached to its trigger

25 presets: results scroll while search and New remain visible

Long preset list after scrolling

Settings edit in place

Settings preset editing with sibling actions disabled

Content search across both selected folders

Content results from both checked-out folders

Testing

  • Inspected rendered app screenshots on macOS; launches used ORCA_BACKGROUND_LAUNCH=1.
  • Automated regression tests added/updated.
  • 60 focused tests passed during the inline/editor review; 15 chooser/popover tests passed after the scrolling fix; 5 scope tests passed after the breadcrumb update (overlapping runs).
  • Hidden Electron proof passed for real Git sparse checkout, one/multiple folder defaults, root/menu/Back navigation, cross-folder content results, and omitted-file exclusion.
  • Preset proof passed for inline editing, pristine/invalid/duplicate input, retained save errors and retry, delayed saving, Escape/focus behavior, keyboard selection, edge alignment, and long-list wheel scrolling/filtering. Re-run end to end against the combobox field after the directory-entry rewrite.
  • Renderer typecheck/build and changed-code/design-system checks passed. The HTML report passed image, enlargement, issue-filtering, and mobile-width checks.

Explorer proof uses real temporary Git checkouts with seeded directory metadata for deterministic navigation. Save-failure and delayed-save cases are injected; the 25-preset case seeds additional renderer-store entries.

Not exercised: Linux, Windows, live SSH disconnect/reconnect, native drops, or mixed-version remote clients. Full repository test/lint suites were not run.

Review

Preserved absolute file identities, repository-relative Git paths, async mount/focus guards, host routing, and sparse-detection performance fixes. These UI changes introduce no Git polling, remote wire fields, or existing-checkout mutations.

Agent skill upstream boundary

  • Not applicable; no skill-installer code changed.

Notes

The research report indexes 282 unique matches from fully paginated repository searches for “sparse” and “sparse-checkout,” including unrelated uses, and records feedback dispositions.

Remaining separate work: editing paths in an existing checkout, a flattened multi-root view, persisted disconnected-SSH sparse attribution, and exact-name search issue #22628.

Checklist

  • Explained user-facing changes, mechanism, and design choice.
  • Final rendered screenshots attached.
  • Self-reviewed and considered platform/SSH/path impact.
  • Focused typecheck, tests, build, and changed-code gates passed; broader platform coverage remains with CI.

Directory entry: browse the repository, or type any path · d059fa4a84da

The newline textarea is replaced by the picker itself. Opening Add a folder browses the repository over the existing fs.readDir IPC, so it works for local, WSL, and SSH-backed repos; a breadcrumb and per-row chevron navigate into subfolders, and already-added folders are marked. Typing anything the browser does not list offers + Add <path>, always repo-root-relative. Chosen folders land as removable chips.

Directories combobox with six chips

Typed paths are validated and split on newlines at commit time, so a multi-line paste still adds every entry and a bad path is refused in the popover instead of failing the whole field.

Invalid typed path refused inside the picker

Narrow dark editor and settings pane

800 x 640 dark editor with reachable Save and Cancel

Settings preset editing with the same field

Earlier suggestion-based picker

The first version of this control only suggested paths copied from other saved presets, so it rendered nothing for a repository's first preset and never appeared in settings at all. Browsing the repository replaces it.

Existing users

No migration is required. Presets are stored as directories: string[] and are read unchanged by the chip list; existing sparse worktrees carry their own isSparse/sparseDirectories and are not touched. The main process already rejected absolute paths and .. segments at save, so no stored preset can contain a path the new field would refuse. Covered by a regression test that opens a preset saved before this editor and asserts every directory survives.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds configurable file-explorer roots for sparse worktrees. Root choices persist per worktree and migrate from existing state. The selected root scopes tree projection, loading, reveals, drag and drop, imports, and file creation. Directory errors preserve cached children and expose retry controls. Worktree rename, removal, transfer, and repository cleanup update the new state map. Host capability checks prevent unsupported environments from receiving the new field. Tests cover persistence, migration, scoped behavior, errors, hydration, and host compatibility.

Merge Risk: 🟡 Moderate · up to 59e7c

The explorer-root picker scopes file operations to the selected directory, but a stale native file-drop event can still write files into a previously selected root after changing scope. Error-state coverage also remains incomplete, so this should be resolved before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 80.36% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 56 functions across 52 files.
Description check ✅ Passed The description includes the required sections, linked issue, visual proof, testing details, review notes, boundary declaration, and checklist. It is complete, although it contains broader preset-edit…
Linked Issues check ✅ Passed The description links the primary issue with Fixes #19227 and lists related issues.
Out of Scope Changes check ✅ Passed The summarized changes consistently support persisted sparse-worktree explorer roots, including rendering, persistence, migration, cleanup, compatibility, error handling, and tests.
Title check ✅ Passed The title clearly describes the main change: scoping file trees to sparse checkout directories.

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

@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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 321ee7dd-eae4-4bba-9aaf-f4ee9881c130

📥 Commits

Reviewing files that changed from the base of the PR and between 86cd327 and d25296948b507f86212161c9d9449a2e42aa4ce2.

📒 Files selected for processing (60)
  • src/main/orca-profiles/profile-project-source-removal.ts
  • src/main/orca-profiles/profile-project-transfer-worktree-ids.ts
  • src/main/persistence-ui-state.test.ts
  • src/main/persistence/applying-settings/ui-state-read.ts
  • src/main/persistence/applying-settings/ui-state-update.ts
  • src/main/persistence/loading-store/normalize-loaded-ui-state.ts
  • src/main/persistence/loading-store/repo-lifecycle-operations.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration.ts
  • src/main/runtime/rpc/methods/client-ui-schemas.ts
  • src/main/runtime/rpc/methods/ui-state-schema-parity-checks.ts
  • src/renderer/src/app-shell/use-persisted-ui-writer.ts
  • src/renderer/src/components/right-sidebar/FileExplorer.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerBackgroundMenu.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerRootSelect.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerRow.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerToolbar.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-display-root.test.ts
  • src/renderer/src/components/right-sidebar/file-explorer-display-root.ts
  • src/renderer/src/components/right-sidebar/file-explorer-expanded-dirs-refresh.ts
  • src/renderer/src/components/right-sidebar/file-explorer-name-filter-projection.ts
  • src/renderer/src/components/right-sidebar/file-explorer-types.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-background-menu.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-row-scrolling.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-scope-transition.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-tree-load-effects.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerAutoReveal.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerDragDrop.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerImport.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerInlineInput.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerReveal.scoped-root.test.tsx
  • src/renderer/src/components/right-sidebar/useFileExplorerReveal.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerTree.scoped-root.test.tsx
  • src/renderer/src/components/right-sidebar/useFileExplorerTree.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerVisibleRowProjection.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.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/persisted-ui-write-baseline.test.ts
  • src/renderer/src/store/slices/persisted-ui-write-baseline.ts
  • src/renderer/src/store/slices/ui-hydration-view-layout.test.ts
  • src/renderer/src/store/slices/ui/ui-slice-contract-preferences.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-actions.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-sanitizers.ts
  • src/renderer/src/store/slices/ui/ui-slice-preference-actions.ts
  • src/renderer/src/store/slices/worktrees-slice-test-harness.ts
  • src/renderer/src/store/slices/worktrees/session/worktree-identity-rename-state.ts
  • src/renderer/src/store/slices/worktrees/teardown/remove-worktree-store-cleanup.ts
  • src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts
  • src/renderer/src/web/preload-api/web-ui-api.ts
  • src/renderer/src/web/preload-api/web-ui-explorer-root.test.ts
  • src/shared/constants.ts
  • src/shared/file-explorer-display-root.test.ts
  • src/shared/file-explorer-display-root.ts
  • src/shared/persisted-ui-state-types.ts

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

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — a scoped display root for sparse-checkout worktrees, plus the persistence, migration, error-handling, and old-host compatibility it requires.

  • Per-worktree display-root preference — new persisted explorerDisplayRootByWorktree record and a one-shot _explorerDisplayRootMigrated migration that seeds existing sparse worktrees with Full repo root while newly created ones default to their first sparse directory.
  • Display-root derivation and threading — file-explorer-display-root helpers compute options/path/depth, and the scoped path is threaded through the tree load, row/name-filter projections, reveal, auto-reveal, drag/drop, inline input, and background menu, with displayDepthOffset removing the leading ancestor indentation.
  • Dir-cache read-error handling — a new DirCache.error field distinguishes unreadable from empty, preserves prior children on failed refreshes, and surfaces a Retry action.
  • Scope-transition hygiene — selection, inline input, reveal timers, and scroll reset when the display root changes.
  • Persistence/RPC plumbing — hydration sanitizers, preference actions, teardown/purge cleanup, identity migration, schema parity, and a FileExplorerRootSelect picker plus i18n.
  • Old-host compatibility — the web client capability-negotiates explorerDisplayRootByWorktree so hosts that predate the field never receive an unknown ui.set key.

Verified the depth math is consistent across reveal, the scoped-root load effect, and refresh; that worktreeMeta[].sparseDirectories is a persisted source for the migration; and that the web merge path preserves the field. No behavioral issues found.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@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.

🧹 Nitpick comments (1)
src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.errors.test.tsx (1)

36-43: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Execute FileExplorerTreeStatus in this test.

visit(emptyPane(error)) only inspects the child element and its props. It does not execute the component at Line 26. The role="status" assertion comes from the parent retry element, so the test still passes if if (error !== null) reverts to if (error). Render or invoke FileExplorerTreeStatus with error: '' and assert that it returns the error-message branch.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 894ee9ad-41fe-497b-b7d5-31ee68b83f98

📥 Commits

Reviewing files that changed from the base of the PR and between d25296948b507f86212161c9d9449a2e42aa4ce2 and fb8cdd3db9c806328d5d939c7a45213d0ba6962b.

📒 Files selected for processing (9)
  • src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.errors.test.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerTreeStatus.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-display-root.ts
  • src/renderer/src/components/right-sidebar/file-explorer-expanded-dirs-refresh.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerTree.scoped-root.test.tsx
  • src/renderer/src/web/preload-api/web-explorer-root-sync.ts
  • src/renderer/src/web/preload-api/web-ui-api.ts
  • src/renderer/src/web/preload-api/web-ui-explorer-root.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/renderer/src/components/right-sidebar/file-explorer-display-root.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerTree.scoped-root.test.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-expanded-dirs-refresh.ts
  • src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the follow-up commit addressing reviewer feedback on the sparse explorer root feature.

  • Scoped-root error handling — FileExplorerFilesTreePane now derives its root cache from the display root and treats null as "no error", so a clean scoped directory no longer surfaces the stale full-root read error. FileExplorerTreeStatus, loadDir, and refreshFileExplorerExpandedDirs switch from truthiness to explicit !== null / !== undefined, preserving empty-string errors and cached children on failed reads.
  • Localized full-root label — the "Full repo root" option label now runs through translate with fileExplorer.root.* keys added to all six locales.
  • Web explorer-root replay — the web client's capability negotiation is extracted into createWebExplorerRootSync, which queues unacknowledged roots per environment in browser storage and replays them (with newer-value protection) once a host advertises the field.

Verified the null/undefined error sentinels are consistent across the pane, FileExplorerTreeStatus, loadDir, and refreshFileExplorerExpandedDirs, and traced the replay/acknowledge state machine against its seven test cases, including host-swap and concurrent-write races. No behavioral issues found.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@blaksmatic

Copy link
Copy Markdown
Contributor Author

@coderabbitai Please recheck docstring coverage on 1688c3f7e4. Added concise contract documentation for the changed functions; the local TypeScript AST audit finds JSDoc on all 61 identified changed named functions. Production changes in this commit are comments only. The focused persistence tests and changed-code quality gate pass.

@blaksmatic

Copy link
Copy Markdown
Contributor Author

@blaksmatic

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 003a4eb3-d7ba-4541-8bb6-965e9e09e06b

📥 Commits

Reviewing files that changed from the base of the PR and between 86cd327 and 1688c3f7e45f2d5ae39ec38a6203a0efedadf0f1.

📒 Files selected for processing (63)
  • src/main/orca-profiles/profile-project-source-removal.ts
  • src/main/orca-profiles/profile-project-transfer-worktree-ids.ts
  • src/main/persistence-ui-state.test.ts
  • src/main/persistence/applying-settings/ui-state-read.ts
  • src/main/persistence/applying-settings/ui-state-update.ts
  • src/main/persistence/loading-store/normalize-loaded-ui-state.ts
  • src/main/persistence/loading-store/repo-lifecycle-operations.ts
  • src/main/persistence/tracking-repos/worktree-identity-migration.ts
  • src/main/runtime/rpc/methods/client-ui-schemas.ts
  • src/main/runtime/rpc/methods/ui-state-schema-parity-checks.ts
  • src/renderer/src/app-shell/use-persisted-ui-writer.ts
  • src/renderer/src/components/right-sidebar/FileExplorer.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerBackgroundMenu.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.errors.test.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerRootSelect.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerRow.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerToolbar.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerTreeStatus.tsx
  • src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-display-root.test.ts
  • src/renderer/src/components/right-sidebar/file-explorer-display-root.ts
  • src/renderer/src/components/right-sidebar/file-explorer-expanded-dirs-refresh.ts
  • src/renderer/src/components/right-sidebar/file-explorer-name-filter-projection.ts
  • src/renderer/src/components/right-sidebar/file-explorer-types.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-background-menu.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-row-scrolling.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-scope-transition.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-tree-load-effects.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerAutoReveal.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerDragDrop.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerImport.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerInlineInput.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerReveal.scoped-root.test.tsx
  • src/renderer/src/components/right-sidebar/useFileExplorerReveal.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerTree.scoped-root.test.tsx
  • src/renderer/src/components/right-sidebar/useFileExplorerTree.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerVisibleRowProjection.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.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/persisted-ui-write-baseline.test.ts
  • src/renderer/src/store/slices/persisted-ui-write-baseline.ts
  • src/renderer/src/store/slices/ui-hydration-view-layout.test.ts
  • src/renderer/src/store/slices/ui/ui-slice-contract-preferences.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-actions.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-sanitizers.ts
  • src/renderer/src/store/slices/ui/ui-slice-preference-actions.ts
  • src/renderer/src/store/slices/worktrees-slice-test-harness.ts
  • src/renderer/src/store/slices/worktrees/session/worktree-identity-rename-state.ts
  • src/renderer/src/store/slices/worktrees/teardown/remove-worktree-store-cleanup.ts
  • src/renderer/src/store/slices/worktrees/teardown/worktree-purge-state.ts
  • src/renderer/src/web/preload-api/web-explorer-root-sync.ts
  • src/renderer/src/web/preload-api/web-ui-api.ts
  • src/renderer/src/web/preload-api/web-ui-explorer-root.test.ts
  • src/shared/constants.ts
  • src/shared/file-explorer-display-root.test.ts
  • src/shared/file-explorer-display-root.ts
  • src/shared/persisted-ui-state-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit="1688c3f7e4"

git rev-parse --verify "${commit}^{commit}"
printf '\n--- Changed files ---\n'
git diff-tree --no-commit-id --name-status -r "$commit"

printf '\n--- Production TypeScript diff (function and JSDoc context) ---\n'
git diff --unified=8 "${commit}^" "$commit" -- \
  ':(exclude)**/*.test.ts' \
  ':(exclude)**/*.test.tsx' \
  ':(exclude)**/*.spec.ts' \
  ':(exclude)**/*.spec.tsx' \
  '*.ts' '*.tsx'

printf '\n--- Changed production TypeScript files ---\n'
git diff-tree --no-commit-id --name-only -r "$commit" -- '*.ts' '*.tsx' \
  | grep -Ev '(\.test|\.spec)\.(ts|tsx)$' || true

Length of output: 50718


🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit="1688c3f7e4"

python3 - "$commit" <<'PY'
import re
import subprocess
import sys

commit = sys.argv[1]
diff = subprocess.check_output(
    ["git", "diff", "--unified=0", f"{commit}^", commit, "--", "*.ts", "*.tsx"],
    text=True,
)

current_file = None
entries = []
lines = diff.splitlines()
i = 0
while i < len(lines):
    line = lines[i]
    if line.startswith("+++ b/"):
        current_file = line[6:]
    if line.startswith("+/**"):
        block = [line[1:]]
        i += 1
        while i < len(lines):
            candidate = lines[i]
            if candidate.startswith("+"):
                block.append(candidate[1:])
                if candidate[1:].strip().endswith("*/"):
                    i += 1
                    break
            else:
                break
            i += 1

        following = []
        while i < len(lines) and len(following) < 12:
            candidate = lines[i]
            if candidate.startswith("+") and not candidate.startswith("+++"):
                following.append(candidate[1:].strip())
            elif candidate.startswith("@@") or candidate.startswith("diff --git"):
                break
            i += 1
        text = " ".join(following)
        match = re.search(
            r"(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)|"
            r"([A-Za-z_$][\w$]*)\s*:\s*(?:async\s*)?\([^)]*\)\s*=>|"
            r"(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?\([^)]*\)\s*=>|"
            r"([A-Za-z_$][\w$]*)\s*\([^)]*\)\s*(?::[^=]+)?=>",
            text,
        )
        name = next((group for group in match.groups() if group), None) if match else None
        entries.append((current_file, name, " ".join(block)))
        continue
    i += 1

production = [entry for entry in entries if not re.search(r"\.(test|spec)\.[tj]sx?$", entry[0] or "")]
tests = [entry for entry in entries if entry not in production]
unmatched = [entry for entry in entries if entry[1] is None]

print(f"Added JSDoc blocks: {len(entries)}")
print(f"Production JSDoc blocks: {len(production)}")
print(f"Test JSDoc blocks: {len(tests)}")
print(f"Unmatched blocks: {len(unmatched)}")
print("\n--- JSDoc declaration associations ---")
for path, name, _ in entries:
    print(f"{path}: {name or 'UNMATCHED'}")
if unmatched:
    print("\n--- Unmatched block text ---")
    for path, _, block in unmatched:
        print(f"{path}: {block}")
PY

Length of output: 13125


🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit="1688c3f7e4"

python3 - "$commit" <<'PY'
import re
import subprocess
import sys

commit = sys.argv[1]
diff = subprocess.check_output(
    ["git", "diff", "--unified=0", f"{commit}^", commit, "--", "*.ts", "*.tsx"],
    text=True,
)

locations = []
path = None
for line in diff.splitlines():
    if line.startswith("+++ b/"):
        path = line[6:]
        continue
    if line.startswith("@@"):
        # Example: @@ -12,0 +13 @@
        match = re.search(r"\+(\d+)(?:,(\d+))?", line)
        new_line = int(match.group(1)) if match else None
        continue
    if path is None or "new_line" not in locals() or new_line is None:
        continue
    if line.startswith("+") and not line.startswith("+++"):
        if line[1:].lstrip().startswith("/**"):
            locations.append((path, new_line))
        new_line += 1
    elif line.startswith(" "):
        new_line += 1

declaration = re.compile(
    r"^(?:export\s+)?(?:default\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\b|"
    r"^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>|"
    r"^([A-Za-z_$][\w$]*)\s*:\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>"
)

unmatched = []
matched = []
for path, start in locations:
    source = subprocess.check_output(["git", "show", f"{commit}:{path}"], text=True).splitlines()
    index = start - 1
    # Skip the complete JSDoc block.
    while index < len(source):
        if "*/" in source[index]:
            index += 1
            break
        index += 1
    # Skip blank lines only. A JSDoc must directly document the next declaration.
    while index < len(source) and not source[index].strip():
        index += 1
    next_line = source[index].strip() if index < len(source) else ""
    match = declaration.match(next_line)
    if match:
        matched.append((path, start, next(group for group in match.groups() if group)))
    else:
        unmatched.append((path, start, next_line))

print(f"Added production JSDoc blocks: {len(locations)}")
print(f"Blocks followed by a named function declaration: {len(matched)}")
print(f"Blocks not matched by the declaration heuristic: {len(unmatched)}")
print("\n--- Verified associations ---")
for path, line, name in matched:
    print(f"{path}: Line {line} -> {name}")
if unmatched:
    print("\n--- Requires manual review ---")
    for path, line, next_line in unmatched:
        print(f"{path}: Line {line} -> {next_line}")
PY

Length of output: 8191


@blaksmatic Recheck complete for 1688c3f7e4.

I found 52 added production JSDoc blocks. All 52 directly document a named function or method.

The audit matched 48 declarations automatically. I manually verified the remaining four valid declarations:

  • commitPendingResults
  • prepare
  • acknowledge
  • read

The commit-level diff contains 52 added JSDoc blocks, not 61. This does not conflict with the reported 61-function audit because functions documented in earlier commits are not new JSDoc additions in this comments-only commit.

No docstring coverage finding remains.

You are interacting with an AI system.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the delta since the prior Pullfrog review (commit fb8cdd3).

  • Malformed-marker persistence fix — normalizeLoadedUiState now gates markNeedsSave() on parsed.ui?._explorerDisplayRootMigrated !== true instead of truthiness, so a truthy-but-malformed marker (1, 'true', {}) can no longer re-run the one-shot migration on every load without ever persisting the seeded display roots.
  • Regression test — a new it.each test drives normalizeLoadedUiState across every marker shape (undefined/false/null/1/'true'/{}/true), asserting the migration result is persisted exactly when the marker is not boolean true, plus reload idempotency.

Verified the new test fails under the previous truthiness check (the 1/'true'/{} cases) and passes with the strict check, and that the fix aligns markNeedsSave with the existing === true gate already used by migrateExplorerDisplayRoots.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/right-sidebar/useFileExplorerImport.ts (1)

113-117: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject a stale native drop before importing it.

After a scope change commits, the callback can still receive the old destinationDir. The focused test does this with /repo/app after /repo/api commits. Lines 113-117 suppress selection only after importExternalPathsToRuntime writes the file and refreshDir refreshes the old directory.

Validate destinationDir against displayRootRef.current before the import. Keep the check inside the try block so finally clears the native drag state. Add assertions that the second drop does not call import or refresh.

Proposed fix
       void (async () => {
         try {
+          if (
+            getRelativePathInsideRoot(destinationDir, displayRootRef.current) === null
+          ) {
+            return
+          }
+
           const operationGuard = captureFileExplorerOperationGuard(wtId, operationOwnerRef.current)
   await waitFor(() => expect(clearDrag).toHaveBeenCalledTimes(2))
   expect(selected).not.toHaveBeenCalled()
+  expect(mocks.importPaths).toHaveBeenCalledTimes(1)
+  expect(refresh).toHaveBeenCalledTimes(1)
   expect(mocks.subscribe).toHaveBeenCalledTimes(1)

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 79bcd9ca-19d0-45e0-a728-8cf8956b0a02

📥 Commits

Reviewing files that changed from the base of the PR and between 28792eadd256f79a92eec47f4b6e5dbc01d3d262 and 59e7c6e1bba9a3dfce54bb2871351f584d87c0c8.

📒 Files selected for processing (2)
  • src/renderer/src/components/right-sidebar/useFileExplorerImport.committed-scope.test.tsx
  • src/renderer/src/components/right-sidebar/useFileExplorerImport.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the delta since the prior Pullfrog review (commit 28792ea).

  • Native-drop committed-scope fix — useFileExplorerImport now assigns its latest-value refs inside a useLayoutEffect instead of during render, so a native file drop fired during a suspended scope transition observes only the committed workspace state rather than torn, uncommitted refs.
  • Scoped-selection guard — the import pipeline only reveals the first imported file when its destination still lies inside the current display root, preventing a reveal of a file that is now outside the scoped tree after a concurrent root switch.
  • Regression test — a new useFileExplorerImport.committed-scope.test.tsx drives a startTransition + Suspense suspend and asserts the drop uses the old committed scope during suspension and the new scope after commit.

Verified the useLayoutEffect move is the correct pattern for React 18 concurrent rendering (render-phase ref assignment tears under suspension, and the test fails if the change is reverted), and that getRelativePathInsideRoot(destPath, displayRoot) returning null correctly suppresses selection when the imported file falls outside the committed display root. No behavioral issues found.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the feat/sparse-explorer-root branch 2 times, most recently from e8a604a to 51a0c59 Compare September 27, 2026 05:53

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the delta since the prior Pullfrog review: the fix(explorer): reject stale drops and satisfy quality gates commit (rebased content-identical onto newer main).

  • Stale native-drop rejection — useFileExplorerImport now returns early when the drop's destinationDir falls outside the committed display root, so a drop that raced a scope switch is no longer imported into the previously-scoped directory. The guard sits inside the try, so finally still clears the native drag state.
  • Regression coverage — useFileExplorerImport.committed-scope.test.tsx adds importPaths/refresh call-count assertions on the second (stale) drop; the test fails without the guard.
  • Real error-branch render test — FileExplorerFilesTreePane.errors.test.tsx renders FileExplorerTreeStatus with error="" via renderToStaticMarkup and asserts the failure message rather than the empty-directory message.
  • Quality-gate cleanup — as never / as unknown as Virtualizer test casts replaced with typed fixtures and line-scoped SAFETY disables; components/ui primitive restyling removed from FileExplorerRootSelect.

Verified the guard cannot reject legitimate drops: the pane background and rows carry data-native-file-drop-dir values inside the display root, getExplorerDisplayRootPath never returns null while worktreePath is set, and the handler already bails when it is not. No behavioral issues in the delta; prior reviews have no open threads.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

Copy link
Copy Markdown
Contributor

Implemented the sparse explorer navigation follow-up.

  • New worktrees with one eligible sparse folder focus that folder. With multiple folders, the default is the repository root so sibling packages remain visible. Explicit saved choices and the existing migration are preserved.
  • The picker says “Viewing: …” and labels the repository root without implying a checkout change.
  • An explicit reveal outside the focused folder offers “Back to …”. The return target is transient within the mounted explorer; it adds no persisted or remote field.
  • The Contents view names its workspace search scope.

This keeps the existing tree and file-operation paths. A grouped “All sparse folders” view remains a follow-up rather than introducing new grouping and drop-target behavior here.

Actual rendered comparisons

Original PR at 51a0c59bbe13 on the left; the updated build on the right. Captured from hidden Electron instances on macOS at the same viewport. Images below are explorer crops with comparison labels; no UI is drawn or substituted.

The scenario uses real temporary files and seeded sparse-directory metadata. It drives the picker and Back button through the UI and explicit reveal through the normal store action. This validates explorer navigation, not Git sparse-checkout creation.

One sparse folder — focused by default in both builds, now with an explicit viewing label.

single-folder-comparison.png

Multiple sparse folders — the default now exposes sibling packages and repository files.

multiple-folders-comparison.png

Outside-file reveal — the updated view offers a return action.

outside-reveal-comparison.png

Return action, search scope, dark theme, and ordinary workspace

After clicking Back to apps/web

returned-to-folder-crop.png

Content-search scope

content-search-crop.png

Explicit package choice in dark mode

saved-choice-dark-crop.png

Ordinary workspace without a sparse picker

ordinary-workspace-crop.png

Validation

  • pnpm tc:web passed.
  • 12 focused unit/hook tests passed.
  • sparse-explorer-proof.spec.ts passed, exercising defaults, explicit reveal/return, search scope, a chosen directory in dark mode, and non-sparse fallback.
  • Renderer build, runtime English catalog check, and changed-code quality gate (including design-system checks) passed.
  • Linux, Windows, SSH reconnect, and native file drops were not exercised in this run.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the delta since the prior Pullfrog review: commit b42884a9 (fix(explorer): preserve context when navigating sparse folders), which adds a "return to previous scope" affordance after an outside-file reveal and tightens the default-root rule for multi-directory sparse worktrees.

  • Multi-directory default — resolveExplorerDisplayRootChoice now focuses the sole sparse directory only when exactly one exists (options.length === 2); worktrees with two or more sparse directories default to the repository root. The JSDoc and file-explorer-display-root.test.ts were updated to match.
  • Scope return affordance — a new useFileExplorerRootNavigation hook records a per-worktree return target when a reveal falls outside the display root, and returnRoot only resolves while the current choice is the full root and the recorded worktree still matches (so a worktree switch cannot surface a stale target). useFileExplorerReveal now calls an injected onRevealOutsideRoot callback instead of writing the store directly, and a new FileExplorerScopeNotice renders the "Back to {{path}}" button plus a search-scope note in the Contents view.
  • Picker label — the full-root option and trigger read "Repository root" / "Viewing: …", with viewing/back/searchScope keys added to all six locales.
  • Proof spec — a new tests/e2e/sparse-explorer-proof.spec.ts exercises the single- and multi-directory defaults, scoping via the picker, the outside-file reveal and return, the content-search scope note, and the ordinary-workspace fallback.

I verified that getRevealAncestorDirs(displayRootPath, file) returns null for a file outside the display root, so the outside-scope case is handled by the onRevealOutsideRoot branch and never feeds the selection effect with bogus ancestors, and that the scope-transition useLayoutEffect runs before the reveal useEffect (so the reset cannot clobber the reveal selection). Ran the focused vitest suites for the changed hooks/helpers — all pass.

ℹ️ PR description no longer matches the default-root rule

The PR body states that "Only newly created sparse worktrees default to their first sparse directory," but after this commit that is only true for single-directory sparse worktrees — a new worktree with two or more sparse directories now opens at the repository root. Worth updating the description so the recorded intent matches the shipped behavior (or confirming the multi-directory default is the intended final rule).

Technical details
# Multi-directory sparse worktrees default to the repository root

## Affected sites
- `src/renderer/src/components/right-sidebar/file-explorer-display-root.ts` — `resolveExplorerDisplayRootChoice` returns `options[1].value` only when `options?.length === 2`; otherwise `FILE_EXPLORER_FULL_ROOT`.
- PR description ("What Changed" bullet: "Only newly created sparse worktrees default to their first sparse directory").

## Required outcome
- The description reflects that auto-focus applies only to a sole sparse directory, or the default is changed so multi-directory worktrees also auto-focus.

## Open questions for the human
- Is the repository-root default for multi-directory sparse worktrees intentional, and should the description be updated?

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

Important

One new localization-gate failure would block the merge; see the inline comment.

Reviewed changes — the delta since the prior pullfrog review: commit 6f794218 (feat(sparse): unify preset editing and clarify checkout scope).

  • Shared preset editor — the composer picker and repository settings now render one SparsePresetEditorDialog wrapping SparseCheckoutPresetDraftForm, replacing the two separate inline editors; the composer closes its popover before opening the dialog and restores focus to the trigger on close.
  • Shared name validator — validateSparsePresetName moved into sparse-preset-draft.ts with translated messages and named duplicate-name interpolation, and both surfaces call it (the name input's maxLength was dropped so the length error is reachable).
  • Textarea code variant — the directories field is rebuilt on a variant="code" textarea inside a scrollable form body with a pinned Save/Cancel footer.
  • Checkout-scope clarity — FileExplorerScopeNotice now renders for any sparse worktree, adding an “omitted files are not searched” note and a “view changes do not change checked-out files” banner.
  • i18n and proof — sparsePreset.* keys added to all six locales, plus a new tests/e2e/sparse-preset-proof.spec.ts; the explorer proof spec now builds a real sparse checkout.

ℹ️ Nitpicks

  • FileExplorer.tsx:282 — sparse={!!activeWorktree?.isSparse} is always true, since the notice is only mounted under activeWorktree?.isSparse; the sparse ? … : null branches in FileExplorerScopeNotice are therefore dead. Dropping the prop and rendering the notice unconditionally would be simpler.
  • SparsePresetSettingsSection.tsx:186 — on a failed save the same message is rendered twice with role="alert" (the section's visibleError banner at line 174 and the dialog form's operationError), so assistive tech announces it twice. Consider suppressing the section banner while the draft dialog is open.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

Important

One new must-address issue: while a sparse preset draft is open, pressing Enter on the agent picker still creates the workspace, bypassing the "save or cancel the preset" block. Details inline.

Reviewed changes — the delta since the prior pullfrog review: commit 199c060 (fix(sparse): edit presets inline without stacking dialogs).

  • Replaced the stacked preset dialog with a shared inline SparsePresetInlineEditor rendered as a labelled region, used by both the composer picker and repository settings.
  • Added composer sparseEditing state that disables the footer Create button, shows a save-or-cancel note, and marks the composer root with data-sparse-preset-editing; the modal's Escape and Cmd/Ctrl+Enter handlers now respect an open editor.
  • Reworked the shared form on the Textarea code variant with a sticky footer, collapsible checkout help, a localized name placeholder, accessible directory status, and settings focus restoration.
  • Added sparsePreset.details/finishEditing and catalog sync across all six locales, and updated the sparse-preset e2e proof to the inline editor.

ℹ️ Nitpicks

  • NewWorkspaceComposerAdvancedSection.tsx:152 — collapsing Advanced while a preset draft is open hides and inerts the editor while Create stays disabled; recovery requires re-expanding and cancelling. Consider disabling the Advanced toggle while editing.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ Reviewed the new commits; no new issues found. The localization-coverage gate flagged in an earlier review is unchanged (SparseCheckoutPresetDraftForm.tsx:94 still holds a raw placeholder literal), so this PR is not mergeable yet and stays unapproved.

Reviewed changes — the delta since the prior pullfrog review: commit 55d7cd76 (fix(sparse): polish inline editing and explorer scope).

  • Closed the preset-editing create bypass — the agent section now receives createDisabled={props.createDisabled || sparseEditing} and advancedLocked, the footer is hidden while a draft is open, and the project section is a disabled fieldset; the prior "plain Enter on the agent picker creates the workspace" finding is fixed.
  • Extracted the preset chooser — SparsePresetChooser now owns preset search, the "Full checkout" default, per-preset edit, and the New preset action, with CommandItem gaining a selection="palette" variant.
  • Relocated the explorer scope row — the root picker moved from the toolbar into FileExplorerScopeNotice, which gains an Info popover, a search-scope note, and the "Back to" row; the name filter prompt now names the viewed folder.
  • Scoped explorer copy and retry — FileExplorerTreeStatus distinguishes an empty/failed folder from an empty/failed workspace, and the pane derives only the display root's error with a Retry that refreshes that directory.
  • Inline settings editing — SparsePresetSettingsSection edits in place, blocks competing New/Edit/Delete while a draft is open, suppresses its duplicate error banner, adds a load retry, and restores focus to the edited row.
  • i18n and proof — new keys in all six locales plus extended explorer/preset proof specs.

Verified locally: tc:web passes, 46 focused vitest tests pass, and the catalog/runtime-catalog/extraction localization checks pass.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta.

Reviewed changes — the delta since the prior pullfrog review: commit c93a2eb (fix(sparse): attach chooser and keep long-list actions visible).

  • Chooser attached to its trigger — the preset popover drops its own max-height/scroll and passes sideOffset={0}, so the surface sits flush against the "Checkout preset" trigger instead of floating with a gap.
  • Results-only scrolling — SparsePresetChooser bounds itself and makes the result list min-h-0 flex-1, pinning the search field and the New preset footer; the New preset action can no longer scroll out of reach with a long preset list.
  • Popover wheel shim opt-in — PopoverContent gains a wheelScroll marker that routes wheel events to the nearest scrollable descendant (the result list) through the existing shim, since Radix's dialog scroll-lock swallows them.
  • Proof coverage — the preset proof now asserts trigger/edge alignment, Enter selection with focus return, wheel scrolling with 25 presets, and filtering to the last preset.

Verified locally: tc:web, check:dead-classes, and check:code-quality:changed (0 findings across 89 changed files) all pass, and the focused preset suites pass.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No critical issues — one layout suggestion inline.

Reviewed changes — the delta since the prior pullfrog review: commit 9f35189 (refine(sparse): use compact explorer breadcrumb navigation), which reworks the sparse explorer root picker into a breadcrumb row.

  • Breadcrumb root picker — FileExplorerRootSelect replaces the Radix Select with a <nav>: an icon button returns to the repository root, and a DropdownMenu radio group picks among the sparse directories.
  • Return action folded into the scope row — FileExplorerScopeNotice now renders the "Back to {{path}}" control as an icon button inline with the picker and the Info popover, instead of a second full-width row.
  • Test/proof updates — the scope-notice unit test and sparse-explorer-proof.spec.ts switch from combobox/option queries to button/menuitemradio and add an Escape plus a root-then-repick retry.

Every new visible string still routes through translate, and the menu now inherits WebkitAppRegion: 'no-drag' from the dropdown primitive, so the previous explicit no-drag class is no longer needed.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

type="button"
variant="ghost"
size="xs"
className="min-w-0"

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.

The trigger lost the width constraint the old SelectTrigger had (min-w-0 flex-1), and the base Button carries shrink-0. With no flex-1/max-w-*, the button sizes to its content, so truncate on the label never engages and a long sparse directory path overflows the scope row instead of ellipsizing.

Technical details
# Constrain the breadcrumb trigger so long paths truncate

## Affected sites
- `src/renderer/src/components/right-sidebar/FileExplorerRootSelect.tsx:61-71` — the trigger `Button` has only `min-w-0`, while `buttonVariants` is `inline-flex shrink-0`; nothing caps the width, so the label expands the button past the scope row.
- `src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsx:88` — the codebase's equivalent dropdown trigger constrains the same shape with `max-w-48` on the `Button` plus `<span className="truncate">`.

## Required outcome
- A long selected folder path ellipsizes within the available scope-row width at the 220px sidebar minimum and does not overlap the Info button.

## Suggested approach (optional)
- Give the trigger a width cap the base `shrink-0` cannot defeat — e.g. `className="min-w-0 max-w-full"`, or a bounded cap as in the native-chat picker; the inner `<span className="truncate">` then elides.
Suggested change
className="min-w-0"
className="min-w-0 max-w-full"

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 2/5

[Medium risk] File explorer now scopes display to sparse checkout directories.

The PR does not appear safe to merge while previously reported preference-loss, wrong-directory selection, and root-sync ordering defects remain.

Findings

  1. P1 Transferred explorer choices are lost ▶
  2. P1 Absolute path selects another directory ▶
  3. P1 Older choice overwrites newer choice ▶
  4. P2 Preset actions scroll away ▶
  5. P2 Selected folders block browsing ▶
  6. P2 New picker text remains English ▶

Summary

The PR adds sparse-directory explorer scoping, breadcrumb navigation, and a shared inline preset editor. Changes since the previous review also revise CI, release workflows, and runtime persistence.

  • The release-policy workflow cannot load its new policy module when an older tagged release is edited.
  • Earlier findings about profile-transfer preferences, absolute picker paths, picker navigation and localization, and web root synchronization remain outstanding.

Reviews (7) · Last reviewed commit: "fix(sparse): name the directory picker f..."

Comment on lines +39 to +42
explorerDisplayRootByWorktree: removeRepoWorktreeRecord(
state.ui.explorerDisplayRootByWorktree,
repoId
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Transferred explorer choices are lost When a repository is moved or copied to another profile, its saved explorer-folder choices are not included in the transfer payload. A move also deletes them from the source profile, so the choices are lost rather than following the repository.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P2 Folder picker remains untranslated src/renderer/src/i18n/locales/es.json:154 ▶

    The new folder-picker labels are still English in the Spanish, French, Japanese, Korean, and Chinese locale files. Users of those languages see “Add a folder,” “Find a folder…,” and “No folders found.” inside an otherwise localized preset editor.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@pullfrog pullfrog 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.

ℹ️ No critical issues — a few minor suggestions inline.

Reviewed changes — the delta since the prior pullfrog review: commit fe1edf2 (fix(sparse): add path suggestions and seal editor footer).

  • Searchable folder suggestions — a new SparseDirectoryPicker popover lists directories drawn from existing presets (filtered against the draft's current selection) and appends the picked path to the directories field.
  • Editor footer sealed — the shared preset form gains bottom padding and an opaque sticky Save/Cancel footer with a soft top shadow, and Save swaps to an inline spinner while keeping its label.
  • Scroll on open — SparsePresetInlineEditor scrolls itself to center on mount.
  • i18n — sparsePreset.addPath / findPath / noPathMatches added to all six catalogs.

ℹ️ Nitpicks

  • SparseDirectoryPicker has no unit or e2e coverage — the sparse-preset proof spec still exercises only the textarea path.
  • The three new picker strings carry the English value in the es / fr / ja / ko / zh catalogs; the catalog gate accepts English fallbacks, but the PR body states copy was added in all six languages.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +54 to +56
const addDirectory = (directory: string): void => {
const next = [...(parsedDirectories?.directories ?? []), directory]
onDraftChange({ ...draft, directoriesText: next.join('\n') })

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.

The picker stays enabled while the directories field is invalid, and addDirectory rebuilds the text from parsedDirectories.directories, which is [] for any parse error (hasAbsoluteEntry, or ./parent segment). Clicking a suggestion then silently replaces the whole field — including any valid lines the user typed next to the bad one — with just the picked folder. Appending to the raw directoriesText (or disabling the picker while directoryError is set) avoids dropping entries.

Technical details
# Adding a suggested folder discards existing typed directories

## Affected sites
- `src/renderer/src/components/sparse/SparseCheckoutPresetDraftForm.tsx:54-56` — `addDirectory` uses `parsedDirectories?.directories ?? []` as the base, then `next.join('\n')`.
- `src/renderer/src/lib/sparse-preset-draft.ts:29-56` — both error branches (`hasAbsoluteEntry`, and `.`/parent segment) return `directories: []`, so every typed line is dropped, not just the invalid one.
- `src/renderer/src/components/sparse/SparseDirectoryPicker.tsx:33` — the trigger is only gated on `submitting`, so it is clickable during the error state.

## Required outcome
- Adding a suggested folder never discards directories the user has already typed.

## Suggested approach (optional)
- Append to the current `directoriesText` lines (deduped) instead of rebuilding from `parsedDirectories.directories`, or keep the picker disabled while `directoryError` is non-null.

disabled,
onAdd
}: SparseDirectoryPickerProps): React.JSX.Element | null {
const available = suggestions.filter((path) => !selected.includes(path))

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.

suggestions is a flatMap across every preset and isn't deduped, so two presets sharing a directory produce duplicate key/CommandItem rows (React duplicate-key warning and two identical entries). Dedupe before filtering, e.g. [...new Set(suggestions)].

</div>
<SparsePresetInlineEditor
{...props}
directorySuggestions={directorySuggestions}

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.

directorySuggestions is accepted here but never supplied — SparsePresetSettingsSection is the only caller of SparsePresetDraftEditor and doesn't pass it, so the picker never renders in settings and this forwarded prop is dead. Either give the settings caller the repo's preset directories too, or drop the prop from the wrapper.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes — the delta since the prior pullfrog review: commit 663dc188 (fix(sparse): keep path picker visible and stop footer overlap).

  • Picker stays visible — SparseDirectoryPicker now renders whenever any saved path suggestion exists, instead of hiding itself once every suggestion is already selected.
  • Footer de-stickied — the preset form's action area switches from sticky bottom-0 (with a top shadow) to relative, removing the sticky bar's overlap over scrolled content.

Verified pnpm tc:web and the SparseCheckoutPresetDraftForm / SparsePresetChooser suites still pass.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

onAdd
}: SparseDirectoryPickerProps): React.JSX.Element | null {
const available = suggestions.filter((path) => !selected.includes(path))
if (!suggestions.length) {

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.

Now that the picker renders whenever suggestions is non-empty, the available.length === 0 case falls through to CommandEmpty, so opening "Add a folder" when every suggestion is already selected shows "No folders found." That reads as the add feature failing rather than "all folders already added". Consider a distinct empty-state message for that case (or list the already-selected paths as disabled/checked items).

@pullfrog pullfrog 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.

Important

One must-address issue: the rewritten Directories field leaves tests/e2e/sparse-preset-proof.spec.ts targeting a control that no longer exists, and the field's label no longer labels anything. That spec is selected by the changed-e2e lane, so it will fail CI.

Reviewed changes — the delta since the prior pullfrog review: commit b497bab (refine(sparse): make Directories a combobox with a chip list).

  • Directories as a combobox plus chip list — the preset form drops its directories textarea for a SparseDirectoryPicker popover and a new SparseSelectedDirectoryList; add/remove rewrite directoriesText from the normalized lines, so a preset with unparseable saved paths keeps its chips and no longer silently drops other entries on add.
  • Typed-path entry — SparseDirectoryPicker now accepts free-form text or a multi-line paste (parseSparseDirectoryEntryInput), rendering either an "Add <path>" row or the parse error, alongside the existing live folder browser; addSparseDirectoryEntries appends deduped.
  • i18n and unit coverage — findOrTypePath/addTypedPath/noDirectories/removePath were added across all six catalogs, the form test was updated to the chips UI, and pnpm run verify:localization-coverage now passes (resolving the prior blocker).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread tests/e2e/sparse-preset-proof.spec.ts Resolved
Comment on lines +56 to +64
const preparedAtRead = latestPrepared.get(environmentId)
// Replay survives hydration and browser reloads, even if the diff baseline became clean.
await callRuntimeResult('ui.set', { explorerDisplayRootByWorktree: roots }, 15_000)
acknowledge(environmentId, roots)
const newerPrepared = latestPrepared.get(environmentId)
ui.explorerDisplayRootByWorktree =
newerPrepared && newerPrepared !== preparedAtRead
? newerPrepared
: (pending()[environmentId] ?? roots)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Older choice overwrites newer choice

If a pending explorer-root choice is replayed after a host upgrade, a newer choice can be saved and acknowledged while that replay is still in flight. If the older replay finishes last, it overwrites the newer choice on the host. The newer choice has already been removed from the queue, so a later load restores the old choice even though the UI showed the new one.

@pullfrog pullfrog 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.

ℹ️ No new issues in this commit — the proof-spec rewrite and the copy cleanup both look right. Left unapproved only because two earlier threads on untouched files (FileExplorerRootSelect trigger width, SparseDirectoryPicker added-row drill-down) are still open.

Reviewed changes — the delta since the prior pullfrog review: commit d059fa4 (refine(sparse): drop the directory count and preset scope blurb).

  • Preset proof spec moved to the combobox/chip UI — an addDirectory helper opens the "Add a folder" picker, types a repo-relative path, clicks the literal row, and asserts the resulting chip; validation now asserts the parse error and the absence of a literal row, and edit mode checks the two saved chips. This clears the changed-e2e failure flagged against b497bab.
  • Form copy cleanup — the directories count/status line and the preset-scope blurb were removed, with singleDirectory/directoryCount/futureHelp dropped from all six catalogs (no remaining code references).

Verified pnpm tc:web and the catalog, extraction, and coverage localization gates pass.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues in this delta. The only new commit adds an accessible name to the preset folder picker plus a regression test; it stays unapproved only because two earlier minor threads on untouched files remain open.

Reviewed changes — the delta since the prior pullfrog review: commit 5b1fe78 (fix(sparse): name the directory picker for assistive tech).

  • Picker combobox named — the role="combobox" trigger in SparseDirectoryPicker now carries aria-label equal to its visible "Add a folder" text. That role takes no name from content, so the control was previously unnamed and the existing getByRole('combobox', { name: 'Add a folder' }) steps in sparse-preset-proof.spec.ts (the addDirectory helper and the validation row) could not resolve.
  • Legacy-preset regression test — a new case renders a preset saved before the chip editor and asserts each stored directory still renders a Remove … chip, Save stays enabled, and rendering does not mutate the draft (guarding the normalizeSparseDirectoryLines-backed chip list).

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

blaksmatic and others added 18 commits September 29, 2026 02:18
The picker only ever suggested paths copied from other saved presets, so
it vanished for the first preset and never appeared in settings at all.
It now reads the repository through fs.readDir: breadcrumb navigation,
drill-in per folder, already-added rows marked, bounded to the popover's
available height. Also drops the reserved space left over from the old
sticky footer.
The newline textarea is replaced by the folder picker itself: one
combobox that browses the repository and also accepts free-form typing,
with the chosen folders listed as removable chips below it. Typed input
is validated and split on newlines at commit time, so a bad path is
refused in the popover instead of failing the whole field, and a
multi-line paste still adds every entry.
Both restated what the chip list already shows. The inline region now
carries only a validation error when there is one, and the e2e proof
drives the combobox instead of the removed textarea.
role="combobox" takes no accessible name from its contents, so the
trigger was announced unnamed despite its visible label. Adds the
explicit label and a regression test that a preset saved before the chip
editor opens with every directory intact.
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]: Improve vertical space for sparse preset editing in New Workspace

2 participants