[DIT-13503]: candidate ids hash the line number instead of the occurrence - #7
Merged
laurakoye merged 2 commits intoAug 19, 2026
Conversation
laurakoye
changed the base branch from
main
to
laura/dit-13464-capture-the-raw-literal-snapshot_text-in-source-code
August 18, 2026 21:12
laurakoye
changed the base branch from
laura/dit-13464-capture-the-raw-literal-snapshot_text-in-source-code
to
laura/dit-13480-capture-the-raw-literal-snapshot_text-in-resource-file
August 18, 2026 21:12
jholiga
approved these changes
Aug 19, 2026
laurakoye
merged commit Aug 19, 2026
a0e3825
into
laura/dit-13480-capture-the-raw-literal-snapshot_text-in-resource-file
3 checks passed
laurakoye
deleted the
laura/dit-13503-candidate-ids-hash-the-line-number-instead-of-the-occurrence
branch
August 19, 2026 15:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes DIT-13503.
Candidate ids hashed
(file, line, column, value). The project's identity rule is the opposite: a string is identified by its file, its text, and which repeat it is — never its line number.Now:
id = sha1(file:value:occurrence_index).lineandcolumnstay onlocation, just not in the hash.occurrence_indexis already computed before the id loop, so nothing was reordered.Fixes two things
Ids churned on unrelated edits. An import added above a string shifted its line and changed its id — a delete plus a create to anything keying by id. That's what
occurrence_index(DIT-13463) exists to prevent.Ids could collide. PO plural forms take their location from the same
msgid_pluralline, so two forms sharing text hashed identically and a consumer keyed by id dropped one:Tests
New
src/candidate-id.test.ts— plural forms sharing text get distinct ids; an id survives lines inserted above it. No existing test hardcoded an id.Breaking
makeCandidateIdis exported:(file, line, column, value)→(file, value, occurrenceIndex)Safe now — nothing persists candidate ids yet, so this is a two-line change today and a migration later.
Also bumps
package.jsonto0.3.0. With #4, the release note needs three breaks: requiredsnapshot_text, themakeCandidateIdsignature, and changed id values.