Skip to content

fix: expand ~ and relative paths in Add Repository - #578

Open
vc1492a wants to merge 1 commit into
dcouple:mainfrom
vc1492a:fix/expand-user-repo-paths
Open

fix: expand ~ and relative paths in Add Repository#578
vc1492a wants to merge 1 commit into
dcouple:mainfrom
vc1492a:fix/expand-user-repo-paths

Conversation

@vc1492a

@vc1492a vc1492a commented Sep 3, 2026

Copy link
Copy Markdown

Description

Fixes Add Repository so typed ~/… and relative paths resolve before detect-branch, project create, and RunPane repo validation. Also stops projects:detect-branch from reporting a fake main when detection fails (UI now shows a failure state).

Closes #577

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (N/A beyond in-app tooltip update in AddProjectDialog — no markdown/docs pages referenced the absolute-only wording)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (see QA notes: issue-specific + frontend green; full main suite has 4 unrelated skillCacheManager failures)
  • I have run pnpm typecheck and pnpm lint locally (Node 22.18.0)
  • I have tested the Electron app locally with pnpm electron-dev (needs human GUI probes below)

Critical Areas Modified

  • Session output handling (requires explicit permission)
  • Timestamp handling
  • State management/IPC events (touched projects:create / projects:detect-branch and RunPane repo-path validation to expand paths; no session-output changes)
  • Diff viewer CSS

Additional Notes

Behavior choices reviewers should know:

  • Relative paths resolve against $HOME, not Electron/process cwd (avoids creating repos under / or the app directory).
  • Existing paths are realpath’d when present (e.g. /tmp/private/tmp on macOS), so stored paths become canonical.
  • WSL UNC paths (\\wsl.localhost\…, \\wsl$\…) are left unchanged so parseWSLPath still works.
  • Create remains allowed when branch detection fails (pre-existing product behavior); only the fake-main lie is removed.
  • Remote session dialog’s local main fallback is intentionally untouched.

Manual probes (still need a human in pnpm electron-dev):

  • Type ~/path/to/real-repo → Detected Branch matches git branch --show-current; create stores the realpath.
  • Bogus path → no Detected Branch main.
  • Browse-picked absolute path still works.
  • runpane repos add --path '~/…' after this build.

Automated QA (2026-09-03, head 91d13835, Node 22.18.0)

Check Result
pnpm typecheck pass
pnpm lint pass (Node 22.18 required for oxlint TS plugin)
Issue-specific Vitest (pathResolver + detectProjectBranch) 13/13 pass
CI=1 pnpm --filter frontend test 327/327 pass
pnpm rebuild better-sqlite3-multiple-ciphers + CI=1 pnpm --filter main exec vitest run 902 pass / 4 fail / 2 skip — failures only in skillCacheManager.test.ts (Pane Chat guide / idle watcher), unrelated to path expansion
GitHub Actions Code Quality + React Doctor blocked: action_required (first-time contributor workflow approval)
Socket Security pass

No review threads yet.

Resolve home and relative repo paths before detect-branch, create, and RunPane validation, and stop reporting a fake main branch when detection fails.

Closes dcouple#577

Co-authored-by: Cursor <cursoragent@cursor.com>
@vc1492a

vc1492a commented Sep 3, 2026

Copy link
Copy Markdown
Author

Status update from contributor automation

Local verification on head 91d13835 (Node 22.18.0):

  • pnpm typecheck
  • pnpm lint
  • Issue-specific tests ✅ 13/13
  • Frontend unit tests ✅ 327/327
  • Full main Vitest: 902 passed; 4 failures in skillCacheManager.test.ts only (unrelated to this path-expansion change)

Needs a maintainer (cannot do from this fork account):

  1. Approve / enable the pending GitHub Actions workflows for this first-time contributor PR (Code Quality + React Doctor are currently action_required):
  2. Optional: GUI smoke of Add Repository with ~/… / bogus path / Browse after CI is green (pnpm electron-dev).

Happy to address review feedback once CI can run.

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.

fix: expand ~ and relative paths in Add Repository

1 participant