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.IfcTypeObjectis anIfcRoot, 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. Tagparticipates 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. Theattr:coresub-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_entrieswithbuild_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, offeringcheckeach 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_setsfor quantity sets.- check_
type_ assignments - The component
type-assignmenttext, the only hole-bearing string a type assignment projection builds before the oracle reads materials (#8114).