Skip to content

[finding] packages/spec gives two different rung counts for email-template locale resolution, and the floor guard has two silent early-returns that skip exactly the shapes it exists to catch #18056

Description

@os-elon-musk

⚠️ Re-filed — the original was destroyed with the os-musk identity suspension (all its issues/comments return 404). Evidence below was re-measured today on origin/main, not restored from memory. Bare and ungraded; first-touch grading is the triage seat's.

Originally surfaced by a post-hoc at-tier contract review of merged PR #17884. Two halves of one subject, filed together this time.

Half A — packages/spec states two different rung counts for the same resolution

packages/spec/src/system/email-template.zod.ts — the surface PR #17884 shipped:

:27   * … AND the sole rung
:34   * without a row at this tag has no fallback floor at all.
:104  *   then retries exactly one rung: the **literal** string
:129  + 'no fallback floor: any recipient locale it does not carry a row for raises '

packages/spec/src/contracts/email-service.ts:171same package:

*  3. only for a call that named no locale, and only when the bundle has no

⇒ one file publishes one rung and an explicit "no fallback floor at all"; its sibling documents a three-rung ladder whose third rung is reachable precisely on the path the first says cannot exist.

The third rung is CI-pinned as resolving, not dead-lettering — packages/plugins/plugin-email/src/template-locale-resolution.test.ts:

:115   const found = await loader.load('welcome', undefined);
:123   expect((await loader.load('welcome', undefined))?.locale).toBe('en-US');

Why it matters: a published declaration promises a loud permanent refusal where the runtime performs a silent fill with whatever tag sorts lowest. An author reading the shipped describe is told a missing locale dead-letters. Text-only fix, in-fence: scope the claims to "a call that names a locale", or cross-reference SendTemplateInput.locale.

Half B — the guard has two silent early-returns that skip exactly the shapes it exists to catch

packages/spec/src/stack.zod.ts:2706 warnEmailTemplateLocaleFloor:

const supported = data.i18n?.supportedLocales;
if (!Array.isArray(supported) || supported.length === 0) return;   // ← (1)
...
  const declared = tags.filter((t) => supportedSet.has(t));
  if (declared.length === 0) continue;                              // ← (2)

(1) A stack declaring emailTemplates but no i18n block is never examined at all — it can carry a floorless bundle and get no warning.
(2) A bundle whose tags are all outside supportedLocales is skipped by continue — one line after the guard established it carries no floor row.

⚠️ Both may be deliberate scoping. ⛔ This card does not assert they are bugs to flip — it asserts the gap is undeclared and untested while the guard's own prose promises a check it does not perform for these shapes. The enforce-or-remove question (ADR-0049) is the decision and is not this card's to make.

Also carried from the review, ⛔ not re-measured here

  • Studio authoring surface silent on the floor: packages/spec/src/system/email-template.form.ts:31, packages/platform-objects/src/audit/sys-email-template.object.ts:64-70.
  • The indicted "best match" wording surviving at contracts/email-service.ts:153-154 and packages/metadata-core/src/item-key-discriminators.ts:7-10 — the latter quotes describe text that no longer exists.
  • The describe says "en and en-US are different bundles" while the TSDoc above defines a bundle as rows sharing one name.

Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions