Skip to content

Commit 9571f5e

Browse files
committed
test(ui): the ui script suites read the renamed packs and the converter's twin
A doc link and a test comment named the old zh.ts path; they name zh-Hans.ts. The nested-layout drift case pinned that a pack missing at the base throws; under the follower rule only en does, and a follower the base lacks reads as empty and is named, so the case pins both. The lint-rule-coverage ledger declares the converter's declaration twin, packages/i18n/scripts/zh-hant.d.mts, beside the two script twins it already declares, and its tests accept an objectstack card on a row. Claude-Session: https://claude.ai/code/session_01L6bhgThgWPADcpU1xXCBsw Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9070a29 commit 9571f5e

5 files changed

Lines changed: 43 additions & 15 deletions

File tree

‎ui/packages/app-shell/src/console/home/__tests__/HomeItemTypeLabel.parity.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ vi.mock('react-router-dom', () => ({
4141
* One translator for all three surfaces.
4242
*
4343
* The keyed entry is spelled in zh (verbatim from
44-
* `packages/i18n/src/locales/zh.ts`) on purpose: `capitalizeFirst` could
44+
* `packages/i18n/src/locales/zh-Hans.ts`) on purpose: `capitalizeFirst` could
4545
* never produce `报表`, so the keyed control below cannot pass by accidentally
4646
* running the fallback. Anything not in this map misses, exactly as i18next
4747
* misses an absent key, and the call site's `defaultValue` decides.

‎ui/packages/plugin-gantt/docs/verification/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Two fixes landed here:
337337
(the browser was `zh-CN`) — now they always match.
338338
2. **The central locale packs were completed.** `@object-ui/i18n`'s built-in
339339
`gantt:` namespace ([`en.ts`](../../../i18n/src/locales/en.ts),
340-
[`zh.ts`](../../../i18n/src/locales/zh.ts)) was stale — it predated Phases
340+
[`zh-Hans.ts`](../../../i18n/src/locales/zh-Hans.ts)) was stale — it predated Phases
341341
4–6, so apps on `I18nProvider` rendered **raw keys** (e.g.
342342
`gantt.viewMode.day`, `gantt.toolbar.criticalPath`) for the newer
343343
toolbar / view-mode / menu strings. The namespace now mirrors the plugin's

‎ui/scripts/__tests__/check-lint-rule-coverage.test.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -587,14 +587,20 @@ describe('this repository', () => {
587587
expect(row.vacuousMatches.length, `ledger row '${row.glob}' declares nothing any more`).toBeGreaterThan(0);
588588
expect(row.ruleBearingMatches, `ledger row '${row.glob}' over-claims`).toEqual([]);
589589
}
590-
// Predicate 2, same two properties. Its population is three files today --
590+
// Predicate 2, same two properties. Its population is four files today --
591591
// the vitest config objectui#8337 was filed about, and the declaration twins
592-
// `scripts/ui-root.d.mts` and `scripts/workspace-root.d.mts` that package
593-
// tests (compiled with `allowJs: false`) need to import those helpers typed
594-
// (objectstack#25685, objectui#13472, objectstack#25723) -- and a green here
595-
// means all three are DECLARED rather than invisible.
592+
// `scripts/ui-root.d.mts`, `scripts/workspace-root.d.mts` and
593+
// `packages/i18n/scripts/zh-hant.d.mts` that package tests (compiled with
594+
// `allowJs: false`) need to import those modules typed (objectstack#25685,
595+
// objectui#13472, objectstack#25723, objectstack#30511) -- and a green here
596+
// means all four are DECLARED rather than invisible.
596597
expect(extensionProbeCollapse(result.reach)).toBeNull();
597-
expect(result.unreached).toEqual(['scripts/ui-root.d.mts', 'scripts/workspace-root.d.mts', 'vitest.config.mts']);
598+
expect(result.unreached).toEqual([
599+
'packages/i18n/scripts/zh-hant.d.mts',
600+
'scripts/ui-root.d.mts',
601+
'scripts/workspace-root.d.mts',
602+
'vitest.config.mts',
603+
]);
598604
// objectui#8369: this run is only a reading of the tree git tracks if the
599605
// filter was there and could answer both ways.
600606
expect(result.git.available).toBe(true);
@@ -648,7 +654,7 @@ describe('this repository', () => {
648654
for (const row of VACUOUS_GROUPS) {
649655
expect(row.glob, 'a row must be a glob').toBeTruthy();
650656
expect(row.reason.length, `row '${row.glob}' needs a reason, not a bare glob`).toBeGreaterThan(40);
651-
expect(row.card, `row '${row.glob}' must name the card that owns it`).toMatch(/objectui#\d+/);
657+
expect(row.card, `row '${row.glob}' must name the card that owns it`).toMatch(/(objectui|objectstack)#\d+/);
652658
}
653659
// Rows are globs on purpose -- a per-path ledger of this population would be
654660
// over a hundred rows that nobody would ever shrink.
@@ -659,7 +665,7 @@ describe('this repository', () => {
659665
expect(UNREACHED_GROUPS.length).toBeGreaterThan(0);
660666
for (const row of UNREACHED_GROUPS) {
661667
expect(row.reason.length, `row '${row.glob}' needs a reason, not a bare path`).toBeGreaterThan(40);
662-
expect(row.card, `row '${row.glob}' must name the card that owns it`).toMatch(/objectui#\d+/);
668+
expect(row.card, `row '${row.glob}' must name the card that owns it`).toMatch(/(objectui|objectstack)#\d+/);
663669
// The asymmetry with VACUOUS_GROUPS, pinned because it is deliberate: a
664670
// `**/*.mts` row would waive the next `.mts` file, which is the only
665671
// thing this predicate exists to catch.

‎ui/scripts/__tests__/git-paths-nested-layout.test.ts‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function layout(prefix: string): { tree: string; base: string; head: string } {
7474
}
7575

7676
describe('check:i18n-drift over the change that IMPORTS the tree (objectstack#25728)', () => {
77-
it('reads an empty before side when the tree does not exist at the base, and still throws when only a pack is missing', () => {
77+
it('reads an empty before side when the tree does not exist at the base, and still throws when only the en pack is missing', () => {
7878
const repo = fs.mkdtempSync(path.join(os.tmpdir(), 'git-paths-import-'));
7979
tempRoots.push(repo);
8080
const git = (...args: string[]) => execFileSync('git', args, { cwd: repo, encoding: 'utf8' }).trim();
@@ -103,12 +103,23 @@ describe('check:i18n-drift over the change that IMPORTS the tree (objectstack#25
103103
expect(result.findings).toEqual([]);
104104
expect(result.counters.addedEnKeys).toBe(1);
105105

106-
// The tree exists at the base but a pack does not: a broken input, never an empty side.
106+
// The tree exists at the base but `en` does not: a broken input, never an
107+
// empty side.
108+
fs.rmSync(path.join(tree, packPath('en')));
109+
git('add', '-A');
110+
git('commit', '-q', '-m', 'lose the en pack');
111+
const lostEn = git('rev-parse', 'HEAD');
112+
expect(() => analyze(tree, { base: lostEn, head: imported })).toThrow(/cannot read/);
113+
114+
// A follower pack the base does not have is a language the platform locale
115+
// table gained (objectstack#30511): it reads as empty there, and is named.
116+
git('checkout', '-q', imported, '--', '.');
107117
fs.rmSync(path.join(tree, packPath('ja')));
108118
git('add', '-A');
109-
git('commit', '-q', '-m', 'lose a pack');
110-
const lost = git('rev-parse', 'HEAD');
111-
expect(() => analyze(tree, { base: lost, head: imported })).toThrow(/cannot read/);
119+
git('commit', '-q', '-m', 'a base without the ja pack');
120+
const noJa = git('rev-parse', 'HEAD');
121+
const gained = analyze(tree, { base: noJa, head: imported });
122+
expect(gained.newAtBase).toEqual(['ja']);
112123
});
113124
});
114125

‎ui/scripts/check-lint-rule-coverage.mjs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,17 @@ export const UNREACHED_GROUPS = [
623623
'does not take.',
624624
card: 'objectui#13472',
625625
},
626+
{
627+
glob: 'packages/i18n/scripts/zh-hant.d.mts',
628+
reason:
629+
'The hand-written declaration twin of `packages/i18n/scripts/zh-hant.mjs`, the converter that generates ' +
630+
'the Traditional Chinese pack; the package test `src/__tests__/zh-hant-generated.test.ts` (compiled with ' +
631+
'`allowJs: false`) imports it typed through this twin and pins the twin\'s names to the module\'s real ' +
632+
'exports. It holds `export declare` lines and no executable code. Declared rather than repaired for the ' +
633+
'same reason as the rows above: reaching a `.d.mts` means widening a rule-bearing `files` glob to ' +
634+
'`.mts`, a rule STRENGTH decision this gate reports and does not take.',
635+
card: 'objectstack#30511',
636+
},
626637
];
627638

628639
/**

0 commit comments

Comments
 (0)