Skip to content

Commit fad7b8d

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-xgdbdf
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRabTH2KkTRU4d62Uq
2 parents 24c4208 + 346d56d commit fad7b8d

24 files changed

Lines changed: 877 additions & 59 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
'@objectstack/core': patch
3+
'@objectstack/skills': patch
4+
---
5+
6+
fix(core): a data import resolves a lookup cell naming a detail record within the master the same row names (#33523)
7+
8+
Clause-②: yes (narrowing) — widening: a row whose master identifies one of several same-named details now resolves it, where it was refused `reference_ambiguous`; `@objectstack/core` exports `referenceScopeSources` and the types `ReferenceMaster` and `ReferenceScopeSource`, `RefResolver` and `coerceFieldValue` take an optional scope, `coerceRow` an optional source row, `CoerceContext` an optional `referenceMasters`, and `ExportFieldMeta` an optional `dependsOn`. Narrowing: a row that names a master and a detail only another master carries is refused `reference_not_found`, where the detail was linked across masters; and a caller who cannot read the target's master field (or a `dependsOn` `param` field) is refused `reference_not_found` for a scoped lookup cell that the unscoped lookup resolved, because the scope puts that field into the caller's own filter and a filter on a field the caller cannot read is refused.
9+
Metadata-protocol: none
10+
Skills-docs: `content/docs/data-modeling/import-mappings.mdx` gains "A lookup cell is resolved within the row's own master"; `skills/objectstack-data/rules/relationships.md` names the scoping under `master_detail`.
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No key of any authorable schema is added, removed, renamed or re-shaped. `master_detail` and `dependsOn` are read as declared; the change is in how the import runtime resolves a cell, and no stored row is rewritten. -->
13+
14+
**What changes.** A detail's name is often unique only inside its master: two contracts can each carry an "Advance 30%" billing milestone. The import resolved a lookup cell across every record of the target, so a row naming contract B and "Advance 30%" failed with `reference_ambiguous`. A lookup cell is now resolved within the row's own master when either:
15+
16+
- the lookup's target declares a `master_detail` field, and exactly one other single-value reference column of the row points at that master object and is filled in; or
17+
- the lookup field declares `dependsOn`, and the row fills in the sibling field it names (the string form compares the target field of the same name; `{ field, param }` compares `param`). This is the filter the record form's picker applies; the `master_detail` inference above has no counterpart in the picker, so for a lookup without `dependsOn` the import is stricter than the form.
18+
19+
Inside that scope a tie is `reference_ambiguous`, and a name that only another master carries is `reference_not_found`; it never resolves to another master's record. The same holds for the match-key pass of an update or upsert import, so a key column naming a detail is grouped by the value the row's own pass resolves, for one level of master: a master column outside the key columns is resolved unscoped in that pass, so in a chain such as account → contract → milestone the two passes can differ.
20+
21+
**What stays.** A row that leaves the master blank is resolved across the whole target as before, `reference_ambiguous` on a tie. Two columns of the row pointing at the master object (a bill-to and a ship-to account) do not say which one is the master, so neither scopes; `dependsOn` says it. A master cell that fails its own lookup scopes nothing. Every lookup still reads as the importing caller: the scope only adds conditions to the same read, so a record the caller cannot read never matches.
22+
23+
**Field permissions.** Because the scope is part of the caller's own filter, a caller who cannot read the target's master field, or the field a `dependsOn` entry names as `param`, has every scoped candidate refused, and the cell answers `reference_not_found` even for a detail the caller can read and whose name is unique. The same row resolved before this change. It fails closed and discloses nothing.
24+
25+
**Remedy for a narrowed row.** A pasted id is scoped too, so a row that means another master's detail has no way through in one import. Correct the master cell; or, when the cross-master link is intended, leave the master column out of the import and set it in a second update. For the field-permission case, grant the importing caller read access to that field, or leave the master column (or the `dependsOn` sibling) out in the same way.
26+
27+
**Docs.** `content/docs/data-modeling/import-mappings.mdx` describes the scoping under cell coercion; the data skill's relationships rule names it under `master_detail`.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/mcp': patch
3+
'@objectstack/runtime': patch
4+
---
5+
6+
fix(mcp): `describe_object` no longer lists the hidden `__search` search companion, on either MCP transport
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
Where pinyin search is on, the registry serves an object with the hidden `__search` companion column beside its display field. `describe_object` described every served field, so it offered an agent that column (as `readonly` and `system`), while no caller may read, write or name it: a record never echoes it, a `$searchFields` override naming it is refused, and `validate_expression` answers `unknown-field` for a read of it.
12+
13+
`describe_object` now leaves the companion out on both transports: the HTTP bridge in `@objectstack/runtime`, and the stdio bridge and the `objectstack://objects/{name}` resource in `@objectstack/mcp`. Both skip it by the protocol's one constant, `SEARCH_COMPANION_FIELD` from `@objectstack/spec/data`. Every other field is listed as before, the injected system columns such as `organization_id` and `created_at` included.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
A per-organization seed replay no longer throws the driver's `INVALID_FILTER` on a dataset of a global object (one with no organization column and no tenant field, e.g. `tenancy: { enabled: false }`). The replay now matches such an object's existing rows unscoped, the same reading the seed loader's reference probe already uses for a global target, so every organization's replay upserts the one shared row instead of failing to land it.

‎.claude/skills/pm-dispatch/references/contract-review.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
`~/.claude/projects/*/<id>.jsonl`;`verify-review-tier.mjs` 拒即重跑 ⛔ 不改档名。
3939
- ④ 设计判断欠 schema、governed 规则文本、收窄三面:逐 `hits` 文件判改动对所引代码与
4040
验收场景是否成立,ADR 另判首个消费者与执行计划;①–④ 合称完整复核,余面同形无 ④。
41-
- 实质 head 各欠一轮完整复核,发现逐条定 must-fix/should-fix/nit(无碍正确性与契约);有前两级
42-
才由同一复核者 delta 复核修复;仅 nit 即终轮,nit 记接受的偏差、转后续卡或只改散文面。
41+
- 实质 head 各欠一轮完整复核,发现逐条定 must-fix/should-fix/nit(无碍正确性与契约);有前两级才
42+
由同一复核者 delta 复核修复;仅 nit 即终轮,nit 记接受的偏差、转 PR 后续卡或只改散文面。
4343
- 另记作者:PR `user.login` 非 `objectstack-fleet[bot]` ⇒ ③ 注点名该 login(脱中继写),落地前读。
4444
- ③ 恒查(席位自读同):SQL 可下推处新增 id 物化或应用内 join 而无因由 ⇒ 记发现(AGENTS.md)。
4545
- 简报从 `record-recognisers.mjs --brief-template` 起稿:只读条款与输入集内建,⛔ 不删 ⛔ 行。
@@ -48,13 +48,13 @@
4848
- 卡线程隔离子代理照上落现 head 记录并贴简报 ⇒ 席核简报、`Scope:` 与独立性对后采纳,
4949
ACCEPT 点名其评论 id;`Scope:` 窄于 `hits` 不采纳;席的补缺记录只管缺口,⛔ 不单充 head 记录。
5050
- 轮次报告设复审清单专节,与呈裁清单同为强制审计。
51-
- 请审/求批与落地前检两条,过则 Tier S 入队、Tier H 等人批:① 现 head 同形达档 PASS 在案。
51+
- 请审/求批与落地前检两条,过则 S 入队、H 等人批:① 现 head 同形达档 PASS 在案,无前两级。
5252
- head 后移例外:纯重生成或只动散文面原记录续管,落 `Regen-provenance:` 行;余移或现 head 落 FAIL
5353
而已挂 auto-merge ⇒ 派发席读到即照 AGENTS.md disarm 句撤挂,FAIL 记录点名欠撤挂;重挂照 ①。
5454
- ② PR check 全绿,⛔ 非 required 子集;例外:merge-base 同签名的红不计、按设计而红见 SKILL.md。
5555
- 签名 = 失败步 + 首错行,读 base check runs 的 API ⛔ 不凭口述;主干红止血立单不变。
5656
- 落地时仍欠复核的 PR 在落地 head 复审,复核席或车道席按 (a)(b)(c) 接;FAIL ⛔ 不修已关 PR。
57-
- 每条 must-fix 引该记录立新卡、按发现定级;回退仅限主干红(p0,main-red 约定①)或安全边界。
57+
- 每条 must-fix 引该记录立卡、按发现定级;回退仅限主干红(p0,main-red 约定①)或安全边界。
5858

5959
## 等复核标记 `needs:contract-review`
6060

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
- 「动手的读者」与 Acceptance notes 同一问:说得出具体 PR 或人 ⇒ 写进去,说不出 ⇒ 不立卡。
3333
- 说不出的形态:`.changeset/*`、无人在改的文档页、生成物、已扫完的批次,兜底不成立。
3434
- 配额:每 fire 不限张数,逐缺陷各立一张、各过本门;折清单卡可选、不强制;守批量写间隔。
35+
- 例外:复核后续(nit、接受偏差、同车道 diff 外发现)每 PR 一卡 `review follow-ups of PR #N`逐项勾,
36+
后轮追加 ⛔ 不另立;① 缺陷仍各立;p3 文案/文档 nit 入该区 `<area> loose ends` 卡,无则才立。
37+
- 复核立卡前搜 open 卡 `PR #N` 与文件路径,同一发现追加;技能/ADR 文本卡照 `triage-duties.md`。
3538
- 分诊席的存量清理仍走维护者确认的十张一组、只备下一组,⛔ 不因本门改批量。
3639
- 读到 `User` ⇒ 记座位贴、本 fire ⛔ 不立新卡;认领仍靠 assignee,署名仍是文本的 session ID。
3740

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- 轮次记录按车道计欠审逾一轮的 head 数并点名车道(`check-owed-reviews.mjs`),只报 ⛔ 不接审。
1414
- 每日看板与轮次记录列「待维护者」:当前里程碑已清的专题,注小结贴否;读数非门禁。
1515
- 「待维护者」另逐张列 open `needs-user-decision` 与 `pm:awaiting-maintainer` 卡,注入态以来卡龄。
16+
- 轮次记录每 3 小时报 24h 流量:卡新建/关闭/净增、合并 PR 数、open p1、引契约复核新卡数。
1617
- 析取 ①全裸(无 `pm:*`/`needs-user-decision`/`domain:*`);② `pm:queue` 无 `domain:*`(仅多车道仓);
1718
- ③ `domain:*` 无 pm-state;④ `pm:queue`+`domain:*` 无 `priority:*`;②③④ 只取 `updated_at` 早于 ~2min。
1819
- 排除 `tracking`、`status:parked`、全部 `pm:seat` 贴、`qa-run` 记录。
@@ -70,7 +71,7 @@
7071
- 跨层功能点(≥2 层)立父单带 `area:*`+`tracking`+清单项级,逐层子单按 `Blocked-by:` 排。
7172
- 每张留一条英文审计评论(`Triage: lands in …; rationale: …`),可选带 `Size/model suggestion:` 行。
7273
- 改作者可写面(种类非 `none` 或带 `(narrowing)`)的卡,首触 done-when 写 skills + docs + eval 三项。
73-
- ADR/技能文本的携带注记 ⛔ 不挂实施卡:ADR 由落地席合并后立卡,余各立 `domain:skills` 卡。
74+
- ADR/技能文本携带注记 ⛔ 不挂实施卡:ADR 由落地席合并后立卡,余每 PR 一 `domain:skills` 卡。
7475
- 查重/shadow 检查先按文件/机制查本仓与姊妹仓 open 卡(含 `pm:dispatched`),再跟引用与关键词。
7576
- 同文件同机制 = 同一发现,不分车道即并:证据搬先卡,后卡经中继 `issue_patch` 关 `duplicate`。
7677
- 同族发现并入收口卡,不开单点卡;在飞(assignee/open PR)永不并,`Blocked-by:` 不派;完工查过期。

‎content/docs/data-modeling/import-mappings.mdx‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,47 @@ own field metadata:
326326
- **lookup / master\_detail / user** — the display text resolves to a record **id**.
327327
This is what a `lookup` transform is relying on when it copies its cell through.
328328

329+
### A lookup cell is resolved within the row's own master
330+
331+
The display text is matched against the target's id, its title field and its other
332+
identifying fields, as the caller who runs the import: a record that caller cannot read
333+
never matches. A name that matches no record fails the row with `reference_not_found`;
334+
a name that matches more than one fails it with `reference_ambiguous`, and nothing is
335+
linked.
336+
337+
A detail record's name is often unique only inside its master: two contracts can each
338+
carry an "Advance 30%" billing milestone. When the same row also names the master, the
339+
cell is resolved **within that master's records**:
340+
341+
- the lookup's target has a `master_detail` field, and exactly one other single-value
342+
reference column of the row points at that master object and is filled in; or
343+
- the lookup field declares `dependsOn`, and the row fills in the sibling field it
344+
names. The string form compares the target field of the same name; `{ field, param }`
345+
compares the target field `param`. This is the filter the record form's picker applies.
346+
347+
The `master_detail` rule has no counterpart in the picker, which narrows by `dependsOn`
348+
and `lookupFilters`, never by an inferred master: for a lookup without `dependsOn`, the
349+
import is stricter than the form.
350+
351+
Inside that scope a tie is `reference_ambiguous` and a name that only another master
352+
carries is `reference_not_found`; it never resolves to another master's record. A row
353+
that leaves the master blank is resolved across the whole target as before. When two
354+
columns of the row point at the master object (a bill-to and a ship-to account), neither
355+
is taken as the master; declare `dependsOn` on the lookup to say which one is. A master
356+
cell that fails its own lookup scopes nothing, and the row already fails on that cell.
357+
358+
The scope is part of the importing caller's own filter. A caller who cannot read the
359+
target's master field, or the target field a `dependsOn` entry names as `param`, has the
360+
scoped lookup refused, and the cell fails with `reference_not_found`, even for a detail
361+
that caller can read and whose name is unique. Without the master (or the `dependsOn`
362+
sibling) in the row, the same cell resolves.
363+
364+
A pasted id is scoped too, so a row that means another master's detail cannot be linked
365+
in one import. Correct the master cell; or, when the cross-master link is intended, leave
366+
the master column out of the import and set it in a second update. For the
367+
field-permission case, grant the caller read access to that field, or leave the master
368+
column out in the same way.
369+
329370
A field the object does not know is left untouched. A cell that cannot be coerced fails
330371
its own row with the offending column named.
331372

‎docs/adr/0090-permission-model-v2-concept-convergence.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,13 @@ Replaces both the `member_default` builtin-set fallback and ADR-0056 D7's defaul
309309
> `isDefault`, and an accepted suggestion edits that definition instead of inserting a row — and a
310310
> package-declared capability lives in the registry. D5's rules stand.
311311
312+
> **Note (2026-11-14, ruling of record 6879388034 on #33010) — removing a row one owns is not a
313+
> delete bit.** A member withdrawing a row they own is served by an own-row delete door,
314+
> authorized because the row's owner column names the caller — not by `allowDelete` on a set
315+
> bound to `everyone`. The storage service's `DELETE /api/v1/attachments/:id`, over
316+
> `sys_attachment.uploaded_by`, is one such door: a member removes an attachment they uploaded
317+
> and no other. The attachment member grant still carries read and create only.
318+
312319
### D6 — Explain engine is P0; access-matrix snapshots gate publishes
313320

314321
A contract `explain(principal, operation, object, record?) → decision + granting path` (which

‎docs/adr/0113-required-write-contract-vs-column-constraint.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ loader guessing:
192192
constraint unreachable, and nagging every legacy required field would bury
193193
real drift. A declaration stricter than the column stays the destructive
194194
ceremony it always was.
195+
The silence is for a field with no `storage` declaration: a `required: true`
196+
field that writes `storage: { notNull: false }` out has its stricter column
197+
reported (`relax_not_null`, still `needs_confirm`, never auto-applied), and
198+
the publish of that declaration applies the relax, being the deliberate relax
199+
named above.
195200

196201
### D6 — `criteria_json` is the first consumer
197202

0 commit comments

Comments
 (0)