Skip to content

Commit 25ac5df

Browse files
docs(getting-started): the Build with Claude Code tutorial lays out its ticket by field groups, not an internal form (#38670)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JeHmqv6CKCkW8ewrPBLekk)_ Fixes #38641 Clause-②: no Metadata-protocol: none ## 维护者速读 - 照着入门教程搭支持台应用的开发者:工单视图里不再写一张平台早已不加载的内部新建/编辑表单,改由工单对象的字段分组决定新建和编辑页面的布局,校验不再报那条警告。 - 属于入门文档纠错:教程教的机制与平台实际行为不一致,AI 会照抄。 - 出错只影响文档与夜间测试,内容可直接撤回;最坏情况是教程又回到旧写法,夜间测试会转红提示。 - 无 ## What changes - `content/docs/getting-started/build-with-claude-code.mdx` - `src/views/ticket.view.ts` drops its `form: { type: 'simple', ... }` block. The platform does not load an internal create/edit form, and `os validate` warned `form-view-internal-not-loaded` on it. - `src/objects/ticket.object.ts` declares `fieldGroups: [{ key: 'ticket', label: 'Ticket', fields: ['subject', 'description', 'priority', 'status'] }]`. This is the group-lists-its-members spelling that the spec names for new metadata (`Field.group` is the older one). The `blank` template's own objects use it too: `packages/create-objectstack/src/templates/blank/src/objects/company.object.ts`, `contact.object.ts` and `article.object.ts`. Its comment says no field is marked `showOnCreate: false`, so the create form asks for all four. No new key; validate passes. - The paragraph that called the form the place where `description` is entered now says how both forms lay a ticket out. The Ticket group's `fields` list places the four fields in the order it lists them, and `showOnCreate` defaults to on. The paragraph also says that `description`'s entry in that list is the only metadata that names it, that the `field-no-consumers` rule credits that placement, and that the run therefore prints no advisory for `description`. - `packages/cli/test/getting-started-build-with-claude-code.e2e.test.ts` gets two assertions. The first checks that the run prints no `form-view-internal-not-loaded`. The second checks that it prints no advisory on the ticket's `description`. The header comment names both checks. Count lines did not move (`4 Objects 22 Fields`, `1 Apps 4 Views 1 Actions`). Read first: (1) the ticket object block in the page, at its `fieldGroups` hunk; (2) the rewritten paragraph after the Resolve action paragraph; (3) the two new `it` blocks at the end of the test. No changeset: the page is not in any package, and the test is outside `@objectstack/cli`'s `files[]` (`dist`, `README.md`, `CHANGELOG.md`). ## Tests At head `7fc986b211`: - `OS_TEST_TIERS=nightly pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 test/getting-started-build-with-claude-code.e2e.test.ts` gave `Test Files 1 passed (1)`, `Tests 7 passed (7)`. - Ablation: put a `form` back into the page's ticket view and drop `description` from the group's `fields` list. That gave `Tests 2 failed | 5 passed (7)`, and the two failures are the new assertions. Restoring with `git checkout HEAD -- PAGE` brought the blob hash back to HEAD's (`06195731`), with a clean `git status`. - `pnpm --filter @objectstack/cli typecheck` exited 0. <details><summary>os validate on the page's files, before / form removed only / after</summary> origin/main 555d699: ```text ⚠ view "support_desk_ticket" · form: ... this internal create/edit form is no longer loaded — create and edit lay the object out by its field groups and follow the rules on its fields rule: form-view-internal-not-loaded at views[0].form ``` Form removed, no field groups: ```text ⚠ object "support_desk_ticket" · field "description": declared, but nothing in this stack displays or reads it (inert; a consumer of the same name on "support_desk_company" does not count) rule: field-no-consumers at objects[3].fields.description ``` This branch at 7fc986b: `✓ Validation passed`, with the same count lines and no advisory at all. Exit 0 in all three runs. </details> ## Acceptance notes - Step 2's prompt still asks for "a form for entering tickets". The agent answers that with field groups, as the rewritten paragraph explains, so the user-facing prompt is unchanged. ## Verification Two-minute check: `OS_TEST_TIERS=nightly pnpm --filter @objectstack/cli exec vitest run test/getting-started-build-with-claude-code.e2e.test.ts` should print `Tests 7 passed (7)`. <details><summary>Local gates</summary> `dispatch-gates --commands` derived 83 commands. 81 exited 0. Two exited 3 with PREREQUISITE NOT MET, because they read the dist of packages outside this card's build closure, and are left to CI: `check:skill-examples` and `check:dual-build-cjs-loads`. `dispatch-gates --ran` printed `83 derived famil(ies) accounted for — 81 run, 2 NOT-MEASURED`. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B <!-- signed: repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0124851 commit 25ac5df

2 files changed

Lines changed: 34 additions & 17 deletions

File tree

‎content/docs/getting-started/build-with-claude-code.mdx‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ export const Ticket = ObjectSchema.create({
158158
}),
159159
},
160160

