Skip to content

docs(adr): ADR-0160 amended — a related child this caller is not served is left out; pack selection conditions; carried-text bound - #37196

Merged
os-zhuang merged 1 commit into
mainfrom
claude/trusting-cerf-23rczi-adr0160
Nov 25, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/trusting-cerf-23rczi-adr0160

Conversation

@os-bob

@os-bob os-bob commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby

Refs #36996, #37140

Ruling-ref: maintainer, 2026-11-25, in the maintainer's session, verbatim: 「同意你的建议」. The maintainer was answering two independent analyses of ADR-0160 written that day:

维护者速读

  • 做什么:按你 11-25 的「同意你的建议」修订 ADR-0160。
    • 第 2 点改了:某个用户读不了包里的某个关联对象时,省略那一节,并附一句「部分资料对你不可见」,不再整包拒绝。系统对象、或 API 关闭了暴露的对象,对谁都不提供,仍然整包拒绝。
    • 第 1 点接受,加三个条件:多个包被拒时列出「名字(标签)」;应用内预读不替用户选包;校验时给两条提醒。
    • 第 10 点照原样接受。
    • 关联列表里可以放长文本,但整个包交给模型的文字总量有一个明确上限,截断一定写明。上限的数值在 记录 AI 问询 5:资料包类型 ai_context、渲染服务与 get_record_context 工具(MCP) #37140 的 PR 里按业务证据定:BrightRule 实测整份约 1.2 万 token 的制度作答效果好,所以 8000 字符不能作为唯一上限。
    • 状态改为 Accepted,索引重新生成。
  • 为什么:对象权限是各部署自己配的,包是随应用发布的。整包拒绝会让某个部署收回一项对象权限后,这个角色的「问 AI」整体失效。省略并说明不比拒绝泄露更多信息。
  • 需要你做的:审后手动合并。docs/adr/** 是 Tier H 受管面。

What changed (only docs/adr/0160-record-scoped-ai-inquiry.md and the generated docs/adr/README.md)

  • Status and a new Amended: line.
  • D1: two advisory validation reports (point 1, condition 3).
  • D3:
    • step 1 and "Object level" split by whom a refusal refuses;
    • the field-level structural bullet;
    • a new paragraph, "The bound on carried text".
  • D4:
    • the several-packs refusal lists name and label (point 1, condition 1);
    • step 4.
  • D8: the in-app runtime never runs a pack it chose itself (point 1, condition 2).
  • Points: the header, points 1, 2, 11 and 12.
  • Consequences: "One pack can serve roles with different object access".
  • Not changed:
    • related filter / orderBy. That is a separate protocol decision.
    • The root and lookup-target rules.
    • Point 10.

Checks (local, at the head)

Every command node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derives for this diff exited 0, 21 of 21. They include:

  • check:adr-index
  • check:adr-anchors
  • check:adr-symbol-anchors
  • check-adr-links (1215 links resolve)
  • check:doc-authoring
  • check:pm-governed-merges
  • check:pm-prior-rulings
  • check:doc-formula-expressions, which ran after building @objectstack/formula and @objectstack/lint.

Governed surface (Tier H): this PR stays draft, and the maintainer merges it by hand.


Generated by Claude Code

… caller is not served; point 1 accepted with three conditions; carried-text bound

The maintainer accepted points 1, 2 and 10 on 2026-11-25 (「同意你的建议」):
point 1 with three conditions (several-packs refusal names each pack with
its label; the in-app pre-read never runs a pack the runtime chose;
advisory validation reports), point 2 changed (a related child the door
serves nobody still refuses the call; a child this caller is not served
is left out and stated), point 10 as written. Long-text cells in related
lists are allowed under one stated bound on the pack's carried text.
Status set to Accepted; index regenerated.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012dn2AecKpLaYkUtNRiqtby
@os-bob os-bob added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 25, 2026 — with Claude
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 25, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 25, 2026 03:22
@os-zhuang
os-zhuang enabled auto-merge November 25, 2026 03:22
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit a33691e Nov 25, 2026
48 of 50 checks passed
@os-zhuang
os-zhuang deleted the claude/trusting-cerf-23rczi-adr0160 branch November 25, 2026 03:47
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…cket beside skill (objectstack-ai#37209)

<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_

repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK

Fixes objectstack-ai#37180

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:用户无感(只改决定记录,不改代码);提议两个应用各带的同名 AI
资料包按「应用+名字」分开认,和技能现在的做法一样,AI 点名某个应用的资料包时用「应用前缀-名字」的写法。
- 为什么做:属于「记录级 AI 问询」这项工作;现在同名的资料包在系统里只留后装的那一份,规则要先定,再由后续实现卡
objectstack-ai#37216(把资料包加进按应用区分的名单)落地,而它必须排在 objectstack-ai#37141(让技能写明用哪个资料包)之前。
- 出错会怎样:规则定错的话,后面的实现会照着错的做;本次只有文档,撤回这次合并即可。
- 要你做什么:这条只能由你本人定,合并就等于批准,其中两处超出卡面原话(AI
用「应用前缀-名字」点名资料包;同一应用前缀下不许两个应用包带同名资料包);不同意就不合并,那样只保留「同一对象上两个同名资料包不替用户挑、一律拒绝」这一条。

## What changes

Two files under `docs/adr/`: 44 lines added, 1 line changed. No schema,
no code, no changeset.

**ADR-0150** (Accepted) gains a dated addendum. No ruled sentence is
rewritten.

- The status line gains one **Amended** clause, dated 2026-11-25. This
is the one changed line: the clause is appended, and nothing before it
is edited.
- The D1 table gains one row, marked with the date, between bucket 3 and
bucket 4.
- A new section at the end of D1, "Addendum (2026-11-25): `ai_context`
joins bucket 3". It proposes that the context pack type of ADR-0160 is
identified by `(package, name)`, in bucket 3 beside `skill`.

The addendum says, in this order:

1. **The type**, and what D2, D3, D6 and D8 mean for it. A package's
pack is spelled `NS-NAME` where its name crosses the AI face.
2. **The tree today**, measured on `main` at `0a1b69c0`. The type and
its pack selection are on `main`. The registry keeps each package's
item. The metadata service keeps one copy per name, the one registered
last.
3. **What changes with the bucket**: the service's copy, overlays, owner
stamps (unchanged) and uninstall.
4. **The readers that move.** It names three and moves none.
5. **The follow-up**, objectstack-ai#37216, which lands before row 8 (objectstack-ai#37141).
6. **The interim rule**: two parsed packs that share a name and a root
are never chosen between.
7. **Past the card's words**: two points that are the maintainer's
decision alone, and one that is no new decision.

**ADR-0160** gains one cross-reference note under D1, which also names
the follow-up and its order. No sentence of it is changed.

**Not in this PR**, by the card's contract: `PACKAGE_SCOPED_TYPES` is
not edited and no reader is moved. That is objectstack-ai#37216's work, after the
ruling.

## Round 2

The contract review of the first head passed with two should-fix
findings and four nits. This head closes them.

- **S1, the tree moved.** `main` gained the type and the tool (objectstack-ai#37173)
and the ADR-0160 amendment (objectstack-ai#37196) after the first measurement. `main`
is merged into the branch (a merge commit, no rebase and no force-push),
and every "today" sentence is re-measured at `0a1b69c0`. The addendum
now cites the merged code. "Nothing first-party is refused" is restated
against the showcase app, the one declarer: one package, two packs of
different names on different roots. `objectstack-ai/hotcrm` at
`b1ea6fcc` declares none.
- **S2, who rules.** The addendum no longer lets any authorized approval
be its ruling. Points 1 and 3 are the maintainer's alone, so the record
is ruled by the maintainer's own merge or word. Point 2 is stated as
following from ADR-0160 D4, not as a new decision.
- **N1.** The interim rule no longer says "one answer". A `context` that
names the two packs answers `409`. So does an omitted `context` when
theirs is the only name on the root. With another name on the root, an
omitted `context` gets the several-packs answer, which lists the shared
name once. The first match is taken in none of these.
- **N2.** The overlays bullet now says a package-less row under a name a
package ships is not served, that this is D4 as for `skill`, and that
objectstack-ai#37216 measures it.
- **N3.** The follow-up is filed as objectstack-ai#37216 and named in both records.
- **N4.** The no-hyphen premise of the face is anchored to the name
pattern.

## Tests

No package is touched, so no package build or test is owed. The checks
that read these two files are the docs gates under Verification.

## Acceptance notes

- **The chain.** This PR is the ruling. objectstack-ai#37216 implements it and is
blocked by this PR. objectstack-ai#37141 (the skill key) waits for objectstack-ai#37216, because the
one rule throws for a type outside `PACKAGE_SCOPED_TYPES`.
- **Two decisions are the maintainer's alone.**
1. Bucket 3 and not bucket 2: a package's pack is spelled `NS-NAME` in
the tool's `context` argument. This widens D6 from the names a server
lists to the value of an argument. The alternative, an optional
`namespace` input on the tool, adds a key to two shapes ADR-0160 has
ruled.
2. Child N's predicate carries the install refusal: the type joins
`NAMESPACE_UNIQUE_TYPES`, whose header reserves a further type to the
maintainer.
- **Not a new decision.** The root object narrows the candidates before
the one rule picks. ADR-0160 D4 already requires it: step 3 selects
among the packs rooted on the requested object, and the naming bound
lets no refusal name a pack beyond those.
- **The card's step 3 names one list, and the bucket takes four.** They
are `PACKAGE_SCOPED_TYPES`, `PACKAGE_SCOPED_READ_TYPES`,
`PACKAGE_SLOTTED_METADATA_TYPES` and `NAMESPACE_UNIQUE_TYPES`. The
service's one copy per name is governed by the third, not the first.
`skill` is in the first three; its one-holder rule inside a namespace is
phase 1's, which a new type never had.
- **Citation form.** `check:adr-symbol-anchors` refuses a line anchor
under `docs/adr/`, so the record cites `path#Symbol`, and the line
numbers are in the table under Verification.
- **No changeset.** `docs/adr/` ships in no package, so this PR carries
`skip-changeset`.
- **Tier H.** This PR stays draft. The merge is the maintainer's, and it
is the ruling.
- **Shallow checkout.** No claim here is read from history dates.
- **Noted, not filed.** On `main` the several-packs answer lists pack
names only (`packages/services/service-record-context/src/sentences.ts`,
`severalPacks`). ADR-0160 D4, as amended on 2026-11-25, says each
candidate is listed by name with its `label`. This is read from source,
not measured through the tool, and no first-party object has several
packs. The addendum leaves what that answer carries to D4.

## Verification

**Read first**, by risk:

1. `docs/adr/0150-…-literal-prefix.md`, "Past the card's words" at the
end of the addendum: the two decisions that are the maintainer's.
2. The same file, the D1 table hunk: one row inserted into a ruled
table. Check that it reads as an addition and changes no ruled row.
3. The same file, the status line: the appended clause.

**Two-minute check**: run `node scripts/check-adr-symbol-anchors.mjs`.
Expect `4186 anchors across 163 records resolve` and exit 0. Fourteen of
them are this diff's `path#Symbol` anchors.

<details>
<summary>Measured anchors on main at 0a1b69c (file:line)</summary>

| What the addendum says | Where it is read |
|---|---|
| The type is on `main`, and a pack name holds no hyphen |
`packages/spec/src/ai/ai-context.zod.ts:136` (`AiContextSchema`),
`:157`; `packages/spec/src/kernel/address-grammar.ts:68`
(`ROUTER_ADDRESSABLE_NAME_PATTERN`) |
| Pack selection keeps the packs rooted on the object and matches a bare
name | `packages/services/service-record-context/src/read-set.ts:65`
(`selectContextPack`) |
| Two packs of one name on one root: `409`; with another name and no
`context`: the several-packs answer |
`packages/services/service-record-context/src/record-context-tools.ts:266`,
`:265` |
| The one rule resolves only its listed types |
`packages/core/src/package-scoped-resolution.ts:245`
(`PACKAGE_SCOPED_TYPES`; `skill` at `:270`) |
| It throws for a type outside the list |
`packages/core/src/package-scoped-resolution.ts:740`,
`packages/objectql/src/package-scoped-resolver.ts:148` |
| A by-name read consults (package, name) for listed types |
`packages/objectql/src/package-scoped-read.ts:88`
(`PACKAGE_SCOPED_READ_TYPES`; `skill` at `:96`), read by
`packages/objectql/src/registry-package-addressing.ts:433` |
| The service keeps one slot per (package, name) for listed types |
`packages/spec/src/api/protocol.zod.ts:2753`
(`PACKAGE_SLOTTED_METADATA_TYPES`; `skill` at `:2754`),
`packages/metadata/src/package-slotted-store.ts:154` |
| Any other type is keyed by name alone |
`packages/metadata/src/package-slotted-store.ts:797` (`storeWriteKey`),
`:820` |
| The last registration replaces the copy |
`packages/metadata/src/metadata-manager.ts:1499`,
`packages/metadata-protocol/src/protocol-registry-hydration.ts:148` |
| One package holder of a name inside a namespace |
`packages/objectql/src/namespace-co-owner-names.ts:96`
(`NAMESPACE_UNIQUE_TYPES`); the list is reserved to the maintainer at
`:27` |
| The type opens no overlay channel, and its row is not among the served
overrides | `packages/spec/src/kernel/metadata-plugin.zod.ts:1388`,
`packages/metadata-protocol/src/protocol-package-bindings.ts:388`
(`SEALED_ROW_SERVED_OVERRIDE_TYPES`) |
| A skill prompt's name: a face, else a bare name by the one rule |
`packages/mcp/src/skill-prompts.ts:373` (`lookupSkillPrompt`) |
| The one face derivation | `packages/spec/src/ai/face-name.ts:86`
(`deriveAiFaceName`) |
| The owner stamp's judge, and the pack's collection among those it
judges | `packages/spec/src/kernel/collection-item-owner-stamp.ts:129`,
`:107` |
| Uninstall, the registry's half |
`packages/objectql/src/registry.ts:5328` (`uninstallPackage`) |
| Uninstall, the service's half |
`packages/metadata/src/metadata-manager.ts:2880` (`unregisterPackage`) |
| The one first-party declarer: two packs, two names, two roots |
`examples/app-showcase/objectstack.config.ts:223`,
`examples/app-showcase/src/ai/record-context.ai-context.ts:20`, `:30` |

Absence readings, each with a positive control:

- `ai_context` in the four list files and in
`packages/metadata/src/package-slotted-store.ts`: 0 lines each. Control:
`skill` is in the first three lists, at the lines the table gives.
- The skill key: `packages/spec/src/ai/skill.zod.ts` has 0 `context:`
property lines. Control: 1 `tools:` line.
- `objectstack-ai/hotcrm` at `b1ea6fcc`: `ai_context`, `aiContexts` or
`ai-context`, 0 files. Control: `skills:`, 6 files.

</details>

<details>
<summary>Local gates at head deee29a: 21 derived, 21 run, all exit
0</summary>

Derived with `node scripts/pm/dispatch-gates.mjs --repo
objectstack-ai/objectstack --commands`, and reconciled with `--ran`:

```
Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3).
```

Each exit code was captured before any pipe:

```
0  node scripts/check-adr-links.mjs                      1222 relative link destination(s) under docs/adr/ resolve
0  node scripts/check-adr-links.mjs --self-test
0  node scripts/check-closing-keyword-parity.mjs
0  node scripts/check-closing-keyword-parity.mjs --self-test
0  node scripts/check-comment-mask-corpus.mjs            23898 files, 0 disagree, 0 unparseable
0  node scripts/ci/plan-test-core-shards.mjs --self-test
0  pnpm --filter @objectstack/lint run check:doc-formula-expressions
0  pnpm check:adr-anchors
0  pnpm check:adr-index                                  docs/adr/README.md is current, every record parsed
0  pnpm check:adr-symbol-anchors                         4186 anchors across 163 records resolve
0  pnpm check:ci-filter-parity
0  pnpm check:closed-ceremony-text
0  pnpm check:cross-package-test-inputs
0  pnpm check:doc-authoring
0  pnpm check:driver-memory-census
0  pnpm check:gitlink-declared
0  pnpm check:nul-bytes                                  no raw ASCII control bytes
0  pnpm check:pm-governed-merges
0  pnpm check:pm-prior-rulings
0  pnpm check:refd-timer-probe
0  pnpm check:watch-hint-literal
```

`check:doc-formula-expressions` reads the compiled output of
`@objectstack/formula` and `@objectstack/lint`. Those two and their
dependencies were built first, under the shared verify lock (`VERDICT
command-exit 0`).

`docs/adr/README.md` is generated from each record's status keyword.
ADR-0150's keyword stays Accepted, so the index does not change and is
not in this diff.

</details>

<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi13yZRqVcp2mGonWK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…mit (row 11 contract) (objectstack-ai#37240)

<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_

repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK

Fixes objectstack-ai#37202

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:现在用户无感(只改决定记录,不改代码);规则是给 AI
的记录资料包里,关联列表可以只带挑出来的行、按指定顺序排、限定条数(例如只带当前生效的那一版),筛选不增加任何权限,筛选或排序用到提问人不能据以查询的字段(看不到的、值被收起的、只显示掩码的)时整段省略并说明有资料不可见、不点名字段;要等后续实现卡
objectstack-ai#37203(把这三个写法和读取它们的服务一起做出来)合并后才真正生效。
- 为什么做:属于「按记录向 AI 提问」这一大项,你 11 月 25 日已同意关联列表的筛选和排序,这里把它写成成文规则,后面的实现照着做。
- 出错会怎样:规则写错的话,后面的实现会照着错的做,碰到的是写资料包的人和用它提问的人;这次只有文档,撤回这次合并即可。
-
要你做什么:审后由你本人合并(合并即批准);你的原话只说了筛选和排序,其余十处是记录自己补全的决定,已在记录的「超出卡面原话的几点」一节逐条编号列出(第
13 到 22 点,下文英文部分也有一份),不同意哪条可以先划掉再合并。

## What changes

One file under `docs/adr/`: `0160-record-scoped-ai-inquiry.md`, 55 lines
added and 13 removed against `main`. No schema, no code, no changeset.

This is ADR-0160's second amendment. It records the maintainer's word of
2026-11-25, verbatim: 「related 的筛选和排序 同意」 (the thread of epic objectstack-ai#36996,
card objectstack-ai#37202). The first amendment (PR objectstack-ai#37196) had left filter and order
on `related` as a separate protocol decision.

- **Header.** A second `Amended:` bullet quotes the maintainer and lists
what the amendment records. It says the maintainer's word names filter
and order and no more, and it names each of the ten additions with its
point number. The `Status:` line is byte-identical, so the generated
`docs/adr/README.md` does not change and is not in the diff.
- **D1.** A `related` entry gains `where`, `orderBy` and `limit`, on the
child's own fields only.
- `where` uses the platform's object filter form with ten operators
(`$eq`, `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$null`,
`$exists`), joined by `$and` / `$or`. A bare value is read as `$eq`. It
follows no relation and takes no field-to-field comparand, no `$now`
anchor, no formula and no whole `{token}` placeholder. Anything else is
refused at parse.
  - `orderBy` is `{ field, order }[]`.
- `limit` is a positive integer, at most the service's row cap for one
related list.
- The three keys leave "Later work". Placeholders resolved at call time
join it.
- The keys are declared here and land with their reader in row 11. Until
then the schema on `main` refuses them.
- **D3.** The filter and the order run inside the caller's one capped
child query and grant nothing. A `related` entry whose `where` or
`orderBy` names a field the caller cannot query on is dropped whole,
with the statement that some material is not visible, and the field is
never named.
- **D4.** The read set is unchanged: the three keys add no object to it.
- **Points that go past the card's words.** Points 5 and 11 are updated.
Points 13–22 are new and list every place where the amendment goes past
the maintainer's word and the card.
- **Implementation split, Consequences.** The split gains row 11 (card
objectstack-ai#37203). Consequences counts a fourth protocol addition.

### Round 2, at `1cd00b0d`

The contract review of the first head passed with three should-fix
findings (comment 7154648352, adopted by the seat in 7154665327). This
head answers them.

- **S1.** D3 said "a field this caller cannot read". It now says "a
field this caller cannot query on" and defines it as every field outside
the security service's `getQueryableFields` answer. That takes in the
field served masked and the field an agent's ceiling withholds, which
the engine's guard also refuses. Both symbols are anchored.
- **S2, by the seat's ruling for this text.** A bare value such as `{
is_current: true }` is admitted and read as `$eq`. A comparand that is
one whole `{token}` placeholder is refused at parse in v1, beside the
`$now` anchor, and placeholders resolved at call time are later work.
- **S3.** The `Amended:` bullet no longer says that one sentence goes
past the maintainer's word. The record's own section now carries points
13–22, and point 11 covers `where` and `orderBy`.
- **Nits applied where they touch this text.**
- The refusal that the rule avoids is named as the security plugin's
engine middleware, not the data engine.
- "The body" says an outline is cut by the body bound or by the entry
cap. PR objectstack-ai#37222 has merged, so the entry cap is now anchored on `main`.
- A door whose own page cap is lower than a `limit` that parsed cuts the
list there, and the cut is stated.
- Row 11 may bound the size of a `where` at parse; this record sets no
number.
- **Not changed, by the review's own word.** The link-field sentence
beside the new one still says "that caller's schema hides". The review
asks for a follow-up card to carry it.

The branch also merged `main` at `6211ddf4`, with no conflict. That
brought the note PR objectstack-ai#37209 added to D1 and the outline cap of PR objectstack-ai#37222.

## Tests

This PR changes a record only. No test is added or changed, and nothing
is ablated. The readings the text rests on were re-taken on `main` at
`6211ddf4`. The branch head is `1cd00b0d`, and every local gate below
ran on that head.

<details><summary>What the schema on main does with the three keys and
with the sort direction</summary>

A probe parsed a pack through `AiContextSchema` and a sort node through
`SortNodeSchema`. It ran with `tsx` from the scratchpad and is not
committed.

```text
CONTROL (no new key) success = true
related[].where: success = false | unrecognized_keys @ related.0: Unrecognized key(s) on a context pack `related` entry: `where`.
related[].orderBy: success = false | unrecognized_keys @ related.0: Unrecognized key(s) on a context pack `related` entry: `orderBy`.
related[].limit: success = false | unrecognized_keys @ related.0: Unrecognized key(s) on a context pack `related` entry: `limit`.
SortNode { field, order }: success = true
SortNode { field, direction }: success = false | unrecognized_keys: Unrecognized key(s) on this sort node: `direction`. Did you mean `direction` → `order`?
```

Each message is cut after its first sentence. The control row shows that
the probe pack parses without the new keys, so each refusal is the key's
own.

</details>

<details><summary>The anchors this round adds, resolved one by
one</summary>

`symbolResolutionClass` from `scripts/symbol-anchors.mjs`, asked for
each new anchor and for one name that does not exist:

```text
declaration  packages/spec/src/contracts/security-service.ts#getQueryableFields
declaration  packages/plugins/plugin-security/src/security-plugin-object-inputs.ts#computeQueryGuardFieldPerms
declaration  packages/plugins/plugin-security/src/predicate-guard.ts#assertReadableQueryFields
declaration  packages/spec/src/data/context-tokens.zod.ts#FILTER_TOKEN_WRAPPED_RE
declaration  packages/core/src/utils/filter-tokens.ts#resolveFilterTokens
declaration  packages/services/service-record-context/src/body-outline.ts#RECORD_CONTEXT_OUTLINE_MAX_ENTRIES
null         packages/spec/src/contracts/security-service.ts#noSuchSymbolControl
```

</details>

<details><summary>Local gates at 1cd00b0: 21 derived, 21 run, all exit
0</summary>

`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived the same 21 commands as on the first
head. Each exit code was captured before any pipe, and `--ran`
reconciled the list:

```text
✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3).
```

The gates that read this file printed:

```text
✅ check-adr-links: 1222 relative link destination(s) under docs/adr/ resolve
✅ check-adr-symbol-anchors: 4199 anchors across 163 records resolve — 1416 symbol (1387 declaration, 29 literal), 2731 file-level, 52 cross-repo, 6 exempt, 96 continuation.
adr-index --report: OK — docs/adr/README.md is current, every record parsed, self-test 60 assertions green.
check-nul-bytes: OK (scanned 27783 text file(s) -- 27783 tracked, 0 untracked-not-ignored; skipped 101 binary; no raw ASCII control bytes).
```

The other 17 are `check-adr-links --self-test`, `check:adr-anchors`,
`check:doc-authoring`, `check:pm-governed-merges`,
`check:pm-prior-rulings`, `check:closed-ceremony-text`,
`check-closing-keyword-parity` and its self-test,
`check-comment-mask-corpus`, `check:cross-package-test-inputs`,
`check:ci-filter-parity`, `check:driver-memory-census`,
`check:gitlink-declared`, `check:refd-timer-probe`,
`check:watch-hint-literal`, `plan-test-core-shards --self-test` and
`check:doc-formula-expressions`.

`check:doc-formula-expressions` reads the compiled output of
`@objectstack/formula` and `@objectstack/lint`. Both were built first
under the shared verify lock (`VERDICT command-exit 0`).

`node scripts/adr-index.mjs` answered `unchanged docs/adr/README.md (250
lines)`.

`node scripts/pm/overlap-check.mjs` answered `VERDICT clean exit 0`
before each push.

</details>

Every family that CI runs is read from this PR's check-runs. None of
them is re-run locally.

## Acceptance notes

**Governed surface (Tier H).** `docs/adr/**` is governed. The
maintainer's merge is the record. No seat readies, queues or arms this
PR.

**These decisions are listed for the maintainer.** The maintainer's word
names filter and order on `related`. Everything below is the record's
own settlement, accepted or struck by the merge. Each is a numbered
point in the record's "Points that go past the card's words" section,
and any one can be struck without touching the rest.

| Point | Decision | Where it comes from |
|:--|:--|:--|
| 13 | `related` takes `limit` as well as filter and order. | The card
names it; `get_record`'s `related` already takes one. |
| 14 | A `limit` over the row cap is refused at parse. Row 11 declares
one number that the schema and the service both read. | The pack's other
bounds, and `get_record`'s own `related` limit. |
| 15 | `where` admits ten operators, joined by `$and` / `$or`. `$not`,
`$between`, `$empty`, the string-match operators, relation conditions,
`{ $field }` and `$now` are refused. | The card says "a small operator
set" and names none. |
| 16 | A bare value is read as `$eq`. | The seat's ruling on review
finding S2. |
| 17 | A whole `{token}` comparand is refused at parse. Placeholders
resolved at call time are later work. | The seat's ruling on review
finding S2. |
| 18 | `orderBy` is `{ field, order }[]`. | `SortNodeSchema` on `main`
refuses `direction` by name. |
| 19 | A `where` or `orderBy` field the caller cannot query on drops the
section, stated and never named. | Review finding S1. The card says
"hidden". |
| 20 | A `where` or `orderBy` field the published definition lacks
leaves the section out, and the answer states nothing. | The record's
rule for author defects. |
| 21 | A list cut at its own `limit` is a stated cut. | The record's
rule that every cut is stated. |
| 22 | D3, "The body", names the cap on an outline's entries. | Not
about `related`: carried from the review of PR objectstack-ai#37222, nit N5. |

**Sections touched beyond the card's list, all in the one claimed
file:** the author-defects paragraph and "Later work" in D1, "The body"
in D3, the "Points" section, the intro and the two paragraphs under the
Implementation split table, and one line of Consequences.

**Seen and not changed here** (read on `main`, not exercised through a
public door, so not filed):

- Row 5's service still refuses the whole call when a `related` child is
not served to this caller. The first amendment says that child is left
out and the answer says so.
- The link-field rule in D3 still says "that caller's schema hides". A
link field that the schema shows and the caller cannot query on would
reach the engine's guard, which refuses the whole call. The review asks
for a follow-up card.
- Card objectstack-ai#37203's example spells the sort direction `direction`, and its
item 3 says "hidden". Both now differ from the record.
- The `ai_context` schema's guidance text for a stray `filter` key says
a related list reads every child row the caller may read. Row 11 has to
reword it.

## Verification

Read first, by risk. All three are in
`docs/adr/0160-record-scoped-ai-inquiry.md`:

1. **D3, "Field level", the bullet "The hidden field is one the pack
uses structurally".** This is the disclosure rule: which callers lose
the section, and what the answer may say. Round 2 rewrote its middle.
2. **D1, the `where` bullet under "Filter, order and limit on a related
list".** This is the contract row 11 implements: the operator set, the
bare value, and the comparands refused at parse.
3. **"Points that go past the card's words", points 13–22, and the
header's second `Amended:` bullet.** They say which parts are the
maintainer's word and which are the record's own.

Two-minute check: run `pnpm check:adr-symbol-anchors`. It should exit 0
and print a line that starts `✅ check-adr-symbol-anchors:`. That line
means every symbol the text cites is declared at the path the text
names. At this head it counts 4199 anchors across 163 records.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK)_

<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi13yZRqVcp2mGonWK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…xt pack is identified by its package and its name; get_record_context selects a pack by its face on both MCP doors (objectstack-ai#37291)

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Fixes objectstack-ai#37216
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up objectstack-ai#37177

## 维护者速读
- 用户能看到什么变化:两个应用各自带了同名的资料包时,外部 AI 通过 MCP
读取记录资料能按“应用+名字”分别选到各自的包;只给名字且有两个应用都带这个名字时,会被明确拒绝并列出每个可选的写法。
- 为什么做:属于“在一条记录上问 AI”专题,落实已合并的资料包身份裁决(资料包按应用+名字认),也为后续“技能指定资料包”那张卡扫清前提。
- 出错会怎样:只影响资料包的选取与同名校验;第一方应用里没有任何同名资料包,现有部署读到的结果不变,可直接撤回。
- 要你做什么:这是收窄改动,请你批准;批准后由席位合入。契约审核通过记录是 PR comment 7168612536,Head-sha
`7408543965b4dbbc8e51cf8033e51106d2e2f79d`。

## What changes
ADR-0150's addendum (PR objectstack-ai#37209, merged by the maintainer) puts the
context pack in bucket 3 beside `skill`: a pack is identified by its
package and its name.

- **The four lists.** `ai_context` joins `PACKAGE_SCOPED_TYPES`
(`packages/core/src/package-scoped-resolution.ts`, the one ADR-0150 D3
rule), `PACKAGE_SCOPED_READ_TYPES`
(`packages/objectql/src/package-scoped-read.ts`, the `/meta` by-name
read and its `?package=` qualifier), `PACKAGE_SLOTTED_METADATA_TYPES`
(`packages/spec/src/api/protocol.zod.ts`, the metadata service's
per-`(package, name)` slot; uninstall drops one package's pack and keeps
another's) and `NAMESPACE_UNIQUE_TYPES`
(`packages/objectql/src/namespace-co-owner-names.ts`, D2's refusal of a
second holder inside one namespace, at install and in `os validate`).
- **Reader 1, pack selection**
(`packages/services/service-record-context/src/read-set.ts`). Candidates
are still the packs rooted on `objectName`. `context` is read as a skill
prompt's name is: a face (`NS-NAME`, `deriveAiFaceName`) answers its one
pack; a bare name resolves by D3 as a caller with no package (the
environment's pack, else the one package holder, else `409
RESOURCE_CONFLICT` naming each candidate by its face).
`RecordContextDoor` gains an optional `packageNamespace(packageId)`; the
tool description teaches `NAMESPACE-NAME`.
- **Both MCP doors place a pack's package.** The `/mcp` route
(`packages/runtime/src/domains/mcp.ts`) implements `packageNamespace`
through `packageNamespaceOf`, on the engine resolved beside the
`listContextPacks` read, as `listSkills` does. The stdio bridge
(`packages/mcp/src/stdio-data-bridge.ts`) implements it from its
`engine`'s registry (the `objectql` service, the same record
`installedPackageNamespace` reads for skill prompts). Both sit on top of
objectstack-ai#37255's `stripReadDecorations` listing, unchanged.
- **The several-packs answer** (triage row 7154571964, ADR-0160 D4 step
3 as amended by objectstack-ai#37196): each pack is listed by its face with its label,
in en and zh-Hans; a pack with a blank label is listed by its face
alone.
- **The overlay consequence** (card What 4, ADR-0150 D4 as ruled for
`skill`): a package-less `ai_context` row under a name a package ships
is that holder's customization and is not served, read at `(type, name)`
whatever the row's root. Measured by a §5 pin with a control in
`packages/metadata-protocol/src/protocol.reads-environment-only.test.ts`.
- **ADR-0087 semantic entry**
`packages/spec/src/migrations/entries/semantic/18.ai-context-package-scoped-name.ts`,
registered by the changeset's `registered
ai-context-package-scoped-name` marker.

**Narrowings, each measured on first-party trees** (objectstack at
`d7f299c0`, re-read at this head; hotcrm at `9b735103`): the one
declarer of packs, `examples/app-showcase`
(`src/ai/record-context.ai-context.ts`), ships two packs of different
names (`showcase_project_brief`, `showcase_task_notes`) in one package;
hotcrm declares none.

| Narrowing | First-party count |
|:---|:---|
| A second holder of a pack name inside one namespace: refused at
install (`422 NAMESPACE_CONFLICT`) and by `os validate` | 0 |
| `GET /api/v1/meta/ai_context/NAME` with no package, for a name two
packages hold: first match becomes `409 RESOURCE_CONFLICT` | 0 |
| A package-less pack row under a name a package ships: not served (the
holder's customization) | 0 |

## Tests
- `packages/mcp/src/mcp-record-context-tools.test.ts`: a new top-level
`describe` on the stdio bridge whose engine's registry places two
packages: each same-name pack reached by its face, alike over
MCP-over-HTTP and stdio; the bare name refused `409` naming both faces;
a control engine with no registry spells each pack bare, so no face
reaches one (`404`).
- `packages/runtime/src/mcp-record-context-tools-bridge.test.ts`: in the
real-protocol `/mcp` harness, two packages of two namespaces ship
`rcd_brief` on one root: each is reached by its face, and the bare name
is refused `409` naming both. The door's member pin lists
`packageNamespace`.
-
`packages/services/service-record-context/src/__tests__/record-context-tools.test.ts`:
a new top-level `describe` for selection by `(package, name)`: each of
two packages' same-name packs reached by its face; the bare name refused
`409` naming both faces with nothing read; uninstalling one holder keeps
the other; environment pack first under D3; the root narrows before D3
picks; the several answer by face and label in en and zh-Hans, with the
blank-label fallback; a door without `packageNamespace`.
- `packages/metadata/src/metadata-manager-keyed-plural-read.test.ts`:
the pinned slotted set gains `ai_context`, so every plural-read case
runs for it.
- `packages/metadata/src/loaders/database-loader.test.ts` (objectstack-ai#32521
priming): the two host-file cases spelt the host's file
`helper.TYPE.yml`, which the pass never reads for `ai_context` (the
registry declares `**/*.ai-context.yml`). They now spell the file from
the type's registry pattern. Every assertion is unchanged, and the
`ai_context` cases assert the slotted behaviour every other type already
had.
- objectql and CLI enumeration pins
(`registry-namespace-co-owner-names`, `package-scoped-exact-qualifier`,
`package-scoped-e8-readers`, `manifest-service-residual-namespace-name`,
the CLI's `namespace-co-owner-names`) list `ai_context` where it moved.

## Acceptance notes
- **Owed item 3 of the hand-off is folded into this PR.** Both doors'
`packageNamespace` (`packages/runtime/src/domains/mcp.ts`,
`packages/mcp/src/stdio-data-bridge.ts`) waited for PR objectstack-ai#37255 (objectstack-ai#37243),
which edits the same `listContextPacks` regions. It landed after objectstack-ai#37255
merged: `main` was merged in at `057cedfa` (no rebase), and the doors
were built on its `stripReadDecorations` listing (commit `1deea31f`).
- `record-context-tools.zod.ts`'s `context` describe still says "by
name"; the addendum makes it a face or a bare name. Noted for objectstack-ai#37141,
which owns that key.
- The contract review at CONTRACT_REVIEW_TIER
(`packages/spec/src/api/protocol.zod.ts`) is run by the zone, not here.

## Verification
<details><summary>Local readings</summary>

Each run under `scripts/pm/os-verify-lock.sh`, exit taken from its
`VERDICT command-exit` line. Readings taken at `6cb32813` (main merged
at `057cedfa`, which carries objectstack-ai#37255). The head is now `74085439`: the
two commits since change only the changeset's `Clause-②` line and the
semantic entry's `reason` plus the first BREAKING bullet (`422
NAMESPACE_CONFLICT`). The dogfood battery was re-run on `74085439` (see
below). The suites the door commits touch were re-run there; the rest
were read at `c61fb9f7`, and the merge brought no change to their
packages (`packages/spec`, `core`, `objectql`, `metadata`,
`metadata-protocol` untouched by it).

| Command | Head | Result |
|:---|:---|:---|
| `pnpm --filter @objectstack/mcp test` | `6cb32813` | 85 files, 1507
tests passed · exit 0 |
| `pnpm --filter @objectstack/runtime test` | `6cb32813` | 647 files;
11997 passed, 25 skipped · exit 0 |
| `pnpm --filter @objectstack/service-record-context test` | `6cb32813`
| 2 files, 82 tests passed · exit 0 |
| `typecheck` mcp, runtime | `6cb32813` | exit 0 each |
| `pnpm --filter @objectstack/core test` | `c61fb9f7` | 157 files, 3761
tests passed · exit 0 |
| `pnpm --filter @objectstack/objectql test` | `c61fb9f7` | 638 files,
14423 tests passed · exit 0 |
| `pnpm --filter @objectstack/metadata test` | `c61fb9f7` | 83 files,
2798 tests passed · exit 0 |
| `pnpm --filter @objectstack/metadata-protocol test` | `c61fb9f7` | 370
files passed, 9 skipped; 23419 tests passed · exit 0 (§5 pin and its
control both ran and passed) |
| `pnpm --filter @objectstack/spec exec vitest run src/migrations
src/api` | `c61fb9f7` | 69 files, 2339 tests passed · exit 0 |
| `pnpm --filter @objectstack/cli exec vitest run --project unit
src/utils/namespace-co-owner-names.test.ts` | `c61fb9f7` | 31 tests
passed · exit 0 |
| `typecheck` service-record-context, metadata, core, objectql,
metadata-protocol, spec, cli | `c61fb9f7` | exit 0 each |

The objectstack-ai#32521 host-file pins before the fixture fix: 2 failed / 539 passed
(the two `ai_context` host-file cases; the pass read no file). After:
541 passed, 23 of them `ai_context` cases.

**Ablations** (once each, after committing; restore proven by blob equal
to HEAD): deleting the stdio bridge's `packageNamespace` member turns
both face cases of the new mcp `describe` red (2 failed, the control
passes). Deleting the `/mcp` door's member turns the runtime face case
and the member pin red (2 failed).

The CLI `integration` layer and `test:repo` were not run locally; CI
runs them.
</details>

<details><summary>Gate sweep (dispatch-gates --commands)</summary>

`node scripts/pm/dispatch-gates.mjs --commands` at `6cb32813`: 105
derived commands, each run with its exit code recorded. `--ran`: **105
derived, 105 run, 0 NOT MEASURED** (a derived zero: every line carries
its exit code).

- 104 exit 0 on the first run.
- `pnpm check:type-check-debt`: exit 3 on the first run (lock
queue-timeout behind the dogfood run, nothing measured). Re-run under
the lock: exit 0.
- `check:adr-0087-registration`: `registered
ai-context-package-scoped-name (new here:
ai-context-package-scoped-name)`.
</details>

<details><summary>Dogfood battery</summary>

Head `74085439` (the current head; the os-dev-report is objectstack-ai#37216 comment
7169906867): the full battery under the lock gave `VERDICT command-exit
0` · Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68
skipped (4196) · no failures. Earlier reading, head `6cb32813`, `pnpm
turbo run build --filter='@objectstack/dogfood^...'` (exit 0), then
`pnpm --filter @objectstack/dogfood test` under the lock: `VERDICT
command-exit 0` · Test Files 487 passed, 3 skipped (490) · Tests 4128
passed, 68 skipped (4196) · no failures. (Also run at `c61fb9f7`, before
the door commits: the same counts.)
</details>

**Read first:**
`packages/services/service-record-context/src/read-set.ts`
(`selectContextPack`, the face / D3 order),
`packages/spec/src/api/protocol.zod.ts` (the slot list, a contract
surface), `packages/mcp/src/stdio-data-bridge.ts`
(`installedPackageNamespaceOf`, the stdio door's new member).

**Two-minute check:** `pnpm --filter @objectstack/service-record-context
exec vitest run src/__tests__/record-context-tools.test.ts` → 65 passed,
including "the bare name two packages hold is refused 409, naming both
faces".

## Provenance

Opened by seat repo:objectstack#4 on the maintainer's authorization in
the seat session (「objectstack-ai#37216 开 PR 放行」). The dev session's
(`session_01QSeKYohZLmQ1Ug9FKcQtVu`, zone a4-A) own relay `pr_create`
was refused by its permission check and not retried; the dev sent the
prepared body. The seat changed the dev's `Clause-②: no (narrowing)` to
`Clause-②: yes (narrowing)`. A narrowing arm is legal with either value;
`yes` is right here because the diff also widens published surface:
`?package=` on the history and rollback doors for `ai_context`, a face
in `get_record_context`'s `context`, and new `service-record-context`
exports. Branch `claude/issue-37216-ai-context-package-scope` @
`74085439`.

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants