diff --git a/.changeset/37585-skills-follow-merged-code.md b/.changeset/37585-skills-follow-merged-code.md new file mode 100644 index 00000000000..33a16c94078 --- /dev/null +++ b/.changeset/37585-skills-follow-merged-code.md @@ -0,0 +1,18 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): four skill pages follow code that has merged — the `_milestones` translation key, the remedy for a hidden related-list entry, `kanban.cardFooter`, and the rule that refuses an ungranted action write + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-i18n/SKILL.md`: the object sub-key table gains a `_milestones.{field}.{value}` row. Its `summary` is the timeline sentence of the `activityMilestones` entry that fires on that field and value, with the same `{field}` tokens; the row is composed at read time in the reader's language, a select token shows as its option label, the stored row is unchanged, and field redaction applies as it does to the stored sentence. The `_relatedLists` row's remedy for a hidden entry now says the entry is re-stated shown, with the owner's label. + +`skills/objectstack-data/rules/relationships.md`: the same remedy; a bare child name in a `.custom` arrangement, labelled or not, covers each of that child's `child.field` lists; and an import scope the engine cannot filter by (such as a formula) answers `reference_not_found`. + +`skills/objectstack-ui/rules/list-views.md`: the kanban example and its notes carry `cardFooter: { comments, attachments }`. `comments` counts the record's open top-level threads, `attachments` its files, shown only where the object has `enable.files`; no other member is accepted. + +`skills/objectstack-ui/rules/actions.md`: a body that writes without `capabilities: ['api.write']` is named by its rule, `action-body-write-capability-undeclared`, in place of the sentence about the sandbox throwing. + +Each addition is paid for in its own file (shortened examples and asides); no token ceiling moves. diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index abddc037598..3cfaff19487 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -23,7 +23,6 @@ export default ObjectSchema.create({ name: 'contact', sharingModel: 'public_read_write', fields: { - first_name: { type: 'text', required: true }, account_id: { type: 'lookup', reference: 'account', @@ -55,7 +54,6 @@ export default ObjectSchema.create({ deleteBehavior: 'cascade', required: true, }, - product: { type: 'text', required: true }, amount: { type: 'currency', required: true }, } }); @@ -108,7 +106,8 @@ an omitted `required` as `true`. master (one reference column to it) or the lookup's `dependsOn` sibling: a tie there is `reference_ambiguous`, another master's detail `reference_out_of_scope` (`scope: [{ field, value }]` names the scoping columns). A name no record -has, or a scoping field the caller cannot read, is `reference_not_found`. +has, or a scoping field the caller cannot read or the engine cannot filter by +(such as a formula), is `reference_not_found`. ### Many-to-Many: Junction Object @@ -358,8 +357,9 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false }, (`sys_attachment`, `sys_approval_request`, `sys_activity`). An entry is the child, `object.field` or `{ list, label, columns }`; its `label` translates at `objects.{parent}._relatedLists.{list}.label` (none: no key). A `.custom` - arrangement re-stating the entry with no `label`, or hiding it, leaves none and - `os validate` refuses the key: drop it, or re-state the entry with the + arrangement re-stating the entry with no `label`, or hiding it, leaves none (a + bare child's name, labelled or not, covers each of its `child.field` lists too) and + `os validate` refuses the key: drop it, or re-state the entry, shown, with the owner's `label`. A child in the stack with no inbound FK is refused everywhere; one that exists nowhere is refused by `os validate` / `os build` (bar a platform or sibling-artifact name) and by a metadata @@ -368,8 +368,7 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false }, `relatedListTitle` / `relatedListColumns` override the derived title / columns (columns: the child's `highlightFields`); an entry's `label` / `columns` win. Audit FKs (`created_by`/`updated_by`/`owner_id`) never become related lists. A child that -references the parent through several FKs (e.g. `primary_account` + -`partner_account`) yields **one related list per FK**; a self-referential FK +references the parent through several FKs yields **one related list per FK**; a self-referential FK surfaces a "children" list. ## Incorrect vs Correct diff --git a/skills/objectstack-i18n/SKILL.md b/skills/objectstack-i18n/SKILL.md index dc4b7ec58b2..d5cfbf1c29b 100644 --- a/skills/objectstack-i18n/SKILL.md +++ b/skills/objectstack-i18n/SKILL.md @@ -76,7 +76,6 @@ const en: TranslationData = { completed: 'Completed', }, }, - due_date: { label: 'Due Date' }, }, _views: { all_tasks: { @@ -101,7 +100,6 @@ const en: TranslationData = { }, messages: { 'common.save': 'Save', - 'common.cancel': 'Cancel', 'welcome.user': 'Welcome, {{userName}}!', }, }; @@ -118,16 +116,11 @@ const zhCN: TranslationData = { label: '状态', options: { not_started: '未开始', in_progress: '进行中', completed: '已完成' }, }, - due_date: { label: '截止日期' }, }, }, }, - apps: { - todo_app: { label: '待办管理', description: '个人任务管理' }, - }, messages: { 'common.save': '保存', - 'common.cancel': '取消', 'welcome.user': '欢迎,{{userName}}!', }, }; @@ -163,7 +156,8 @@ All translatable content for a single object is aggregated under | `_actions.{action_name}` | `label`, `description`, `confirmText`, `submitText` (the param dialog's button verb — only under an action that declares `params`), `cancelText` (the dismiss button of the confirm or param dialog — only under an action that declares `confirmText` or a non-empty `params`), `successMessage`, `disabledReason` (the sentence a greyed action shows; absent keeps the console's default), `params.{param_name}` (and `.options.{value}` beneath it — an option's stored `value` in that param's inline `options`), `outcomeMessages.{outcome}` (an outcome the action's own `outcomeMessages` declares), `resultDialog.title` / `.description` / `.acknowledge` (only under an action that declares a `resultDialog`), `resultDialog.fields.{path}` (the literal `path` of a field in `resultDialog.fields[]`, dots included — `client.secret` is one key), `preflight.fields.{path}` (only under an action that declares `preflight`: a field's literal `path` in its `preflight.fields[]`, its value a plain string as under `resultDialog.fields`), `resultDialog.columns.{path}.{column_path}` / `preflight.columns.{path}.{column_path}` (a table's column headers, beside `fields`: the literal `path` of a `format: 'table'` field, then of one of its `columns[]`, each a plain string; `defineTranslationBundle` refuses any other key under `preflight`, a `title` included); the same keys hold under `globalActions.{action_name}` | | `_sections.{section_name}` | Form section `label`, `description`; `fields.{field_name}` — the `label`, `placeholder`, `helpText` an entry overrides for that form alone (`helpText` here, `help` under `fields.{field_name}` above: each spells what its source does) | | `_tabs.{tab_name}` | Filter-preset tab `label` (`ViewTabSchema.name`) | -| `_relatedLists.{list}` | `label` of an object-form `relatedLists` entry on this (parent) object, by its literal `list` (`event.related_to` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label. Where the paired `.custom` package's `relatedLists` (**objectstack-data**) re-states the entry without a `label`, or hides it, `os validate` refuses the key: drop it, or re-state the entry with the owner's own `label`. Spelled `relatedLists`, the group is refused, naming this one | +| `_relatedLists.{list}` | `label` of an object-form `relatedLists` entry on this (parent) object, by its literal `list` (`event.related_to` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label. Where the paired `.custom` package's `relatedLists` (**objectstack-data**) re-states the entry without a `label`, or hides it, `os validate` refuses the key: drop it, or re-state the entry, shown, with the owner's own `label`. Spelled `relatedLists`, the group is refused, naming this one | +| `_milestones.{field}.{value}` | `summary`, the timeline sentence of the `activityMilestones` entry firing on that field and value, same `{field}` tokens: composed at read time in the reader's language (a select token as its option label), stored row unchanged, redacted as the stored sentence is | | `_validations.{rule_name}` | `message` only — the sentence a rejected write returns (replaces the retired `validationMessages`) | | `_actions.{action_name}.refusals.{CODE}` | `message`, and `reasons.{reason}.message` per declared reason — the sentences of the action's `refusals` catalogue (**objectstack-ui** → Actions), for a code and reason it declares (any other is `translation-target-unknown`); the same under `globalActions.{action_name}` | @@ -282,8 +276,7 @@ what the runtime implements.) ```json { "messages": { - "welcome": "Welcome, {{userName}}!", - "pagination": "Showing {{start}} to {{end}} of {{total}} items" + "welcome": "Welcome, {{userName}}!" } } ``` diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index 03c49d94aed..83548250d5f 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -12,7 +12,8 @@ is refused at validate and publish (`action-no-object-binding`; set it, or that returns or assigns values writes nothing (`action-record-write-discarded`): it calls `ctx.api.object(...).update(...)` in `language: 'js'` (an `expression` body has no I/O) with -`capabilities: ['api.write']`: without it the sandbox throws on a write. +`capabilities: ['api.write']`; without that grant, a write is refused too +(`action-body-write-capability-undeclared`). ## Where Actions Appear (`locations`) @@ -44,7 +45,7 @@ there: a wrong name draws nothing. - `visible` — a bare CEL predicate over the current record (prefer the `P\`...\`` template; `record.` resolves identically on every surface, never `${…}`- or `{…}`-wrapped — see `objectstack-formula`); when false it is **hidden**. - `disabled` — `boolean` **or** a CEL predicate; when true it **shows but greys out**. A bare field ref in either (`done` for `record.done`) fails `os validate`. - `disabledReason` — an I18nLabel (a sentence or an inline locale map) a greyed action shows as its hover title and accessible description. Display-only: never a predicate or a gate (the hook or permission still refuses). Omit it to keep the console's default "Not available for this record"; a blank one is refused, and `disabledMessage` / `disabledTooltip` / `disabledHint` / `disabledText` are refused naming this key. The reason goes here, not in `description`. -- `pressed` — a CEL predicate over the same scope as `visible` that marks the action as already done by this reader: while TRUE the record header draws it pressed (`aria-pressed`). Display-only, never a gate; a boolean literal is refused (a constant is a style, not a reader's state), and `active` / `activeWhen` / `pressedWhen` are refused naming this key. A per-reader fact (the reader's vote) is a block the object declares under `attachedOnRead`, filled per caller by a service or `afterFind` hook, read as `has(record.viewer) && record.viewer.vote == 'helpful'`. +- `pressed` — a CEL predicate over the same scope as `visible` that marks the action as already done by this reader: while TRUE the record header draws it pressed (`aria-pressed`). Display-only, never a gate; a boolean literal is refused, and `active` / `activeWhen` / `pressedWhen` are refused naming this key. A per-reader fact (the reader's vote) is a block the object declares under `attachedOnRead`, filled per caller by a service or `afterFind` hook, read as `has(record.viewer) && record.viewer.vote == 'helpful'`. - `confirmText` — set for any destructive or irreversible operation; the confirm dialog of a param-less action. It gates no AI call: an `ai.exposed` one also sets `ai.requiresConfirmation: true`. A registered action is refused it beside a non-empty `params` (put the question on `description`); a view's `bulkActionDefs` entry pairs the two by its own contract. - `submitText` — the verb on the param dialog's submit button ("Send", "Log Call") in place of "Confirm": an I18nLabel, refused blank and refused without a non-empty `params` (no dialog opens); `submitLabel` / `confirmLabel` are refused naming this key. - `preflight` — a read the param dialog shows above the params before submit: `{ read: { url }, path?, fields?, seed? }` sends one `GET` (no other `method`, no body or credentials) to a same-origin API path (one leading `/`) whose only holes are `${param.NAME}` (a declared param; re-read when it changes), `${ctx.recordId}` and `${ctx.record.FIELD}`. `path` selects the answer's sub-tree (`data`); `fields` rows are `resultDialog.fields`' (omitted: JSON). Each `seed: [{ param, path }]` entry fills a declared param, drawn read-only and submitted as shown: seeded once, no `defaultValue` / `defaultFromRow` / `carryOver`, read by no hole; mark it `required` so Confirm waits for the answer. Refused without a non-empty `params` and beside `execution: 'aggregate'`. UX, not authorization: the endpoint still checks a seeded value. diff --git a/skills/objectstack-ui/rules/list-views.md b/skills/objectstack-ui/rules/list-views.md index 68552819aab..0fffa9ef1b2 100644 --- a/skills/objectstack-ui/rules/list-views.md +++ b/skills/objectstack-ui/rules/list-views.md @@ -38,8 +38,7 @@ export const CaseViews = defineView({ ### Data Source (`data`) -Bare-key blocks in this file are fragments, so `check:skill-examples` skips -them. Every view connects to data via one of two providers: +Every view connects to data via one of two providers: ```typescript data: { provider: 'object', object: 'support_case' } @@ -61,11 +60,7 @@ columns: [ { field: 'status', width: 120, align: 'center' }, { field: 'priority' }, { field: 'owner_id' }, - { - field: 'due_date', - summary: 'min', // plain enum value, not an object - sortable: true, - }, + { field: 'due_date', sortable: true, summary: 'min' }, // plain enum value ] ``` @@ -126,7 +121,7 @@ it read-only. ### End-User Quick Filters (`userFilters`, ADR-0047) `filter` is the always-on base criteria. For the *end-user-facing* filter bar -(Airtable "User filters") use `userFilters` — dropdowns, filter tabs, or +use `userFilters` — dropdowns, filter tabs, or toggles the user combines at runtime: ```typescript @@ -138,7 +133,7 @@ userFilters: { ], }, -// Runtime visualization whitelist (Airtable "Appearance → Visualizations"): +// Runtime visualization whitelist: appearance: { allowedVisualizations: ['grid', 'kanban', 'gallery'] }, // one entry = locked, no switcher ``` @@ -275,6 +270,7 @@ const board: ListView = { showFieldLabels: false, // optional, default true: cards name each field hideEmptyFields: false, // optional, default true: cards drop an empty field columns: ['title', 'owner_id', 'priority'], // fields shown on each card + cardFooter: { comments: true, attachments: true }, // optional foot counts }, sort: [{ field: 'priority', order: 'desc' }], }; @@ -289,6 +285,8 @@ const board: ListView = { > `none`, `count`, or `sum` / `avg` / `min` / `max` of a `field`, computed by the > query over every record of the lane, lanes over a lookup field included. Omit > `summary` to keep the older `summarizeField`'s sum, or no statistic without it. +> `cardFooter` takes those two members only: `comments` counts the record's open +> top-level threads, `attachments` its files (shown only with `enable.files` on the object). ### Adding a board, calendar, gallery or gantt beside the list @@ -333,10 +331,10 @@ const timeline: ListView = { gantt: { startDateField: 'start_date', endDateField: 'end_date', - titleField: 'name', // bar label - progressField: 'progress', // 0–100 fill - dependenciesField: 'depends_on', // FS dependency arrows - parentField: 'parent', // builds the summary-bar tree + titleField: 'name', // bar label + progressField: 'progress', // 0–100 fill + dependenciesField: 'depends_on', // FS dependency arrows + parentField: 'parent', // builds the summary-bar tree }, }; ```