Repository navigation
refactor(sales): Send Email and the activity actions add mail and timeline entries through the platform's doors - #2455
Merged
Conversation
…eline entries through the platform's doors Send Email hands its message to ctx.email.send and its timeline entry to ctx.activity.append; the fifteen generated activity actions add their entry through ctx.activity.append. No app action body writes an append-only object itself: the platform's writers stamp the sender or actor, the organization and the origin. Mail now goes out from the deployment's configured sender, with the rep named in the display name; the rep's address is the reply-to. An email's timeline entry carries the mail log id in its metadata (email_id) instead of a source, because the door reads a source in the caller's scope and a sales rep cannot read the mail log. The bodies no longer resolve the actor's display name themselves; the shared resolution block and its splice guard are gone, replaced by a guard that no shipped body addresses an append-only object and that every timeline writer uses the door. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwzNRpkoiCFn1kQpUh
…ts timeline entry carries The mail goes out from the deployment's configured sender address with the rep's name in the display name, and a reply comes back to the rep. The contact's timeline entry carries the message id in its details instead of linking to the mail log row. English, Simplified and Traditional Chinese. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwzNRpkoiCFn1kQpUh
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
|
security#2 · os-tesla · session_01L9qibwMmGJKaQ52CgHqNu2 ACCEPT · 2026-11-13T15:40Z · PR #2455 · head
|
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.
Requested by Tesla · project thread
Refs objectstack-ai/objectstack#32004
Clause-②: no
Metadata-protocol: none
维护者速读
ctx.email.send),时间线条目交给平台的活动服务(ctx.activity.append);各销售对象上的「记录通话 / 记录会议 / 安排会议」(共 15 个)也改为通过活动服务写时间线。应用的操作不再自己写邮件日志或活动流;发件人、操作人、组织和来源由平台记录。sys_user拼显示名的旧做法,改由平台写入显示名。src/sales/actions/contact.actions.ts的 Send Email 操作体,src/sales/actions/activity-actions.ts第 3 步(时间线条目),以及test/script-bodies.test.ts里新加的「代表能在联系人时间线看到」和「没有操作体直接写只追加对象」两个用例。npx vitest run test/script-bodies.test.ts test/global-actions.test.ts,应全部通过(130 个)。Description
The contact's Send Email action and the fifteen generated activity actions (Log a Call, Log a Meeting, Schedule a Meeting on every sales object) hand their mail and timeline entries to the platform's declared doors,
ctx.email.sendandctx.activity.append, which ship in @objectstack 18.4.0. No app action body writes an append-only object itself; the platform's writers record the sender or actor, the organization and the entry's origin.Type of Change
Related Issues
Refs objectstack-ai/objectstack#32004 (step 2 of the append-only ruling). The platform half, objectstack-ai/objectstack#33110 (a hook's published
bodydescription says a hook body cannot send mail), has merged.Changes Made
src/sales/actions/contact.actions.ts(Send Email): the message goes toctx.email.sendwith the contact as its related record and the rep's address as reply-to; the timeline entry goes toctx.activity.append. Capabilitiesapi.write,email.send,activity.append. The entry names the contact and carries the mail log row's id in its metadata (email_id), not as itssource: the door reads asourcein the caller's scope, and a sales rep cannot read the mail log.email_idis not a metadata key the door reserves for the platform.src/sales/actions/activity-actions.ts: step 3 of the generated body adds the entry throughctx.activity.append, with the event as itssource; the summary and label are held to the timeline's bounds and the notes in the metadata hint to 4,000 characters (the event keeps the full notes). Capabilitiesapi.write,activity.append;api.readis gone with the body's ownsys_userread. The shared actor-name resolution block (ACTOR_NAME_RESOLUTION_SOURCE) is retired: the door stamps the actor and the platform's display name.test/script-bodies.test.ts: Send Email's pin reads what the doors stored: queued handover, rep as sender of record, configured sender with the rep in the display name, rep as reply-to, the contact as related record, nosource,metadata.email_idequal to the mail row, the action as origin. New: the rep reads the entry on the contact's timeline through the record page (POST /data/crm_contact/:id/page), as the rep; and a guard that no shipped body addresses an append-only object (the set is read from the booted registry) and that every timeline writer uses the door. Retired: the four pins of the body's ownsys_userlookup and its splice guard.test/global-actions.test.ts: the actor test also checks each entry's origin names its own action; a new pin that no activity body resolves an actor; the twins comparison leaves outorigin, which names each twin's own action. Retired: the three pins of the body'ssys_userlookup and its fault cases, and their read watcher.test/freeze-guard-reference-cleanup.test.ts: a comment no longer cites the retired splice guard.content/docs/guides/email-and-calendar{,.zh-Hans,.zh-Hant}.mdx: Send Email's steps 2 and 3 say where the mail goes out from, where replies go, and what the timeline entry carries..changeset/mail-and-timeline-through-platform-doors.md(hotcrm: patch).Testing
Run on this branch with
mainmerged in (35f230d, @objectstack 18.4.0; the docs commit 238251d touches docs only, and the 45 suites that readcontent/docswere run again after it: 1056 passed, 6 skipped):pnpm changeset status --since=origin/main:hotcrmpatch.pnpm validate,pnpm typecheck,pnpm lint(objectstack lint --strict),pnpm hygiene,pnpm hygiene:tokens,pnpm build: exit 0.pnpm test: 268 files, 5106 passed, 7 skipped, 0 failed.apps/docs):pnpm types:checkexit 0 (compiles the edited MDX).old) in place ofemail_idis refused by the door; a mail-logsourceon the email entry is refused for the rep (the door reads it in the rep's scope); a directsys_emailwrite in the body trips the new guard.Checklist
.changeset/mail-and-timeline-through-platform-doors.md(hotcrm: patch).Acceptance notes
🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibwzNRpkoiCFn1kQpUh