Repository navigation
Commit 7625001
refactor(examples): every named form in the examples is a form item, and the docs teach forms: (#38806)
<!-- claude-projects-attribution: {"github_login":"huangyiirene"} -->
_Requested by **Irene** · [project
thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67xS68ohex7kwSZDDRyKDZGMF)_
Fixes #37088
Clause-②: no
Metadata-protocol: none
Skills-docs: follow-up #37105 — `skills/objectstack-ui` teaching
`forms:` is that card's (seat 3); no `skills/**` file is in this PR
## 维护者速读
- 用户能看到什么变化:示例应用里的表单(CRM 的网站留资表单,showcase 的任务表单、四种布局表单和公开联系表单)都改成独立的
form 条目,名字、分区和翻译都不变;唯一改了对外地址的是 CRM 示例的网站留资表单,从 /forms/contact-us 改为
/forms/web-to-lead(showcase 的联系表单占着 /forms/contact-us,两个 form
条目不能共用一个公开地址,否则把 CRM 示例装进 showcase 环境会被拒);showcase
的四种布局表单各多了一个按钮可以打开(任务列表上两个,任务行上两个)。文档改为教 `forms:`,`views:` 只放列表。
- 为什么做:ADR-0159 把表单定为独立的元数据类型,示例和文档还在教旧写法,照抄的开发者和 AI 会继续写旧形状。
- 出错会怎样:只动示例和文档,不动平台代码;公开表单迁移前后实测都能打开、能提交。dogfood
里「隔离租户下管理员读表单时说明原因」那条断言依赖服务器端修复 #38805,它已合入(PR #38807),本 PR 已合并
main,该用例现在通过。
- 要你做什么:无。
## What changes
Every named form in `examples/` that has a consumer moves from its view
container to a `defineForm` item under the stack's `forms:`, under its
served name. The view containers keep lists only.
- **app-crm**: `crm_lead.web_to_lead` moves from `lead.view.ts`'s
`formViews` to `src/forms/lead.form.ts`, wired in
`objectstack.config.ts`. **Its public address moves from
`/forms/contact-us` to `/forms/web-to-lead`** (claim amendment 6). The
showcase's `showcase_inquiry.contact` keeps `/forms/contact-us`, and two
`form` items may not share one public address: the CRM example's
unmanaged install onto a showcase boot answered `409
FORM_ADDRESS_TAKEN`. That is what dogfood
`install-local-unmanaged-seed-copy` and `install-local-unmanaged-mode`
measured. This is the PR's one served-address change.
- **app-showcase**: `showcase_task.form`, `.tabbed`, `.wizard`,
`.split`, `.quick` move to `src/ui/forms/task.form.ts`;
`showcase_inquiry.contact` (public, `/forms/contact-us`) to
`src/ui/forms/inquiry.form.ts`. They are wired in
`objectstack.config.ts` beside the existing `FeedbackForm`.
- **Four new form actions** (ruling Q0 = A), one consumer per layout
form, all `type: 'form'` on `showcase_task` with `refreshAfter: true`:
- `showcase_new_task_tabbed` "New Task (Tabbed)" →
`showcase_task.tabbed`, at `list`
- `showcase_new_task_wizard` "New Task (Wizard)" →
`showcase_task.wizard`, at `list`
- `showcase_edit_task_tabs` "Edit in Tabs" → `showcase_task.split`, at
`record_row`
- `showcase_quick_edit_task` "Quick Edit" → `showcase_task.quick`, at
`record_row`
- zh-CN labels for all four are added.
- **Translation tail** (D8):
`objects.showcase_inquiry._views.contact.submitBehavior` moves to
`forms['showcase_inquiry.contact'].submitBehavior`.
- **D7 deletions**: no internal record form that nothing opens was left
in the examples (measured empty), so nothing is deleted.
- **Tests re-pointed at the form item** (amendments 2 and 3, no
assertion weakened):
- crm `i18n-sections.test.ts`; showcase `seed.test.ts`,
`coverage.test.ts`, `actions.test.ts`, `author-time-advisories.test.ts`
- `packages/rest/src/public-form-app-crm-byte-equal.test.ts` and
`scripts/cross-package-test-inputs.mjs`
- the four showcase public-form dogfood tests, which now read
`/meta/form/showcase_inquiry.contact`
- **Allow-list** (ruling: lint gap = B):
`author-time-advisories.test.ts` allow-lists six
`view-ref-form-target-missing` and one `field-no-consumers` advisory,
each reason naming #38804 (the lint checks a form action's target
against views only, and its consumer roots miss `forms`). No
`packages/lint` file is in this PR.
- **Docs**: these pages teach `defineForm` / `forms:`, with `views:` as
lists only:
- `ui/forms.mdx`, `ui/public-data-collection.mdx`, `ui/views.mdx`,
`ui/create-vs-edit-form.mdx`
- `protocol/kernel/plugin-spec.mdx`
- `protocol/kernel/i18n-standard.mdx` (form rows only, plus a new
`forms.{form}.sections` row)
- `deployment/cli.mdx` (the ticket-view sentence)
- the `os:check` blocks in `concepts/architecture.mdx` and
`protocol/objectui/index.mdx` (amendment 4)
- **Checklist**: two anchors that named `formViews` are re-pointed at
`InquiryContactForm` and `TaskForm`.
- **Changesets**: one for `@objectstack/example-crm` and one for
`@objectstack/example-showcase`.
## Tests
See Verification.
## Verification
Readings at head `efab27c7b`:
- `pnpm --filter @objectstack/example-showcase test`: 49 files, 547
tests passed. `pnpm --filter @objectstack/example-crm test`: 7 files, 53
tests passed (crm typecheck was also green, earlier on this branch).
- `objectstack validate` on both apps: exit 0, with no
`form-view-internal-not-loaded` and no `form-consumer-less` line.
- `packages/rest/src/public-form-app-crm-byte-equal.test.ts`: passes.
- `@objectstack/lint` tests `validate-translatable-sections`,
`validate-translation-references` and
`validate-page-visualization-bindings`: 341 passed. cli i18n section and
tab coverage: 38 passed.
- Dogfood: the four re-pointed showcase public-form files pass, except
the one known assertion (see Acceptance notes). The other 10 related
public-form and form dogfood files are green untouched.
- `node scripts/check-i18n-bundles.mjs --write` changed nothing, and
`pnpm check:i18n` is OK.
- `pnpm --filter @objectstack/spec check:skill-examples`: 348 examples
type-check, after a `client-react` build.
- `node scripts/check-platform-checklist.mjs` (full and `--changed-from
origin/main`): OK.
- `dispatch-gates --commands`: 118 families. First pass:
- 113 exited 0.
- 2 exited 1, both fixed and re-run to exit 0:
- `check:cross-package-test-inputs`, by the turbo.json input (amendment
5).
- `check:role-word`, by a forms.mdx anchor link.
- 2 exited 3, each re-run to exit 0 once its prerequisite was met:
- `check-plugin-teardown-shape --self-test` (shallow clone).
- `check:dual-build-cjs-loads` (after a full `pnpm build`, run with an 8
GB Node heap).
- `check:turbo-task-graph`, derived after the turbo.json edit, exited 0.
- `--ran` on the record: 118 derived, 116 run, 2 NOT-MEASURED. It reads
the first-pass exit 3 for those two, and their re-runs follow in the
record with exit 0.
- After the address move (head `0fb3615f0`):
- The rest byte-equal test and the crm test suite (7 files / 53 tests)
pass, and crm `validate` exits 0.
- Dogfood `install-local-unmanaged-seed-copy` and
`install-local-unmanaged-mode`: 2 files / 26 tests passed.
- Dogfood `guest-grants-channel`, `showcase-public-form` and the four
re-pointed public-form files: 45 of 46 passed. The one failure is the
known walled-intake case.
- `check:cross-package-test-inputs`: exit 0.
- After merging `origin/main` with #38807 (head `027a4e550`):
- `pnpm install --frozen-lockfile` and a full `pnpm build` exit 0.
- Dogfood: walled-intake, `showcase-public-form`, the redirect,
withdrawal and withdrawal-layers files, and both install-local-unmanaged
files: 7 files / 51 tests passed.
- `dispatch-gates --commands`: 118 families, all exit 0. `--ran`: 118
derived, 118 run, 0 NOT-MEASURED, 0 UNRUN.
## Acceptance notes
- **Walled-intake case, fixed by #38805**:
`packages/qa/dogfood/test/showcase-public-form-walled-intake.dogfood.test.ts`
› "the administrator's read names why" needed the admin read of a `form`
item to carry the walled-posture intake warning. #38805 (PR #38807)
added it at path `sharing`. This PR re-points the expected path from the
view-era `config.sharing` to `sharing` (the assertion and the file's
header comment), and after merging main the case passes. The rest of the
assertion is unchanged.
- **Done-when grep**: `git grep -lE "formViews|viewKind: 'form'" --
examples content/docs ':!**/CHANGELOG.md'`, with references and releases
excluded, returns only migration-describing pages:
- `content/docs/concepts/metadata-lifecycle.mdx` (the
package-less-overlays ceremony's container handling)
- `content/docs/deployment/cli.mdx` (the `os migrate
packageless-overlays` and `os migrate stored-forms` rows)
- `content/docs/deployment/stored-forms-upgrade.mdx` (the upgrade page)
- **`/meta/form` names**: crm `[crm_lead.web_to_lead]` and showcase's 7
names are the same before and after, and none is projected after.
- **Public forms answer before and after**: resolve answers 200 and
submit 201 for the showcase's `/forms/contact-us` and
`/forms/showcase-feedback`, and for the CRM form, now at
`/forms/web-to-lead`.
- The CRM resolve body differs from the fixture taken before the type in
two ways:
- `form.data` (`{provider:'object',object:'crm_lead'}`) is absent,
because a `form` item carries no `data`;
- the address, so `slug` and `form.sharing.publicLink` name
`web-to-lead`.
- The rest byte-equal test pins both differences and asserts every other
byte; `_formDefinedIn` is absent.
- **`feedback.form.ts`**: only its stale comment changed. It pointed at
the inquiry view and now points at `inquiry.form.ts`.
- **Not in this PR**: `content/docs/frontend/plugins/plugin-view.mdx`'s
`form:` hits are the React component's prop, not `defineView` (amendment
4). Prose mentions of `formViews` in checklist step text (as opposed to
anchors) are left as they are.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01J8VVAohb1X5HaLfC572Naz
<!-- signed: repo:objectstack@huangyiirene · huangyiirene ·
session_01J8VVAmaT5PwLmXgonaxjYG -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 47bfc94 commit 7625001
41 files changed
Lines changed: 753 additions & 609 deletions
File tree
- .changeset
- content/docs
- concepts
- deployment
- protocol
- kernel
- objectui
- ui
- docs/qa/platform-checklist/areas
- examples
- app-crm
- src
- forms
- views
- test
- app-showcase
- src
- system/translations
- ui
- actions
- forms
- pages
- views
- test
- packages
- qa/dogfood/test
- rest/src
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| 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 | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1114 | 1114 | | |
1115 | 1115 | | |
1116 | 1116 | | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
| 1117 | + | |
1121 | 1118 | | |
1122 | 1119 | | |
1123 | 1120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1048 | 1050 | | |
1049 | 1051 | | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1053 | 1055 | | |
1054 | 1056 | | |
1055 | 1057 | | |
| |||
1183 | 1185 | | |
1184 | 1186 | | |
1185 | 1187 | | |
1186 | | - | |
1187 | | - | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
1188 | 1191 | | |
1189 | 1192 | | |
1190 | 1193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
320 | | - | |
| 319 | + | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
0 commit comments