Repository navigation
Commit f0ad1f7
fix(app-shell): word the flow closure refusal on the Problems list in the Console's language (#30721)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuMV2VKbhgYbNaU6UB5gnKrv)_
Fixes #30038
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:流程绑定了本软件包不能用的对象时,Studio「问题」列表不再原样显示服务端的英文打包术语,而按服务端给的规则 id
与路径显示中文(或英文)说明:点名对象、说明软件包能用哪些对象、给出两种改法。
- 为什么改:#30038 第 3 项,执行裁决 A(只改 ui,线上形状不动);第 1、2、4 项已随 PR #30148 落地。
- 风险与回滚:只影响这两个规则 id 在三个位置的错误条目;其余条目原样显示。回滚即还原本 PR,无数据或协议影响。
-
先看:`previews/flow-closure-refusal.ts`(新渲染模块),`previews/flow-problems.ts`(接入点一行),`draftVerdict.ts`(保留
`code`)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/metadata-admin/previews/flow-problems.closureRefusal-30038.test.ts`,预期
7/7 通过。
- 需要你做的:无,席位落地。
## What changes
- **New module**
`ui/packages/app-shell/src/views/metadata-admin/previews/flow-closure-refusal.ts`:
`closureRefusalMessage(entry, flow, locale)` words the publish refusal
from the served entry's `code` and item-relative `path`, and only at the
ruling's three positions: `flow-trigger-unknown-object` at
`nodes.N.config.objectName` and `nodes.N.config.timeRelative.object`,
`flow-input-unknown-object` at `variables.N.objectName`. The object name
is read from the flow on screen at that path. Any other code, any other
position, or no name at the path answers `undefined`.
- **`code` threaded through the three ui-internal positions** (ruling
item 3):
- `previews/flow-problems.ts`: `ServerDiagnostic` gains `code?: string`;
`buildFlowProblems` uses the new module for an error-level server entry
and falls back to the served `message` (ruling item 4).
- `draftVerdict.ts`: `verdictPreviewEntries` (and
`verdictEntriesStillShown`, which wraps it) keeps an error's `code`.
Studio's Automations pillar reaches the Problems list through this
function, and its existing `{ ...entry }` spread carries the code on, so
`StudioDesignSurface.tsx` is unchanged.
- `ResourceEditPage.tsx`: `previewDiagnostics` keeps a served error's
`code` on the entries it hands the canvas (it used to drop it).
- **Copy** (ruling item 5): three keys
`engine.flowProblems.closureRefusal.{triggerObject,scanObject,inputObject}`
in `ui/packages/i18n/src/namespaces/studio/en.ts` and `zh.ts`. Those two
are every catalogue the `studio` namespace has. The wording reuses the
Console's existing package vocabulary
(`engine.inspector.objectPicker.outsideReason`). The eager language
packs `ui/packages/i18n/src/locales/*.ts` are not touched, so the
first-screen English pack carries no new bytes. The studio `en`
catalogue is its own chunk (`i18n-ns-studio-en`), and
`ui/scripts/check-eager-closure-budget.mjs` does not budget it.
- One changeset: `@object-ui/app-shell` + `@object-ui/i18n` patch.
The wire shape does not move: no `packages/**` file changes (ruling A).
## Tests
- New `previews/flow-problems.closureRefusal-30038.test.ts` (7 cases).
zh-CN renders Chinese naming the object, at the trigger position. en
renders the studio sentence, not the packaging one. The scan and input
positions render too. An unknown code, or no code, passes through
unchanged. A known code at a position it does not word, at a node with
no name, or under the other rule id passes through. A warning under the
same id passes through. `verdictPreviewEntries` keeps `code` end to end.
- `ResourceEditPage.draftPublishVerdict-26707.test.tsx` gains a
top-level describe that pins the canvas entry carrying the draft
verdict's `code`. The file's harness already serves a coded refusal.
## Acceptance notes
- **Ruling item 2, package id. Deviation, declared.** The sentence says
"this package" (本软件包) and does not print the package id. The Problems
list is built in `buildFlowProblems`, a pure function whose host
(`FlowPreview`, through `MetadataPreviewProps`) receives no package.
Threading one in would widen past the claim's file surface
(`preview-registry.ts`, `FlowPreview.tsx`, `StudioDesignSurface.tsx`),
and the package is the one the Studio page is already showing. If the
seat wants the id printed, that is a follow-up through
`MetadataPreviewProps`.
- **"Did you mean" is not recomputed** (ruling item 2's fallback). The
Problems list has no object catalogue, so the sentence says to pick an
object from the list or to declare a dependency on the package that
defines it.
- **The object name is read from the flow on screen** at the served path
(ruling item 2), not from the judged body. If the author edits the value
before the next verdict read, the sentence names the new value. That is
the staleness every served entry already has until the next read.
- **Advisory warnings are not reworded.** Both rule ids also raise a
no-closure warning with other words. The draft's `_diagnostics` carries
only the publish's refusals in `errors[]` (`withPublishVerdict`), so the
module rewords error entries only.
- **Not reworded on purpose (outside the ruling's "Problems panel"
reach):** `ResourceEditPage`'s diagnostics banner and the SchemaForm
inline issues still show the served English for these entries.
- `MetadataPreviewProps.diagnostics` (`preview-registry.ts`) does not
declare `code` in its element type. The value passes structurally, and
both new pins hold the runtime behaviour. The type line is outside the
file surface.
## Verification
All readings are on head `1f905121` unless noted.
<details><summary>Tests (lock VERDICT command-exit 0)</summary>
`pnpm --dir ui exec vitest run --maxWorkers=2` over
`previews/flow-problems.closureRefusal-30038.test.ts`,
`ResourceEditPage.draftPublishVerdict-26707.test.tsx`,
`draftVerdict.test.ts`, `previews/flow-problems.test.ts` and
`packages/i18n/src/__tests__/studio-namespace.test.ts`: `Test Files 5
passed (5)`, `Tests 52 passed (52)`.
</details>
<details><summary>Ablation, three legs (scripts/ablation-replace.mjs,
each restored: blob == HEAD, git diff HEAD empty)</summary>
The tests import `src` directly, so no `dist/` is involved.
- Leg A: in `flow-problems.ts`, `closureRefusalMessage(diag, { nodes,
variables }, locale)` → `(undefined as string | undefined)`. Result:
`Tests 4 failed | 3 passed (7)`. All four rendering cases went red. The
three pass-through cases stayed green.
- Leg B: in `draftVerdict.ts`, deleted the `code` spread. Result: `Tests
1 failed | 6 passed (7)`, the end-to-end `verdictPreviewEntries` case.
- Leg C: in `ResourceEditPage.tsx`, deleted the `code` spread. Result:
`Tests 1 failed | 3 passed (4)`, the new canvas-`code` case.
- The first tries at legs A, B and C were refused before running,
because the replacement text sat inside the anchor. They were re-run
with a distinct replacement (A) and with `--delete` (B, C).
</details>
<details><summary>Type check</summary>
`pnpm exec turbo run type-check --concurrency=2
--filter=./ui/packages/app-shell --filter=./ui/packages/i18n`: `Tasks:
68 successful, 68 total`. Both packages ran `tsc --noEmit && tsc -p
tsconfig.test.json`. Lock VERDICT command-exit 0.
</details>
<details><summary>Derived gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands` (merge base `4bf9a2d7e`,
9 paths, head `1f905121`): 35 families, each run with its exit code
captured before any pipe, all 35 exit 0. They include `pnpm --dir ui
exec vitest run scripts/` (lock VERDICT command-exit 0),
`check:type-check-debt` (0 raw tsc errors over the ledger),
`check:type-check-coverage`, `check:nul-bytes`, `check:published-files`,
`check:cross-package-test-inputs`, `check:test-source-alias`,
`check-adr-0087-registration`, `check-empty-changeset` and
`check-sdui-manifest`. `--ran` reconciliation: "35 derived famil(ies)
accounted for, 35 run, 0 NOT-MEASURED (a DERIVED zero, all 35 recorded
an exit code and none of them is 3)". The tests, ablation and type check
ran on `ac42ace6`. `1f905121` only adds the changeset, and every source
blob is unchanged. CI check-runs were not awaited.
</details>
<details><summary>Lint (per file, CI owns the repo sweep)</summary>
`npx eslint --no-inline-config` over the 8 changed source files: 3
errors, all in `ResourceEditPage.tsx` at L3444/3577/3600
(`react-hooks/static-components`). The same file on `origin/main`,
through `--stdin`, gives the same 3. None is in this diff's hunks.
</details>
## 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. (Per-file reading above;
the repo sweep is CI's.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request. (Harness-pinned card-thread branch.)
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [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. (Except the 维护者速读
block, which is in Chinese by repo rule.)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgU6Ui5Bf4TtimeCqH2
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgU6Ui5Bf4TtimeCqH2)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a91ad42 commit f0ad1f7
9 files changed
Lines changed: 298 additions & 8 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/views/metadata-admin
- previews
- i18n/src/namespaces/studio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | | - | |
| 908 | + | |
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| 913 | + | |
| 914 | + | |
913 | 915 | | |
914 | 916 | | |
915 | 917 | | |
916 | | - | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
917 | 923 | | |
918 | 924 | | |
919 | 925 | | |
920 | 926 | | |
921 | 927 | | |
922 | | - | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
923 | 934 | | |
924 | 935 | | |
925 | 936 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| |||
188 | 195 | | |
189 | 196 | | |
190 | 197 | | |
191 | | - | |
| 198 | + | |
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 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 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 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 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
| |||
282 | 290 | | |
283 | 291 | | |
284 | 292 | | |
285 | | - | |
| 293 | + | |
| 294 | + | |
286 | 295 | | |
287 | 296 | | |
288 | | - | |
| 297 | + | |
289 | 298 | | |
290 | 299 | | |
291 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4271 | 4271 | | |
4272 | 4272 | | |
4273 | 4273 | | |
| 4274 | + | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
4274 | 4279 | | |
4275 | 4280 | | |
4276 | 4281 | | |
| |||
0 commit comments