Repository navigation
Expand file tree
/
Copy pathobjects-fields-relationships.json
More file actions
520 lines (520 loc) · 36.4 KB
/
Copy pathobjects-fields-relationships.json
File metadata and controls
520 lines (520 loc) · 36.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
{
"skill_name": "objectstack-data",
"evals": [
{
"id": 1,
"prompt": "Create `src/objects/vendor.object.ts` for our vendors: company name, contact email, a status (Active / Inactive), the API key we use to call their system, and the password for their supplier portal. None of the project's files are in this directory: write the file in your answer.",
"expected_output": "Emits `ObjectSchema.create({...})` with a snake_case `name`, an authored `sharingModel` (a publish with none is refused), `label` / `pluralLabel` / `icon`, `nameField`, and fields with snake_case keys and camelCase config properties: `text` (required), `email`, a `select` whose `options` carry lowercase `value`s (`active`, `inactive`), and BOTH credentials as `type: 'secret'` (encrypted at rest) — never `type: 'password'`, which is plaintext at rest on a generic object. No `namespace` or `tableName` key.",
"files": [],
"assertions": {
"must_contain": [
"ObjectSchema.create",
"sharingModel",
"type: 'secret'",
"options",
"nameField"
],
"must_not_contain": [
"{ type: 'password'",
"namespace:",
"vendorName"
]
}
},
{
"id": 2,
"prompt": "Model invoices with line items, and let invoices be tagged with many tags where each tagging records who added it and when. A rep who owns a line item but can only read the invoice may still correct that line.",
"expected_output": "Line items: `invoice_line` with a `master_detail` field to `invoice`, `required: true`, `deleteBehavior: 'cascade'` (or `'restrict'` — `set_null` is refused on master_detail), and a `summary` roll-up field on the parent. Tagging carries attributes, so it is a junction object (`invoice_tag`) with two `lookup` fields plus `added_by` / `added_at` — not a `multiple: true` lookup (an array of ids) and not a `many_to_many` type, which does not exist. The line object is `sharingModel: 'controlled_by_parent'` with `sharing: { controlledByParent: { ownerMayEdit: true } }` (by-id update only; every other write still needs master edit). `added_by` is `type: 'user'` — never a `lookup` to a `user` object, which does not exist.",
"files": [],
"assertions": {
"must_contain": [
"master_detail",
"deleteBehavior",
"summary",
"lookup",
"ownerMayEdit",
"type: 'user'"
],
"must_not_contain": [
"type: 'many_to_many'",
"deleteBehavior: 'set_null'",
"reference: 'user'"
]
}
},
{
"id": 3,
"prompt": "On `employee`: email must be unique within each organization, `status` may only move draft → active → terminated, and a `contract_end` earlier than `contract_start` must be rejected.",
"expected_output": "Uniqueness is an index, not a validation type: `indexes: [{ fields: ['email'], unique: 'organization' }]` (the scope is stated; `type` / `partial` are retired). The lifecycle is one `state_machine` validation with `field: 'status'`, `transitions: { draft: ['active'], active: ['terminated'], terminated: [] }`, `initialStates: ['draft']` and a `message` — `transitions` governs only UPDATE, so publish refuses a machine that runs on insert without it (`state-machine-no-initial-states`). The date rule is a `script` validation (inverted: fails when the expression is true) or `cross_field`, written as bare CEL over `record.` with explicit `!= null` guards.",
"files": [],
"assertions": {
"must_contain": [
"unique: 'organization'",
"state_machine",
"transitions",
"initialStates",
"record.",
"!= null"
],
"must_not_contain": [
"type: 'unique'",
"partial:"
]
}
},
{
"id": 4,
"prompt": "On `invoice`, `paid_at` should only appear — and become mandatory — once the status is `paid`, and `total` must lock after payment.",
"expected_output": "Declares the rules on the FIELD definitions (they belong to the data model, so every form and API write honours them): `visibleWhen: P`record.status == 'paid'``, `requiredWhen: P`record.status == 'paid'`` on `paid_at`, and `readonlyWhen: P`record.status == 'paid'`` on `total`. Bare CEL with `record.` — never brace-wrapped, never Salesforce syntax, never the removed `conditionalRequired` alias, and not in a form view.",
"files": [],
"assertions": {
"must_contain": [
"visibleWhen",
"requiredWhen",
"readonlyWhen",
"record.status"
],
"must_not_contain": [
"conditionalRequired:",
"{record."
]
}
},
{
"id": 5,
"prompt": "We installed HotCRM (`hotcrm`, namespace `crm`). Add a `region` field to its `crm_account` object for our own use, without touching HotCRM's source.",
"expected_output": "An object extension authored in HotCRM's paired customization package `hotcrm.custom` (never a replacement of the object, never an edit of HotCRM itself): `defineObjectExtension({ extend: 'crm_account', fields: { region__c: Field.text({ label: 'Region' }) } })` registered in that stack's `objectExtensions`. The field name ends in `__c` because the suffix is reserved to the pair; an unsuffixed field in a `.custom` extension is refused at save, publish, install, `os validate` and `os build`. A change to one of HotCRM's own fields goes through `fieldPatches` (display properties only), and the object takes no `overrides` declaration.",
"files": [],
"assertions": {
"must_contain": [
"hotcrm.custom",
"defineObjectExtension",
"extend: 'crm_account'",
"region__c"
],
"must_not_contain": [
"overrides:",
"name: 'crm_account'"
]
}
},
{
"id": 6,
"prompt": "On `ticket`, `reviewer` is the lead who signs it off and must always be set; deleting that lead's user account must be blocked while they still review tickets. `watchers` is several users, and a deleted user should just drop out of the list.",
"expected_output": "Both are `type: 'user'` fields, each with an authored `deleteBehavior` — a `user` field joins the referential delete walk only when it declares one. `reviewer`: `required: true` with `deleteBehavior: 'restrict'` (deleting a named reviewer is refused with `409 DELETE_RESTRICTED`; `set_null` on a required field would refuse too). `watchers`: `multiple: true` with `deleteBehavior: 'set_null'` (only the deleted member is removed; an emptied set is `[]`). Neither is a `lookup` to a `user` object, which does not exist, and a `user` field with no `deleteBehavior` keeps the deleted user's id.",
"files": [],
"assertions": {
"must_contain": [
"type: 'user'",
"deleteBehavior: 'restrict'",
"deleteBehavior: 'set_null'",
"multiple: true",
"required: true"
],
"must_not_contain": [
"reference: 'user'",
"deleteBehavior: 'cascade'"
]
}
},
{
"id": 7,
"prompt": "We installed HotCRM (`hotcrm`, namespace `crm`). Its `crm_account` object's `industry` field should read \"Sector\" instead of \"Industry\" for our users, without touching HotCRM's source.",
"expected_output": "An object extension in HotCRM's paired customization package `hotcrm.custom`, registered in that stack's `objectExtensions`: `defineObjectExtension({ extend: 'crm_account', fieldPatches: { industry: { label: 'Sector' } } })`. A patch carries display keys only (`label`, `description`, `inlineHelpText`, `placeholder`); the field's type, values and rules stay HotCRM's, so its upgrades still reach it, and a key the tenant edited keeps the tenant's text. Never redeclare `industry` in `fields`: that takes the field over whole and cuts it off from the owner's upgrades, and an unsuffixed field in a `.custom` extension is refused anyway. An option's label rides the same patch keyed by the option's stored `value` only for a field that declares its own `options`; HotCRM's `industry` takes its options from the `industry` picklist, and a `picklist`-bound field's options are never patchable, so no `options` entry belongs on this patch. A patch naming a field or option value the target lacks is refused at install and by `os validate`.",
"files": [],
"assertions": {
"must_contain": [
"hotcrm.custom",
"defineObjectExtension",
"extend: 'crm_account'",
"fieldPatches",
"label: 'Sector'"
],
"must_not_contain": [
"industry: Field.",
"overrides:",
"name: 'crm_account'"
]
}
},
{
"id": 8,
"prompt": "Model a `project` and its `milestone` rows; a milestone belongs to exactly one project and is deleted with it. Give me both object files.",
"expected_output": "Two complete `ObjectSchema.create` calls, each with an authored `sharingModel` (a publish without one is refused with `security-owd-unset`): `project` with `sharingModel: 'private'`, `milestone` with `sharingModel: 'controlled_by_parent'` and a `master_detail` field to `project` with `deleteBehavior: 'cascade'`.",
"files": [],
"assertions": {
"must_contain": [
"ObjectSchema.create",
"sharingModel: 'private'",
"sharingModel: 'controlled_by_parent'",
"master_detail",
"deleteBehavior: 'cascade'"
],
"must_not_contain": [
"many_to_many",
"deleteBehavior: 'set_null'"
]
}
},
{
"id": 9,
"prompt": "Our app runs multi-tenant. Add an index on `ticket` for the list every agent opens: their organization's open tickets, newest first. None of the project's files are in this directory: write the change in your answer.",
"expected_output": "`indexes: [{ fields: ['organization_id', 'status', 'created_at'] }]` — the tenant column is `organization_id`, injected by `systemFields.tenant`, so it is indexed but not declared as a field; an index naming an undeclared `tenant_id` is refused. The platform already adds the single-column `organization_id` index on a multi-tenant host.",
"files": [],
"assertions": {
"must_contain": [
"indexes",
"organization_id"
],
"must_not_contain": []
}
},
{
"id": 10,
"prompt": "给 `task` 加一个「是否完成」字段,设成必填,免得有人忘了填。",
"expected_output": "Adds `is_done: { type: 'boolean', label: '是否完成', defaultValue: false }`; `required: true` may stay or go, and either way the answer says what it does: on a boolean `required` refuses only `null`, and an unchecked box is a value, so it never means \"must be ticked\" and nobody can forget to fill it — the default lands every row, imported or seeded ones included, on a real `false`. Tells the user that \"must be ticked\" (terms, a consent) is a `validations[]` `script` rule whose `condition` is true while the box is not `true`, not `required`. The label is Chinese, as the request is.",
"files": [],
"assertions": {
"must_contain": [
"type: 'boolean'",
"defaultValue: false",
"label: '是否完成'"
],
"must_not_contain": [
"label: 'Is Done'"
]
}
},
{
"id": 11,
"prompt": "订单的流程是 草稿 → 已提交 → 已审批 / 已驳回,审批通过后才能发货。请建模这个流程,并保证没人能直接建一张已审批的订单。",
"expected_output": "The lifecycle is a `status` field of `type: 'select'` on `order` (options `draft` / `submitted` / `approved` / `rejected` with Chinese labels), guarded by a `type: 'state_machine'` validation whose `transitions` map uses option VALUES and which declares `initialStates: ['draft']` — `transitions` governs only UPDATE and a `select` accepts any option on insert, so without it an order can be created already `approved`, and publish refuses the machine (`state-machine-no-initial-states`; only an update-only machine, `events: ['update']`, owes none). No separate status / stage / step table, and no approval-record object: the approval itself is a flow (objectstack-automation).",
"files": [],
"assertions": {
"must_contain": [
"type: 'select'",
"type: 'state_machine'",
"initialStates: ['draft']",
"transitions"
],
"must_not_contain": [
"reference: 'order_status'",
"name: 'approval_record'",
"approved: ['已发货']"
]
}
},
{
"id": 12,
"prompt": "项目上要显示「已完成任务数」「任务总数」和「完成率」。`task` 现在没有指向项目(`project`)的字段。",
"expected_output": "Three fields on `project`: `completed_task_count` and `task_count` are `type: 'summary'` fields over the `task` child with `function: 'count'` (and `summaryOperations.object: 'task'`), the completed one carrying the qualifier in `filter: { status: 'completed' }` — keyed by a CHILD field and the option VALUE, never the label `已完成`; dropped, the field counts every task and shows a plausible wrong total. `completion_rate` is a `type: 'formula'` field over the two summaries, authored after them (it computes only once they do). If `project` rows already exist, says the recompute runs only on a child write, so the backfill is `os migrate summary-nulls --apply` — not editing a task to trigger it. `task` gets a field pointing back at `project` (`master_detail` or `lookup`, `reference: 'project'`): a roll-up whose child has none is refused at publish (`rollup/child-without-parent-reference`).",
"files": [],
"assertions": {
"must_contain": [
"type: 'summary'",
"function: 'count'",
"filter:",
"type: 'formula'",
"reference: 'project'"
],
"must_not_contain": [
"filter: { status: '已完成' }",
"status: { $eq: '已完成' }"
]
}
},
{
"id": 13,
"prompt": "工单需要一个「负责人」,每个客服只能看到自己负责的工单。",
"expected_output": "Adds NO owner lookup: every object already carries the platform `owner_id` (reassignable, stamped to the creator), which is what owner-scoped visibility and \"my records\" views read — a hand-added 负责人 lookup is a second owner those never see. Sets `sharingModel: 'private'` on `ticket` (owner-only by default) and leaves `ownership` at its default. A people field is added only for a role DISTINCT from the owner (a reviewer, an approver), as `type: 'user'`.",
"files": [],
"assertions": {
"must_contain": [
"owner_id",
"sharingModel: 'private'"
],
"must_not_contain": [
"reference: 'sys_user'",
"reference: 'user'",
"ownership: 'user'"
]
}
},
{
"id": 14,
"prompt": "新建「供应商」对象:公司名称、联系邮箱、合作状态(合作中 / 已终止)。",
"expected_output": "`supplier` with `label: '供应商'` and Chinese field and option labels (`label: '公司名称'`, `label: '联系邮箱'`, `label: '合作状态'`; options `{ label: '合作中', value: 'active' }`, `{ label: '已终止', value: 'terminated' }`) — labels follow the language of the request, only machine names stay ASCII `snake_case`. An authored `sharingModel`, `pluralLabel` and `icon`; the status is a `select` with a non-empty `options` list.",
"files": [],
"assertions": {
"must_contain": [
"label: '供应商'",
"label: '公司名称'",
"value: '",
"sharingModel"
],
"must_not_contain": [
"label: 'Supplier'",
"label: 'Company Name'",
"value: '合作中'"
]
}
},
{
"id": 15,
"prompt": "Our package's `lead` object has a `company` text field with data in production. Rename it to `account_name` in the next version without losing the values.",
"expected_output": "Key the field `account_name` and declare `renamedFrom: ['company']` on it, removing `company` from the object: on the upgrade the schema sync renames the column, values and all. Without `renamedFrom`, the install-local upgrade stops on a suspected rename before any column changes, and a restart on the new version adds `account_name` as a new, empty column beside `company`, values left behind. Keep the entry while any installed version may still carry `company`.",
"files": [],
"assertions": {
"must_contain": [
"renamedFrom",
"account_name"
],
"must_not_contain": []
}
},
{
"id": 16,
"prompt": "Our `consent_change` audit log must show it if anyone edits, inserts or deletes rows directly in the database, but whatever proof is stored must not carry the consent text itself. How do I declare that?",
"expected_output": "Keep `lifecycle.class: 'audit'` with its bounding `retention` (or a `ttl` on `created_at`) and add `seal: { valueFields: ['consent_text'] }`: the audit plugin signs each `created_at` hour, per organization chain, into one checkpoint (or consecutive checkpoints of at most 10,000 rows), each chained to the one before, where `valueFields` columns enter as salted commitments and every other column in clear. The object declares its own `id` and a text or lookup `tenant_id` field; without that `tenant_id` (and with no `chainField` naming another chain column, such as the injected `organization_id`) it is refused at parse, as is a `chainField` naming a column the object lacks or one that cannot name an organization, and without `id` it parses but is not sealed, and the sealer reports it at `error` each hour. Refused at parse: `seal` on a class other than `audit`, `valueFields` naming `id`, `created_at` or an undeclared field, and beside `seal` a `retention` or `ttl` `onlyWhen`, a `ttl` on another field, or rotation `storage`. Signed expiry covers objects whose lifecycle is declared in packaged metadata, as this one is: its sealed rows leave only by whole checkpoints and read as `expired`. With no `archive`, a retention override below the declared window is rejected and the declared window applies; to keep rows for less time, shorten the declared window. On any other sealed object (one created at runtime) the sweeper still deletes sealed rows, which then read as missing. `os audit verify` checks the ledger and exits 1 on a changed, missing or unsealed row or a chain fault such as a row `listed_twice`. Field history is not tamper evidence.",
"files": [],
"assertions": {
"must_contain": [
"seal",
"valueFields",
"tenant_id",
"salted commitments",
"expired"
],
"must_not_contain": [
"trackHistory",
"class: 'telemetry'"
]
}
},
{
"id": 17,
"prompt": "Order lines belong to orders. Anyone who can see an order should be able to add, change or remove its lines, as far as the line object's own permissions allow; nobody needs edit rights on the order itself for that. How do I declare the line's sharing?",
"expected_output": "`order_line` is `sharingModel: 'controlled_by_parent'` with a required `master_detail` field to `order`, plus `sharing: { controlledByParent: { writeRequiresMasterRead: true } }`: read access to the order becomes the master question for every write (insert, update, delete, re-point), and the line's own object permissions, RLS and FLS decide the rest. Without the key every line write needs edit on the order. Not `ownerMayEdit` (only the owner's by-id update, and refused beside the new key), not the key one level up (`sharing.writeRequiresMasterRead`, refused), and not on a non-`controlled_by_parent` object (refused). A predicate (`multi: true`) update or delete writes the rows a by-id write of each would, all matched rows or none. The platform ownership floor still binds on-behalf-of updates and deletes, for both users.",
"files": [],
"assertions": {
"must_contain": [
"controlled_by_parent",
"master_detail",
"controlledByParent",
"writeRequiresMasterRead: true"
],
"must_not_contain": [
"sharing: { writeRequiresMasterRead",
"ownerMayEdit: true, writeRequiresMasterRead: true",
"writeRequiresMasterRead: true, ownerMayEdit: true",
"required: true, writeRequiresMasterRead"
]
}
},
{
"id": 18,
"prompt": "Each `invoice_line` belongs to an `invoice` (deleting the invoice deletes its lines), and the invoice carries `currency_code`. The line's `amount` must always be in its invoice's currency without storing a code on the line, and the invoice shows a subtotal of its lines. A teammate suggests making `invoice` a plain `lookup` instead. How do I declare the amounts?",
"expected_output": "Keep `invoice` a `master_detail` and declare `amount` with `currencyMode: 'record'` and `currencyField: 'invoice.currency_code'`: on a `master_detail` child the code may be one hop to the parent's `iso_4217_currency` field, so the line stores no code. A `lookup` path is refused, so the teammate's change would refuse the amount. The invoice's `subtotal` is a `summary` with `function: 'sum'` over the lines' `amount`, and it must declare its own `currencyMode: 'record'` with `currencyField: 'currency_code'`. A blank invoice code refuses the line's amount (`ERR_CURRENCY_CODE_REQUIRED`), and once a line follows it the invoice's `currency_code` cannot change until none does.",
"files": [],
"assertions": {
"must_contain": [
"master_detail",
"currencyField: 'invoice.currency_code'",
"iso_4217_currency",
"summary",
"ERR_CURRENCY_CODE_REQUIRED"
],
"must_not_contain": [
"currencyMode: 'fixed'",
"Field.lookup('invoice')"
]
}
},
{
"id": 19,
"prompt": "帮我搭一个工单管理应用:`ticket` 对象有标题、状态(新建 / 处理中 / 已解决)、优先级,以及负责人,负责人可以改派给别的同事。",
"expected_output": "The 负责人 is the platform's injected `owner_id` (`ownership: 'user'`, the default; label Owner / 负责人): reassigning the ticket writes `owner_id`, which also drives owner-scoped visibility and \"My records\" views. The `ticket` object declares no `assignee` / `assigned_to` / owner field of its own and no second visible field labelled 负责人; only a handler the request names apart from the owner would be a `user` field, with a label no other visible field carries (system fields `created_by` 创建人 and `updated_by` 更新人 included), granting no access.",
"files": [],
"assertions": {
"must_contain": [
"owner_id"
],
"must_not_contain": [
"assignee:",
"assigned_to:",
"label: '负责人'"
]
}
},
{
"id": 20,
"prompt": "Our `expense` rows are entered in many currencies: `amount` is a per-record currency field and the engine already stores its home-currency value in `amount_home`. On `project` I want an `actual_cost` total of all its expenses, shown as money, not as a plain number. We report in dollars, so can I just set the total's currency to USD?",
"expected_output": "Roll up the stored home amount, not `amount`: on `project`, `actual_cost` is a `summary` with `function: 'sum'` over `expense`'s `amount_home`, and it declares `currencyConfig: { currencyMode: 'dynamic' }` with no currency code. Every `amount_home` row is already in the organization's home currency, so the total is drawn in `localization.currency` on the record page and in lists; without that declaration it is a bare number. Do not write USD on it: metadata never names the home currency (ADR-0144), so the total follows the organization setting. `dynamic` is admitted only on a roll-up of a home amount (`defineStack` / `os validate` refuses it over any other child field), and a `count` roll-up carries no currency at all.",
"files": [],
"assertions": {
"must_contain": [
"summary",
"amount_home",
"currencyMode: 'dynamic'"
],
"must_not_contain": [
"defaultCurrency: 'USD'"
]
}
},
{
"id": 21,
"prompt": "Our package `acme_billing` depends on HotCRM and already relabels its `crm_account` fields with `fieldPatches`: `industry` reads \"Sector\" and the `type` option `customer` reads \"Client\". Our zh-CN users still see that English text. Where do the Chinese strings go?",
"expected_output": "In `acme_billing`'s own translation bundle, registered on its `defineStack({ translations: [...] })`, under the same keys HotCRM translates its own text under: `'zh-CN': { objects: { crm_account: { fields: { industry: { label: '板块' }, type: { options: { customer: '委托方' } } } } } }` (a patched help text or description goes under the field's `help`). The package that ships the patch translates it: never edit HotCRM's translation files, and never redeclare the field in `fields` to carry a label. HotCRM's zh-CN translation of the text the patch replaced (\"Industry\") never applies to the patched label. A translation of the same key in the paired `hotcrm.custom` package still comes first on the `/meta` reads, and a locale `acme_billing` does not translate serves the patch text (`Sector`) as written.",
"files": [],
"assertions": {
"must_contain": [
"translations",
"acme_billing",
"zh-CN",
"objects",
"crm_account",
"industry",
"customer"
],
"must_not_contain": [
"overrides:"
]
}
},
{
"id": 22,
"prompt": "Add a `uom` text field to our `product` object for the unit of measure (pcs, kg, box, …).",
"expected_output": "Adds `uom` as a `text` field that declares what it holds, `uom: Field.text({ unitConfig: { unitMode: 'code' } })`, neither a bare free-text field nor a `select`: the platform catalog (objectstack-project §0, question 3) lists `sys_unit` and `unitConfig` as what the platform ships, so the app declares no unit object and no option list. The field stores a unit code in exact uppercase: a standard UN/ECE Rec 20 code (`H87` for a piece, `KGM`, `XBX` for a box) or one of the organization's own units, which an administrator adds in Setup. The write path refuses any other value, so pcs, kg and box are what people say, not what is stored. If a quantity sits beside it, the quantity is a `number` field with `unitConfig: { unitMode: 'record', unitField: 'uom' }`, and `uom` then carries no `unitConfig` of its own; a quantity with one unit declares `unitMode: 'fixed'` with `unit`. Showing the unit beside a quantity, totals per unit and conversion are in the catalog's Planned section, not available yet.",
"files": [],
"assertions": {
"must_contain": [
"unitConfig",
"unitMode",
"H87",
"KGM"
],
"must_not_contain": [
"uom: Field.select(",
"type: 'select'"
]
}
},
{
"id": 23,
"prompt": "On `account`, store each customer's country as a two-letter code and their time zone.",
"expected_output": "Two `text` fields that declare a value domain: `country` with `valueDomain: 'iso_3166_alpha2'` (`CN`, `US`) and `time_zone` with `valueDomain: 'iana_time_zone'` (`Asia/Shanghai`). The write path refuses a value outside the standard; the form shows a plain text input for both (only the currency code gets a picker), and no list or filter reads the domain. No picklist of countries to maintain and no regex `pattern`. Mentions that a `text` field named `country` or `time_zone` without the domain is an `os lint` warning.",
"files": [],
"assertions": {
"must_contain": [
"iso_3166_alpha2",
"iana_time_zone"
],
"must_not_contain": [
"type: 'select'",
"pattern:"
]
}
},
{
"id": 24,
"prompt": "Quotes are entered in EUR, GBP and USD and finance wants a USD total on every quote. Create an `exchange_rate` object (currency, rate, valid from) and an `afterInsert` hook on `quote` that converts `amount`.",
"expected_output": "Does not create the object or the hook: the platform ships `sys_exchange_rate`, maintained in Setup, and the conversion at write. On `quote`, `amount` is a `currency` field with `currencyMode: 'record'`, a `currencyField` (`currency_code`, a `text` field with `valueDomain: 'iso_4217_currency'`) and `homeAmount: { field, rateDate, rateField }`, so the engine stores the home-currency amount and the rate it used, both `readonly`. The home currency is the organization's `localization.currency`; the metadata never names it. Totals sum the home field.",
"files": [],
"assertions": {
"must_contain": [
"sys_exchange_rate",
"homeAmount",
"currencyMode: 'record'"
],
"must_not_contain": [
"name: 'exchange_rate'",
"event: 'afterInsert'"
]
}
},
{
"id": 25,
"prompt": "`quote_line` 通过 `master_detail` 字段 `quote` 归属 `quote`。新建报价单时要在表单里直接录明细,和报价单一起保存。该怎么声明?",
"expected_output": "On the PARENT `quote` object, a field group that names the child: `fieldGroups: [..., { key: 'lines', label: '明细', relatedList: 'quote_line' }]` (such a group holds no fields). The standard create/edit form of `quote` then enters the lines at that group and saves quote + lines in one atomic transaction, and the record page draws the same table there. Without the group nothing changes: `quote_line` is a tab and the form has no lines, whatever `inlineEdit` on `quote_line.quote` says; `inlineEdit` only picks how the rows are edited (`'grid'` / `'form'`; absent picks by the child's shape). No custom page and no form view is needed. If either object declares `enable.apiMethods`, it must list `'bulk'`.",
"files": [],
"assertions": {
"must_contain": [
"fieldGroups",
"relatedList: 'quote_line'"
],
"must_not_contain": [
"definePage"
]
}
},
{
"id": 26,
"prompt": "Our add-on package `acme_contracts` depends on HotCRM (`hotcrm`, namespace `crm`). Its extension of `crm_account` adds a `tax_id` text field, and the package ships an `acme_contract` object whose `account` lookup points at `crm_account`. On the account record page, show Tax ID right after Industry in the Basic section, and the Contracts tab right after Opportunities. `crm_account` declares `fieldGroups: [{ key: 'basic', label: 'Basic', fields: ['name', 'industry', 'website'] }]` and `relatedLists: ['crm_contact', 'crm_opportunity', 'crm_lead', 'sys_activity']`. We cannot edit HotCRM.",
"expected_output": "Two `place` entries on the package's own object extension, registered in its stack's `objectExtensions`: `defineObjectExtension({ extend: 'crm_account', fields: { tax_id: Field.text({ label: 'Tax ID' }) }, place: [{ field: 'tax_id', group: 'basic', after: 'industry' }, { list: 'acme_contract', after: 'crm_opportunity' }] })`. `place` arranges only what the extension brings (its own field, its package's child list), each right after (or `before`) an item the account already has, and it applies here because the account declares `fieldGroups` and `relatedLists`. Without it the field arrives after the account's own and the Contracts tab at the end of the tabs, before the activity stream. The extension does not carry `fieldGroups` or `relatedLists` of its own (only the object extension of HotCRM's paired `hotcrm.custom` package writes those keys; here they are refused), does not redeclare the account, and nothing in HotCRM is edited.",
"files": [],
"assertions": {
"must_contain": [
"defineObjectExtension",
"extend: 'crm_account'",
"place:",
"after: 'industry'",
"after: 'crm_opportunity'"
],
"must_not_contain": [
"name: 'crm_account'",
"overrides:"
]
}
},
{
"id": 27,
"prompt": "We installed HotCRM (`hotcrm`, namespace `crm`) and cannot edit it. Its `crm_account` declares `relatedLists: ['crm_contact', 'crm_opportunity', 'crm_lead', 'sys_activity']`. On the account record page our admins want Opportunities before Contacts and the Leads tab gone, for every user. Our add-on package `acme_contracts` already extends `crm_account`, so a colleague put `relatedLists: ['crm_opportunity', 'crm_contact', { list: 'crm_lead', hidden: true }]` on that extension, and `os validate` refused it. Where does this arrangement go, and what may `acme_contracts` write instead?",
"expected_output": "The arrangement goes on the object extension of HotCRM's paired customization package `hotcrm.custom`, registered in that stack's `objectExtensions`: `defineObjectExtension({ extend: 'crm_account', relatedLists: ['crm_opportunity', 'crm_contact', { list: 'crm_lead', hidden: true }] })`. Only the pair's extension writes `relatedLists` (and `fieldGroups`), in the shape an object declares them. The key it writes replaces the tab list whole (HotCRM's own list and every other extension's `place`); a tab it does not name still shows after the listed ones (the activity stream here), so hiding is written, as `{ list: 'crm_lead', hidden: true }`; `fieldGroups`, not written, keeps the groups as they were. `acme_contracts` is not a `.custom` package, so both keys are refused there at save, publish and install and by `os validate` / `os build`, and the refusal prescribes `place`: that package places only what it brings, e.g. `place: [{ list: 'acme_contract', after: 'crm_opportunity' }]`, and cannot reorder or hide HotCRM's tabs. The account is not redeclared, takes no `overrides` declaration, and nothing in HotCRM is edited.",
"files": [],
"assertions": {
"must_contain": [
"hotcrm.custom",
"defineObjectExtension",
"extend: 'crm_account'",
"relatedLists",
"hidden: true",
"place:"
],
"must_not_contain": [
"name: 'crm_account'",
"overrides:"
]
}
},
{
"id": 28,
"prompt": "When a sales manager changes the owner of an `account`, the Change Owner dialog should offer to hand the account's `opportunity` records that the old owner owns to the new owner too. `opportunity.account` is a `lookup` to `account`. A colleague proposes a hook on `account` that rewrites `owner_id` on its opportunities. What do we declare instead, and where is that declaration refused?",
"expected_output": "No hook: declare the cascade on the child's reference field, beside `deleteBehavior`: on `opportunity`, `account: { type: 'lookup', reference: 'account', transferBehavior: 'cascade' }`. The account's Change Owner dialog then offers that relationship, and moves the opportunities the account's previous owner owns; the default `'none'` leaves them with their owner. The key is refused at parse on any type but `lookup` / `master_detail`; `cascade` is also refused on a reference to a `sys_*` object, on a `multiple: true` field, and on a child object that does not offer Change Owner itself, such as a `controlled_by_parent` detail.",
"files": [],
"assertions": {
"must_contain": [
"transferBehavior: 'cascade'",
"controlled_by_parent"
],
"must_not_contain": [
"deleteBehavior: 'cascade'"
]
}
},
{
"id": 29,
"prompt": "On `ticket` a colleague wrote `contact_name: { type: 'text', reference: 'contact' }` so the form offers a contact picker while the column stays text. Will that publish? Write the field as it should be.",
"expected_output": "No: only `lookup`, `master_detail`, `user` and `tree` read `reference`; on a `text` field publish refuses it (`field/reference-on-non-reference-type`). To link a contact the field is `{ type: 'lookup', reference: 'contact' }`; a plain text name drops `reference`.",
"files": [],
"assertions": {
"must_contain": [
"type: 'lookup'",
"reference: 'contact'",
"field/reference-on-non-reference-type"
],
"must_not_contain": []
}
}
]
}