vibeqc.output.formats.qvf.validate_qvf

vibeqc.output.formats.qvf.validate_qvf(source)[source]

Validate a QVF against the canonical SSOT schema.

source may be either a filesystem path to a .qvf file or an already-open zipfile.ZipFile. The latter form lets qvf_bytes() validate an in-memory archive without round-tripping through disk.

Returns a dict with keys valid (bool), summary (list of per-section result strs), and errors (list of error strs).

Checks performed:

  • The archive is a valid zip, no member exceeds the zip-bomb cap.

  • manifest.json exists and parses as JSON.

  • The manifest validates against _SCHEMA_PATH (the canonical schema) — this catches per-kind member shape, dtype, format, and unknown kinds.

  • Every member’s declared zip path exists in the archive.

  • Every member’s declared sha256 matches the bytes on disk.

  • Every binary member’s len(bytes) == np.dtype(dtype).itemsize * product(shape) (no silent under/over-sized buffer).

  • On volume.difference: both operand_a and operand_b (if present) resolve to section ids that exist in the archive.

  • On reaction.waypoints: trajectory_ref resolves to a section in the archive whose kind is trajectory.

Sections whose kind is in _RESERVED_KINDS are not shape-validated (no schema branch yet); their file refs are still checked. Vendor (x_*) sections must conform to the SectionVendor schema branch (members must be valid Json/Binary members) but the shape of those members is unconstrained.

Parameters:

source (PathLike | str | ZipFile)

Return type:

dict[str, Any]