Repository navigation
fix(admin): refuse a TCP allocation the server could never hand out - #12
Merged
Merged
Conversation
The port range lives in the server config and the reservation lives in SQLite, and nothing connected the two: the panel wrote any port it was given, and the deployment only disagreed later, when a client registered and got "requested port 20050 outside range 33000-33020". From the panel's side the allocation looked fine, so the failure read as the allocation having been lost rather than as a port that was never valid. admin.Deployment now carries tcp_port_min/max, and checkTCPPortRange guards both paths that write a reservation. The builder checks before resolving the allocation, so an out-of-range port is refused whether it would be created or adopted from an earlier one — a command promising an address the server cannot serve is worse than no command. A deployment that reports no range is left alone. Refusing an allocation over information the server never gave would be worse than the symptom being fixed, and a pinned session cannot be out of range anyway: its port came from the allocator. /api/server reports the range, so both port fields carry it as their bounds and the browser stops an out-of-range value at the control. `drip admin reservation create` still writes straight to the database and knows no range.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while testing #11 against a local deployment.
The TCP port range lives in the server config and the reservation lives in SQLite, and nothing connected the two. The panel wrote whatever port it was given, and the deployment only disagreed later, when a client registered:
From the panel's side the allocation looked fine, so the failure reads as the allocation having been lost rather than as a port that was never valid in the first place.
The fix
admin.DeploymentcarriesTCPPortMin/TCPPortMax, filled from the server config.checkTCPPortRangeguards both paths that write a reservation —handleCreateReservationand the Patch in builder./api/serverreports the range, so both port fields carry it as theirmin/maxand the browser stops an out-of-range value at the control.Deliberately left alone
drip admin reservation createstill knows no range. It writes straight to the database — this is how the out-of-range rows in my test deployment got there. Closing that would mean teaching the CLI to read the server config, which is a separate decision. Recorded in AGENTS.md.Testing
6 new tests: refusal and acceptance on both paths, the no-range escape hatch, refusing to adopt an out-of-range allocation, and
/api/serverreporting the range.go vetandgo test -race ./...clean.Checked in the panel too: the port placeholder becomes the server's actual minimum, and submitting a port outside the range is stopped at the field before it reaches the API — which refuses it as well.