vendor_fabric.meshy.persistence.utils

Utilities for spec hashing and canonicalization.

Module Contents

Functions

canonicalize_spec

Convert asset spec to canonical JSON string for hashing.

compute_spec_hash

Compute truncated SHA256 hash of asset spec.

API

vendor_fabric.meshy.persistence.utils.canonicalize_spec(spec: dict[str, Any]) str

Convert asset spec to canonical JSON string for hashing.

Args: spec: Asset specification dict

Returns: Canonical JSON string (sorted keys, no whitespace)

vendor_fabric.meshy.persistence.utils.compute_spec_hash(spec: dict[str, Any], length: int = 12) str

Compute truncated SHA256 hash of asset spec.

Args: spec: Asset specification dict length: Hash length (default 12 chars)

Returns: Truncated hex hash safe for filenames