Skip to content

fix(platform): render notifications bell i18n keys and ICU placeholders (#2055) - #2237

Merged
yannickmonney merged 2 commits into
mainfrom
tale/xs76cvbcpnkemvbfe54egjgq5589av1k
Jun 29, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
tale/xs76cvbcpnkemvbfe54egjgq5589av1k

Conversation

@larryro

@larryro larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two i18n defects on the Notifications bell (issue #2055):

  • [117] Agent budget & circuit-breaker org notifications rendered raw i18n keys. The six titleKey/bodyKey strings written by convex/agents/guardrails/internal_mutations.ts (agentBudgetWarn*, agentBudgetExceeded*, agentCircuitTripped*) had no entries in the notifications namespace, so the bell printed the raw key. Added all six to en/de/fr and registered them in lib/i18n/keys-dynamic.txt. Spent/monthly amounts are formatted to USD in the mutation (formatUsd) so the locale strings stay currency-symbol free.
  • [118] task_review_requested rendered a raw {agentSlug} when no agent slug was present. Added a no-agent fallback body inbox.taskReviewRequestedBodyNoAgent (no {agentSlug} placeholder) and made notifyTaskReviewRequested pick it when agentSlug is absent.

Tests

  • New regression test lib/i18n/notification-keys.test.ts: asserts all six notification keys exist per locale and fully substitute, and that the task-review body fully substitutes both with and without an agent slug (the no-agent fallback references no {agentSlug}).
  • bunx vitest --run --project server (i18n parity/usage + guardrails + new test), tsc --noEmit, and oxlint --type-aware all green locally.

Closes #2055

tale-agent added 2 commits June 28, 2026 04:28
…rs (#2055)

Add the six missing agent budget / circuit-breaker keys to the notifications
namespace (en/de/fr) and register them in keys-dynamic.txt, and add a no-agent
fallback body for task_review_requested so the bell never shows a raw
{agentSlug} when no agent slug is present. Money is formatted to USD in the
mutation so locale strings stay currency-symbol free.

Closes #2055
…2055)

The notifications namespace is also mirrored server-side in notification_messages.ts for Slack delivery; add the six new keys there too (deep-equal parity guard).
@larryro

larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Desk Review — PR #2237 (fixes #2055)

Verdict: READY TO MERGE.

Reviewed the full implementation on branch tale/xs76cvbcpnkemvbfe54egjgq5589av1k (two rounds: 6 parallel breadth subagents across the five review-bar dimensions, then independent confirmation of every candidate finding).

CI

gh pr checks — all green. Every Build/Lint/Type check/Unit/UI/Storybook/Playwright (16 shards)/Smoke/Scan job passed; only fork-PR-only jobs (Trivy, Validate images (fork PR), Smoke (fork PR), Web/Docs container test) are skipping, which is expected for a same-repo branch. No red, no pending.

Tests

Installed workspace deps (bun install) and ran the project's own suite once:

  • bunx vitest --run --project server → 543 files / 6523 tests passed (exit 0).
  • Targeted: lib/i18n/notification-keys.test.ts (new) + convex/notifications/notification_messages.test.ts (NOTIFICATIONS_I18N↔messages parity) → 35 passed; full lib/i18n → 47 passed.

What I verified

  1. Budget path (recordBudgetWarnCrossing, recordBudgetPause): params {agentSlug,pct,spent,monthly} / {agentSlug,spent,monthly} exactly match the placeholders in agentBudgetWarn* / agentBudgetExceeded* across en/de/fr and NOTIFICATIONS_I18N. pct is a whole number (Math.round(...*100)), so {pct}% is correct. formatUsd(cents) = $${(cents/100).toFixed(2)}. Audit-log/emitEvent still correctly carry raw cents — no stale param.
  2. Circuit-breaker (tripTaskCircuitBreaker): params {agentSlug,taskTitle,windowRuns,windowHours} match agentCircuitTripped* in all locales.
  3. Task-review no-agent fallback (notifyTaskReviewRequested): with agentSlug → taskReviewRequestedBody (+agentSlug param); without → taskReviewRequestedBodyNoAgent with agentSlug omitted from params, and the fallback body contains no {agentSlug} token. Both branches walked.
  4. Namespace routing: org notifications render via t('notifications'); userNotifications via tInbox('inbox') — both new key sets land in the correct namespace.
  5. Real-renderer proof: rendered all 8 new strings through the actual i18next-icu engine (the bell's runtime) for en/de/fr with production params, including a hostile taskTitle containing ' and ". Zero parse errors, zero leftover placeholders. (Note: the test's helper comment says "no ICU", which is technically imprecise — the engine is ICU — but the strings use no plural/select, so the hand-rolled {name} regex models them faithfully here. Cosmetic doc nit only.)
  6. Completeness/boundaries: enumerated every titleKey/bodyKey written in convex/ — no other key is missing from its namespace (same-class bug not left unfixed); concurrency_queued correctly uses a task comment, not a notification. Bell renders title/body as escaped JSX text (no dangerouslySetInnerHTML) — no injection via taskTitle/agentSlug. Slack path (renderNotificationMessage) now resolves all six keys (no more raw-key warn/fallback), values Slack-escaped.
  7. Conventions: formatUsd is an appropriate local server-side helper (the canonical formatCostCents is client/locale-aware and wrong here); the conditional-key + conditional-param pattern matches sibling emitters in notify.ts; locale parity is clean (typography differences {pct} %, guillemets are correct per-locale, not drift); keys-dynamic.txt additions correct (the inbox.* fallback is covered by the existing blanket entry).

No blocking issues found. The change is minimal, focused, fully resolves both defects in #2055, and is well-tested.

(Automated desk review — review only; no code modified.)

@yannickmonney
yannickmonney merged commit 6794158 into main Jun 29, 2026
51 checks passed
@yannickmonney
yannickmonney deleted the tale/xs76cvbcpnkemvbfe54egjgq5589av1k branch June 29, 2026 17:21
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.

Bug: Notifications bell renders raw i18n keys (agent budget/circuit-breaker) and raw ICU placeholders (task_review_requested with no agentSlug)

2 participants