Module fingerprint

Module fingerprint 

Source
Expand description

Canonical, order-independent data fingerprinting for model diffing.

A byte-exact port of packages/diff/src/fingerprint.ts. Callers extract a plain DataFingerprintInput from whatever store they have and hash it here, so base and head adapters produce identical fingerprints for an unchanged entity — across adapters, machines and now languages.

The rules that are load-bearing rather than incidental, each of which the TypeScript module argues for at length:

  • An assigned type is identified by name and IFC class, never by GlobalId. IfcTypeObject is an IfcRoot, so a from-scratch re-export regenerates its id; hashing it moved the fingerprint of every typed element on exactly the re-export where nothing substantive changed, defeating the content-matching pass that exists for that case.
  • Tag participates for type objects only. For a type object it is design content and often the only discriminator between same-named types. For an occurrence it is the authoring tool’s own element id, so two tools exporting one design disagree on it for every element.
  • Absent and empty hash alike for materials and classifications: the key is omitted entirely when the projection is empty, so shipping those fields did not move the fingerprint of every material-less entity.
  • [core_attributes] is one function, not two literals. The attr:core sub-hash is a collision guard on the whole-blob hash, and that only holds while the two project identically.

Functions§

build_component_fingerprint_entries
JavaScript Map insertion order, including first-position/last-value updates for duplicate component keys. The WASM object boundary consumes this form.
build_component_fingerprint_entries_checked
build_component_fingerprint_entries with build_data_fingerprint_checked’s length checks. Like the oracle, a set collection’s checks precede the panic for its outer holes, and each collection’s precede the next collection.
build_component_fingerprints
Per-component sub-hashes, making the conflict unit (entity, componentKey).
build_data_fingerprint
Build the canonical data fingerprint for one entity.
build_data_fingerprint_checked
build_data_fingerprint, offering check each hole-bearing string length the oracle builds, in its order, before hashing (see the module docs).
build_fingerprint_pair_checked
Equivalent to the data builder followed by the component builder, including sparse string-length checks in the same order. Inputs are owned DTOs: no host getter is deferred across either hash. Solo builders remain available without computing an unwanted second hash.
canonical_value_string
The text produced when fingerprint normalization collapses a value to a string.
check_property_sets
Check the strings the oracle builds while sorting property sets and, for components, while hashing each set’s members (#8114). Call it once the whole collection is projected, before any later input is read.
check_quantity_sets
check_property_sets for quantity sets.
check_type_assignments
The component type-assignment text, the only hole-bearing string a type assignment projection builds before the oracle reads materials (#8114).