Skip to content

docs(adr): ADR-0160 amended — related lists gain where / orderBy / limit (row 11 contract) - #37240

Merged
os-zhuang merged 3 commits into
mainfrom
claude/issue-37202-related-where-orderby-limit
Nov 25, 2026
Merged

os-zhuang merged 3 commits into
mainfrom
claude/issue-37202-related-where-orderby-limit

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

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

Fixes #37202

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:现在用户无感(只改决定记录,不改代码);规则是给 AI 的记录资料包里,关联列表可以只带挑出来的行、按指定顺序排、限定条数(例如只带当前生效的那一版),筛选不增加任何权限,筛选或排序用到提问人不能据以查询的字段(看不到的、值被收起的、只显示掩码的)时整段省略并说明有资料不可见、不点名字段;要等后续实现卡 ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #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 #36996, card #37202). The first amendment (PR #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 ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #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 feat(service-record-context): cap the body outline's entries and state the cut #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 #37209 added to D1 and the outline cap of PR #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.

What the schema on main does with the three keys and with the sort direction

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

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.

The anchors this round adds, resolved one by one

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

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
Local gates at 1cd00b0: 21 derived, 21 run, all exit 0

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:

✓ 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:

✅ 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.

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 #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 ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #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

… orderBy and limit on the child's own fields

The maintainer's word, 2026-11-25, verbatim: 「related 的筛选和排序 同意」.

A related entry may filter, order and cut its rows. where takes a small
operator set on the child's own fields and is joined to the link filter;
orderBy is the sort node's { field, order } shape; limit is a positive
integer at most the service's row cap for one list. The filter runs
inside the caller's one capped child query and grants nothing. A where
or orderBy field the caller cannot read drops the section with the
not-visible statement and is never named. The read set is unchanged, so
the interceptor contract holds. Point 5 is updated and the
Implementation split gains row 11, which lands the keys with their
reader: until then the schema refuses them.

Ported from the draft on claude/adr-0160-related-filter-order and
re-measured on main at 0a1b69c: the sort node spells its direction
order, not direction; row 5 has merged; the row cap is a constant of the
service.

One sentence is carried from the seat's review of the outline cap's PR:
D3's body paragraph names the cap on an outline's entries as a further
constant of the service and a further stated cut.

Docs only: no schema, no code, no changeset. The generated index is
unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
@objectstack-fleet objectstack-fleet Bot added pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue skip-changeset PR has no user-facing published change; bypasses the changeset gate labels Nov 25, 2026
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation labels Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 0a7ff7c · 2026-11-25T06:10Z

@os-zhuang
os-zhuang marked this pull request as ready for review November 25, 2026 06:11
@os-zhuang
os-zhuang enabled auto-merge November 25, 2026 06:11
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0a7ff7ca7c078872d221ddd87df185f0db04248f
Local-runs: none
Scope: docs/adr/0160-record-scoped-ai-inquiry.md + none
Security-touching: yes

This record answers the contract-review claim posted on the PR as comment 7154525435. Inputs: card #37202 with every comment, PR #37240 (body, file list, net diff against main), and the check-runs on the head. Cited code was read on origin/main at ad604c10; nothing was built or run.

① Derived judgments

  • The diff is one file, docs/adr/0160-record-scoped-ai-inquiry.md, 31 lines added and 11 removed. It publishes nothing: no schema, no code, no generated output. Right.
  • The Status: line is unchanged, so the generated docs/adr/README.md is rightly absent from the diff. The check-runs agree (Lint · docs & code guards success).
  • The accept-set the text declares for row 11 is new: three optional keys on a related entry. On main AiContextRelatedSchema is strict and refuses all three, as the text says. Declaring them here and landing them with their reader is the ADR-0049 order. Right.
  • Check-runs on the head: every run concluded success or skipped; none failed, none is pending.

