Skip to content

Commit 4f5de7a

Browse files
committed
Merge branch 'main' of https://github.com/objectstack-ai/objectstack into claude/project-thread-bujuge
# Conflicts: # scripts/pm/check-skill-line-ratchet.mjs
2 parents aec0879 + 3faabd2 commit 4f5de7a

33 files changed

Lines changed: 1515 additions & 22 deletions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/plugin-view': patch
4+
'@object-ui/data-objectstack': patch
5+
'@object-ui/i18n': patch
6+
---
7+
8+
feat(console): Manage views restores the factory version of a customized package view
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: none
12+
13+
A pin, a rename or a set-default on a view a read-only package ships writes the whole view into the package's customization (`<package>.custom`), and every user of the view then sees that copy. Manage views now marks such a view "customized" and offers "Restore factory version" in its `…` menu. After one confirm, which says every user of the view sees the factory version again, the override is removed from the customization and the list shows the package's own view. A view without a customization has no mark and offers no restore; a refused restore is said with the server's own message.
14+
15+
- `@object-ui/data-objectstack`: `ObjectStackAdapter.restoreFactoryView(objectName, viewName)` deletes the view's draft, then its row, at the customization the ensure door names for the shipping package (`DELETE /meta/view/NAME?package=PAIR`, the door Studio's "Restore package original" uses). It refuses, sending nothing, a view that is no override of the package it is served under, and throws when the customization held no row of the view. The customization package itself stays. `listViews()` now carries a record's `overrides` declaration onto the flattened row.
16+
- `@object-ui/plugin-view`: `ViewTabItem.customized` and `ManageViewsDialogProps.onRestoreFactory`.
17+
- `@object-ui/i18n`: the mark, the menu entry, the confirm, its result and the failure title, in every locale pack.

‎.changeset/sec2-vv32.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/plugin-approvals': patch
3+
---
4+
5+
fix: a locked record's lines read as locked, and deleting the locked record still removes its lines
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
**Reading the lock answers for a line too.** `IApprovalService.getRecordLock` (and `GET /api/v1/approvals/records/:object/:recordId/lock`) now answers `{ locked: true }` for a `master_detail` child row while the record it belongs to is held by a locking pending approval: the same rows whose insert, update and delete the server refuses with `409 RECORD_LOCKED`. It used to answer `{ locked: false }` for them, so a page could offer an edit the server then refused. A row the caller cannot read still answers as a missing one.
11+
12+
**Deleting a record while its approval is pending removes its lines again.** The delete lands and cancels the pending request, as before the lines were locked; its `master_detail` lines are removed with it. The whole delete is refused `409 RECORD_LOCKED`, and the record, its lines and its request stay, when the line object has a second relation that also cascades on delete, or when the delete does not run inside an open transaction: a datasource that declares `supports.transactionsUnsupported`, a cascade across datasources, a record and its lines together on a datasource other than the default one, or a delete carrying the handle of a transaction that has already finished. Server code that owns the transaction must not catch the refused delete and commit anyway. A line is never removed by deleting a different record, except that when the locked record is itself the child of a record whose delete cascades to it (a `master_detail` child, or a `lookup` child with `deleteBehavior: 'cascade'`), deleting that parent removes the locked record and its lines and cancels its request.

‎.claude/skills/pm-dispatch/references/dispatch-runbook.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@
133133
- 席位写 assignee+`pm:dispatched`+带该 `Branch:` 的认领。
134134
- worktree 照建;线程读 `os-dev.md`、派发令、卡与全部评论,⛔ 不读 `SKILL.md`;references 按需读。
135135
- 交回:PR 与报告落地后给席位线程发一条消息(PR、head、报告要点);L1/L2 期线程不关,接 FAIL。
136+
- 线程每推后 10 分钟核 Actions 已起、非 `dirty`(冲突 PR 不起 CI),否则合 main 重推;等 CI 必留 `send_later` ≤30分钟兜底。
137+
- 席每轮读在飞卡 PR `pr-state.mjs`:推后 30 分钟零 Actions、`dirty`、2h 无推无报 ⇒ 当轮叫醒线程,⛔ 互等。
136138
- PR 正文由线程自改(中继 `issue_patch`)再报要点,⛔ 不请席或区代发;线程已关才代改。
137139

138140
## 派发前置:前提核实,再把本地检出钉到 main

