Skip to main content

Module stable_id

Module stable_id 

Source
Expand description

Stable, position-free identifiers for clone-audit entities.

Audit continuity across scans hinges on identifiers that survive the edits they should survive: unrelated changes elsewhere in the file, formatting and comments, and file moves must not change an identifier, while a change to the identified content must. Every identifier here is therefore a 128-bit BLAKE3 digest of content and analysis context only — line numbers, byte offsets, file paths, token indices and input ordering are never hashed. Reporting positions live in anchors (see Instance), which are carried next to the identifiers and updated freely on re-scan.

The identifier kinds are distinct newtypes, so a unit fingerprint can never be passed where a group fingerprint is expected; the confusion is a compile error rather than a silent mismatch. Each kind also hashes under its own domain tag, so equal content in different roles yields unrelated digests.

Hash inputs are length-prefixed and include the schema version, the normalization ruleset version, the frontend version, the analysis mode, the language and the build variant, so results from incompatible configurations never collide silently. 128 bits are persisted because these are long-lived identity keys: a truncated key that collides would fuse two clones’ histories without any symptom.

Structs§

CloneGroupFingerprint
Fingerprint of a clone group, derived order-independently from the deduplicated content fingerprints of its members.
CrossLanguageComparisonId
Identity of an explicitly requested Rust-to-C++ semantic comparison.
CrossLanguageGroupId
Stable identity of one group found by a Rust-to-C++ semantic comparison.
CrossLanguageMemberId
Position-free identity of one cross-language group occurrence.
CrossVariantComparisonId
Identity of an opt-in comparison across distinct build variants.
CrossVariantGroupId
Stable identity of one group found by a cross-variant comparison.
CrossVariantMemberId
Position-free identity of one cross-variant group occurrence.
FileContext
Per-file analysis context that participates in content hashing.
FindingId
Identifier of one finding: a specific occurrence of a group’s content, discriminated by its host unit and an in-host occurrence rank rather than by any source position.
FragmentFingerprint
Fingerprint of a sub-unit content slice: a candidate fragment or a matched run. Content-identical slices share one fingerprint; occurrences are told apart by FindingId, never by position.
GroupIds
Stable identifiers of one clone group.
GroupLineageId
Stable identity of a clone group’s history across fingerprint changes.
MemberIds
Stable identifiers of one group member, parallel to CloneGroup::members.
UnitFingerprint
Fingerprint of one whole code unit (function, method, impl/record block, closure), hashed from its token content.

Enums§

ContentNorm
How content is folded before hashing.

Constants§

CROSS_LANGUAGE_POLICY_VERSION
Version of the explicit Rust-to-C++ semantic comparison policy.
CROSS_VARIANT_POLICY_VERSION
Version of the policy that defines cross-build-variant comparisons.
FP_SCHEMA_VERSION
Version of the identifier-hashing recipe. Bump on any change to the hash inputs, their encoding or their order.
HASH_ALGORITHM
The hash algorithm behind every identifier, recorded so a future algorithm change is an explicit versioned event rather than a silent one.

Functions§

clone_group_fingerprint
Fingerprint a clone group from its members’ content fingerprints.
cross_language_comparison_id
Identify an explicit Rust-to-C++ semantic comparison over origin variants.
cross_language_group_id
Identify a verified group from an explicit Rust-to-C++ semantic comparison.
cross_language_member_id
Identify one occurrence inside a cross-language semantic group.
cross_variant_comparison_id
Identify an opt-in comparison over the sorted set of origin variants.
cross_variant_group_id
Identify an exact group produced by a cross-build-variant comparison.
cross_variant_member_id
Identify one occurrence inside a cross-build-variant group.
finding_id
Identify one occurrence of a group’s content.
fragment_fingerprint
Fingerprint a content slice (candidate fragment or matched run).
group_lineage_id
Start a clone-group history from the fingerprint that first identified it.
report_ids
Compute stable identifiers for every group of an engine report.
resolved_fragment_fingerprint
Fingerprint a fragment with compiler-derived name-resolution evidence.
semantic_clone_group_fingerprint
Fingerprint a restricted-semantic group after a registered rule matched.
semantic_fragment_fingerprint
Fingerprint one normalized semantic graph as a finding fragment.
semantic_occurrence_fingerprint
Identify one semantic fragment occurrence inside its stable host unit.
semantic_structure_fingerprint
Fingerprint source structure attached to a bounded semantic window.
structural_clone_group_fingerprint
Fingerprint a Structural (Type-3) clone group, anchored on its canonical instance.
unit_fingerprint
Fingerprint a whole unit’s token stream.