Skip to content

Commit ffa6db1

Browse files
fix(console): the publish-health line shows a finding's customer sentence and folds agent text under technical details (#34539)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X4KthxjbE68SmtZYZQBCfuQ)_ Part of #32984 — the console read of ruling 6929121584 (Q1 letter B, parameter 4). The producer side that writes `probes.issues[].userMessage` is #34513. This PR reads the field tolerantly and lands before #34513, so everything below is true on `main` without it: until #34513 lands, no finding carries a `userMessage` and the line shows the generic sentence. Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 改了什么:AI 搭建对话里,发布后的健康提示行不再原样显示写给 AI 的英文检查结果。某条结果带有客户句(`userMessage`,平台的发布检查从 #34513 起开始提供)时,提示行显示这句话。没带时,显示搭建卡已在用的通用提示句(「这次搭建有部分内容需要修复后才能使用……」)。原始的检查文字统一折叠到「技术详情」里。示例数据加载失败也改用语言包里的句子(「示例数据未能加载。」)。首页「全部发布」的提示和 AI 对话里的待发布条,在示例数据加载失败但服务端没给原因时,仍会提示失败,不会误报「全部已上线」。 - 为什么改:维护者裁决 B「出问题的一方写客户句」,界面不再自己维护按错误码翻译的表。 - 风险与回滚:只改这一行的显示方式、两处发布提示判断失败的依据,以及 `publishHealthFromResponse` 读出的字段(新增三个可选字段)。`seedError` 现在只放服务端自己给的文字,可能为空;判断失败要读 `seedFailed`。回滚:revert 本 PR。 - 先看:`ui/packages/plugin-chatbot/src/ChatbotEnhanced.tsx` 的 `PublishHealthLine`,`ui/packages/plugin-chatbot/src/publishHealth.ts`,`ui/packages/app-shell/src/console/ai/PendingDraftsBar.tsx` 的 `seedFailed` 判断。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.needsAttention-32984.test.tsx packages/app-shell/src/console/ai/__tests__/PendingDraftsBar.advisoryReachesAuthor.test.tsx packages/app-shell/src/preview/__tests__/usePublishAllDrafts.refusal-11922.test.tsx`,预期全部通过。 - 需要你做的:无,席位落地。 ## What changes - `publishHealth.ts`: `PublishHealth.issues[]` gains optional `userMessage` and `fix`. Each is read only when it is a non-empty string. `PublishHealth.seedFailed` (optional) marks a failed seed load. `seedError` now holds only the producer's own text, and is absent when the producer sent none. The English 'Sample data failed to load.' the reader used to make up is gone. A seed-loader finding object in `seedApplied.errors[]` now gives its `message`. Before, `String()` turned it into `[object Object]`. - `PublishHealthLine`: a finding with a `userMessage` shows that sentence on the line. Findings without one get a single generic sentence, the same one the draft-issues block uses (`chatbot.build.issuesSummary` when an error is in the set, else `chatbot.build.warningsSummary`). Every finding's `message` (plus its `fix`) and the seed loader's text go under a closed "Technical details" (`chatbot.build.issuesDetails`). A failed seed reads `chatbot.build.health.seedFailed`. - `@object-ui/app-shell` (`usePublishAllDrafts`, `PendingDraftsBar`): both read the failed-seed signal as `seedFailed === true || !!seedError`, the rule `PublishHealthLine` reads, instead of `seedError` alone. With no producer text, the toast detail is the line's own sentence, `t('chatbot.build.health.seedFailed')`: both readers hold the i18n `t`, so no new key and no new English. Before this, a failed seed with no producer text reached them as nothing, and the bar said "All pending changes are live." - `@object-ui/i18n`: one new key, `chatbot.build.health.seedFailed`, in all eleven packs. zh-Hant is generated by `gen:zh-hant`. The existing keys are reused because they fit. - Seed text: `seedApplied.error` carries engine text (for example `seed apply stopped at the seed for object 'x': …`, or `seed apply: no readable seed bodies`), not a customer sentence. So the line always shows the localized seed sentence, and that text appears only under the details. - Changeset: names `@object-ui/app-shell` (patch), the changed reading of `seedError` beside "nothing is removed or renamed", and words the customer sentence as conditional on the producer sending it (#34513). ## Tests - New `describe` in `ChatbotEnhanced.needsAttention-32984.test.tsx` (the shared I18nProvider harness), 6 cases: a finding with a `userMessage` (the sentence is shown, and the agent text and fix appear only in the closed details); one without (zh-Hans generic sentence, agent text only under the details); warnings only; a mixed set; a failed seed in `ja` with loader text kept as a detail; a failed seed with no producer text (zh-Hans sentence, no English, no details). - New top-level `describe` in `usePublishAllDrafts.refusal-11922.test.tsx` (real hook, real health reader): a batch whose `seedApplied` is `success: false` with no `error` and empty `errors` gives one `home.pendingDrafts.seedWarn` warning whose description is `chatbot.build.health.seedFailed`, and no success toast. - New top-level `describe` in `PendingDraftsBar.advisoryReachesAuthor.test.tsx` (real bar, real client, real health reader): the same seed answer gives a "Published, but …" warning naming "Sample data failed to load.", and no success toast. - Existing tests changed by this PR: `ChatbotEnhanced.test.tsx` (round 1) — the existing health cases now assert the new faces, and two new `publishHealthFromResponse` cases cover non-empty-string reads, a loader finding object, and no invented text. No existing test changed in round 2; the two new cases sit in existing harness files. ## Acceptance notes - The toasts of `usePublishAllDrafts` and `PendingDraftsBar` still print engine text and `issues[].message` verbatim, the same class this PR fixes on the line. That is #34553. This PR fixes only the failure signal in those two readers, not their text. - Known and left as is: a voiced error (one with a `userMessage`) beside an unvoiced warning gives the error's sentence and the red face. - The package-less by-reference loop in `usePublishAllDrafts` reads `seedApplied` directly (not through `seedError`) and already reports a failed seed with or without text; it is not changed. ## Verification <details><summary>Round 2 readings (head 266e140, session_01ADHkmRH4UCX1tvddXMS7cq)</summary> - Merged `origin/main` once (merge commit 266e140). Rebuilt the `@objectstack/*` closure of `@object-ui/app-shell` (`turbo run build`, 42/42 tasks) and then its `@object-ui/*` closure (68/68 tasks), each under os-verify-lock, VERDICT command-exit 0. - `vitest run packages/plugin-chatbot/ packages/i18n/` plus the 38 app-shell test files that name `usePublishAllDrafts`, `PendingDraftsBar` or `publishHealthFromResponse`: Test Files 241 passed (241), Tests 3179 passed, 13 skipped. VERDICT command-exit 0. Narrowed: the full app-shell suite (about 2,300 files) is left to Test UI in CI. - `type-check` for app-shell and plugin-chatbot (both tsc programs each, test layer included): VERDICT command-exit 0. - `pnpm --dir ui exec vitest run scripts/` (the i18n key gates, NOT MEASURED in round 1): Test Files 171 passed, 2 skipped (173); Tests 5077 passed, 2 skipped. VERDICT command-exit 0. - Ablation 3 (`scripts/ablation-replace.mjs`): `usePublishAllDrafts` back to `if (health.seedError) {`. The new case failed: 1 failed, 4 passed. Restored: blob equals HEAD (81fa445) and `git diff HEAD` is empty. - Ablation 4: `PendingDraftsBar` back to `const seedFailed = !!health?.seedError;`. The new case failed: 1 failed, 2 passed. Restored: blob equals HEAD (66003c4) and `git diff HEAD` is empty. - Derived gates (`dispatch-gates --commands`, 40) each run with exit codes captured before any pipe: all exit 0. `--ran` reconciliation: 40 derived, 40 run, 0 NOT-MEASURED. </details> <details><summary>Round 1 readings (head 92fc05b)</summary> - Build closure `turbo run build --filter='@object-ui/plugin-chatbot^...' --concurrency=2` under os-verify-lock: 49/49 tasks, VERDICT command-exit 0. - `vitest run packages/plugin-chatbot/ packages/i18n/`: Test Files 203 passed (203), Tests 2912 passed, 13 skipped. Then `type-check` for plugin-chatbot (both tsc programs, test layer included) and i18n. VERDICT command-exit 0 for the chain. - Ablation 1 (`scripts/ablation-replace.mjs`): voice every finding with `userMessage ?? message`. 3 failed, 10 passed. Restored: blob equals HEAD and `git diff HEAD` is empty. - Ablation 2: the seed line prints `seedError ?? 'Sample data failed to load.'`. 2 failed, 11 passed. Restored the same way. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmRH4UCX1tvddXMS7cq <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmRH4UCX1tvddXMS7cq --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent c493adb commit ffa6db1

20 files changed

Lines changed: 371 additions & 44 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@object-ui/plugin-chatbot': patch
3+
'@object-ui/i18n': patch
4+
'@object-ui/app-shell': patch
5+
---
6+
7+
fix(console): the publish-health line shows a finding's customer sentence and folds the agent text under technical details
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: none
11+
12+
The line under a Published badge in the AI build chat printed each runtime finding's `message` as it arrived. That text is written for the agent that repairs the build ('Seed "x" loaded 0 rows … republish the seed'), so the customer read instructions meant for the AI. When the producer of a finding sends a customer sentence (`userMessage`; the platform's publish probes send it from objectstack#34513), the line shows it:
13+
14+
- **A finding with a `userMessage` shows that sentence on the line.** `publishHealthFromResponse` reads `probes.issues[].userMessage`, and `fix`, when each is a non-empty string, onto `PublishHealth.issues[]` (both optional, new).
15+
- **A finding without one shows the generic sentence the draft-issues block already says** (`chatbot.build.issuesSummary` when an error is in the set, else `chatbot.build.warningsSummary`), once for all such findings.
16+
- **The agent text leaves the line.** Every finding's `message` (with its `fix`) and the seed loader's own failure text sit under a closed "Technical details" (`chatbot.build.issuesDetails`), the face the draft-issues block uses.
17+
- **A failed seed says so through the locale pack.** The line reads `chatbot.build.health.seedFailed` ("Sample data failed to load.", new in every pack, zh-Hant generated from zh-Hans) instead of the loader's English. `PublishHealth.seedFailed` (optional, new) marks the failure; `seedError` now holds only the producer's own text and is absent when it sent none, where it used to hold an English sentence the reader made up. A loader finding object in `seedApplied.errors[]` gives its `message` instead of `[object Object]`.
18+
- **The publish-all toast and the AI chat's pending-drafts bar still report a failed seed when the producer sent no text.** Both read the failure from `seedFailed` (as the line does), not from `seedError`; with no producer text, the detail is the line's own sentence (`chatbot.build.health.seedFailed`).
19+
20+
The widening: new optional `PublishHealth` fields (`seedFailed`, `issues[].fix`, `issues[].userMessage`) and one new i18n key (`chatbot.build.health.seedFailed`); nothing is removed or renamed. One reading changes: `seedError` now holds only the producer's own text and can be absent on a failed seed; read `seedFailed` for the failure.

‎ui/packages/app-shell/src/console/ai/PendingDraftsBar.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,19 @@ export function PendingDraftsBar({ packageId, idle }: PendingDraftsBarProps) {
110110
}
111111
const health = publishHealthFromResponse(body);
112112
const problems = (health?.issues ?? []).filter((i) => i.severity === 'error');
113-
if (health?.seedError || problems.length > 0) {
113+
// objectstack#32984 — `seedFailed` is the failure; `seedError` is only
114+
// the producer's own text and is absent when it sent none. The rule the
115+
// chat's publish-health line reads; with no producer text the detail is
116+
// that line's own sentence, from the pack.
117+
const seedFailed = health?.seedFailed === true || !!health?.seedError;
118+
const seedDetail = seedFailed
119+
? health?.seedError || t('chatbot.build.health.seedFailed', { defaultValue: 'Sample data failed to load.' })
120+
: undefined;
121+
if (seedFailed || problems.length > 0) {
114122
toast.warning(
115123
t('console.ai.pendingDrafts.publishedWithFindings', {
116124
defaultValue: 'Published, but the runtime probes reported problems: {{detail}}',
117-
detail: [health?.seedError, ...problems.map((p) => p.message)].filter(Boolean).join('; '),
125+
detail: [seedDetail, ...problems.map((p) => p.message)].filter(Boolean).join('; '),
118126
}),
119127
);
120128
} else {

‎ui/packages/app-shell/src/console/ai/__tests__/PendingDraftsBar.advisoryReachesAuthor.test.tsx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,26 @@ describe('PendingDraftsBar — the server’s advisory reaches the author (objec
175175
expect(toast.warning).not.toHaveBeenCalled();
176176
});
177177
});
178+
179+
// objectstack#32984 — `seedError` holds only the producer's own text and is
180+
// absent when it sent none; `seedFailed` is the failure. A failed seed with no
181+
// text still reads as a failed seed, in the publish-health line's own words,
182+
// never as "All pending changes are live."
183+
describe('PendingDraftsBar — a failed seed the producer sent no text for (objectstack#32984)', () => {
184+
it('warns that the publish found problems, naming the failed sample data', async () => {
185+
batchBody = {
186+
success: true,
187+
data: {
188+
...CLEAN_BATCH.data,
189+
seedApplied: { success: false, inserted: 0, updated: 0, errors: [] },
190+
},
191+
};
192+
await publishFromTheBar();
193+
194+
await waitFor(() => expect(toast.warning).toHaveBeenCalled());
195+
expect(toast.success).not.toHaveBeenCalled();
196+
const [title] = vi.mocked(toast.warning).mock.calls[0] as [string];
197+
expect(title).toMatch(/^Published\b/);
198+
expect(title).toContain('Sample data failed to load.');
199+
});
200+
});

‎ui/packages/app-shell/src/preview/__tests__/usePublishAllDrafts.refusal-11922.test.tsx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,26 @@ describe('control: a published batch reads as before (objectui#11922)', () => {
201201
expect(calls(toast.success)).toEqual(['home.pendingDrafts.published']);
202202
});
203203
});
204+
205+
// objectstack#32984 — `seedError` holds only the producer's own text and is
206+
// absent when it sent none; `seedFailed` is the failure. A failed seed with no
207+
// text still reads as a failed seed, in the publish-health line's own words.
208+
describe('Publish all reports a failed seed the producer sent no text for (objectstack#32984)', () => {
209+
it('warns that sample data failed, with the line’s sentence as the detail', async () => {
210+
batchBody = batch({
211+
outcome: 'published',
212+
publishedCount: 1,
213+
failedCount: 0,
214+
published: [{ type: 'view', name: 'lead_list', version: 'sha256:0' }],
215+
failed: [],
216+
seedApplied: { success: false, inserted: 0, updated: 0, errors: [] },
217+
});
218+
const outcome = await publishAll();
219+
expect(outcome).toEqual({ ok: true, attempted: 2 });
220+
expect(calls(toast.success)).toEqual([]);
221+
const warnings = vi.mocked(toast.warning).mock.calls;
222+
expect(warnings).toHaveLength(1);
223+
expect(warnings[0][0]).toBe('home.pendingDrafts.seedWarn');
224+
expect(warnings[0][1]).toEqual({ description: 'chatbot.build.health.seedFailed' });
225+
});
226+
});

‎ui/packages/app-shell/src/preview/usePublishAllDrafts.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,16 @@ export function usePublishAllDrafts(t: TranslateFn) {
8686
let seededRows = 0;
8787
const recordHealth = (health: PublishHealth | undefined) => {
8888
if (!health) return;
89-
if (health.seedError) seedProblems.push(health.seedError);
89+
// objectstack#32984 — `seedFailed` is the failure; `seedError` is only
90+
// the producer's own text and is absent when it sent none. The rule
91+
// the chat's publish-health line reads. With no producer text the
92+
// toast says the line's own sentence, from the pack.
93+
if (health.seedFailed === true || health.seedError) {
94+
seedProblems.push(
95+
health.seedError ||
96+
t('chatbot.build.health.seedFailed', { defaultValue: 'Sample data failed to load.' }),
97+
);
98+
}
9099
if (typeof health.seededRows === 'number') seededRows += health.seededRows;
91100
for (const issue of health.issues ?? []) {
92101
if (issue.severity === 'error') probeProblems.push(issue.message);

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,6 +4538,7 @@ const ar = {
45384538
seeds_many: "مجموعات بيانات نموذجية: {{count}}",
45394539
seeds_other: "مجموعات بيانات نموذجية: {{count}}",
45404540
verified: "تم التحقق: {{checks}}",
4541+
seedFailed: "تعذّر تحميل البيانات النموذجية.",
45414542
},
45424543
unknownPhase: "مرحلة إنشاء غير معروفة",
45434544
nextStepsLead: "بعد ذلك يمكنك أن تقول: {{steps}}",

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,6 +4165,7 @@ const de = {
41654165
seeds_one: "{{count}} Beispieldatenpaket",
41664166
seeds_other: "{{count}} Beispieldatenpakete",
41674167
verified: "{{checks}} geprüft",
4168+
seedFailed: "Die Beispieldaten konnten nicht geladen werden.",
41684169
},
41694170
unknownPhase: "Unbekannte Build-Phase",
41704171
nextStepsLead: "Als Nächstes können Sie sagen: {{steps}}",

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5096,6 +5096,7 @@ const en = {
50965096
seeds_one: '{{count}} sample data set',
50975097
seeds_other: '{{count}} sample data sets',
50985098
verified: '{{checks}} verified',
5099+
seedFailed: 'Sample data failed to load.',
50995100
},
51005101
unknownPhase: 'Unknown build phase',
51015102
nextStepsLead: 'Next, you can say: {{steps}}',

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,6 +4259,7 @@ const es = {
42594259
seeds_many: "{{count}} de conjuntos de datos de ejemplo",
42604260
seeds_other: "{{count}} conjuntos de datos de ejemplo",
42614261
verified: "Verificado: {{checks}}",
4262+
seedFailed: "No se pudieron cargar los datos de ejemplo.",
42624263
},
42634264
unknownPhase: "Fase de creación desconocida",
42644265
nextStepsLead: "A continuación puede decir: {{steps}}",

‎ui/packages/i18n/src/locales/fr.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4255,6 +4255,7 @@ const fr = {
42554255
seeds_many: "{{count}} de jeux de données d’exemple",
42564256
seeds_other: "{{count}} jeux de données d’exemple",
42574257
verified: "Vérifié : {{checks}}",
4258+
seedFailed: "Les données d’exemple n’ont pas pu être chargées.",
42584259
},
42594260
unknownPhase: "Phase de création inconnue",
42604261
nextStepsLead: "Ensuite, vous pouvez dire : {{steps}}",

0 commit comments

Comments
 (0)