‎.claude/skills/pm-dispatch/references/execution-duties.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
- 分诊预见的后续工作是一张卡,触发条件落地时立卡;⛔ 分诊一句话永不授权无卡编辑。
4747
- 阻塞项无主 ⇒ 被挡席认领做掉,不限大小;在该卡走完整认领、尊重其热文件串行队。
4848
- 阻塞项在飞 ⇒ 等;卡 PR 叠未合 PR 或 `Blocked-by:` 未合的,合前 ⛔ 不开线程(维护者令除外)。
49+
- 定「等 #N」即同笔写卡 `Blocked-by: #N`+`pm:blocked`;⛔ 只记记忆或评论,无读者即漏派。
4950
- 标签序 = NORTH-STAR「Priority」第 3 条(无级殿后),本车道开放卡现读 `card-pick.mjs --order <序>`。
5051
- 开放 = 未派发(无 `pm:dispatched`、无 assignee);在飞的 P0/P1 不挡任何候选,只余取卡全序。
5152
- 取卡全序:维护者直派插队卡(出处三件)> 契约面卡(判据见 `references/lanes/spec.md`)> 标签序。
@@ -180,7 +181,7 @@
180181
- ① Routine 席巡检首动作 `list_triggers` 确认 Routine 启用;项目席由事件与巡查 routine 唤醒。
181182
- ② 在飞期巡检 ≤45 分钟;待命期靠信箱与 PR 事件唤醒,兜底巡查每 4–6 小时跑待命五项。
182183
- 待命 = 无在飞卡/PR、未读信、候选;事件唤醒空手即收工,有活即复原;⛔ 不取 60–70 分钟。
183-
- ③ 已派发未回报的 dev 逐个发状态询问;派发后 ~45 分钟无远程产出即到门槛。
184+
- ③ 已派发未回报的 dev 与卡线程逐个发状态询问;派发后 ~45 分钟无远程产出即到门槛。
184185
- 已有远程分支/PR 不豁免探针。
185186
- ④ 活着 ⇒ 进度与阻塞点;回 no active task; resumed from transcript ⇒ 生前已死,询问即复活。
186187
- ⑤ 判据永远取正向证据:分支、PR、报告、探活回包。

‎.claude/skills/pm-dispatch/references/filing-gate.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- 增改 pm 规则的卡只在维护者点名时立(归 ③,正文引点名原话);⛔ 席位自提不立。
1818
- 新接口/协议键/元数据类型/审计种类/新能力另立 `Feature` 卡,⛔ 不作 `Bug` 选项,分诊拆。
1919
- ⛔ 不是卡:在建功能(码未合并)的问题,在该功能的卡与 PR 里修;合并后发现的才立 `Bug`。
20-
- 车队立的同专题卡只在改同一文件时互挡(判据同区租约重叠检查);次序偏好列在专题卡。
20+
- 车队立的同专题卡只在改同一文件时互挡(判据同区租约重叠检查);先后只写后卡 `Blocked-by:`。
2121
- 挡路卡只挡本卡一部分 ⇒ 把要等的部分拆成单卡挂 `Blocked-by:`,其余照常排队。
2222
- ⛔ 当前值(冻结、暂停、重点、只做 p1、并发)不进技能,只住座位贴与项目记忆;
2323
单卡裁决只住该卡;唯常设规则进技能,须维护者明言长期有效或由他合并该规则 PR。

‎.claude/skills/pm-dispatch/references/seat-lifecycle.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
- 停:队列空或 `rounds` 用尽(仅一次性调用适用);一轮 ≥ 半数派发失败或升级;维护者打断。
8989
- 队列空是待命非退场(按需席除外):巡查跑到收班,只维护者令停;⛔ 不按 N 次无变化即停。
90-
- 队列空是逐卡表:报无卡可派即贴 `card-pick.mjs --order <序> --why`;无卡点即候选,⛔ 不得报空。
90+
- 每轮对所接车道与专题跑 `card-pick.mjs --order <序> --why`,报空即贴;无卡点即当轮派,⛔ 不得报空。
9191
- 卡点一份词表:候选定义反面,open `Blocked-by:`、`outside --order`、无分诊审计、他席 `Claim:`。
9292
- 单车道仓 `repo:*` 席:每轮首触 sweep 清空再认领,先于待命五项;cloud 细则见 `lanes/cloud.md`。
9393
- 巡查每轮探针后读信箱、认领满 `batch`,跑待命五项;间隔按 `execution-duties.md` 收集节②。

‎content/docs/automation/approvals.mdx‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,41 @@ never deadlock against itself. The exemption is keyed on run identity rather tha
408408
elevation, so a `runAs:'user'` run stays row-level-security scoped while it
409409
writes — it does not become a system write.
410410

