Repository navigation
Commit 0105a68
test(cli): keep the two-namespace control's tools distinct so the bare-name rule does not judge it (#31742)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9Ff4UJdxHJzwSQG7VEko8ou)_
Prerequisite for #31661 (it was ejected from the merge queue by this
test, queue build 42539489585, Test Core 1/8, triage 6729558102).
Test-only; no card of its own, so `skip-changeset`.
## 维护者速读
- 改了什么:只改 `packages/cli/test/validate-namespace-name.test.ts`
的夹具:两个命名空间那条 CONTROL 里,beta 包的 tool 从 `nsn_lookup` 改名为
`nsn_other_lookup`;同命名空间那几条仍共用 `tool/nsn_lookup`。
- 为什么改:#31661 让一期 bare-name 规则在封存后按全环境拒绝同名 tool,于是这个"两个命名空间可以同名"的
CONTROL 在 premise 用例里被 `BareNameConflictError` 422 拒掉。它本意只测 #31717
的命名空间规则,不该被 bare-name 规则判。
- 风险与回滚:只动测试夹具和一个用例标题,不改产品代码。回滚即 revert。
- 先看:`packagesStack` 的 `betaTool` 一行。
- 两分钟验证:`pnpm --filter @objectstack/cli exec vitest run
test/validate-namespace-name.test.ts` —— 预期 4 passed。
- 需要你做的:无,席位落地后 #31661 可重新入队。
## What changes
- `packagesStack(betaNs)` gives the beta package's tool its own name
when `betaNs` is not `nsn` (`nsn_other_lookup`), so the two-namespace
CONTROL shares only the page `nsn_home`. The shared-namespace fixtures
still hold `page/nsn_home` and `tool/nsn_lookup` twice, so every refusal
assertion is unchanged. The CONTROL's title now says what it holds ("the
same page name in two namespaces validates"). A doc comment says why: a
tool is also phase 1's bare-name one-holder type, judged
environment-wide, so a shared tool across two namespaces is that rule's
refusal, not this rule's CONTROL. `os validate` does not run the
bare-name rule, so the CLI CONTROL reads the same either way; only the
package-door premise is affected.
## Verification
Every run under `os-verify-lock`, CLI closure rebuilt each time:
- This head `86e164c2` (main `cae8d8fe` + this commit):
`test/validate-namespace-name.test.ts` **4 passed**.
- This head merged with #31661's head `30b6c84f` (scratch branch): **4
passed**.
- `main` merged with #31661 (no fix, scratch branch): **1 failed / 3
passed**, the premise: `expected BareNameConflictError: Bare-name
conflict… to be undefined`. That is the queue failure, reproduced, and
the fix clears it.
- Lint: `eslint packages/cli/test/validate-namespace-name.test.ts
--no-inline-config` exit 0. Gates: `dispatch-gates --ran` on `86e164c2`:
**49 derived, 49 run, 0 NOT-MEASURED**, all exit 0 (`check:dts-closure`
and `check:dual-build-cjs-loads` first read a declaration-less / partial
local build and were re-run green after a full closure build).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmQv69sQL5nfT8xuPWs)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmQv69sQL5nfT8xuPWs
Co-authored-by: Claude <noreply@anthropic.com>1 parent 90cea47 commit 0105a68
1 file changed
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
68 | | - | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
75 | | - | |
| 82 | + | |
76 | 83 | | |
77 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
78 | 91 | | |
79 | 92 | | |
80 | 93 | | |
| |||
143 | 156 | | |
144 | 157 | | |
145 | 158 | | |
146 | | - | |
| 159 | + | |
147 | 160 | | |
148 | 161 | | |
149 | 162 | | |
| |||
0 commit comments