Skip to content

docs(spec): knowledge-source-id-to-name names the underscore-led id as the one source its rename rebuilds - #38248

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-r6cjhf
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-r6cjhf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #38217

Clause-②: no
Metadata-protocol: none

维护者速读

  • 是什么:从 18 升级时,迁移工具对“知识源 id 改名为 name”的说明原来写“值不变,所以不重建索引”。现在补上例外:id 以下划线开头的知识源要换新名字、在新名字下重建索引,旧索引由作者自己用 dropSource 删掉,不会自动删。
  • 为什么:name 不允许下划线开头。PR docs(knowledge): the 18 to 19 id row names the underscore exception and the dropSource cleanup #38050 已经在 id 的拒收提示和升级条目 knowledge-source-registration-governed 里讲了这个例外,只有转换本身的说明没讲。
  • 行为变了吗:没有。转换照旧把 _faq 原样搬成 name: '_faq',随后解析拒收并提示“去掉下划线改名”;只改了说明文字和注释,加了夹具和测试把这一例钉住。
  • 要你做的:无。

What changes

packages/spec/src/conversions/entries/19/knowledge-source-id-to-name.ts:

  • summary keeps "the value is unchanged, so no index is rebuilt" and adds the exception: an id that begins with an underscore, which name refuses, so that source takes a new name, is built again under it, and its old index is dropped with dropSource, which the author runs; it names the upgrade entry knowledge-source-registration-governed for how. The summary reaches the upgrade guide's conversion table and os migrate meta --json's specChanges.converted[].to.
  • The jsdoc gains a paragraph saying what the conversion actually does with such an id: renameKey copies the value as it is (id: '_faq' → name: '_faq'), the parse then refuses that name with the router-addressable prescription (rename it without the underscore), and the conversion does not invent a new name, because only the author knows it.
  • The fixture carries an underscore-led id (_legacy_faq → name: '_legacy_faq'); expectedNotices 1 → 2.

The conversion's behaviour is unchanged.

New packages/spec/src/conversions/entries/19/knowledge-source-id-to-name.test.ts:

  • the step-19 chain rewrites an underscore-led id and a plain id alike, the underscore-led name is refused by KnowledgeSourceSchema with exactly ROUTER_ADDRESSABLE_NAME_MESSAGE at name, and the plain one parses;
  • the D3 entry lists this conversion in conversionIds and is listed (not proven absent) for such a stack;
  • the summary still reads "no index is rebuilt" and names the exception and dropSource;
  • the summary, the id tombstone (read off the live parse) and the D3 entry's replacement each name the underscore, "takes a new name" and `dropSource`, and the tombstone and summary name the same D3 entry.

What os migrate meta --from 18 prints for such a source is pinned by the report's existing PAIR pin (packages/cli/src/commands/migrate/meta.report-order.test.ts, "pairs every link the registry declares, replayed over the linked conversion's own fixture"), which replays this conversion's fixture, now carrying the underscore-led id, and checks that the D3 entry's review line (its replacement names the new name and dropSource({ source })) is printed beside the edits. That file is not edited here.

One patch changeset for @objectstack/spec.

Why

#38217: the notice was true for every source but one class. PR #38050 taught that class on the tombstone and the upgrade entry; the conversion's own summary and comment did not.

Verification

Ablation: with the conversion file restored to origin/main and the new test kept, the two wording pins fail (the summary keeps "no index is rebuilt"… and the summary, the id tombstone and the D3 entry…); the rewrite and refusal pins pass, as they should, since the behaviour did not change. Restored: green.

runs

Head 8de7f0f.

  • pnpm --filter @objectstack/spec build, then pnpm turbo run build --filter='@objectstack/cli^...': exit 0.
  • packages/spec: npx vitest run --project local (whole package): 912 files, 28855 tests passed (1 todo).
  • packages/spec: tsc --noEmit exit 0; pnpm check:test-typecheck OK; pnpm check:generated: every artifact up to date.
  • packages/cli: npx vitest run src/commands/migrate/meta.report-order.test.ts: 21/21 passed (the PAIR pin included) on the spec dist built from this branch.
  • node scripts/pm/dispatch-gates.mjs --commands --changed: 81 derived at this head, all run (on the first head, whose diff was a superset): 79 exit 0 (pnpm check:test-source-alias re-run at this head); 2 exit 3 (PREREQUISITE NOT MET), so NOT MEASURED locally and left to CI: node scripts/check-plugin-teardown-shape.mjs --self-test (its fixture commit is out of this shallow clone), pnpm check:dual-build-cjs-loads (reads every package's dist/; only the CLI closure is built here). check:test-source-alias was red on the first head, over the dropped CLI pin.
  • node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD: OK, both commits.
  • npx eslint on the changed files: exit 0.

Acceptance notes

  • A separate report pin in meta.report-order.test.ts was written and dropped in the second commit: it duplicated the PAIR pin above, and editing that file puts its thirteen pre-existing dynamic-import reaches under check:test-source-alias. The diff stays inside the claim's file surface.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (prose, fixture and tests only)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; eslint on the changed files passes (the full pnpm lint was not run locally; CI runs it).
  • 4. One issue, one branch off an up-to-date main, one pull request. (branch claude/project-thread-r6cjhf is the harness-assigned name)
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: check:generated reports every artifact up to date (no export or schema changed).
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the 维护者速读 block is the maintainer summary).
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgTJs4WrxwVhFtrMRYq

…xception

The conversion's summary and comment said the rename rebuilds no index
for every knowledge source. A source whose id begins with an underscore
cannot keep it as name: it takes a new name, is built again under it,
and the author drops its old index with dropSource. Say so, in the words
the id tombstone and the knowledge-source-registration-governed entry
use, and pin the case: the fixture carries an underscore-led id, a spec
test reads the chain's rewrite and the parse's refusal and holds the
three texts to one remedy, and a report pin shows os migrate meta
printing the edit, its judge and the refusal.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgTJs4WrxwVhFtrMRYq
…e fixture

The report-order harness's PAIR pin replays every linked conversion's own
fixture, which now carries the underscore-led id, and checks the
knowledge-source-registration-governed review line beside its edits. The
separate describe added nothing to that and, by editing the file, put the
file's thirteen dynamic-import reaches under check:test-source-alias.

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 1 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 177 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 bd5407ec74b280f92a281ca4f82e5c8f0f8bdd47 → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8de7f0f673081f752c178a4b723cd2249b01c670
Local-runs: none
Scope: packages/spec/src/conversions/entries/19/knowledge-source-id-to-name.ts + none

PR #38248 for card #38217. Read: the card body and its three comments (triage 7236479180, unlock 7236758780, claim 7237127602; no ruling, no earlier record), the PR body, its three files, the net diff against main, and the check-runs on this head. The cited code was read on main at bd5407ec74, which holds PR #38050.

Check-runs on this head at the read: 58 success, 11 skipped, none failed, none without a conclusion. The skipped ones are opt-in or conditional jobs (Lint UI, 18.x upgrade harness, packed-tarball smoke, Build Docs, Dogfood Verify CLI, the Dogfood shard matrix placeholder, Temporal Conformance, UI Published Artifacts, Queue verdict, Borrowed queue verdict, Schedule gate). Test Core 1/10 to 10/10, Check Changeset, Type Check · workspace, Lint · ESLint and Governed Surface Queue Guard are all success.

① Derived judgments

  • Accept set: unchanged. Right. No schema, pattern or parse is edited; apply is byte-identical to main. renameKey (conversions/walk.ts) copies the value as it is, so id: '_x' still becomes name: '_x', and KnowledgeSourceSchema.name still refuses it with ROUTER_ADDRESSABLE_NAME_MESSAGE. The claim's stop condition (a behaviour change) was not reached.
  • Public surface: one published string changes, summary of conversion knowledge-source-id-to-name. It is read at migrations/spec-changes.ts (converted[].to), so it reaches the generated spec-changes.json and the specChanges of os migrate meta --json. Right: a wording change to an existing field; no key, id, export or type is added or removed. The text is not committed anywhere else in the tree, so no generated artifact is owed.
  • Fixture: before and after gain one source and expectedNotices goes 1 to 2. Right: the conversion emits one notice per renamed source, the name-led source emits none, and the new source carries only id, adapter and a canonical source.content, so no other step-19 entry walks it. Every suite that replays each entry's fixture pair ran in Test Core on this head: success.
  • The text face of os migrate meta --from 18 is unchanged. Right, and see ④ on the acceptance.

② Semver level

patch on @objectstack/spec matches what the diff publishes: prose in one registry string and a comment, plus a fixture and a test. Clause-②: no is right: nothing is accepted that was refused before, and nothing is refused that was accepted. Metadata-protocol: none is right: no protocol key, default or shape moves. The two lines read the same in the PR body and in the changeset, and the claim (7237127602) declared the same. Check Changeset: success.

③ Boundary flags

  • Dev flag, the dropped CLI pin (PR body, Acceptance notes): accepted. The PAIR case in meta.report-order.test.ts replays this conversion's fixture through the real chain and printMigrationReport, and asserts the review line built from the D3 entry's replacement. A second pin of the same line would add nothing, and the diff stays inside the claimed file surface.
  • Dev flag, two gates not measured locally (check-plugin-teardown-shape --self-test, check:dual-build-cjs-loads): answered by the check-runs on this head, all success.
  • open_questions: none on the PR or the card.
  • SQL push-down: not applicable. The diff adds no query, no id materialisation and no in-app join.

④ Design judgment

