Skip to content

Docs promise contact emails are unique "within the same account" — the enforced rule is per organization, and the documented use case is rejected #648

Closed

Description

@os-zhuang

Found while fixing #625 (account-name uniqueness). Out of scope there — different object, different files. Filing per Prime Directive #10.

What

content/docs/sales/contacts.mdx line 62 (and its two translations) state the contact-email rule as:

An email address must be unique within the same account. The same person can appear under multiple companies (a board member, for example) but not twice in one company.

Both sentences are wrong, and the second one documents a workflow the product actively refuses.

What is actually enforced, on two independent layers:

  1. src/objects/contact.object.ts declares field-level unique: true on email. Since framework#3696 that materializes as the tenant composite (organization_id, email) — unique across the WHOLE organization, not per account. The object's own comment says so: "two orgs may each know john@acme.com" — note "orgs", not "accounts".
  2. contact_integrity in src/objects/contact.hook.ts rejects a duplicate email across accounts before the database ever sees it. There is a test named for exactly this: test/hooks-runtime-sales.test.ts → "rejects a duplicate email GLOBALLY, not just within one account", whose comment records why: "A per-account lookup let a cross-account duplicate sail past the friendly check and explode on the DB's global unique index mid-conversion."

So the board-member example in the docs — the same person under two companies — is precisely the case that throws already exists. A user following the documentation gets an error the documentation says they will not get.

Affected files

  • content/docs/sales/contacts.mdx:62
  • content/docs/sales/contacts.zh-Hans.mdx:62
  • content/docs/sales/contacts.zh-Hant.mdx:62

Suggested fix

Docs-only. Restate the rule as enforced: an email address is unique within your organization — the same address cannot appear on two contacts even under different accounts; another organization on the same platform may have its own contact with that address. Drop the board-member example, or replace it with the shape the product supports.

Note the same sentence pattern was corrected for crm_account in #625 / PR #646 ("across the system (case-insensitive)" → per organization, exact match), so the wording there is a usable template.

Deliberately NOT part of this issue

Whether "one person, two companies" should be supported is a product decision, not a doc fix. If the answer is yes, it is a schema change (the contact-email constraint would have to move) and needs its own issue. This one is only about the docs describing what ships today.

Acceptance

  • The three contacts*.mdx rule lines describe the per-organization constraint that crm_contact.email + contact_integrity actually enforce.
  • No example in those files describes a write the product rejects.

Activity

  1. added
    bugSomething isn't working
    documentationImprovements or additions to documentation
    pm:dispatchedDispatched to a dev agent by /pm-dispatch
    pm:queueReady for the PM dispatch loop
    and removed
    bugSomething isn't working
    on Aug 2, 2026
  2. self-assigned this
    on Aug 4, 2026
  3. os-zhuang commented on Aug 4, 2026

    @os-zhuang
    ContributorAuthor

    认领:PM 循环第 1 轮(分诊:纯 docs,已入队)
    会话:session_01Rvtsew6XgsSjxVa59HRPRK
    分支:claude/issue-648-contact-email-docs
    Worktree:hotcrm-issue-648
    文件面:content/docs/sales/contacts.mdx + contacts.zh-Hans.mdx + contacts.zh-Hant.mdx,不碰其他文件


    Generated by Claude Code

  4. os-zhuang commented on Aug 4, 2026

    @os-zhuang
    ContributorAuthor

    验收(PM 循环第 1 轮,会话 session_01Rvtsew6XgsSjxVa59HRPRK):ACCEPT,已经由合并队列落地 —— PR #666(squash into main)。

    交付内容:三份 contacts*.mdx 的规则行改为实际生效的「组织内唯一」表述(措辞对齐 #646 模板,含小写归一化说明),删除了描述被拒写入的董事会成员示例;新增 test/docs-contact-email-uniqueness.test.ts 双向钉住(文档措辞 × 字段声明/无表级索引 × contact_integrity 真实行为),含反向验证(旧措辞还原 → 4 断言转红);changeset(patch)。dev 在 origin/main @ 17.0.0-rc.2 上重新核实过 premise 后才动笔。CI 9/9 绿。

    「一个人两家公司应否支持」的产品问题按 issue 原意保持悬置,未随本单裁决。


    Generated by Claude Code

  5. added a commit that references this issue on Aug 10, 2026
    b551f15
  6. added and removed on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationpm:dispatchedDispatched to a dev agent by /pm-dispatchpm:queueReady for the PM dispatch looppriority:p2Medium: important, M3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions