Repository navigation
Commit 3e7feed
fix(app-shell): AI chat publish seed warning says the pack sentence, not engine text (#35359)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg6v19uPsX6gX42G8tGcvvzb)_
Fixes #35303
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:在 AI 对话页发布草稿时,如果示例数据(seed)载入失败,警告提示的详情行改为语言包里的那句「示例数据未能加载。」,不再显示
seed 载入器的英文内部报错,也不再显示 `[object Object]`。
- 为什么改:用中文发布的搭建者会在警告下看到英文引擎文本,或在只有逐行错误时看到 `[object Object]`;#32984
的裁决是面向用户的文字只用客户句。首页「全部发布」已由 #35301 改好,这是同族的第二个入口。
- 风险与回滚:只改 `onPublishDrafts`
里警告详情取哪句话,另把引擎文本与错误行原样打到浏览器控制台(`console.warn`);不动接口、语言键和导出。回滚即 revert 本
PR。
-
先看:`ui/packages/app-shell/src/console/ai/AiChatPage.tsx`(`onPublishDrafts`
里 `console.ai.seedWarn` 那一处
toast);`ui/packages/app-shell/src/console/ai/__tests__/AiChatPage.seedWarnPackSentence-35303.test.tsx`;`.changeset/35303-ai-chat-seed-warn-pack-sentence.md`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/console/ai/__tests__/AiChatPage.seedWarnPackSentence-35303.test.tsx`,预期
6 个用例全绿(en 与 zh-Hans 两种语言)。
- 需要你做的:无,席位落地。
## What changes
`AiChatPage`'s `onPublishDrafts` warns `console.ai.seedWarn` when the
publish answers `seedApplied.success === false`. The warning's
description used to be `seedApplied.error` (the seed loader's engine
text), else `String(seedApplied.errors[0])`, which reads `[object
Object]` for a structured `{ row, reason }` row.
The description is now always the pack sentence
`chatbot.build.health.seedFailed`: the sentence the chat's
publish-health line says for the same failure and the one *Publish all*
says since #35301 (objectstack#32984 Q1 ruling: user-facing text is the
customer sentence, never developer or engine text). The engine text and
the error rows go to `console.warn('[app-shell] Published, but the seed
failed to load:', { packageId, error, errors })`, whole, and they still
reach the health line's technical details through
`publishHealthFromResponse`, which this diff does not touch.
The changeset is `patch` on `@object-ui/app-shell`. No locale keys,
props or exports change.
## Tests
New file `AiChatPage.seedWarnPackSentence-35303.test.tsx`, built on the
`publishAdvisoryReachesAuthor` harness (the real handler,
`useMetadataClient` and its client; stubbed `sonner`, `fetch` and the
chat tree reduced to the button that fires `onPublishDrafts`), plus
`I18nProvider` with the shipped `en` and `zh-Hans` packs. Its own file
because `I18nProvider` installs a module-level i18next global, which
would leak into the sibling pin's default-value reads.
- engine-text arm: a batch whose `seedApplied` failed with `error` shows
the pack's `seedWarn` title and `seedFailed` description; the engine
text is absent from the toast and present in the one `console.warn`
line;
- structured-row arm: a batch whose `seedApplied` failed with `errors:
[{ row, reason }]` and no `error` shows the pack sentence, never
`[object Object]`; the row reaches `console.warn` as an object;
- CONTROL: a seed that loaded raises no warning, no seed console line,
and one `publishOk` success toast.
Each case runs in `en` and `zh-Hans` (6 cases).
## Acceptance notes
- Family check: the other `seedApplied` readers under `ui/` are
`usePublishAllDrafts` (fixed by #35301), `publishHealthFromResponse`
(already folds the detail under technical details) and the client's type
declaration; no third toast producer was found.
## Verification
All readings at head `09500fa40c`.
<details><summary>Ablation: the old description restored on disk, 4 red
/ 2 green, then restored</summary>
The fix was committed first (da8a671). `node
scripts/ablation-replace.mjs` replaced the new description with the old
`seedApplied.error ?? String(seedApplied.errors[0])` expression: anchor
1 to 0, replacement 0 to 1, blob af4e13d to a8bb0a93e9. The subject
resolves through source (relative import), so no build sits between the
edit and the run.
```
Expected: "Sample data failed to load."
Received: "seed apply stopped at the seed for object 'crm_task': Reference not found: owner = "ann""
Expected: "示例数据未能加载。"
Received: "[object Object]"
Test Files 1 failed (1)
Tests 4 failed | 2 passed (6)
ablation-replace: ok restored: blob == HEAD (af4e13d) and `git diff HEAD` is empty
```
The 4 failures are the two defect arms in two locales; the 2 passes are
the CONTROL cases.
</details>
<details><summary>Green on the fixed head</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 (new file + publishAdvisoryReachesAuthor)
Test Files 2 passed (2)
Tests 9 passed (9)
os-verify-lock: VERDICT command-exit 0
pnpm --dir ui exec vitest run --maxWorkers=2 (console/ai/__tests__/ + the app-shell census and ratchet files that walk sources + the i18n and plugin-chatbot files that read sources)
Test Files 105 passed (105)
Tests 1182 passed (1182)
os-verify-lock: VERDICT command-exit 0
pnpm --filter @object-ui/app-shell run type-check (both tsc programs; the new test is in tsconfig.test.json's file list)
os-verify-lock: VERDICT command-exit 0
eslint on the two touched source files: 0 errors (27 pre-existing warnings, none in the edited hunk)
```
</details>
<details><summary>Derived gate families (dispatch-gates --commands, 38
families)</summary>
All 38 derived families exited 0, including `pnpm --dir ui exec vitest
run scripts/` (171 files passed, 2 skipped), `check:nul-bytes`,
`check:cross-package-test-inputs`, `check:test-source-alias`,
`check-empty-changeset`, `check-adr-0087-registration`. Reconciliation:
`dispatch-gates --ran` reports 38 derived, 38 run, 0 NOT-MEASURED, 0
UNRUN, all with recorded exit codes. `overlap-check`: merges cleanly
with origin/main. `check:new-line-citations` (ui): 0 new citations.
The full app-shell suite was not run locally; it is left to CI's Test
UI.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c05a8a0 commit 3e7feed
3 files changed
Lines changed: 294 additions & 7 deletions
File tree
- .changeset
- ui/packages/app-shell/src/console/ai
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3206 | 3206 | | |
3207 | 3207 | | |
3208 | 3208 | | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
3209 | 3216 | | |
3210 | 3217 | | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
3211 | 3223 | | |
3212 | 3224 | | |
3213 | | - | |
3214 | | - | |
3215 | | - | |
3216 | | - | |
3217 | | - | |
3218 | | - | |
3219 | | - | |
| 3225 | + | |
3220 | 3226 | | |
3221 | 3227 | | |
3222 | 3228 | | |
| |||
| 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 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 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 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
0 commit comments