packages/spec/src/conversions/entries/19/knowledge-source-id-to-name.ts, read against walk.ts, ai/knowledge-source.zod.ts, kernel/address-grammar.ts, the D3 entry 19.knowledge-source-registration-governed.ts and cli/src/commands/migrate/meta.ts on main.

The jsdoc, sentence by sentence:

  • "renameKey copies the value as it is, so id: '_faq' becomes name: '_faq'": true (next[to] = next[from]).
  • "the parse then refuses that name (ROUTER_ADDRESSABLE_NAME_PATTERN; its message says to rename the item without the underscore)": true. The pattern is /^[a-z][a-z0-9_]*$/ and the message ends "rename the item without it".
  • "The conversion does not choose the new name": true, apply only renames the key.
  • "takes a new name, is built again under it, and its old index is dropped with dropSource, which the author runs — nothing drops it automatically": agrees with the D3 entry's reason (an adapter keys what it holds by the source's name; the service drops an index only for a metadata item it stops serving) and with its replacement (call dropSource({ source }) on the adapter).
  • "the D3 entry ... judges this conversion's edits, conversionIds": true, conversionIds: ['knowledge-source-id-to-name'].

The three texts say the same thing. The new summary clause is the tombstone's own wording ("name refuses the underscore, so that source takes a new name, is built again under it, and its old index is dropped with dropSource; the upgrade entry knowledge-source-registration-governed says how"), with "which the author runs" added, which the D3 entry states at length. The summary keeps "the value is unchanged, so no index is rebuilt" for every other source, as the tombstone keeps "is not rebuilt" and the D3 entry keeps "nothing is rebuilt".

Tried to break it:

  • A plain id: the summary still reads "no index is rebuilt". Holds.
  • An underscore-led id on the text face: the summary is not printed there, before or after this PR. What the author reads is the edit line, the D3 review line beside it (its replacement names the new name and dropSource), the D3 entry under ③ with its why: line (which carries "nothing is rebuilt" and the exception), and the refusal of the name with the rename prescription. So the card's first acceptance bullet is met by what is in the tree: by the D3 lines on the text face, which PR docs(knowledge): the 18 to 19 id row names the underscore exception and the dropSource cleanup #38050 landed and the fixture now exercises with an underscore-led id, and by the new summary on the --json face and in spec-changes.json. The second and third bullets are met by the fixture, the new test and the wording above.
  • The exception read as a claim about the conversion: "the value is unchanged ... except for an id that begins with an underscore" could be read as the conversion changing the value. The rest of the sentence ("that source takes a new name") and the jsdoc settle it, and the wording is the tombstone's. No finding.

No must-fix, no should-fix.

  • N1 (nit) — the card and the PR title place the sentence in the "notice" of os migrate meta --from 18; the summary reaches only the --json face and spec-changes.json, and the text face teaches the exception through the D3 entry. The PR body says this correctly. Nothing to change in the tree.
  • N2 (nit) — outside this record's scope, for the lane seat: in the new test, replacement satisfies the `dropSource` pin through its last sentence ("An adapter without dropSource ..."), not through the remedy sentence, which spells it dropSource({ source }). The pin still holds on the tree.

Implemented-by: claude/project-thread-r6cjhf
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA (isolated contract-review sub-agent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head 8de7f0f · card #38217 · area s2-ai · 2026-11-28T10:24Z

L1 checklist

  • Shape and checks. Every check on the head is green apart from expected skips (58 success, 11 skipped); mergeable clean. The PR is a draft. It changes packages/spec/src/conversions/entries/19/knowledge-source-id-to-name.ts (summary and jsdoc only), adds knowledge-source-id-to-name.test.ts and the _legacy_faq fixture row, and one changeset.
  • Contract review at CONTRACT_REVIEW_TIER. Record 7237869408 is a PASS: no must-fix, no should-fix. N1 (the summary reaches the --json face and spec-changes.json; the text face teaches the exception through entry 19.knowledge-source-registration-governed's lines, which the PR body states) and N2 (the test's dropSource pin is met by the D3 replacement's last sentence) need no change. Its transcript passes verify-review-tier; the seat adopts the record.
  • What changes for an author. The conversion's behaviour is byte-identical: renameKey still moves an underscore-led id to name, which the parse then refuses. Its notice no longer says every source keeps its index: a source whose id starts with an underscore takes a new name, is built again, and its old index is dropped with dropSource by the author. The wording agrees with the id tombstone and the D3 entry PR docs(knowledge): the 18 to 19 id row names the underscore exception and the dropSource cleanup #38050 landed; a plain id still reads "no index is rebuilt".
  • Declarations. Clause-②: no, Metadata-protocol: none, @objectstack/spec patch. Fixes #38217 is right.

Tier: XS. Landing: ready and auto-merge in this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 10:24
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit ba2d960 Nov 28, 2026
70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-r6cjhf branch November 28, 2026 10:53
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 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.

spec: the knowledge-source-id-to-name conversion says "no index is rebuilt" without the leading-underscore exception

2 participants