Repository navigation
Commit 00dde01
test(i18n): derive console.objectView survivors from en instead of pinning counts (#26510)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9UqY9fBL2b73xq6oRApRHbw)_
Fixes #26438
Part of #26431
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`objectView-config-keys-retired-4730.test.ts` 去掉三个手打计数(存活键 103、合计
229、退役清单长度 126),存活键集合改为从 en 包派生。
- 为什么改:每往 `console.objectView` 加一个正常的新键,这个测试就红,只能改数字;它要守的只是「退役键不回来」。
- 风险与回滚:只改一个测试文件,不发布任何东西;回滚就是 revert 本 PR。
-
先看:`ui/packages/i18n/src/__tests__/objectView-config-keys-retired-4730.test.ts`
第一个 `it`(计数换成去重 + 非空检查)和第三个 `it` 开头(`toHaveLength(SURVIVING_KEY_COUNT)`
换成非空检查)。
- 两分钟验证:`pnpm --filter @object-ui/i18n exec vitest run --root ../..
packages/i18n/src/__tests__/objectView-config-keys-retired-4730.test.ts`(在
`ui/` 下),预期 5/5 通过。
- 需要你做的:无,席位落地。
## What changes
One test file, test-only (`skip-changeset`: nothing under any package's
`files[]` moves).
- **Deleted** `SURVIVING_KEY_COUNT = 103`, the `RETIRED + SURVIVING ==
229` sum, `enKeys toHaveLength(SURVIVING_KEY_COUNT)` and the retired
list's own `toHaveLength(126)`.
- **Kept, unchanged:** `RETIRED_OBJECT_VIEW_KEYS` (every name), the
assertion that no pack defines any retired key (named pack and key in
the failure), the assertion that every pack holds exactly `en`'s
`console.objectView` key set (local CLDR plural slots excepted, as
before), the live-sample translation check, and the `t()` reader scan.
- **Replaced with anti-vacuity:** the retired list is non-empty and has
no duplicate name (`new Set(list).size === list.length`); the `en` root
is non-empty; `LANGS` contains `en`.
- **Comments:** the arithmetic history (116 → 118 → … → 126 retired, 209
→ … → 229 total, 104 → 105 → 103 surviving) is removed; each later
retirement round keeps its provenance paragraph, retitled by key name
instead of by count.
No forced test edits: the only test touched is the one this card names.
## Why
The file exists to prove that the objectui#4730 config-panel vocabulary
never comes back. That needs the retired NAMES and a live-set comparison
against `en`; a hand-typed surviving count adds nothing to it and reds
on every legitimate addition (objectui#13052 and objectui#13330 each had
to bump it). The retired list's length pin was the same transcription
one level over: the names already pin the list, so the count only made
each retirement a two-place edit.
Card acceptance, measured below: adding a `console.objectView.*` key
changes no test; retiring one still requires the list edit.
## Tests
All runs at head `3ce8863d`, under `scripts/pm/os-verify-lock.sh`.
- Target file: `Test Files 1 passed (1)`, `Tests 5 passed (5)`.
- `pnpm --filter @object-ui/i18n test --maxWorkers=2`: `Test Files 87
passed (87)`, `Tests 1353 passed | 13 skipped (1366)`.
- `pnpm --filter @object-ui/i18n type-check` (`tsc --noEmit && tsc -p
tsconfig.test.json`): exit 0; `--listFiles` on `tsconfig.test.json`
lists this test file (1 hit).
### Ablation
Each leg mutates a locale pack through `node
scripts/ablation-replace.mjs` (anchor must hit once, blob must change,
restore proven by blob == HEAD and an empty `git diff HEAD`), inside a
script with an EXIT/INT/TERM trap. 12 of 12 restores reported `ok
restored`; `git status --porcelain` empty afterwards. The locale packs
are not in this diff.
| Leg | Mutation | Result |
|:---|:---|:---|
| A | retired `groupBy` put back into `en`'s `console.objectView` |
**red**: 2 failed / 3 passed. `no pack defines any retired key` names
`en :: console.objectView.groupBy`; the shape test reds too (9 packs now
lack an `en` key) |
| B | retired `groupBy` put back into `zh` only | **red**: 2 failed / 3
passed. Names `zh :: console.objectView.groupBy`; the shape test reds on
`zh` |
| C1 | a new key `ablationNewKey26438` added to all ten packs, this PR's
test | **green**: 5/5 |
| C2 | same mutation, `main`'s test (byte copy of `00a4593a`'s file) |
**red**: 1 failed / 4 passed, `expected [ 'ablationNewKey26438', …(103)
] to have a length of 103 but got 104` |
C1 against C2 is the defect the card names, before and after.
## Acceptance notes
- `expect(LANGS).toHaveLength(10)` stays. It pins the locale roster, not
this namespace, and the same line sits in eight sibling i18n test files
plus `entry-locale-shape-7479.test.ts`; retiring it in one file alone
would leave the roster pinned everywhere else. It belongs to the
roster's own entry in the #26431 sweep if that sweep wants it.
- The shape test still reds when a key is added to `en` alone. That is
the parity rule (`all-locales-key-parity.test.ts` holds it repo-wide),
not a count; leg C adds the key to every pack, which is what a
legitimate addition does.
## Verification
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `3ce8863d` derived 24 commands; all 24
ran with exit 0, reconciled with `--ran`: `24 derived famil(ies)
accounted for — 24 run, 0 NOT-MEASURED (a DERIVED zero — all 24 recorded
an exit code and none of them is 3)`.
`pnpm --dir ui exec vitest run scripts/` first exited 1 on a missing
prerequisite (`Cannot find package '@objectstack/spec/ui'`, spec not
built in this fresh container). After `turbo run build
--filter='@object-ui/i18n^...' --filter=@objectstack/spec` it ran green:
`Test Files 178 passed | 2 skipped (180)`, `Tests 5097 passed | 2
skipped (5099)`.
The type-check lanes, artifact rosters and wide-population families that
the derivation prints outside its total are left to CI.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (left to CI's `Lint UI`)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset. (publishes
nothing: `skip-changeset`)
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmQkvjvcnMCSgLomdvg)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7234f33 commit 00dde01
1 file changed
Lines changed: 46 additions & 65 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 96 | + | |
| 97 | + | |
102 | 98 | | |
103 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
107 | | - | |
108 | | - | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 124 | + | |
130 | 125 | | |
131 | 126 | | |
132 | 127 | | |
133 | 128 | | |
134 | | - | |
| 129 | + | |
135 | 130 | | |
136 | 131 | | |
137 | 132 | | |
| |||
141 | 136 | | |
142 | 137 | | |
143 | 138 | | |
144 | | - | |
| 139 | + | |
145 | 140 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
150 | 147 | | |
151 | | - | |
| 148 | + | |
152 | 149 | | |
153 | 150 | | |
154 | 151 | | |
| |||
287 | 284 | | |
288 | 285 | | |
289 | 286 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | 287 | | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
326 | 299 | | |
| 300 | + | |
327 | 301 | | |
328 | 302 | | |
329 | 303 | | |
| |||
345 | 319 | | |
346 | 320 | | |
347 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
348 | 327 | | |
349 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
350 | 331 | | |
351 | 332 | | |
352 | 333 | | |
| |||
412 | 393 | | |
413 | 394 | | |
414 | 395 | | |
415 | | - | |
| 396 | + | |
416 | 397 | | |
417 | 398 | | |
418 | | - | |
| 399 | + | |
419 | 400 | | |
420 | 401 | | |
421 | 402 | | |
| |||
0 commit comments