Skip to content

host: move snapshot metadata to its own names - #1345

Merged
Pedro Henrique Penna (ppenna) merged 3 commits into
feature/nvx-refactorfrom
esaurez/slim-2.3.2-sl2.12a-publication-20261107
Nov 8, 2026
Merged

Pedro Henrique Penna (ppenna) merged 3 commits into
feature/nvx-refactorfrom
esaurez/slim-2.3.2-sl2.12a-publication-20261107

Conversation

@esaurez

@esaurez Enrique Saurez (esaurez) commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1102

Move the existing key, manifest, canonical codecs, and time eligibility from
host::template to host::snapshot. The public types are SnapshotKey and
SnapshotManifest; the template names remain aliases of the same types.

The key drops its separate guest_build field and uses the
nvx snapshot key\0 hash domain. Its runtime identity is unchanged.
Version 1 changes in place, without a prior-format decoder or migration:
snapshots do not survive a deployment. CaptureClass still holds the guest
build and retains its encoding and identity domain. Manifest validation,
geometry checks, and time eligibility are unchanged.

This metadata slice is based on landed #1331 at 3ad5e49d on
feature/nvx-refactor, retaining the capture configuration merged in #1275.
Only the three metadata commits remain; the inherited parent commits are
already landed. It adds the metadata module, not VM
preparation, spawning, the opaque VM snapshot input, Snapshot::open, or
Snapshot::accepts.

Public API and size

Both generated API snapshots add the same 113 metadata items under
host::snapshot. The key, manifest, clock, time, eligibility, downtime, and
manifest limits stay public, and the legacy template aliases stay available.
The only removed legacy API item is TemplateKey::guest_build.

The complete three-commit change measures 36 core lines in 5 counted files,
28 changed paths
, including all moves, tests, fixtures, documentation, and
generated API snapshots. No manual exclusions are applied.

The three commits retain the metadata move and its corrections. Validation
covers the final combined head, not the intermediate commits.

Tests

The complete comparison against 3f217d54 reports 44 changes to existing
test assets, 120 unchanged relocations, and 5 added items
. Existing coverage
is retained apart from the deliberately removed key guest-build field:

Existing asset Disposition and reason
template/{canonical,wire,eligibility}/tests.rs Kept unchanged under snapshot/, with the same test configuration and assertions.
template/key/tests.rs: manifest, key, network_key, assert_mismatched, key_refusal, VECTORS Moved and updated for the new metadata names, fixture owner, diagnostics, and vector path.
Key tests: each_part_of_the_key_changes_it, each_contract_version_changes_the_key, a_key_holds_what_its_capture_made Rewritten for SnapshotKey and the deliberate absence of key guest-build data; all remaining key fields and contract checks are kept.
Key tests: a_capture_that_does_not_match_its_class_is_refused, invalid_classes_are_refused Kept substantively unchanged, with the new type paths.
Key tests: keys_read_back_from_their_canonical_encoding, other_encodings_of_a_key_are_refused, a_key_that_holds_its_network_s_lowering_after_its_invariants_is_refused, keys_of_machines_that_no_manifest_describes_are_refused, the_conformance_vectors_decode_and_encode Updated for the specified in-place encoding and hash domain. Round trips, malformed inputs, strict ordering, geometry refusals, and independent conformance expectations remain covered.
template/manifest/tests.rs: parse, refusal, read_refusal; the_fields_of_a_manifest_need_not_be_written_in_their_order, truncated_manifests_are_refused, the_manifests_that_openvmm_writes_are_read, read_reads_the_manifest_of_a_snapshot, read_refuses_a_fifo_without_waiting_for_a_writer Moved and updated to SnapshotManifest and the snapshot fixture paths. Parsing, truncation, actual OpenVMM fixture, bounded file-read, and FIFO assertions are unchanged.
Shared fixture helpers: DeviceSpec, AttachmentSpec, NetworkSpec, BlockSpec, TimeSpec, CpuSpec, ManifestSpec, ContractSpec in template/tests.rs Moved to snapshot/tests.rs; host-private visibility keeps the remaining template tests using the same fixtures.
Imports in template/clone/tests.rs, template/clone/tests/launch.rs, template/store/capture/tests.rs, template/store/leases/tests.rs, template/store/tests.rs Repointed to the relocated shared metadata fixtures, without changing the cases.
Store helpers publish_for_tests and publish_spec_for_tests Updated metadata paths only; publication behavior is unchanged.
Clone test keys_of_another_encoding_version_are_failures_of_the_host_that_quarantine_nothing The diagnostic now names the snapshot key. Error code, evidence, host attribution, and quarantine assertions remain intact.
runtime-adapter/tests/vm_template.rs::assert_captured Retired only the obsolete key guest-build getter assertion. Runtime identity and machine assertions remain.
Former imports in template/key/tests.rs and template/manifest/tests.rs Replaced by the moved modules' snapshot imports; no test module or coverage is removed.
tests/vectors/template-key-v1.txt Replaced by snapshot-key-v1.txt from the specified encoding: remove the guest-build key field and recompute key hashes with the new domain. Existing malformed/version cases remain; capture-class vectors are unchanged.

