Skip to content

tests: apply the mapping table and start the sandbox in the adapter's worker - #872

Open
Enrique Saurez (esaurez) wants to merge 1 commit into
devfrom
esaurez/822-pr06-guest-order-20261023
Open

Enrique Saurez (esaurez) wants to merge 1 commit into
devfrom
esaurez/822-pr06-guest-order-20261023

Conversation

@esaurez

@esaurez Enrique Saurez (esaurez) commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Part of #822 (PR 6 of 11: the guest's order).

The runtime adapter's worker answered Ready once it assembled its root, then ran the host's executions at once: it had no host export to map from, took no mapping table, and nothing told it when the sandbox's workloads could start, so an execution could run on a root whose mappings were missing.

Changes

  • After the assembly, the worker mounts the host export that the kernel command line names, with nvx::protocol::export::HostExport::parse and Root::mount_export, then answers Ready.
  • It applies the parts of the host's mapping table in order, with Root::map, from the export, and answers each Maps with Mapped or MapFailed. A part that does not decode, or does not continue the table whose length the root configuration's mapping count announces, is refused as a whole. A mapping that the root refuses or fails to apply latches the root, and the worker refuses every later part.
  • Start, which the worker confirms with Started, comes once every announced mapping is applied, and only then does the worker run executions. An execution before the start, a premature or second Start, and a part after the start end the session. A table of zero mappings does no work.
  • The layout stage refuses a mapping count without an export, and export tokens that break their rules. An export that fails to mount fails the assembly. The root operations gain mount_export and map, which the tests' fake root records.

Tests

tests/guest_session.rs, with a fake root: the export and the order; a table applied in parts across a session reset, then the start; zero mappings, with and without an export; parts that do not continue the table; a mapping that the root refuses, which latches the root; and executions, Start, and parts refused out of order.

Validation

On dev at b69f40b, with #822's PRs 1-5 merged:

  • Linux: the adapter's protocol-only, host-only, and guest-only (static musl) configurations (fmt, clippy, build, tests, MSRV).
  • Windows: the protocol-only and host-only configurations (fmt, clippy, build, tests, MSRV).
  • VM suites (vm_layered 25, vm_restart 2, vm_steps 3): WHP 30/30 and MSHV 30/30. KVM runs in CI.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues were identified in the guest-side ordering, mapping failure handling, export lifecycle, or accompanying tests.

No open issues 🎉

What changed in this PR

Implements the guest-side sequencing for #822’s runtime adapter: mount the host export, apply the mapping table, and require Start before running executions.

Changes:

  • Mounts and validates the host export before reporting Ready.
  • Enforces mapping order and completion, blocks startup after mapping failures, and preserves progress across session resets.
  • Adds session tests and documents the updated worker lifecycle.
File Description
tests/​runtime-adapter/​tests/​guest_session.rs Tests export mounting, mapping progress, failures, resets, and startup ordering.
tests/​runtime-adapter/​src/​worker/​order.rs Adds mapping progress and sandbox startup state handling.
tests/​runtime-adapter/​src/​worker.rs Integrates export mounting, mapping operations, execution gating, and export cleanup.
tests/​runtime-adapter/​src/​lib.rs Updates the adapter overview for mappings and explicit startup.
tests/​runtime-adapter/​README.md Documents sequencing rules, failure handling, and test coverage.

Review effort: Balanced

… worker

The runtime adapter's worker answered Ready once it assembled its root, then
ran the host's executions at once: it had no host export to map from, took
no mapping table, and nothing told it when the sandbox's workloads could
start, so an execution could run on a root whose mappings were missing.

After the assembly, the worker now mounts the host export that the kernel
command line names, with nvx::protocol::export::HostExport::parse and
Root::mount_export, then answers Ready. It applies the parts of the host's
mapping table in order, with Root::map, from the export, and answers each
with Mapped or MapFailed. A part that does not decode or does not continue
the table, whose length the root configuration's mapping count announces,
is refused as a whole; a mapping that the root refuses or fails to apply
latches the root, and the worker refuses every later part. Start, which the
worker confirms with Started, comes once every announced mapping is applied,
and only then does the worker run executions: an execution before the
start, a premature or second Start, and a part after the start end its
session. A table of zero mappings does no work.

The layout stage refuses a mapping count without an export, and export
tokens that break their rules; an export that fails to mount fails the
assembly. The root operations gain mount_export and map, which the tests'
fake root records.

Part of #822.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 04632931-537b-49f9-acc9-b12024ad6f3a
@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/822-pr06-guest-order-20261023 branch from 597cd3a to e3071ec Compare October 25, 2026 16:26
Copilot AI balanced review requested due to automatic review settings October 25, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The ordering and export lifecycle match the guest-side scope, with targeted regression coverage and no blocking issues identified.

No open issues 🎉

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants