Repository navigation
feat(service-messaging): each sending feature registers its notification topics, served with a name and when it fires - #39696
Conversation
…ce options door serving it A sending feature registers each topic it sends (label, description, variables as catalog keys with English fallbacks) through MessagingService.registerNotificationTopics; the preference options door serves registered topics as platform, with their texts in the caller's language. The held topic list stays until the sequencing fork is ruled. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ
… the topic registry pins Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ
…cs to the registry Audit, security, auth, messaging's own Slack link and in-app message doors, and core's Change Owner notice register their topics with an English label and description; the preference options door serves them. Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ Co-authored-by: Claude <noreply@anthropic.com>
…ckage Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ Co-authored-by: Claude <noreply@anthropic.com>
… test Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 6 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 65 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 90a41afaf7aedb8d75276af30a93c79364d27e07 && git checkout 90a41afaf7aedb8d75276af30a93c79364d27e07
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 04eba3d2d506f127049a9e27783c56b3617fae79 1ab675870cfe20a62ef19ad0e63a85ad49298cc3 && git checkout -B drift-repro 04eba3d2d506f127049a9e27783c56b3617fae79 && git merge --no-ff 1ab675870cfe20a62ef19ad0e63a85ad49298cc3
node scripts/docs-audit/affected-docs.mjs --json 04eba3d2d506f127049a9e27783c56b3617fae79
|
…lete the held topic list The approval plugin registers the fifteen topics its service sends with the messaging service's topic registry, beside its e-mail templates, so the preference options door offers approval.approved, approval.rejected and approval.abandoned with a name and when they fire. With every sender registered, service-messaging's PLATFORM_NOTIFICATION_TOPICS is deleted: the registry is the door's only platform source. Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ Co-authored-by: Claude <noreply@anthropic.com>
The phase 2 case assigned a vi.fn to mockContext.getService without the cast the generic signature needs, so check:test-typecheck read one TS2322 beyond its ledger. Cast it as PluginContext['getService']. Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxRrrjrsQAWAcsbV46 Contract-review-claim: session_01L9qibxRrrjrsQAWAcsbV46 · head 785344d · 2026-12-04T15:41Z |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxRrrjrsQAWAcsbV46 Contract reviewServed-tier: Read: card #39641 (body and all 9 comments), PR #39696 (body, 28 files, net diff against merge base ① Derived judgments
② Semver level
M1 (must-fix) — The changeset's title and first paragraph state a Console behaviour this diff does not ship. S3 (should-fix) — The changeset and PR body name ③ Boundary flags
N1 (nit) — The PR body's grep sentence under-counts the remaining hits (see above); none is a reader. ④ Design judgmentAgainst ruling 7409753977 / analysis 7408971705 (option D):
Against the zone amendments (7411363617, 7411387836, 7416235070): label and description required, key and variables optional; every held topic registered with English text; the four absent ones included; held list deleted in this PR; approvals beside Attempts to break it:
S1 (should-fix) — After the held list's deletion, a refused registration no longer "costs only the description": the topic is not offered at all unless a flow names it or the organization has stored one, and one collision drops the sender's whole call (all fifteen approval topics). The text was true in phase 2 and was not updated in phase 3. It is wrong in the four S2 (should-fix) — The door serves No must-fix in ④; M1 stands under ②. Implemented-by: VERDICT: FAIL |
…lared variables on the door The changeset no longer claims the Console pickers draw topic names (they still show ids; the drawing is the later ui card), names the four newly offered topics, the composition dependence, and the second door that reads the same options (GET /api/v1/messaging/me/preferences). The door serves `variables` only when the sender declared them, so "not declared yet" stays distinguishable from "declares none". The four senders' refusal warnings and docblocks now say a refused registration leaves the topics unoffered. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzh1VNrCPz6JqyRPQQ
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxRrrjrsQAWAcsbV46 Contract-review-claim: session_01L9qibxRrrjrsQAWAcsbV46 · head 1ab6758 · 2026-12-04T16:31Z |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxRrrjrsQAWAcsbV46 Contract reviewServed-tier: Delta round on record 7416374363 (FAIL at Findings of the previous record:
① Derived judgmentsEverything the previous record named right under ① still stands; the delta moves one answer.
② Semver level
③ Boundary flags
N2 (nit) — The module docblock of ④ Design judgmentThe previous record's reading against ruling 7409753977, analysis 7408971705 and zone amendments 7411363617, 7411387836, 7416235070 stands; the delta changes no registration, no source and no door path. On the S2 shape the dev chose (omit, of the two options offered):
The refusal wording (S1) is now true to the code path the previous record traced: No must-fix and no should-fix open. N2 does not hold the verdict. Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv L1-a · ACCEPT · #39696 @
Not Tier H: the zone lands it on this ACCEPT. |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxRrrjrsQAWAcsbV46 Landing · 2026-12-04T16:41Z · zone ot-p1 · head
State: ready + auto-merge through the merge queue under the maintainer's standing landing line on seat post #39520 (「复审通过的 PR 座位自己落地」). On MERGED, |
Requested by Tesla · project thread
Fixes #39641
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
@objectstack/service-messaging: the notification topic registry (notification-topic-registry.ts,MessagingService.registerNotificationTopics). A descriptor carries the topic id, alabeland adescription(each an Englishfallback, catalogkeyoptional) and optionalvariables; a malformed descriptor or a topic already registered is refused with aTypeErrorand nothing from the call is kept. The preference options door (GET /api/v1/messaging/preference-options) serves each registered topic withlabelanddescription, andvariablesonly where the descriptor declares them (absent = not declared yet, the generic variables apply;[]= the sender declared none), in the caller's language (messaging-service-plugin.tswiresregisteredTopicsinto its option sources). The plugin registers its own two topics (messaging.slack_link_removed,org.announcement) and core's Change Owner topic at init.@objectstack/core: exportsCHANGE_OWNER_NOTIFICATION_TOPIC_DESCRIPTOR(core cannot depend on messaging, so messaging registers it; zone ruling (b)).@objectstack/plugin-audit: registerscollab.mentionandcollab.replyonkernel:ready, beside its e-mail templates (collab-notification-topics.ts, new sibling module:audit-plugin.tsis over 1,000 lines and gains only the call).@objectstack/plugin-security: registerssecurity.access_upgradeandsystem.upgrade_impactonkernel:ready(security-plugin-start-hooks.ts).@objectstack/plugin-auth: registersauth.phone_otpandauth.phone_inviteonkernel:ready(phone-sms-notification-topics.ts, new sibling module:auth-plugin.tsis over 1,000 lines and gains only the hook).@objectstack/plugin-approvals: registers the fifteen topics its service sends, among themapproval.approved,approval.rejectedandapproval.abandoned, beside theregisterBuiltinTemplatescall inapprovals-plugin.ts(approval-notification-topics.ts, new sibling module: a later card adds catalog keys and variables to every descriptor, which would pushapprovals-plugin.ts, at 822 lines, past 1,000).PLATFORM_NOTIFICATION_TOPICS(preference-options.ts, never exported from the package) is deleted: the registry is the door's only platform source.git grep PLATFORM_NOTIFICATION_TOPICSstill hits two.changeset/pre/notes, threeCHANGELOG.mdfiles (release-owned, untouched), this PR's changeset and a comment inapproval-notification-topics.test.ts; no code reads the name.registerBuiltinTemplates); a refusal is onewarn, and since the registry keeps nothing from a refused call, those topics are then not offered at all (one collision drops every topic of that sender's call) unless a flow names one or the organization has stored one; the notices are sent either way. The audit and security packages declare the descriptor shape structurally, since they take no dependency on service-messaging.Tests
approval-notification-topics.test.ts(new): the realMessagingServicePluginandApprovalsServicePluginover a realObjectQL, the door driven through the handler the messaging plugin mounts; every approval topic is offered with label and description, among them the three never listed and the twelve approval ids the deleted list offered (pinned literally). It also pins that every'approval.*'topic literal in the package source is registered, and the no-member, refusal and success paths. Ablation: replacing the plugin'sregisterApprovalNotificationTopicscall with a no-op reds the door case (approval.abandoned: expected undefined to deeply equal {...}); restored,git diff HEADempty.slack-channel-composition.test.ts(the plugin plus the doors it mounts): the door servesorg.announcement,messaging.slack_link_removedandrecord.owner_changedwith label and description; CONTROL: a topic nobody in that composition registered is not offered at all.preference-options-routes.integration.test.ts,notification-topic-registry.test.ts,my-preferences-routes.integration.test.ts: the platform topics now come from registered fixture descriptors; a topic no feature registered is not listed. Ablation: dropping the plugin's registration call reds it (expected [] to deeply equal [ Array(3) ]), restored.audit-plugin.test.ts: registration onkernel:readyagainst a realMessagingService, a refused registration as onewarn, and a messaging service without the member.access-upgrade-report.wiring.test.ts: the security plugin'skernel:readyregistration, and a refusal as onewarn.auth-plugin.test.tsandphone-sms-notification-topics.test.ts: the auth hook, and the module's success, refusal and no-member paths.notification-topic-registry.test.ts(phase 1): the registry's refusals, rendering, and the door over it.variableson the door (contract review S2):preference-options-routes.integration.test.tspins a registered topic withoutvariablesserved with novariablesmember, one declaring a variable served with it, and one declaring[]served[];notification-topic-registry.test.tspins the rendering keeps the member absent. Ablation: restoring(d.variables ?? [])inNotificationTopicRegistry.renderreds both (2 failed / 21 passed), restored.Acceptance notes
pnpm dev:showcase -- --fresh(approvals composed) offers all 20 ids the held list offered plusapproval.approved,approval.rejected,approval.abandonedandorg.announcement, each with label and description;pnpm dev:crm -- --fresh(noapprovalsinrequires) offers noapproval.*topic, where the held list used to offer twelve that nothing in that composition sends. A topic an organization has stored notifications for is still offered understored.approval-notification-topics.tsand its test (new files), andmy-preferences-routes.ts(one doc sentence) withmy-preferences-routes.integration.test.ts, whose fixture leaned on the deleted list.ui/packages/fields/src/widgets/preferenceOptions.ts) keepsvalue,wildcard,configuredonly, and noui/file is in this diff. Drawing the name, description and variables is the ui card (notification template form: the topic picker shows label and description, the form lists the topic's variables #39651).GET /api/v1/messaging/me/preferenceslists a person's own preferences from the samereadPreferenceOptions, so each person's own list changes by composition the same way (the four new topics appear on a fresh boot; the twelveapproval.*ids leave where approvals is not composed). Named in the changeset too.Verification
Read first:
packages/services/service-messaging/src/preference-options.ts:readPreferenceOptionsnow reads platform topics fromregisteredTopicsonly.packages/plugins/plugin-approvals/src/approvals-plugin.ts: theregisterApprovalNotificationTopicscall afterregisterBuiltinTemplates.packages/services/service-messaging/src/messaging-service-plugin.ts:registeredTopicsinoptionSources.Two-minute check:
pnpm --filter @objectstack/plugin-approvals exec vitest run src/approval-notification-topics.test.ts, expect 5 passed, including "offers every approval topic with its label and description, the three never listed among them".Local readings at 1ab6758 (contract review rework)
variablesomission, N1 this body.approval-notification-topics.test.ts5 passed;audit-plugin.test.ts35 passed;phone-sms-notification-topics.test.ts+auth-plugin.test.ts124 passed;access-upgrade-report.wiring.test.ts10 passed.turbo run typecheck --onlyon service-messaging, plugin-approvals, plugin-audit, plugin-auth, plugin-security: 5/5 successful.dispatch-gates --commandsat 1ab6758 derives 85 families (28 paths vs merge base 1802815);--ran: 80 run exit 0, 5 NOT-MEASURED, 0 unrun. NOT MEASURED locally:check-comment-mask-corpus,check:query-options-erasure,check:type-check-debt(killed by local 120s/190s timeouts on a shared box),check:dual-build-cjs-loads,check:i18n(exit 3 PREREQUISITE NOT MET, nodist/in a closure-only build); CI runs all five.Local readings at 785344d
turbo run typecheck --continueon plugin-auth, plugin-approvals, plugin-audit, plugin-security, service-messaging and core: 46/46 tasks successful (plugin-auth a cache miss, executed). The first CI run at 1aaec7e readType Check · workspacered: plugin-auth'scheck:test-typecheckcounted one TS2322 beyond its ledger in the phase 2 case ofauth-plugin.test.ts; fixed in 785344d by typing the mock asPluginContext['getService'](check:test-typecheckfor plugin-auth: OK, held at the ledger).auth-plugin.test.ts121 passed at 785344d. Phase 2 readings at b36c272: plugin-audit 120 / 1990; plugin-security 294 / 7455 (52 skipped); plugin-auth 298 / 6356 (10 skipped); core 164 / 3866.dispatch-gates --commands, re-derived at 785344d, same 85 as at 1aaec7e): 85 run, all exit 0;--ranreconciliation: 85 run, 0 NOT-MEASURED (derived zero, every line carries its exit code). At 1aaec7e three first-pass reds were re-run:check:dual-build-cjs-loadsandcheck:i18nexit 3 (PREREQUISITE NOT MET, nodist/) green after the build each prescribes;check:query-options-erasurekilled by a local timeout, green on re-run.check-platform-checklist --changed-from origin/main: OK, 0 anchors lost.GET /api/v1/messaging/preference-optionsread as the seeded admin).Generated by Claude Code