Repository navigation
Commit c76fa97
committed
test(i18n,app-shell): discover the createSafeTranslation defaults tables instead of hand-listing three (objectui#7884)
The rule "every row names a key the en pack actually defines" is the one rule in
this repo that rejects a defaults row whose key no locale pack defines. It did
not miss objectui#7874's five dead `timeline.relative.*` rows because it was
wrong -- it never saw them: its `MAPS` was a hand-written list of three IMPORTED
maps, and `TIMELINE_DEFAULT_TRANSLATIONS` was not on it.
Measured: the three-map list judged 400 of 1056 rows (37.9%). It was also
structurally incompletable by its own mechanism -- 11 of the 32 factory call
sites pass an anonymous inline object literal exported under no name at all, so
no list of imports could ever reach them.
The AST walk that discovers these tables already existed, module-private inside
`fallback-placeholder-spelling-3512.test.ts`. It is MOVED, not copied, into
`@object-ui/test-support`, so both gates ask their different questions of one
definition of the population instead of two that drift apart.
Behaviour of the objectui#3512 gate is preserved, verified on one tree either
side of the move: 35 discovery entries, 1072 rows, 0 unreadable, the same 4
needle files, and an identical sha256 over every row
(f7910279e114cd6e1bf1d2b97bf7164661283cd9fbb5eef88286f2f75bea8065).
The scanner is reached as a DECLARED subpath, `@object-ui/test-support/
defaults-table-scan`, and NOT from the package index. It reads the workspace
from disk, so it only type-checks where Node's ambient types are present, and a
barrel re-export puts a module into the program of every consumer that imports
the index for anything at all. Measured with it on the index: `data-objectstack`
imports `{ enumOptions }` from that index in one test, so `tsc -p
packages/data-objectstack/tsconfig.json --listFiles` pulled this file into that
package's program and the repo-wide type-check failed with three TS2591s in a
file that package never asked for. `./zod-wrapper-keys` is the same escape hatch
for the mirror case, and objectui#4325's lesson is untouched: the hazard there
was an UNDECLARED deep path, TS2882 for `tsc`; this one is in `exports`.
One spelling also had to change. The walk skips `__tests__` directories, which is
why the needle could be a single literal while it lived in one; in a normal
`src/` module a verbatim spelling makes the scanner match its own source and
report itself as a fifth interpolator. It is assembled from fragments now, with
the runtime value unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbJQ1y1J12nZxYzFWhP8Q31 parent d9580f4 commit c76fa97
9 files changed
Lines changed: 630 additions & 288 deletions
File tree
- .changeset
- packages
- app-shell/src/__tests__
- i18n
- src/__tests__
- test-support
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 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 | + | |
12 | 52 | | |
13 | 53 | | |
14 | 54 | | |
| |||
75 | 115 | | |
76 | 116 | | |
77 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
78 | 121 | | |
79 | 122 | | |
80 | 123 | | |
| |||
89 | 132 | | |
90 | 133 | | |
91 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
92 | 162 | | |
93 | 163 | | |
94 | 164 | | |
| |||
237 | 307 | | |
238 | 308 | | |
239 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
0 commit comments