Skip to content

TechVault libvirt fakes raise KeyError and echo defined XML, and production reads a lookup KeyError as absence #1602

Closed as not planned

Description

@doublewhy

Problem

The hermetic fakes behind the TechVault native libvirt driver report shapes libvirt never produces (dev 348c4903):

  • implementations/python/tests/test_libvirt_backend_techvault_native.py:105-109, and the same fakes in test_libvirt_backend_guest_certified.py and test_libvirt_evidence_run.py, raise KeyError for a missing domain or network. libvirt 12.7.0 (test:///default, libvirt-python 12.8.0) raises libvirt.libvirtError with code 42 (VIR_ERR_NO_DOMAIN) or 43 (VIR_ERR_NO_NETWORK).
  • The fakes' XMLDesc(0) echoes the defined XML (<memory unit="MiB">128</memory>). libvirt reads it back normalized: <memory unit='KiB'>131072</memory>, a currentMemory element and <vcpu placement='static'>.

Production handles code 42/43 and KiB, but no hermetic test reaches those branches: disabling either left all 128 tests in the three modules passing. Production also catches KeyError ahead of the code checks and reads it as verified absence (raes_backend_libvirt/_techvault_native_ops.py:54 in _ensure_name_available, raes_backend_libvirt/techvault_lifecycle.py:80 in _resolve_by_name). That branch exists only for the fakes: a KeyError from any other cause lets realize create over an unverified name and lets destroy report a known domain removed.

The #1344 fixture-provenance audit lists these as findings LV-2 and LV-3 in the record #1461 proposes.

Scope

  • Commit a capture of libvirt's readback and lookup errors for production-rendered TechVault XML, and make the three modules' fakes raise its codes and apply its normalization; a missing or undefined object is not found, and the message names the requested object.
  • Run the production readers and the TechVault concern gate on the captured XML.
  • Remove the two KeyError absence branches, so a KeyError is an unexpected lookup failure. This touches package code under implementations/python/packages, which the research-evidence implementation digest covers, so both research captures are recorded in the same PR.

Done when

  • A test fails if production stops handling code 42/43 at realize or destroy, or stops converting a KiB readback.
  • The captured XML passes the TechVault concern gate in a test, and a test fails when the renderer's output no longer matches the capture.
  • A lookup that raises KeyError makes realize refuse to create and destroy report residual state, with tests.
  • If docs(research): record the fixture provenance audit and the boundary fixture convention #1461 has merged, the LV-2 and LV-3 entries in docs/research/fixture-provenance/index.md and their rows in inventory.md record the fix.

Related

Activity

  1. doublewhy commented on Oct 25, 2026

    @doublewhy
    ContributorAuthor

    Moot on dev: #1621 (ADR-115) removed the libvirt backend this issue describes. The bug remains only in the released 7.0.0 line; see #1453.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions