Repository navigation
Description
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
Filing gate: ③ maintainer-ruled. Split of placeholder #37144 per ruling 7177410380 (the maintainer, decision card, 2026-11-25T23:18Z: Q1 A · Q2 A · Q3 A; analysis 7177223845).
Grading: area:ai · Feature · p2 (topic child; blocks 10b and cloud 10c) · reach: n/a (new capability) · evidence: read (split analysis on main a182fbe).
维护者速读
- 做什么:在 spec 里定义"引用"的形状(哪条记录、哪个资料包、正文哪一节、原文摘句),同时交付核对器:以提问人的权限重读这条记录,确认摘句确实逐字出现在资料里。
- 谁受益:所有展示 AI 引用的界面(控制台、cloud 应用内问答),它们只显示核对通过的引用。
- 不做会怎样:AI 给出的引用无法核对,可能引用不存在的原文。
- 需要你做的:无(三条裁决已定)。
What
packages/spec/src/ai/record-citation.zod.ts(new):RecordCitationSchema, strict:object,id,context?(the pack face, spelt asget_record_context's inputcontexttakes it; ruling Q2),anchor?(min 1),quote(min 1).RecordCitationsSchema: an array with a cap.RECORD_CITATIONS_PART_TYPE = 'data-record-citations': the answer member is a UI-message data part (precedentBUILD_PROGRESS_FRAME_TYPE). Export fromai/index.ts.
packages/spec/src/ai/record-body-anchor.ts(new): moveheadingsOf/slugOfhere unchanged frombody-outline.ts, so the server and the console derive one anchor.body-outline.tsre-imports them;body-outline.test.tspasses untouched.packages/services/service-record-context/src/verify-citations.ts(new):verifyRecordCitations(citations, door).- One
executeGetRecordContextper distinct(object, id, context, anchor), as the door's caller (ruling Q1: the platform verifies as the asking user). object/idare the pack's root record (ruling Q3). Verified ⇔quoteis a substring of a data-member string of that answer: a field or related-list cellvalue/display, orbody.text. Notes, framing and labels never count. Whitespace runs collapse. Anhtml/richtextbody is also matched tag-stripped.- A citation without
contexton an object with several packs is not verified (the tool's refusal stands); with one pack it verifies. - Any refusal ⇒ not verified. The function returns the verified subset and never throws per citation.
- One
- Export from
src/index.ts. Tests in__tests__/verify-citations.test.ts, reusingfake-door.ts.
Acceptance
- The spec schema refuses an unknown key, an empty
quoteandnull, and admitscontext. - The verifier:
- verifies a quote in a section by its anchor, and refuses a stale anchor;
- verifies a quote found in a related-list cell, cited on the root record (Q3);
- refuses a quote that appears only in a note;
- refuses a quote from a field the caller has withheld or hidden;
- for a body that came back as an outline, refuses a quote cited without an anchor;
- refuses a citation without
contexton an object with two packs, and verifies it on an object with one (Q2).
- A caller with no read access gets "not verified", and nothing that reveals existence.
Metadata-protocol: added(new exported schema →authorable-surface/ai.jsonrows; ADR-0160 expectsadded) with itsSkills-docs:line.Clause-②: yes.
Out of scope: an MCP verify tool; rendering (10b); producing and persisting citations (cloud 10c).
Governing text: ADR-0160 D9 as amended by #37363, D3, D4; ADR-0049 (the schema lands with its first reader); ruling 7177410380.
Blocked-by: #37363
Parent: #36996 (row 10a; replaces placeholder #37144)
Size: M
Dedupe (objectstack, is:issue): citation in:title → #37144 (this placeholder, closed in favour of these cards); no other citation-shape card.
Activity
objectstack-fleet commentedon Nov 25, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
First touch, 2026-11-25T23:34Z.
priority:p2(a topic child of 专题:记录范围 AI 问询(在一条记录上问 AI:对话钉在这条记录上、平台按配置交给模型这条记录的资料、外部 AI 经 MCP 拿到同一份) #36996 that blocks 记录 AI 问询 10b:控制台显示核对过的引用,点开记录并定位到被引章节 #37365 and cloud 10c).pm:blocked.Blocked-by: #37363is open. When 记录 AI 问询 10 前置:ADR-0160 D9 引用格式加可选 context,并写入引用核对的三条裁决 #37363 closes, triage unlocks this card topm:queuefor repo:objectstack#5.objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
Unblocked:
Blocked-by: #37363is closed. PR #37370 merged as db77cc4, so ADR-0160's third amendment (D9context, when a citation is verified, root record for quotes from related rows) is in force.pm:blocked→pm:queue. Dispatch waits on PR #37354, which is in the merge queue and touches the sameservice-record-contextand specai.jsonbaselines. Also:pm:dispatchedremoved from closed #37363.objectstack-fleet commentedon Nov 26, 2026
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:21Z
Session:
session_01Utp6CbeF2saT6wUBV4E9ucAccount:
os-billArea: ai-36996
Branch:
claude/issue-37364-record-citation-verifierWorktree:
objectstack-issue-37364Domain:
domain:specSeat:
repo:objectstack#5File surface:
packages/spec/src/ai/record-citation.zod.ts(new) andrecord-body-anchor.ts(new),packages/spec/src/ai/index.ts, theheadingsOf/slugOfmove out ofpackages/services/service-record-context/src/body-outline.ts(re-import only),packages/services/service-record-context/src/verify-citations.ts(new),src/index.ts, tests, liveness rows, generated spec baselines, root.changeset/. Stop on breach and report.Container & model:
M,mode:subagent,model: default — dispatch-gates --tier: "no path-derived mandate",effort: highClause-②: yes
Metadata-protocol: added
Responsibility: n/a — not a defect card
Thread-read: 7179552779
Premise: holds — on
origin/main9ffe37153: #37363 closed (PR #37370 merged, ADR-0160 third amendment in force); PR #37354 mergedSerial constraints cleared: PR #37354 merged (service-record-context, spec ai baselines). #37233 also touches
body-outline.tsand is held until this lands. Sibling #37361 (this area, in flight) ownsrecord-context-tools.ts, the doors and the runtime harness; this card only readsfake-door.ts.Pre-claim deps: #37363 closed
Prior rulings read: ruling 7177410380 (Q1 A · Q2 A · Q3 A) on #37144; ADR-0160 D9 as amended by PR #37370
objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
os-dev-report
{ "issue": 37364, "status": "done", "branch": "claude/issue-37364-record-citation-verifier", "pr": "https://github.com/objectstack-ai/objectstack/pull/37396", "head": "8471b77d7", "session": "session_01Utp6CbeF2saT6wUBV4E9uc", "premise_still_valid": true, "summary": "Spec gains RecordCitationSchema {object,id,context?,anchor?,quote} (strictObject, all strings min 1), RecordCitationsSchema (max RECORD_CITATIONS_MAX = 20), RECORD_CITATIONS_PART_TYPE = 'data-record-citations', and record-body-anchor.ts, where headingsOf and its private readers (slugOf included, still private) moved unchanged out of service-record-context body-outline.ts; the tag reader is exported as stripBodyTags. service-record-context gains verifyRecordCitations(citations, door): one executeGetRecordContext per distinct (object,id,context,anchor) through the caller's door; any refusal drops the citation; a quote survives only as a whitespace-collapsed, trimmed, case-sensitive substring of a field/cell value (strings only) or display, or body.text (html/richtext also tag-stripped). Notes, framing, labels, pack/record header and outline headings are never matched. It reads at most 20 entries, drops unparsable ones and never throws. body-outline.ts re-imports and re-exports headingsOf and BodyHeading; body-outline.test.ts is untouched and green. A1 measured: spec's package.json has no workspace dependency (pg-connection-string and zod only), so moving headingsOf creates no cycle. A2 holds: the verifier is the schema's only reader.", "per_acceptance_bullet": { "schema refuses unknown key / empty quote / null, admits context": "record-citation.test.ts: unrecognized_keys keys [field]; too_small path [quote]; invalid_type path []; context+anchor parse equal", "verifies quote by anchor, refuses stale anchor": "verify-citations.test.ts 'verifies a quote in a section by its anchor...' (also: anchor scopes the match)", "related-list cell on root (Q3)": "'verifies a quote found in a related-list cell...' (control: other policy's row dropped)", "refuses note-only quote": "'refuses a quote that appears only in a note, the framing, or a label' (control: the answer carries each string); this test is the ablation target", "refuses withheld or hidden field": "'refuses a quote from a field the caller has withheld or hidden' (control: same quote verified unhidden)", "outline body without anchor refused": "'for a body that came back as an outline...' (control: same quote with anchor verified; outline anchors [scope, claims])", "two packs without context refused, one pack verified (Q2)": "'refuses a citation without context on an object with two packs...' plus named-pack verified, unknown-pack refused", "no read access: not verified, nothing reveals existence": "unreadable row / missing id / unserved / guarded / unexposed object all resolve to []", "Metadata-protocol added + Skills-docs, Clause-2 yes": "PR body and changeset carry Clause-②: yes, Metadata-protocol: added, Skills-docs: follow-up #37177; authorable-surface/ai.json gains 5 ai/RecordCitation rows; Check Changeset success" }, "matching_rule_stated_in_pr": "Yes, in PR What changes: value (string only) or display of root fields and related cells, plus body.text (html/richtext also tag-stripped); whitespace runs collapse; never notes, framing, labels, header, outline headings or non-string values.", "tests": "Final head 8471b77d7: pnpm --filter @objectstack/spec test, SPEC_EXIT=0, Test Files 897 passed (897), Tests 28448 passed, 1 todo. pnpm --filter @objectstack/service-record-context test, SVC_EXIT=0, Test Files 3 passed (3), Tests 115 passed (115). service-record-context typecheck SVCTC_EXIT=0. spec typecheck exit 0 (36ec0cf68; the later commit touched only llms.txt). The first spec run on c46e26d72 had 1 failure: alias-integrity, recordId and record_id collapse onto probe recordid. Fixed in 36ec0cf68 by dropping record_id. Ablation (one behaviour, the data-member restriction) via scripts/ablation-replace.mjs: haystackOf also collected answer.framing, note texts and pack.label. Anchor 1 to 0, blob c35fc729 to dcec1804; 'refuses a quote that appears only in a note, the framing, or a label' went RED (1 failed / 15 passed). Restored: blob == HEAD, git diff HEAD empty. A first attempt was a no-op the tool refused before running (its replacement contained the anchor). The verifier test imports src directly (no dist hop for the mutated file), so no rebuild leg was needed.", "gates": "Local: dispatch-gates --commands derived 111 families; --ran with exit codes reconciled 111 derived, 106 run, 5 NOT-MEASURED, 0 UNRUN. All 106 run families exit 0 (the 11 that first exited 3 on a stale spec dist or an unbuilt lint closure were re-run after building @objectstack/lint... and all exited 0, check:generated, check:api-surface and check:llms-txt included). NOT MEASURED locally, prerequisite exit 3: check-plugin-teardown-shape --self-test (shallow clone; fixture needs an unshallowed main), spec check:skill-examples (client-react dist absent), check:dual-build-cjs-loads, check:lean-entry-closure, check:type-check-debt (whole-workspace dist absent). This is a declared narrowing; CI runs them. Local-only families: check:skill-frame-freshness exit 0; check:dev-prereqs exit 1, workspace not fully built (103/110 packages without dist), a prerequisite not about this diff, NOT MEASURED. Generated by check:generated --fix: api-surface, export-origins, declaration-map, content/docs/references, strictness-ledger counts; authorable-surface and json-schema.manifest written by the spec build. CI on final head 8471b77d7, 70 check-runs, 60 success, 10 skipped, 0 failure: Lint & Repo Gates=success; TypeScript Type Check=success; Type Check · source gates=success; Test Core=success; Build Core=success; Governed Surface Queue Guard=success; Type Check UI=success; Test UI=success; Build & E2E UI=success; Live E2E UI=success; Dogfood Regression Gate=success; Lint UI=skipped; Check Changeset=success; Spec property liveness=success. The previous head 36ec0cf68 was red only on Type Check · source gates, check:llms-txt (ai count 16 vs 17); CI log saved to scratch and grepped; fixed in 8471b77d7.", "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm", "line_budget": "1030 changed lines (+853 / -177) over 20 files, under the 3000 human-merge threshold; skills/** untouched", "files_changed": [ ".changeset/37364-record-citation-verifier.md", "content/docs/references/ai/index.mdx", "content/docs/references/ai/meta.json", "content/docs/references/ai/record-citation.mdx", "content/docs/references/index.mdx", "docs/audits/2026-07-unknown-key-strictness-ledger.counts/ai.md", "packages/spec/api-surface/ai.json", "packages/spec/authorable-surface/ai.json", "packages/spec/declaration-map/ai.json", "packages/spec/export-origins/ai.json", "packages/spec/json-schema.manifest/ai.json", "packages/spec/llms.txt", "packages/spec/src/ai/index.ts", "packages/spec/src/ai/record-body-anchor.ts", "packages/spec/src/ai/record-citation.zod.ts", "packages/spec/src/ai/record-citation.test.ts", "packages/services/service-record-context/src/body-outline.ts", "packages/services/service-record-context/src/index.ts", "packages/services/service-record-context/src/verify-citations.ts", "packages/services/service-record-context/src/__tests__/verify-citations.test.ts" ], "readings": "Tree objectstack-ai/objectstack. Base 9ffe37153, head 8471b77d7. Shallow clone (is-shallow true); no ancestry verdict depended on it. overlap-check before each push: the first push was clean; the later pushes reported VERDICT overlap exit 1, a conflict with #37366 only in the generated packages/spec/export-origins/ai.json, which whichever PR lands second regenerates (stated in the PR body); origin/main merged cleanly each time.", "deviations": [ "File surface: packages/spec/llms.txt (hand-kept inventory, ai count 16 to 17 and total 230 to 231, Record Citation added to the ai row) and docs/audits/2026-07-unknown-key-strictness-ledger.counts/ai.md (generated count) are not named in the claim. Both were forced by the new spec module: check:llms-txt and check:strictness-ledger red without them.", "Exported stripBodyTags from spec (the old private stripTags, renamed), beyond the card's headingsOf/slugOf move, so that the verifier and the anchor derivation share one tag reader. slugOf stays module-private as before.", "The PR body's Readings block was written at head 36ec0cf68. Final-head readings (full spec suite 897/897, CI all green on 8471b77d7) are only in this report: os-dev.md forbids a dev PATCH of the PR body, while the dispatch allows issue_patch; I followed os-dev.md (standard text wins). The seat may patch the readings in.", "Pushed after overlap-check exit 1 twice. Both times the only conflict was the generated export-origins/ai.json with #37366: the generated-file rule, regenerated by the second lander.", "Wrote a scratch file at /home/user/pr-body-37364.md by mistake (outside any repo) and deleted it at once." ], "mcp_calls": "0", "api_writes": "4 REST writes via the fleet-write relay, as objectstack-fleet[bot]: pr_create stroke = POST /repos/objectstack-ai/objectstack/pulls (draft #37396) + POST /repos/objectstack-ai/objectstack/issues/37396/assignees (os-bill); post-stamped comment = POST /repos/objectstack-ai/objectstack/issues/37364/comments (this os-dev-report); plus the repository_dispatch POST that carries each relay stroke. git push is not counted.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted, not filed: tag-stripping removes a tag with nothing in its place (as headingsOf does), so a quote spanning two html block elements does not verify, and html entities in the body are not decoded. This follows the card's rule as written and is stricter only; noted in the PR's Acceptance notes." ] }objectstack-fleet commentedon Nov 26, 2026
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc
ACCEPT → PR #37396 comment 7181455245