Repository navigation
fix(plugin-auth,plugin-email)!: the invitation mail warns once on an untranslated role label and states when it expires - #26072
Conversation
… and states its expiry Claude-Session: https://claude.ai/code/session_011Ed1XCLEcJnL1JmrzvGgmW Co-authored-by: Claude <noreply@anthropic.com>
…he invitation expiry sentence Claude-Session: https://claude.ai/code/session_011Ed1XCLEcJnL1JmrzvGgmW Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Ed1XCLEcJnL1JmrzvGgmW Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 24 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6da05dff5f34df7e492fbc300073145d957870de && git checkout 6da05dff5f34df7e492fbc300073145d957870de
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0a6948210cc96a95cc568b30193895e157968c01 34331f6613fdcb19e8495de4210887c15bfc0566 && git checkout -B drift-repro 0a6948210cc96a95cc568b30193895e157968c01 && git merge --no-ff 34331f6613fdcb19e8495de4210887c15bfc0566
node scripts/docs-audit/affected-docs.mjs --json 0a6948210cc96a95cc568b30193895e157968c01
|
…mplate variable, refused loudly when absent Claude-Session: https://claude.ai/code/session_011Ed1XCLEcJnL1JmrzvGgmW Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Ed1XCLEcJnL1JmrzvGgmW Co-authored-by: Claude <noreply@anthropic.com>
…l, not one ICU release's wording Claude-Session: https://claude.ai/code/session_011Ed1XCLEcJnL1JmrzvGgmW Co-authored-by: Claude <noreply@anthropic.com>
Contract reviewServed-tier: Inputs read: card #25802 (body and all four comments, the claim 6413932028 and the two os-dev-reports 6414584447 and 6415196510 included), PR #26072 (body, file list, net diff against origin/main at this head, and the diff from the previously reviewed head This head supersedes the FAIL record on ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.
Generated by Claude Code |
Requested by Leehom · project thread
Part of #25802 (the in-repo half; the card stays open for the cloud control plane's i18n composition, routed to that lane)
Clause-②: no (narrowing: the built-in
auth.invitationrows declare a new required variable,expiresAt, so asendTemplateofauth.invitationthat names noexpiresAtis now refused withMISSING_VARIABLESwhere it used to be sent)Metadata-protocol: none (a built-in template row's declared variables, read by the email service at send time; no spec key, authorable spelling or stored shape moves)
What changes
Two fixes to the
auth.invitationmail. Both are named on the card (the second is from its follow-up comment 6398750019).invitationRoleLabel(plugin-auth/src/invitation-role-label.ts) now logs onewarnper send when the mail's locale is not English and a role token's label is still its authored (English) text. The warn names the locale, the tokens and what to check:[AuthManager] invitation mail: no 'zh-CN' label was found for the membership role(s) 'member'; the mail names the authored (English) label instead. …. Before this, only a read that threw was reported. The read that answers but holds no zh-CN entry, which is the reported shape (以 Member 的身份, no log line), was silent. Each degradation gets one warn: a thrown read keeps its own warn and gets no second one, and a token outside the option list keeps its existing warn and is not counted again. An en-US or en-GB mail reads the authored label as its own text and logs nothing. The mail is always sent.auth-manager-organization-plugin.ts) passesinvitation.expiresAtas a new required template variable,expiresAt, as an ISO-8601 instant. The engine has no conditionals, so every body states the expiry, and a send without it is refused (MISSING_VARIABLES: expiresAt) instead of being sent with a dangling "expires on ." sentence. If the value does not read as a date, the sender leaves it out and logs onewarnthat names the invitation id and says the mail will be refused, so the invitation can be resent. Each of the four built-in rows (en-US, zh-CN, ja-JP, es-ES), in both the HTML and the text body, ends with one sentence that renders it as{{ expiresAt | datetime:long }}. This uses the date formatter the template layer already has (ADR-0053 Phase 2). The date reads in the row's locale and in the reference timezone the send names. Thelongstyle prints the zone name, so a reader never has to guess the zone. With UTC the sentences render as 「此邀请将于 2031年3月4日 UTC 05:06:07 过期。」, "This invitation expires on March 4, 2031 at 5:06:07 AM UTC.", 「この招待の有効期限は 2031年3月4日 5:06:07 UTC です。」 and "Esta invitación caduca el 4 de marzo de 2031, 5:06:07 UTC.".BREAKING
This is for code that sends
auth.invitationitself. The built-in organization-invitation sender already passes the value, and it is the only sender in this repository (git grepatorigin/main).inviter,organization,role,acceptUrlandappNamewas delivered.MISSING_VARIABLES: expiresAt.dataasexpiresAt.The changeset carries
adr-0087: not-required (no-migration-prescription), andcheck-adr-0087-registrationaccepts it.Measurement (the order's first step, at
origin/mainbbf7061)platform-objects/src/apps/translations/zh-CN.objects.generated.tshassys_member.fields.role.options= 所有者 / 管理员 / 受托管理员 / 成员 / 外部成员.LiteKernelwith the realI18nServicePlugin(theregistered file-based i18n adapterthe cloud log names) and the realPlatformObjectsPlugin, then calledinvitationRoleLabel('member', 'zh-CN', { getI18n }):getLocales()defaultLocale: 'en', fallbackLocale: 'en'supportedLocales: ['en']supportedLocales: ['en', 'zh']supportedLocales: ['en', 'zh-CN']defaultLocale: 'zh-CN', fallbackLocale: 'en'The card's symptom (
Memberand no log line) reproduces only when the service's reported locales do not namezh-CN.translateMetaListbuilds its bundle fromgetLocales(). So the label read here is correct. The cloud control plane's i18n composition is the likely cause: a declaredsupportedLocales, or bundle registration. I could not read that half from this repository, and I have reported it to the seat. This PR adds the warn, which names exactly that check.Tests
Red first. The new and updated pins, run against the BASE implementation (the three source files restored from bbf7061, the tests kept): plugin-auth
invitation-role-label.test.tshad 5 failed / 19 passed, and plugin-email (auth-templates-locales,builtin-auth-render-identity,plain-text-faces) had 11 failed / 90 passed. The source was then restored from HEAD and proven bygit diff HEADempty plus a blob-hash match on all three files.Green, at head ee295b9 (after merging
origin/main):pnpm --filter @objectstack/plugin-auth --filter @objectstack/plugin-email run test: plugin-auth 197/197 files, 3753 passed, 10 skipped; plugin-email 38/38 files, 699 passed. The lock VERDICT was command-exit 0.run typecheckon both packages (tsc, examples config,check:test-typecheck): exit 0.pnpm exec eslint --no-inline-configover every.tsfile this PR touches: exit 0.(narrowing)arm):pnpm --filter @objectstack/dogfood testat ee295b9, after its^...closure build. The lock VERDICT was command-exit 0. Test Files 296 passed, 3 skipped (299); Tests 2523 passed, 18 skipped (2541). 0 failures.What the pins hold:
Memberand one warn, whose meta names the role, the locale and that a service was present. No service at all on a zh-CN mail gives one warn: the existing pin asserted silence, and it now asserts the one warn. A list warns once, naming every English token. An out-of-list token is not double-counted. A thrown read produces exactly one invitation warn in total. en-US and en-GB mails produce no warn.Dateand a string both reach the template as the ISO instant. A missing or unreadable expiry is left out of the data, with one warn naminginv1and the refusal. A readable expiry logs no expiry warn. In every locale, a send withoutexpiresAtis refused withMISSING_VARIABLES: expiresAtand nothing reaches the transport. Per locale, both faces carry the expiry sentence for a UTC send. A send namingAsia/Shanghaimoves the wall-clock and namesGMT+8. A zh-CN mail carries no English expiry text. The existing every-fact-in-both-faces pin now coversexpiresAt.builtin-auth-render-identity.test.ts) now renders withtimezone: 'UTC', so its bytes never follow the machine's zone. Only the fourauth.invitationrows' html/text digests moved. Every other template's 28 rows kept their digests under the UTC render.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 69 families at ee295b9 (the same set as the first round). All were run there, with exit codes captured before any pipe.--ranreconciles: 69 derived, 68 run, 1 NOT-MEASURED, 0 UNRUN.pnpm check:dual-build-cjs-loads(exit 3, PREREQUISITE NOT MET: it needs a full-repo build). CI runs it.check-adr-0087-registration --base origin/mainexit 0 (it accepts theno-migration-prescriptionexemption),check-changeset-no-majorexit 0 andcheck-empty-changesetexit 0.Clause-②line.Acceptance notes
auth.password_reset,auth.magic_linkandauth.two_factor_otpdeclareexpiresInMinutesrequired: falseand print "expires in {{expiresInMinutes}} minutes" unconditionally. A send without the value renders a dangling sentence.auth.account_invitationalready declares its ownrequired: true.longstyle. Passing the invitee's or the organization's timezone would be a separate change to the locale ladder, which this card does not ask for.supportedLocales: ['en', 'zh'],FileI18nAdapter.getTranslations('zh')answers{}: it matches exactly, and the bundles are keyedzh-CN. The kernel's in-memory provider resolveszhto the zh-CN bundle. So the same declaration translates on one provider and not on the other. The measurement is a composed-kernel probe only, with no public-door reading, so per the report contract it is a note here and not a card. Owner: none.#24154stays closed. Its ruling (the role in a Chinese invitation reads 「成员」) is what the label read already delivers, and this PR makes the residual miss loud.Generated by Claude Code