Skip to content

37203 跟进:get_record_context 无权的关联子对象改为省略、真实通道交出可查询字段,并补筛选排序的双通道比对 #37361

In progress

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Filing gate: ② follow-up out of #37203 (os-dev report 7177026930), filed by the owning area under the parent, per the maintainer's standing permission for areas to file their own follow-up cards.
Grading: area:ai · Bug (conformance gap against ADR-0160 as amended) · p2 · reach: every get_record_context call through the real MCP doors · evidence: read and measured (implemented and reverted on the #37203 branch).

维护者速读

  • 做什么:外接 AI 读一条记录的资料时,如果某个关联子对象提问人无权看,现在整次调用报错;按已同意的 ADR 应该省略这一段并说明。同时让真实通道把“这个人能按哪些字段查询”的安全答案交给资料服务,筛选条件里有不能查的字段时也是省略,而不是整次报错。
  • 谁受益:用外接 AI 在记录上提问的用户,资料少看一段,不会整次失败。
  • 不做会怎样:带关联列表的资料包,只要有一个子对象或一个筛选字段提问人无权用,整次问答失败。
  • 需要你做的:无。

What

  1. A related child this caller is not served is left out, not refused (triage row 7154563681 on ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #37203, ADR-0160 D3 "Object level" as amended):
    • In executeGetRecordContext (packages/services/service-record-context/src/record-context-tools.ts, step 4a), a child for which servedObjectDefinitionOf answers null for this caller is left out. The answer carries the single not_visible statement. Per D3, the section is not named. The triage row asked for the child to be named, and the ADR wins.
    • Call assertApiExposed first. On the real kernel, a disabled-package child also comes back null from servedObjectDefinitionOf. OBJECT_PACKAGE_DISABLED and API-exposure refusals still refuse, as the ADR says.
    • Flip, in the same PR, the real-kernel parity pin in packages/runtime/src/mcp-record-context-tools-bridge.test.ts, landed by test(runtime): get_record_context answers one caller with the same bytes on the /mcp and stdio doors over a real kernel #37350. The case is titled "[today; ADR-0160 as amended says left out and stated]".
  2. Both real doors supply queryableFieldsOf. packages/runtime/src/domains/mcp.ts#recordContextMembers and packages/mcp/src/stdio-data-bridge.ts#createStdioDataBridge build the RecordContextDoor without it, so the executor uses the fallback that runs when getQueryableFields is absent. ADR-0160 D3 (second amendment) says the fields a caller can query on are the security service's answer for that caller (getQueryableFields), judged before the read. When the fallback admits a field that the security service's answer excludes, plugin-security's assertReadableQueryFields refuses the whole call. Examples are an agent acting for a person, or a computed field reading a hidden one.
  3. Parity pin for where / orderBy / limit. Add one case to the real-kernel harness: a pack whose related entry carries all three answers byte-identically on both doors, including the drop when the caller cannot query a where field.

Acceptance

  • An unserved related child gives the root plus the served children, with one not_visible statement. The child is named nowhere. Pinned on both doors, with a served control.
  • A disabled-package child still refuses with OBJECT_PACKAGE_DISABLED.
  • On both doors, a where field that getQueryableFields excludes for this caller drops the section with the statement and never refuses. Pinned with a field that the fallback would admit.
  • The where/orderBy/limit parity case is green on both doors.
  • Clause-②: no. This is a behaviour fix under existing ADR text.

Notes

  • Surface: packages/services/service-record-context/**, packages/runtime/src/domains/mcp.ts plus the real-kernel harness, and packages/mcp/src/stdio-data-bridge.ts plus its test. Holding 37178 跟进:资料包目录被截断时,没列出的章节也要能读到 #37233 (service-record-context) until this lands is not required: the two cards touch different functions. Overlap is checked at dispatch.
  • Also noted, not part of this card: the doc line of RecordContextNoteKind (packages/spec/src/ai/record-context-tools.zod.ts) says related_truncated means a cut "at the row cap". It now also fires at limit.

Parent: #36996
Dedupe (objectstack, is:issue): queryableFieldsOf 1 (#37203, the source) · "left out" related child record context 0 new (#37175 and #37202 are the siblings; the triage row sits on #37203, which ships without it).

Activity

  1. added
    priority:p2
    pm:queue
    area:ai
    on Nov 25, 2026
  2. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Scope added from the PR #37354 contract review (record 7177225249, seat L1 7177237404). These three ride this card:

    • N1. RecordContextNoteKind doc line (packages/spec/src/ai/record-context-tools.zod.ts) says related_truncated is a cut "at the row cap". After ai_context: related lists filter, order and limit (where / orderBy / limit) with the render-service reader #37203 it also fires at an entry's limit. Correct the prose.
    • N2. A door whose own page cap is below limit + 1 cuts the list without the executor detecting it, so the cut is not stated. This was already true for the row cap. Either the door reports its cap, or the executor asks for at most the door's cap and states the cut. Pin it.
    • N5. An orderBy on a registry-injected field (for example created_at) is untested. Pin that the own-field check and the door both accept it, or refuse it loudly at parse.

    Acceptance adds: one test per item, on the service, and on both doors where the door is involved.

  3. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    First touch, 2026-11-25T23:33Z.

  4. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: lands in area:ai · Bug · priority:p2 · pm:queue · size M; rationale: a conformance gap against ADR-0160 as amended. Every get_record_context call through the real MCP doors fails whole when one related child or filter field is not served, instead of leaving that part out.

    Audit record in the shape the claim check reads, which restates the first touch of 2026-11-25T23:41Z. That touch used another opening. Route: a #36996 follow-up → repo:objectstack#5.

  5. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim: PM loop round 4 · area ai-36996 (topic #36996 non-cloud rows; the maintainer, verbatim, 2026-11-25T12:57Z project thread: 「开一个 36996 专题,接手剩余任务」) · 2026-11-26T01:22Z
    Session: session_01Utp6CbeF2saT6wUBV4E9uc
    Account: os-bill
    Area: ai-36996
    Branch: claude/issue-37361-left-out-queryable-doors
    Worktree: objectstack-issue-37361
    Domain: domain:server
    Seat: repo:objectstack#5
    File surface: packages/services/service-record-context/src/record-context-tools.ts, door.ts (also the amendment-4 docblock sentence carried from #37175), sentences.ts if a note changes, its __tests__/**; packages/runtime/src/domains/mcp.ts and packages/runtime/src/mcp-record-context-tools-bridge.test.ts; packages/mcp/src/stdio-data-bridge.ts and its tests; the RecordContextNoteKind doc line in packages/spec/src/ai/record-context-tools.zod.ts (prose only, N1); root .changeset/. Stop on breach and report.
    Container & model: M, mode:subagent, model: default — dispatch-gates --tier: "no path-derived mandate", effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: packages/services/service-record-context (executeGetRecordContext 4a) and both MCP doors in objectstack produce the over-refusal | no platform path covers it | every get_record_context caller through the real doors, today
    Thread-read: 7178928225
    Premise: holds — on origin/main 9ffe37153: PR #37354 merged; the runtime parity pin titled "[today; ADR-0160 as amended says left out and stated]" is on main (PR #37350)
    Serial constraints cleared: PR #37354 merged. Sibling #37364 (this area, in flight) owns the new verify-citations.ts, the spec citation files and the body-outline.ts move; it only reads fake-door.ts. #37233 (same package) is held until both land.
    Pre-claim deps: none
    Prior rulings read: ADR-0160 D3 "Object level" (amended) and its second amendment; triage row 7154563681; seat review 7179109796 (N1, N2, N5 assigned here)

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 26, 2026
  7. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
    os-dev-report

    {
     "issue": 37361,
     "status": "done",
     "branch": "claude/issue-37361-left-out-queryable-doors",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/37412",
     "head": "a50181d4e",
     "session": "session_01Utp6CbeF2saT6wUBV4E9uc",
     "premise_still_valid": true,
     "summary": "What 1: executeGetRecordContext step 4a now judges a related child by read guard, then API exposure, then the served definition; a child this caller is not served is left out with the one not_visible note, named nowhere, and never read again (its published definition included). API-exposure and disabled-package refusals still refuse whole with PERMISSION_DENIED; a throwing served-definition read refuses unnamed. What 2: both doors (runtime recordContextMembers, mcp createStdioDataBridge) supply queryableFieldsOf from the security service's getQueryableFields for the caller each already resolves (A1 holds, no new dependency). N2 (smaller design: the door reports its cap, the executor asks for at most it): new optional door member pageCap(); executor cuts at min(limit or row cap, pageCap-1) and states it; both doors report min(OS_DATA_MAX_PAGE_SIZE, OS_DATA_QUERY_ROW_BUDGET). N1 doc line corrected; N5 pinned (executor own-field check and both doors accept orderBy created_at); door.ts query docblock carries the amendment-4 sentence (#37175). Premise partly holds: with plugin-security the fallback and getQueryableFields agree except masked fields, where the fallback over-dropped (now fixed); the 'fallback admits, service excludes' direction is pinned by narrowing the real service's answer with a spy.",
     "tests": "At head a50181d4e, whole suites under the verify lock: service-record-context exit 0, 2/2 files, 106/106; mcp exit 0, 85/85 files, 1515/1515; runtime (--project local) exit 0, 649/649 files, 12040 passed 25 skipped; spec exit 0, 896/896 files, 28442 passed 1 todo. typecheck exit 0 on all four. spec build + check:generated: all 14 artifacts up to date. Ablations (committed first, scripts/ablation-replace.mjs, dist preflight where the subject resolves through dist, restored to HEAD blob, git status clean): A left-out->refusal: service 3 red, runtime 1 red; E no exposure gate: runtime red on API-exposure and disabled-package children (A2 measured: disabled child reaches servedObjectDefinitionOf null), service 6 red; B /mcp door without queryableFieldsOf: 4 red; C stdio door without it (mcp rebuilt): 2 red; D executor ignores pageCap: service N2 red, runtime page-cap red with /mcp answering MAX_RECORDS_EXCEEDED (first D attempt did not build and ran nothing; redone).",
     "gates": "Local: dispatch-gates --commands (tree objectstack-ai/objectstack at a50181d4e) derived 93; all run with exit captured before any pipe; --ran: 93 derived, 91 run green, 2 NOT MEASURED (check-plugin-teardown-shape --self-test exit 3: pinned fixture commit outside shallow checkout; check:dual-build-cjs-loads exit 3: needs every package's dist), 0 unrun. overlap-check before each push: VERDICT clean. PR check-runs on a50181d4e, all complete: 57 success, 11 skipped, 1 failure. Required: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards), Build Core success, Governed Surface Queue Guard success, Type Check UI success, Test UI success (16/16), Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success (shards skipped on PR), Lint UI skipped. Failure: 'PR-body guards' check:closing-target-claim: Fixes #37175 but #37175's governing Claim names claude/issue-37175-record-context-http-rig (log saved and grepped). Seat remedy: post a Claim on #37175 naming this branch, or change the body to Part of #37175.",
     "line_budget": "8 files, +483/-44 (527 changed lines, under 3000); no skills/ files",
     "files_changed": [
      ".changeset/37361-record-context-left-out-queryable-doors.md",
      "packages/mcp/src/stdio-data-bridge.ts",
      "packages/runtime/src/domains/mcp.ts",
      "packages/runtime/src/mcp-record-context-tools-bridge.test.ts",
      "packages/services/service-record-context/src/__tests__/record-context-tools.test.ts",
      "packages/services/service-record-context/src/door.ts",
      "packages/services/service-record-context/src/record-context-tools.ts",
      "packages/spec/src/ai/record-context-tools.zod.ts"
     ],
     "acceptance": {
      "unserved child left out, root + served children, one not_visible, named nowhere, both doors, served control": "pass (runtime harness flipped case + service case)",
      "disabled-package child still refuses": "pass (PERMISSION_DENIED unnamed, the one object-level code per ADR-0160 point 12; existing pin kept; card's 'with OBJECT_PACKAGE_DISABLED' read as naming the case)",
      "where field excluded by getQueryableFields drops section, never refuses, both doors, field the fallback admits": "pass (spy narrows the real service's answer by one served, readable, unmasked field; plugin-security offers no such field natively)",
      "where/orderBy/limit parity on both doors": "pass",
      "N1 doc line": "pass",
      "N2 door cap below limit+1 stated, service and both doors": "pass",
      "N5 orderBy created_at accepted by own-field check and both doors": "pass for the executor's own-field check and both doors; the authoring lint (packages/lint validateAiContext, outside the file surface) warns falsely, reported below",
      "amendment-4 docblock sentence": "pass"
     },
     "readings": "A1 holds (both doors reach getQueryableFields with the caller they resolve, no new dependency). A2 holds (ablation E: disabled-package child answers left out when exposure is skipped, so it reaches servedObjectDefinitionOf as null; exposure-first keeps the refusal). Pre-fix N2 on the real kernel was a whole-call MAX_RECORDS_EXCEEDED on /mcp and a full read on stdio, not a silent cut.",
     "deviations": "Did not merge origin/main before opening the PR (AGENTS multi-agent section 10): 7 incoming commits touch none of the changed files (spec and metadata elsewhere, ui, .claude); overlap-check clean; CI ran on the merge ref and is green on required contexts. PR body written once at pr_create and not patched (os-dev.md over the dispatch's patch permission). Dispatch's 'Fixes #37175' reds check:closing-target-claim because #37175 is claimed by another branch; not changed by the dev. Harness-written Co-Authored-By trailer not used; commits carry the model-free pair.",
     "dogfood_battery": "n/a, no ! in the PR title and no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "3 so far: git push (not REST); relay pr_create (POST /repos/objectstack-ai/objectstack/pulls + POST /issues/37412/assignees, run 45743529452); relay comment os-dev-report on #37361 via post-stamped",
     "open_questions": [
      {
       "question": "PR #37412 carries Fixes #37175 as dispatched, but #37175's governing Claim names claude/issue-37175-record-context-http-rig, so the PR-body guard is red. Which way?",
       "options": [
        "A: the seat posts a Claim on #37175 naming claude/issue-37361-left-out-queryable-doors and re-runs the job",
        "B: the seat edits the body to Part of #37175 and closes #37175 separately once this lands"
       ],
       "recommendation": "A if #37175's other branch is dead (the dispatch says #37175 closes when this lands); else B"
      }
     ],
     "security_findings": "none",
     "out_of_scope_findings": [
      "class: a (misleading author-facing text) · reach: named producer: AUTHORING_RULES row validateAiContext (packages/lint/src/authoring-rules.ts), run by os validate and the save door · evidence: validateAiContext on a pack with related orderBy created_at (an object that does not declare it) returns ai-context-field-unknown 'the list is left out of every answer', while the executor and both MCP doors read the list ordered by created_at (runtime harness case on this PR) · dedupe words: ai-context-field-unknown created_at, validateAiContext registry-injected field, orderBy injected column lint",
      "carrier: none · noted, not filed: RecordContextRelatedListSchema rows/truncated .describe() still say 'row cap' (needs schema regeneration, outside N1's prose-only line)",
      "carrier: none · noted, not filed: the stdio door's engine reads plan no OS_DATA_MAX_PAGE_SIZE window, unlike the data door; measured only for get_record_context, which this PR aligns"
     ]
    }
  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

    Claim amendment · 2026-11-26T03:25Z · claim 7179712908 · answers seat 5's REWORK on PR #37412 (L2 record 7181694279).

    • Clause-②, corrected: Clause-②: yes (widening). N2's optional pageCap() member widens the exported RecordContextDoor; precedent mcp: query_records and get_record say which fields field-level security withheld, so an answer says "not visible to you", not "blank" #35137. Bump stays patch. Metadata-protocol: none stands.
    • File surface, added: the .describe() texts of RecordContextRelatedListSchema rows and truncated in packages/spec/src/ai/record-context-tools.zod.ts (N3, "row cap" → also limit / door page cap) and the generated artifacts they move (regenerated by check:generated --fix, not hand-edited).
    • Scope of the rework: S1 (declare the widening in body and changeset), S2 (real-kernel pin on both doors: a masked field whose rule is not lifted for the caller drops the section), S3 (door.ts cites ADR-0160 D3 or card comment 7151678330 item 4, not a non-existent "amendment 4"); N3 and N4 (one recordContextPageCap) ride.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aipm:dispatchedpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions