Sync jobs
The server-side engine behind CLI syncs — phases, strategies, statuses, resumability, and failure handling.
A sync job is a server-side, resumable job that reconciles a
submitted set of translation strings against a namespace — diffing,
pushing the changes, and optionally AI-translating whatever is still
missing. It's the engine behind
nrc langsync sync; you'll rarely create
one by hand, but understanding how it behaves explains everything the
CLI reports.
The four phases
Every job runs the same pipeline:
- Planning. Compare the submitted marks and values against the namespace's current state, and write an ordered list of operations: create (mark doesn't exist), update (value changed), delete (only when pruning).
- Pushing. Apply each operation. Progress counters
(
created/updated/deleted) tick as it goes. In a namespace whose message syntax isicu, each pushed value is checked first; a refused one fails its operation with a code. After the operations, the job stores the key descriptions the request sent. - Autotranslating. Run the AI engine over every term × language cell that's still empty, with each term's key and description, glossary included. A translation that fails the checks is not stored and becomes a failure entry with a code.
- Finalizing. Assemble the resulting per-language state — the
complete
mark → valuemap for every attached language — which is what the CLI writes back to your local files.
Statuses
pending → planning → planned (terminal for dry-run)
└→ pushing → autotranslating → finalizing → completedfailed and cancelled are the other terminal states. A dry-run stops
at planned with the plan attached — nothing is applied.
Poll the job over the API (GET /namespaces/{name}/sync/{jobId}) to
watch it move; that's exactly what the CLI's live dashboard does. The
response carries the status, per-phase progress counters, the plan (for
dry-runs and in-flight pushes), the resulting per-language state, a
count of cells that remained untranslated, unreviewedPerLanguage, and
a list of failures if any occurred.
unreviewedPerLanguage is set once the job is completed: per language
code, how many translations have text that nobody has
marked reviewed. The job's source
language is not in it.
Options
| Option | Default | What it does |
|---|---|---|
strategy | local | local = push the submitted strings, then autotranslate. server = don't push anything; just autotranslate what's missing and return the server state. Use server for a read-only refresh. |
prune | off | Delete server-side marks that are missing from the submitted set. Without it, marks you didn't submit are left alone. |
dryRun | off | Stop after planning; return the plan without applying anything. |
waitForAutotranslate | on | Whether the job should be polled through the autotranslate phase before the client reports completion. |
waitTimeoutSeconds | 120 | Server-side cap on that wait. |
contexts | none | Key descriptions, {key: description}, stored with the terms and given to the model. See below. |
retranslateOnSourceChange | off | When an update changes a term's source-language value, clear its other-language translations so the AI regenerates them from the new source. Off means stale translations stay until you deal with them. |
| source language | namespace default | The submitted strings' language. When it differs from the namespace default, autotranslate uses your language as the translation source — see source-of-truth language. |
Key descriptions (contexts)
A short key such as close or changes can mean several things. A
description says where the text is used ("button that closes the
dialog"), and the model gets it with the key whenever it translates
the term. The CLI sends descriptions from the namespace's
context_file.
contexts maps keys of the request's source language to descriptions:
- every key must be one of the source-language keys in the same request, and there can't be more entries than those keys;
- a description is at most 1,000 characters of valid text;
- an empty description clears the term's description, and a key left out keeps the one it has.
The job stores them in each term's context (the Context field of
the dashboard) after its push operations, so new terms get theirs too,
and before autotranslate, so the model reads them. A server strategy
or a dry-run pushes nothing and stores no descriptions.
A request that breaks a rule is refused before a job is created with
400 SYNC_CONTEXTS_INVALID. data.reason says which rule:
reason | Meaning | Other data |
|---|---|---|
too_many | More entries than the request has source-language keys. | max |
unknown_key | An entry names a key the request's source language does not have. | key |
too_long | A description is longer than 1,000 characters. | key, maxChars |
not_text | A key or a description is not valid text (invalid UTF-8 or a NUL character). | key |
Failure entries
Each entry of failures has the phase it happened in (push or
autotranslate), the operation's opIdx and the term's mark where
there is one, and error, an English sentence for logs.
An entry about a translation that was not stored because of its text also has:
| Field | Meaning |
|---|---|
code | Why: placeholders_changed, icu_invalid, plural_forms, tags_changed, glossary_term_missing, too_many_variants, untranslated or model_failed. See the codes. |
languageCode | The language of the translation. |
offset, argument, missing, unexpected | The code's facts, when it has them. |
- Phase
autotranslate: one entry per key and language the engine refused. The cell stays empty; other keys and languages are stored. A job lists at most 500 of these and then one more entry whosedroppedcounts the rest. - Phase
push: a pushed value anicunamespace refused. The operation fails and the job goes on; a refused source value creates no term.
Reliability guarantees
Sync jobs are built to survive crashes and never double-charge AI work:
- One worker at a time. Workers claim jobs with a short exclusive lease that they keep refreshing; a competing worker can't pick up a live job.
- Resumable, idempotent operations. Every planned operation records whether it has been applied. If a worker dies mid-push, the next one resumes from the first unapplied operation; re-running an applied operation is a no-op.
- Autotranslate fires at most once. The job records the moment autotranslate is triggered before dispatching it; resumption sees the marker and never re-triggers the AI batch.
- Failures are captured, not fatal. If individual operations fail, the job continues, completes, and reports the failures list — three bad rows out of a hundred don't waste the other ninety-seven. The CLI surfaces these in its Issues block along with diagnostic hints (a common one: source values that are empty, which autotranslate skips).
Retention
Job records — the plan, progress counters, results, and failures — are
kept for 7 days after completion, then deleted automatically. Pull
anything you need for audits before that; the job's creation,
completion, or failure is also permanently recorded in the
audit log (sync_job.created /
sync_job.completed / sync_job.failed).
Edge cases worth knowing
- Pruning deletes are permanent. A
local+prunejob removes server marks missing from your submission — terms and all their translations. Run--dry-runfirst when in doubt. serverstrategy never writes your submitted values. It's safe to run against a namespace someone else is editing — you'll get their edits, they won't get yours.- The wait is client-side convenience, not job control. If the wait
times out, the job keeps running server-side; the CLI writes whatever
is finished and tells you translations are still draining. Re-run
nrc langsync pulllater to pick up the rest.
Related
- CLI project sync — the tool that creates these jobs and everything about its flags.
- Auto-translate — how the AI phase translates and what it costs.
Use the glossary
Set up your organization's glossary — create it, add items and per-language values, and verify the AI respects them.
CLI
Manage LangSync from the terminal with norcube / nrc. Namespaces, terms, translations, languages, prompts, the glossary, API keys, CSV import, the audit log and project sync.