Repository navigation
Commit 119931d
domain:server#1 · os-tesla · session_01L9qibwurKjbb54r3yD6yJg
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoLxa2hmovTvgRDEhw3svMof)_
Fixes #27884
Clause-②: no (narrowing for readers below datasource administration)
Metadata-protocol: none
## 维护者速读
- 改了什么:数据源定义(datasource / external_catalog)所在的元数据存储行,现在只对持有
`manage_platform_settings` 的数据源管理员提供;与 `/meta`
类型读取门用的是同一张“类型→能力”表,没有新增规则、权限名或键。
- 为什么改:同一份数据源定义原来在两个出口对两组调用者开放,按裁决 A 统一为同一组读者;连接配置的问题也由本卡关闭。
- 风险与回滚:低于数据源管理员的读者不再能看到这些行(BREAKING 读集收窄,changeset
已写明补救);管理员与系统读取不变;回滚即还原本 PR。
-
先看:`packages/metadata-core/src/stored-metadata-type-read-admission.ts`(唯一的那张表),再看
`packages/objectql/src/stored-metadata-type-read-gate.ts`。
- 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run
src/stored-metadata-type-read-gate.test.ts` 与 `pnpm --filter
@objectstack/rest exec vitest run
src/meta-type-read-stored-row-parity.test.ts`。
- 需要你做的:席位的契约复审(收窄一侧)后落地。
## What changes
A stored-row read exit admits only datasource administrators.
- **One row.** The type-to-capability table that the metadata read door
already used moves to `@objectstack/metadata-core` as
`STORED_METADATA_TYPE_READ_CAPABILITIES` (`datasource`,
`external_catalog` → `manage_platform_settings`), with
`storedMetadataTypesWithheldFrom(caller)` and
`isCapabilityGatedStoredMetadataType(type)`. `@objectstack/rest` keeps
exporting `META_TYPE_READ_CAPABILITIES`, now the same frozen object; the
metadata read door answers exactly as before.
- **The stored row.** The engine applies that same row to every
caller-context read of the stored-metadata tables (`find`, `findOne`,
`count`, `aggregate`): a caller without a type's capability is served no
row of that type, and a read of such a row's id answers as a read of a
row that does not exist. Holders of the capability, platform
administrators among them, are served everything as before; system reads
are unchanged.
- **Events.** A record-change event of a row of a gated type carries no
metadata body to any subscriber.
- **Flows.** A flow run under a user identity is a caller like any
other: below datasource administration its read of a gated type is
served no row. A flow run under the system identity is unchanged.
- **Docs.** The isSystem census page gains the row for the new gate's
system-read exemption (generated register refreshed).
- No new rule, permission name or key. No `packages/spec` change, no
`packages/metadata-protocol/src/protocol.ts` change.
## Why
Ruling A on #27884 (record 6545628488): one document admits one set of
callers at every exit that serves it, reusing the one capability row the
`/meta` type gate names. Caller-aware redaction and a redactor-type
parameter are out of scope.
## Verification
- Unit pins (objectql): an administrator reads the row whole; a caller
below datasource administration and a plain reader are served no gated
row on find / findOne / count / aggregate; the history table is gated by
the same row; a system read is not narrowed; the composed predicate
names exactly the withheld types; events of gated rows withhold the body
while an ungated row keeps it.
- Parity pins (rest): `META_TYPE_READ_CAPABILITIES` is the shared frozen
row, and for six callers the metadata door refuses a type exactly when
the stored-row gate withholds it.
- Dogfood (booted stack, platform security composition): an
administrator is served the row whole; callers below datasource
administration are served nothing; for each caller the stored row is
served exactly when the metadata door serves the definition.
- Ablations, each red then restored byte-identical: gate removed (4
objectql pins red), row withheld from everyone (3 red, the administrator
pin among them), event arm removed (2 red), a second copy of the row in
rest (3 parity pins red), gate removed from the built objectql dist
(dogfood + parity pins red; and, separately, the 3 user-identity flow
pins red with the other 22 in those files green).
- Suites: objectql 506 files / 9836 tests passed; metadata-core + rest
21 files / 875 tests passed; sibling reader suite
`@objectstack/service-automation` 244 files / 3105 tests passed (its
flow `get_record` pins on the stored-metadata family now run their
projection cases under the system identity and pin that a user-identity
run below datasource administration is served no row); typecheck of the
three packages exit 0; scoped `eslint` over the touched files exit 0;
derived gates all exit 0 on the final head (record below); full
`@objectstack/dogfood` battery (record below).
<!-- verification-record -->
Verification record, final head `0b381cd7`:
- `node scripts/pm/dispatch-gates.mjs --commands` on `0b381cd7` → 96
derived commands, all run with `</dev/null`, all `exit 0`;
`dispatch-gates --ran` → 96 derived, 96 run, 0 NOT-MEASURED, 0 UNRUN.
- Fixed during the sweep: `check:objectql-double-limit` (pin driver
honours the limit), `check:query-options-erasure` (typed query options,
test surface back to 236), `check:where-matcher` (pin matcher refuses
unknown combinators), `check:system-context-census` (census row 18d +
regenerated register).
- `pnpm --filter @objectstack/dogfood test` (whole battery on
`1e838c5c`, under the verify lock, concurrent with a gate sweep): 361
files passed, 3 skipped, 1 failed —
`automation-authoring-doors-durable.dogfood.test.ts`, a 5000 ms test
timeout on a flow update under the shared load; that file re-run alone:
7/7 passed. The commits after it change prose, a changeset line and
service-automation tests only; the new dogfood file re-ran on
`de1f609b`: 4/4 passed.
- `@objectstack/service-automation` whole suite on `0b381cd7`: 244 files
/ 3105 tests passed.
- `npx eslint` over the touched source and test files: exit 0.
Clause-② and Metadata-protocol are declared on the lines above and in
the changeset.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` untouched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (scoped to the touched
files).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 section is
the maintainer's Chinese digest).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
## Acceptance notes
- Readers below datasource administration are no longer served stored
datasource or federation-catalog rows; the remedy is to grant
`manage_platform_settings` or read through the datasource admin door as
such a caller.
- Contract review: PASS at `0b381cd7`.
---
https://claude.ai/code/session_01L9qibwurKjbb54r3yD6yJg
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9b1dc99 commit 119931d
14 files changed
Lines changed: 670 additions & 20 deletions
File tree
- .changeset
- content/docs/permissions
- packages
- metadata-core/src
- objectql/src
- qa/dogfood/test
- rest/src
- services/service-automation/src/builtin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
543 | 544 | | |
544 | 545 | | |
545 | 546 | | |
| 547 | + | |
546 | 548 | | |
547 | 549 | | |
548 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
134 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
135 | 140 | | |
136 | 141 | | |
137 | 142 | | |
| |||
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
152 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
153 | 164 | | |
154 | 165 | | |
155 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 117 | + | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
5126 | 5128 | | |
5127 | 5129 | | |
5128 | 5130 | | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
5129 | 5139 | | |
5130 | 5140 | | |
5131 | 5141 | | |
| |||
0 commit comments