Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions content/docs/getting-started/build-with-claude-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ export const Ticket = ObjectSchema.create({
}),
},

// The create and edit forms lay a ticket out by these groups: one section,
// its fields in the order its `fields` list gives. No field is marked
// `showOnCreate: false`, so the create form asks for all four.
fieldGroups: [
{ key: 'ticket', label: 'Ticket', fields: ['subject', 'description', 'priority', 'status'] },
],

sharingModel: 'private', // org-wide default (OWD) — required by the security gate
enable: { apiEnabled: true, searchable: true },
});
Expand Down Expand Up @@ -212,17 +219,6 @@ export const TicketViews = defineView({
sort: [{ field: 'priority', order: 'desc' }],
},
},
form: {
type: 'simple',
data,
sections: [
{
name: 'ticket',
label: 'Ticket',
fields: [{ field: 'subject' }, { field: 'description' }, { field: 'priority' }, { field: 'status' }],
},
],
},
});
```

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

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

The agent also **exports each new file from its directory's barrel**: one line
at the end of each of the three `index.ts` files, beside the lines the starter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
* Asserted beside the run: every new file is exported by a barrel line the page
* shows, in its own directory's `index.ts` (the page's rule that metadata
* exists only if its barrel exports it). Exit statuses and count lines are
* asserted; prose is not pinned.
* asserted; prose is not pinned. Two advisories are asserted absent, by rule
* id: `form-view-internal-not-loaded` (the page's files declare no internal
* create/edit form, which the platform does not load) and `field-no-consumers`
* on the ticket's `description` (the page says its field group is the
* consumer that names it).
*
* The `Runtime:` line is not compared. The project here is not installed (it
* lives under this package's `node_modules`, so its imports resolve to
Expand Down Expand Up @@ -221,4 +225,15 @@ describe('the page, followed verbatim in a fresh `blank` scaffold', () => {
const printed = validate.stdout.split('\n').filter((l) => COUNT_LINE.test(l)).map(fold);
for (const line of countLines) expect(printed, out(validate)).toContain(line);
});

it('prints no `form-view-internal-not-loaded`: the page declares no internal create/edit form', () => {
expect(out(validate)).not.toContain('form-view-internal-not-loaded');
});

it("prints no `field-no-consumers` for the ticket's `description`: its field group names it", () => {
const advisories = out(validate)
.split('\n')
.filter((l) => l.includes('field "description"') && l.includes('support_desk_ticket'));
expect(advisories, out(validate)).toEqual([]);
});
});
Loading