Two focused regressions additionally prove that different capture-class guest
builds change the class identity but not the snapshot key, including through
the legacy alias, and that keys carrying the removed field are refused by
both names. The existing key-identity/lease-parser parity assertion is kept
unchanged. The production module-layering test is also unchanged.

Validation

Checks below ran at 89db081f205ce4974cb1604b8a968fc12a82829d and are
reused for history-only restack 1106886aa8e397113aac4f5cc4f148656f766c53.
Every original metadata commit retains its source tree. The final source tree
00af53fda3873714ca07fb6d16e8914e3bc727db and effective parent tree
8c7a51d779b777a9993c20dcac8c295def316775 are unchanged, as is the pinned
native input. No check is claimed rerun at the new commit ID.

  • Windows metadata/template selection: 255 passed, 5 existing role entries
    ignored; Linux: 254 passed, 5 existing role entries ignored.
  • On each OS, the unchanged module-layering suite passed all 22 cases, and
    the fake-VMM capture/creation/recovery suite passed 6 cases with 1 existing
    subprocess role ignored.
  • Both source/native verifications, both crate format checks, test layout,
    Markdown links, and the complete test-change inventory passed.
  • Actual pinned-rustdoc API checks matched both Linux and Windows snapshots.
    The macOS all-target/all-feature cross-check passed with existing warnings
    in unsupported-host test paths.
  • The five feature-specific Clippy configurations, warning-denied docs,
    and Rust 1.89 checks passed on both OSes. The independent adapter passed
    49 protocol tests on each OS, 128 host tests on Windows, and 127 on Linux;
    its lint, docs, and MSRV configurations also passed on both.
  • Independent source review found no blocking correctness or scope issues.

No hardware-backed VM matrix was run for this metadata-only slice. The
adapter's 92 existing native-VM cases remain ignored, not passing. This Draft
does not claim CI, native runtime, or merge readiness.

@esaurez Enrique Saurez (esaurez) added tests-modified Changes existing tests, test data, or test wiring feat-nvx-refactor labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It modifies or removes 44 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests.

Test code

Change What Before After
modified helper fn manifest in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:12 nvx-rs/src/host/snapshot/key/tests.rs:12
modified helper fn key in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:18 nvx-rs/src/host/snapshot/key/tests.rs:18
modified helper fn network_key in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:23 nvx-rs/src/host/snapshot/key/tests.rs:23
modified helper fn assert_mismatched in host::template::key::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/key/tests.rs:384 nvx-rs/src/host/snapshot/key/tests.rs:400
modified helper fn key_refusal in host::template::key::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/key/tests.rs:666 nvx-rs/src/host/snapshot/key/tests.rs:706
modified helper const VECTORS in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:866 nvx-rs/src/host/snapshot/key/tests.rs:906
modified helper fn parse in host::template::manifest::tests (moved) nvx-rs/src/host/template/manifest/tests.rs:12 nvx-rs/src/host/snapshot/manifest/tests.rs:12
modified helper fn refusal in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:17 nvx-rs/src/host/snapshot/manifest/tests.rs:17
modified helper fn read_refusal in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:1020 nvx-rs/src/host/snapshot/manifest/tests.rs:1020
modified helper fn publish_for_tests in host::template::store::tests, impl Store`` (only the paths that it names changed) nvx-rs/src/host/template/store/tests.rs:21 nvx-rs/src/host/template/store/tests.rs:21
modified helper fn publish_spec_for_tests in host::template::store::tests, impl Store`` (only the paths that it names changed) nvx-rs/src/host/template/store/tests.rs:33 nvx-rs/src/host/template/store/tests.rs:33
modified helper struct DeviceSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:112 nvx-rs/src/host/snapshot/tests.rs:112
modified helper struct AttachmentSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:214 nvx-rs/src/host/snapshot/tests.rs:214
modified helper struct NetworkSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:270 nvx-rs/src/host/snapshot/tests.rs:270
modified helper struct BlockSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:321 nvx-rs/src/host/snapshot/tests.rs:321
modified helper struct TimeSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:360 nvx-rs/src/host/snapshot/tests.rs:360
modified helper struct CpuSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:411 nvx-rs/src/host/snapshot/tests.rs:411
modified helper struct ContractSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:438 nvx-rs/src/host/snapshot/tests.rs:438
modified helper struct ManifestSpec in host::template::tests (moved) nvx-rs/src/host/template/tests.rs:572 nvx-rs/src/host/snapshot/tests.rs:572
modified helper fn assert_captured in vm_template (tests) tests/runtime-adapter/tests/vm_template.rs:395 tests/runtime-adapter/tests/vm_template.rs:395
modified imports the imports of host::template::clone::tests nvx-rs/src/host/template/clone/tests.rs:9 nvx-rs/src/host/template/clone/tests.rs:9
modified imports the imports of host::template::clone::tests::launch nvx-rs/src/host/template/clone/tests/launch.rs:9 nvx-rs/src/host/template/clone/tests/launch.rs:9
modified imports the imports of host::template::store::capture::tests nvx-rs/src/host/template/store/capture/tests.rs:7 nvx-rs/src/host/template/store/capture/tests.rs:7
modified imports the imports of host::template::store::leases::tests nvx-rs/src/host/template/store/leases/tests.rs:5 nvx-rs/src/host/template/store/leases/tests.rs:5
modified imports the imports of host::template::store::tests nvx-rs/src/host/template/store/tests.rs:5 nvx-rs/src/host/template/store/tests.rs:5
modified test fn keys_of_another_encoding_version_are_failures_of_the_host_that_quarantine_nothing in host::template::clone::tests nvx-rs/src/host/template/clone/tests.rs:1333 nvx-rs/src/host/template/clone/tests.rs:1333
modified test fn each_part_of_the_key_changes_it in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:48 nvx-rs/src/host/snapshot/key/tests.rs:48
modified test fn each_contract_version_changes_the_key in host::template::key::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/key/tests.rs:266 nvx-rs/src/host/snapshot/key/tests.rs:263
modified test fn a_key_holds_what_its_capture_made in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:336 nvx-rs/src/host/snapshot/key/tests.rs:353
modified test fn a_capture_that_does_not_match_its_class_is_refused in host::template::key::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/key/tests.rs:398 nvx-rs/src/host/snapshot/key/tests.rs:414
modified test fn invalid_classes_are_refused in host::template::key::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/key/tests.rs:501 nvx-rs/src/host/snapshot/key/tests.rs:517
modified test fn keys_read_back_from_their_canonical_encoding in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:645 nvx-rs/src/host/snapshot/key/tests.rs:661
modified test fn other_encodings_of_a_key_are_refused in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:673 nvx-rs/src/host/snapshot/key/tests.rs:713
modified test fn a_key_that_holds_its_network_s_lowering_after_its_invariants_is_refused in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:705 nvx-rs/src/host/snapshot/key/tests.rs:745
modified test fn keys_of_machines_that_no_manifest_describes_are_refused in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:737 nvx-rs/src/host/snapshot/key/tests.rs:777
modified test fn the_conformance_vectors_decode_and_encode in host::template::key::tests (moved) nvx-rs/src/host/template/key/tests.rs:977 nvx-rs/src/host/snapshot/key/tests.rs:1017
modified test fn the_fields_of_a_manifest_need_not_be_written_in_their_order in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:231 nvx-rs/src/host/snapshot/manifest/tests.rs:231
modified test fn truncated_manifests_are_refused in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:428 nvx-rs/src/host/snapshot/manifest/tests.rs:428
modified test fn the_manifests_that_openvmm_writes_are_read in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:860 nvx-rs/src/host/snapshot/manifest/tests.rs:860
modified test fn read_reads_the_manifest_of_a_snapshot in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:1030 nvx-rs/src/host/snapshot/manifest/tests.rs:1030
modified test fn read_refuses_a_fifo_without_waiting_for_a_writer in host::template::manifest::tests (moved, and only the paths that it names changed) nvx-rs/src/host/template/manifest/tests.rs:1117 nvx-rs/src/host/snapshot/manifest/tests.rs:1117
removed imports the imports of host::template::key::tests nvx-rs/src/host/template/key/tests.rs:4
removed imports the imports of host::template::manifest::tests nvx-rs/src/host/template/manifest/tests.rs:4

