Skip to content

docs(skills): context-packs.md says an unserved related child is left out, and names what still refuses the call - #37475

Merged
os-zhuang merged 2 commits into
mainfrom
claude/project-thread-sxex2q
Nov 26, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/project-thread-sxex2q

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #37414

维护者速读

  • 用户能看到什么变化:AI 助手照技能文档写「资料包」时,学到的是现在的真实行为:提问人看不到某个关联对象时,这一段被省略并附一句说明,而不是整次报错。
  • 为什么做:属于「AI 资料包」专题的收尾。产品行为已经改成省略,技能文档还在教旧的整次报错。
  • 出错会怎样:只改文档文字,不动产品。写错的话助手会学到错误说法,撤回这次改动即可。
  • 要你做什么:这是受管的技能文件,需要审批人批准后才能合并。

What changes

One paragraph of skills/objectstack-ai/references/context-packs.md, section "What the caller is not shown, and what os validate reports", plus a patch changeset for @objectstack/skills.

  • Before: "A related object the caller cannot read at all refuses the whole call (403 PERMISSION_DENIED), so list only child objects the pack's audience can read."
  • After: a related list is left out when the caller cannot read its object, the same as for its link field or a where / orderBy field; the list is never named and notes carry the one not_visible note. The whole-call 403 PERMISSION_DENIED stays for a related object nobody is served (a system object the record tools refuse, one closed to API list reads, one in a disabled package) and for a lookup shown to the caller whose target is such a system object.

The second half is nit N1 of the contract review on the pull request that added this file: the reference names what still refuses.

The file sat at zero headroom on its token-ratchet row (1454), so the growth is paid for in the same file by cutting five restatements. No ceiling moves and no ratchet row is edited.

Cut Why it is restatement
fields row: ": the record's own facts" the row already says "root fields"; the opening paragraph says "fields of the root object"
related row: ": rows of another object that hang on the record" the opening paragraph says "child lists that point at the record"; the related entry table says "a child object with a reference field ... that points at the root"
body row: "the one long text the record is about," the opening paragraph says "one long-text field read as its body"
"(the open ones, soonest first)" restates the example's where and orderBy above it
", so a caller never learns it" restates "silent at the tool" in the same sentence

Dropped with the old sentence: "so list only child objects the pack's audience can read". That advice was the old behaviour's consequence. A pack now answers a narrower audience with a shorter pack.

Why

main leaves out a related child this caller is not served (ADR-0160 D3 "Object level", as amended; packages/services/service-record-context/src/record-context-tools.ts, step 4a) and the published skill still taught the whole-call refusal. An assistant that learns context packs from the skill would tell authors to split packs per audience for a refusal that no longer happens.

Tests

Documentation only: no package source changes, so no package test suite is owed. No ablation: the diff changes no tested behaviour.

Readings for a skills/** diff, base a46efa8c against head 782a8c45:

Reading Before After
context-packs.md lines 111 113
context-packs.md bytes 5813 5813
context-packs.md tokens (ceiling 1454) 1454 1454
All skills/*/SKILL.md lines, summed 4961 4961
Bundle total tokens (whole shipped tree) 299309 299309

The two extra lines are re-wrapping; the byte count is unchanged.

