Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 7fed09d

Browse files
fix(app-shell,components,console): the three remaining select placeholders read their locale key, not a hard-coded English "Select…" (objectui#11252) (#11279)
Fixes #11252 Clause-②: no ## What changed The last three product selects that fell back to a hard-coded English `Select…` now read a locale key. No key was added and no dependency edge was added. The en text is unchanged at all three. - `packages/app-shell/src/views/metadata-admin/datasource/DatasourceResourcePage.tsx`: an `enum` driver-config property with no value (the named producer is the Turso driver's optional `mode`) shows `t('engine.form.selectEllipsis', locale)` from Studio's own table, with `locale` from `useMetadataLocale()`. This is the word `SchemaForm`'s enum selects and `InspectorComboField` already show. The page imports `t` from `../i18n.js`, inside the `metadata-admin/` scope that `check:i18n-keys` classifies as the local table. - `packages/components/src/custom/config-field-renderer.tsx`: the select arm's `field.placeholder ?? 'Select…'` is now `field.placeholder ?? t('common.select')`, through a `createSafeTranslation` defaults map (`common.select` set to `Select…`). This is the path the sibling `config-panel-renderer.tsx` uses for its footer: a published primitive with provider-less consumers. The hook sits above the `visibleWhen` early return. An author-supplied `placeholder` still wins, verbatim. - `apps/console/src/pages/settings/SettingsField.tsx`: the closed select's placeholder is `t('common.select', { defaultValue: 'Select…' })`, with `t` from `useObjectTranslation()`. This is the shape PR objectui#11250 used for `ScreenView`. It is also the console's documented idiom for app screens: `SettingsView`'s objectui#4024 comment records `useObjectTranslation` rather than `createSafeTranslation` for this directory. It is safe the same way: a provider-less mount answers the inline en default, never the raw key. `@object-ui/console` already declares `@object-ui/i18n`. - `.changeset/11252-select-placeholders-i18n.md`: patch for `@object-ui/app-shell`, `@object-ui/components` and `@object-ui/console`. ## Pins - One per site, each under `zh-CN` and `en`. Each asserts the key's identity: what the bound instance or the Studio table answers. A guard proves the zh answer is neither the en word nor the raw key. Each also has a CONTROL case, where a set value or a declared default renders instead of the placeholder. - `packages/app-shell/src/views/metadata-admin/datasource/DatasourceResourcePage.selectPlaceholderLocale-11252.test.tsx`. It drives the real page against a faked authenticated fetch that serves a Turso-shaped catalog: `url`, plus an optional `mode` enum with no default. It clicks "New datasource" and reads the `mode` trigger. - `packages/components/src/__tests__/config-field-select-placeholder-i18n-11252.test.tsx`. This one also pins that an author-supplied placeholder still wins under zh-CN. - `packages/components/src/__tests__/config-field-select-placeholder-no-provider-11252.test.tsx` is the provider-less leg of the defaults map. It is its own file because `createI18n` registers a module-global instance that outlives `cleanup()`, the convention `config-panel-footer-no-provider-4750.test.tsx` already follows. - `apps/console/src/pages/settings/__tests__/SettingsField.selectPlaceholderLocale-11252.test.tsx`. - The enumeration pin: `packages/app-shell/src/__tests__/select-placeholder-literal-11252.test.ts`. - It walks `packages/` and `apps/`, skipping tests, and parses only files that contain `Select` followed by an ellipsis (the U+2026 glyph or three full stops). - It classifies each string, template and JSX-text token with the TypeScript AST. Comments are trivia, so prose is never read as code. - Allowed positions: a locale pack row, a row under a dotted translation key, and the `defaultValue` of a translation call's options object. Anything else is an offender. - Lit control: each offender shape is planted in memory and must be found by the same classifier. The shapes are a JSX attribute, `??` and `||` fallbacks, JSX text, a `placeholder:` property (ASCII spelling), a template, and a pack-shaped row outside the packs. The allowed shapes and comments must not be flagged. - Population control: the tree scan must see a pack row, a table row and an inline default. ## Measurements (the PM's mechanism assumptions, re-measured at `7d074baae`) 1. **Confirmed.** Hard-coded `Select…` sits at exactly the three sites: the datasource page's enum `SelectValue`, `ConfigFieldRenderer`'s select fallback, and `SettingsField`'s closed select. Every other occurrence in product source is a translation-table row, `ScreenView`'s inline default, or a comment. The enumeration pin now re-derives this; no count is copied here. 2. **Confirmed.** `common.select` is defined in all ten built-in packs (ar, de, en, es, fr, ja, ko, pt, ru, zh). `engine.form.selectEllipsis` has an en row and a zh row in Studio's table, and `check:i18n-designer-parity` is green. 3. The dispatch's test lead `packages/components/src/custom/` holds no test files. The component's pins sit where the package keeps its config-panel pins, `packages/components/src/__tests__/`. ## Tests (final head `88a1f2d52`) - Targeted union, run on `88a1f2d52` with `pnpm exec vitest run` (repo root, verbose): `Test Files 34 passed (34)`, `Tests 629 passed (629)`. It covered: - the datasource directory; - `packages/app-shell/src/__tests__/`, which includes `spec-symbol-parity`, a reader of the page; - `scripts/__tests__/spec-symbol-ledger-app-shell-7265.test.ts`; - `apps/console/src/pages/settings/`; - the five components `config-panel` / `config-field` pins; - plugin-dashboard's four `ConfigPanel*` suites, the only in-tree mounts of `ConfigFieldRenderer` besides `ConfigPanelRenderer`. - The five new files alone: `Test Files 5 passed (5)`, `Tests 16 passed (16)`. - Ablations, each through objectstack's `scripts/ablation-replace.mjs`. In every case the anchor hit 1→0, the blob moved, and the restore was proven (`blob == HEAD`, `git diff HEAD` empty). The pins resolve their subjects through `src/` (vitest alias and relative imports), so no `dist/` leg applies. - A1: the datasource literal restored. `2 failed | 14 passed (16)`: the datasource zh case and the enumeration pin's "finds no offender", which named that file. - A2: the `ConfigFieldRenderer` literal restored. `2 failed | 14 passed`: the components zh case and the enumeration pin. - A3: the `SettingsField` literal restored. `2 failed | 14 passed`: the settings zh case and the enumeration pin. - A4: the `common.select` row deleted from the new defaults map. `1 failed | 15 passed`: only the provider-less leg. - Gate reach: changing the `SettingsField` inline default makes `check:i18n-keys` exit 1 with `[default-value-drift] common.select` on `SettingsField.tsx`. Changing the new defaults row makes it exit 1 with `[factory-default-drift] common.select (FIELD_DEFAULT_TRANSLATIONS)`. The gate reads both new call sites. - Build and type-check. `pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build` (29 packages) passed. So did app-shell plus the five remaining plugins of `@object-ui/console^...`. Then `pnpm --filter PKG type-check` exited 0 for `@object-ui/components`, `@object-ui/app-shell` and `@object-ui/console`. Each config's resolved file list contains the new test files: app-shell and components through `tsconfig.test.json`, console through `tsconfig.json`. - Gates, all exit 0: `check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys`, `check:i18n-designer-parity`, `check:control-bytes`, `check:new-line-citations` (0 new citations), `check:test-path-roots`, `check:phantom-deps`, `check-changeset-presence` (8 source files of 3 released packages, 1 changeset). - `eslint` on the 8 changed ts/tsx files, with the repo config the package `lint` scripts use: exit 0, 0 errors. The 9 warnings all sit on lines this branch did not add. - The changeset is markdown, so `node scripts/markdown-test-inputs.mjs --audit` was run (exit 0), and so was the root `scripts/__tests__/` suite on `88a1f2d52`: `177 passed | 2 skipped (179)`, `Tests 5371 passed | 2 skipped`. - Declared narrowing: the whole `packages/components/` and `packages/app-shell/` suites were not run locally. They are CI's. Each changed product file's in-tree importers were enumerated with `git grep`, and their suites are in the targeted union above: - the datasource page is imported only by its `register.ts`; - `ConfigFieldRenderer` only by `ConfigPanelRenderer`; - `SettingsField` only by `SettingsView`. ## Acceptance notes These were observed and not filed. None has a measured public door or a named producer beyond this card. No carrier is known for any of them (承接者:无). - `DatasourceResourcePage` carries other English copy: the driver select's "Choose a driver", the schema-mode labels, the status chips and the toasts. That is a page-level family, recorded as the precedent PR did. This card closes only the `Select…` family. - The console's `useSettingsLabel` exposes a `fieldPlaceholder` helper that no arm of `SettingsField` calls, and the console's settings `Specifier` type declares no `placeholder`. This is dead code, not a contract gap. - Studio's zh word for this slot (`engine.form.selectEllipsis`) differs from the zh pack's `common.select`. Each surface reads its own existing key, per the triage direction. Session: `https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec` --- _Generated by [Claude Code](https://claude.ai/code/session_011p7ikEivgXefNDaE5S5Uec)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b4333ab commit 7fed09d

9 files changed

Lines changed: 606 additions & 3 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/components': patch
4+
'@object-ui/console': patch
5+
---
6+
7+
fix(app-shell,components,console): the three remaining select placeholders show the locale's own "Select…" word (objectui#11252)
8+
9+
Three selects with no value fell back to a hard-coded English `Select…`, so they read English under every locale, beside otherwise localized copy:
10+
11+
- Studio's datasource dialog (`DatasourceResourcePage`): an `enum` property in a driver's config form with no value, such as the Turso driver's optional `mode`. It now shows Studio's own `engine.form.selectEllipsis`, the word Studio's other enum selects already show, in the designer's language.
12+
- `ConfigFieldRenderer` in `@object-ui/components`: a `select` field with no `placeholder`. It now reads the shared `common.select` key. A host with no `I18nProvider` still sees `Select…`, never the raw key. An author-supplied `placeholder` still renders verbatim.
13+
- The console settings page (`SettingsField`): a closed `select` with no value. It now reads `common.select`, with `Select…` as the en default.
14+
15+
The en text is unchanged at all three. No locale key was added.

‎apps/console/src/pages/settings/SettingsField.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
Badge,
2929
Button,
3030
} from '@object-ui/components';
31+
import { useObjectTranslation } from '@object-ui/i18n';
3132
import { ChevronRight, Info } from 'lucide-react';
3233
import { getIcon } from '../../utils/getIcon';
3334
import { EnvLockBadge } from './EnvLockBadge';
@@ -225,6 +226,7 @@ function DomainCombobox({
225226
export function SettingsField(props: SettingsFieldProps) {
226227
const { spec, resolved, value, onChange, onAction, locked, saving, labels, error } = props;
227228
const id = useId();
229+
const { t } = useObjectTranslation();
228230
const disabled = Boolean(locked || saving);
229231
const literalLabel = resolveLabel(spec.label);
230232
// Field-scoped label/help/placeholder/option resolution. Falls back to the
@@ -452,7 +454,10 @@ export function SettingsField(props: SettingsFieldProps) {
452454
disabled={disabled}
453455
>
454456
<SelectTrigger id={id}>
455-
<SelectValue placeholder="Select…" />
457+
{/* No value yet ⇒ the locale's `common.select`, with its en word as
458+
the inline default so a provider-less mount never shows the
459+
raw key (objectui#11252). */}
460+
<SelectValue placeholder={t('common.select', { defaultValue: 'Select…' })} />
456461
</SelectTrigger>
457462
<SelectContent>
458463
{spec.options?.map((opt) => (
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* SettingsField — a closed `select` with no value shows the locale's
11+
* `common.select`, not an English literal (objectui#11252).
12+
*
13+
* The closed dropdown (a `select` specifier WITHOUT `valueDomain`) drew
14+
* `SelectValue placeholder="Select…"`, so an unset key read English under every
15+
* locale. It now reads the shared `common.select` key, so this file asserts the
16+
* key's IDENTITY — what the bound instance answers — and guards that the zh and
17+
* en answers really differ.
18+
*/
19+
20+
import { describe, it, expect, vi, afterEach } from 'vitest';
21+
import { render, screen, cleanup } from '@testing-library/react';
22+
import { createI18n, I18nProvider } from '@object-ui/i18n';
23+
24+
import { SettingsField } from '../SettingsField';
25+
import type { Specifier } from '../types';
26+
27+
afterEach(cleanup);
28+
29+
/** A closed select: exhaustive `options`, no `valueDomain`, no default. */
30+
const PROVIDER: Specifier = {
31+
type: 'select',
32+
key: 'provider',
33+
label: 'Provider',
34+
options: [
35+
{ value: 'smtp', label: 'SMTP' },
36+
{ value: 'ses', label: 'Amazon SES' },
37+
],
38+
};
39+
40+
/** Mount under a provider in `language`; returns the bound instance. */
41+
function renderIn(language: string, value: unknown = undefined) {
42+
const instance = createI18n({ defaultLanguage: language, detectBrowserLanguage: false });
43+
render(
44+
<I18nProvider instance={instance} persistLanguage={false}>
45+
<SettingsField spec={PROVIDER} value={value} onChange={vi.fn()} />
46+
</I18nProvider>,
47+
);
48+
return instance;
49+
}
50+
51+
describe('objectui#11252 — an unset closed settings select reads `common.select`', () => {
52+
it('under zh-CN, the placeholder is the zh pack\'s `common.select`, not the en word', () => {
53+
const zh = renderIn('zh-CN');
54+
const zhWord = zh.t('common.select');
55+
const enWord = zh.getFixedT('en')('common.select');
56+
57+
// The pin is only a pin if the two packs disagree.
58+
expect(zhWord).not.toBe(enWord);
59+
expect(zhWord).not.toBe('common.select');
60+
expect(screen.getByRole('combobox')).toHaveTextContent(zhWord);
61+
expect(screen.getByRole('combobox')).not.toHaveTextContent(enWord);
62+
});
63+
64+
it('under en, the placeholder is the en pack\'s `common.select`', () => {
65+
const en = renderIn('en');
66+
expect(screen.getByRole('combobox')).toHaveTextContent(en.t('common.select'));
67+
});
68+
69+
it('CONTROL — a set value renders its option label, not the placeholder', () => {
70+
const zh = renderIn('zh-CN', 'ses');
71+
expect(screen.getByRole('combobox')).toHaveTextContent('Amazon SES');
72+
expect(screen.getByRole('combobox')).not.toHaveTextContent(zh.t('common.select'));
73+
});
74+
});
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* objectui#11252 — product source carries no hard-coded English `Select…`
5+
* placeholder. This is the family-closing pin.
6+
*
7+
* The family: a select whose placeholder was the English literal `Select…`, so
8+
* it read English under every locale. objectui#11220 (PR objectui#11250) fixed
9+
* the flow screen's `ScreenView`; objectui#11252 fixed the last three
10+
* (Studio's datasource config form, `ConfigFieldRenderer`, and the console's
11+
* `SettingsField`). Each site now reads a locale key. This file keeps the
12+
* literal from coming back anywhere in `packages/` or `apps/`.
13+
*
14+
* ## What counts as the literal, and where it is allowed
15+
*
16+
* `Select` followed by an ellipsis, either the U+2026 glyph or three full
17+
* stops. It may appear in product source only as translation VOCABULARY:
18+
*
19+
* - `pack-row`: a value in a built-in locale pack (`packages/i18n/src/locales/`);
20+
* - `table-row`: a value under a dotted translation key in a fallback table
21+
* (`'common.select': …` in a `createSafeTranslation` defaults map, or a row
22+
* of Studio's `metadata-admin/i18n.ts` table);
23+
* - `inline-default`: the `defaultValue` of a translation call's options
24+
* object (`t('common.select', { defaultValue: … })`).
25+
*
26+
* Anywhere else it is an offender: a JSX attribute or text, a `??` / `||`
27+
* fallback, an object property such as `placeholder:`, a template.
28+
*
29+
* ## Why the TypeScript scanner and not a regex
30+
*
31+
* The literal also appears in PROSE (comments that describe the placeholder).
32+
* The classifier reads only string, template and JSX-text tokens from the
33+
* TypeScript AST. Comments are trivia to that scanner, so prose is never read
34+
* as code and no comment stripper can drop real code from the scan. Only files
35+
* that contain the literal at all are parsed.
36+
*
37+
* ## Controls
38+
*
39+
* - Lit control: every offender shape is planted in memory and must be found
40+
* by the same classifier the tree scan uses; the allowed shapes and the
41+
* prose must not be.
42+
* - Population control: the tree scan must SEE the vocabulary (a pack row, a
43+
* table row and an inline default). A walk that read nothing, or a
44+
* classifier that saw nothing, cannot pass it.
45+
*
46+
* Tests are not product source and are skipped (this file plants the literal on
47+
* purpose).
48+
*/
49+
50+
import { describe, it, expect } from 'vitest';
51+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
52+
import { join, relative, sep } from 'node:path';
53+
import ts from 'typescript';
54+
55+
/**
56+
* The repo root, derived from THIS file's own location, never from
57+
* `process.cwd()` (AGENTS.md; the spelling `common-search-retired-4392.test.ts`
58+
* uses).
59+
*/
60+
const SELF_DEPTH_BELOW_REPO_ROOT = 5; // packages / app-shell / src / __tests__ / this file
61+
const REPO_ROOT = decodeURIComponent(new URL(import.meta.url).pathname)
62+
.split('/')
63+
.slice(0, -SELF_DEPTH_BELOW_REPO_ROOT)
64+
.join('/');
65+
66+
const SCAN_ROOTS = ['packages', 'apps'];
67+
68+
/** `Select` then an ellipsis: the U+2026 glyph or three full stops. */
69+
const LITERAL = /Select(?:…|\.\.\.)/;
70+
71+
const SKIP_DIRS = new Set([
72+
'node_modules', 'dist', 'build', 'coverage',
73+
'__tests__', '__mocks__', 'test', 'tests', 'e2e',
74+
]);
75+
const SOURCE_FILE = /\.(?:tsx?|jsx?|mts|cts|mjs|cjs)$/;
76+
const NOT_PRODUCT = /\.d\.ts$|\.(?:test|spec|stories)\.[cm]?[jt]sx?$/;
77+
const PACK_DIR = 'packages/i18n/src/locales/';
78+
79+
type Kind = 'pack-row' | 'table-row' | 'inline-default' | 'offender';
80+
interface Hit {
81+
file: string;
82+
line: number;
83+
kind: Kind;
84+
text: string;
85+
}
86+
87+
function scriptKindOf(fileName: string): ts.ScriptKind {
88+
if (fileName.endsWith('.tsx')) return ts.ScriptKind.TSX;
89+
if (fileName.endsWith('.jsx')) return ts.ScriptKind.JSX;
90+
if (/\.[cm]?js$/.test(fileName)) return ts.ScriptKind.JS;
91+
return ts.ScriptKind.TS;
92+
}
93+
94+
function propertyNameText(name: ts.PropertyName): string | undefined {
95+
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) return name.text;
96+
return undefined;
97+
}
98+
99+
/** Where one literal-bearing token sits: vocabulary, or an offender. */
100+
function classify(node: ts.Node, file: string): Kind {
101+
const parent = node.parent;
102+
if (!parent || !ts.isPropertyAssignment(parent) || parent.initializer !== node) return 'offender';
103+
const key = propertyNameText(parent.name);
104+
if (file.startsWith(PACK_DIR)) return 'pack-row';
105+
if (ts.isStringLiteral(parent.name) && parent.name.text.includes('.')) return 'table-row';
106+
if (key === 'defaultValue') {
107+
const options = parent.parent;
108+
if (ts.isObjectLiteralExpression(options) && options.parent && ts.isCallExpression(options.parent)) {
109+
return 'inline-default';
110+
}
111+
}
112+
return 'offender';
113+
}
114+
115+
/** Every string / template / JSX-text token carrying the literal, classified. */
116+
function scanSource(file: string, text: string): Hit[] {
117+
if (!LITERAL.test(text)) return [];
118+
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, scriptKindOf(file));
119+
const hits: Hit[] = [];
120+
const visit = (node: ts.Node) => {
121+
if (
122+
(ts.isStringLiteral(node) ||
123+
ts.isNoSubstitutionTemplateLiteral(node) ||
124+
ts.isTemplateHead(node) ||
125+
ts.isTemplateMiddle(node) ||
126+
ts.isTemplateTail(node) ||
127+
ts.isJsxText(node)) &&
128+
LITERAL.test(node.text)
129+
) {
130+
const line = source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1;
131+
hits.push({ file, line, kind: classify(node, file), text: node.getText(source).trim() });
132+
}
133+
ts.forEachChild(node, visit);
134+
};
135+
visit(source);
136+
return hits;
137+
}
138+
139+
function scanTree(): { filesRead: number; hits: Hit[] } {
140+
let filesRead = 0;
141+
const hits: Hit[] = [];
142+
const walk = (dir: string) => {
143+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
144+
if (entry.name.startsWith('.')) continue;
145+
const full = join(dir, entry.name);
146+
if (entry.isDirectory()) {
147+
if (!SKIP_DIRS.has(entry.name)) walk(full);
148+
continue;
149+
}
150+
if (!SOURCE_FILE.test(entry.name) || NOT_PRODUCT.test(entry.name)) continue;
151+
filesRead += 1;
152+
const rel = relative(REPO_ROOT, full).split(sep).join('/');
153+
hits.push(...scanSource(rel, readFileSync(full, 'utf8')));
154+
}
155+
};
156+
for (const root of SCAN_ROOTS) {
157+
const abs = join(REPO_ROOT, root);
158+
expect(existsSync(abs), `scan root missing: ${abs}`).toBe(true);
159+
walk(abs);
160+
}
161+
return { filesRead, hits };
162+
}
163+
164+
const offendersIn = (file: string, text: string) =>
165+
scanSource(file, text).filter((h) => h.kind === 'offender');
166+
167+
describe('objectui#11252 — the literal scanner (lit control)', () => {
168+
it('finds every planted offender shape', () => {
169+
const planted: Array<[string, string]> = [
170+
['a.tsx', '<SelectValue placeholder="Select…" />'],
171+
['b.tsx', "<SelectValue placeholder={field.placeholder ?? 'Select…'} />"],
172+
['c.tsx', "<SelectValue placeholder={field.placeholder || 'Select…'} />"],
173+
['d.tsx', 'const el = <span>Select…</span>;'],
174+
['e.ts', "const field = { type: 'select', placeholder: 'Select...' };"],
175+
['f.ts', 'const p = `Select… ${hint}`;'],
176+
// A pack-shaped row OUTSIDE the packs is not vocabulary.
177+
['packages/x/src/labels.ts', "export default { common: { select: 'Select…' } };"],
178+
];
179+
for (const [file, text] of planted) {
180+
expect(offendersIn(file, text), `planted in ${file}: ${text}`).toHaveLength(1);
181+
}
182+
});
183+
184+
it('leaves the vocabulary and the prose alone', () => {
185+
expect(scanSource('g.tsx', "t('common.select', { defaultValue: 'Select…' });").map((h) => h.kind))
186+
.toEqual(['inline-default']);
187+
expect(scanSource('h.ts', "const D = { 'common.select': 'Select…' };").map((h) => h.kind))
188+
.toEqual(['table-row']);
189+
expect(scanSource(`${PACK_DIR}xx.ts`, "export default { common: { select: 'Select…' } };").map((h) => h.kind))
190+
.toEqual(['pack-row']);
191+
// Prose is trivia: no token at all, so no hit of any kind.
192+
expect(scanSource('i.tsx', '// the bare "Select…" placeholder\n/** a "Select..." button */\nconst x = 1;'))
193+
.toEqual([]);
194+
});
195+
});
196+
197+
describe('objectui#11252 — product source carries no hard-coded `Select…` placeholder', () => {
198+
let tree: ReturnType<typeof scanTree> | undefined;
199+
const scanned = () => (tree ??= scanTree());
200+
201+
it('the walk reaches the vocabulary (population control)', () => {
202+
const { filesRead, hits } = scanned();
203+
expect(filesRead).toBeGreaterThan(0);
204+
const seen = new Set(hits.map((h) => h.kind));
205+
expect(seen.has('pack-row'), 'no locale pack row seen: the walk missed packages/i18n').toBe(true);
206+
expect(seen.has('table-row'), 'no fallback-table row seen').toBe(true);
207+
expect(seen.has('inline-default'), 'no inline translation default seen').toBe(true);
208+
});
209+
210+
it('finds no offender', () => {
211+
const offenders = scanned()
212+
.hits
213+
.filter((h) => h.kind === 'offender')
214+
.map((h) => `${h.file}:${h.line} ${h.text}`);
215+
expect(
216+
offenders,
217+
'A hard-coded English "Select…" is back in product source. Read a locale key ' +
218+
'instead: `common.select` through the package\'s translation hook (with its en ' +
219+
'word as the inline `defaultValue` or in a `createSafeTranslation` defaults map), ' +
220+
'or `engine.form.selectEllipsis` inside Studio (objectui#11252).',
221+
).toEqual([]);
222+
});
223+
});

0 commit comments

Comments
 (0)