Repository navigation
T73 — Surface the host's classifier verdict on the create response and in the CLI - #1877
norrietaylor merged 40 commits into
Conversation
The wire half of the NET-079 create-time verdict: the create response gains a classifier advisory — the host's cause in words, the state it leaves the box in, and the exact command that ends the cause when one can — and a per-box egress enforcement attribute in the machine spelling the launch's record uses, so a client can say at once what a host-address box runs under while the host cannot decide per box. Both default to None, so a daemon that predates them decodes as absence, and a host that decides says nothing: absence is silence, never a decided verdict. A test pins the step-missing spelling (cause plus command), the cannot-confine silence (cause, no command), the decided host's enforcement, and the pre-field reply an old client would have sent.
The create handler reads the host's classifier verdict fresh — the same facts the start-up line and each launch read, on the blocking pool — and answers with what it yields: the advisory a start prints (spelled here, on the one side that read the host, so the log line, the reply and the start agree by construction, and never a prompt), and the per-box egress enforcement, recorded onto the record under egress_enforcement so the state outlives the reply. Only a host-address box carries the enforcement; the advisory rides every create on a host that cannot decide. One info line per advisory-carrying create names the cause, the command when one applies, and the enforcement recorded, so the bundle's log tail carries what every create told the terminal. Tests build the stand-in facts both causes need — the step's cohort without the table's marker on a confining mount, and the same cohort on one that cannot confine — and answer over them, pinning the install-bearing advisory, the install-less one, the absence of any question, the one-line log, the deny-all box's reply and record saying none, an own-address box's record saying nothing, and the decided host's pure half.
The install command now ends the advisory with nothing after it, so the line a person copies from the terminal is the command, verbatim — no trailing period glued to it. The log line keeps the advisory whole in one physical line, as a Debug-escaped field beside the cause, the command, and the enforcement it recorded: the terminal gets the two-line spelling, the bundle's tail gets the same text without the event wrapping across lines. The stand-in installers go public like the loopback probe's, so the library target has no dead seam, and their doc names the mutex their windows take. The tests take that mutex for the whole install→create→assert→clear window and attribute their log assertions by session id, so the shared-process runner and the shared capture buffer stay as safe as the probe tests' own.
The activation prints the advisory a create reply carries, verbatim — the daemon's own spelling, because the daemon is the side that read the host, so the terminal, the daemon's log line for the same create, and the start cannot disagree. With the exact command that installs the classifier's privileged step when the step is the cause; and it is never a prompt: the line names what a person may run and the activation goes on without waiting for an answer. Printed after the session exists and before the work on it, like the deny-all notice beside it. A host that decides per box, or a daemon that predates the field, carries no advisory and prints none.
The strict gate holds changed lines to a standard the tree is not yet clean for: the stand-in installers take their lock the poisoned-lock way instead of unwrapping it, and the two tests' await-holding-lock suppressions become expectations with the reason they hold it for.
…e-host-s-classifier-verdict-on-the-cre
|
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 |
…e-host-s-classifier-verdict-on-the-cre # Conflicts: # crates/minimal/src/cmd/session.rs
|
/revise Round 2. Allowed files:
Do not touch other files.
Keep the three plan test lines and every existing test passing, and re-run them. The PR body is edited by hand; do not rewrite it. |
|
That Round 2 of 6 was not counted; #1806 carries the same sentence. |
|
/revise Round 2. Allowed files:
Do not touch other files.
Keep the three plan test lines and every existing test passing, and re-run them. The PR body is edited by hand; do not rewrite it. |
…e-host-s-classifier-verdict-on-the-cre
…e-host-s-classifier-verdict-on-the-cre
|
Round 2 of 6 on a /revise note: the coder changed nothing. every commit this round put on the branch above |
|
/revise Round 3. Round 2 committed nothing. The coder spent its time weighing whether adding a field to Scope ruling (babysitter). Ask 3 requires the attribute on
The only out-of-layer logic change allowed is round 2's Order of work:
Commit after each step, so a timeout still leaves work on the branch. |
…e-host-s-classifier-verdict-on-the-cre
…aces
Round 1 put NET-079's per-box enforcement on the create reply alone, as
`egress_enforcement`; T48's launch and the daemon's own log line already
spelled the machine word `host_ip_enforcement`, so the reply and the
record attr now use the one spelling a script greps for.
The state joins the surfaces that read a session after the create, each
off the record the create wrote it on: a listing entry (boxed the way
`git` is, so the picker enums that copy rows by value stay under
clippy's large-variant threshold), the effective-policy reply that
`min session policy` renders, and that render's own egress block, which
prints the value verbatim beside the rules it qualifies — `deny all`
with an enforcement of `none` says the state the box actually runs in.
`EffectiveSessionPolicy` drops `deny_unknown_fields` for this: its
`egress` is required, so the daemon's `{"error": ...}` reply still falls
through the untagged `Errorable`'s Ok arm without it, while an older
client must still decode a newer daemon's reply that carries the new
key.
The `ListSessionsEntry` fixtures outside this task's layers get the
mechanical `host_ip_enforcement: None` only.
The launch and the create response each had a private spawn_blocking read of the classifier fact — the same tree, the same live mount table, the same fresh decision over the table's effect — spelled twice, so the two could drift: a create that answered over one table while the launch that followed it answered over another would hand a start an advisory its own launch disagrees with. The read is now the one shared fact, `session_host::re_read_classifier_fact`, carrying the mount table back out beside the decision because the launch's placement answers over the same one table the decision did. The create path's private copy goes; its stand-in pair now rides the knob the shared read carries, and the production path's own mount-table read moves inside the one blocking hop, off the async worker a session is being created on. A read that never runs stays each caller's own cause to name: the launch refuses to place over it, the create reports the host as unable to decide and never as deciding.
The create reply's enforcement state was proven alone with the record attr beneath it; the listing and the effective-policy reply that read the same record were left to trust the fill. The cross-surface test now drives all of them over the same deny-all host-address session on a host that cannot decide per box: the create reply, the listing entry, and the policy reply all say `none`, the policy reply carrying it beside the declared deny-all it qualifies — the state the box runs in, not a verdict that looks decided and is not. The own-address control shows nothing on every surface too, not only the record: its verdict was decided on address leases, so there is no per-box state to say.
…olds The advisory's closing clause — "whatever the boxes' declarations say" — was appended to every cause, but it holds only natively, and only for the causes the step or the host's mount can end: over the two probe causes a deny-all host-address box is refused at placement, and in the guest every cause refuses, so the clause denied the refusal a person was about to hit. It now rides only on the causes whose box outcome names no refusals — the same set the classifier spells "run unenforced" for — so the clause and the outcome it qualifies cannot drift apart. The probe-cause advisories are pinned pure, no stand-in can produce either: they name the refusal, the table an install would reload still names the command, the probe no command can make run names none, and the guest advisory carries no clause on any cause.
The activate test pinned the advisory by asking the accessor for the field and asserting it equalled the field — a tautology that would pass whatever the start printed. The advisory is now a writer over the reply, the same one `min session activate` drives on stderr, and the test drives it with a buffer: it pins the bytes the terminal gets, the daemon's spelling opening the line, the command ending it with nothing after, and not one byte from a decided host or a pre-field daemon. The policy render's new enforcement row gets the same treatment beside its existing fixtures: `deny all` with `per-box enforcement none` — the state the box runs in — the decided host's `per_box` on the same row, and no row from silence.
…e-host-s-classifier-verdict-on-the-cre
|
Round 3 of 6 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. On a host that cannot decide per box, a session start still names the cause and carries the install command only for the missing step, never prompts — and the box's listing entry and the Notes from the agent: Scope ruling, as directed: the eight approved files got exactly the mechanical update — Two files sit outside the task's layers, each for a reason the directive itself supplies: crates/minimald/src/session_host.rs — round 2's sanctioned re-read, extracted into the shared |
|
/revise Round 4. Round 3 did the mechanical work and passes the three plan tests, but it rebuilt the per-create design round 2 rejected. It re-runs
Run the plan's test lines, the new ones above and |
…e-host-s-classifier-verdict-on-the-cre
The daemon now keeps exactly one fact about NET-079's per-box enforcement: whether this host can decide a host-address box's egress verdict per box, and — while it cannot — the cause. The start-up read seeds it and each host-address launch's own re-read refreshes it, because the fact it rests on is the loaded table's effect, which does not outlive the table. Every surface that shows a session derives its answer from that fact at read time, so no surface can show a state a re-read has replaced: the listing entry (now the typed HostIpEnforcement enum rather than a stringly box), the effective-policy reply 'min session policy' renders, and the create reply, which states the same fact instead of probing. The create-time decision machinery is gone: a create is not a place that decides a box, so it reads the fact the launch before it will refresh. Nothing about enforcement is written into a record — the state is the host's, not the session's — and the daemon's own 'host_ip_enforcement' attr key is stripped from a create's attrs unconditionally, for every network mode, so no client can hand the read surfaces a state of its own choosing. Each surface's derivation shares the launch's own refusal gate, so a box the classifier refuses — the deny-all box over either probe cause — shows nothing, exactly as its launch refused it, and a box whose verdict is decided on address leases (own-address, none) shows nothing anywhere. The advisory rides the create reply only where it applies: a host-address create on a daemon that is not itself a microVM's guest. The fact lives as a process-global cell rather than a field on the server's state, because the start-up read that seeds it runs before any server exists; the probe-test mutex moves to the module that owns the fact, so the launch tests that write it and the RPC tests that read it serialize on one guard. 'deny_unknown_fields' returns to EffectiveSessionPolicy, with the new field still on it: its egress is required, so the daemon's error reply still falls through the untagged Errorable's Ok arm, and an older client must keep decoding a newer daemon's reply. The field stays stringly there and on the create reply — 'sessions' cannot see minimald-rpc's enum, and the typed change the round asks for is the listing entry's.
…e-host-s-classifier-verdict-on-the-cre
|
Taking this out of draft. A local fixer pushed e1f9a7e with six commits:
Both open threads are addressed at this head. The refusal text that disagrees with the install-command rule is pre-existing on main and is tracked in gominimal/inbox#861. |
|
The runtime will not revise this pull request again on its own: round 8 would exceed the cap of 1 (the last trigger was the runtime's review findings). A person decides now. Remove |
…ing again Re-running the install replaces the classifier table in one nft -f transaction (add, delete, re-declare), so it is the known reload for a table installed but not refusing. This reverts 23ed982, so the advisory and the launch refusal name the same remedy.
…M egress cell The not-refusing table's remedy rests on the batch opening with add and delete table before re-declaring it, so that prelude is asserted on the installer's own --print-ruleset output. The multi-VM min ls table gets the EGRESS assertion the single-VM one has.
norrietaylor
left a comment
There was a problem hiding this comment.
Approved at f619287. ARCH PASS, CI green, minimal-review approved this head, and no open threads.
|
/arch-review |
|
/arch-review f5da026 |
|
/arch-review |
2 similar comments
|
/arch-review |
|
/arch-review |
|
/arch-review f5da026 |
T73 — Surface the host's classifier verdict on the create response and in the CLI
slice: S11
kind: task
covers: none
size: S
est: 120 code, 120 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: the bundle's daemon log tail carries the advisory each create response carried and the enforcement attribute recorded for each host-address box
observability: one info log line per create response that carries the advisory, naming the cause
layers:
- daemon:
- crates/minimald-rpc/src/lib.rs: the create response gains a defaulted classifier advisory and the per-box enforcement attribute; an old client decodes a reply without them
- crates/minimald/src/rpc.rs: fills the advisory and the per-box enforcement attribute on the create response from the start-up fact T48 records (a deny-all box running unenforced shows egress enforcement none in its listing and spec while the host cannot decide per box; the state outlives the activate message)
test: cargo nextest run -p minimald native_host_advises_classifier_install_without_prompt
test: cargo nextest run -p minimald create_response_shows_enforcement_none_while_the_host_cannot_decide
- cli:
- crates/minimal/src/cmd/session.rs: prints the advisory with the install command when the missing privileged step is the cause, and never prompts
test: cargo nextest run -p minimal activate_prints_classifier_advisory
produces: none
consumes:
- crates/minimald/src/net/classifier.rs
proof: On a host that cannot decide per box, session start names the cause, prints the install command only when the missing step is the cause, never prompts, and the box's listing and spec show egress enforcement none until the host can decide.
depends on:
- blocked by #1631
Out of time
The coder ran out of its 7200s before it finished. If it left work uncommitted, its last commit is the runtime's snapshot of that work as it stood — the commit message says so — and not a finished step: it may not build or pass its tests. So this PR is a draft.
Proof
On a host that cannot decide per box, session start names the cause, prints the install command only when the missing step is the cause, never prompts, and the box's listing and spec show egress enforcement none until the host can decide.
Tests
cargo nextest run -p minimald native_host_advises_classifier_install_without_promptcargo nextest run -p minimald create_response_shows_enforcement_none_while_the_host_cannot_decidecargo nextest run -p minimal activate_prints_classifier_advisoryVerify
min task run agent-verifyexited 100, so this PR is a draft.Base
The base branch moved while the coder worked and was merged in before the tests ran. These files changed on BOTH sides since the branch point — read them first, because a rewrite from a stale reading can undo a merge without a conflict:
crates/minimal/src/cmd/session.rsCloses #1806