Skip to content

Commit 8eef9a8

Browse files
test(app-shell): flowCanvasChip-11665 awaits the lazy studio zh catalogue before reading the tooltip (#26800)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ81VujgxVnz75EwAiFbgNpow)_ Fixes #26692 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:Studio 自动化画布标题条的测试 `flowCanvasChip-11665`,在模块作用域先 `await loadStudioCatalogue('zh')`,再跑用例;只改测试,不动源码。另修 `metadata-admin/inspectors/inspectorStrings.i18n-10804` 同类竞态(#26780 把 flowNode 文案移入 studio 懒加载包后暴露)。 - 为什么改:zh 用例只等了标题条出现,就同步读提示文字「API 名称」;这行文案在按需加载的 studio 中文包里,包没到时读到英文,Test UI 随机变红(CI run 40506346595)。 - 风险与回滚:两个测试文件各加 6 行,不发布任何包;回滚即还原这两个文件。 - 先看:`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.flowCanvasChip-11665.test.tsx` 第 27–32 行。 - 两分钟验证:在仓根跑 `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface.flowCanvasChip-11665.test.tsx`,应见 4 passed。 - 需要你做的:无,席位落地。 ## What changes The zh case of `StudioDesignSurface.flowCanvasChip-11665.test.tsx` awaited only `findByTestId('auto-canvas-caption')` and then asserted the chip's `title` synchronously. That title is `designer.field.apiName`, a row of the `studio` i18n namespace, whose zh catalogue is a lazy `import()`. If the chunk had not landed, the title was still the en row, so `Test UI` could go red on any PR whose shard ran this file. The test now loads the catalogue at module scope (`await loadStudioCatalogue('zh')`), the same shape the other studio-namespace zh tests in app-shell already use (for example `CelTestRunDialog.i18n-10862.test.tsx`, `BuilderLanding.environmentOverlayCopy-12171.test.ts`). The cost moves into the import phase, outside any test or hook timeout, per `ui/AGENTS.md` test discipline. No sleep, no retry wrapper, no quarantine. `inspectorStrings.i18n-10804.test.tsx` gets the same preload. #26780 (#25922 S2) moved `engine.inspector.flowNode.*` into the lazy `studio` namespace, and that test's `zhRow()` reads `t(key, 'zh-CN')` synchronously, so `Test UI (3/16)` went red twice on `8dd8c259` (`flowNode.kind` read as `Node`). ## Why Triage ruling 6444153925: the test awaits the catalogue. Of the two spellings the dispatch order offered (top-level preload, or `findBy`/`waitFor` on the title), this PR picks the top-level preload: it is the established pattern in this package, and it waits on the catalogue itself rather than on an RTL budget the loader can still overrun. ## Tests Deterministic proof at head `d3202677` (merge base `c8583f80`), under the shared verify lock. The studio zh loader (`ui/packages/i18n/src/namespaces/studio/index.ts`) was delayed 4000 ms through `scripts/ablation-replace.mjs`; every mutation was restored (blob equals HEAD, `git diff HEAD` empty). | Leg | Fixes | zh loader | Result | |---|---|---|---| | 0 | both kept | normal | Tests 25 passed (25) | | A | both kept | delayed 4000 ms | Tests 25 passed (25) | | B1 | 10804 preload removed | delayed 4000 ms | 3 failed, 18 passed (the CI failure: `flowNode.kind` zh read as `Node`) | | B2 | flowCanvasChip preload removed | delayed 4000 ms | 1 failed, 3 passed (the card's failure: `API name` vs `API 名称`) | ## Acceptance notes - Sweep, measured not read: with the studio zh loader delayed 4000 ms, all 259 app-shell test files that name zh without the preload ran (2634 tests); only `inspectorStrings.i18n-10804` went red. The seat's 8 other heuristic candidates (three `FlowNodeInspector` tests, `datasetPickers.authorText-11161`, `FlowPreview.removeNode-11772`, `flow-problems.removalRefusal-11838`, `previewStrings.i18n-10848`, `metadataError.heldWidget-11910`) stayed green and are dropped: they compare the DOM with `t()` in the same tick, so a slow chunk leaves both sides en. - No changeset: `@object-ui/app-shell` is private and only a test file changed (`skip-changeset`). ## Verification Gate families derived by `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at `d3202677` (merge base `c8583f80`; 24 derived, 24 run, all exit 0), each run locally with exits captured before any pipe and reconciled with `--ran`; readings are in the os-dev report on #26692. Repo-wide scans (`pnpm lint`, the full `Test UI` matrix) are CI's. ## 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. (CI) - [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) - [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. (the maintainer summary is in Chinese by the dispatch contract) - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbXwuDiqzYUyEfANmtM --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbXwuDiqzYUyEfANmtM)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 019f26e commit 8eef9a8

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/inspectorStrings.i18n-10804.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ import * as React from 'react';
4747
import { describe, it, expect, vi, afterEach } from 'vitest';
4848
import { render, screen, cleanup, fireEvent, act, within } from '@testing-library/react';
4949
import { I18nProvider } from '@object-ui/i18n';
50+
// The `engine.inspector.flowNode.*` rows live in `@object-ui/i18n`'s `studio`
51+
// namespace (#25922 slice S2), whose `zh` catalogue is fetched on demand.
52+
// Resident before any case, so `zhRow` reads the zh row, never the en fallback
53+
// while the chunk is in flight (objectstack#26692).
54+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
55+
await loadStudioCatalogue('zh');
5056

5157
// Every roster in these inspectors comes through the shared metadata client
5258
// (stable identity, like the real memoized client). Nothing here needs a

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.flowCanvasChip-11665.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2424
import { render, screen, cleanup } from '@testing-library/react';
2525
import { MemoryRouter } from 'react-router-dom';
2626
import { I18nProvider } from '@object-ui/i18n';
27+
// The chip's tooltip row (`designer.field.apiName`) lives in `@object-ui/i18n`'s
28+
// `studio` namespace, whose `zh` catalogue is fetched on demand. Resident before
29+
// any case, so the zh tooltip is read after the catalogue lands, never racing it
30+
// (objectstack#26692).
31+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
32+
await loadStudioCatalogue('zh');
2733

2834
const PKG = 'com.acme.app';
2935
const API_NAME = 'nightly_digest';

0 commit comments

Comments
 (0)