Skip to content

docs(adr): ADR-0161 dated note, a knowledge source declares how its hits are ordered for the caller and what a hit brings - #38511

Merged
os-zhuang merged 3 commits into
mainfrom
claude/issue-38502-adr-0161-declared-ordering
Nov 29, 2026
Merged

os-zhuang merged 3 commits into
mainfrom
claude/issue-38502-adr-0161-declared-ordering

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #38502

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;只在知识检索的架构记录里加一条带日期的注记,定下知识源怎样声明「和提问人相关的内容排前面」(按负责人或所在单位加权,或本单位就近优先),以及「命中一段时带出前后相邻的内容和它所挂记录的名称」。功能本身由随后三张开发卡分别实现。
  • 为什么做:属于知识专题;您已裁定平台做「排序加带出」、不做硬筛选、按时间衰减等有应用要再加。注记把这次裁定写进架构记录,并改掉记录里「知识服务不给候选打分」那一句,随后的实现才有据可依。
  • 出错会怎样:只改一份文档,运行行为不变;条文若写错,碰到的是随后照它实现的开发者,可以直接撤回。
  • 要你做什么:审批并合并这份注记;注记自己定的两处请一并接受或划掉:
    • 加权怎样和各存储的相关度分数结合:不碰分数,只按名次挪位(知识源写「前移几位」;本单位就近优先则按单位层级分档)。三种存储的分数含义不同,同一个数在不同存储上效果不一样,名次是唯一各处一致的依据。
    • 相邻内容怎样取:不给存储适配器加新接口,由平台把命中的那条记录按当前内容重新切段,取前后几段。所有存储不用改就能用,取到的是记录当前的内容;代价是长文档要整篇读一遍。

What changes

One file, docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md, 25 lines added and none removed against main, in three places:

  • Header. A fourth **Amended** line, dated 2026-11-29, in the shape of the three before it. It quotes the maintainer's choice 「A 精简:排序加带出」 and names ruling record 7251603512 on the decision card [Decision] knowledge_source: a declarative retrieval block — rank hits by the asker's relation to a declared field, by recency, and expand a hit along declared structure #38412.
  • K1, under "What follows from the two lists". The dated note. It amends by name the sentence "The service does not choose a model, compute a vector, score a candidate, rerank or parse a file" and gives its new reading: the service still computes no score, and may re-order the hits it is about to answer by an ordering their source declares against a platform-resolved fact about the caller, by position alone. The sentence itself, both K1 tables, the K8 table and every earlier note are left as written.
  • K4. One cross-reference line in the block that is there, saying the two source keys are declared by the K1 note and land with their readers.

What the note fixes, executing the ruling record's conditions as written: no filter mode; the caller fact is a closed list the platform resolves and never a value a client or a model supplies; several affinity entries add and a source declares at most one nearest; the re-order applies to the unit returned (passage, record or group) inside the existing refill bound and reports no count; the tool gains no opt-out argument; recency is not in this note.

Choices the note makes past the ruling's words, each marked ◆ in the text for the approver to accept or strike:

  1. The keys sit on the object arm: source.affinity (entries { field, caller, mode, places? }) and source.expand ({ window?, follow? }), with no wrapper key.
  2. The caller facts are a closed list of two: user and business_unit (the primary unit and its parents), both read from the one resolver the caller-identity card mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363 builds.
  3. A boost combines by position, never by score (the first point the ruling left open). Per source, nearest parts that source's units into tiers by distance in the caller's unit chain; inside a tier a boost moves a matching unit up by places. A hit keeps the score its adapter answered.
  4. Neighbouring passages are cut again from the record; no adapter member is added (the second point the ruling left open). K8's closed list stays closed.
    • Review finding S1, rule chosen: neighbours are attached only when the passage cut at the hit's id is the hit's own snippet, character for character. Chosen over "only when indexStatus answers the expected fingerprint" because it judges the text the service holds, not a report from an optional member, so it is one rule for an adapter with indexStatus and one without, and it fails closed on an adapter whose snippet is not the passage.
    • Review nits N1 to N3 are taken in the note: expand.window is marked ◆ and names the heading-bounded mode it leaves out; places has no bound until knowledge_source: order hits by the asker's relation to a declared field (affinity: boost and nearest, #38412 ruling) #38503 sets one; a follow whose target the record tools serve to no caller is among the refusals.
  5. expand.follow brings the related record's object, id and title, one hop, read as the caller.
  6. An expansion rides on the tool's hit (neighbours, related) as a result of the service, so the hit an adapter answers gains no key.

