You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 64599ec
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-sharing): a refused write on a federated object whose mapped owner column the driver did not serve is logged again (#27760)
<!-- claude-projects-attribution: {"github_login":"marchtian"} -->
_Requested by **田騏** · [project
thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiDTkG7yDwxUsQaHUFmCQQgM)_Fixes#27662
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么:** 外部对象用 `columnMap` 把远端列映到
`owner_id`、但驱动没把这列返回时,成员写入被拒的同时,服务器重新打出一行 warn(每个对象一次),点名「驱动没有返回映射的
owner 列」。
- **为什么改:** #27425 把这种映射算作已证 owner 后,#8418 的诊断不再触发,运维只看到一个 403,没有任何日志。
- **风险与回滚:** 只加日志,判决不变(三个写判决矩阵用例照旧);回滚即 revert 本 PR。
- **先看:** `packages/plugins/plugin-sharing/src/sharing-service.ts` 的
`notePhantomAnchorWriteDeny`(新分支按「行里没有 `owner_id` 键」判定);同文件新常量
`UNSERVED_OWNER_WRITE_DENY_NOTICE`;测试文件末尾的 `[#27662]` 块。
- **两分钟验证:** `pnpm --filter @objectstack/plugin-sharing exec vitest run
src/federated-phantom-owner-scoping.test.ts`,预期 57 个用例全绿,其中 `[#27662]` 块
6 个。
- **需要你做的:** 无,席位落地。
## What changes
- `matchesOwnerScope` passes the pre-image row it already read to the
#8418 diagnostic. No new query.
- `notePhantomAnchorWriteDeny` keeps its phantom-anchor branch
byte-for-byte. A second branch fires when the object is federated, is
not phantom-anchored, and the row came back with no `owner_id` key at
all. It logs the new exported `UNSERVED_OWNER_WRITE_DENY_NOTICE` with
the same payload (`object`, `ownerField`, `userId`) under the same
once-per-object latch.
- The discrimination is the key, not the value. A driver that applies
the map and serves a NULL owner is an ordinary owner-less row and stays
silent. A missing record (no row) stays silent too.
- `hasPhantomOwnerAnchor` and `federated-phantom-anchors.ts` are not
touched: the new branch reuses the already-exported `isFederatedObject`
and reads no `columnMap` itself, so it adds no fourth reader to the set
#27661 is consolidating.
## Tests
New `[#27662]` block in `federated-phantom-owner-scoping.test.ts`:
- a map-ignoring plugin driver denies on edit, delete and at `org`
depth, and logs exactly one unserved-owner notice (never the phantom
one);
- the wording names the driver and `external.columnMap`;
- a second object gets its own line, a second caller does not re-arm the
first;
- a map-applying driver stays silent on an own row (allow), another
owner (deny) and a served NULL owner (deny);
- a declared-owner control stays silent on allow and deny;
- a record that does not exist stays silent.
## Acceptance notes
- **Wider than "mapped" by design.** The new branch also fires for a
federated object that DECLARES `owner_id` when its driver returns rows
without that key (for example the SQL driver discarding a projection
that names a column the remote table lacks). That is the same
operator-facing fault, and the message says "maps (external.columnMap)
or declares". The card's declared-owner control (owner present) is
silent, as pinned.
- The method keeps its `notePhantomAnchorWriteDeny` name to keep the
diff small; its doc comment now names both notices.
## Verification
Readings for head `41cbab7c` are in the os-dev-report on the card.
---
_Generated by [Claude
Code](https://claude.ai/code/session_017ihL2eGmV67aXQuY2TJg7s)_
Co-authored-by: Claude <noreply@anthropic.com>
fix(plugin-sharing): a refused write on a federated object whose mapped owner column the driver did not serve is logged again
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
A federated object that maps a remote column onto `owner_id` through `external.columnMap`, served by a plugin driver that does not apply the map, returns rows with no `owner_id`, so every member edit or delete is refused. The refusal is unchanged. Since the mapped class stopped counting as a phantom owner anchor, the one-line server warning that tells the operator why had stopped firing. It fires again, at most once per object, as the new `UNSERVED_OWNER_WRITE_DENY_NOTICE`, which names the driver returning no value for the mapped or declared owner column. A driver that serves the column, including a row whose owner is NULL, stays silent.
0 commit comments