Skip to content

docs(adr): ADR-0161 dated note — the document hash covers the organization of a document that has one (K8 items 2 and 9) - #37263

Merged
os-zhuang merged 3 commits into
mainfrom
claude/issue-37097-adr-0161-dochash-note
Nov 25, 2026
Merged

os-zhuang merged 3 commits into
mainfrom
claude/issue-37097-adr-0161-dochash-note

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Part of #37097

repo:objectstack#4 · os-justin · session_01QSeKYkXwZ3ECV8yacsjMJM

Clause-②: yes
Metadata-protocol: none

维护者速读

What changes

One file under docs/adr/: 0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md, 9 lines added and none removed against main. No schema, no code, no changeset.

This PR must merge before PR #37256. That PR changes the hash recipe of K8 item 2, and K8 rule 3 gives the form of such a change: "the change is a dated note on this record". Contract review 7157191417 on PR #37256 (its finding M1) and the seat's L1 7157210840 hold that PR until this note has merged. docs/adr/** is Tier H: the maintainer merges this PR; no seat approves, merges or enqueues it.

Part of #37097, not a closing line: the card's implementation is PR #37256 and stays there. This PR carries the record's note and nothing else.

Two additions, both in the form sibling records already use (ADR-0090 and ADR-0151, notes of 2026-11-24):

  1. A dated note under K8's table, as a blockquote that opens Note (2026-11-25, card, built by PR). The table is left as written.
  2. One Amended bullet at the end of the header list, pointing at the note. The Status: line is byte-identical, so the generated docs/adr/README.md does not change and is not in the diff.

The note, as it stands at the head:

Note (2026-11-25, #37097, built by #37256) — items 2 and 9: the hash covers the organization of a document that has one. Item 2's hash covers the document as the service assembles it. The parenthesis "content, title, metadata" was everything assembly set on a document, its identity aside, when item 2 was accepted. Item 9 adds organizationId to the assembled document when the document has one, and the hash covers it then. A document without one hashes byte for byte as it did before, so the version prefix is not bumped.

  • Why. A document that gains an organization, loses it or moves to another one gets a new hash, so a complete reindex never leaves a stale organization on a stored document. The other answer kept the parenthesis and bumped the version. It leaves a later change of organization to the events alone, and missed events are the hole reconcile exists to close (K1).
  • A later optional member that assembly sets enters the hash the same way, left out when it is absent, or the version is bumped.
  • What an adapter stores. An adapter that stores docHash stores organizationId from the same version on; otherwise, once it starts reading this field, a complete reindex skips its documents and a walled search never ranks them.

Item 9's first reader, #37097, is built by PR #37256, and this change to item 2 lands with it. The reasoning is contract review 7157191417 on that PR (its M1 and S2). The table is left as written; read items 2 and 9 with this note.

The header bullet:

  • Amended (2026-11-25, #37097): a dated note under the table of K8 records that the document hash of item 2 covers organizationId when the document has one (item 9), with no version bump. The status line above is left as it is.

What each sentence of the note rests on:

Sentence Read where
the hash covered content, title and metadata packages/services/service-knowledge/src/knowledge-service.ts#computeDocHash on origin/main at d62f9e9c
assembly also sets the document's identity, which the hash never covered recordToDocument in the same file at d62f9e9c: id, sourceId, sourceRecordId beside content, title, metadata
the organization enters the hashed body only when the document has one; the version stays v1 computeDocHash and DOC_HASH_VERSION on PR #37256's branch at e8b0688f (and unchanged from 3df745d2, the head the review read)
events keep an index fresh, reconcile keeps it correct K1 of this record, the "Sync and reconcile" row
the adapter sentence finding S2 of review 7157191417; character for character the spec TSDoc on KnowledgeDocument.organizationId on PR #37256 at 6e978db3

Tests

No test changes: the diff is one Markdown file. The derived gate families were run at dd1756af. The final head aec56080 changes only the adapter sentence's wording, and CI at aec56080 is 25 success, 19 skipped, 0 failed.

Local gates at dd1756a: 21 derived, 21 run, all exit 0

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 21 commands from the branch's change set (1 path against merge base d62f9e9c). Each was run with its output redirected to a file and its exit code read before any pipe.

Command Exit
node scripts/check-adr-links.mjs 0
node scripts/check-adr-links.mjs --self-test 0
node scripts/check-closing-keyword-parity.mjs 0
node scripts/check-closing-keyword-parity.mjs --self-test 0
node scripts/check-comment-mask-corpus.mjs 0
node scripts/ci/plan-test-core-shards.mjs --self-test 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions 0
pnpm check:adr-anchors 0
pnpm check:adr-index 0
pnpm check:adr-symbol-anchors 0
pnpm check:ci-filter-parity 0
pnpm check:closed-ceremony-text 0
pnpm check:cross-package-test-inputs 0
pnpm check:doc-authoring 0
pnpm check:driver-memory-census 0
pnpm check:gitlink-declared 0
pnpm check:nul-bytes 0
pnpm check:pm-governed-merges 0
pnpm check:pm-prior-rulings 0
pnpm check:refd-timer-probe 0
pnpm check:watch-hint-literal 0

Reconciliation, node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran with the exit codes recorded, at dd1756af:

Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN.
✓ 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).

Verdict lines from that run:

✅ check-adr-links: 1222 relative link destination(s) under docs/adr/ resolve
adr-index --report: OK — docs/adr/README.md is current, every record parsed, self-test 60 assertions green. …
✅ check-adr-symbol-anchors: 4199 anchors across 163 records resolve …
check-nul-bytes: OK (scanned 27788 text file(s) -- 27788 tracked, 0 untracked-not-ignored; skipped 101 binary; no raw ASCII control bytes).

One family was not measured on its first run. At the first commit 15616e2f, check:doc-formula-expressions exited 3, PREREQUISITE NOT MET: it imports the compiled output of @objectstack/formula and @objectstack/lint, and neither was built in a fresh worktree. After pnpm exec turbo run build --concurrency=2 --filter=@objectstack/formula --filter=@objectstack/lint under the verify lock (VERDICT command-exit 0), it exited 0 at 15616e2f and again at dd1756af.

node scripts/pm/overlap-check.mjs --branch=claude/issue-37097-adr-0161-dochash-note before each of the three pushes: VERDICT clean exit 0 (at dd1756af: 1 changed file, against origin/main d62f9e9c and 0 PR heads).

Acceptance notes

Verification

Read first:

  1. The note under K8's table in the one changed file. The sentence to weigh is the adapter rule, "An adapter that stores docHash stores organizationId from the same version on": K8 rule 2 keeps every member optional, and this sentence says two of them are taken up together.
  2. The "Why" bullet of the same note: it records which answer was not taken (keep the parenthesis, bump the version) and why.
  3. computeDocHash on PR feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256's branch, packages/services/service-knowledge/src/knowledge-service.ts, to hold the note against the recipe it describes.

Two-minute check: open this PR's Files tab. It shows one file under docs/adr/, +9 −0: one Amended bullet at the end of the header list, and one blockquote between K8's table and the paragraph that starts "What "capabilities" became."

Body rewritten to head aec56080 by seat repo:objectstack#4 (session_01QSeKYpEsWWE9Y5YtSsDgqZ) from the dev's round-2 report 7158272523.


Generated by Claude Code

…ation of a document that has one (K8 items 2 and 9)

K8 rule 3 names a dated note as the form of a change to a decided shape.
The note under K8's table records that item 2's hash covers the document
as the service assembles it, which since item 9 includes organizationId
when the document has one; a document without one hashes as before, so
the version prefix is not bumped. It also carries the rule for a later
optional member and the sentence an adapter author needs: an adapter that
stores docHash stores organizationId from the same version on.

Claude-Session: https://claude.ai/code/session_01QSeKYkXwZ3ECV8yacsjMJM
Co-authored-by: Claude <noreply@anthropic.com>
… the later-member rule to what assembly sets

Three wording changes inside the dated note under K8's table: the
parenthesis listed everything assembly set on a document, its identity
aside; the rule for a later optional member is about a member that
assembly sets; and the note says "complete reindex", the words the spec
TSDoc on organizationId uses for the same walk.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYkXwZ3ECV8yacsjMJM
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/issue-37097-adr-0161-dochash-note",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/37263",
  "pr_number": 37263,
  "head_sha": "dd1756af23aa77d637584512556706c9a902ace4",
  "session": "session_01QSeKYkXwZ3ECV8yacsjMJM",
  "premise_still_valid": true,
  "summary": "No-card order under card #37097 (zone a4-K, seat repo:objectstack#4). One docs-only change to ADR-0161: a dated note under the table of K8 on items 2 and 9, and one `Amended` pointer bullet at the end of the header list; one file, 9 lines added, none removed, no anchor entry, no changeset. The note records that the hash of item 2 covers the document as the service assembles it, which with item 9 includes `organizationId` when the document has one, with no version bump; it gives the reason, the rule for a later optional member, and the adapter sentence of review 7157191417 (S2). Draft PR #37263 opens with `Part of #37097`, says plainly that it must merge before PR #37256, and is Tier H: it waits for the maintainer, and this session approved, merged and enqueued nothing. Premise verified: on origin/main d62f9e9c `computeDocHash` covers content, title and metadata; on the branch of PR #37256 at 3df745d2 (the head the review read) and at e8b0688f (its head now) `organizationId` enters the hashed body only when defined and `DOC_HASH_VERSION` stays `v1`.",
  "note_text": {
    "header_bullet": "- **Amended** (2026-11-25, [#37097](https://github.com/objectstack-ai/objectstack/issues/37097)): a dated note under the table of [K8](#k8--the-contract-additions-decided-item-by-item) records that the document hash of item 2 covers `organizationId` when the document has one (item 9), with no version bump. The status line above is left as it is.",
    "note_under_k8_table": "> **Note (2026-11-25, [#37097](https://github.com/objectstack-ai/objectstack/issues/37097), built by [#37256](https://github.com/objectstack-ai/objectstack/pull/37256)) — items 2 and 9: the hash covers the organization of a document that has one.** Item 2's hash covers the document as the service assembles it. The parenthesis \"content, title, metadata\" was everything assembly set on a document, its identity aside, when item 2 was accepted. Item 9 adds `organizationId` to the assembled document when the document has one, and the hash covers it then. A document without one hashes byte for byte as it did before, so the version prefix is not bumped.\n>\n> - **Why.** A document that gains an organization, loses it or moves to another one gets a new hash, so a complete reindex never leaves a stale organization on a stored document. The other answer kept the parenthesis and bumped the version. It leaves a later change of organization to the events alone, and missed events are the hole reconcile exists to close (K1).\n> - **A later optional member that assembly sets** enters the hash the same way, left out when it is absent, or the version is bumped.\n> - **An adapter that stores `docHash` stores `organizationId` from the same version of the adapter on.** Otherwise, once it starts to read item 9, a complete reindex skips its documents, because the hashes match, and a search filtered by organization never ranks them.\n>\n> Item 9's first reader, #37097, is built by PR #37256, and this change to item 2 lands with it. The reasoning is contract review [`7157191417`](https://github.com/objectstack-ai/objectstack/pull/37256#issuecomment-7157191417) on that PR (its M1 and S2). The table is left as written; read items 2 and 9 with this note."
  },
  "tests": "No test: the diff is one Markdown file. No package is touched, so there is no dependency closure to build, no package test or typecheck owed, and no ablation (docs are not ablated). The gate union was run after the last commit, at dd1756af: 21 of 21 exit 0 (see gates).",
  "gates": {
    "local_head": "dd1756af",
    "derived": "node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack — 21 commands from 1 path against merge base d62f9e9c; each run with output redirected to a file and the exit code read before any pipe",
    "runs_at_dd1756af": [
      "node scripts/check-adr-links.mjs → exit 0",
      "node scripts/check-adr-links.mjs --self-test → exit 0",
      "node scripts/check-closing-keyword-parity.mjs → exit 0",
      "node scripts/check-closing-keyword-parity.mjs --self-test → exit 0",
      "node scripts/check-comment-mask-corpus.mjs → exit 0",
      "node scripts/ci/plan-test-core-shards.mjs --self-test → exit 0",
      "pnpm --filter @objectstack/lint run check:doc-formula-expressions → exit 0",
      "pnpm check:adr-anchors → exit 0",
      "pnpm check:adr-index → exit 0",
      "pnpm check:adr-symbol-anchors → exit 0",
      "pnpm check:ci-filter-parity → exit 0",
      "pnpm check:closed-ceremony-text → exit 0",
      "pnpm check:cross-package-test-inputs → exit 0",
      "pnpm check:doc-authoring → exit 0",
      "pnpm check:driver-memory-census → exit 0",
      "pnpm check:gitlink-declared → exit 0",
      "pnpm check:nul-bytes → exit 0",
      "pnpm check:pm-governed-merges → exit 0",
      "pnpm check:pm-prior-rulings → exit 0",
      "pnpm check:refd-timer-probe → exit 0",
      "pnpm check:watch-hint-literal → exit 0"
    ],
    "ran_reconciliation": "node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran (exit codes recorded) at dd1756af, exit 0: \"Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN.\"",
    "first_run_at_15616e2f": "20 exit 0; `pnpm --filter @objectstack/lint run check:doc-formula-expressions` exit 3, PREREQUISITE NOT MET (it imports the compiled output of @objectstack/formula and @objectstack/lint, not built in a fresh worktree). Built both under the verify lock (`VERDICT command-exit 0`, held 99s, waited 0s); re-run exit 0 at 15616e2f and at dd1756af.",
    "adr_anchor_gate": "pnpm check:adr-anchors exit 0 with no new scripts/adr-anchors entry, so the gate does not require one for the note.",
    "overlap_check": "node scripts/pm/overlap-check.mjs --branch=claude/issue-37097-adr-0161-dochash-note before each of the 3 pushes: exit 0, \"VERDICT clean exit 0\" (at dd1756af: 1 changed file, against origin/main d62f9e9c and 0 PR heads).",
    "ci_check_runs_at_dd1756af": "One read right after the PR opened, not waited for: 45 check-runs — 5 success (filter; Governed Surface Queue Guard; Check PR Size; Check Changeset; Check Documentation Links), 17 in_progress (among them Lint · repo & tooling gates, Lint · docs & code guards, Lint · PM dispatch-gates, Lint · ESLint, Type Check · workspace, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, Test UI, Dogfood Regression Gate, Plan Test Core shards, PR-body guards), 23 skipped (opt-in, UI and queue-only jobs). in_progress is the honest value; CI convergence is the seat’s to read."
  },
  "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
  "pr_state_read_back": "PR #37263: open, draft, base main, head dd1756af23aa77d637584512556706c9a902ace4, 1 file, +9 −0, labels size/xs and skip-changeset, assignee os-justin, auto-merge not armed. Body: 11264 bytes sent, 11264 stored, identical.",
  "mcp_calls": "0 — no MCP GitHub call, read or write. GitHub reads went through `gh api` GETs (comments 7157191417, 7157210840 and 7155140070; pulls 37240, 37256 and 37263; the pulls list filtered by this head; check-runs at dd1756af). The copy of this report sent to session_01QSeKYpRrYuqSLCvbSk9zrL goes by the session tool `send_message`, which is not a GitHub call.",
  "api_writes": "2 relay strokes, both as objectstack-fleet[bot]. (1) scripts/pm/fleet-write/dispatch.mjs `pr_create` (draft, assignees [os-justin], labels [skip-changeset]) → PR #37263, run 45582061807, conclusion success; endpoints on the runner: POST /repos/objectstack-ai/objectstack/pulls, POST /repos/objectstack-ai/objectstack/issues/37263/assignees, POST /repos/objectstack-ai/objectstack/issues/37263/labels. (2) scripts/pm/post-stamped.mjs --comment=37263, this report: POST /repos/objectstack-ai/objectstack/issues/37263/comments. Not REST writes: 3 git pushes to the branch (the empty-branch probe, 15616e2f, dd1756af). No write to card #37097: no claim, no assignee, no label.",
  "deviations": [
    "Order point 6 says the item 9 reader \"landed\" in PR #37256. This note merges first, so it says the reader \"is built by PR #37256, and this change to item 2 lands with it\", true before and after that merge.",
    "\"The whole assembled document\" is written as \"everything assembly set on a document, its identity aside\": on origin/main d62f9e9c `recordToDocument` also sets `id`, `sourceId` and `sourceRecordId`, which the hash never covered.",
    "The rule for a later optional member is scoped to a member \"that assembly sets\", so it is not read as a rule about every optional key of `KnowledgeDocument` (the chunk channel of item 5 is set by the splitter and belongs to the fingerprint of K7).",
    "\"From the same version on\" is written as \"from the same version of the adapter on\", because the note also speaks of the version prefix of the hash; \"a walled search\" is written as \"a search filtered by organization\", because the record uses the word \"wall\" nowhere.",
    "Added beyond the order’s six points: one `Amended` bullet at the end of the header list (the form of ADR-0151, whose header has the same shape; the Status line is byte-identical, so the generated docs/adr/README.md is unchanged), and one sentence in the note citing contract review 7157191417 (its M1 and S2).",
    "PR body: the seat signature is a plain line under the first line, the shape PR #37256 uses; no HTML comment anywhere in the body.",
    "Second commit dd1756af after the first gate run: three wording changes inside the note. The whole derived union was run again at dd1756af before the PR was opened.",
    "`test:repo` was not run locally: the diff touches no test of that project and the derivation does not name it; CI’s Test Core owns it.",
    "`pnpm install` and a build of @objectstack/formula and @objectstack/lint ran in the worktree only to measure one derived gate; nothing they produce is tracked or committed."
  ],
  "open_questions": [],
  "security_findings": "none",
  "out_of_scope_findings": [
    "carrier: seat repo:objectstack#4 (contract review 7157191417, N4) · no scripts/adr-anchors entry for K8 item 9 in code; the ADR-anchor gate asks for none for this note, and the file surface of this order excludes one unless the gate requires it · noted, not filed"
  ]
}

