Skip to content

feat(service-record-context): get_record_context lists a long body's outline in pages (outlineFrom / outlineNext) - #37484

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-37233-outline-continuation
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-37233-outline-continuation

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #37233

Clause-②: yes (widening)
Metadata-protocol: added

维护者速读

  • 用户能看到什么变化:外接 AI 读一条正文很长的记录时,目录超过一页上限的部分可以分页继续列出,每个章节都能读到;此前如果几百个标题都在同一层,第 80 个之后的章节 AI 根本读不到。
  • 为什么做:记录级 AI 问答专题(资料包读取工具)的后续收尾,补上目录截断后剩余章节无法到达的缺口,并改正一句会误导 AI 的截断提示。
  • 出错会怎样:最坏是 AI 读长文时多翻一页或少列几个标题,读到的内容仍受原有长度上限和权限约束;可以直接撤回本次改动。
  • 要你做的:无。

What changes

ADR-0160 D3 "The body"; L1 ACCEPT 7153812992 on PR #37222, nit N2 (this card), N3, N4.

  • The outline comes in pages (boundedOutline(headings, from), body-outline.ts). The pages run through every heading in ONE order — shallowest level first, body order within a level — and a page takes that order from from until the next heading would pass either existing bound (80 entries, 8,000 serialized characters); each page lists its headings in body order. Page 1 is today's outline, bar the N3 case below. Every heading is on exactly one page, so following the continuation from page 1 lists every heading with the anchor headingsOf gives it. One mechanism serves both cuts: a flat body's pages are runs of it in body order; a nested body's first page is its top levels and later pages carry the deeper headings (which matters too: a top section past the body bound is itself cut, so its sub-headings past the cut were unreachable before as well).
  • Input outlineFrom, output body.outlineNext (record-context-tools.zod.ts). outlineNext is present only when a heading remains that a later page lists; pass it as outlineFrom. outlineFrom 0 is page 1. An outlineFrom past the last page, or on a body that is no outline (carried whole, absent from the pack, withheld from the caller), is ONE answer, RESOURCE_NOT_FOUND 404, as an unresolved anchor is. anchor with outlineFrom is refused VALIDATION_ERROR 400 at step 1, before any read.
  • The outline_truncated sentence, en and zh-Hans (sentences.ts), now says how many headings this page lists, how many it does not, that pages run shallowest levels first then body order, and the outlineFrom that lists the next page (or that no later page lists more). The clause "A listed section's text includes the headings under it" is gone: in a flat cut nothing left out sits under a listed section. The sentence carries numbers only, never an anchor (an anchor is record text, and a note never carries record text) — which is why the cursor is a position and not an anchor.
  • N3, revisited because the paging made it cheap. A heading whose entry alone passes the character bound fits no page. Without a change it would end the pages (the page that must start with it lists nothing), so the pages now pass over it and the note counts it ("1 heading is too long for any page to list, so its anchor is not given" / "K headings are too long ..."). As a side effect one such heading no longer empties page 1. A body whose ONLY headings are such headings is still carried to the bound and marked truncated, as before. Trade-off stated: such a heading (about 3,950 characters or more of heading text) gets no anchor; in a nested body its text is still inside its parent's section.
  • N4: no change needed (the changeset it named has merged).
  • Tool description: names outlineNext / outlineFrom beside anchor.
  • The body_outline note, en and zh-Hans, on every page now says to read a section with the same objectName, recordId and context, plus the anchor and no outlineFrom. Before, it said "the same arguments", and on a page reached through outlineFrom those arguments plus an anchor are the pair this PR refuses (review S1).
  • The MCP doors needed no code: both pass the input through whole, and the /mcp door's registration validates against the spec's GetRecordContextInputSchema, so the key is admitted there by the spec change alone. The real-kernel parity cases below prove both doors carry it.

Design, and the alternative weighed

Continuation (chosen) vs listing every omitted heading's anchor compactly: a compact list is still O(headings) in one answer, so for a large enough body it passes the same bound and needs a cut of its own; the continuation keeps every answer within the existing bounds however big the body, with one mechanism for flat and nested cuts. Cursor: a position in the page order, not an anchor, because the note that tells the model where to continue may not carry record text, and an anchor is derived from heading text.

Declaration

Metadata-protocol: added, @objectstack/spec graded minor (PM ruling, option A, on this PR's open question): the spec's authorable-surface ledger records GetRecordContextInput:outlineFrom and RecordContextBody:outlineNext as entered keys, and Check Changeset reads that shard as a metadata-protocol addition (precedent: #37140, #37354). @objectstack/service-record-context stays patch.

ADR text this will need (governed, not edited here)

  • D4 "Definition", the input line { objectName: string, recordId: string, context?: string, anchor?: string } gains outlineFrom?: integer (the output's body gains outlineNext).
  • D3 "The body", the sentence "A longer body is carried as an outline: its headings in order, each with an anchor." needs: an outline past its bounds comes in pages, continued by outlineFrom, every heading listed on one page (bar a heading too long to list by itself, stated). Carried by 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490, which should also say that the cursor is a position in the current body, so "exactly one page" holds for one state of the body.

Tests

See Verification for the commands and readings.

  • body-outline.test.ts: a flat body of 300 headings pages as 80/80/80/60 and the pages together are exactly the body's headings in order; a nested body's page 1 holds every top heading and later pages only deeper ones, each page in body order, union = all headings, no duplicates; the character bound before the entry cap; an over-long shallowest heading is on no page, counted, and does not empty page 1.
  • record-context-tools.test.ts (executor): the acceptance pin — a body of 300 headings at one level, every page walked by the outlineNext the tool gave, all 300 anchors issued once, every section read by its issued anchor and equal to its text, every answer parsing against GetRecordContextOutputSchema and within the bounds; the nested cut whose top section is itself cut; the outline_truncated sentence for a flat cut AND a nested cut in en AND zh-Hans (counts, outlineFrom N, no record text, the old clause absent); the last page; outlineFrom: 0; the one 404 answer (past the end / body whole / no body / withheld body); anchor + outlineFrom refused before any read; negative / fractional / string refused at parse.
  • record-context-tools.zod.test.ts (spec, new): admits and refuses outlineFrom and outlineNext, asserting zod's issue code and path; the JSON Schema projection carries outlineFrom as an integer of at least 0.
  • mcp-record-context-tools-bridge.test.ts (runtime, real kernel): page 2 over both doors, byte-equal, starts at clause-(N+1) (a door that dropped the key would answer page 1), and its anchor reads its section; outlineFrom on a body carried whole is the same coded 404 on both doors.
  • mcp-record-context-tools.test.ts: the registration's input property list gains outlineFrom.

Acceptance notes

  • Acceptance bullet 1 (300 same-level headings, every section reached by issued anchors, each answer bounded): pinned in record-context-tools.test.ts, "a body of 300 headings at one level".
  • Acceptance bullet 2 (the note sentence true for nested and flat cuts, both pinned): "the cut note is true for a flat cut and for a nested cut, in en and zh-Hans".
  • Re-reading outlineFrom against a body edited between calls simply answers the page at that position of the current body; anchors on it are the current body's, so nothing stale is served.

Verification

Read first (by risk): packages/services/service-record-context/src/body-outline.ts (boundedOutline: the skip of an unlistable heading and where next is set), src/record-context-tools.ts (the body block: the one 404 for an outline page that does not start where asked), src/sentences.ts (outlineTruncated).

Two-minute check: pnpm --filter @objectstack/service-record-context exec vitest run --maxWorkers=2 src/__tests__/record-context-tools.test.ts -t "300 headings" — one test passes; it walks four pages and reads 300 sections.

All readings at head 5f6f72fd82540c66a716be2a3a874bbd89e58bbd.

Suites of every touched package (under the verify lock: VERDICT command-exit 0)
  • Build of the three closures exit 0; pnpm --filter @objectstack/spec check:generated: all 14 generated artifacts up to date.
  • @objectstack/service-record-context test: Test Files 4 passed (4), Tests 139 passed (139); typecheck exit 0.
  • @objectstack/mcp test: Test Files 85 passed (85), Tests 1521 passed (1521); typecheck exit 0.
  • @objectstack/runtime test (--project local): Test Files 649 passed (649), Tests 12061 passed, 25 skipped (12086); typecheck exit 0.
  • @objectstack/spec test: Test Files 899 passed (899), Tests 28494 passed, 1 todo (28495); typecheck exit 0.
Derived gate families (dispatch-gates --commands, 111)
  • 109 exit 0 (11 of them re-run after the build, having first refused with no built output to read).
  • NOT MEASURED, check:skill-examples and check:dual-build-cjs-loads: PREREQUISITE NOT MET, they read built output of packages this diff does not touch. CI's Lint and Repo Gates measures both.
Review S1 pin, and the ablation of the first round
  • S1: "a section listed on page 2 is read exactly as that page's body_outline note says" reads page 2's first anchor with the record's arguments, the anchor and no outlineFrom (en and zh-Hans), and gets the section. The control, page 2's arguments plus the anchor, is refused VALIDATION_ERROR 400.
  • Ablation (first round, unchanged code path): for (let at = from; ... replaced by for (let at = 0; ... in boundedOutline turned the 300-heading acceptance pin red (24080 anchors issued, not 300), along with three other executor pins; restored blob equals HEAD.

Generated by Claude Code

…ne (outlineFrom / outlineNext)

WIP: tests follow.

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
… outlineFrom on both doors

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
…r advances fails

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
… outlineFrom / outlineNext

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

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/service-record-context, @objectstack/spec, touching 13 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/spec/authorable-surface/ai.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/api/data-api.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/api/error-catalog.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/api/error-handling-client.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/automation/webhooks.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/kernel/contracts/metadata-service.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/permissions/authentication.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/permissions/sso.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/protocol/kernel/error-handling.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/ui/actions.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/ui/print-pages.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/releases/v17/17-5.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/releases/v18/18-2.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))
  • content/docs/releases/v18/18-3.mdx (via RESOURCE_NOT_FOUND (literal, a string literal in executeGetRecordContext))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/spec/authorable-surface/ai.json) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_ERROR (literal, 39 pages)
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json b7bddeb91029a324cfe89c666fb62dd894fd730e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 47b38ecea244df88bc7c9eb53aa01ab1051a4bb1 — the merge of head 5f6f72fd82540c66a716be2a3a874bbd89e58bbd into base b7bddeb91029a324cfe89c666fb62dd894fd730e, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 47b38ecea244df88bc7c9eb53aa01ab1051a4bb1 && git checkout 47b38ecea244df88bc7c9eb53aa01ab1051a4bb1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b7bddeb91029a324cfe89c666fb62dd894fd730e 5f6f72fd82540c66a716be2a3a874bbd89e58bbd && git checkout -B drift-repro b7bddeb91029a324cfe89c666fb62dd894fd730e && git merge --no-ff 5f6f72fd82540c66a716be2a3a874bbd89e58bbd

node scripts/docs-audit/affected-docs.mjs --json b7bddeb91029a324cfe89c666fb62dd894fd730e

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs b7bddeb91029a324cfe89c666fb62dd894fd730e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…l added, spec minor

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head 6489315 · 2026-11-26T09:09Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 64893151a8070e45d8532d5c1c8f4648a9309a45
Local-runs: none
Scope: packages/spec/src/ai/record-context-tools.zod.ts + packages/services/service-record-context/src/body-outline.ts, packages/services/service-record-context/src/record-context-tools.ts, packages/services/service-record-context/src/sentences.ts
Security-touching: yes

PR #37484, card #37233 (epic #36996). Read: the card body and its 7 comments (claim 7183671948, reports 7186736579 and 7187454759, claim amendment 7186766469), the PR body and its 2 comments, the net diff against main (12 files, +436/−44), the 74 check-runs on the head, ADR-0160 D3/D4 on main, and #37490. The security line reads yes because the executor hunk carries a disclosure rule (the one 404 answer that keeps outlineFrom from showing a body the caller's schema hides); no defect was found in it (see ④, Leaks).

① Derived judgments

  • Input accept-set widens by one optional member, nothing narrows — right. GetRecordContextInputSchema gains outlineFrom: z.number().int().min(0).optional(). Every input main admits still parses and, with outlineFrom absent, from is 0 and the executor takes the path it took before. The generated authorable-surface/ai.json and record-context-tools.mdx agree with the zod file.
  • Output widens by one optional member — right. RecordContextBody.outlineNext: int, min 1, optional. The floor holds in code: next is set only after at least one entry was admitted (a listable entry always fits an empty page: its length + 2 is at most 8,000), so next is greater than from and at least 1.
  • No note kind and no error code added — right. outline_truncated keeps its kind and gets a new sentence; the two new refusals reuse RESOURCE_NOT_FOUND 404 and VALIDATION_ERROR 400.
  • Three behaviour changes on calls main already admits (no outlineFrom), all stated in the changeset — right, none a narrowing. (a) The outline_truncated sentence is reworded, en and zh-Hans. (b) A cut outline's body now carries outlineNext. (c) N3: a heading whose entry alone passes the character bound is passed over, where main stopped the listing at it (or, when it came first, answered truncated text with no outline). Page 1 is otherwise the same set in the same order as main's outline.
  • The mutual exclusion is not in the schema — right as declared, see N2. The strict object admits anchor with outlineFrom; the executor refuses the pair. The field's describe says "Not with anchor".

② Semver level

  • Clause-②: yes (widening) on the PR body and the changeset: right. One optional input and one optional output member; nothing refused that was admitted.
  • Metadata-protocol: added, @objectstack/spec minor: right by the gate's own reading. The authorable-surface ledger gains GetRecordContextInput:outlineFrom and RecordContextBody:outlineNext, and AGENTS.md step 3 gives an added kind at least minor. Precedent .changeset/37140-… graded spec minor for this tool's input.
  • @objectstack/service-record-context patch: right. boundedOutline and its new BoundedOutline type are not exported from the package index (it exports the two constants only), so the package's public surface is unchanged; the behaviour change ships as patch under the repo rule (precedent .changeset/37178-…, patch for the cap itself). Both packages sit in the changesets fixed group, so they version together either way.
  • Gate verdict, from the check-runs on the head: two Check Changeset runs exist. Run 139789254279 (workflow run 45784948113) started 08:39:01Z, completed 08:40:56Z, failure. Run 139789447261 (workflow run 45785004439) started 08:39:25Z, completed 08:41:17Z, success. The success is the newer by both timestamps, so the gate's standing answer on this head is success. The ordering is verified; that the failed run read the pre-edit PR body is the dev's account, consistent with the superseded PR-body guards run being cancelled at 08:39:25Z and its successor starting 08:39:28Z, but the failed run's log was not read here (its check-run output is empty). See N6.

③ Boundary flags

  • Open question of report 7186736579 (which Metadata-protocol declaration stands): answered. Option A, by claim amendment 7186766469; the changeset, PR body and newest Check Changeset agree.
  • Deviation: packages/mcp/src/mcp-record-context-tools.test.ts outside the first claim: acceptable. One line, test only, no mcp source. The pin asserts the registration's exact input key list, so any input widening must move it or leave Test Core red. The claim amendment adds it to the file surface. It was amended after the PR opened, which is the honest order for a file the widening forced.
  • Deviation: ADR sentences carried by 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490, not this PR: right carrier. docs/adr/** is Tier H; the card's Out-of-scope clause says the ADR text for a new input is a later amendment's, stated in the PR. 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490 is filed under 37178 跟进:资料包目录被截断时,没列出的章节也要能读到 #37233, blocked on this PR, and names both sentences (D4 input line, D3 "The body") plus the 404/400 behaviour. Until it lands, ADR-0160 D4's "Input, strict" line lists four members while the spec admits five; the card accepted that window. See N4 for the PR body's pointer.
  • Out-of-scope finding of the report (a heading too long to list has no issued anchor; in a flat body its section is unreachable through the tool), carrier: none: accepted as stated, not escalated. The card allowed N3 "stated as is"; the note counts such headings and says their anchors are not given; it takes about 3,950 characters of heading text. The acceptance line "every section is reachable … by anchors it issued" holds for every heading that can be listed.
  • Report 7187454759 names its head 64893151a81. That is not a prefix of the head (64893151a80…). See N5.
  • Stale failed Check Changeset run left on the head: see ② and N6.
  • SQL push-down: no finding. The diff adds no query, no id materialisation and no in-app join. Paging runs over the one body string the root read already returned. An outline page call repeats the whole pack read (fields, related lists), exactly as an anchor call does on main; that is the tool's existing shape, not a new cost class.

④ Design judgment

packages/spec/src/ai/record-context-tools.zod.ts (hits) against ADR-0160 D3/D4 and its first consumer, the executor.

  • outlineFrom is declared in the input schema, strict object kept, integer of at least 0, projected to the tool's JSON Schema (spec test and the registration pin both read it). Holds.
  • outlineNext min 1 matches the code (①). The note-kind jsdoc for outline_truncated matches the sentence. Holds.
  • ADR-0160 D4 lists the input without outlineFrom. The card delegates the ADR text; 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490 carries it. Holds as a stated, carried gap.

body-outline.ts — paging correctness. Tried to break it; it holds.

  • One order: byLevel sorts by level, then by body index, so the order is total and the same on every call for the same body. A page is the contiguous run of that order from from to next, minus unlistable headings. Runs of consecutive pages are disjoint and adjacent, so walking from 0 by next lists every listable heading exactly once, for flat and for mixed levels. No gap, no duplicate.
  • Unlistable headings are skipped by continue before the cap test, at any position, including when the page is already full; next is only ever set at a listable heading.
  • No livelock: next always points at a listable heading, which the next page admits first, so every page reached through outlineNext is non-empty; the executor emits outlineNext only on a non-empty page; and next is strictly greater than from.
  • When only unlistable headings remain, next is absent and the sentence says no later page lists more.
  • A passed-over heading stays readable by anchor: sectionOf resolves against every heading headingsOf gave, listed or not. The tool never issues that anchor, which the note states.
  • Both bounds hold per page (entry cap; serialized characters with brackets and commas counted). No later step cuts the outline, so outlineNext cannot point past entries that were dropped.
  • An outlineFrom that is not a boundary the tool issued gets the page starting there; harmless.

record-context-tools.ts — contract and leaks.

  • 400 for anchor with outlineFrom: thrown in step 1, after parse and the locale read, before readGuard. It matches D4 "the arguments are validated" first, and the code and status are those of the parse refusal. The test pins door.reads empty.
  • 404 for an outline page that does not start at outlineFrom: RESOURCE_NOT_FOUND, the code an unresolved anchor gets, and D3's "one answer whatever the reason" extended to the new input. It is thrown in the body block, after the root gates, pack selection, the related children's gates and the reads, so no earlier answer changes: a caller the gates refuse gets the same 403/404 with or without outlineFrom.
  • Leaks: for any outlineFrom above 0 the answer is the same code, status and sentence (it echoes only the number sent) for a page past the end, a body carried whole, a pack with no body, and a body the caller's projection withheld or dropped; the test compares the four refusals for equality. So outlineFrom cannot show that a pack has a body the caller's schema hides. outlineNext and the counts in the note are derived from a body the caller is reading. No finding.
  • outlineFrom: 0 is page 1, and on a body that is no outline it answers as a call without it. Consistent with the schema's floor.

sentences.ts — sentence against code.

  • outlineTruncated, en and zh-Hans: listed, total, not-listed-on-this-page, the page order, the next outlineFrom or "no later page", and the unlistable count all match what boundedOutline returns. The clause a flat cut made false is gone. The two say the same thing. Holds.
  • outlineFromUnresolved and outlineFromWithAnchor, en and zh-Hans: match the code. Hold.

S1 (should-fix) — On every outline page the executor still pushes the body_outline note, whose unchanged sentence reads "To read a section, call get_record_context again with the same arguments and that section's anchor" (zh-Hans: 用相同的参数和该节的 anchor). On a page reached with outlineFrom (page 2 onward), "the same arguments" include outlineFrom, and this PR makes anchor with outlineFrom a 400 VALIDATION_ERROR. So the note this answer carries instructs a call the tool refuses, for every section listed past page 1, which is exactly the set of sections the card exists to make reachable. A model recovers from the refusal sentence, at the cost of a refused call. The acceptance pin does not see it: it reads each section with { ...CALL, anchor }, never with the arguments of the page that issued the anchor. Fix in sentences.ts, en and zh-Hans (for example: with that section's anchor and without outlineFrom), and pin it by reading a section from page 2 the way the note says.

N1 (nit) — The cursor is a position in the current body's order. If the body is edited between two page calls, the walk can skip or repeat headings with no signal; anchors on each page are still current. "Each heading is on exactly one page" is true for one state of the body. The PR body says so; the spec describe and #37490's proposed D3 sentence do not. Carry the qualifier into #37490.

N2 (nit) — The anchor/outlineFrom exclusion lives in the executor and in describe prose only; the schema and its JSON Schema projection admit both. Acceptable for a strict object projected to JSON Schema, and the executor test pins the refusal. No spec test pins that the schema admits the pair, so the split is by convention.

N3 (nit) — Loose wording. Spec outline: "the pages run through every heading" and outlineNext: "when headings remain past this outline page" are both off by the too-long-to-list case (a later page must list one). The en sentence reads "1 of the headings are too long" when the count is 1.

N4 (nit) — The PR body names the ADR carrier as "the ADR-0160 amendment of #37202 or a later one"; the carrier is #37490. Prose face: point the PR body at #37490.

N5 (nit) — Delta report 7187454759 gives "head": "64893151a81", which matches no commit; the head is 64893151a8070e45…. The same report's gates line says 64893151a, which does match. A record defect in the report, not in the tree.

N6 (nit) — The failed Check Changeset run 139789254279 stays on the head beside the newer success. It has no effect on the gate's standing answer; re-running that one job would clear the red mark for a human reader.

No must-fix. One should-fix (S1), which earns a delta review of its fix.

Implemented-by: claude/issue-37233-outline-continuation
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

Head-sha: 64893151a8070e45d8532d5c1c8f4648a9309a45
REWORK — L1, seat repo:objectstack#5. Contract record 7187652688 (CONTRACT_REVIEW_TIER) reads PASS: paging is correct, the contract holds, and nothing leaks. One should-fix, S1, closes in this PR before ACCEPT.

  1. Shape: open draft against main, 12 files (+436/−44), Fixes #37233, Clause-②: yes (widening), Metadata-protocol: added. Changesets: spec minor, service-record-context patch. Not governed. All required contexts are green. The stale failed Check Changeset run (08:39:01Z) is superseded by the 08:39:25Z success.
  2. Premise: pages are disjoint, adjacent runs of one total order, so every listable heading is listed exactly once. outlineNext is deterministic and strictly increasing, and no page can be empty. outlineFrom is in the strict input schema. The 404 is the same code, status and sentence for every not-listable case, thrown after the root gates. The 400 comes at step 1, before readGuard.
  3. Owed before ACCEPT:
    • S1. The body_outline note on every page tells the caller to repeat "the same arguments" plus the section's anchor. On a page reached with outlineFrom, those arguments include outlineFrom, and anchor with outlineFrom is the 400 this PR adds. Fix the sentence in sentences.ts, in both en and zh-Hans, and pin a section read from page 2 that is done exactly as the note says.
    • The same reviewer reads the delta.
  4. Accepted deviations:
    • The mcp test-only registration pin is covered by the claim amendment.
    • Nits, fix in the same push if cheap:
  5. Out of scope and where it went: the ADR D3/D4 sentences go to 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490. N1 also goes there: the cursor is a position in the current body, so "exactly one page" holds per body state. 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490's D3 sentence should carry that qualifier.
  6. Landing terms: ungoverned, CONTRACT_REVIEW_TIER. Owed: S1 closed, a same-head delta PASS, and an ACCEPT. Then the area lands it.

…age names a section read without outlineFrom; singular for one too-long heading

Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5f6f72fd82540c66a716be2a3a874bbd89e58bbd
Local-runs: none
Scope: packages/spec/src/ai/record-context-tools.zod.ts + packages/services/service-record-context/src/body-outline.ts, packages/services/service-record-context/src/record-context-tools.ts, packages/services/service-record-context/src/sentences.ts
Security-touching: yes

Delta round on PR #37484, card #37233 (epic #36996), and a whole record for this head. The earlier record is 7187652688 on 64893151a8070e45d8532d5c1c8f4648a9309a45; the seat's REWORK is 7187667170. Read this round: the card's 8 comments (delta report 7189969133 among them), the PR body and its 4 comments, the two delta commits (898c5e76ce, 5f6f72fd82: 5 files, +52/−13), the net diff against main (12 files, +477/−46), the 74 check-runs on this head, ADR-0160 D3/D4 on main, and #37490 with its 2 comments. The security line reads yes for the same reason as before: the executor hunk carries a disclosure rule (the one 404 answer that keeps outlineFrom from showing a body the caller's schema hides). The delta does not touch it and no defect was found in it.

The delta holds no merge of main. main is ahead of the branch's merge base (a46efa8c6) and has since moved three files of the service package (index.ts, verify-citations.ts and its test); none is in this diff, and the PR reads as mergeable clean.

① Derived judgments

  • Input accept-set widens by one optional member, nothing narrows — right, unchanged by the delta. GetRecordContextInputSchema gains outlineFrom: z.number().int().min(0).optional(). With it absent the executor takes the path it took on main.
  • Output widens by one optional member — right, unchanged. RecordContextBody.outlineNext: int, min 1, optional; the floor holds in code (next is set only after an entry was admitted, so it is above from).
  • No note kind and no error code added — right. The two refusals reuse RESOURCE_NOT_FOUND 404 and VALIDATION_ERROR 400.
  • Behaviour changes on calls main already admits — right, none a narrowing. (a) the outline_truncated sentence; (b) outlineNext on a cut outline; (c) a heading too long to list is passed over and counted; and, new in the delta, (d) the body_outline sentence is reworded on every outline answer, page 1 included (en and zh-Hans). It names the same call as before for a first-page caller, so no caller's working call changes. See N7 for the changeset's account of (d).
  • The delta's schema hunk is describe text only. No accept-set moves; the regenerated record-context-tools.mdx rows agree with the zod file, and authorable-surface/ai.json is unchanged by the delta.
  • The anchor with outlineFrom exclusion stays the executor's — right as declared, and now pinned on both sides (N2).

② Semver level

  • Clause-②: yes (widening), Metadata-protocol: added, @objectstack/spec minor, @objectstack/service-record-context patch: right, and unchanged by the delta. The delta adds no key, no value and no export; the changeset file is not touched by it.
  • Gate verdict, from the check-runs on this head: 74 runs, all completed, none failed (62 success, 12 skipped). Check Changeset ran twice, both success: 139823195841 started 09:45:49Z, and 139856513383 started 10:47:51Z after the PR body edit of 10:47:42Z. PR-body guards likewise twice, both success.

③ Boundary flags

  • Delta report 7189969133: no open question, no out-of-scope finding, security_findings: none. Nothing to answer.
  • Its deviations: acceptable. Unlocked single-file test runs while queued for the verify lock, with every reported reading re-taken under the lock at the final head; gen:schema and gen:docs run from source, then check:generated 14/14 under the lock. No re-run of the stale failed job on the old head: that job belongs to 64893151a8 and this head carries no failed run.
  • No merge of main was made (reported as merging cleanly; consistent with what was read above).
  • Earlier flags, standing: the metadata-protocol question is answered (option A); the mcp test-only registration pin is covered by the claim amendment; the ADR sentences are carried by 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490, which is blocked on this PR; the unreachable too-long heading in a flat body is accepted as stated in the note.
  • SQL push-down: no finding. The delta is sentences, describe text, tests and generated docs. The PR as a whole adds no query, no id materialisation and no in-app join.

④ Design judgment

packages/spec/src/ai/record-context-tools.zod.ts (hits).

  • outlineFrom and outlineNext hold as in the earlier record. ADR-0160 D4 still lists the input without outlineFrom; 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490 carries it.
  • The delta's two describes are true to boundedOutline: outline now says the pages run through every heading short enough to list and that the note counts any heading too long for any page; outlineNext says it is present when a heading a later page lists remains, and absent on the last page even when too-long headings remain. That is exactly when next is set.

body-outline.ts and record-context-tools.ts: not touched by the delta. The earlier judgment stands on this head: pages are disjoint, adjacent runs of one total order, so every listable heading is listed exactly once; outlineNext is deterministic and strictly increasing; no page reached through it is empty; the 400 is thrown at step 1 before readGuard; the 404 is one code, status and sentence for a page past the end, a body carried whole, a pack with no body and a hidden body, thrown after the root gates.

sentences.ts — sentence against code, re-read whole.

  • bodyOutline, en: "call get_record_context again with the same objectName, recordId and context, plus that section's anchor and no outlineFrom". zh-Hans says the same (相同的 objectName、recordId 和 context,加上该节的 anchor(不带 outlineFrom)). The call it names is admitted on every page, and it is the call the executor answers with the section. The new pin takes page 2's arguments, drops outlineFrom, adds the page's first anchor and gets the section, in both locales; the control, page 2's arguments plus the anchor, is the 400.
  • outlineTruncated keeps "the same arguments and outlineFrom N". On a later page those arguments already hold an outlineFrom, which the named value replaces; that names one admitted call and is not the S1 defect.
  • The too-long count now reads "1 heading is too long …, so its anchor is not given" for one and "N headings are too long …, so their anchors are not given" for more; both pinned. zh-Hans has no number agreement and is unchanged.

Earlier findings on this head:

  • S1: closed. The sentence is fixed in both locales and pinned by a page-2 section read done as the note says.
  • N1: carried with 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490 (its comment 7187692455 asks the D3 sentence to say "exactly one page" holds for one state of the body). The PR body now says the same.
  • N2: closed. The spec test pins that the schema admits the pair; the executor test parses the pair with the spec schema before asserting the 400.
  • N3: closed. Both describes cover the too-long case; the singular is fixed and pinned.
  • N4: closed. The PR body names 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490 as the ADR carrier.
  • N5: closed. Report 7189969133 gives the full head sha, and it is this head.
  • N6: closed. No failed run sits on this head.

New on this head:

N7 (nit) — The changeset body does not mention that the body_outline note sentence changed. It is a published sentence change on every outline answer, of the same kind as the outline_truncated one the changeset does list. It changes no level and no declaration. Accepted as a deviation or added when the changeset is next touched; a fix here moves the head for no contract gain.

No must-fix, no should-fix.

Implemented-by: claude/issue-37233-outline-continuation
Reviewed-by: session_01Utp6CYtTDvfPQDzMbZnN5X

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

席位核对

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

  1. Shape: open draft against main, Fixes #37233, Clause-②: yes (widening), Metadata-protocol: added. Changesets: spec minor, service-record-context patch. Not governed. 62 success · 12 expected skip · 0 failed. Mergeable clean.
  2. Premise: the paged body outline lists every listable heading exactly once. outlineNext is deterministic, and anchor + outlineFrom is refused with a 400. Neither body-outline.ts nor record-context-tools.ts changed in the delta, so the paging and leak judgments stand.
  3. Gates: delta record 7190027212 (same reviewer, CONTRACT_REVIEW_TIER, verified on the transcript) reads PASS.
    • S1 is closed: the body_outline note in en and zh-Hans names a call the tool admits on every page, pinned by a page-2 section read with the 400 as control.
    • N2–N6 are closed.
  4. Accepted deviations:
  5. Out of scope and where it went: 37233 跟进:ADR-0160 补写目录分页(outlineFrom / outlineNext) #37490.
  6. Landing terms: ungoverned. Same-head delta PASS plus this ACCEPT. Area ai-36996 lands it with --land and closes 37178 跟进:资料包目录被截断时,没列出的章节也要能读到 #37233. Security-touching: yes per the record, so the security label goes on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X

Security label: Security-touching: yes per contract record 7190027212 (record-context read paging; no leak found).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Landing: ACCEPT 7190047844 (delta contract record 7190027212, PASS) at head 5f6f72fd82540c66a716be2a3a874bbd89e58bbd.

Probe Reading
Check-runs on head 62 success, 12 skipped, 0 failed, 0 pending
Governed / size check-governed-merges --pr 37484: NOT governed, 480 changed lines ≤ 3000; mergeable_state clean

Status: ready + auto-merge (merge queue). On MERGED, #37233 closes by Fixes; #37490 (ADR text, with N1's qualifier) unblocks; #37463, #37141 and #37432 are released.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 10:59
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Correction to landing comment 7190106730: at the stroke two runs were still in progress on the head, Check Changeset (re-run from the security label, 10:57:18Z) and Governed Surface Queue Guard (re-run from ready, 10:59:24Z); the earlier runs of both were success. The queue waits on them; I watch the outcome.

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 protocol:ai security size/l tests 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.

37178 跟进:资料包目录被截断时,没列出的章节也要能读到

2 participants