Repository navigation
T80 — Publish runtime exposures at the registered address, refuse stopped boxes, and say when a port is not yet reachable - #1906
Conversation
A runtime `min net expose` bound at the raw handed loopback address, which is not the address the box's name answers at when the loopback verdict has not vouched for its hand: the hand then publishes at the 127.0.0.1 interim, and a landed verdict can move the registry's publish off the hand. The publish now takes its local address from the hostname registry's published own address — the one source the declared path reads through OwnAddressReporter::published_address — and keeps box_addresses.switch_address as the forward target, with the reported lease standing in for a self-allocated box. A missing publish stays its own typed refusal, never a policy deny. A publish also needs a box standing behind it: a stopped box's record still reads active, but the resurrected actor holds no host, so an expose reaching it is refused with a new NotRunning typed refusal — checked before the switch is asked, and again in the same synchronous step that records the forwarder, so a stop cannot leave a publish behind its unexpose sweep. LiveMapping gains a pending field: a runtime publish is bound on the host but the box's relay gate admits only declared ports, so the serving handler fills the reachability state from the gate's compile set on every read, the CLI renders it as "(pending; not yet reachable)" — as does the in-box publish reply — and the JSON wire shape carries it. Every expose request now leaves exactly one info line: the actor logs each request it sees, and the env channel logs the paths no actor can — a non-numeric port, a session that is gone, and a record that will not read, whose line the actor cannot write because the box's name lives in that record. A record that will not read is its own ExposeFailure arm rather than a publish failure. The pending field also reaches the LiveMapping literal the gvproxy_network test drives, spelled mechanically.
The daemon's switch control socket is one shared path, so the failing-bind stand-in in expose_logs_every_path now takes the socket over from the serving one instead of racing it for the bind. The gone-session refusal logs its reason through %format_args! like the other expose reasons, the record walk behind expose_logs_every_path_from_the_channel filters the sessions directory down to record files, and the per-transport admitted set the reachability fill reads is computed per mapping — the match on the proto enum no longer needs every transport spelled out. The reachability round-trip assertion keeps its expected value in a clone, and rustfmt settles the rest.
…ntime-exposures-at-the-registered-addr
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
/revise Round 1. ARCH design check at bbe1067: CONDITIONS. The core conforms: the published-address bind with no fallback, the double live-host check with unbind,
Add the new test names as |
|
/revise Round 1. ARCH design check at bbe1067: CONDITIONS. The core conforms: the published-address bind with no fallback, the double live-host check with unbind,
Add the new test names as |
…ntime-exposures-at-the-registered-addr
The review round's minimald asks: - ActorGone is its own ExposeFailure arm, not a Publish whose source happens to be ENOTCONN: a dead actor never reached the bind, so a real ENOTCONN out of a bind the actor did attempt is no longer conflated with it, and one request no longer risks two lines. The env channel matches the new arm, and a stand-in actor fixture drives both it and a genuine ENOTCONN through the channel's one-line-per-request test. - The in-box reply appends "not yet reachable" only for ports the box did not declare, decided by the same declared_ingress_ports set the live-ingress list reads -- no parallel list. - A shared-address collision, the shape every box at the 127.0.0.1 interim makes, is the typed bind error naming the port: no forward, no listed mapping, no fallback address -- pinned by a scripted stand-in switch that refuses the duplicate bind. - NoPublishedAddress names only the registry, not the VM host's hand.
The typed-failure batch landed with two lines rustfmt would reflow: the stand-in actor fixture's answer list and the collision test's panic message. No behaviour change — `just fmt-check` was the gate that caught them.
A machine-readable twin for `min session policy`: `-o json` writes one `min/v1/session-policy` document on stdout — the schema stamp a client checks first, the policy's blocks as keys (an own-address box carries its ingress, a host-address box none, a none box only the mode — the same shape decisions the text rendering makes), and the live mappings as the wire's own rows with each one's `pending` state carried. Failures in the mode answer in the same currency: one `min/v1/error` object on stderr — `code` a name a script can branch on (daemon_unreachable / session_not_found / policy_unavailable), `message` the same chain the text mode's error line carries — written by the walk where the kinds can be told apart, and carried to main as the typed `PolicyJsonExit` so the run ends non-zero without printing a second, plain-text line for the same failure. The text rendering is unchanged; its live-ingress fetch moved verbatim into a helper both walks share. main.rs carries the sentinel's downcast and the stdout-contract gate for the json arm, without which tracing would pollute the document.
|
Recovered the round that was quarantined when the pkgs pin bump changed |
|
Approved: no findings at Nothing to do. Clobber: none: |
|
Correction to my earlier note: |
|
/revise Design review (ARCH) at bf08e8f: CONDITIONS. The daemon path passes, and the
Keep every plan test name. |
|
That Round 3 of 6 was not counted; #1878 carries the same sentence. |
|
/revise Design review (ARCH) at bf08e8f: CONDITIONS. The daemon path passes, and the
Keep every plan test name. |
|
That Round 3 of 6 was not counted; #1878 carries the same sentence. |
|
/revise Design review (ARCH) at bf08e8f: CONDITIONS. The daemon path passes, and the
Keep every plan test name. |
…ntime-exposures-at-the-registered-addr
LiveMapping.pending becomes Option<bool>, still defaulted on the wire. A reply from a daemon that predates the field carries no pending key, and that absence decoded as plain false — the reachable reading — before. It now decodes as None, and both renderings spell it rather than failing open: the text row prints "(unknown; daemon predates this field)", the JSON document carries null, and nothing parsing either surface reads the port as reachable. The daemon fills Some(..) at read time, so only a genuinely older daemon answers with the absence. One construction site in net/gvproxy_network.rs rides along — the type change forces its literal, and that file sits outside the task's layer list. Refs #1906
The policy-specific PolicyJsonExit sentinel is gone. A machine-output run now fails its walk into MachineModeFailure — a generic payload of code, message and hint, defined beside the -o flag it keys on — and main.rs holds the single emitter that writes the one min/v1/error object on stderr, gated on the output mode the failed run was under and downcasting the payload, the way it downcasts TaskExit. The next command that takes -o json joins by failing its walk into the payload; it needs no sentinel, no writer, and no change to main. The missing-session code becomes the architecture's not_found, with the kind of thing that was missing in the message and the hint; the object gains a hint field, so every failure answers with what to do about it. daemon_unreachable and policy_unavailable keep their codes. min ls --json is untouched: its failure stays the plain-text line. Refs #1906
# Conflicts: # crates/minimal/src/main.rs # crates/minimald/src/env.rs # crates/minimald/src/session.rs # crates/minimald/src/session/tests.rs
|
A local fixer pushed b5f9e00. It is round 3's quarantined work, which had finished all five asks, plus a merge of main.
Removing needs-human. |
`min session policy -o json` fed the degrading live-ingress fetch into the document unconditionally, so a fetch the daemon could not serve — an older build without the subsystem, a session mid-teardown — rendered as `live_ingress: []`, which the document's own contract reads as the claim that the box published nothing, and put a plain-text warning on the stderr a machine run reserves for its error object. Split the fetch from its text-mode degrade: the JSON walk threads the fetch result and the document renders a failed fetch as `null` — the unknown — never as an authoritative empty list, and only the text walk warns. Pin the tri-state in the document tests: served rows (an empty list included), `null` for an unavailable view, and no key at all for a mode without the surface.
…ntime-exposures-at-the-registered-addr
|
The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was the runtime's review findings). A person decides now. Remove |
…g-up reader with 141 A write or flush failure on the document's own stdout was a plain anyhow error, so a -o json run printed prose on stderr beside the contract's one min/v1/error object. The shared machine-mode path now answers a hung-up reader with a quiet 141 and any other I/O failure with an output_failed object, for every command that takes -o json.
|
Round 1 of 1 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
The T80 proof stands as the earlier rounds left it — a runtime publish answers at the address its declared ports use and the live mapping names it, an expose after Stop is refused as not-running and leaves no forward and no listed mapping, a box with no published address gets an error that is not a policy deny, every expose request leaves one info line whatever its outcome, and Notes from the agent: One review thread, judged valid and fixed by splitting the live fetch (fetch_live_ingress, non-printing, returns Result) from its text-mode degrade (fetch_live_ingress_degrading, still warns and prints no section); the -o json walk threads the fetch result and write_policy_json renders Err as null. The degraded fetch could not be forced deterministically against the test daemon (it serves GetLiveIngress), so the pin is the renderer's tri-state plus the structural fact that only the text walk calls the printing helper. Pre-existing, outside this round's layers, verified identical with my changes stashed: |
…the rest unspecified Any io error in the chain was read as stdout failing, so a config read or socket error would have named the wrong remedy. The policy command now tags its own document write with OutputWriteError, which is all output_failed matches. In a machine mode every other failure is one unspecified object with no hint, never a prose line.
|
/review |
|
The runtime will not revise this pull request again on its own: round 2 would exceed the cap of 1 (the last trigger was a failed check suite). A person decides now. Remove |
There was a problem hiding this comment.
Approved at b3902d3. ARCH PASS, Linux lanes green, minimal-review approved this head, and no open threads.
T80 — Publish runtime exposures at the registered address, refuse stopped boxes, and say when a port is not yet reachable
slice: S13
kind: task
covers: NET-044, NET-047
size: M
est: 220 code, 260 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: the bundle's daemon log tail carries one expose line per request on every path, including a record-read failure and a non-numeric port, with the box, the port as given and the outcome
observability: the existing one-info-line-per-expose-request line, now emitted on every path
layers:
- daemon:
- crates/minimald/src/session.rs: publish_exposed_port takes its local address from the hostname registry's published own address for the box, the source the declared ingress path reads through OwnAddressReporter::published_address, and keeps box_addresses.switch_address as the forward target; no published address or a failed bind there returns a typed error and leaves nothing behind, never falling back to the raw handed loopback address; the Active-with-a-live-host check runs inside the actor in the same step that pushes to live_ingress, so a stop cannot interleave and stop_running's unexpose sweep stays complete; a stopped box gets a new typed ExposeRefusal variant saying it is not running
- crates/minimald/src/net/policy.rs: the no-published-address refusal is its own typed error, never DeniedByPolicy or the deny code; AlreadyPublished is idempotent success or its own code, never the deny code
- crates/minimald/src/env.rs: the record-read failure and the non-numeric port reply each emit the expose info line with the box, the port as given and the outcome
- crates/minimald/src/env_min_helper.sh: until the relay gate admits runtime-published ports, the in-box
min net exposeprints "published; not yet reachable" rather than a bare "published" (message text only)- crates/minimald/src/rpc.rs: the policy handler fills the live mapping's reachability state
- crates/minimald-rpc/src/lib.rs: LiveMapping gains a pending/reachability field
- crates/minimald/src/session/tests.rs: hosts the expose tests
test: cargo nextest run -p minimald expose_publishes_at_the_registered_address
test: cargo nextest run -p minimald expose_on_stopped_box_refused
test: cargo nextest run -p minimald expose_without_published_address_is_not_a_policy_deny
test: cargo nextest run -p minimald expose_logs_every_path
- cli:
- crates/minimal/src/cmd/session.rs:
min session policyshows a live mapping's pending state in both its text and its JSON outputtest: cargo nextest run -p minimal policy_shows_pending_live_mapping
produces: none
consumes:
- crates/minimald/src/session.rs
- crates/minimald-rpc/src/lib.rs
proof: A box whose hand the loopback verdict has not vouched for publishes its runtime port at the same address its declared ports use and the live mapping names that address; an expose after Stop is refused with a not-running error and leaves no forward and no listed mapping; a box with no published address gets an error that is not a policy deny; every expose request, failed reads and bad ports included, leaves one info line; and
min session policytext and JSON both show a runtime mapping as pending until the gate admits it.Proof
A runtime
min net exposeon a box whose hand the loopback verdict has not vouched for now publishes at the same address its declared ports use — the hostname registry's published own address, never the raw handed loopback — and the live mapping names that address; an expose after Stop is refused with the new not-running error and leaves no forward and no listed mapping; a box with no published address gets a refusal of its own that is not a policy deny; every expose request, failed record reads and non-numeric ports included, leaves one info line naming the box and the port as given; andmin session policyshows a runtime mapping aspending; not yet reachablein both its text and its JSON until the relay gate's admitted set grows to admit it.Notes from the agent: env_min_helper.sh (a named layer) needed no edit: its
msg)case echoes the daemon's reply verbatim, so the 'published; not yet reachable' message is carried by the new reply text in env.rs (msg:pub 8000 lished port {} at {}; not yet reachable) — the note in the layer is message text only, and the message a user sees in the box is exactly that line. One file outside the named layers was touched: crates/minimald/src/net/gvproxy_network.rs, a mechanical one-line test-module fix — aLiveMappingliteral in aRuntimeIngress::record(...)call gained the new non-optionalpending: falsefield; no production code in that file changed. crates/minimald/src/net/provider.rs only stores and clonesLiveMappingand needed no change. The daemon's switch control socket is one shared path across sessions, soexpose_logs_every_pathsequences its two switch stand-ins (the serving one is aborted and the socket file removed before the failing-bind one binds) rather than binding both at once. Beyond the five task lines: one whole-crate run each of the two crates the shared-type change could ripple through (minimald 652 passed, minimald-rpc 51 passed), `cargo clippy -p minimald -p minimald-rpc -p minimal …[truncated]Tests
cargo nextest run -p minimald expose_publishes_at_the_registered_addresscargo nextest run -p minimald expose_on_stopped_box_refusedcargo nextest run -p minimald expose_without_published_address_is_not_a_policy_denycargo nextest run -p minimald expose_logs_every_pathcargo nextest run -p minimal policy_shows_pending_live_mappingVerify
min task run agent-verifypassed ([tasks.verify]).Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimald/src/net/gvproxy_network.rsCloses #1878