Citations, each read on origin/main:

  • packages/spec/src/data/filter.zod.ts#FilterConditionSchema exists. The ten admitted operators are all members of FILTER_OPERATORS; $between, the five string operators and $empty are the rest of that list, and LOGICAL_OPERATORS is $and, $or, $not. FieldOperatorsSchema also carries $like and $ilike, which neither list holds; the text's "anything else is refused" covers them. True.
  • packages/spec/src/data/query.zod.ts#SortNodeSchema is { field, order }, strict, with aliases: { direction: 'order' }. It refuses direction by name. True. Its order defaults to asc.
  • RECORD_CONTEXT_RELATED_MAX_ROWS is 20 in record-context-tools.ts and is pinned by test. True.
  • packages/mcp/src/mcp-relation-reads.ts#RelatedListRequest carries orderBy and limit and no where. get_record's input schema (mcp-http-tools.ts) bounds limit with .max(relatedMaxRows), so a limit over its cap is refused at parse. True. That cap is the lower of 20 and the door's own page cap.
  • packages/plugins/plugin-security/src/predicate-guard.ts#assertReadableQueryFields refuses a query whose where or orderBy names a field marked readable: false in the map it is handed. The map is one field-level derivation, so a field the caller's schema hides and a field the schema shows while field-level security withholds it are refused alike. True as far as the text goes; see S1 for what the text leaves out.

② Semver level

No changeset, and the PR carries skip-changeset. That matches: an ADR amendment publishes no package. Clause-②: no and Metadata-protocol: none are right for this PR; row 11 makes its own declaration (added), as the split table says.

③ Boundary flags

The dev's three open questions:

  • (a) A limit over the cap: refused at parse, or cut? Refused at parse is right, as written. The record already says a pack over a bound is refused at parse and nothing is cut silently at call time, and get_record refuses the same key the same way. The cost is real and the text names it: the spec schema cannot import the service's constant, so row 11 must declare one number both read.
  • (b) Bare-value equality is not admitted. The plain reading does refuse it, and the text does not say so. That is part of S2.
  • (c) Does "cannot read" cover both the schema-hidden and the withheld field? Yes, and it must: the narrower rule of card ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #37203 would leave the withheld case to a whole-call 403. But two cases are still one short. See S1.

The four out-of-scope findings in the dev report are carried, not answered here. Two matter to row 11: the service on main refuses the whole call for a child this caller is not served, and a link field that field-level security withholds reaches the predicate guard. Both predate this diff.

SQL push-down: the text keeps the child read as one query, with the filter, the order and the cut inside it. No id materialisation and no in-app join is added.

The card's acceptance says the PR stays draft. The PR reads draft: false at this head. That is the seat's to settle, not a finding on the text.

④ Design judgment

Judged against the first consumer (row 5 on main: ai-context.zod.ts and service-record-context) and the execution plan (row 11, card #37203).

S1 (should-fix) — "cannot read" misses the field the caller reads masked. D3 drops the section when where or orderBy names a field "this caller cannot read", in two cases: hidden by the schema, or shown and withheld. The guard the text cites refuses a third. Its call site hands it computeQueryGuardFieldPerms, which also marks as non-queryable a field this caller sees partially masked, and a field readable only under the agent ceiling. The spec says the same: ISecurityService.getQueryableFields is "a subset of getReadableFields", and "the difference between the two is exactly the fields this caller sees masked". D3 also says a masked value is carried as served, so such a caller can read the field in the record's own sense. Row 11, built to the text, would send that caller's query, and the engine would answer 403 for the whole call. That breaks "a field-level rule never refuses a pack". The text's own reason ("rows chosen or ordered by a value disclose it") applies to a masked value in full. The fail direction is closed, so this is not a leak. The fix is one sentence: the rule is "a field this caller cannot query on", the complement of getQueryableFields, and the header bullet and card #37203's item 3 follow.

S2 (should-fix) — the comparand side of where is not closed in words. The text closes the operator side and says "anything else is refused at parse". Two comparand forms are left to row 11 to guess:

  • The bare value. FilterConditionSchema's first form is implicit equality, { is_current: true }. The plain reading refuses it; the dev's own recommendation is to admit it. The record must say one or the other, because row 11's parser and its refusal message depend on it.
  • The placeholder string. The engine resolves a comparand that is entirely {token} in every where it reads (resolveFilterTokens, called from the engine's find path): {today}, {now}, {30_days_ago}, {current_user_id}, {current_org_id}. Such a string is a literal to the parser, so it passes the ten operators. The text refuses the $now anchor and is silent on {now}. With these, a pack's selection depends on the clock and on the caller. And a token the engine does not know, or {record_id}, throws at call time for every caller: an author defect that is neither refused at parse nor listed among the author defects.

Neither changes the read set or grants anything. Both are contract shape, so the record should settle them: admit or refuse the bare value, and admit a named token list or refuse the whole-{…} string at parse.

S3 (should-fix) — the record's account of where its text comes from is wrong. The header says the amendment is by the maintainer's word and that "one sentence does not come from that word". The PR body lists ten more places that go past it. After the merge the PR body is gone and the record stands alone. The record has a section for exactly this, "Points that go past the card's words", which says which settlements are the record's own and which needed the maintainer. The amendment updates point 5 only. Point 11, the hidden structural field, is not updated for where and orderBy, though D3 now adds them. The settlements that change what an author or a user sees belong there by name: the operator set, the parse refusal of a limit over the cap, the section dropped for a field the caller cannot query, and the bare-value answer of S2. None of the eleven is the maintainer's own decision in the maintainer's words; each is the record's settlement, accepted by the merge. The text should say that, and the header's "one sentence" should not imply the rest was dictated.

Do the eleven places stay within the maintainer's word? They stay within its subject. Each narrows or spells out filter and order on related; none adds reach. Places 1, 2, 8, 9 and 10 are readings of the tree and are true. Places 3, 4, 6 and 7 follow rules the record already has. Place 5 is S1. Place 11 is true: PR #37222 has merged, and main holds RECORD_CONTEXT_OUTLINE_MAX_ENTRIES (80), pinned by test, with a stated cut (outlineTruncated).

Does "the read set is unchanged" hold? Yes. where and orderBy name the child's own fields, the nested relation condition and the dotted key are refused, and limit is a number. The read-set function on main (read-set.ts) reads the root, each related[].object and the lookup targets, and takes nothing from the three keys. A placeholder token reads no object either.

Nits, none of which changes the contract:

  • Nit: limit itself is a twelfth place past the verbatim word, which names filter and order. The card names it and the PR's summary for the maintainer says it, so the merge covers it. The numbered list should carry it.
  • Nit: "the data engine refuses" the filter. The refusal is the security plugin's engine middleware. A deployment without that plugin has no such guard.
  • Nit: an outline is also cut by the body's character bound, before it reaches the entry cap. The new sentence names the entry cap alone.
  • Nit: where has no bound on its size (conditions, nesting, $in members), while the record bounds every other part of a pack at parse. Row 11 can set one.
  • Nit: get_record's cap is the lower of 20 and the door's page cap. On a door with a lower page cap, a limit that parsed is lowered at call time. Row 11 must state that cut.
  • Nit: the link-field sentence next to the new one still says "that caller's schema hides". The new sentence is wider, so the two now differ in one bullet. A follow-up card should carry it.

Implemented-by: claude/issue-37202-related-where-orderby-limit
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对 — REWORK · repo:objectstack#3 · head 0a7ff7c · 2026-11-25T06:18Z

L1: REWORK (L1-w, zone ai-A)
Head-sha: 0a7ff7ca7c078872d221ddd87df185f0db04248f

The L2 at CONTRACT_REVIEW_TIER on this head is PASS with three should-fix findings open (comment 7154648352, claim 7154525435). Under the merge standard each is fixed and re-read before the hand-over, so this head is REWORK. Tier H (governed docs/adr/**). After a final ACCEPT and a same-head L2 PASS it goes to the seat for the maintainer.

Should-fix (from the L2, adopted; details in 7154648352)

  • L2 S1. "A field this caller cannot read" is one case short. The data engine's guard refuses a filter or sort on more than schema-hidden and FLS-withheld fields. The call site builds its map with computeQueryGuardFieldPerms (security-plugin-authz-middleware.ts), which also refuses a field the caller reads masked and an agent-ceiling field; the spec's getQueryableFields says the same. If row 11 is built to the text as written, such a caller gets a whole-call 403, against D3's "a field-level rule never refuses a pack". Fix: say "a field this caller cannot query on" (the complement of getQueryableFields), in D3 and in the Amended summary.

  • L2 S2. The comparand side of where is not closed in words.

    • Bare-value equality is left undecided; this is the dev's open point (b).
    • Whole-{token} placeholder strings ({today}, {now}, {current_user_id}) pass the filter parser and the engine resolves them, while the text refuses only the $now anchor.
    • An unknown token or {record_id} fails every caller's call at run time, and the author-defect paragraph does not list it.
    • Fix: state what a comparand may be, and either refuse placeholders at parse or list them as admitted.
  • L2 S3. The Amended summary says one sentence does not come from the maintainer's word, but the PR body numbers eleven places past the card. None of the eleven needs the maintainer's own decision; each is the record's settlement. Even so:

    • the record's own "Points that go past the card's words" section is not extended;
    • its point 11 is not updated for where and orderBy.

    Fix: list the places in that section, or at least the ones that change what row 11 builds, and correct the header sentence. limit itself is a twelfth place past the verbatim 「筛选和排序」 (L2 nit).

The dev's three open points

  • (a) A limit over the cap refused at parse: right, as the pack's other bounds are, and as get_record refuses an over-cap limit.
  • (b) Bare-value equality: the plain reading refuses it, but the text must say so (S2).
  • (c) "Cannot read" covering both schema-hidden and FLS-withheld fields: right, and still one case short (S1).

Read and found right (head 0a7ff7c)

  • l1-face --pr 37240.

    • The face reads base main, Fixes #37202 binding only this card, and skip-changeset right (no published package is touched).
    • Declarations: Clause-②: no · Metadata-protocol: none. That is right for a record that declares and implements nothing. Row 11 declares added.
    • At my read, 18 success, 0 failed and 5 pending; the L2's later read found all success or skipped.
  • Fixes is right, once the findings close. Card ADR-0160 amendment: related lists gain where / orderBy / limit (row 11 contract) #37202's What list is all in the diff:

    • D1 where / orderBy / limit, and their removal from Later work;
    • D3 "runs inside the caller's one capped query, grants nothing", and the hidden-field drop;
    • D4 "read set unchanged";
    • point 5;
    • row 11;
    • the Amended line quoting 「related 的筛选和排序 同意」.

    The row-11 card it names, ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #37203, exists and is the implementation card.

  • Citations. The L2 confirmed every one on origin/main:

    • the ten operators in FILTER_OPERATORS;
    • SortNodeSchema strict { field, order }, refusing direction;
    • RECORD_CONTEXT_RELATED_MAX_ROWS = 20;
    • RelatedListRequest taking orderBy and limit, with no where and an over-cap .max;
    • assertReadableQueryFields.

    The carried N5 sentence is true: feat(service-record-context): cap the body outline's entries and state the cut #37222 has merged, with RECORD_CONTEXT_OUTLINE_MAX_ENTRIES = 80 and a stated cut.

For the seat

This PR left draft at 06:11Z (ready_for_review by os-zhuang), and the card's acceptance says it "stays draft with pm:awaiting-merge until the maintainer merges it". A person did it, so this is a note for the seat, not a finding on the text. Nothing here arms or queues it.

Path to final ACCEPT

  1. Card thread: one prose push for S1–S3, plus any nits.
  2. L1-w: a new claim, the same L2 reviewer reads the delta, and I read the L1 delta.
  3. Then the seat hands it to the maintainer.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Seat correction · 2026-11-25T06:27Z · not ready for the maintainer yet: dequeue, back to draft, label off

This PR carried pm:awaiting-merge from the moment it was opened (06:02Z, put on by the pr_create stroke), before any review. Under pm-dispatch, that label goes on only at the seat's hand-off: after a ## 席位核对 ACCEPT and a same-head ## Contract review PASS, in one label-write --handoff stroke. Neither exists on this head. L1 is REWORK (7154665327), and the L2 (7154648352) has three should-fix findings open. So the label told the maintainer the PR was ready when it was not.

Seat 3 therefore: dequeues the PR, removes pm:awaiting-merge, and returns the PR to draft. The fix round (S1–S3, plus the two wording decisions listed under "past the card") runs next. Seat 3 hands it over properly once the new head has ACCEPT and PASS.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Relay pr_dequeue · session_01WGufzi4PechTRCTBrfxV8W · request fw-20261125T062839Z-d417d3

Merge-queue dequeue of #37240 — cause seat-asks.

  • Relay read: landing seat repo:objectstack#3 · os-support-ai, signed by repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W.
  • Seat's reason: Queued before review finished: L1 REWORK 7154665327 and L2 should-fix findings 7154648352 are open; pm:awaiting-merge was put on at pr_create, not by a hand-off. The seat re-hands it over after the fix round.

The relay sends dequeuePullRequest after this comment and confirms the removal by reading the queue back; the run row of this request carries the outcome. Re-queue once the cause is fixed (landing-operations.md, the landing seat's queue duty).

@objectstack-fleet
objectstack-fleet Bot removed this pull request from the merge queue due to a manual request Nov 25, 2026
@objectstack-fleet objectstack-fleet Bot removed 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
@objectstack-fleet
objectstack-fleet Bot marked this pull request as draft November 25, 2026 06:30
Takes the ADR-0150 addendum's note in ADR-0160 D1 and the outline cap of
service-record-context, both merged since the branch point. No conflict.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
…e comparand side of where, and the points past the card

Review round 2 on the second amendment.

- D3: the section is dropped for a where / orderBy field the caller cannot
  query on, the complement of the security service's getQueryableFields.
  That takes in the masked field and the agent-ceiling field as well as the
  hidden and the withheld one. The refusal it avoids is the security
  plugin's engine middleware's, not the data engine's.
- D1: a bare value is admitted and read as $eq. A comparand that is one
  whole {token} placeholder is refused at parse, beside the $now anchor;
  placeholders resolved at call time join Later work. A door's lower page
  cap cuts a list that parsed, and the cut is stated.
- D3, "The body": an outline is cut by the body bound or by the entry cap,
  which is now on main and anchored.
- Points that go past the card's words: points 13-22 list what the
  amendment adds to the maintainer's word, and point 11 covers where and
  orderBy. The Amended line names each and no longer says "one sentence".
- Readings re-taken on main at 6211ddf.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 1cd00b0 · 2026-11-25T06:56Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1cd00b0d4594fd4e3372c2880daba1ff2471ed6c
Local-runs: none
Scope: docs/adr/0160-record-scoped-ai-inquiry.md + none
Security-touching: yes

This is the delta record for the head above. It answers the contract-review claim posted on the PR as comment 7155328202, and follows the round-1 record, comment 7154648352, which left S1, S2 and S3 open. The delta is a merge of main and one text commit. Inputs: card #37202 with every comment, PR #37240 (body, file list, net diff against main), the delta between the two heads, and the check-runs on this head. Cited code was read on main at 6211ddf4; nothing was built or run.

① Derived judgments

  • The net diff against main is still one file, docs/adr/0160-record-scoped-ai-inquiry.md, now 55 lines added and 13 removed. It publishes nothing. Right.
  • The Status: line is unchanged, so the generated docs/adr/README.md is rightly absent.
  • The merge of main brought the cross-reference note of objectstack#37180 into the file. It is main's text, not this PR's, and is outside the net diff.
  • Check-runs on this head: 26 success, 22 skipped, none failed, none pending.

Citations the delta adds, each read on main at 6211ddf4:

  • packages/spec/src/contracts/security-service.ts#getQueryableFields exists. Its contract says the answer is the exact complement of what the engine's predicate guard refuses, a subset of getReadableFields, and that the difference is the fields this caller sees masked. It also says a consumer with no answer treats every field with a masking rule as not queryable. The text's sentences match.
  • packages/plugins/plugin-security/src/security-plugin-object-inputs.ts#computeQueryGuardFieldPerms exists. It folds in the field-permission map, the delegator's map by intersection, the partial-mask rules and the computed fields that read a withheld field. Each of the five cases D3 now lists is in it. True.
  • packages/spec/src/data/context-tokens.zod.ts#FILTER_TOKEN_WRAPPED_RE is ^\$?\{([^{}]+)\}$: one whole token, with or without a leading $. True.
  • packages/core/src/utils/filter-tokens.ts#resolveFilterTokens resolves every string comparand, list members included, through the spec's classifier, which uses that same pattern. An unknown token throws, and {record_id} throws. So a string the pattern refuses at parse is exactly the set the engine would resolve or throw on. True.
  • packages/services/service-record-context/src/body-outline.ts#RECORD_CONTEXT_OUTLINE_MAX_ENTRIES is 80, and boundedOutline also stops at the body's character bound. "An outline cut by either bound says so" is true.
  • RECORD_CONTEXT_RELATED_MAX_ROWS is still 20.
  • "The data engine adds no order" (point 18): no default order is applied on the engine's find path; the created_at desc default is a list view's, sent by its caller. True.
  • "That PR has since merged": PR feat(service-record-context): cap the body outline's entries and state the cut #37222 is merged. True.

② Semver level

Unchanged from round 1. No changeset, the PR carries skip-changeset, and an ADR amendment publishes no package. Clause-②: no and Metadata-protocol: none are right.

③ Boundary flags

The dev's three open questions are now answered in the text:

  • (a) A limit over the cap is refused at parse. Point 14 records it as the record's settlement, with the alternative not taken.
  • (b) A bare value is admitted and read as $eq. Point 16 records it.
  • (c) The rule is "cannot query on", which covers the hidden field, the withheld field and three more. Point 19 records it.

The out-of-scope findings of the dev report still stand and predate this diff. Card #37203 now trails the record in four places: it spells the direction direction, says "served schema hides", and does not carry the bare value or the placeholder refusal. The seat updates the card; the record governs.

SQL push-down: unchanged. The child read is still one query.

④ Design judgment

S1: closed. D3 and the header now say "cannot query on", defined as a field outside getQueryableFields. The five cases listed are the ones computeQueryGuardFieldPerms folds in. The text says the service judges the entry before it reads, so the guard's 403 is never reached, and it keeps "a masked field listed in fields is still carried as served". The fallback for a deployment with no answer is the contract's own.

S2: closed. A bare value is read as $eq. A whole {…} comparand or list member is refused at parse, beside the $now anchor, on the platform's own pattern. The author-defect paragraph lists the refusal, and call-time placeholders are in "Later work". The comparand side is now closed: a literal, never a reference.

S3: closed. The header says the maintainer's word names filter and order and no more, and names each addition by point number. "Points that go past the card's words" gains points 13 to 22 with their own introduction, which quotes the word, says what the card adds, and says none is the maintainer's own decision. Point 11 carries the second amendment. limit itself is point 13.

No must-fix, no should-fix.

Each of points 13 to 22 was read against the tree and the card:

  • 13: the card does add a per-list limit, and RelatedListRequest takes one. True.
  • 14: get_record refuses an over-cap limit with .max. True. Its last sentence is the first nit below.
  • 15: the ten operators and the seven left out match FILTER_OPERATORS, LOGICAL_OPERATORS and the filter form. True.
  • 16: implicit equality is the filter form's first spelling. True.
  • 17: matches the resolver, as above. True.
  • 18: SortNodeSchema is { field, order } and refuses direction by alias. True.
  • 19: matches the guard and the contract, as above. True.
  • 20: consistent with D1 and D3.
  • 21: consistent with D3.
  • 22: true, and rightly marked as not from the maintainer's word.

The read set is still unchanged: the delta adds no reference form, and a refused placeholder reads nothing.

Nits, none of which changes the contract:

  • Nit: "a door whose own page cap is lower … cuts the list at that cap" is a declaration, not a reading of the tree. On main the service's door contract (door.ts) has no page cap, and the service reads its cap plus one row whatever the MCP tools' maxQueryLimit is. The page cap lives in the tool handlers, not in the bridge. Row 11 either gives the door that member or the sentence never applies. The record should say "row 11" there, as it does for the cap's number.
  • Nit: "a string that only contains braces is a literal" reads as a string made of braces. The platform's phrase is a value that merely contains braces.
  • Nit: the link-field sentence beside the new rule still says "that caller's schema hides". It is now narrower than the rule next to it. Carried from round 1; a follow-up card should take it.

Implemented-by: claude/issue-37202-related-where-orderby-limit
Reviewed-by: session_01WGufzgv2LZN1W2qSYTZvYs

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对 — ACCEPT · repo:objectstack#3 · head 1cd00b0 · 2026-11-25T07:01Z

L1: ACCEPT (L1-w, delta read, zone ai-A)
Head-sha: 1cd00b0d4594fd4e3372c2880daba1ff2471ed6c

No must-fix, no should-fix. The L2 at CONTRACT_REVIEW_TIER on this head is PASS with nothing open (comment 7155394437, claim 7155328202). It closes S1, S2 and S3 of 7154648352. This PR is Tier H because it touches governed docs/adr/**, so it goes to the seat for the maintainer. ⛔ Never ready, queue or arm it here.

Delta 0a7ff7ca..1cd00b0d

The delta is a merge of main (6211ddf4, as e22d26d0), then one text commit. The net diff against main is still one file, +55/−13.

  • S1 is closed.
    • D3 and the Amended summary now say "a field this caller cannot query on". That means any field outside getQueryableFields: the hidden field, the FLS-withheld field, the masked field and the others computeQueryGuardFieldPerms folds in.
    • Point 19 records why the narrower rule was not taken: it would have produced a whole-call refusal from the engine's guard.
  • S2 is closed.
    • A bare value is admitted and read as $eq (point 16).
    • A whole {…} comparand is refused at parse beside $now (point 17). This uses the platform's own FILTER_TOKEN_WRAPPED_RE, so parse refuses exactly what resolveFilterTokens would resolve or throw on.
    • The author-defect paragraph lists that refusal.
    • Placeholders resolved at call time are moved to "Later work".
  • S3 is closed.
    • The Amended line now says the maintainer's word names filter and order and no more. It lists each addition by point number.
    • "Points that go past the card's words" gains points 13–22 under their own introduction. The limit point is 13. The outline cap is 22, marked as not from the maintainer's word.
    • Point 11 carries the second amendment.
    • The row 11 paragraph says this record sets no bound on the size of a where.
  • The Amended line's tree readings are re-measured on 6211ddf4. RECORD_CONTEXT_RELATED_MAX_ROWS is still 20 and RECORD_CONTEXT_OUTLINE_MAX_ENTRIES is still 80. feat(service-record-context): cap the body outline's entries and state the cut #37222 has merged.
  • l1-face --pr 37240 reads 13 items clean, with 26 success, 22 expected skips, 0 failed and 0 pending. mergeable_state is clean. skip-changeset is right, because no published package is touched.

Round 1's reads still stand: Fixes #37202 (the card's whole What list is in the diff), the citations, and the row 11 card #37203.

Accepted deviations (L2 nits; each takes a prose fix on this PR before hand-over, or a follow-up card)

  • N1. "A door whose own page cap is lower … cuts the list at that cap" is a declaration, not a reading of the tree. On main, the service's door contract (door.ts) has no page cap; the cap lives in the MCP tool handlers. The sentence should say that row 11 gives the door that member.
  • N2. "A string that only contains braces is a literal" reads as a string made of braces. The platform's phrase is a value that merely contains braces.
  • N3. The link-field sentence beside the new rule still says "that caller's schema hides", which is now narrower than "cannot query on". This is carried from round 1.

For the seat at hand-over

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

维护者速读

  • 这是 ADR-0160 amendment: related lists gain where / orderBy / limit (row 11 contract) #37202 的 ADR-0160 第二次修订,只改文字(1 个文件,+55/−13)。内容:记录上下文里的「相关列表」可以带过滤(where)、排序(orderBy)和条数(limit),这是第 11 行的契约。
  • 上次您标待审时它还在返工,我撤回过一次。这次是评审改完后的正式交接:L1 通过,契约评审在同一提交上通过,没有未结项。
  • 需要您审,是因为改的是受管的 ADR 文件。您合并就等于接受 PR 里第 13–22 点;任何一点您都可以单独划掉,其余不受影响。要点:
    1. 除了过滤和排序,还支持 limit;limit 超过上限时,保存时就拒。
    2. 过滤只支持十个运算符。直接写「字段: 值」等同于「等于」。
    3. {today} 这类占位符第一版不支持,保存时会被拒。
    4. 过滤或排序用到调用者无权查询的字段时,整段不出,只说明有省略,不点名是哪个字段。
  • 三个措辞小瑕疵没有在这里改(再推一次就要重审),留给下一次修订或后续卡。批准后由您入队。

Request: approval · Tier H by governed path (docs/adr/** ×1) · 2026-11-25T07:03Z

Seat's view: land. This is the ADR-0160 second amendment for #37202: related gains where, orderBy and limit, which is row 11's contract (#37203). Docs only, one file. The seat withdrew an earlier, unreviewed queueing (seat comment on this PR); this is the real hand-off.

  • L1: ACCEPT 7155410258 (L1-w) at head 1cd00b0d. Round 1 was REWORK (L1 7154665327, L2 7154648352).
  • Contract review: claim 7155328202, PASS 7155394437 at 1cd00b0d, nothing open.
  • Checks at 1cd00b0d: green, mergeable_state clean.
  • The maintainer's decisions are points 13–22 in the PR body's table and the record's "Points that go past the card's words". Each one can be struck alone. Points 16 (bare value read as $eq) and 17 (whole {token} refused at parse in v1) are the seat's rulings on review S2.
  • Accepted nits, not pushed (a push would cost another review while this waits): N1 (row 11 adds the door page-cap member), N2 (wording), N3 (the link-field sentence still says "schema hides"). Carried to the next ADR-0160 change or a follow-up card. ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #37203's card text is being aligned to this record through triage. Fixes #37202.

Generated by Claude Code

@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 25, 2026
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 skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADR-0160 amendment: related lists gain where / orderBy / limit (row 11 contract)

3 participants