161+
// The create and edit forms lay a ticket out by these groups: one section,
162+
// its fields in the order its `fields` list gives. No field is marked
163+
// `showOnCreate: false`, so the create form asks for all four.
164+
fieldGroups: [
165+
{ key: 'ticket', label: 'Ticket', fields: ['subject', 'description', 'priority', 'status'] },
166+
],
167+
161168
sharingModel: 'private', // org-wide default (OWD) — required by the security gate
162169
enable: { apiEnabled: true, searchable: true },
163170
});
@@ -212,17 +219,6 @@ export const TicketViews = defineView({
212219
sort: [{ field: 'priority', order: 'desc' }],
213220
},
214221
},
215-
form: {
216-
type: 'simple',
217-
data,
218-
sections: [
219-
{
220-
name: 'ticket',
221-
label: 'Ticket',
222-
fields: [{ field: 'subject' }, { field: 'description' }, { field: 'priority' }, { field: 'status' }],
223-
},
224-
],
225-
},
226222
});
227223
```
228224

@@ -306,11 +302,17 @@ passes an unregistered one, the `os dev` boot log warns
306302
fails when clicked (the
307303
[two paths](/docs/ui/actions#give-it-server-behavior--two-paths) a handler takes).
308304

309-
The view file also declares the create and edit **form**, and the form is where the
310-
long-text `description` is entered and shown. The list columns leave it out, so the
311-
form is the only metadata that names it. A field that no consumer names (a view, a form, a
312-
flow, a formula or an action, among the others the rule counts) gets an advisory
313-
`field-no-consumers` warning from `os validate`.
305+
The view file declares lists only: no file declares a create or edit **form**.
306+
Both forms lay a ticket out by the object's `fieldGroups`: the one **Ticket**
307+
group's `fields` list places the four fields in that section, in the order it
308+
lists them. No field is marked `showOnCreate: false`, so the create form asks
309+
for all four, the long-text `description` among them. The list columns leave
310+
`description` out, so its entry in the group's `fields` list is the only
311+
metadata that names it, and that placement counts as a consumer: a field that
312+
no consumer names (a view column, a field group, a flow, a formula or an
313+
action, among the others the rule counts) gets an advisory
314+
`field-no-consumers` warning from `os validate`, and the run below prints none
315+
for `description`.
314316

315317
The agent also **exports each new file from its directory's barrel**: one line
316318
at the end of each of the three `index.ts` files, beside the lines the starter

‎packages/cli/test/getting-started-build-with-claude-code.e2e.test.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
* Asserted beside the run: every new file is exported by a barrel line the page
3434
* shows, in its own directory's `index.ts` (the page's rule that metadata
3535
* exists only if its barrel exports it). Exit statuses and count lines are
36-
* asserted; prose is not pinned.
36+
* asserted; prose is not pinned. Two advisories are asserted absent, by rule
37+
* id: `form-view-internal-not-loaded` (the page's files declare no internal
38+
* create/edit form, which the platform does not load) and `field-no-consumers`
39+
* on the ticket's `description` (the page says its field group is the
40+
* consumer that names it).
3741
*
3842
* The `Runtime:` line is not compared. The project here is not installed (it
3943
* lives under this package's `node_modules`, so its imports resolve to
@@ -221,4 +225,15 @@ describe('the page, followed verbatim in a fresh `blank` scaffold', () => {
221225
const printed = validate.stdout.split('\n').filter((l) => COUNT_LINE.test(l)).map(fold);
222226
for (const line of countLines) expect(printed, out(validate)).toContain(line);
223227
});
228+
229+
it('prints no `form-view-internal-not-loaded`: the page declares no internal create/edit form', () => {
230+
expect(out(validate)).not.toContain('form-view-internal-not-loaded');
231+
});
232+
233+
it("prints no `field-no-consumers` for the ticket's `description`: its field group names it", () => {
234+
const advisories = out(validate)
235+
.split('\n')
236+
.filter((l) => l.includes('field "description"') && l.includes('support_desk_ticket'));
237+
expect(advisories, out(validate)).toEqual([]);
238+
});
224239
});

0 commit comments

Comments
 (0)