Skip to content

autonumber 业务标识字段默认不唯一,可铸重号 —— 裁定:默认唯一(租户复合形状),显式退出才不唯一 #13894

Description

@huangyiirene

按维护者裁定上行立卡(2026-08-31,hotcrm#1301 决裁批 #19-hotcrm ②,批复「其他同意」采纳呈报「定性业务标识符 + 平台路线」)。

平台级 declared ≠ enforced(实测)

裁定方向

autonumber 字段默认 unique,租户复合形状照 case_number 既有样板;显式声明退出才不唯一。

设计约束(实现 + 复审判断)

  1. 退出通道的拼写与 docblock(何时合法退出:纯展示序号等),⛔ 不发明超出需要的配置面;
  2. 存量重号处理必须响亮:默认翻转时,已有数据含重号的表建索引会失败 —— 迁移/启动路径要检测并点名重号行 + 修复指引,⛔ 不静默跳过、⛔ 不静默降级为不唯一;
  3. 与 The #8686 tenancy backfill destroys the autonumber high-water mark: the merge targets a row that does not exist yet, the __global__ row is deleted unconditionally, and an already-allocated business identifier is re-issued #12394(烧号重发)/Seed loader writes untenanted rows while the REST path stamps an organization — one single-tenant install runs two autonumber scopes and mints duplicate business identifiers, silently (17.0.0 GA) #8686(计数器分裂)的修复交互写进 PR —— 默认唯一会把那两类缺陷从「静默重号」变「响亮拒绝」,这是意图的一部分;
  4. 条款②:YES(路径肢 packages/spec/src/** 预期命中 + 内容肢:已发布 autonumber 契约行为变化),契约复审档位,changeset 标行为变化;
  5. 首个消费者/验收:hotcrm 八字段在平台默认下获得唯一性、零应用侧声明(hotcrm#1301 已改挂本卡)。

Refs: hotcrm#1301(九字段测量)· hotcrm#1292(被措辞误导的前卡)· #12394 · #12395 · #8686 · #13848。

Activity

  1. zhuangjianguo commented on Sep 3, 2026

    @zhuangjianguo
    Collaborator

    Landing reconciled — domain:spec seat, session_0174WZTU6XcFcS7g2kykC53i (seat post #6017), 2026-09-03T15:48Z.

    PR #14904 MERGED 2026-09-03T14:48:27Z as f8e8f035 — contract review PASS at tier by the director seat (14904#issuecomment-5527202464, a take-over of the stalled in-seat review after the dispatching session went off shift), ready + auto-merge by the same seat. Probed on origin/main 9786d39 (15:38Z): packages/spec/src/data/field.zod.ts:2047 reads patch.unique = field.type === 'autonumber' ? 'organization' : false; and the unique describe at :960 carries the autonumber-default sentence with the explicit unique: false opt-out. Card closed via Fixes; pm:dispatched was stripped at 15:20Z (label set read back = domain:spec).

    The dev report's two open questions (5523180672) are answered inside that PASS: the ADR-0120 D4 posture is kept (an accepted maintainer decision, not reopened — a loud, remedied degrade satisfies constraint 2); hotcrm's ten autonumber fields are parsed declarations, so the default reaches them once a published @objectstack/spec carries it — the cross-repo unlock for hotcrm#1301 is an installable release plus a hotcrm bump, not this merge. Filed by the dev, unassigned, for triage: #14901 (sub-issue of this card — the hand-written field-types row) and #14902 (engine lane — a plain unique index over existing duplicates throws the raw driver error at boot). The dispatching session's cloud dev session_017xqRv7A8HiJdKxsVm1UCuM is scoped to that session's account and cannot be archived from this seat — recorded here, not carried as a successor debt.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions