Polyglot Parrot re-translates every key under a parent object when the added key uses a computed property name

Open
#105,936 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start with extractKeyFromPropertyNode and buildDotNotationPath in scripts/utils/TSCompilerUtils.ts, then inspect the translation workflow logs cited in the issue to confirm how changed paths are built. Trace how computed property names using CONST.NEXT_STEP.MESSAGE_KEY.* map to their constant values. Done when the workflow identifies only the added key and avoids re-translating sibling keys under nextStep.message.

Written by the indexing model from the issue text.

Description

What happened

PR https://github.com/Expensify/App/pull/104973 added one new English string to src/languages/en.ts:

[CONST.NEXT_STEP.MESSAGE_KEY.APPROVE_ONLY_SUBMIT_BLOCKED]: ...

The Polyglot Parrot bot then produced a 118KB translation patch that re-translated all 16 keys under nextStep.message in all 10 languages. Most of those strings were already translated, so the patch mostly reworded them (one German string even got a zero-width space added).

Why it happens

The new key uses a computed property name, so the path builder cannot name it and falls back to the parent object:

The bot marks the whole nextStep.message object as changed and re-translates every key under it.

Evidence

Workflow run https://github.com/Expensify/App/actions/runs/41727931903 logs the wrong path:

🔄 Found changed path: nextStep.message
🔄 Paths to modify: nextStep.message

It should have been only the new key.

Suggested fix

Teach extractKeyFromPropertyNode to resolve computed keys of the form [CONST.NEXT_STEP.MESSAGE_KEY.SOMETHING] to the constant value they point to. Then the changed path points at the single new key, and the bot re-translates only that key.

Same symptom was reported before in https://github.com/Expensify/App/issues/80978, which was closed without this root cause.

Dominant language
TypeScript
Stars
5k
Forks
4k
Avg merge
3d 5h
Merged PRs (30d)
594

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Expensify/App

All issues in Expensify/App

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.