… TSDoc carries

The sentence on what an adapter stores now reads word for word as the
TSDoc on KnowledgeDocument.organizationId does on the branch that builds
item 9, so the record and the contract say one sentence, not two. The
bullet opens with a plain label and the sentence follows it unbroken.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYkXwZ3ECV8yacsjMJM
os-dev-report

{
  "issue": null,
  "status": "done",
  "round": "2 — a patch round on the same order, after three messages from the zone session session_01QSeKYpRrYuqSLCvbSk9zrL that were read only after the first report",
  "branch": "claude/issue-37097-adr-0161-dochash-note",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/37263",
  "pr_number": 37263,
  "head_sha": "aec560807bc964835469e5062b5baa3dfe775a02",
  "previous_head_sha": "dd1756af23aa77d637584512556706c9a902ace4",
  "session": "session_01QSeKYkXwZ3ECV8yacsjMJM",
  "premise_still_valid": true,
  "summary": "One sentence of the dated note changed; nothing else did. The adapter sentence under the table of K8 now reads word for word as the TSDoc on `KnowledgeDocument.organizationId` reads on the branch of PR #37256 at its head 6e978db3, as the zone asked in its last message. The diff against main is still one file, 9 lines added, none removed. The PR stays a draft and Tier H; this session approved, merged and enqueued nothing. The PR body was written once at `pr_create` and is now stale in the places listed under seat_action; this session does not rewrite it.",
  "zone_messages": [
    "Message 1 (a line-initial `Rule-change:` line in the PR body, per the PR template under .github): NOT done. `.github/PULL_REQUEST_TEMPLATE.md` says the line is added \"Only when this pull request changes a file under `.claude/`\" and that \"Every other pull request leaves it out\"; os-dev.md says the same (a diff that touches the root `.claude/` tree). This PR changes one file under docs/adr/. Where a dispatch word and os-dev.md differ, os-dev.md holds and the difference is named here. A dev also writes a PR body only at `pr_create`.",
    "Message 2 (the adapter sentence in the words of the TSDoc at e8b0688f, the longer sentence): superseded by message 3 before it was read; not applied.",
    "Message 3 (the adapter sentence in the words of the TSDoc at 6e978db3, called final): applied in commit aec56080. Verified first: PR #37256 is at head 6e978db363c73dc9d151549ef46d6c141bc679ac, and the TSDoc sentence there, with its comment line breaks joined, is contained in the note exactly once, byte for byte. The hash recipe is unchanged at that head (`organizationId` enters the hashed body only when defined; `DOC_HASH_VERSION` stays `v1`). One difference from what the message says: its sentence is not the order’s first wording word for word (the order said \"once it starts reading item 9\" and \"(the hashes match)\"; the TSDoc says \"once it starts reading this field\" and has no parenthesis). The note follows the TSDoc, which is the stated aim."
  ],
  "note_text": {
    "header_bullet": "- **Amended** (2026-11-25, [#37097](https://github.com/objectstack-ai/objectstack/issues/37097)): a dated note under the table of [K8](#k8--the-contract-additions-decided-item-by-item) records that the document hash of item 2 covers `organizationId` when the document has one (item 9), with no version bump. The status line above is left as it is.",
    "note_under_k8_table": "> **Note (2026-11-25, [#37097](https://github.com/objectstack-ai/objectstack/issues/37097), built by [#37256](https://github.com/objectstack-ai/objectstack/pull/37256)) — items 2 and 9: the hash covers the organization of a document that has one.** Item 2's hash covers the document as the service assembles it. The parenthesis \"content, title, metadata\" was everything assembly set on a document, its identity aside, when item 2 was accepted. Item 9 adds `organizationId` to the assembled document when the document has one, and the hash covers it then. A document without one hashes byte for byte as it did before, so the version prefix is not bumped.\n>\n> - **Why.** A document that gains an organization, loses it or moves to another one gets a new hash, so a complete reindex never leaves a stale organization on a stored document. The other answer kept the parenthesis and bumped the version. It leaves a later change of organization to the events alone, and missed events are the hole reconcile exists to close (K1).\n> - **A later optional member that assembly sets** enters the hash the same way, left out when it is absent, or the version is bumped.\n> - **What an adapter stores.** An adapter that stores `docHash` stores `organizationId` from the same version on; otherwise, once it starts reading this field, a complete reindex skips its documents and a walled search never ranks them.\n>\n> Item 9's first reader, #37097, is built by PR #37256, and this change to item 2 lands with it. The reasoning is contract review [`7157191417`](https://github.com/objectstack-ai/objectstack/pull/37256#issuecomment-7157191417) on that PR (its M1 and S2). The table is left as written; read items 2 and 9 with this note.",
    "changed_bullet": "> - **What an adapter stores.** An adapter that stores `docHash` stores `organizationId` from the same version on; otherwise, once it starts reading this field, a complete reindex skips its documents and a walled search never ranks them."
  },
  "tests": "No test: the diff is one Markdown file. The gate union was run again after the last commit, at aec56080: 21 of 21 exit 0.",
  "gates": {
    "local_head": "aec56080",
    "derived": "node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack — the same 21 commands as in round 1 (1 path against merge base d62f9e9c; origin/main has since moved to 9171bed0a6 and touches none of this file, scripts/adr-anchors or docs/adr/README.md)",
    "runs_at_aec56080": [
      "node scripts/check-adr-links.mjs → exit 0",
      "node scripts/check-adr-links.mjs --self-test → exit 0",
      "node scripts/check-closing-keyword-parity.mjs → exit 0",
      "node scripts/check-closing-keyword-parity.mjs --self-test → exit 0",
      "node scripts/check-comment-mask-corpus.mjs → exit 0",
      "node scripts/ci/plan-test-core-shards.mjs --self-test → exit 0",
      "pnpm --filter @objectstack/lint run check:doc-formula-expressions → exit 0",
      "pnpm check:adr-anchors → exit 0",
      "pnpm check:adr-index → exit 0",
      "pnpm check:adr-symbol-anchors → exit 0",
      "pnpm check:ci-filter-parity → exit 0",
      "pnpm check:closed-ceremony-text → exit 0",
      "pnpm check:cross-package-test-inputs → exit 0",
      "pnpm check:doc-authoring → exit 0",
      "pnpm check:driver-memory-census → exit 0",
      "pnpm check:gitlink-declared → exit 0",
      "pnpm check:nul-bytes → exit 0",
      "pnpm check:pm-governed-merges → exit 0",
      "pnpm check:pm-prior-rulings → exit 0",
      "pnpm check:refd-timer-probe → exit 0",
      "pnpm check:watch-hint-literal → exit 0"
    ],
    "ran_reconciliation": "node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran (exit codes recorded) at aec56080, exit 0: \"Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN.\"",
    "prerequisite_build": "the worktree was recreated for this round; @objectstack/formula and @objectstack/lint were built under the verify lock before the run (`VERDICT command-exit 0`, 5 of 5 tasks from cache), so `check:doc-formula-expressions` was measured: exit 0.",
    "overlap_check": "node scripts/pm/overlap-check.mjs --branch=claude/issue-37097-adr-0161-dochash-note before the push of aec56080, against origin/main d62f9e9c and again against origin/main 9171bed0a6: exit 0 both times, \"VERDICT clean exit 0\", 0 PR heads.",
    "ci_check_runs_at_aec56080": "One read after the local run, not waited for: 43 check-runs — 23 success (Lint & Repo Gates; TypeScript Type Check; Test UI; Dogfood Regression Gate; Governed Surface Queue Guard; PR-body guards; Check Documentation Links; Check PR Size; Plan Test Core shards; Auto Label; filter; the Lint and Type Check lanes), 1 in_progress (Test Core 1/10), 19 skipped, 0 failed.",
    "ci_check_runs_at_dd1756af": "The previous head, read at the same time: 25 success (Test Core, Lint & Repo Gates, TypeScript Type Check, Dogfood Regression Gate, Check Changeset and PR-body guards among them), 1 cancelled (the Test Core 1/10 shard, cancelled by the new push), 23 skipped, 0 failed."
  },
  "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
  "pr_state_read_back": "PR #37263: open, draft, base main, head aec560807bc964835469e5062b5baa3dfe775a02, 1 file, +9 −0, labels documentation, size/xs and skip-changeset, assignee os-justin, auto-merge not armed. Body unchanged since `pr_create` (11264 bytes).",
  "seat_action": [
    "The PR body is the seat’s to bring to the new head (a dev writes it once, at `pr_create`). Stale at aec56080: (1) under What changes, the third bullet of the quoted note, which is now the text in note_text.changed_bullet; (2) in the table under it, the last two rows cite e8b0688f, and the branch of PR #37256 is now at 6e978db3 with the TSDoc sentence equal to the note’s; (3) under Tests, the final head is aec56080 and there were four pushes; (4) under Acceptance notes, the two wording bullets on \"from the same version of the adapter on\" and \"a search filtered by organization\" no longer hold and go; (5) under Verification, Read first item 1 quotes the old sentence.",
    "No `Rule-change:` line was added (zone message 1); if the seat still wants one on a docs/adr PR, that is a body edit of the seat’s and a reading the template does not give."
  ],
  "mcp_calls": "0 — no MCP GitHub call, read or write, in either round. GitHub reads went through `gh api` GETs. The notifications were read with the session tool, and the copies of the reports went by the session tool `send_message`; neither is a GitHub call.",
  "api_writes": "3 relay strokes in all, each as objectstack-fleet[bot]. Round 1: (1) `pr_create` → PR #37263 (POST /repos/objectstack-ai/objectstack/pulls, POST .../issues/37263/assignees, POST .../issues/37263/labels); (2) post-stamped report comment 7157915424 (POST .../issues/37263/comments). Round 2: (3) post-stamped --comment=37263, this report (POST .../issues/37263/comments). Not REST writes: 4 git pushes to the branch (the empty-branch probe, 15616e2f, dd1756af, aec56080), none forced. No PATCH of the PR body. No write to card #37097.",
  "deviations": [
    "Round 1 deviation 4 is withdrawn by this round: the note no longer says \"of the adapter\" or \"a search filtered by organization\". The other round 1 deviations stand (the reader \"is built by\" PR #37256; \"everything assembly set on a document, its identity aside\"; the later-member rule scoped to what assembly sets; the header bullet; the citation of review 7157191417).",
    "The changed bullet opens with a plain label, \"What an adapter stores.\", so that the sentence after it is unbroken by markup and matches the TSDoc as one string.",
    "Reading notes on the adopted sentence, for the approver, not a request: \"the same version\" stands one bullet below \"or the version is bumped\", so it can be read as the adapter’s version or as the hash’s; both readings give the same rule, that an adapter which stores the hash stores the organization. \"Walled\" and \"this field\" are the TSDoc’s words: the record does not use \"wall\" elsewhere, and \"field\" elsewhere in it means a field of an object.",
    "The first report was sent before the three zone messages were read: they were queued while round 1 ran and the session read its notifications only after it had reported.",
    "`test:repo` was not run locally (as in round 1); CI’s Test Core owns it and one of its shards was still running at the read."
  ],
  "open_questions": [],
  "security_findings": "none",
  "out_of_scope_findings": [
    "carrier: seat repo:objectstack#4 (contract review 7157191417, N4) · no scripts/adr-anchors entry for K8 item 9 in code; the ADR-anchor gate asks for none for this note · noted, not filed"
  ]
}

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: aec560807bc964835469e5062b5baa3dfe775a02
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

① Derived judgments

  • PR docs(adr): ADR-0161 dated note — the document hash covers the organization of a document that has one (K8 items 2 and 9) #37263 (draft), Part of #37097, epic 专题:知识检索平台化(应用写一份知识源配置就有可用的检索:开源、托管、企业版都能用) #37000. One file, +9 −0 against main: one Amended bullet at the end of ADR-0161's header list, and one dated note between K8's table and "What "capabilities" became". Three commits (15616e2f, dd1756af, aec56080); the third replaced the adapter sentence only.
  • Owed tier by record-recognisers --template --paths: CONTRACT_REVIEW_TIER, rules face, hits = the one file. No other file is in the diff, so + none. The code the note describes is in PR feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256 and was read there at 6e978db363c73dc9d151549ef46d6c141bc679ac, not reviewed here.
  • K = 4 (merge-base d62f9e9c05a4, origin/main 7939732f3520). None of the four commits touches docs/adr/**, scripts/adr-anchors/** or scripts/adr-index.mjs. git merge-tree against origin/main is clean (tree 228fc6e8b0ee), and so is this head against feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256's head (tree 8ffb69713e46). GitHub reads mergeable_state: clean.
  • Check-runs at this head, read 2026-11-25T09:28Z: 25 success, 19 skipped, 0 failed, 0 running. pnpm check:adr-anchors and pnpm check:adr-index are steps of "Lint · repo & tooling gates", which is green; "Lint · docs & code guards", "Check Documentation Links", "Governed Surface Queue Guard", "PR-body guards" and "Test Core" are green. The cancelled Test Core shard belonged to the previous head dd1756af and was cancelled by this push.
  • Generated files: docs/adr/README.md is byte-identical between this head and origin/main. The index reads the line that starts **Status**:; that line is not in the diff, and ADR-0161's row still reads "Proposed — 2026-11-24 …". No drift.
  • The header bullet's link #k8--the-contract-additions-decided-item-by-item is the slug of the K8 heading and is already used twice elsewhere in the file.
  • check:adr-anchors is a presence check over the entries in scripts/adr-anchors/. No entry names ADR-0161 today and the diff adds none, so the note cannot break it; CI agrees.
  • Nothing was built or run locally. The first form of the recogniser call, --paths without --template, is refused by the script ("unrecognised argument"); the tier was read from --template --paths.

② Semver level

  • Nothing publishes: one Markdown file under docs/adr/, no package, no schema, no generated reference. skip-changeset is the right label (AGENTS.md: the label is for a diff that publishes nothing from any released package).
  • Metadata-protocol: none holds. Clause-②: yes is the careful reading for a note on the contract's governing record and costs nothing here.

③ Boundary flags

Each declared deviation, at this head:

  1. The adapter sentence. Withdrawn by the dev in round 2 (report 7158272523). The sentence now reads, after the label "What an adapter stores.": "An adapter that stores docHash stores organizationId from the same version on; otherwise, once it starts reading this field, a complete reindex skips its documents and a walled search never ranks them." That is character for character the sentence in the TSDoc of KnowledgeDocument.organizationId in packages/spec/src/ai/knowledge-document.zod.ts at feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256's head 6e978db3 (lines 60 to 63, rejoined). The pair is verbatim; neither side has to change. The earlier wording ("of the adapter", "a search filtered by organization") had the same meaning; see N1 and N2 for what the verbatim form costs.
  2. "everything assembly set on a document, its identity aside": verified. recordToDocument at 6e978db3 sets id, sourceId, sourceRecordId, content, title, metadata, then organizationId when there is one, then docHash. computeDocHash takes content, title, metadata, and organizationId only when it is defined. On origin/main the same function sets the same six keys and hashes the same three. The three identity keys never entered the hash. Accepted; it is more exact than "the whole assembled document".
  3. The later-member rule limited to "a member that assembly sets": accepted. KnowledgeDocument has optional keys assembly does not set (permissions today, chunks from item 5, which the splitter sets and K7's fingerprint covers). Without the limit the rule would claim those.
  4. The Amended header bullet: accepted. It has the shape of ADR-0151's four bullets (date, card link, "a dated note under … records that …", "The status line above is left as it is."). No generated-file drift and the anchor gates hold, as ① shows.
  5. "is built by PR feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256, and this change to item 2 lands with it": true before and after that merge, and it does not claim behaviour on main. Between the two merges main still hashes three parts, and the note's own last paragraph says where the change arrives. The sentences in the present tense ("the hash covers it then") state the decision, as the rest of K8 does for members not yet built. Residual: if feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256 changed the recipe before it merged, this note would need a second dated note.

Further flags of round 2: the label "What an adapter stores." is fine and keeps the sentence unbroken. The dev states that the PR body was written once and is stale at this head; that is the seat's to settle and is in the seat's L1, not in this record's scope. Open questions: none. The out-of-scope item (no scripts/adr-anchors entry for K8 item 9 in code) stays the follow-up it was in review 7157191417.

SQL push-down (Prime Directive 5): no code in the diff.

④ Design judgment

Against its first consumer, #37256 at 6e978db3:

  • "Item 9 adds organizationId to the assembled document when the document has one, and the hash covers it then": holds, by the conditional spread in computeDocHash.
  • "A document without one hashes byte for byte as it did before, so the version prefix is not bumped": holds. With organizationId undefined the hashed body is the three keys main hashes, and DOC_HASH_VERSION is v1 on both sides.
  • "gains an organization, loses it or moves to another one gets a new hash": holds for all three, since the key is present with its value or absent.
  • The manual path (indexDocument) hashes with the same function and refuses a caller's organizationId, so it stays on the old bytes. The note does not contradict it.

Against the record itself:

  • Item 2's row and the note agree once read together, as the note says; the table is not edited, which is the form rule 3 names.
  • K1's "Sync and reconcile" row reads "Events keep an index fresh; a reconcile pass keeps it correct". The note's "missed events are the hole reconcile exists to close (K1)" is a fair reading of it.
  • K7's recipe hash is a second hash over what assembly reads; the note speaks of the document hash only and does not touch it.
  • Rule 2 ("Every member is optional") and the adapter bullet: no contradiction, but a new rule. An adapter that takes up neither member, or organizationId alone, is as before. One that stores docHash is now told to store organizationId with it. The rule enters by a dated note, the form rules 3 and 5 give, and the approver should know he is accepting it.
  • Item 9's own row ("set by the service at assembly … The adapter filters by it before it ranks") is unchanged in meaning.
  • ADR-0151: nothing in common except the header format. It does not mention knowledge, docHash or this record. No other record under docs/adr/ mentions docHash.

A versus B, as the "Why" bullet states it: correct, and the same as review 7157191417. A: every change of organization changes the hash, so a complete reindex rewrites the document. B: the parenthesis is kept and the version bumped; the first reindex is right, and a later change of organization reaches the index by events only. The bullet says a reindex "never" leaves a stale organization; the one exception is the adapter the next-but-one bullet covers, so the note is complete as a whole.

  • N1 — "from the same version on" stands one bullet below "or the version is bumped", where "version" is the hash's prefix. Read either way the rule is the same: an adapter that stores the hash stores the organization. No change asked.
  • N2 — "a walled search" and "this field" are the TSDoc's words. This record uses "wall" nowhere else, and "field" elsewhere in it means a field of an object. Here they mean a search that is handed organizationIds, and organizationId. A reader of the record alone can work both out from item 9. No change asked; a change would have to be made on both sides to keep the pair verbatim.
  • N3 — "everything assembly set on a document, its identity aside": assembly also sets docHash itself, which no hash can cover. Not worth a word.

Implemented-by: claude/issue-37097-adr-0161-dochash-note
Reviewed-by: session_01QSeKYpEsWWE9Y5YtSsDgqZ

VERDICT: PASS

No must-fix, no should-fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head aec560807bc964835469e5062b5baa3dfe775a02 · 2026-11-25T09:30Z

  • What it is. PR docs(adr): ADR-0161 dated note — the document hash covers the organization of a document that has one (K8 items 2 and 9) #37263 (draft, Part of #37097): the dated note on ADR-0161 K8, items 2 and 9, that contract review 7157191417 on PR feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256 asked for. One file under docs/adr/, +9 −0: one Amended header bullet and one note under K8's table. Dev reports 7157915424 (round 1, head dd1756af) and 7158272523 (round 2, this head).
  • Tier. docs/adr/** is Tier H. The seat approves, merges and enqueues nothing; it hands the PR to the maintainer. It must merge before PR feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256.
  • Head. The head moved during this check, from dd1756af to aec56080: one sentence of the note changed. Everything below was read at aec56080.
  • The note against the code. Read against feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256 at 6e978db363c73dc9d151549ef46d6c141bc679ac: the organization enters the hash only when the document has one, a document without one hashes as on main, and the version stays v1. id, sourceId and sourceRecordId are set at assembly and never hashed, so "its identity aside" is right.
  • The adapter sentence. Now character for character the sentence in the spec TSDoc of KnowledgeDocument.organizationId at 6e978db3. The round 1 deviation on this point is withdrawn; neither side has to change.
  • The other deviations. Accepted: the later-member rule limited to what assembly sets; the Amended bullet in ADR-0151's form; "is built by PR feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256, and this change to item 2 lands with it", which is true before and after that merge and claims nothing about main today.
  • Generated files and gates. docs/adr/README.md is identical to main (the **Status**: line is untouched). Check-runs at this head, read 2026-11-25T09:28Z: 25 success, 19 skipped, 0 failed, 0 running; check:adr-anchors and check:adr-index ran inside "Lint · repo & tooling gates", green. The cancelled Test Core shard was on the previous head.
  • Merge state. K = 4, none of the four commits near docs/adr/**. git merge-tree is clean against origin/main 7939732f3520 and against feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256's head. mergeable_state: clean.
  • Changeset. None, with skip-changeset: right, nothing publishes.
  • Consistency. No contradiction with the rest of ADR-0161 or with ADR-0151. The reasoning for the chosen answer over the version bump is stated as the review gave it.
  • One thing for the approver to weigh. K8 rule 2 keeps every member optional. The adapter bullet adds a rule on top: an adapter that stores docHash stores organizationId too. It is a new rule, entering in the form K8 gives for one.
  • Seat action before the hand-off (no new head). The PR body is stale at this head. It quotes the old adapter sentence under "The note, as it stands at the head" and under "Verification", lists two wording deviations that no longer exist, and names dd1756af as the final head for the local gates. The dev's round 2 report says so and leaves the rewrite to the seat. The 维护者速读 block is still accurate. The seat syncs those places and marks the PR ready for review, then hands off.
  • Open, none blocking. Three reading notes in the contract review (N1 to N3), no change asked. A scripts/adr-anchors entry for K8 item 9 stays a follow-up outside this PR.
  • Contract review. PASS at this head, CONTRACT_REVIEW_TIER, Local-runs: none, Security-touching: yes.

No must-fix, no should-fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

维护者速读

  • 用户能看到什么变化:用户无感。只在「知识检索平台边界」这份决定记录(ADR-0161)里加一条带日期的说明:文档带有所属组织时,文档指纹把组织也算进去;不带组织的文档,指纹和以前一字不差。
  • 为什么做:「知识检索平台化」专题第二阶段的实现改动 feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256(索引文档记下所属组织、检索先按组织过滤)改了指纹的算法。按这份记录自己的规矩,这类改动要先写成带日期的说明、由你批准,所以单独开了这一张。
  • 出错会怎样:说明写错的话,以后写存储适配器的人会照着错的做,最坏是换了组织的文档在重建索引时被跳过、按组织检索时排不出来。这次只有一个文档文件、9 行,撤回这次合并即可,不涉及数据和接口。
  • 要你做什么:审核并由你本人合并(合并即批准),而且必须排在 feat(service-knowledge): documents carry their organization, and search hands the adapter the caller's organizations #37256 之前合并。请留意一点:说明里新增了一条给适配器作者的规矩——存了文档指纹的适配器,要同时存所属组织;记录原先只说每个成员都可选。契约审核 PASS:记录 7158429794,Head-sha aec560807bc964835469e5062b5baa3dfe775a02;席位核对 ACCEPT:7158440806。0 个失败检查。

席位意见:通过。说明逐句对照了 #37256 的代码,都对得上;给适配器作者的那句话与接口注释里的一字不差;索引页没有变动,检查全绿;与主干、与 #37256 合并都干净。剩 3 处读法上的小提示,不需要改。

Hand-off · 2026-11-25T09:33Z · @os-zhuang — PR #37263 (Part of #37097) is ready for your review. Tier H: docs/adr/**, a dated note on ADR-0161 K8, items 2 and 9, one file, +9 −0. Seat ACCEPT 7158440806 and contract review PASS 7158429794 (CONTRACT_REVIEW_TIER), Head-sha aec560807bc964835469e5062b5baa3dfe775a02; 0 failed check-runs. It must merge before PR #37256, which stays held until it has. Your merge is the approval; the seat does not land it.

@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 25, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 25, 2026 09:34
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 8032d95 Nov 25, 2026
54 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-37097-adr-0161-dochash-note branch November 25, 2026 09:55
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 size/xs 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.

3 participants