Acceptance notes

  • Acceptance 1 (the sentence matches step 4a on main and cites no behaviour main lacks). Read against record-context-tools.ts at a46efa8c: step 4a refuses a related child on the read guard, then on API exposure for a list read (a disabled package's refusal included), each as 403 PERMISSION_DENIED; a child that passes both and that this caller is not served is added to the left-out set and sets the one not_visible note. Step 4c refuses when the read guard refuses the target of a lookup that survived projection, which is a lookup the caller's served schema shows.
  • Acceptance 2 (node scripts/check-skills-token-ratchet.mjs exits 0, no ceiling raised): exit 0; the row reads 1454 of 1454.
  • Acceptance 3: both declaration lines are below and in the changeset.
  • Not taught, on purpose: step 4c also refuses a lookup target that the published plan does not reach (a fail-closed branch), and step 4a refuses when a definition read fails. Neither is something an author chooses, so neither is in the reference.
  • Noted, not changed (outside this card's sentence): the same paragraph's first clause, "a field the caller cannot read carries no value", describes a field the caller's schema shows and field-level security withholds. A field the caller's schema hides has no entry at all and is covered by the same not_visible note. The clause is not wrong for the case it names, and the paragraph's "some material is not visible" covers both.
  • No generated mirror moves: context-packs.md is referenced only by two SKILL.md pointers and its ratchet row.

Verification

Two-minute check: node scripts/check-skills-token-ratchet.mjs prints context-packs.md is 1454 tokens (ceiling 1454; headroom 0) and exits 0.

Read first, by risk: (1) the rewritten paragraph in context-packs.md against step 4a and 4c; (2) the three key-table rows that lost their gloss; (3) the changeset body.

Local gates at 782a8c4 (derived by dispatch-gates --commands)
spec build: os-verify-lock VERDICT command-exit 0
exit 0  node scripts/check-adr-0087-registration.mjs --base origin/main
exit 0  node scripts/check-adr-0087-registration.mjs --self-test
exit 0  node scripts/check-changeset-no-major.mjs --base origin/main
exit 0  node scripts/check-closing-keyword-parity.mjs
exit 0  node scripts/check-closing-keyword-parity.mjs --self-test
exit 0  node scripts/check-comment-mask-corpus.mjs
exit 0  node scripts/check-doc-route-spelling.mjs --advisory
exit 0  node scripts/check-doc-route-spelling.mjs --self-test
exit 0  node scripts/check-dts-emitted.mjs --self-test
exit 0  node scripts/check-empty-changeset.mjs --base origin/main
exit 0  node scripts/check-empty-changeset.mjs --self-test
exit 0  node scripts/check-skills-token-ratchet.mjs
exit 0  node scripts/check-skills-token-ratchet.mjs --self-test
exit 0  node scripts/ci/assert-turbo-remote-cache.mjs --self-test
exit 0  node scripts/ci/plan-test-core-shards.mjs --self-test
exit 0  node scripts/ci/prune-turbo-cache.mjs --self-test
exit 0  node scripts/ci/snapshot-next.mjs --self-test
exit 0  node scripts/pm/check-governed-queue-guard.mjs --self-test
exit 0  node scripts/pm/release-rehearsal-clone.mjs --self-test
exit 0  node scripts/release-pending-publish.mjs --self-test
exit 0  pnpm --filter @objectstack/lint run check:doc-formula-expressions   (first run exit 3, prerequisite not met; rerun after building formula and lint)
exit 0  pnpm --filter @objectstack/spec run check:skill-refs
exit 0  pnpm check:adr-anchors
exit 0  pnpm check:agent-test-spelling
exit 0  pnpm check:changeset-gate-self-tests
exit 0  pnpm check:ci-filter-parity
exit 0  pnpm check:closed-ceremony-text
exit 0  pnpm check:corpus-claim-drift
exit 0  pnpm check:cross-package-test-inputs
exit 0  pnpm check:doc-authoring
exit 0  pnpm check:driver-memory-census
exit 0  pnpm check:dts-closure
NOT MEASURED (exit 3, needs the whole-workspace build; the diff changes no package source; read from CI)  pnpm check:dual-build-cjs-loads
exit 0  pnpm check:gitlink-declared
NOT MEASURED (exit 3, needs the whole-workspace build; the diff changes no package source; read from CI)  pnpm check:lean-entry-closure
exit 0  pnpm check:nul-bytes
exit 0  pnpm check:pm-expected-skips
exit 0  pnpm check:pm-governed-merges
exit 0  pnpm check:pm-skill-id-lint
exit 0  pnpm check:published-files
exit 0  pnpm check:refd-timer-probe
exit 0  pnpm check:role-word
exit 0  pnpm check:skill-compatibility
exit 0  pnpm check:skill-frame-sync
exit 0  pnpm check:skill-identifier-liveness
exit 0  pnpm check:skill-links
exit 0  pnpm check:sourcemap-no-sources-content
exit 0  pnpm check:watch-hint-literal
dispatch-gates --ran: 48 derived, 48 run, 0 UNRUN (2 of the 48 are the NOT MEASURED lines above)

Clause-②: no
Metadata-protocol: none

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind. (no name added)
  • 3. No formatter ran; pnpm lint passes. (no formatter ran; the repo-wide lint is CI's run)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

… out, and names what still refuses the call

A related object this caller cannot read is left out with the one
not_visible note (ADR-0160 D3 "Object level", as amended); the whole-call
403 stays for a related object nobody is served and for a shown lookup
whose target the read guard refuses. Growth is paid for by cutting
restatement in the same file; the token-ratchet row does not move.

Claude-Session: https://claude.ai/code/session_01Utp6CYM2brJLG6jU6VWtsE
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 782a8c4 · 2026-11-26T07:57Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 782a8c4525a35f146b4c3c02d9bf694abf72671c
Local-runs: none
Scope: skills/objectstack-ai/references/context-packs.md + none
Security-touching: yes

PR #37475 (card #37414), 2 files, +24/−12, merge base a46efa8c62. Read: the card body and its five comments (two triage notes, the unblock note, claim 7185258989, os-dev report 7185979707), the PR body, the net diff, and the check-runs on the head. Precedent read: contract record 7181463291 on PR #37409 and ADR-0160 D3 on main. Code on main (4925039a75) was read to judge the teaching, never reviewed; nothing under skills/ or packages/services/service-record-context differs between the merge base and that main. Nothing was built, run or re-run. The byte count was read with wc -c off the two refs.

① Derived judgments

  • Accept-set: unchanged — right. The diff is one reference file's prose and a changeset. No schema, key, bound, operator, refusal or code path moves.
  • Public surface: skill prose only — right. context-packs.md ships in the skills bundle. No generated mirror follows it: the only other mentions are the two SKILL.md pointers and the ratchet row, none in the diff.
  • Ratchet: no row moves — right. context-packs.md is 5813 bytes at the head and 5813 at main; ceil(5813 / 4) = 1454, the row in scripts/check-skills-token-ratchet.mjs reads 1454, and that script is not in the diff. Headroom stays zero. Lines go 111 to 113 by re-wrapping.
  • Gates: green on the head. 44 check-runs: 28 success, 16 skipped, none failed, cancelled or pending.

② Semver level

Clause-②: no is right: nothing an existing author wrote parses, loads or reads differently; the product behaviour landed in PR #37412 and this diff only describes it. Metadata-protocol: none is right. The changeset is patch on @objectstack/skills, the package that publishes the skills/** tree, which is the level none takes and the shape of the other skills-text changesets on main. Both declaration lines are line-initial in the PR body and the changeset body, and the changeset's account of the change matches the diff. Check Changeset is green.

③ Boundary flags

  • Dev deviation, five cuts outside the card's sentence: answered in ④. The card allows it ("pay for any growth by cutting restatement in the same file"); each cut is judged below.
  • Dev deviation, two derived gates not measured locally (check:dual-build-cjs-loads, check:lean-entry-closure): answered by the head's check-runs, which are green; the diff changes no package source.
  • Dev deviations on commit trailers, effort level and hand-off: the seat's to accept, not contract matter.
  • Dev note, "not taught on purpose" (step 4c's fail-closed branch for a target the plan does not reach; step 4a's refusal when a definition read fails): right to leave out. Both exist on main and neither is something an author chooses.
  • Out-of-scope finding, the first clause of the paragraph: answered, N2 below.
  • open_questions: empty.
  • SQL push-down: n/a. No query, id materialisation or join is added.
  • Escalated to the seat, not judged here (code outside the diff): by reading step 4a, a related object the stack does not define passes the read guard, passes API exposure (both doors fall open on no declaration), and is answered null by servedObjectDefinitionOf, so it joins the left-out set and every caller gets the not_visible note. ADR-0160 says an author defect states nothing at the tool. Read, not measured. It needs its own card if the seat confirms it; see N1.

④ Design judgment

skills/objectstack-ai/references/context-packs.md, the rewritten paragraph against packages/services/service-record-context/src/record-context-tools.ts on main:

  • "a related list is left out when the caller cannot read its object" — holds. Step 4a: a child that passes the read guard and API exposure and for which servedObjectDefinitionOf answers null is added to leftOut, sets hidden, and is never read again (publishedOf answers null for it, the plan loop skips it). The path is reachable on the real doors: the HTTP door's readObjectForCaller and the stdio door's served view answer nothing for an object the caller may not read, and both exposure gates fall open on anything but their own refusals, so an ordinary permission gap reaches the served-definition read. "or link field, or cannot query on a field its where / orderBy names" is unchanged and still holds (the hidden-link branch and queryableAmong).
  • "one not_visible note naming nothing" — holds. One hidden flag yields one { kind: 'not_visible', text } note however many parts were removed. The note has no object or field key and its sentence names none, in both locales. A left-out list appears nowhere else in the answer: related holds only planned lists, and the truncation, narrowing and withheld notes are built from planned lists only. "for a list" is the right qualifier: a field the served schema shows and field-level security withholds gets the withheld_fields note, which does name fields.
  • "refused (403 PERMISSION_DENIED) for a related object nobody is served" — holds, each of the three. All three go through refuseObject, which throws PERMISSION_DENIED with status 403 whatever the door's own code was. (a) The read guard: readGuard in mcp-http-tools.ts refuses a system object unless the server allows system objects or the published definition attests enable.aiReadable; both are per deployment or per definition, never per caller. (b) API exposure for a list read: the executor asks assertApiExposed(object, 'query'); the doors' 404 OBJECT_API_DISABLED and 405 OBJECT_API_METHOD_NOT_ALLOWED are rewrapped as the 403. (c) A disabled package: both doors rethrow OBJECT_PACKAGE_DISABLED from the same gate, and the executor refuses on any throw there. "Nobody" is exact for every caller the tool has; the exposure gate's bypass is for a system context, which is no tool caller.
  • "and for a lookup shown to the caller whose target is such a system object" — holds. Step 4c collects the targets of the lookups that survived projection (root fields and each planned list's columns, on the served definitions) and refuses with the same 403 when readGuard refuses a target. A lookup the caller's schema hides was dropped in 4b and its target is never judged. "Such a system object" reads back to "a system object the record tools refuse", and that is the only target gate the code has: a target closed to API reads is left unexpanded by the door, not refused, so the narrower wording is the correct one. "Lookup" here covers every reference type (lookupTargetOf reads REFERENCE_VALUE_TYPES), as it does in the file's fields row; the stock sys_user attests AI reads, so an owner or user field does not trip this.
  • Nothing leaks, and nothing is cited that main lacks. The paragraph does not say a refusal never names the object, which would be false: an API-exposure refusal names the child when the caller's served schema shows it (the naming bound). It claims "naming nothing" for the note only.
  • The dropped advice ("so list only child objects the pack's audience can read") is right to drop. It was the consequence of the old refusal. ADR-0160 as amended says one pack serves roles with different object access.

The five cuts, each against what remains in the file and in SKILL.md:

  • fields row, ": the record's own facts": restates "root fields" in the same row and "fields of the root object" in the opening paragraph. Nothing lost.
  • related row, ": rows of another object that hang on the record": restates "child lists that point at the record" (opening) and the related.object row ("A child object with a reference field ... that points at the root"). Nothing lost.
  • body row, "the one long text the record is about,": "one long-text field read as its body" stays in the opening; the four types stay in the row; ai-context-body-not-long-text stays in the table. Nothing lost.
  • "(the open ones, soonest first)": a gloss of the example's own where and orderBy. Nothing lost; eval case 11 asserts none of these words.
  • ", so a caller never learns it": restates "silent at the tool" in the same sentence. Nothing lost.

SKILL.md (lines 247 to 252) points at the reference for keys, bounds, pack names and os validate rules and restates none of the cut or changed text, so the two stay in agreement.

  • N1 (nit) — "An author's mistake is silent at the tool" is not exact for one row of the table below it: a related object the stack does not define is, by reading step 4a, left out with the not_visible note for every caller (see ③). The sentence is in a changed hunk, but its claim is the same at the base, the diff's cut makes it weaker and not stronger, the os validate row is correct, and no pack an author writes changes. The cause is the code's, so the fix belongs with the escalated card, not this file at zero headroom.
  • N2 (nit) — "a field the caller cannot read carries no value" names the withheld case only (served schema shows it, field-level security withholds it: name and label kept, withheld: true, a withheld_fields note). A field the caller's served schema hides has no entry at all and is covered by the not_visible note. Not a misteaching: an absent entry carries no value either, "some material is not visible" covers both, and an author writes the same pack in both cases. Unchanged by this diff and disclosed in the PR body. One clause would cover it when the file next has headroom.

Security: the hunk teaches visibility and permission behaviour, so the line above reads yes. It teaches the safe reading (omission is stated, never named; only gates that refuse everyone refuse the call), it discloses nothing beyond ADR-0160 as published on main, and it tells no author that a pack grants or hides anything; the file's opening still says "A pack is no permission".

No must-fix, no should-fix. The paragraph matches steps 4a and 4c on main, the cuts lose nothing, and the file stays on its ratchet row. Open: nits N1 and N2.

Implemented-by: claude/project-thread-sxex2q
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

维护者速读

  • 改了什么:AI 技能里「情境包」那篇参考补了一段:调用者读不到的关联列表会被直接略去,不点名,只留一条 not_visible 提示;关联对象对谁都不开放(系统对象、关闭了 API 列表读取、所在包已停用)时,整个调用返回 403。为了不涨 token,同一文件删掉了五处重复表述。
  • 为什么:docs(skills): objectstack-ai teaches the context pack (ai_context); the record-context docs name both mounts #37409 契约复核 N1 的跟进。之前技能没教这两种行为,AI 会写出拿不到数据的情境包。
  • 风险:只改文档,不改行为,文件字节数不变(5813 字节 / 1454 token)。涉及权限可见性,已逐句对照 main 上的代码核实,不泄露对象名。
  • 要你做什么:批准合并。契约复核 PASS 在评论 7186128335,Head-sha 782a8c4525a35f146b4c3c02d9bf694abf72671c。

席位意见:ACCEPT。新段落逐句对得上 step 4a/4c 和 refuseObject 的实际行为;删掉的五处都是重复,教学内容没有丢。

席位核对

Head-sha: 782a8c4525a35f146b4c3c02d9bf694abf72671c
ACCEPT — L1, seat repo:objectstack#5

  1. Shape: open draft against main, 2 files (+24/−12), Fixes #37414, Clause-②: no, Metadata-protocol: none, @objectstack/skills patch. Tier H (skills/**).
  2. Premise:
    • Left out: step 4a adds a child with no served definition to leftOut and records one { kind: 'not_visible', text } that names nothing.
    • 403: all three unserved cases go through refuseObject, which returns PERMISSION_DENIED 403. Step 4c refuses a surviving lookup whose target the read guard refuses.
    • Cuts: all five are pure restatement, and SKILL.md and eval case 11 depend on none of the cut words.
    • Ratchet: wc -c gives 5813 bytes at both the head and main, so the row stays at 1454.
  3. Gates: check-runs at 782a8c4525: 28 success, 16 skipped, 0 failed. mergeable clean.
  4. Accepted deviations (contract nits):
    • N2: the "carries no value" clause names only the withheld case, as disclosed in the PR body.
    • N1: "an author's mistake is silent at the tool" is not exact for a related object the stack does not define. Every caller has that object left out with the not_visible note. The base text says the same.
  5. Out of scope and where it went: N1's code behaviour, an undefined related object answered as not_visible rather than refused, is a possible defect. Area ai-36996 files a card under 专题:记录范围 AI 问询(在一条记录上问 AI:对话钉在这条记录上、平台按配置交给模型这条记录的资料、外部 AI 经 MCP 拿到同一份) #36996 to decide it.
  6. Landing terms: Tier H, whole PR. L2 at CONTRACT_REVIEW_TIER: PASS, comment 7186128335, same head, no open must-fix or should-fix. Security-touching: yes, so the security label goes on. It waits for the approver. After an APPROVED review, the seat or area lands it (ready, auto-merge).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Approval requested (Tier H, skills/**; Security-touching: yes). Seat ACCEPT: comment 7186144126. Contract review PASS at CONTRACT_REVIEW_TIER: comment 7186128335, Head-sha 782a8c4525a35f146b4c3c02d9bf694abf72671c. After approval the seat or area lands it.

@objectstack-fleet objectstack-fleet Bot 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 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Security label: Security-touching: yes per contract record 7186128335 (the reference teaches visibility and refusal behaviour of related reads).

@os-zhuang
os-zhuang marked this pull request as ready for review November 26, 2026 08:13
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit df0894a Nov 26, 2026
54 of 55 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-sxex2q branch November 26, 2026 08:39
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 security size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

37177 跟进:技能文档 context-packs.md 改写「看不到的关联对象」一句,对齐 #37361 的省略行为

3 participants