411+
**The record's lines are locked with it.** Rows of a `master_detail` child of the
412+
locked record (an expense claim's lines, an opportunity's products) refuse insert,
413+
update and delete with the same `409 RECORD_LOCKED`, and so does moving a row into
414+
or out of the record. The record lock's exemptions carry over: system writes and
415+
the run that opened the request still write the lines. Children joined by a plain
416+
`lookup` are not locked.
417+
418+
**Deleting the record while it is pending** is not refused: the delete lands and
419+
its pending request is cancelled (`status: 'cancelled'`, with `cancel_reason` on
420+
the row). The delete removes the record's `master_detail` lines with it. In the
421+
cases below the server refuses the whole delete with `409 RECORD_LOCKED` instead, and
422+
the record, its lines and its pending request all stay:
423+
424+
- the line object has a second relation that also cascades on delete (a `lookup`
425+
with `deleteBehavior: 'cascade'`, or a second `master_detail`), so the server
426+
cannot tell which record's delete removes the line;
427+
- the delete does not run inside an open transaction. This covers a datasource
428+
that declares `supports.transactionsUnsupported`, a cascade that spans more
429+
than one datasource, a record and its lines that sit together on a datasource
430+
other than the default one (the server opens its cascade transaction on the
431+
default datasource only), and a delete that carries the handle of a
432+
transaction that has already finished (for example from an `async` after-hook).
433+
The lines would be removed one by one, and a later refusal (a `restrict`
434+
reference to the record) would leave the record locked with its lines gone.
435+
436+
Inside a transaction the refusal is what keeps the lines: server code that owns
437+
the transaction must not catch the refused delete and commit anyway, or the
438+
lines are gone while the record stays locked.
439+
440+
Deleting a different record never removes a locked record's line, with one
441+
exception: when the locked record is itself the child of a record whose delete
442+
cascades to it (a `master_detail` child, or a `lookup` child with
443+
`deleteBehavior: 'cascade'`), deleting that parent removes the locked record and
444+
its lines, and cancels its request.
445+
411446
**Reading the lock.** Anyone who can read the record can ask whether it is
412447
locked, including a member who is not on the approval and so is served no
413448
request row:
@@ -423,7 +458,8 @@ which stay behind the object's `approvalsVisibleToReaders` switch. `locked` is
423458
`true` while a pending request's node has `lockRecord` other than `false`. That
424459
is the same check the server applies when it refuses an edit with `409
425460
RECORD_LOCKED`, so a page that reads it never offers an edit the server will
426-
refuse. The record is read as the caller: a record they cannot read answers
461+
refuse. Asked of a line, it answers `true` while the record the line belongs to
462+
is locked. The record is read as the caller: a record they cannot read answers
427463
`404 RECORD_NOT_FOUND`, the same body a record id that does not exist gets. The
428464
SDK call is `client.approvals.getRecordLock(object, recordId)`, and the service
429465
member is `IApprovalService.getRecordLock`. An approvals service without that

‎packages/plugins/plugin-approvals/src/approval-service.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ import {
163163
type FieldVisibilitySource,
164164
} from './payload-redaction.js';
165165
import { APPROVAL_REQUEST_CHILD_OBJECTS, type RequestVisibilitySource } from './request-read-gate.js';
166-
import { nodeConfigLocksRecord, recordHeldByLockingApproval } from './lifecycle-hooks.js';
166+
import { detailRowHeldByLockingApproval, nodeConfigLocksRecord, recordHeldByLockingApproval } from './lifecycle-hooks.js';
167167
import { PendingApproverReadGrantSource, type PendingApproverReadGrants } from './pending-approver-read-grant.js';
168168
// The ADR-0043 pages — the ONE copy of their text, rendered by the plugin's
169169
// self-hosted mount and by `handleActionPage` alike.
@@ -11124,7 +11124,11 @@ export class ApprovalService implements IApprovalService, ObjectSchemaReadDelega
1112411124
* `{ locked }` only: no request id, node, participants or `pending`. Request
1112511125
* content stays behind `approvalsVisibleToReaders` (#8652 ruling 5299823744,
1112611126
* untouched). The judgement is the record-lock hook's own
11127-
* ({@link recordHeldByLockingApproval}), never a second copy of it.
11127+
* ({@link recordHeldByLockingApproval}), never a second copy of it — and,
11128+
* for a master-detail line, the detail-row lock's
11129+
* ({@link detailRowHeldByLockingApproval}): a locked record's lines are
11130+
* locked with it, so the read answers `true` for a line whose write the hook
11131+
* refuses.
1112811132
*/
1112911133
async getRecordLock(
1113011134
object: string,
@@ -11139,7 +11143,9 @@ export class ApprovalService implements IApprovalService, ObjectSchemaReadDelega
1113911143
where: { id }, fields: ['id'], limit: 1, context,
1114011144
});
1114111145
if (!Array.isArray(readable) || readable.length === 0) return null;
11142-
return { locked: await recordHeldByLockingApproval(this.engine, objectName, id) };
11146+
const locked = await recordHeldByLockingApproval(this.engine, objectName, id)
11147+
|| await detailRowHeldByLockingApproval(this.engine, objectName, id);
11148+
return { locked };
1114311149
}
1114411150

1114511151
private async loadRequest(

0 commit comments

Comments
 (0)