Test data

Change What Before After
removed file nvx-rs/tests/vectors/template-key-v1.txt nvx-rs/tests/vectors/template-key-v1.txt

Relocated unchanged: 120; added: 5. Compared the merge base 3ad5e49df09f with 1106886aa8e3.

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 active review issues block the snapshot metadata rename.

No open issues 🎉

What changed in this PR

Moves NVX’s snapshot metadata from host::template to host::snapshot, implementing the metadata-renaming slice of #1102 while retaining legacy template aliases. Snapshot opening and VM lifecycle changes remain out of scope.

Changes:

  • Relocates keys, manifests, codecs, and restore-time eligibility without changing manifest validation or geometry checks.
  • Renames the public types to SnapshotKey and SnapshotManifest; removes the key’s guest_build field and changes its hash domain in place at version 1.
  • Updates tests, conformance vectors, documentation, and both platform API snapshots.
File Description
tests/​runtime-adapter/​tests/​vm_template.rs Removes the obsolete key guest-build assertion.
tests/​runtime-adapter/​README.md Distinguishes capture-class guest build from key identity.
nvx-rs/​tests/​vectors/​snapshot-key-v1.txt Supplies vectors for the revised key encoding and hash domain.
nvx-rs/​tests/​vectors/​README.md Documents renamed vectors and the in-place format change.
nvx-rs/​tests/​fixtures/​template/​README.md Updates the documented manifest reader name.
nvx-rs/​src/​host/​template/​store/​tests.rs Uses relocated metadata fixtures.
nvx-rs/​src/​host/​template/​store/​leases/​tests.rs Imports fixtures from snapshot tests.
nvx-rs/​src/​host/​template/​store/​capture/​tests.rs Imports relocated capture fixtures.
nvx-rs/​src/​host/​template/​mod.rs Retains metadata aliases and generation eligibility.
nvx-rs/​src/​host/​template/​clone/​tests/​launch.rs Updates the shared artifact-helper import.
nvx-rs/​src/​host/​template/​clone/​tests.rs Updates fixture imports and key diagnostic expectations.
nvx-rs/​src/​host/​snapshot/​wire/​tests.rs Relocates protobuf reader coverage unchanged.
nvx-rs/​src/​host/​snapshot/​wire.rs Relocates the strict protobuf reader.
nvx-rs/​src/​host/​snapshot/​tests.rs Relocates shared fixtures with host-scoped visibility.
nvx-rs/​src/​host/​snapshot/​manifest/​tests.rs Updates manifest tests to the snapshot type name.
nvx-rs/​src/​host/​snapshot/​manifest.rs Renames and relocates the manifest reader.
nvx-rs/​src/​host/​snapshot/​key/​tests.rs Updates key coverage and adds guest-build removal regressions.
nvx-rs/​src/​host/​snapshot/​key.rs Renames the key and revises its encoding and hash domain.
nvx-rs/​src/​host/​snapshot/​eligibility/​tests.rs Relocates restore-window coverage unchanged.
nvx-rs/​src/​host/​snapshot/​eligibility.rs Relocates eligibility logic without the template-generation dependency.
nvx-rs/​src/​host/​snapshot/​canonical/​tests.rs Relocates canonical codec coverage unchanged.
nvx-rs/​src/​host/​snapshot/​canonical.rs Relocates canonical encoding utilities.
nvx-rs/​src/​host/​snapshot.rs Defines and documents the public metadata module.
nvx-rs/​src/​host/​mod.rs Exposes snapshot metadata and documents module responsibilities.
nvx-rs/​README.md Documents snapshot APIs and legacy template aliases.
nvx-rs/​public-api/​windows.txt Records the Windows API additions and removed getter.
nvx-rs/​public-api/​linux.txt Records the Linux API additions and removed getter.

Review effort: Balanced

@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/slim-2.3.2-sl2.12a-publication-20261107 branch from abb3835 to 89db081 Compare November 7, 2026 22:58
@esaurez
Enrique Saurez (esaurez) changed the base branch from feature/nvx-refactor to esaurez/slim-3.2.1-sl4.2-canonical-20261107 November 7, 2026 22:59
@esaurez
Enrique Saurez (esaurez) requested a balanced review from Copilot November 7, 2026 22:59

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 active review issues block the snapshot metadata migration.

No open issues 🎉

Review effort: Balanced

Base automatically changed from esaurez/slim-3.2.1-sl4.2-canonical-20261107 to feature/nvx-refactor November 7, 2026 23:53
@esaurez
Enrique Saurez (esaurez) marked this pull request as ready for review November 8, 2026 01:24
Enrique Saurez and others added 3 commits November 7, 2026 18:53
Own the key, manifest, codecs and time eligibility in host::snapshot while retaining the template re-exports for current users. Remove guest_build from the key and change its version 1 encoding and hash domain in place. Keep the existing opaque snapshot shell and capture and restore behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f9c3ba3-e38b-427c-8ed6-da7a970c21a9
Copilot-Session: 0325d032-38a9-4c7f-9899-687a4ec93a51
Keep HostClock parsing visible to the existing template store within the host boundary. Moving the manifest must not hide the parser from its current caller.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f9c3ba3-e38b-427c-8ed6-da7a970c21a9
Copilot-Session: 0325d032-38a9-4c7f-9899-687a4ec93a51
Keep the existing key-identity error shared by the template lease parser, and update the clone test for the renamed key. Retain Generation eligibility at the template boundary so snapshot metadata does not depend on its legacy store. Update the directly affected metadata documentation.

The snapshot module exports metadata only, independent of cold VM preparation and spawning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f9c3ba3-e38b-427c-8ed6-da7a970c21a9
Copilot-Session: 0325d032-38a9-4c7f-9899-687a4ec93a51

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 active review issues remain for the snapshot metadata migration and key updates.

No open issues 🎉

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) merged commit 489ce50 into feature/nvx-refactor Nov 8, 2026
60 of 61 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the esaurez/slim-2.3.2-sl2.12a-publication-20261107 branch November 8, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat-nvx-refactor tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants