Skip to content

fix: show allocation directory in --list instead of Docker Cwd#81

Merged
dapi merged 3 commits intomasterfrom
fix/list-docker-directory
Mar 2, 2026
Merged

fix: show allocation directory in --list instead of Docker Cwd#81
dapi merged 3 commits intomasterfrom
fix/list-docker-directory

Conversation

@dapi
Copy link
Owner

@dapi dapi commented Mar 2, 2026

Summary

  • --list no longer replaces the allocation directory with the Docker container's working directory. Previously, when Docker from another project hijacked an allocated port, the user saw a foreign directory and couldn't tell the port was actually theirs.
  • Adds a warning to stderr when returning a busy port for an existing allocation (warning: port 3018 is busy (docker-proxy); use --forget to get a new port), so the user knows what to do.

Context

Root cause investigation via logs confirmed: port 3018 was allocated to ~/code/alfagen/mercury, then Docker from a feature branch bound to it. --list showed the Docker container's Cwd, making it look like the port belonged to a different project.

Test plan

  • port-selector --list shows the allocation's saved directory, not Docker's Cwd
  • When a port is busy, port-selector outputs a warning to stderr with process name
  • Existing tests pass (go test ./...)

🤖 Generated with Claude Code

Previously, --list replaced the allocation's saved directory with the
Docker container's working directory. This was confusing when Docker
from another project hijacked an allocated port — the user saw a
foreign directory and couldn't tell the port was actually theirs.

Also adds a warning to stderr when returning a busy port for an
existing allocation, so the user knows the port is occupied and
can use --forget to get a new one.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dapi and others added 2 commits March 2, 2026 10:48
Extends TestPortSelector_ReturnsSamePortEvenWhenBusy to verify that
when a port is busy, stderr contains "warning: port ... is busy"
with a --forget hint for the user.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove extra blank lines in allocations_test.go (gofmt)
- Remove unused fmt.Sscanf call and fmt import in main_test.go (errcheck)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dapi dapi merged commit bd4d5d8 into master Mar 2, 2026
7 checks passed
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.

1 participant