Skip to content

email-template-render (a): declared i18n bundle collides — Registry keys email_template without locale, only the last locale survives #7730

Description

@huangyiirene

Symptom

A stack declaring two emailTemplates with the same name and different locale (an i18n bundle) does not materialize all rows. The registry logs [Registry] Overwriting email_template: packageId:name and only 3 of 4 authored templates reach sys_email_template — the en-US twin is dropped. The spec states that multiple rows with the same name but different locale form an i18n bundle, so both should coexist.

Root cause

packages/objectql/src/registry.ts (~line 1826) computes the storage key without locale:

const storageKey = packageId ? + "${packageId}:${baseName}" + : baseName;

A second row with the same name but a different locale collides on that key and overwrites the first (the [Registry] Overwriting ... path at ~line 1828). Locale is not part of any item key, so the registry cannot hold an i18n bundle for a single name. This contradicts the spec's own "same name + different locale = i18n bundle" statement. The key computation is generic to every item type, so nothing email-specific rescues it.

Stale-premise check: identical in src, in the executed dist, and on origin/main (byte-for-byte with the 92f26f75 pin) — not fixed upstream.

Reproduction

  1. Author a stack declaring two emailTemplates with the same name, one locale: 'en-US' and one locale: 'zh-CN'.
  2. Boot; watch the registry log and query sys_email_template.

Expected: both locales materialize as an i18n bundle. Actual: [Registry] Overwriting email_template is logged and only the last-registered locale survives.

Source

Extracted from the QA run #7690 (framework 92f26f7, console 09987b680).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions