# Fix the translation agent pushing unreviewed strings to the production bundle

## TL;DR

The agent ships whatever the TMS has, including unreviewed strings, so gate the production bundle on review state. Production should only ever contain reviewed or explicitly approved strings. Filter the bundle build to reviewed strings, falling back to the source language for the rest.

## The error

```text
Production bundle contains unreviewed machine translations
users see broken MT output, the agent pushed everything
```

## Fix it

### Step 1: Check what the bundle build includes

```bash
grep -n "reviewed\|filter" scripts/build-bundle.js | head -5
```

Expected: You see whether the build filters by review state.

### Step 2: Filter to reviewed strings with source-language fallback

```bash
node -e "console.log('pattern: include reviewed translations, fall back to the source string for unreviewed ones')"
```

Expected: Unreviewed strings show source text instead of bad MT.

### Step 3: Rebuild the production bundle

```bash
node scripts/build-bundle.js --env production | tail -3
```

Expected: The bundle builds with the filter active.

### Step 4: Verify no unreviewed strings shipped

```bash
node -e "console.log('audit the bundle: every non-source string should carry the reviewed state')"
```

Expected: The bundle is clean.

## When to use this

- Production shows unreviewed machine translations
- The agent pushes everything to the bundle

## When NOT to use this

- Staging shows unreviewed strings, that is fine and expected
- Reviewed strings are wrong, that is a translator issue

## Tool and version compatibility

- Any TMS with review states, bundle build scripts
- Source-language fallback for unreviewed

## Variant phrasings

### emergency release needs unreviewed strings

Allowlist specific keys for the release, do not open the floodgate for everything.

### no review workflow exists yet

Then define one. Shipping raw MT to production without any review step is the deeper bug.

## Why it happens

Bundle builders default to including everything the TMS returns. Without a review-state filter, the agent's unreviewed machine output flows straight into production, and users become the QA team.

## Edge cases

- Fallback to source language can look broken too, prefer it over wrong MT
- Track unreviewed counts per release so the backlog is visible
- The filter belongs in the build, not the agent, so manual exports are gated too

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_-xuQYJK89OjcyXgS7zAsvA
