Repository navigation
Conversation
Share parseWorktreeList and parseUnmergedEntry in src/shared so SSH cannot drift from local: porcelain sparse sets optional isSparse, and unmerged paths go through decodeGitCQuotedPath with the desktop ENOENT/ENOTDIR probe. Fixes stablyai#18280
|
Warning Review limit reachedNext included review available in 42 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (12)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Unified
parseWorktreeListintosrc/shared/git-worktree-list-parser.ts— one shared parser now serves both desktop and relay, setting optionalisSparsefrom the porcelainsparseline and omitting it when absent. - Unified
parseUnmergedEntryintosrc/shared/git-unmerged-entry.ts— the shared parser C-quote-decodes conflict paths and probes the filesystem with asyncaccess, treating onlyENOENT/ENOTDIRasdeleted. - Desktop modules became one-line re-exports —
worktree-list-parser.tsandstatus-conflict-entries.tsnow forward to the shared implementations. - Relay drift removed —
git-handler-utils.tsdeletes its duplicated parsers and re-exports the shared functions, dropping the now-internalparseConflictKindexport. - Relay call sites updated —
git.listWorktreesreturns parser output soisSparserides on the JSON, andgetStatusOpawaits the now-async unmerged parser.
The dedupe is faithful: the desktop parser moved verbatim and the only wire delta is the additive optional isSparse field (remote-wire Rule 1, ignored by older clients) plus the corrected C-quote decoding of conflict paths. readRelayWorktreeList's narrower RelayWorktreeInfo mapping still drops isSparse, but that path feeds worktree-remove / base-ref-refresh only — the public git.listWorktrees handler returns the full parser output, so the fix reaches the client worktree model via mergeWorktree. Tests use exact assertions that can fail, and the affected suites (39 + 15 tests) plus pnpm tc:node all pass.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
Local Git listing already knew when a worktree was a sparse checkout, and already decoded quoted conflict file names. The SSH relay used a copy of those parsers that skipped both, so sparse SSH worktrees looked full and conflict paths with spaces or non-ASCII names stayed quoted. There is now one shared parser for both.
What Changed
parseWorktreeListtosrc/shared/git-worktree-list-parser.ts. Porcelainsparsesets optionalisSparse; without the line the field is omitted (Git 2.25).parseUnmergedEntrytosrc/shared/git-unmerged-entry.ts. Paths go throughdecodeGitCQuotedPath. Missing-file probes use asyncaccessand treat onlyENOENT/ENOTDIRas deleted (EACCES stays modified).git-handler-utils.tsdeletes the drifted copies and re-exports the same implementations.git.listWorktreeson the relay returns parser output, soisSparseis on the JSON result when present.Why
The relay copy of
parseWorktreeListhad nosparsebranch, so SSH sparse checkouts were unmarked for space-analysis, sparse UI, and adoption guards. The relay unmerged parser skipped C-quoted decode and usedexistsSyncwith catch-modified, so quoted conflict paths and fs-probe errors diverged from local. Sharing the desktop parsers in electron-freesrc/sharedremoves that drift.isSparseis an optional JSON field (remote-wire Rule 1). Older clients ignore it. Git hosts older than 2.28 omit the porcelain line, which is the correct absent field.Linked Issue
Fixes #18280
Visual Proof
N/A — no visual or interaction change. Parser-only; SSH list/status JSON may now include optional
isSparseand decoded conflict paths.Testing
pnpm test src/main/git/worktree-list-porcelain.test.ts src/main/git/worktree-porcelain-parsing.test.tspnpm test src/relay/git-handler-utils.test.ts src/relay/git-handler-status-ops.test.ts src/relay/git-handler-worktree-list.test.tspnpm test src/shared/git-unmerged-entry.test.tspnpm tc:nodepnpm run check:code-quality:changedrg "function parseWorktreeList" src— one implementationrg "function parseUnmergedEntry" src— one implementation (desktop/relay re-export)Platforms exercised by tests: macOS (this workspace). Path joins use
path.join. Windows/Linux/SSH hosts run the same shared parser on the execution host.Review
path.joinon the OS that runs Git (native, WSL, or SSH). No hardcodedmetaKeyor POSIX-only separators.git.listWorktreesforwards optionalisSparse. Mixed-version clients ignore the unknown field (Rule 1). Loss of contact is unchanged; this is parse-only.await accessinstead of syncexistsSync. Same cost class as desktop; avoids a falsedeletedon EACCES.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
plans/README.mdwas not updated: this dispatch was instructed not to commit files underplans/.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)