Repository navigation
hotclm's own notifications reach a zh-CN user in English — "Contract approved: …", "Renewal decision due: …", "Expired: …" — though the platform's notify template path is per-recipient localized - #174
Merged
Conversation
…emplates Every notify node in the approval, signature, renewal-notice, expiry, legal-review SLA and stalled-turn flows wrote its words inline in `title` / `message`, which NotifyConfigSchema defines as one text for every recipient. A zh-CN user's bell and mail read English. Each node now names an `email_template` bundle (`template`) and fills its holes from `templateData`. Each bundle has an en-US member (the resolver's fallback floor, carrying the unchanged English sentence) and a zh-CN member. The delivery path picks the member per recipient, from sys_user.locale or else the deployment default, for the inbox and the email channel alike. The missing-formalities notice passes the formality list in both languages, because the words are option labels computed in the flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn
Contributor
Author
席位核对 — ACCEPT · head
|
| check | reading |
|---|---|
| shape | draft → main, Fixes #160; mergeable clean |
| CI on the head | both Validate check-runs success on c4423f7 = PR head.sha |
| scope | 16 files (+409/−27): ten notify nodes move to template + templateData, with new bundles in src/email-templates/ (en-US + zh-CN members) |
| surface | three places sit beyond the claim's letter, and the seat accepts them: the one emailTemplates registration line in objectstack.config.ts (the platform requires it); _daily-sweep.ts rowBody, which builds four of the ten nodes; and signatureExecution's zh-CN formality list. RenewalStartFlow is untouched, as the seat asked. Nothing governed; lint 0 warnings |
| the defect | measured live with the declared staff. Before: a zh-CN requester's bell read 'Contract approved: …' in English. After: approved, rejected, executed-copy-missing and formalities-outstanding each arrive in the recipient's own language, zh-CN or en. A recipient with no locale gets the deployment default. All 7 emails had a subject in the bell's language, status sent, with 0 failed |
| not measured live | the daily sweeps (renewal due, expired, renewal drafted, review 30/60, turn stalled): an admin cannot start a system-run schedule flow on demand on 18.2.0 (403). All ten bundles were rendered through plugin-email's own renderTemplate for zh-CN, en and fr-FR: 20 members, 0 failures, no unfilled hole |
| en-US member | the 18.2.0 resolver's only fallback is the literal en-US, so an en member would leave other locales with no floor. Accepted |
| follow-up | obligation-due.flow.ts and payment-overdue.flow.ts still send inline English. The card did not list them; the seat files a follow-up card |
Landing: under the maintainer's merge authorization (project thread: 「你可以自己审核的就自己合并」).
Generated by Claude Code
zhuangjianguo
marked this pull request as ready for review
October 27, 2026 11:11
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #160
Clause-②: no
Metadata-protocol: none
Every notification hotclm sends itself wrote its words inline in a
notifynode'stitle/message.NotifyConfigSchemadefines those as one text for every recipient ("not localizable — usetemplatefor per-locale content"), so a zh-CN user's bell and mail read English. Each listed node now names anemail_templatebundle intemplateand fills its holes fromtemplateData. The platform picks the member per recipient, fromsys_user.localeor else the deployment default, on the inbox and the email channel alike.What changed
src/email-templates/: ten bundles, one file per flow, built bynoticeBundle()in_bundle.ts. Each bundle has an English member carrying the unchanged sentence and a zh-CN member written in the tone of the existing zh-CN bundle (你, 「」, 请…). They are registered throughdefineStack({ emailTemplates }).clm.contract_approved,clm.contract_rejectedclm.execution_copy_missing,clm.execution_formalities_missingclm.renewal_notice_dueclm.contract_expired,clm.contract_auto_renewedclm.legal_review_over_30_days,clm.legal_review_over_60_daysclm.turn_stalleden-US, noten. At 18.2.0 the resolver matches(name, locale)exactly. For a call that names a locale, it retries one rung only, the literalen-US(EMAIL_TEMPLATE_FLOOR_LOCALE), with no subtag folding. The stack's default isen, and the Console's English choice writesen. Both miss and land on theen-USfloor, and so does any tag nobody authored. A member written asenwould have no floor: an unknown locale would dead-letter withTEMPLATE_NOT_FOUND. The measurement below shows theen→en-UShop live.title/messagefortemplate+templateData(CEL value envelopes,ref()as before). In_daily-sweep.ts,RowNoticetakes either form, sorowBody()can build a template notice. The two sweeps outside this card still pass inline copy (see Acceptance notes).signatureExecutionalready mapped each missing formality to its English option label. It now also maps it to the zh-CN bundle's label (missingTextZhCN, joined with 、, read fromsrc/translations/zh-CN/objects.lifecycle.ts). The zh-CN member reads that list and the English member readsmissingText. Without this, the zh-CN sentence would name the formality in English.RenewalStartFlowis untouched. Inrenewal-notice.flow.tsonly the sweep's notify node changed.Measured on 18.2.0 (
pnpm demo:zh, port 3152, throwaway DB, Chromium at/opt/pw-browsers/chromiumin zh-CN)The personas are the declared demo staff, signed in through the Console's login form with admin123. Each requester's line manager was set to Executive with
POST /api/v1/auth/admin/set-user-manager. Each persona's language was chosen in the Console (account menu → 语言). That control writesPATCH /api/v1/data/sys_user/ID {"locale":"zh-CN"}(or{"locale":"en"}), so a user who picks 中文 in the Console becomes a zh-CN recipient.Before (origin/main 0159171). NDA-2026-0016 (owner requester1, sys_user.locale zh-CN) went through approval: counsel2 decided the open deviation and the review and sent it for approval, and executive approved rung 1. requester1's bell read Contract approved: 双向保密协议 — 铜田商旅 / Your contract … has cleared every approval rung ….
sys_email.subjectwas the same English. This confirms the card's premise.After (this branch):
sys_email.subjecten)No delivery failed (
sys_notification_deliverywith status other than success: 0 rows). The metadata API serves all 20 members (GET /api/v1/meta/email_template: 10 names ×en-US+zh-CN). The boot banner shows no degraded capability. Two console errors in the browser,404and401on resource loads, show identically on origin/main (before run) and are not from this change.NOT MEASURED in the browser: the four daily sweeps (renewal decision due, expired, renewal drafted, 30/60 days in review, waiting on the counterparty). They have no on-demand door.
POST /api/v1/automation/expiration_sweep/trigger(and…/turn_stalled/trigger) as the dev admin (tried on the before boot; the refusal is the platform's flow-start rule, not this change) answers403 PERMISSION_DENIED: "This caller may not start this flow. A flow that runs on its own trigger starts there…". The cron is0 6/7 * * *UTC. Per the round's rule, no alternate route was taken.What covers them instead is a render proof through the platform's own code. All 10 bundles were rendered by plugin-email 18.2.0's
EmailService.renderTemplate, the call the inbox channel makes, overcreateRegistryEmailTemplateLoaderfedallEmailTemplates. Each bundle ran for recipient localeszh-CN,enandfr-FR. Result:bundles=10 members=20 failures=0. zh-CN rendered the Chinese member,enandfr-FRfell to theen-USmember, and no{{hole was left unfilled.Gates (head c4423f7)
pnpm install: exit 0pnpm validate: exit 0. The 7 diagnostics are byte-identical to origin/main's (diffed against agit archive 0159171snapshot).pnpm lint: exit 0, 0 warnings, 6 suggestions, identical to origin/main.pnpm typecheck: exit 0pnpm lint:i18n-gate: exit 0 (✓ i18n gate … COVERAGE : 0 missing keys across 2 locale(s))CLM_DEMO_SEED=1 pnpm validate: exit 0Acceptance notes
src/flows/obligation-due.flow.ts(due in 7 days / due today / overdue) andsrc/flows/payment-overdue.flow.ts(instalment overdue) still send inline English. The card did not list them and the claim did not include them. With this PR the move for each is three lines: a bundle plustemplate/templateDataon therowBodynotice.review_started_atandturn_sinceare datetimes and render as raw ISO (2026-09-12T00:00:00.000Z) in both members, exactly as the inline English did. Formatting them (for example| date:iso) would change the English text, so it is left out of this card.src/email-templates/, this PR editsobjectstack.config.ts(oneemailTemplates:registration, which the platform requires for an app to declare templates),_daily-sweep.ts(the builder that emits four of the ten notify nodes), andsignatureExecution(the zh-CN formality list).🤖 Generated with Claude Code
https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn