Repository navigation
feat: the ports of a machine: /v1/ports, /hub/ports, doctor (ADR-0082) - #396
Merged
Merged
Conversation
The first of three steps of review card C. A daemon reports every port its stack holds on this machine, per lane: fixed ports behind their proxy or forward and the lane they lead to, instance ports, containers' published and held ports, and the forwards of lanes on nodes. The hub joins every registered stack's, a stopped one's as its stack file declares them, and lists where two stacks meet; `devstack doctor` warns of each overlap. The mock hub answers both routes. ADR-0082 records the whole card; the graph and the port shift follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
Merged
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.
The first of three pull requests for review card C, the ports of a machine (ADR-0082). It builds point 1. The graph (point 2) and the port shift (points 3–7, #387) follow.
What it adds
GET /v1/ports(daemon). It lists every port the stack holds on this machine, per lane:{"ports": [PortEntry]}withport,proto,lane(mainor the lane's name),kind,holder?,via,target?,target_lane?,node?andlistening.kindis one of:fixed(behind its proxy or forward, and the lane it leads to),instance,published(a container's),held(main_ports), ornode(the forward of a lane on a node)./v1/lanes/<lane>/v1/portslists one lane's.listeningcomes from devstack's own state, not from a probe.GET /hub/ports(hub). For each registered stack it asks the daemon if one runs, or else reads what the stack file declares for the main tree (kind: "declared": the services'port,announced_ports, and localurls). It answers with{stacks, overlaps}.devstack doctorwarns of each overlap (or says there is none). It uses the hub when it runs and reads the daemons and stack files directly otherwise.compose ps).webholds). The types are intypes.ts; there is no view yet.dashboard-api.md, the changelog.Review card (ADR-0070)
Approved by the owner in the conversation on 2026-10-30, points 1 to 7:
GET /v1/ports); the hub joins every stack's (GET /hub/ports) and marks overlaps.[stack] port_offset, which moves the collisionupcolliding with a running stack starts nothing and offers `--shift auto--shift none.Decided by the agent alone, for the whole card: the shift is a multiple of 1000 (
autotakes the lowest one free of every claim, lanes 1–3 included);doctorlists overlaps; a shifted stack's lanes offset from the shifted ports; hard-coded ports do not follow (documented); entries whose folder or stack file is gone are no claim; the stack file does not change.Decided for this PR:
kindandviaare plain strings, passed on as they come.listeningcomes from devstack's state, not from a probe.listening: false.docker compose config; documented./v1/portsgets its declared ports.Tests
cargo fmtandcargo clippy --all-targets -D warningsare clean.devstack-daemon: 179 passed (new: the entry builders, overlaps, declared ports, a lane supervisor's ports).devstack-hub: 99 passed. CLI: 51 passed.devstack-compose: 20 passed.a_worktree_runs_as_a_lane(native Windows,--include-ignored) checks three things: the main tree's fixed ports (apivia proxy,webvia forward), the lane's moved ports, and that/v1/lanes/<lane>/v1/portslists that lane's alone.npm run typecheckis clean;npm test115 passed.devstack doctoron this machine: "no two stacks on this machine share one".🤖 Generated with Claude Code