The note names the slice cards that build it: #38504 (expand.window), #38503 (affinity, after the caller-identity card #38363, with the ruling's three-arm measurement as its acceptance), #38505 (expand.follow).

No code, no schema, no contract member, no changeset: the record declares and implements nothing. skip-changeset is declared on this pull: docs/adr/** publishes from no released package.

Read first, by risk

  1. The bullet "◆ By position, never by score". Two things to weigh: the re-order is per source (a source's units move only among the places that source's units hold, so another source's hit never moves), and nearest is a strict tiering inside the candidates the search already read, not a bounded lift.
  2. The bullet "◆ Neighbouring passages are cut again from the record; no adapter member is added". It rests on three readings taken at 545a4fa278: a passage carries no offset and is not a slice of the document's text; the splitter is pure and the fingerprint covers the applied split; the service already makes the same read and hash comparison in two places.
  3. The bullet "◆ expand.follow". It reads the slice card's "declared fields" as the hop's object, id and title, and sends a list of fields to bring back to a later dated note.

Tests

None. The diff is one Markdown file under docs/adr/; no tested behaviour changes, so nothing is ablated.

Acceptance notes

  • Measured facts the two open points rest on, all read on main at 545a4fa278:
    • knowledge-pgvector and knowledge-turso answer a reciprocal rank fusion (RRF_K 60 in both) divided by the score of a passage first in both legs: ranks 1 to 10 in both legs score 1 down to 61/70, and a passage only one leg ranks scores at most 0.5. knowledge-memory answers the raw cosine similarity. KnowledgeHitSchema says the meaning of score is each adapter's.
    • The service orders merged hits by that score and nothing else (kept.sort((a, b) => b.score - a.score) in searchByKey, and the same comparison in answerByRecord).
    • KnowledgeChunkSchema carries id, documentId, index, content, headingPath?; no offset. Under markdown a passage begins with its heading path and a table cut between rows repeats its header row.
    • IKnowledgeAdapter has no method that reads a passage by document and index. All three in-tree adapters declare capabilities.chunks and store the passage ids the service sets.
    • splitDocument is pure; the fingerprint covers the resolved split and the split algorithm version; checkFreshness and dropUnverifiedHits already read a hit's record, assemble it and compare docHash.
  • The caller-identity card mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363 is a draft, not merged (branch claude/issue-38363-mcp-asker-identity at 0cea24a56c, no pull request open on it when this was read). Its resolver answers the user, the active organization, and the primary business unit with its parents, each read as the caller. The note names the two facts it takes, not the resolver's code.
  • Noted, not filed (carrier in brackets):
  • The 维护者速读 carries two sub-lines under its fourth line: the order asks for the two open points in one line each, and the agent file caps the section at four lines.

Verification

Two-minute check: git diff --stat origin/main...HEAD prints one file, 25 insertions and no deletion; then pnpm check:adr-symbol-anchors exits 0 with its ✅ line, which shows every path#symbol the note cites resolves.

Local gates at head ec46fbc (21 derived, 21 run, each exit 0)

Derived with node scripts/pm/dispatch-gates.mjs --commands (no path passed; 1 changed path, +25 / -0 against merge base 545a4fa27) and reconciled with --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)".

  • node scripts/check-adr-links.mjs and its --self-test :: exit 0 ("1281 relative link destination(s) under docs/adr/ resolve")
  • pnpm check:adr-anchors :: exit 0
  • pnpm check:adr-index :: exit 0 ("docs/adr/README.md is current, every record parsed")
  • pnpm check:adr-symbol-anchors :: exit 0 ("4561 anchors across 165 records resolve ... 0 line anchors survive")
  • pnpm check:doc-authoring :: exit 0
  • pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 (after building @objectstack/formula and @objectstack/lint under the verify lock, VERDICT command-exit 0)
  • node scripts/check-closing-keyword-parity.mjs and its --self-test :: exit 0
  • node scripts/check-comment-mask-corpus.mjs :: exit 0 ("24362 files, 0 disagree, 0 unparseable")
  • node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
  • pnpm check:ci-filter-parity, check:closed-ceremony-text, check:cross-package-test-inputs, check:driver-memory-census, check:gitlink-declared, check:nul-bytes, check:pm-governed-merges, check:pm-prior-rulings, check:refd-timer-probe, check:watch-hint-literal :: exit 0 each

The whole list was run again at ec46fbc986, after the rework commit, with node scripts/pm/overlap-check.mjs before the push (VERDICT clean, exit 0). At the first head, seven of these exited 3 on the first pass (PREREQUISITE NOT MET: the worktree had no node_modules, then two unbuilt packages); each was run again after pnpm install and the build and exited 0. The repo-wide scans and the full check farm are left to CI.

🤖 Generated with Claude Code

…dered for the caller and what a hit brings

A fourth dated note, under K1. It amends by name the sentence "The
service does not ... score a candidate": the service may re-order the
hits it is about to answer by an ordering the source declares against a
platform-resolved fact about the caller, by position and never by score.
It fixes the two source keys on the object arm, `source.affinity` and
`source.expand`, and how neighbouring passages are read: cut again from
the record, with no adapter member added.

Docs only: no schema, no contract member, no code.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oQLfL8thb6wtUHnTb
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 29, 2026
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation labels Nov 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb

Contract-review-claim: session_01FEkQ5oQLfL8thb6wtUHnTb · head d9de430 · 2026-11-29T06:45Z

Face: governed rules text (docs/adr/**, ADR-0161 dated note), so CONTRACT_REVIEW_TIER, run by an isolated fable subagent of the area, independent of the implementing dev.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: d9de430a7f2e3e41b714c5850f9db606cab520b2
Local-runs: none
Scope: docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md + none
Security-touching: yes

PR #38511, card #38502. The diff against main is one file, 25 lines added and none removed (merge base 545a4fa278): a fourth Amended header line, the dated note under "What follows from the two lists" in K1, and one cross-reference line under K4. No file in the diff implements or enforces the note, so the scope names none beside the hits path. Read to judge it, never reviewed: packages/services/service-knowledge/src/knowledge-service.ts, knowledge-tools.ts, knowledge-index-fingerprint.ts, knowledge-source-admission.ts, split/splitter.ts; packages/spec/src/ai/knowledge-document.zod.ts, packages/spec/src/contracts/knowledge-adapter.ts, packages/spec/src/data/field-value.zod.ts; the three in-tree adapters; packages/platform-objects/src/identity/; ruling record 7251603512 and analysis 7251063339 on #38412.

Security-touching: yes is meant: the note teaches permission and sharing behaviour (the re-order is never an access decision; which unit chain a caller's ordering reads; a neighbour is attached only for a row that passed the caller's re-check; a followed record is read as the caller under every gate of the record tools; no marker and no count for what the caller may not read).

Check-runs on this head, read once and not waited on. Success: Check Changeset, Check PR Size, Check Documentation Links, PR-body guards, Governed Surface Queue Guard, Auto Label, filter, Plan Test Core shards, Lint · docs and code guards, Lint · repo and tooling gates, Lint · PM dispatch-gates, Lint · CI, release and engine gates, Lint · ESLint, the three Lint · scoped jobs, Lint and Repo Gates, Type Check · workspace, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, TypeScript Type Check, Test UI, Dogfood Regression Gate. Skipped by the path filter or opt-in: the UI build, lint and E2E jobs, Build Core, Build Docs, Dogfood Verify CLI, Temporal Conformance, both queue verdicts, the schedule gate, the 18.x upgrade harness, the packed-tarball smoke. NOT MEASURED: Test Core (1/12) was in progress when read, and no other Test Core shard had reported; no conclusion is claimed for the Test Core family. No check-run had failed.

① Derived judgments

② Semver level

Clause-②: no

skip-changeset is on the pull and Check Changeset concluded success. No package changes, so no changeset is owed and none is present. The PR body's Clause-②: no and Metadata-protocol: none agree with the tree: the widening (Clause-② yes, Metadata-protocol: added) belongs to the slices that add the keys to packages/spec/src/ai/knowledge-source.zod.ts, as analysis 7251063339 states.

③ Boundary flags

Dev report 7252042698 on #38502: open_questions is empty; security_findings none. Its deviations and carried findings, each answered:

SQL push-down (Prime Directive 5). The note describes three in-service steps where a store could do work: the re-order after the re-check, the re-read and in-memory split for neighbours, and the one-hop read for follow. A reason is given for each. The re-order works on the merged, re-checked list of several sources that may sit in several stores, and K8 rule 4 keeps weights out of the adapter. The neighbour read is argued at length against a by-position adapter member (it would reopen K8's closed list and bring nothing on an adapter that lacks it), its price is stated (a long document is read whole), and the member's return path is named. The follow read is as the caller, at most topK hits per search. No finding.

④ Design judgment

docs/adr/0161-…md, judged against the ruling record, K1, K4, K7, K8, K9, K10 on this head, and the code the note cites.

The ruling's execution conditions, each found in the note as written: no filter mode, narrowing is the search scope and visibility is sharing (the affinity bullet, the refusal list, "Not in this note"); K1's sentence amended by name; the caller fact is a closed list the platform resolves and never a value a client or a model supplies; several entries add and a source declares at most one nearest; the re-order applies to the unit returned (passage, record or group) inside the existing refill bound and reports no count; no opt-out argument until a consumer asks; recency out, returning by a dated note with its first consumer; the three-arm acceptance on #38503 with the return to the maintainer before expand.follow. The slice cards are named. The maintainer's words and the option's line are quoted as record 7251603512 holds them.

Each ◆ choice:

  1. Keys on the object arm, no wrapper. Holds: it is item 10's reasoning (both keys name fields of the indexed object), and field and follow members are tied to metadataFields, which source admission already gates per caller (servedFieldsOf covers content, metadataFields and the title field).
  2. Two caller facts, user and business_unit. Holds: referenceTargetOf answers sys_user for a user field and the declared target for a lookup; sys_business_unit carries parent_business_unit_id, and sys_user.primary_business_unit_id is the projection of the primary membership. The list is closed and smaller than the decision card's five, with a dated-note path for the rest: the smaller spread is the ruling's own direction.
  3. By position, never by score. Holds, and the arithmetic was checked: both SQL adapters divide the fused sum by 2 / (RRF_K + 1) with RRF_K 60, so rank ten in both legs scores 61/70 and a one-leg passage at most 0.5; knowledge-memory answers the cosine; adding 0.1 to rank nine in both legs (61/69) lands above rank two (61/62) by 0.0002. The tier rule passes the stated bound: a unit numbered n with sum p passes exactly the non-matching units numbered n-p to n-1, at most p. searchByKey sorts kept by score and cuts to topK, and answerByRecord sorts the group leads and cuts inside each freshness round, so "before the cut, on nothing else" has one place to go in each path, and the first round is topK × SEARCH_FIRST_ROUND_FACTOR for every re-checked caller, as the note says. The amended sentence still forbids computing a score, and the design computes none. nearest is a strict tiering over what the search already read, not a bounded lift; the note and the PR body say so plainly and it is the ruling's 「本单位就近优先」.
  4. Neighbours cut again from the record, no adapter member. The premises hold: KnowledgeChunkSchema carries no offset; markdown passages begin with their heading path and a cut table repeats its header row; IKnowledgeAdapter has nine methods and none reads a passage by position; splitDocument(doc, split) is pure; the fingerprint hashes the resolved strategy, maxChars, minChars, the token budget and the per-strategy algorithm version; checkFreshness and dropUnverifiedHits already read, assemble and compare docHash with the projection the note names. K8's list stays closed. One hole, S1 below.
  5. expand.follow brings object, id and title, read as the caller. Holds against K10 rule 3 and K9 rule 5; nothing of the related record enters an index.
  6. An expansion rides on the tool's hit and on the service's search report. Holds: the tool reads searchWithRefusals, whose KnowledgeSearchReport is the service package's own type, and a result of the service is not a member. IKnowledgeService.search keeps its signature (K9 rule 3).

The security sentences were tried and hold: the re-order permutes, per source, hits that already passed the re-check and removes or admits none; it is judged on values the caller is admitted to query and on the caller's own facts; a neighbour is text of a document whose hash equals the indexed copy, so it shows nothing a hit of the same document could not; a refused or missing related record leaves no marker.

Findings:

S1 (should-fix) — "a search is served only under the fingerprint the service expects (K7 rule 5), so a document whose hash is the hit's docHash cuts again into the passages the index holds, index for index" is true only for an adapter that holds a search to the fingerprint. K8 rule 2 makes every member optional, item 8 among them, and K7's table has a row for an adapter with no indexStatus whose index "is left alone". Such an adapter may declare capabilities.chunks, keep passages cut under an earlier knowledge.chunk_target or embedder limit, and still answer; docHash covers content, title and metadata, never the split, so it matches; the service then cuts under today's split and attaches the passages around a chunkId that names another piece of text. The bullet "When a hit brings no neighbours" lists its cases as the whole set and this one is not among them, so #38504 built to the letter attaches wrong neighbours silently. All three in-tree adapters refuse a mismatched search (rebuildRequired), so nothing in the tree is affected; the gap is in the contract text an out-of-tree adapter is read against. One sentence closes it, the note's to choose: no neighbours unless the adapter's indexStatus answers the expected fingerprint, or no neighbours when the passage cut at the hit's index is not the hit's own passage.

N1 (nit) — the expand.window bullet carries no ◆, yet it decides shape past the ruling's words: a count on each side within the document, across headings, and no heading-bounded mode (the decision card's siblingsBy, used by two rows of its four-app table). "Not in this note" does not list that mode. Mark the bullet or name what is left out, so the approver accepts it knowingly.

N2 (nit) — places is "a positive integer" with no bound and no card assigned one, where expand.window is bounded by #38504 and a multiple hop by #38505. A very large places is "matches first" inside a tier, the answer "Why position" sets aside for boost. A follow-up line on #38503 is enough.

N3 (nit) — a follow member whose target the record tools never admit for any caller (a system object without enable.aiReadable) brings nothing for everyone and is not in the refusal list; ADR-0078 is cited there for expand.window on a whole split only. A follow-up line on #38505 is enough.

No must-fix. S1 is open on this head; N1 to N3 may be fixed in the note with S1 or carried to the slice cards.

Implemented-by: claude/issue-38502-adr-0161-declared-ordering
Reviewed-by: session_01FEkQ5oQLfL8thb6wtUHnTb

VERDICT: PASS

…it's own text

The fingerprint is an optional member, so an adapter may answer passages
cut under an earlier split while docHash still matches. Neighbours are
attached only when the passage cut at the hit's id is the hit's snippet.
Also: expand.window is marked as a choice and names the heading-bounded
mode it leaves out; places has no bound until its slice sets one; a
follow whose target the record tools serve to no caller is refused.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oQLfL8thb6wtUHnTb
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb

Contract-review-claim: session_01FEkQ5oQLfL8thb6wtUHnTb · head ec46fbc · 2026-11-29T07:10Z

Face: governed rules text (docs/adr/**, ADR-0161 dated note), delta review on the S1 rework (d9de430 → ec46fbc), CONTRACT_REVIEW_TIER, run by the same isolated fable subagent of the area that wrote 7252134389, independent of the implementing dev.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5oQLfL8thb6wtUHnTb

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: ec46fbc98678c0e3f974bd6d5562d7e7fb4cc97b
Local-runs: none
Scope: docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md + none
Security-touching: yes

Delta review of PR #38511 (card #38502) after record 7252134389, which reviewed d9de430a7f and left S1 open. One commit since: git diff d9de430a7f ec46fbc986 is the ADR file alone, five lines changed in place, all inside the dated note. Against main the pull is still one file, 25 lines added and none removed. Everything the first record judged outside these five lines stands as judged there. Read again to judge the new rule, never reviewed: the three in-tree adapters, packages/spec/src/ai/knowledge-document.zod.ts, packages/services/service-knowledge/src/testing.ts, knowledge-service.ts and knowledge-tools.ts.

Security-touching: yes stays as meant in the first record. The new lines add no permission, sharing or credential behaviour of their own.

Check-runs on this head, read once and not waited on. Success: PR-body guards (both runs), Governed Surface Queue Guard, Check Documentation Links, Check PR Size, Auto Label, filter, Plan Test Core shards, Test Core (1/12), Test Core, Test UI, Dogfood Regression Gate, Lint · docs and code guards, Lint · repo and tooling gates, Lint · PM dispatch-gates, Lint · CI, release and engine gates, Lint · ESLint, the three Lint · scoped jobs, Lint and Repo Gates, Type Check · workspace, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, TypeScript Type Check. Skipped: the UI build, lint and E2E jobs, Build Core, Build Docs, Dogfood Verify CLI, Temporal Conformance, both queue verdicts, the schedule gate, the two opt-in jobs. Check Changeset reads skipped in both of its runs on this head, where one run concluded success on the head before; skip-changeset is still on the pull, and no success is claimed for that check here. No check-run was in progress and none had failed.

① Derived judgments

Unchanged from the first record. The accept-set and the public surface are untouched: no schema, contract member, tool definition or settings key is in the diff. The five lines add to what the note declares for the slices: one condition on attaching neighbours (#38504), an upper bound on places owed by #38503, one more write-time refusal for follow (#38505). Each lands with its reader. Right.

② Semver level

Clause-②: no

Unchanged: docs/adr/** publishes from no released package, no changeset is owed, skip-changeset is declared.

③ Boundary flags

No new dev flag and no open_questions entry came with the rework. The two escalations of the first record stand and are the seat's: slice cards #38504 ("both stores") and #38505 ("declared fields") still need rewording before dispatch. #38503 now also owes the upper bound on places, and #38505 the new follow refusal; the note assigns both in words.

SQL push-down: the new rule compares two strings the service already holds. No new read, no id materialisation, no join. No finding.

④ Design judgment

S1: closed

The note now attaches neighbours only when the passage cut at the hit's chunkId has content equal to the hit's snippet, character for character, and "When a hit brings no neighbours" lists both failures (no passage with that chunkId; the text differs). This is the second of the two rules the first record offered. It closes the hole as stated: an adapter that keeps passages of an earlier split now fails the comparison instead of receiving the passages around another piece of text. When the comparison passes, the neighbours are the passages adjacent to that same text in the current cut of a document whose hash matched, which is what the key promises.

Whether the rule could never attach by design was checked. It can attach on every in-tree store: knowledge-memory answers snippet: chunk.content, knowledge-pgvector snippet: r.content, knowledge-turso snippet: String(r.content); none trims or highlights. KnowledgeChunkSchema defines content as "the text the adapter embeds and returns as a snippet", and the contract suite pins it (runKnowledgeAdapterContract expects snippet: third.content). The service and the tool hand hit.snippet through unchanged, so the comparison sees what the adapter answered. The note's clause "which is what a passage's content is defined as" is therefore accurate. An out-of-tree adapter that shortens or decorates its snippet gets no neighbours, fail-closed, and the note says so ("or its snippet is not the passage"). The PR body's line on the chosen rule agrees with the note.

The earlier nits:

  • N1: handled. The expand.window bullet carries ◆, says the count runs across headings, and names the heading-bounded siblingsBy mode as not taken, returning by a dated note with a consumer.
  • N2: handled. places has no upper bound in the note, and knowledge_source: order hits by the asker's relation to a declared field (affinity: boost and nearest, #38412 ruling) #38503 sets one and states it on the key.
  • N3: handled. A follow member whose target is an object the record tools serve to no caller is in the refusal list, under ADR-0078. It agrees with K4's own wording of that gate (a system object without enable.aiReadable).

One new nit from the rework:

N4 (nit) — the snippet comparison fails silently for a whole adapter. The neighbouring case in the same bullet (no capabilities.chunks) logs once and names the adapter, by K8 rule 2 ("Nothing is skipped silently"), and the scope check of item 17 does the same for an adapter whose hits it drops. An adapter whose snippet is never the passage gets expand.window that never does anything, with no line anywhere. A once-per-adapter log line is enough; it can go in the note or on #38504. It changes no answer and no contract shape.

No must-fix, no should-fix.

Implemented-by: claude/issue-38502-adr-0161-declared-ordering
Reviewed-by: session_01FEkQ5oQLfL8thb6wtUHnTb

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5nNJM8FQkBco82NDFb

席位核对 — L1 ACCEPT · head ec46fbc · 2026-11-29T07:13Z

Verdict: ACCEPT at ec46fbc986. Checks: 26 success, 0 failed, 0 pending, mergeable clean. The PR changes one file, docs/adr/0161-*, with 25 additions and no deletions. Declarations: Clause-②: no, Metadata-protocol: none, and skip-changeset, since docs/adr/** ships from no package. It is Tier H: the seat hands it to the maintainer after the delta contract review (claim 7252319414).

Fixes #38502 is right. The card asks for three things, and the note does all three:

  • It amends K1's sentence by name and gives the new reading.
  • It fixes the authorable shape (affinity, expand).
  • It designs the two open points: how a boost combines with scores, and how neighbours are read.

The note also carries all six of the ruling's execution conditions unmarked: no filter mode, a closed caller-fact list, entries that add with at most one nearest, a re-order of the returned unit inside the refill bound with no count, no opt-out argument, and no recency. It names the three slice cards. The card's acceptance ("approved by the maintainer, names the slice cards") is met when the maintainer merges.

Claims I checked against main

  • The RRF arithmetic. RRF_K = 60 is declared in both adapters (pgvector-adapter.ts:125, turso-adapter.ts:190).
    • First in both legs scores 2/61, which normalises to 1. Tenth in both legs scores 61/70 ≈ 0.871, so "about 0.87" holds.
    • A passage ranked by one leg only scores at most (1/61)/(2/61) = 0.5.
    • The "+0.1 lifts the ninth to second" example: 61/69 + 0.1 ≈ 0.98406, which beats 61/62 ≈ 0.98387 for second place and stays under 1. It holds, but only just.
  • The constants. SEARCH_FIRST_ROUND_FACTOR = 5 and SEARCH_REFILL_FACTOR = 20 are in knowledge-service.ts. With a topK of 5, a first round of 25 passages is 5 × 5.
  • "The service orders merged hits by that score and nothing else". kept.sort((a, b) => b.score - a.score) is at knowledge-service.ts:2575.
  • "The service already reads a hit's record, assembles it and compares that hash in two places".
    • dropUnverifiedHits keeps a hit only when its stored docHash equals the one recordToDocument computes.
    • checkFreshness compares the hash too. The one exception is when the tenancy posture cannot be read, and the service then logs that it compares no hash. That is an edge the note does not need: its neighbour rule adds its own check that the snippet matches character for character, so it fails closed either way.
  • The S1 rework is the second rule the contract review offered. Neighbours are attached only when the passage cut at chunkId equals the hit's snippet. It is stated once in the rule and once in "When a hit brings no neighbours", and it is the same rule whether or not the adapter has indexStatus.
  • N1 to N3 are in the text.
  • The header line and the K4 cross-reference follow the shape of the three earlier dated notes. Each says the status line and K4 are left as written. CI's anchor and link gates are green.

Residuals

Nit. The 维护者速读 has two sub-lines under its fourth line. The body explains why: the order asks for the two open points one line each, and the cap is four lines. That is acceptable, but the maintainer reads it as six lines.

Landing (seat): Tier H, the maintainer's merge. Fixes closes #38502 on merge, and the three slice cards are each Blocked-by: it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5mzSTSPADAvwapnhxr

维护者速读

席位意见:同意合并。合并后席位按落地的注记改写 #38504、#38505 的卡正文,再派分片。

席位核对 — ACCEPT · repo:objectstack#5 · Head-sha ec46fbc98678c0e3f974bd6d5562d7e7fb4cc97b · 2026-11-29T07:17Z

  1. 形态:open draft → main,1 file(ADR-0161),+25/−0,Fixes #38502,Clause-②: no,Metadata-protocol: none,skip-changeset。Ruling-ref 7251603512([Decision] knowledge_source: a declarative retrieval block — rank hits by the asker's relation to a declared field, by recency, and expand a hit along declared structure #38412)。
  2. 前提实测:Tier H(受管的 ADR 文字,维护者落地)。契约记录经 contractReviewRecordReading 本地读:delta 7252340623 VERDICT PASS,Served-tier CONTRACT_REVIEW_TIER,Head-sha 即本 head,open 与 unreadable 均为空。Security-touching:两份记录第 9 行都是 yes;读取器把第 13 行开头加了反引号的引述也算作一行,所以判为不可读,席位按第 9 行读作 yes,并加了 security 标签。
  3. 门禁 check-runs:本 head 26 success、22 skipped、0 失败,mergeable_state clean。
  4. 接受的偏差:nit N4(整批邻段快照比对失败时记一次日志)移到 knowledge_source: a hit brings its neighbouring content (expand, siblings slice of the #38412 ruling) #38504。
  5. 范围外去向:knowledge_source: a hit brings its neighbouring content (expand, siblings slice of the #38412 ruling) #38504、knowledge_source: a hit brings one declared lookup hop (expand.follow, #38412 ruling) #38505 的卡正文在合并后按注记改写;knowledge_source: order hits by the asker's relation to a declared field (affinity: boost and nearest, #38412 ruling) #38503 要补 places 的上限,并和 mcp: tell the model who is signed in — the asker's user and business-unit chain reach the ask route (cloud#5099) but not an MCP client #38363 一起定 resolver 放在哪里;Security model: should every plain member read their own primary business-unit chain by default (asker identity for #38503's arm 2)? #38515(成员能否读自己的部门链)在决策线程里。
  6. 落地条款:Tier H,维护者批准后才入队;契约档 L2(fable)delta PASS 7252340623 在本 head,无未闭须修/应修;L1-a ACCEPT 7252345673。批准后由席位落地(ready + auto-merge)。⛔ 未批不入队。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-project-manager · session_01FEkQ5mzSTSPADAvwapnhxr

Approval requested (Tier H: governed ADR text, ADR-0161 dated note; Ruling-ref 7251603512 on #38412) · 2026-11-29T07:18Z

  • Head-sha: ec46fbc98678c0e3f974bd6d5562d7e7fb4cc97b
  • 维护者速读 and the seat's ACCEPT: the seat record above. Contract-tier delta PASS on this head: 7252340623 (first round 7252134389; no open must-fix or should-fix). L1-a: 7252345673.
  • After your approval the seat lands it (ready + auto-merge); it stays draft until then.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 29, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 29, 2026 07:28
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit be1cc06 Nov 29, 2026
59 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-38502-adr-0161-declared-ordering branch November 29, 2026 07:42
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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue security size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADR-0161 dated note: a knowledge_source declares how its hits are ordered for the asker and what a hit brings with it (amends K1)

3 participants