Skip to content

Resolve workspace symlinks so a folder and its link share one engine and project - #2889

Open
jay23606 wants to merge 1 commit into
Agent-Field:devfrom
jay23606:pr-go/1761-workspace-a-folder-reached-through-a-sym
Open

jay23606 wants to merge 1 commit into
Agent-Field:devfrom
jay23606:pr-go/1761-workspace-a-folder-reached-through-a-sym

Conversation

@jay23606

Copy link
Copy Markdown

The bug

A folder and a symlink to it were treated as two workspaces. The engine host named its directory by a hash of the path as spelled, and the project store keyed projects the same way. So /tmp/x and /private/tmp/x (or any linked ~/Code) got two engines and two project entries, and codeaf engine --status / --stop on the link missed the engine that was running.

The change

A workspace is now named by its resolved path (filepath.EvalSymlinks, falling back to the cleaned spelling when the path does not exist yet) wherever it becomes a key:

  • internal/enginehost: the host directory hash in where.
  • internal/gitidentity: ProjectKey.
  • cmd/codeaf/engine.go: engineWorkspace, so --workspace and --dir resolve the same way.
  • internal/tui3/projectcmd.go: a /project pin stores the resolved folder.

How it was tested

  • Regression test TestASymlinkToAWorkspaceHoldsTheSameEngine (internal/enginehost/workspace_symlink_test.go): fails on the base commit with a folder and a symlink to it hold two engines, passes on this change. Commands: go test ./internal/enginehost/ -run TestASymlinkToAWorkspaceHoldsTheSameEngine -count=1.
  • go vet and go test for ./internal/enginehost/ and ./internal/gitidentity/ pass.
  • go build ./cmd/codeaf and go vet ./internal/tui3/ pass.

Not verified here

  • The issue's end-to-end acceptance (/project <link> followed by a launch from the resolved directory, and engine --status/--stop through a link against a running engine) was not run.
  • No regression test covers the gitidentity, cmd/codeaf or tui3 changes directly.

Regression test: fails on base twice (/a folder and a symlink to it hold two engines/), passes on fix twice (go test ./internal/enginehost/ -run TestASymlinkToAWorkspaceHoldsTheSameEngine -count=1)

Fixes #1761

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@santoshkumarradha

Copy link
Copy Markdown
Member

Hey, thanks for the PR. Could you sign the CLA when you get a chance so we can review it?

@jay23606

Copy link
Copy Markdown
Author

I can't sign the Contributor License Agreement on the author's behalf. It has to be signed from the author's GitHub account through the CLA link on this PR. No code changed in this round.

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.

workspace: a folder reached through a symlink becomes two projects and two engines

3 participants