Skip to content

build: restore a shared NLS catalog across targets - #336476

Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
agents/nls-metadata-ownership-investigation
Draft

Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
agents/nls-metadata-ownership-investigation

Conversation

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Fixes #299425.

Why

The old build assigned core NLS IDs before target bundling. The esbuild migration instead assigns IDs from each target's dependency graph, while browser localization still selects a CDN catalog by commit/version/locale, without a target identity.

This is a verified cross-target mismatch, not merely a suspected write race: the official 1.110.0 server-web bundle expects 16,545 entries, but its same-commit localized CDN supplies standalone web's 16,421-entry table. Fresh-browser reproduction matches the original NLS MISSING: 16444 exception and stack. Materializing the same language pack with server-web's ordered keys restores localized startup.

Changes

  • Extract a deterministic, source-wide core catalog before target bundling, independently of entry points. Exclude declarations and test sources, preserve translator comments and separate localize/localize2 slots, and reject conflicting default messages.
  • Prepare one manifest before parallel core-ci bundles. Targets consume its index map and write only their own catalogs, rather than overwriting shared metadata.
  • Prepare the same source-wide catalog for standalone-web packaging and CDN metadata upload. Direct/local bundles without a supplied manifest extract that catalog in memory without publishing to out-build.
  • Fail on missing, malformed, non-canonical, or source-stale manifests, changed entries, and unresolved placeholders. Publish the manifest only after metadata writes succeed.
  • Preserve ASCII serialization, source maps, and the native/remote cache identity protections from Precompute NLS translation cache identity during packaging #336109. Update related build documentation.

Validation

  • 34 focused NLS tests pass, covering cross-target semantic lookups, repeated keys/comments, translation export, source drift, LF/CRLF portability, failed publication, source maps, ASCII serialization, and cache identities.
  • npm run typecheck --prefix build -- --pretty false passes.
  • Staged repository hygiene (npm run precommit), explicit changed-file ESLint with --max-warnings 0, and git diff --check pass.
  • Real bundle --minify --nls runs succeed for server, server-web, and standalone web. All four catalog files are byte-identical across those outputs, including the server's independent extraction path.
  • Both browser bundles emit the original profile-icon key at index 25,094 in a 25,216-slot catalog.
  • Independent extraction produces byte-identical manifests/metadata. The real XLF exporter emits 168 files covering all 25,165 distinct keys.

Reviewer / rollout notes

The correctness trade-off is shipping the complete catalog in smaller targets. On the validated source snapshot, the English JSON is 1,238,251 bytes / 319,198 bytes gzip; these are total sizes, not per-target increases. Source-wide extraction took about 23 seconds, and loading plus full-source validation about 2 seconds, locally on Windows.

Reindexed bundles and catalogs must ship together under a new build identity; existing published commit catalogs must not be replaced with reordered arrays. This does not change browser fallback behavior, language-pack formats, or the CDN URL contract. Full signed release packaging and live CDN deployment have not been exercised.

Extract and validate a source-wide NLS catalog before target bundling so products and the localization CDN use the same numeric indices. Give shared metadata one publisher and preserve complete translator output, source maps, ASCII serialization, and native cache identity behavior.

Fixes #299425

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 16, 2026 20:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It changes release-wide localization indexing and packaging, while full signed packaging and live CDN deployment remain unverified.

Review effort: Balanced (auto)
Findings: None

Note

Copilot is running an experiment and ran this review at Balanced.

What changed in this PR

Restores deterministic, source-wide NLS indexing so all build targets share compatible localization catalogs.

Changes:

  • Adds canonical NLS catalog extraction, validation, and publication.
  • Makes production targets consume the shared catalog.
  • Adds cross-target, failure-path, serialization, and source-map coverage.
File Description
.github/​instructions/​buildNext.instructions.md Documents canonical NLS workflow.
build/​gulpfile.vscode.ts Prepares one catalog before parallel bundles.
build/​gulpfile.vscode.web.ts Prepares the catalog for web packaging.
build/​lib/​esbuild.ts Adds NLS command orchestration and catalog arguments.
build/​lib/​test/​nlsMessages.test.ts Updates serialization tests for catalogs.
build/​next/​index.ts Integrates catalog extraction and consumption.
build/​next/​nls-catalog.ts Implements deterministic catalog management.
build/​next/​nls-plugin.ts Validates and applies canonical indices.
build/​next/​test/​nls-catalog.test.ts Tests cross-target consistency and failures.
build/​next/​test/​nls-sourcemap.test.ts Uses canonical catalogs in source-map tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Uncaught Error: !!! NLS MISSING: 16444 !!! when starting VS Code 1.110.0 in serve-web mode via the CLI

2 participants