Skip to content

Fix 7 structurally broken locale JSON files in src/locales/{ar,de,en,es,fr,he,zh}/common.json so next build succeeds (blocks perf:budgets / bundle:measure on every PR) #618

Description

@Adiz4415

Bug: next build is blocked by 7 structurally broken locale JSON files

next build (and therefore everything downstream: pnpm build, pnpm bundle:measure, pnpm perf:budgets, every CI run, every next dev cold-cache rebuild) fails on every PR because 7 of the i18n locale files in src/locales/*/common.json cannot be parsed by JSON.parse. The errors are not single missing commas — they are cascading unclosed { braces inside nested objects that bleed across multiple property boundaries.

Reproduction

git checkout origin/main
node -e "for(const lang of ['ar','de','en','es','fr','he','zh']){const p='src/locales/'+lang+'/common.json';try{JSON.parse(require('fs').readFileSync(p,'utf8'));console.log('OK: '+p)}catch(e){console.log('BROKEN: '+p+' :: '+e.message)}}"

Verbatim JSON.parse output on origin/main:

BROKEN: src/locales/ar/common.json :: Expected ',' or '}' after property value in JSON at position 9095
BROKEN: src/locales/de/common.json :: Expected ',' or '}' after property value in JSON at position 8820
BROKEN: src/locales/en/common.json :: Expected ',' or '}' after property value in JSON at position 10257
BROKEN: src/locales/es/common.json :: Expected ',' or '}' after property value in JSON at position 8900
BROKEN: src/locales/fr/common.json :: Expected ',' or '}' after property value in JSON at position 8870
BROKEN: src/locales/he/common.json :: Expected ',' or '}' after property value in JSON at position 8990
BROKEN: src/locales/zh/common.json :: Expected ',' or '}' after property value in JSON at position 7785

Cascading unclosed-object structure (each file follows the same broken pattern)

For each file, the strict-parser failures cluster in the qrCodenetworkSwitcherreferral block:

"qrCode": {                          <-- opens; never closed →
  "title": "...",
  "description": "...",
  "buttonText": "...",
  "ariaLabel": "...",                <-- last property; missing trailing comma AND missing },
"networkSwitcher": {                 <-- next sibling, causes the strict-parser abort
  ...
  "switchingNetwork": "...",         <-- last property; missing trailing comma AND missing },
"referral": {                        <-- next sibling; same broken shape
  ...
}
}
}

The parser sees the } of one nested object's last property as the close-brace of the parent object, then sees the next sibling key with no comma, fails, and reports a position somewhere in the middle of the cascade. The "missing comma" hypothesis is insufficient — fixing just one comma leaves the next unclosed } broken too. Multiple unclosed { per file plus interleaved missing commas.

Why this blocks every PR (and what doesn't unblock it)

  • pnpm perf:budgets is gated on .next/build-manifest.json, which is only produced by a successful (webpack-mode) next build. Aborts upstream → script reads nothing → exits non-zero.
  • pnpm bundle:measure calls npm run build:analyze, which itself fails the JSON parse in the webpack JSON loader. No .next/bundle-analysis/report.json produced.
  • Adding typescript: { ignoreBuildErrors: true } and eslint: { ignoreDuringBuilds: true } to next.config.ts does not help — the JSON parse failure is a webpack-loader-time error before any of those flags can intervene.
  • Adding a single , after the offending ariaLabel line does not help — verified locally with awk inserting , at the parser-flagged line, then re-running JSON.parse strictly: file still rejected because the next unclosed } is also broken.
  • Moving the file out of src/locales/ temporarily is unsafe — the next-intl/webpack plugin static-analyzes that directory at build time and the build will fail differently or route to undefined strings at runtime.

Suggested fix (a focused PR)

Patch each of the 7 files to restore proper nested-object termination. Since each file roughly mirrors the others structurally (only string values differ per locale), the smallest correct fix is per-file targeted edits: locate each unclosed {, insert the missing } (and any missing ,) at its parent-property boundary, then validate with node -e "JSON.parse(...)". A draft automated approach:

# 1. For each file, parse with `json5` (lenient) if available, or use a tolerant
#    streaming parser; identify the property-boundary closures that are missing.
# 2. Insert the closures + commas at the right indentation.
# 3. Validate strictly with node -e "JSON.parse(...)".
# 4. Run `pnpm test` and `npx next build` to confirm the cascade is gone.

A reviewer-friendly alternative: ask the i18n owner to regenerate these files from the source-of-truth (likely a spreadsheet, translation tool, or upstream English copy-paste). If the JSON was authored by hand, regeneration is the only durable fix; if it was machine-exported, fix the exporter instead.

Files in scope

File First-broken line Cascading property block
src/locales/ar/common.json 295 qrCodenetworkSwitcherreferral
src/locales/de/common.json 295 same
src/locales/en/common.json 328 same
src/locales/es/common.json 295 same
src/locales/fr/common.json 295 same
src/locales/he/common.json 295 same
src/locales/zh/common.json 295 same

Acceptance criteria

  • node -e "JSON.parse(require('fs').readFileSync('src/locales/zh/common.json','utf8'))" succeeds for all 7 files.
  • npx next build --webpack (or pnpm build) reaches the production-build stage without aborting on webpack JSON-loader errors.
  • pnpm bundle:measure produces .next/bundle-analysis/report.json and exits 0.
  • pnpm perf:budgets reads .next/build-manifest.json and exits 0 (or exits non-zero because of a real budget overrun — but reads the manifest, not because of a missing one).
  • No production runtime change: i18n string lookups that were "silently missing" while the parse failed continue to resolve to the same string values now that the parse succeeds (or, if any key was actually deleted, identify and surface it via a release note).

Why a separate issue (not part of PR #612)

PR #612 (MettaChain/PropChain-FrontEnd#612, "perf(stellar-wave): resolve #503, #504, #505, #506") is already 11 files / 1,641 lines and has a tightly scoped perf narrative. Adding a 7-file locale JSON regeneration would obscure both review lines and force the same blockers to be re-litigated in a different PR. Filing here as a prerequisite for any post-#612 perf automation.

Suggested label

bug, build, i18n, blocker

Suggestion for the assignee

  1. Open a tiny measurement PR first: a script that lists every locale file's node -e "JSON.parse(...)" outcome — that becomes the test fixture for the fix PR.
  2. For each broken file, regenerate the cascade block by hand (or from the i18n source-of-truth) and validate strictly.
  3. After merge, run the 4-step post-merge perf runbook documented in the PR perf(stellar-wave): resolve #503, #504, #505, #506 #612 followups: pnpm bundle:measure + pnpm perf:budgets should now produce numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions