Repository navigation
Commit a127a45
feat(console): the first-run checklist shows the built-in AI provider and folds done rows; every not-found page has a way back (#32728)
Part of #32021
Fixes #32157
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 改了什么:首次使用清单新增一行「设置内置 AI」,读取服务端实际在用的 AI 服务商(`GET /api/settings/ai` 的
`live.provider`);清单里已完成的项默认折叠,只留待办;四种「找不到」页面(对象、网址、记录、应用)共用一个组件,每种都有返回路径(返回列表
/ 返回首页)。
- 为什么改:新装私有部署的管理员最先想用内置 AI,清单里却没有这一步;清单占满手机首屏且已完成项占位置;有两种「找不到」页面是死胡同。
- 风险与回滚:只动控制台 UI 与语言包(只增键);服务端未声明 `live` 时不画 AI 这一行,旧服务端行为不变。回滚即还原本 PR。
-
先看:`ui/apps/console/src/pages/settings/firstRunChecklistLogic.ts`(`aiProviderState`:只读
`live`,不读
`values`)、`ui/packages/app-shell/src/components/NotFoundState.tsx`(`BackToHomeButton`
的首页解析)、`ui/apps/console/src/pages/settings/FirstRunChecklist.tsx`(折叠控件)。
- 两分钟验证:`pnpm --dir ui exec vitest run
apps/console/src/pages/settings/__tests__/FirstRunChecklist.test.tsx
packages/app-shell/src/components/__tests__/NotFoundState.test.tsx`,预期全部通过。
- 需要你做的:无,席位落地。
## What changes
**#32021 item 4: the built-in AI on the first-run checklist.** A new
row, "Set up the built-in AI", is read from `live.provider` of `GET
/api/settings/ai`, which landed in #32057. It never reads
`values.provider`, because that only says what was saved, and the
runtime can detect a provider from its boot environment while nothing is
saved. A provider in use makes the row done. The row names the provider
by its option label and says where it came from: "set in Setup", or
"detected from the server environment". With `source: 'none'` the row is
not done and links to Setup → AI & Embedder. A server that does not
state the provider gets no row, because unknown is not unset. Only a
session that may write `ai` reads it. The external assistant row keeps
the wording from PR #32050, and its Home claim is unaffected. Item 4 was
the last open item on #32021: once this merges, the card can close.
The values arrive once the AI runtime fills `registerLiveStatus('ai')`.
That runtime is cloud service-ai, and the carry is recorded on #32052.
On this repository alone `live` is absent, so the row stays out, as
designed.
**#32157: Home crowding.** Rows that are done are folded away. The list
draws the rows still to do. One control under them ("Show completed (N)"
/ "Hide completed", with `aria-expanded` and `aria-controls`) unfolds
the done rows in their place. Every visit starts folded. The progress
count is unchanged.
**#32157: not-found states.** Unknown object, unmatched URL, unknown
record and unknown app now draw through one `NotFoundState`. Each keeps
its own title and cause sentence and offers its own way back first, then
"Back to home":
- unknown object: "Back to home" only (before: no way out);
- unmatched URL: "Go back" and "Back to home";
- unknown record: "Back to OBJECT-LIST", a link to the object's list,
then "Back to home" (before: no way out);
- unknown app: "Retry" and "Back to home".
The app-access-denied screen uses the same button. `BackToHomeButton`
resolves Home with `useHomePath()`'s policy (`resolveDeclaredHomePath`,
else the launcher) against `@object-ui/react`'s metadata context.
Screens that already hold `useHomePath()` pass it as `to`, as every
AppContent screen does. It does not import `useHomePath` itself, because
that module loads the console metadata provider and the metadata client
factory into every view that draws a not-found state. That import broke
18 RecordDetailView harnesses at collection.
New `@object-ui/i18n` keys in all 11 packs (zh-Hant regenerated with
`gen:zh-hant`):
`console.firstRunChecklist.aiProvider.{title,todo,doneSettings,doneEnvironment,action}`,
`console.firstRunChecklist.{showDone,hideDone}`, `empty.backToList`. No
key is removed or renamed.
## Tests
Final head `4b7db52a3`:
- Consumer sweep: every test file in `packages/app-shell/src` and
`apps/console/src` that reaches `RecordDetailView`, `objectViewChrome`,
`ObjectView`, `NotFoundState` or `AppContent`, plus the checklist and
i18n parity tests. 312 files, 2813 tests passed, in 4 chunks under the
shared lock.
- Type-checks: `@object-ui/app-shell`, `@object-ui/console`,
`@object-ui/i18n` `type-check` all exit 0.
<details><summary>Ablations (each via scripts/ablation-replace.mjs on
the committed tree, restored blob == HEAD, git diff HEAD
empty)</summary>
- A1, environment-detected provider treated as not in use:
`FirstRunChecklist.test.tsx` 1 failed / 35 passed ("detected from the
boot environment").
- A2, done rows not folded: `FirstRunChecklist.test.tsx` 2 failed / 34
passed (both fold pins).
- A3, unknown-object state without its Home button:
`NotFoundState.test.tsx` 3 failed / 0 passed.
- A4, record not-found without the list link:
`RecordDetailView.recordReadFailure-11902.test.tsx` 2 failed / 9 passed
(control on the same head: 11/11 passed).
</details>
## Acceptance notes
- The unknown-object title stays "Object Not Found" (title case) beside
"Page not found" / "Record not found". Changing an `en` value reds
`check:i18n-drift` for all ten follower packs, and the claim allows
adding keys only. Noted, not changed.
- The premise reading (the checklist takes about 60% of a 1440×900 first
screen, and all of a 390 px one) was not re-measured in a browser in
this run. NOT MEASURED: no backend stack was built, and the shared lock
was contended. On `origin/main` the code draws every row, done or not,
which is the mechanism #32157 names.
- Existing harnesses touched: `AppContent.noAppComponentRoutes` now
loads `@objectstack/lint` at module top, as `check:test-source-alias`
asks of an edited file. `recordReadFailure-11902` mounts the record page
on the console's record route, so the list link has its app segment.
## Verification
Gates derived by `node scripts/pm/dispatch-gates.mjs --commands` at
`4b7db52a3`, and run locally. Also run: `check:i18n-keys`,
`check:i18n-drift` and `check:i18n-dead-keys` (all exit 0), `pnpm --dir
ui exec vitest run scripts/` (5062 passed, 2 skipped), and `gen:zh-hant`
reports zh-Hant already current. Dogfood battery: n/a (no `!` in the
title, no narrowing arm).
---
_Generated by [Claude
Code](https://claude.ai/code/session_012MmDsRT6hvZsQH9dTzn4CA)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent 19f9053 commit a127a45
23 files changed
Lines changed: 824 additions & 82 deletions
File tree
- .changeset
- ui
- apps/console/src/pages/settings
- __tests__
- packages
- app-shell/src
- components
- __tests__
- console
- __tests__
- views
- i18n/src/locales
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| |||
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
| |||
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
80 | | - | |
| 93 | + | |
81 | 94 | | |
82 | 95 | | |
83 | 96 | | |
| |||
97 | 110 | | |
98 | 111 | | |
99 | 112 | | |
| 113 | + | |
| 114 | + | |
100 | 115 | | |
101 | 116 | | |
102 | 117 | | |
| |||
384 | 399 | | |
385 | 400 | | |
386 | 401 | | |
| 402 | + | |
387 | 403 | | |
388 | 404 | | |
| 405 | + | |
| 406 | + | |
389 | 407 | | |
390 | 408 | | |
391 | 409 | | |
| |||
599 | 617 | | |
600 | 618 | | |
601 | 619 | | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
602 | 651 | | |
603 | 652 | | |
604 | 653 | | |
| |||
665 | 714 | | |
666 | 715 | | |
667 | 716 | | |
668 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
669 | 741 | | |
670 | 742 | | |
671 | 743 | | |
| |||
0 commit comments