Repository navigation
Commit ba2d960
docs(spec): knowledge-source-id-to-name names the underscore-led id as the one source its rename rebuilds (#38248)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuXRXWTshhd56mTNbwBRnBxD)_
Fixes #38217
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 是什么:从 18 升级时,迁移工具对“知识源 id 改名为 name”的说明原来写“值不变,所以不重建索引”。现在补上例外:id
以下划线开头的知识源要换新名字、在新名字下重建索引,旧索引由作者自己用 `dropSource` 删掉,不会自动删。
- 为什么:`name` 不允许下划线开头。PR #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.
<details><summary>runs</summary>
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.
</details>
## 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
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(prose, fixture and tests only)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; eslint on the changed files passes (the full
`pnpm lint` was not run locally; CI runs it).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request. (branch `claude/project-thread-r6cjhf` is the harness-assigned
name)
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: `check:generated` reports every
artifact up to date (no export or schema changed).
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block is the
maintainer summary).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTJs4WrxwVhFtrMRYq
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent d994002 commit ba2d960
3 files changed
Lines changed: 131 additions & 2 deletions
File tree
- .changeset
- packages/spec/src/conversions/entries/19
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
15 | 26 | | |
16 | 27 | | |
17 | 28 | | |
| |||
27 | 38 | | |
28 | 39 | | |
29 | 40 | | |
30 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| |||
44 | 58 | | |
45 | 59 | | |
46 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
47 | 65 | | |
48 | 66 | | |
49 | 67 | | |
50 | 68 | | |
51 | 69 | | |
52 | 70 | | |
| 71 | + | |
53 | 72 | | |
54 | 73 | | |
55 | | - | |
| 74 | + | |
56 | 75 | | |
57 | 76 | | |
58 | 77 | | |
| |||
0 commit comments