Skip to content

fix(sync): backfill missing target_hash for hand-added translations - #5

Merged
mhenrixon merged 1 commit into
mainfrom
fix/sync-backfill-target-hash
Jul 16, 2026
Merged

fix(sync): backfill missing target_hash for hand-added translations#5
mhenrixon merged 1 commit into
mainfrom
fix/sync-backfill-target-hash

Conversation

@mhenrixon

Copy link
Copy Markdown
Collaborator

Problem

Translations added straight to the locale YAML (agents/humans writing the af/fr values by hand instead of running translate) get bare {source_hash} state entries from sync — no target_hash baseline, so the manual_edits validator can never detect subsequent hand-edits to them. Surfaced by the getzazu/app state reconciliation (getzazu/app#2931), which produced ~10 such bare entries.

Fix

sync backfills target_hash from the current target value only when the entry has none. An existing target_hash is never recomputed — that would silently absorb hand-edit drift, which 0.4.0 deliberately keeps visible until resolved via accept-edits. manual flags remain untouched. This restores the baseline coverage the pre-extraction script had (it always recorded target_hash) without its drift-absorbing recompute.

Verification

  • 99 examples, 0 failures — replaced the "leaves bare entries bare" spec with backfill assertions; the "never recompute existing target_hash" invariant is locked in by the existing preservation spec
  • RuboCop clean; docs (commands, drift-state) + CHANGELOG updated
  • No version bump — rake release[x.y.z] owns it

…t drift protection

Translations written straight into the locale YAML (never passing through
translate or accept-edits) ended up as bare {source_hash} entries — invisible
to the manual_edits validator. sync now records target_hash from the current
value when the entry has none; an existing target_hash is never recomputed,
so hand-edit drift stays visible.
@mhenrixon mhenrixon self-assigned this Jul 16, 2026
@mhenrixon mhenrixon added the enhancement New feature or request label Jul 16, 2026
@mhenrixon
mhenrixon merged commit 6632b18 into main Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant