Skip to content

记录页编辑:主记录的字段和主从子表的行一起进入编辑状态,一次保存、同一个事务 #35599

Description

@objectstack-fleet

coordinator#1 · hotlong · session_85eb0287cb754f0f9c2bed54cab9abff

立卡门类别:④ 协调节点的子单,承父单 #35590(专题:记录详情页重做,维护者直派)。⛔ 不是认领。优先级 p2(维护者 2026-11-19:「这一批卡p2」)。

维护者 2026-11-19 原话:「编辑的时候也要能一起编辑和保存」「这个你要具体调研合理性和代码能实现的可行性」。

图是深色稿,只表达结构和尺寸,颜色沿用现有主题变量。参照对象 Twenty 是 AGPL,只参照结构,⛔ 不抄代码。代码读数取自 origin/main 7ece0204a6。外壳(顶栏、左侧栏)不动。

现状

要做的

  1. 点「编辑」后,记录页概览进入编辑状态:字段变成输入控件,概览里的主从子表变成可编辑的行(可加行、删行、改行)。头部右边换成「取消」「保存」。
  2. 一次保存:主记录的改动和所有主从子表的增、改、删打成一个批次提交,复用 MasterDetailForm 的批次构造,走 POST /api/v1/batch,同一个事务。失败时什么都不落,逐条显示错误并定位到对应字段或行。
  3. 多张主从子表都在同一次保存里。
  4. 「取消」放弃全部改动;有未保存改动时离开页面要确认。
  5. 父对象或子对象没开 bulk 时,不出现「能编辑但存不了」:要么平台在声明了主从正文表格时自动放行这条批量路径,要么进入编辑状态前就提示并只允许改主记录。由实现方选一种并写进 PR。
  6. 抽屉里同样适用。

裁决

  • A. 审批锁定也锁主从子表的行——已裁决:锁。 维护者 2026-11-19 原话:「一起锁」(问的是「审批中的记录,它的主从子表的行也一起锁住吗?」)。主记录因审批锁定时,它的主从子表不能增、改、删,客户端禁用,服务端在子对象的写入钩子里检查父记录的锁。理由:审批人批的是「这条记录连同它的明细」,批的过程中明细能改,等于批的内容会变。这一项要动服务端。
  • B. 逐字段就地改是否保留——待维护者裁决,裁决前先按建议做。 协调席建议:保留给没有主从子表的对象和简单字段;有主从子表的对象统一走「编辑 → 保存」,避免同一页上两种保存方式并存。

不做的

  • 不改新建表单;不改表单弹窗本身。
  • 普通关联子表的行不在这次一起编辑的范围内。

验收

  • HotCRM 报价单:点「编辑」,改一个主记录字段、改一行数量、加一行、删一行,点「保存」:只发一次批量请求;刷新后四处改动都在,合计正确。
  • 同样的操作里把某一行改成不合法的值:保存失败,主记录和其他行都没变,错误定位到那一行。
  • 点「取消」后页面回到编辑前的样子。
  • 审批中的商机,直接调接口改它的产品明细被拒绝,返回 RECORD_LOCKED。
  • 验收条款 records-forms.master-detail-atomic-save 同笔更新,覆盖记录页这条路径。
  • 一次合入、一次验收。PR 正文列出迁移和作废的测试,以及同笔修改的 docs/qa/platform-checklist 条款。

Reader: domain:ui 车道;另需 plugin-approvals 的服务端改动(裁决 A:锁)。ui/packages/app-shell/src/views/RecordDetailView.tsx、InlineEditSaveBar.tsx、ui/packages/plugin-form/src/MasterDetailForm.tsx、packages/rest/src/batch-routes.ts、packages/plugins/plugin-approvals/src/lifecycle-hooks.ts。依赖子卡「主从子表」。

Dedupe: 记录页 编辑 子表 一起保存、record page edit master detail batch save(objectstack,open)→ 0;相关:#34566(已关闭)。

正文最后更新:2026-11-19T21:51Z

Activity

  1. added
    enhancement
    priority:p2
    domain:ui
    on Nov 19, 2026
  2. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:ui · pm:queue; rationale: area:ux · Feature (header fields and master-detail rows edit together and save in one transaction) · a child of the maintainer's record-page topic #35590 (his words for this batch: 「这一批卡p2」) → p2 as he set it.

  3. added
    pm:queue
    on Nov 19, 2026
  4. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    coordinator#1 · hotlong · session_85eb0287cb754f0f9c2bed54cab9abff

    裁决 A 已定,正文已同步。

    维护者 2026-11-19 原话:「一起锁」。问的是:「审批中的记录,它的主从子表的行也一起锁住吗?」

    落到本卡:

    • 主记录因审批锁定时,它的主从子表不能增、改、删。
    • 客户端禁用这些入口;服务端在子对象的写入钩子里检查父记录的锁,直接调接口改也要被拒绝,返回 RECORD_LOCKED。
    • 这一项要动 packages/plugins/plugin-approvals,不只是界面。

    裁决 B(逐字段就地改是否保留)仍待定,先按正文里的建议做。

  5. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

    Claim: PM loop round 20 · area ux-2, second dev (maintainer direct dispatch: epic #35590; seat split names #35599 third in the ux-2 lane; its dependency #35597 merged as 9b6db730b2; seat 5 cleared a parallel start beside #35601 on a clean file overlap) · 2026-11-20T03:29Z
    Area: ux-2
    Session: session_01Utp6CZrgaiMgTJCnswR6jQ
    Account: os-bill
    Branch: claude/issue-35599-record-edit-save
    Worktree: objectstack-issue-35599
    Domain: domain:ui (+ plugin-approvals server guard, ruling A)
    Seat: repo:objectstack#5
    File surface: ui/packages/app-shell/src/views/RecordDetailView.tsx (ux-2's regions only: the approval-lock read ~2307-2352, the canEdit conjunction ~5536-5543, the save-bar mount ~5831, and the overview edit-state swap for body tables; the header's Cancel/Save swap through the existing action-bar props, no header layout change), ui/packages/plugin-detail/src/InlineEditSaveBar.tsx (and the inline-edit provider it pairs with), ui/packages/plugin-form/src/MasterDetailForm.tsx (reuse its batch construction; export a helper if needed), packages/plugins/plugin-approvals/src/lifecycle-hooks.ts (child insert/update/delete guards), their tests, docs/qa/platform-checklist item records-forms.master-detail-atomic-save, root .changeset/. ⛔ Not ui/packages/plugin-detail/src/RelatedList.tsx, RelatedRecordActionsBridge.tsx, useOpenRecordList.ts, record-related-list.tsx, RecordPickerDialog.tsx, RecordPagePreferencesContext.tsx (#35601 in flight on those); not packages/rest/src/batch-routes.ts without reporting first; not RecordDetailView.tsx's tab region (~5610, another area's #35595), containers.tsx, RecordPageColumns.tsx, recordPageColumns.ts, record-reference-rail.tsx, DetailView.tsx, buildDefaultPageSchema.ts; no packages/spec/**, no docs/adr/** without reporting first. Stop on breach and report.
    Container & model: L, mode:subagent, model: default — no path-derived mandate, effort: xhigh (server write guard, approval semantics)
    Clause-②: no (measure; a REST or spec contract change makes it yes — report first)
    Metadata-protocol: none (measure)
    Responsibility: ui app-shell / plugin-form record-page edit and save, and server plugin-approvals lock enforcement in objectstack; every record page with master-detail body tables, and every write to a locked record's detail rows
    Thread-read: none
    Premise: holds as filed (card readings at 7ece0204a6; the save bar now mounts at ~5831 and the canEdit conjunction sits at ~5536-5543 on current main; re-read first)
    Serial constraints cleared: no open PR touches the listed files (live read of all open PRs' files at claim time); #35601's branch touches RelatedList.tsx, RecordPickerDialog.tsx, RecordPagePreferencesContext.tsx and react context, none of this surface; #35593 (header) merged
    Pre-claim lane: domain:ui + plugin-approvals
    Pre-claim deps: none open (#35597 closed)
    Prior rulings read (check-prior-rulings --card 35599 --paths RecordDetailView.tsx,MasterDetailForm.tsx,lifecycle-hooks.ts,batch-routes.ts): ruling A on the card (Bill 2026-11-19 「一起锁」) binds: a locked parent's detail rows refuse insert/update/delete with RECORD_LOCKED; ruling B is open on a decision card, built on the recommended option (inline edit off on objects with master-detail body tables) as ONE isolated canEdit term; ADR-0098 §7 (hook-bypassing write paths) binds the guard's coverage — the batch and bulk paths must not bypass it; ADR-0058 D4 (RLS write check) and ADR-0148 D6 read; lifecycle-hooks.ts ~:750 ruling (2026-08-31) and its exemptions (system writes, the opening flow run ~658-664) carried; RecordDetailView.tsx ~:3303 ruling untouched; whether ADR-0019 needs a note is unverified (any docs/adr edit makes the PR Tier H)

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 20, 2026
  7. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

    Ruling B recorded: keep per-field inline edit on every object (maintainer, 2026-11-20T04:24Z).

    Asked: 「记录页是否保留逐字段就地编辑?」 Answer: 「全部保留」.

    • Inline edit stays on every record page, including objects with master-detail body tables. The suggested "turn it off where body tables exist" term is not built.
    • The two save paths stay distinct on one page: inline edit saves the master record alone (the save bar), and the "Edit → Save" mode saves the master and its detail rows in one batch transaction.
    • One mode at a time: while the page is in whole-record edit mode, inline edit is not offered, and entering edit mode with unsaved inline changes asks first. This is implementation, not a new rule.
    • Ruling A (detail rows locked while the master is under approval, 「一起锁」) is unchanged.
  8. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ
    os-dev-report

    {
     "issue": 35599,
     "status": "done",
     "branch": "claude/issue-35599-record-edit-save",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/35755",
     "head": "9cb0d100",
     "session": "session_01Utp6CZrgaiMgTJCnswR6jQ",
     "premise_still_valid": true,
     "summary": "Resumed after a container restart and finished Ruling B 「全部保留」. Inline edit now stays on every object, those with body tables included; the provisional canEdit term is gone, and inline edit saves the master alone through the save bar. Edit, then Save, sends the master and its rows in one atomic batch. Only one mode runs at a time: (a) the edit state takes the record's single inline session, so it draws no pencil and no save bar; (b) pressing Edit with unsaved inline changes opens an AlertDialog, never window.confirm. Gate reds that came from the earlier commits are fixed: the erasure ratchet and the system-context census (server half), the editor's registration sitting outside the sideEffects chain plus a stale KNOWN_SCHEMA_TYPES, and zh-Hant needing a regeneration. origin/main was merged in cleanly. Ruling A is unchanged.",
     "rulings": {
      "A": "settled (lock), committed a0e58e3b; unchanged",
      "B": "「全部保留」: both modes on every object, one at a time; the provisional term inlineEditOffForBodyTables was removed and its test retired"
     },
     "tests": "Run under os-verify-lock with --maxWorkers=1 --pool=forks. (1) On head 9cb0d100: RecordDetailView.harness.test.tsx (all 70), recordEditState.helpers-35599.test.ts, RecordBodyTableEditor.recordEditBatch-35599.test.ts, scripts/__tests__/check-side-effects-array.test.ts and scripts/__tests__/known-schema-types-derivation-5115.test.ts gave 'Test Files 5 passed (5) · Tests 141 passed (141)'. (2) On the merged tree d0bdc9da: the three edit-state files plus packages/i18n/ gave 'Test Files 108 passed (108) · Tests 2039 passed | 13 skipped (2052)'. plugin-approvals detail-row-lock.integration.test.ts gave 'Tests 10 passed (10)'; no approvals or i18n file changed after d0bdc9da. (3) Type checks: app-shell and @object-ui/cli type-check exit 0 on 9cb0d100; plugin-form, i18n and app-shell type-check, and plugin-approvals typecheck, exit 0 on d0bdc9da. (4) Ruling B pins in block recordEditState-35599: save-bar-alone (one update of {summary}, no batch) and, in the edit state, zero pencils and no save bar; discard confirm (Keep editing keeps the draft, Discard enters over the stored values, window.confirm stub not called); CONTROL (no unsaved changes, so no dialog). (5) Ablation through scripts/ablation-replace.mjs (source-resolved, no dist leg): requestEnter's setConfirmDiscard(true) changed to enterNow() moved the anchor 1 to 0, and the one-mode cell went red ('Tests 1 failed | 6 passed'); restored with blob == HEAD b0b0e192465c and an empty git diff HEAD. The earlier run's server-guard ablation (7 failed | 3 passed, restored to blob def2d354757a) and its client-gate mutation are cited in the PR.",
     "gates": "dispatch-gates --commands derived 121 families on the final tree, and all 121 ran locally. 108 ran on d0bdc9da; the 13 the package.json edit added ran on 9cb0d100, all exit 0. --ran reconciliation: '121 derived famil(ies) accounted for — 121 run, 0 NOT-MEASURED'. Non-zero exits: 'pnpm --dir ui exec vitest run scripts/' exit 1 on d0bdc9da, all four failures from this diff (sideEffects chain, KNOWN_SCHEMA_TYPES); fixed in 9cb0d100, and the two files re-ran green. check:query-options-erasure and check:system-context-census were red on the earlier run's tree and are fixed, exit 0. NOT MEASURED because a prerequisite is missing in this box: check:dts-closure exit 1 (unbuilt packages' dist), check:dual-build-cjs-loads exit 3, spec check:skill-examples exit 3 (client-react not built), check-plugin-teardown-shape --self-test exit 3 (shallow checkout). check-sdui-manifest exit 0 on 9cb0d100. check-platform-checklist --changed-from origin/main OK (0 anchors lost). check:nul-bytes exit 0. CI check-runs had not concluded when this was written: in_progress.",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
     "browser_reading_A5": "NOT MEASURED: the container restart killed the dogfood build, and the resume was limited to affected test files; the PR states this",
     "item5_choice": "option 2, UI-only (bodyTablesSaveTogether: a missing bulk keeps the tables read-only with a notice; the record saves through a plain update). No batch-routes.ts or contract change.",
     "client_gate": "done through the existing RelatedRecordActionsBridge serve prop (withDetailWritesWithheld); RelatedList.tsx and the bridge are not edited",
     "line_budget": "29 files, +2027 / -16 against origin/main merge-base (under 2500)",
     "files_changed": "see PR #35755 file list (29)",
     "mcp_calls": "0",
     "api_writes": "3 REST requests in 2 relay strokes — pr_create (POST /repos/objectstack-ai/objectstack/pulls + its assignee leg POST /repos/objectstack-ai/objectstack/issues/35755/assignees, run 44681446436); os-dev-report comment via post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/35599/comments). git push is not a REST write.",
     "deviations": [
      "Mechanism assumption (a) is wrong. Adding !recordEditState as a canEdit term would break the edit state: the controller enters the record-level inline session, and the provider's enter() refuses when canEdit is false. The old term carried !recordEditState as an exemption inside the edit state, not as a gate against it. (a) holds structurally: the edit state is that single session (every field an input, no pencils) and the save bar is unmounted while it is on. So no term was added; the PR explains why, and a test pins zero pencils and no save bar in the edit state.",
      "Edit's disableDuringInlineEdit read a ref written later in the same render, so it could lag a render. It is now state set during render (setRecordEditEligible); the hooks-below-early-returns constraint rules out an effect.",
      "Files outside the claim's surface: content/docs/permissions/system-context.mdx (census row, required by the gate for the new isSystem read); ui/packages/app-shell/src/index.ts, package.json and a new record-body-table-editor-renderer.tsx (sideEffects chain); ui/packages/cli/src/utils/known-schema-types.ts (regenerated); the i18n locales and plugin-form (from the earlier run).",
      "origin/main (5 commits) was merged in as one merge commit before the PR opened, per AGENTS §10. The merge was clean, and builds and affected tests were re-run after it.",
      "A5 browser dogfood was not run (see browser_reading_A5).",
      "The resume order's trailer spelling is 'Co-authored-by: Claude' plus Claude-Session, and the commits use it; the harness reminder's model-named trailer was not used."
     ],
     "uncovered_write_paths": "see security_findings",
     "open_questions": [],
     "security_findings": "withheld",
     "out_of_scope_findings": [
      "none"
     ]
    }
  9. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

    Claim amendment · area ux-2 · 2026-11-20T06:31Z · amends claim 7029471192 (answers L1-a R1, 7032276125)

    File surface, added (all already in PR #35755; nothing new is edited by this amendment beyond the R2 guard commit, which stays in lifecycle-hooks.ts and its integration test, both already claimed):

    Everything else in claim 7029471192 stands.

  10. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

    Closed-out · area ux-2 · 2026-11-20T07:41Z

    reading value
    PR #35755 MERGED as 1e018d6ede (Fixes #35599; this card closed completed)
    review record L1-a ACCEPT 7032276125 + delta ACCEPT 7032383142; seat: no L2 (no contract face)
    rulings A 「一起锁」 and B 「全部保留」, as recorded on this card

    Delivered:

    • A locked master's detail rows refuse insert, update and delete with RECORD_LOCKED, with the record lock's exemptions. A reparent is checked at both ends, and an unresolvable write fails closed. The UI hides New, Edit and Delete on a locked record's lines.
    • The record page's Edit → Save writes the record and its body-table rows in one atomic batch, with refusals placed on the field or line.
    • Inline edit stays on every object and saves the record alone. Only one mode is active at a time, and Edit with unsaved inline changes asks first.

    Browser reading (A4) was not measured; the PR body says so.
    State: pm:dispatched removed; card closed.

  11. removed
    pm:dispatched
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:uxdomain:uienhancementpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions