Skip to content

feat(service-record-context): cap the body outline's entries and state the cut - #37222

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-37178-outline-entry-cap
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-37178-outline-entry-cap

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

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

Fixes #37178

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

维护者速读

  • 用户能看到什么变化:AI 代理读取一条正文很长、几乎全是标题的记录时,拿到的目录最多列 80 条,超出时多一句说明有多少个标题没列出;以前目录没有上限,可能和正文一样大。
  • 为什么做:属于“按记录向 AI 提问”这一大项,补上目录不设上限、让正文 8000 字上限形同虚设的口子。
  • 出错会怎样:受影响的只有读超长正文的 AI 代理,最坏是目录少列了标题,没列出的章节仍能按锚点读到;纯服务端改动,可直接撤回。
  • 要你做什么:无。

What changes

get_record_context answers a long body with an outline of its headings. The outline had no cap: a long body that is almost all headings made an outline as big as the body, which undid the 8000-character body bound. The outline is now bounded whatever the body holds.

  • RECORD_CONTEXT_OUTLINE_MAX_ENTRIES = 80, a service constant beside RECORD_CONTEXT_BODY_MAX_CHARS (exported from the package index). An outline lists at most 80 headings, AND its listing, serialized, stays within RECORD_CONTEXT_BODY_MAX_CHARS. The entry cap alone does not meet the card's acceptance ("bounded by the constant, whatever the body holds"): a heading's text, and the anchor derived from it, is as long as the author makes it, so 80 entries of 5,000-character headings would still be an unbounded answer. The character bound closes that; it reuses the body bound instead of coining a third number.
  • Which headings a cut keeps (boundedOutline in body-outline.ts): headings are admitted shallowest level first, in body order within a level, until the next would pass either bound, and are listed in body order. So a cut leaves out the deepest headings first, and a listed section's text holds the headings left out under it (a section runs to the next heading of the same or a higher level). For a body of many headings at one level this is a plain prefix cut.
  • Anchors past the cap stay readable (decided and pinned): the cap bounds the listing, not which sections exist. A section call resolves its anchor against every heading, listed or not, and anchors are numbered over every heading, so a listed anchor is the same whether or not the outline was cut.
  • One note per cut, kind outline_truncated (new RecordContextNoteKind value, docblock updated). It sits beside body_outline. Its sentence, in en and zh-Hans, says how many headings are listed, how many the body has and how many are not listed. It carries no record text.
  • Edge: a body whose first-admitted heading is too long to list within the bound (a heading over about 4,000 characters) gets no empty outline. It is carried as text up to the bound and marked truncated, with the body_truncated note, the same as a long body with no headings.
  • Spec: the outline field's .describe() now says the outline is held to the service's bounds and a cut is stated by an outline_truncated note. The reference page is regenerated (gen:docs).

Why a new note kind (Clause-② yes), not the existing truncated mark plus body_truncated

I checked this as the claim asked. The existing pieces cannot carry the cut honestly:

  • RecordContextBody.truncated is described as "Present when text was cut at the bound". An outline cut has no text, so setting it there would contradict its published description.
  • body_truncated is documented as "the body (or a section) was cut at the bound", a character cut of text. Using it for an entry cut would quietly change what a published kind means. An added enum value is visible to every consumer; a changed meaning is not.
  • Neither one carries the count. The count goes in the note's sentence, as related_truncated carries its cap.

So the published output enum widens by one value: Clause-②: yes (widening), Metadata-protocol: none (nothing an author writes changes), changesets at patch. Under the claim, this owes the L2 at CONTRACT_REVIEW_TIER. Repo grep: no consumer switches over the note kinds exhaustively (the MCP and runtime bridges pass notes through).

How the number was chosen

I measured the outline reader on real long documents: the 543 Markdown files of this repository (content/docs, docs, skills) that are past the 8000-character body bound and have headings, at a33691e.

reading value
mean serialized size of one outline entry 95.4 chars
headings per document, p50 / p90 / p95 / p99 / max 19 / 48 / 60 / 103 / 425
documents an entry cap of 40 / 60 / 80 / 100 would cut 75 / 24 / 15 / 9

80 entries × about 95 chars is about 7,600 chars: an outline answer the size of the body bound, as the claim asked. With both bounds applied (boundedOutline), 527 of the 543 are listed uncut, 4 of the 16 cut ones are cut by the character bound before the entry cap, none gets an empty outline, and the largest outline serializes to 7,994 chars.

Tests

The new pins go into the package's two existing test files as top-level describe blocks, under the shared-harness rule in AGENTS.md: the executor pins sit beside the fake-door harness, and the reader pins beside the outline reader's own pins.

  • record-context-tools.test.ts: RECORD_CONTEXT_OUTLINE_MAX_ENTRIES pinned at 80 in the constants block. A new block, "the outline bound", pins four things:
    • a body of 300 short headings lists exactly 80, the outline serializes within the body bound, the notes are ['body_outline', 'outline_truncated'], and the cut note names 220 and 300 and carries no record text;
    • the cut is stated in the caller's locale (zh-CN);
    • the anchor of heading 300 (not listed) reads its section;
    • a body whose only heading is too long to list is carried truncated.
  • body-outline.test.ts: a new block, "the outline is bounded whatever the body holds", pins boundedOutline directly:
    • within the cap, every heading is listed and none left out;
    • the entry cap is a body-order prefix at one level;
    • shallowest first: with 10 parts of 20 clauses each, all 10 parts and the first 70 clauses are listed, in body order;
    • long headings are held to the character bound before the cap;
    • a heading too long to list is left out;
    • numbered anchors are unchanged by a cut.
Test, typecheck and ablation readings
  • pnpm --filter @objectstack/service-record-context test: Test Files 2 passed (2), Tests 71 passed (71). typecheck (tsc --noEmit plus check:test-typecheck): OK, 0 errors. Lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/spec exec vitest run src/ai: 16 files, 448 tests passed.
  • Ablation 1 removed the entry-cap break in boundedOutline, via scripts/ablation-replace.mjs: anchor 1 → 0, blob f1e3b8c8 → 00d35ea8. Result: 5 failed, 66 passed. Restored, blob equal to HEAD, git diff HEAD empty.
  • Ablation 2 removed the character-bound break: 3 failed, 68 passed. Restored the same way. The tests resolve the package's own src (no dist in the path), so no rebuild leg applies.
Derived gate union at 2831c87
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 110 commands at 2831c87. All 110 were run, each exit code captured before any pipe.
  • 103 exited 0 on the first pass.
  • Five refused on missing builds (exit 3): check:doc-formula-expressions, check:doc-security-posture, check:skill-examples, check:docs-transcript-drift, check:lean-entry-closure. After building formula, lint, objectql, client-react and their closures, all five re-ran with exit 0.
  • Two stay NOT MEASURED, left to CI:
    • check-plugin-teardown-shape --self-test needs a full clone; it is checker health only.
    • check:dual-build-cjs-loads needs a full pnpm build.
  • --ran reconciliation: "110 derived famil(ies) accounted for — 108 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)".
  • pnpm --filter @objectstack/spec check:generated after gen:docs: "All 14 generated artifacts are up to date".

Acceptance notes

  • The outline's .describe() and the new kind's docblock are spec prose in the claimed file. They state only what this PR implements. No ADR-0160 ruling is changed: D3 says every cut is stated in the notes and the bounds are service constants pinned by test.
  • Consumer side of the widened enum: pnpm --filter @objectstack/mcp exec vitest run src/mcp-record-context-tools.test.ts passed, 10/10. No consumer reads the note kinds exhaustively. The runtime bridge test is left to CI's Test Core.

Verification

Read first:

  1. packages/services/service-record-context/src/body-outline.ts, boundedOutline: the admission order and the two breaks.
  2. packages/services/service-record-context/src/record-context-tools.ts, the outline branch: the listed guard and the fallback to truncated text when nothing can be listed.
  3. packages/spec/src/ai/record-context-tools.zod.ts: the new outline_truncated value.

Two-minute check: pnpm --filter @objectstack/service-record-context exec vitest run -t "outline bound" should show 4 tests passed, including "an unlisted heading's anchor reads its section".


Generated by Claude Code

…e the cut

An outline answer is now bounded whatever the body holds: at most
RECORD_CONTEXT_OUTLINE_MAX_ENTRIES (80) headings, and its listing serialized
within RECORD_CONTEXT_BODY_MAX_CHARS. Headings are admitted shallowest level
first, listed in body order; a cut adds one `outline_truncated` note naming
how many headings were left out. Every anchor still reads its section.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
@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 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

9 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/services/service-record-context/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/services/service-record-context/src/index.ts) — pages documenting those are invisible to this run
  • 2 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 — 175 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 93bd45957bc4a43eb54d8fec2b36f1cbef41dc5f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b0536e12b1d58e720b883582644c8eec07deb887 — the merge of head 2831c87e9ec67f2993ca9acf63240ed34e069b0d into base 93bd45957bc4a43eb54d8fec2b36f1cbef41dc5f, 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 b0536e12b1d58e720b883582644c8eec07deb887 && git checkout b0536e12b1d58e720b883582644c8eec07deb887
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 93bd45957bc4a43eb54d8fec2b36f1cbef41dc5f 2831c87e9ec67f2993ca9acf63240ed34e069b0d && git checkout -B drift-repro 93bd45957bc4a43eb54d8fec2b36f1cbef41dc5f && git merge --no-ff 2831c87e9ec67f2993ca9acf63240ed34e069b0d

node scripts/docs-audit/affected-docs.mjs --json 93bd45957bc4a43eb54d8fec2b36f1cbef41dc5f

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 2831c87 · 2026-11-25T05:21Z

@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: 2831c87e9ec67f2993ca9acf63240ed34e069b0d
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, packages/services/service-record-context/src/index.ts

Inputs read: card #37178 with every comment (the triage notes, the implementation claim 7152342456, the dev report 7153677982), PR #37222's body, file list and net diff against main, and the check-runs on the head. The review claim is PR comment 7153710557. The rest of the diff (the two test files, the changeset, the generated reference page) is the lane seat's ACCEPT; the changeset and the reference page were read only to judge ② and the declarations.

① Derived judgments

  • Published output enum RecordContextNoteKind gains outline_truncated: right, and a pure widening in this tree. Every reader of the enum at the head is the spec module itself and the executor that writes the notes. No file in the repository switches over the kinds, exhaustively or otherwise. The MCP door registers get_record_context with a description and an input schema only (packages/mcp/src/mcp-http-tools.ts, the registerTool call beside get_record): it declares no output schema and returns the executor's answer as text, so no transport validates a note's kind and none refuses an unknown one. The runtime and stdio bridges pass the answer through. The only parse of an answer against GetRecordContextOutputSchema is the service's own test, against the same head. The one consumer class a new output value can break is one compiled against an older spec that parses the answer strictly or switches exhaustively; none exists in the tree, and the changeset says so in words ("a consumer that switches over note kinds exhaustively must handle the new value").
  • RecordContextBody.outline's description changes, its shape does not: right. The accept-set of the field is unchanged; the sentence added states the bound and names the note.
  • @objectstack/service-record-context gains the export RECORD_CONTEXT_OUTLINE_MAX_ENTRIES: right. An added export beside RECORD_CONTEXT_BODY_MAX_CHARS; nothing is removed or renamed. boundedOutline and BodyOutlineEntry stay internal to the package, which matches the index.
  • Behaviour of get_record_context narrows for one input class: right, and stated. A long body with more than 80 headings, or whose listing would pass 8000 serialized characters, used to list every heading and now lists a subset with a note. That is the card's ask. A second class changes too: a long body whose first-admitted heading cannot be listed used to answer with an outline and now answers with truncated text and body_truncated. Both are output changes of a tool, not of anything an author writes.
  • Generated faces follow. The reference page carries the new enum value and the new description in both tables; Lint & Repo Gates, Lint · docs & code guards, Spec property liveness and Build Docs are success on the head.
  • Gate verdicts on the head: 60 success, 10 skipped, 0 failure. Test Core (10 of 10 shards), TypeScript Type Check, Build Core, Check Changeset, Governed Surface Queue Guard and PR-body guards are success. The skipped runs are path-selected or queue-only (Lint UI, the Dogfood shard matrix, the opt-in harnesses).

② Semver level

  • Clause-②: yes (widening) is right: one value is added to a published output enum, and nothing is taken away. The line is present, line-initial, in both the PR body and the changeset body.
  • Metadata-protocol: none is right: no key, accepted value or metadata type an author can write changes. RecordContextNote is tool output; ai_context packs are untouched.
  • patch on @objectstack/spec and on @objectstack/service-record-context is right under AGENTS.md, Post-Task Checklist step 3: the level follows the metadata-protocol kind alone, none takes patch, and a non-protocol widening ships patch. Both packages the diff moves are named. No BREAKING banner and no ADR-0087 disposition are owed, because nothing an author or a consumer could write is removed.

③ Boundary flags

  • open_questions in the dev report is empty. Nothing to answer.
  • Dev flag, "the outline's .describe() and the new kind's docblock are spec prose in the claimed file": answered. Both sentences were read against the executor and hold (④).
  • Dev flag, the tests went into the two existing test files and not into a card-named file as the claim's file surface said: the reason given is the shared-harness rule in AGENTS.md. This is outside ④ and is the lane seat's to accept.
  • Dev decision, a new note kind instead of the existing truncated mark plus body_truncated: answered, right. RecordContextBody.truncated is published as "present when text was cut", and an outline answer has no text; body_truncated is published as a character cut of text. Reusing either would change a published meaning without a visible change. The claim asked for this to be measured and it was.
  • Dev decision, a character bound beside the entry cap: answered, right, and required by the card's acceptance. A heading and the anchor derived from it are as long as the author makes them, so an entry cap alone bounds nothing.
  • SQL push-down: no finding. The diff adds no read, no id materialisation and no in-app join. boundedOutline works on the body string the root read already returned.

④ Design judgment

No must-fix, no should-fix.

packages/spec/src/ai/record-context-tools.zod.ts, against ADR-0160 D3 on main and its first consumer, the executor.

  • The enum value and its docblock agree with the executor: outline_truncated is pushed only in the outline branch, only when omitted is above zero, exactly once, right after body_outline. "Its sentence says how many headings are not listed" is true in both languages. "Every heading's anchor still reads its section" is true: see the executor below.
  • The outline description, "a cut leaves out the deepest headings first and is stated by an outline_truncated note", holds. Admission is in (level, body order) and stops at the first heading that does not fit, so no listed heading is deeper than any omitted one.
  • Agreement with ADR-0160 D3. D3 says a longer body is carried as an outline, that every cut is stated in the notes, that a note is a fixed sentence of the executor's in the caller's locale and never carries record text, and that bounds are constants of the service pinned by test with no number set by the record. The change holds to each: the cut has a note, the note takes only the body field's name (a name the caller's served schema shows, since this branch runs only for a body that is neither hidden nor withheld) and three counts, the cap is a service constant, and the lane's tests pin it at 80. The cut carries no structural mark on body; D3 allows a mark and does not require one, and the note's kind is the machine-readable carrier. Nothing in D3 is reversed, so AGENTS.md Prime Directive 13 is not engaged.

body-outline.ts.

  • The bound is exact. chars starts at 2 for the brackets and each admitted entry adds its JSON.stringify length plus one comma after the first, so chars equals JSON.stringify(outline).length at every step, and an entry is admitted only while that stays at or below RECORD_CONTEXT_BODY_MAX_CHARS. The entry cap is tested before each admission, so at most 80 are listed. Both bounds hold whatever the body holds, which is the card's acceptance.
  • 80 is consistent with the character bound: at the measured mean of about 95 characters an entry, 80 entries is about 7600 characters, so on ordinary documents the entry cap binds first and the character bound is the backstop for long headings.
  • Selection is right. The sort is by level then by original index (an explicit tie-break, so it does not rely on sort stability); the admitted set is re-sorted by index, so the listing is in body order. omitted is headings.length minus the admitted count.
  • Anchors are untouched: boundedOutline copies the anchor headingsOf gave, and headingsOf de-duplicates slugs over every heading before any cut, so a listed anchor is the same cut or not.
  • Cost: one sort of the headings and at most 81 JSON.stringify calls; the reader's linear-scan property is not affected in practice.

record-context-tools.ts.

  • A section call resolves its anchor with sectionOf(text, headings, args.anchor) over the full headings array; boundedOutline runs only when no anchor was given and the body is past the bound. So an anchor past the cap reads its section, as the docblock and the changeset say.
  • The note's arithmetic is exact: listed is listed.outline.length, total is headings.length, and the sentence computes the remainder as total minus listed, which equals omitted.
  • The fallback is stated, never silent: when nothing can be listed the body is carried to the bound with truncated and body_truncated. An empty outline is never returned.

sentences.ts. outlineTruncated exists in en and zh-Hans with the same three values, and the satisfies clause plus the union return type make a missing language a type error (TypeScript Type Check is success). The picker maps zh-CN to zh-Hans. Neither sentence can carry record text.

index.ts. Exports the new constant beside the body bound. Agrees with the changeset.

Nits (no effect on correctness or the contract):

  • nit — "Serialized" means compact JSON. The MCP door renders the answer with a two-space indent (jsonText in packages/mcp/src/mcp-http-tools.ts), which adds about 54 characters an entry, so a full outline is up to about 12,300 characters on that wire. The answer is still bounded by the two constants, and the body bound is likewise counted before serialization, so the acceptance holds. The jsdoc on boundedOutline could say "compact JSON". Accepted deviation.
  • nit — The English and Chinese sentences end with "a listed section's text includes the headings under it". That is true, and it helps when deeper headings are cut. In a flat cut (the card's own case: 300 headings at one level) the 220 unlisted headings are under no listed section, and the sentence may lead a model to think the listed sections cover them. The first half of the note does say they are not listed, and their anchors do resolve, but the outline gives a caller no way to learn those anchors. A sentence that says sections under no listed heading are not reachable from this outline, or a paged outline, is a follow-up card; it is not this card's ask.
  • nit — The character bound uses break, so one over-long heading stops admission of everything after it in (level, body order). When that heading is the first admitted, a body with many short, listable headings falls back to truncated text. That needs a single heading of about 4000 characters, the outcome is stated by body_truncated, and it keeps the "nothing deeper than an omitted heading is listed" property, so the choice is defensible. It does make two published sentences slightly narrow: RecordContextBody.truncated still lists "a long body with no headings" as the whole-body case, and ADR-0160 D3 says the same. Follow-up: add "or none short enough to list" where those are next edited.
  • nit — The changeset says "a body whose only heading is too long to list"; the code's condition is the first-admitted heading, whatever else the body holds. Fixable on the prose face.
  • nit — ADR-0160 D3's body paragraph names two constants (the body bound and the related-row cap) and three kinds of cut. The outline cap is a third constant and a fourth cut, in the spirit of the paragraph but not in its text. A one-line amendment is a follow-up on that governed surface.

Implemented-by: claude/issue-37178-outline-entry-cap
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 2831c87 · 2026-11-25T05:28Z

L1: ACCEPT (L1-w, zone ai-A)
Head-sha: 2831c87e9ec67f2993ca9acf63240ed34e069b0d

No must-fix, no should-fix. The L2 at CONTRACT_REVIEW_TIER on this head is PASS with nothing open: comment 7153800496, claim 7153710557. This is Tier S: no governed path, 247 changed lines on this card's only PR. needs:contract-review is not owed, because a same-head PASS is on record. ai-A lands it after ACCEPT and green.

Read and found right (head 2831c87)

  • l1-face --pr 37222: 13 items clean.
    • Draft, base main. Fixes #37178 binds only this card.
    • The declarations are Clause-②: yes (widening) · Metadata-protocol: none.
    • The changeset names both published packages moved (spec, service-record-context). patch is right for a non-protocol widening (AGENTS.md). The L2 found no exhaustive switch over RecordContextNoteKind in the tree, and no output schema on the MCP door that would refuse the new kind.
    • 60 success, 10 expected skips, 0 failed. mergeable_state clean.
  • Fixes is right. The card asks for the outline's entries to be capped by a service constant. RECORD_CONTEXT_OUTLINE_MAX_ENTRIES (80) is exported and pinned. The listing also stays within RECORD_CONTEXT_BODY_MAX_CHARS. A cut is stated by one outline_truncated note with exact listed, total and omitted counts, in en and zh-Hans. Anchors past the cap still read their section.
  • Changeset and the generated record-context-tools.mdx, sentence by sentence. The cap, the character bound, "shallowest levels first … in body order", "every heading's anchor still reads its section", the new note kind and the consumer warning all hold. The one exception is the "only heading" sentence (L2 nit 4: the code's condition is the first-admitted heading). The mdx rows are the spec .describe() text and the enum list, regenerated.
  • The tests landed in the two existing test files, per the shared-harness rule.

Accepted deviations (nits from the L2; each needs a follow-up card under the nit rule, or a prose-face fix)

  • N2, the one to file first. In a flat cut (every heading at one level, as in the card's own 300-heading case), the omitted headings sit under no listed section. The answer then gives no way to learn their anchors, so those sections cannot be reached through the tool. The note's sentence "a listed section's text includes the headings under it" misleads there. The follow-up should decide how an omitted section is reached, for example a continuation or an offset on the outline, and fix the sentence.
  • N1. The bound is on compact JSON. The MCP door pretty-prints, so a full outline is up to about 12,300 characters on the wire. That is still bounded by the constants.
  • N3. One very long first-admitted heading drops the whole outline to truncated text, though other headings could be listed. It is stated by body_truncated.
  • N4. The changeset's "only heading" wording. It can be fixed on the prose face.
  • N5. ADR-0160 D3 does not yet name the outline cap as a further constant and cut. That needs a one-line amendment, which is a governed follow-up.

Landing to-do

Fixes #37178 closes the card on merge. File the N2 card, and carry N5 to the next ADR-0160 amendment.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Landing · 2026-11-25T05:29Z · ACCEPT 7153812992 at head 2831c87 (L2 PASS 7153800496, same head, nothing open)

reading value
check-governed-merges.mjs --pr 37222 NOT governed · 247 changed lines
landing-k.mjs --pr 37222 K = 7 < 15 · ok
check-runs at 2831c87 60 success · 10 skipped · 0 failed · mergeable clean

State: ready + auto-merge (Tier S). On MERGED, #37178 closes by Fixes; zone ai-A removes pm:dispatched. Accepted nits N1–N5 are carried by follow-ups (N2 card first; N5 to the next ADR-0160 amendment).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 05:29
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 6831e04 Nov 25, 2026
71 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37178-outline-entry-cap branch November 25, 2026 05:57
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…mit (row 11 contract) (objectstack-ai#37240)

<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_

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

Fixes objectstack-ai#37202

Clause-②: no
Metadata-protocol: none

## 维护者速读

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

<details><summary>What the schema on main does with the three keys and
with the sort direction</summary>

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

```text
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.

</details>

<details><summary>The anchors this round adds, resolved one by
one</summary>

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

```text
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
```

</details>

<details><summary>Local gates at 1cd00b0: 21 derived, 21 run, all exit
0</summary>

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

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

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

</details>

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 objectstack-ai#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 objectstack-ai#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](https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK)_

<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzi13yZRqVcp2mGonWK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…outline in pages (outlineFrom / outlineNext) (objectstack-ai#37484)

Fixes objectstack-ai#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 objectstack-ai#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: objectstack-ai#37140,
objectstack-ai#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 objectstack-ai#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`.

<details><summary>Suites of every touched package (under the verify
lock: VERDICT command-exit 0)</summary>

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

</details>

<details><summary>Derived gate families (dispatch-gates --commands,
111)</summary>

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

</details>

<details><summary>Review S1 pin, and the ablation of the first
round</summary>

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

</details>

---

_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc)_

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbeF2saT6wUBV4E9uc -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 size/m 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.

37140 跟进:资料包正文目录设条数上限

2 participants