Skip to content

host: keep file-seal timestamps and version private #1696

Description

Area: area: nvx (host::seal).

Base revision: e5330ad60af7f734a7a2fa75338053b0b064e4d1.

What is over-exposed

The file-seal implementation exposes four implementation details to the whole crate:

All four are pub(crate), although their complete uses at the base revision are within host::seal and its descendants:

Use Source
FileSeal keeps its timestamps in private fields; comparison and serde derives operate within the defining module seal.rs, comparison
Linux's child imp constructs the version and timestamps; its timestamp constructor is private seal.rs
Windows's child module constructs the version and timestamps; its timestamp constructor is private seal/windows.rs
Existing descendant tests construct and compare timestamps, including pre-epoch Windows timestamps seal/tests.rs, seal/windows/tests.rs

All Rust references to these identifiers were searched and read at the base revision. No function exposed outside the module returns or accepts SealTime. host is feature-gated; seal is crate-private. The constant is compiled on Linux with cli, or on Windows; the timestamp is compiled with cli or on Windows. The other-host implementation has no additional timestamp consumer.

Proposed change and benefit

Remove pub(crate) from those four declarations, making each private to host::seal, the least visibility that its uses require. Keep all other declarations, cfg predicates, derives, function bodies, and callers unchanged.

This makes the module's actual boundary compiler-enforced: callers use FileSeal rather than coupling to its timestamp representation or seal-version constant. Descendant platform implementations and tests retain access through Rust's ordinary privacy rules. It is four one-line replacements, with no new abstraction, wrapper, dependency, feature, or unsafe code.

Why behavior is unchanged

Only Rust visibility changes. Field types, layout, serde attributes and field names, encoded timestamps and versions, error messages and ErrorKinds, protocol bytes, golden fixtures, guest command lines, exit statuses, and output remain identical. Neither item is public API. The module layout and documented purpose do not change, so no module documentation changes are needed.

Prior work and overlap

The open and closed code-quality issues and their linked pull requests were checked. #1683 mentioned these items only as an unconfirmed follow-up; its merged #1686 changes sandbox modules, not seals. #1685's merged #1688 changes hexadecimal identity helpers, not seals. Both recent reviews recommended approval and recorded no requested corrections. The active #1689 (CLI parser arity) and #1692 / #1695 (NVXS record helpers) are separate work. No closed-unmerged code-quality pull request proposed this change.

Every changed-file page of each open pull request targeting dev was checked before filing; none changes nvx/src/host/seal.rs. Do not modify files held by other open pull requests.

Acceptance criteria

  • Make only the four listed declarations private in nvx/src/host/seal.rs.
  • Record passing affected tests at the base revision, then run them unchanged after the change: cargo test --locked --all-features --lib --manifest-path nvx/Cargo.toml host::seal:: on Linux and Windows, including the serde round-trip and timestamp tests. Existing tests remain unchanged.
  • Leave nvx/public-api/ snapshots unchanged; the public-API check passes without rewriting them.
  • Preserve protocol bytes, golden fixtures, serialization, error messages and ErrorKinds, guest command lines, exit statuses, and output exactly.
  • Introduce no dependency, feature, or unsafe code. If implementation introduces a new abstraction, give it a focused unit test; none is proposed or needed here.
  • Check the relevant feature/target combinations, including default host, CLI-only, and all-features on Windows and Linux, plus the no-default/serde/testing configurations and the repository's macOS and guest-target checks.
  • Pass the gates selected by python3 scripts/local_gates.py --base origin/dev and the applicable commands in check-nvx. Report local and CI-only checks distinctly.
  • Keep the entire diff below 1000 changed lines, insertions plus deletions as git diff --shortstat reports them. Expected: one production file, four insertions and four deletions. Changes are restricted to nvx/ and, only if needed, doc/project-structure.md; no scripts, workflows, data, or OpenVMM changes.

Follow-ups

None required for this self-contained change. Other visibility cleanup and refactors remain out of scope. No suspected bug was identified in this candidate.

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

Metadata

Metadata

Labels

area: nvxInitial title-keyword triage suggestioncode-qualityFindings from focused code-quality reviews

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions