Backlog
Backlog
Feature
Copy link
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivespm:queueReady for the PM dispatch looppriority:p2Medium: important, M3
Description
repo:cloud#2 · os-bob · session_012dn2AecKpLaYkUtNRiqtby
Filing gate: ③ maintainer-directed (topic child). Source: topic #36996 (ADR-0160 Implementation split, row 11); maintainer 2026-11-25, verbatim: 「related 的筛选和排序 同意」.
Grading: area:ai · Feature · p2 (topic) · reach: every ai_context pack with a related list · evidence: read.
维护者速读
- 做什么:情境包的关联列表(
related)可以筛选、排序、限条数:where(只能用子对象自己的字段,少量运算符)、orderBy、limit。 - 例子:BrightRule 的制度包只带现行版本的文档,正文在前、附件按序号排:
where: { is_current: { $eq: true } },orderBy: [{ field: 'sort_no', order: 'asc' }]。CRM 的客户包只带未关闭的商机、按金额倒序。 - 安全:筛选是作者写的,只是「选取」,不授予也不收回权限,提问人的行级规则照旧生效;筛选或排序用到的字段是提问人不能用来查询的字段时,整个关联段落省略并附一句「部分资料对你不可见」,不报错、不点名。
- 需要你做的:无(规则已在 ADR-0160 修订中裁定,见 ADR-0160 amendment: related lists gain where / orderBy / limit (row 11 contract) #37202)。
What
- Spec (
packages/spec/src/ai/ai-context.zod.ts, as landed by 记录 AI 问询 5:资料包类型 ai_context、渲染服务与 get_record_context 工具(MCP) #37140):related[]gains optionalwhere: the object-filter form (packages/spec/src/data/filter.zod.ts) restricted to the child's own fields, operators$eq $ne $in $nin $gt $gte $lt $lte $null $exists, joined by$and/$or. A bare value is read as$eq. Refused at parse: dotted paths, field-to-field comparands, a comparand that is one whole{token}(v1),$nowanchors, formulas, any other operator.orderBy:SortNodeSchema[](packages/spec/src/data/query.zod.ts), that is{ field, order }[], on the child's own fields. The direction is spelledorder;SortNodeSchemarefusesdirection.limit: positive integer, at most the service's per-list cap.- Liveness rows for the three keys with this card's reader; the
KIND_COVERAGEexample pack gains one filtered, ordered list; generated baselines refreshed.
- Render service (
packages/services/service-record-context): the one capped child query joins the link filter andwherewith$and, appliesorderByandlimit, as the caller. No second query. - Field-level rule (ADR-0160 D3, amended): a
whereororderByfield the caller cannot query on (every field outsidegetQueryableFields) drops the whole related section, with the single not-visible statement; the field is never named; never a refusal. - Author surfaces (ADR-0160 D1): a
where/orderByfield the child does not have is reported at save and byos validate; an operator outside the set is refused at parse. - Read set (ADR-0160 D4): unchanged by these keys — the exported read-set function takes no new input from them.
Acceptance
- Filter and order applied: a pack with
where+orderBy+limitreturns only matching child rows, in order, cut atlimit; the cut is stated in the notes. - A row the caller's row rules hide stays absent even when it matches
where(the filter grants nothing). - A
wherefield and anorderByfield the caller cannot query on each drop the section with the not-visible statement, for an ordinary caller; the field name appears nowhere in the answer. - An unknown operator, a dotted path, a field-to-field comparand and a whole-
{token}comparand are refused at parse; a bare value reads as$eq; an unknown field is reported byos validate. - The read-set function returns the same set with and without the three keys (pinned by test).
- Same answer on MCP stdio and HTTP for one caller (the 记录 AI 问询 5:资料包类型 ai_context、渲染服务与 get_record_context 工具(MCP) #37140 parity harness).
- Container run per AGENTS.md.
Out of scope
- Reads through a parent lookup or deeper than one level; relation traversal in
where(ADR-0160 "Later work"). - Studio controls for the three keys (记录 AI 问询 7:在 Studio 里编辑资料包(ai_context 表单与作者界面) #37143 picks them up when both land; note it there).
Blocked-by: #37140, #37202 (ADR-0160 amendment carrying this decision)
Parent: #36996. Reader: the server lane for service-record-context, with one spec file.
Dedupe: related where orderBy ai_context 0 · ai_context related filter 1 (the epic) · get_record_context related orderBy 1 (the seat post, no card).
Metadata
Metadata
Assignees
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivespm:queueReady for the PM dispatch looppriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Nov 25, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: first touch 2026-11-25T03:35Z
Featureset.pm:blockedadded:Blocked-by: #37140, #37202.ai_contextpack with a related list · read · size M.objectstack-fleet commentedon Nov 25, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Row added 2026-11-25T06:12Z, at repo:objectstack#3's request (mailbox #36743, 7154521857). It is a conformance gap against ADR-0160 as amended by #37196 (merged at 03:47Z). This card builds the related-list read in
get_record_context, so the gap rides here.packages/services/service-record-context/src/record-context-tools.ts:283and:290callrefuseObject(entry.object, false)for a related child that the entry does not serve. The amended ADR says such a child is left out of the answer, and the answer says so. Done when the call returns the root and its served children, names the omitted child in the answer, and pins both an unserved child and a served control. The:296arm, for exposure refusals, stays as the ADR says.Read on
main(the lines are confirmed), not yet measured through the tool.objectstack-fleet commentedon Nov 25, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
2026-11-25T07:06Z Body aligned with the ADR-0160 second amendment (PR #37240, #37202), at seat 3's request (mailbox #36743, 7155462225; L1-w notes):
order(orderByis{ field, order }[];SortNodeSchemarefusesdirection). The example in the quick read is fixed too.getQueryableFields)", in What 3, the Acceptance and the quick read.whereis read as ``.{token}is refused at parse in v1 (What 1 and the Acceptance).The body never had a "stays draft with
pm:awaiting-merge" line, so nothing was dropped.objectstack-fleet commentedon Nov 25, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
2026-11-25T07:08Z Correction to the note above. Item 3 lost its operator to shell expansion. It reads: a bare value in
whereis read as$eq. The card body itself is correct.objectstack-fleet commentedon Nov 25, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Unlocked 2026-11-25T08:38Z. PR #37240 merged and closed #37202, the ADR-0160 second amendment. #37140 was already closed.
pm:blocked→pm:queue. Goes to seat 3 zone ai-A, as a non-cloud row of #36996 (row 11). The body was aligned with the amendment at 07:07Z, and it carries the unserved-related-child row.