Expose a sandbox port from the sandbox page - #1
Merged
Merged
Conversation
Starting a dev server in a sandbox meant dropping into the shell, running a command, and reading the URL out of its output. Nothing on the page said what the sandbox was serving or where. A Ports strip sits above the terminal: a row per exposed port with its address as a link, copy and remove beside it, and an input to expose another. Only while there is a workload -- exposures belong to it, so a stopped sandbox has none. Ports are keyed by workload rather than by sandbox, because a restart makes them a different set even though the sandbox is the same. The list is not live. Expose publishes no notification events, so a port exposed from inside the shell surfaces on the next refetch -- mount, this component's own mutations, or the workload changing. parsePort refuses anything that is not purely digits rather than coercing: 3000x is a typo, and exposing port 3000 for someone who meant something else gives them no way to tell from the result. The strip states the two things the page cannot otherwise tell you -- the address resolves only on an enrolled device, and anyone else on the platform network can reach it.
The strip repeated the full host on every row, which is redundant: an address is derived from the sandbox, so every port shares one host. Factoring it out collapses a row to its port, and the whole set then fits in the header beside the clocks -- so the terminal keeps the vertical space a second strip was taking. The chip is present whenever the sandbox is running, reading "None" with nothing exposed. Hiding it until the first port would be cleaner and would leave nobody a way to find the feature. Expose is a ghost row rather than an input and a button: two boxy controls in a popover of rows read as pasted in. At rest it matches the rows above it; clicking turns the row itself into an inline field that submits on Enter and cancels on Escape. Re-exposing an existing port is not an error. The service returns the record it already has, so the editor closes and that port pulses instead of an error appearing for something that worked. A refusal stays in the row with a retry rather than becoming a toast, which would outlive the popover and detach from what caused it. The empty popover drops the host line and the reachability notice -- neither says anything until there is an address.
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.
Needs agynio/expose#37 — without it a browser cannot expose or remove a port at all.
Starting a dev server in a sandbox meant dropping into the shell, running a command, and reading the URL out of its output. Nothing on the page said what the sandbox was serving or where.
Shape
Ports live in a header chip beside the clocks, not a strip of their own. An address is derived from the sandbox, so every port shares one host — factoring it out collapses a row to its port, and the whole set then fits in the header. The terminal keeps the vertical space a second strip was taking.
The chip is present whenever the sandbox is running, reading "None" with nothing exposed. Hiding it until the first port would be cleaner and would leave nobody a way to find the feature.
Behind it, a popover: the host once, one row per port (link, copy, remove), the expose control, and the reachability notice.
The expose control is a ghost row
Two boxy controls in a popover of rows read as pasted in. At rest it matches the rows above it; clicking turns the row itself into an inline field that submits on Enter and cancels on Escape.
States worth reviewing
57 tests, lint and typecheck clean. Deployed from source and checked in the browser.
Spec: agynio/architecture#179 (merged).