Skip to content

[engine][设计卡] 多态弱引用挂靠表的平台级删除级联 —— sys_record_share/attachment/comment 一族的统一清理机制 #5180

Closed as not planned

Description

@claude

Restart-when: a second subsystem needs its own self-bound afterDelete cleanup for a polymorphic weak-reference attach table, or an actual orphan-row defect is filed against the attachment / comment / approval family — write the ADR before dispatch

从 #5103 的裁定中拆出的平台级设计卡。#5103 已按方案 A(plugin-sharing 自绑 afterDelete)先行恢复不变量;本卡跟踪更普适的机制。

问题形状

一族系统表按 (object_name, record_id) 多态挂靠业务记录:sys_record_share、sys_attachment、sys_comment、sys_approval_request 等。宿主记录删除后,这些行成为孤儿 —— 每个子系统各自补 afterDelete 是重复实现,且新挂靠表默认不被覆盖(fail-open by default)。

提议

平台级「多态弱引用」声明 + 删除时级联:挂靠表在元数据里声明 (object_name, record_id) 为弱引用,引擎在宿主删除时统一清理(或标记)。declared = enforced:声明了挂靠就自动获得清理,新表不再能静默漏。

依赖与范围

落点 packages/objectql / packages/spec(声明面),横跨 engine + spec 车道;需要 ADR。#5103 的 A 实现可作为第一个迁移案例。

Refs: #5103、#4779、#4757、#4630。

identity 车道 PM session_015W6nhsDrz6zWQc8je12a1t 代立;labeling ≠ claiming。


Generated by Claude Code

Activity

  1. added
    pm:on-holdDecision made, deliberately deferred — no dispatch, no nag; restart condition in the hold comment
    and removed on Aug 5, 2026
  2. os-zhuang commented on Aug 6, 2026

    @os-zhuang
    Contributor

    存量裁决轮(维护者 2026-08-06 委托,session_01LeEfA7CFwbJb7JJmXm2KM3):裁定停放(pm:on-hold)。#5103 已按 A 案恢复 sys_record_share 的不变量;通用删除级联机制需要 ADR、横跨 spec+engine,当前无第二个挂靠表的实际孤儿缺陷在拉动——创业阶段聚焦原则下刻意延后。重启条件:attachment / comment / approval 族任一挂靠表出现实际孤儿行缺陷单,或第二个子系统需要重复自绑 afterDelete 清理时重启,重启后先出 ADR 再派发。


    Generated by Claude Code

  3. added
    domain:engineRetired 2026-10-22, alias of domain:server (engine surface); in-flight cards keep it until they land
    and removed on Aug 19, 2026
  4. objectstack-fleet commented on Sep 23, 2026

    @objectstack-fleet
    Contributor

    维护者裁定:保留挂起 —— 记下来,因为本卡的 Restart-when: 已经被触发过,以后不要再按它唤醒

    分诊席(session_01Tw7jnJinGHvoGSi8aFkhPJ),2026-09-23T07:43Z。⛔ 不改状态、⛔ 不改标签。维护者 2026-09-23 在分诊会话里逐张复核 pm:on-hold 卡,对本卡的回复原文:「#2657 + #3257 5180 保留」。

    维护者做决定时已经知道的事实

    本卡的 Restart-when:(正文第一行):

    a second subsystem needs its own self-bound afterDelete cleanup for a polymorphic weak-reference attach table, or an actual orphan-row defect is filed against the attachment / comment / approval family

    这个条件 在 2026-08-31 就已经满足了,只是没有被扫到:#13568(维护者 2026-08-31「同意」)让 plugin-approvals 自己绑了一个全局 afterDelete 钩子,用来撤销已删除记录上还没处理的审批请求(packages/plugins/plugin-approvals/src/lifecycle-hooks.ts,bindRecordDeleteCancelHook)。这正好就是「第二个子系统自己绑删除清理」,而且落在 approval 这一族。

    呈给维护者的另外两点:

    以后怎么读这张卡

    维护者是在知道 #13568 已经触发条件的前提下选择了保留挂起。⇒ ⛔ 以后的巡检不要把 #13568 当成新的唤醒信号。本卡仍等 2026-08-06T08:04Z 那条裁定里的其余情形:attachment / comment 这一族出现实际的孤儿行缺陷,或者又有一个子系统需要自己绑删除清理。重启后先写 ADR,再派发。

    ⚠️ 有一处本席读不到:GitHub 显示本卡有 2 条评论,API 只返回 1 条(5202037737)。卡片最后更新时间是 2026-08-24,另一条评论很可能就是那一次留下的,发评论的账号已被隐藏,和 09-21 那批 404 卡是同一个原因。⛔ 本席没有读到它的内容,所以也不对它做任何断言。


    Generated by Claude Code

  5. objectstack-fleet commented on Sep 27, 2026

    @objectstack-fleet
    Contributor

    Closed not_planned: a design card whose own restart waits on a second subsystem that has not appeared

    Triage seat (objectstack-wide, seat post #6015) · session_01W89enF2dYV7K4N2Fbfj33f · 2026-09-27T16:01Z. ⛔ Not a claim, ⛔ not a dispatch.

    Provenance: who — the maintainer; verbatim — 「同意」, answering the triage seat's on-hold cleanup plan (which named this card and this disposition); where — the maintainer's chat with the triage session session_01W89enF2dYV7K4N2Fbfj33f, 2026-09-27.

    Reopen is free on exactly this card's condition: a second subsystem needs its own afterDelete cleanup for such a table, or an orphan-row defect is filed. The design notes here stay the starting point.

  6. removed
    pm:on-holdDecision made, deliberately deferred — no dispatch, no nag; restart condition in the hold comment
    on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:engineRetired 2026-10-22, alias of domain:server (engine surface); in-flight cards keep it until they landenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions