Skip to content

nvx-rs: remove the CPython emulation in nvx::host::python #731

Description

Goal

Once no test compares nvx-rs with recorded Python behavior, remove nvx::host::python, whose 5,199 lines emulate CPython 3.14 so that the ports kept Python's behavior byte for byte, and use Rust's own facilities with the behavior that #722 decided.

Tasks

Module Lines Becomes
golden.rs, unicode.rs, and mod.rs 583 Deleted, with tests/fixtures/python.json
builtins.rs 614 Rust's quoting, an ASCII decimal parser with explicit ranges, and the separators of #723 for values that become kernel tokens
json.rs 872 serde_json, refusing duplicate keys, with limits on depth and integer size
dumps.rs 212 serde_json's pretty printer over sorted maps
path.rs 925 std::path, with one specified function that makes a path absolute
fs.rs and windows.rs 1,195 std::fs, and the file identities of nvx::host::platform
text.rs 287 str, since paths that aren't valid Unicode, and unpaired surrogates, are refused
uuid.rs 98 A canonical UUID parser, or the uuid crate (#646)
value.rs 292 Typed serde structures of config.json formats 1 to 6
shell.rs 121 Kept, outside python, for the >> COMMAND line
  • Replace each module as the table says, and delete nvx::host::python.
  • Simplify nvx::host::cli::args once nvx.py: retire the sandbox and run commands in favor of nvx-rs #725 removes --prog and the emulation of argparse's layout.
  • Docs: remove the README's "Python parity" section, update its module table and its "Other differences from nvx.py" and Testing sections, and update doc/project-structure.md.
  • After measuring the coverage gate below, retire the nvx-rs coverage workflow of nvx-rs: measure line, branch, and mutation coverage on Linux and Windows #726, whose last family of golden tests this step deletes: delete .github/workflows/nvx-rs-coverage.yml, scripts/nvx_rs_coverage.py, its tests, and the "nvx-rs coverage" section of doc/ci.md, and update validate-nvx, doc/project-structure.md, and the README's Testing section. Keep nvx-rs-mutants.yml, moving its tests out of scripts/test_nvx_rs_coverage.py, and keep nvx-rs and nvx-fake-openvmm returning their exit statuses from main, without which coverage builds write no profile on Windows.

Gate

  • The lines and branches that only python.json reaches, 6 and 12 on Windows, are reached by other tests or deleted.
  • The scenario tests of nvx-rs: replace the golden CLI scenarios with structured scenario tests #728 pass on Linux and Windows, and so do the tests of aci_edge_sandboxes and of the runtime adapter in tests/runtime-adapter/.
  • The crate still builds with its minimum supported Rust version.

Coordination

Acceptance criteria

  • nvx::host::python and tests/fixtures/python.json are gone.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions