Skip to main content

Module fingerprint

Module fingerprint 

Source
Expand description

fingerprint — deterministic fingerprint of a portable IR document (common Generator, bc#13 — Rust port of ts/src/generator/fingerprint.ts).

Generated modules recompute the fingerprint over their embedded IR literal on first use and compare it against the constant baked in at generation time (skew is a LOUD reject — graphddb #208 prepared-artifact discipline).

Cross-language identity discipline (must match TS / Python / Go / PHP exactly):

  1. Lift the JSON document into the Value domain. Integral numbers become int; only non-integral numbers stay float. JSON’s data model (RFC 8259) does not distinguish 1 from 1.0, so integral floats canonicalize to int (TS loses the distinction at JSON.parse time — this specifies that behavior so all languages agree). -0.0 stays float (matches TS).
  2. Serialize with canonical_json (all-level code-point key sort — canonical-serialization.md §3).
  3. FNV-1a 64 over the UTF-8 bytes. Representation: "fnv1a64:" + 16 hex.

Constraint (fail-closed): integral numbers with |n| >= 2^53 are rejected (portable-IR big integers must use the Expression IR {int:"..."} wrapper — expression-ir.md §2.3. TS loses precision at JSON.parse, so allowing them here would let fingerprints diverge across languages).

Structs§

FingerprintFailure
A fingerprint input invariant violation (fail-closed).

Enums§

FingerprintFailureCode
Fingerprint input invariant violation codes (fail-closed).

Functions§

fingerprint_component_graph
Deterministic fingerprint ("fnv1a64:<16hex>") of a portable IR document.