diff --git a/.changeset/34785-skills-fieldpatches-own-translations.md b/.changeset/34785-skills-fieldpatches-own-translations.md new file mode 100644 index 00000000000..7fcd25d2b3b --- /dev/null +++ b/.changeset/34785-skills-fieldpatches-own-translations.md @@ -0,0 +1,10 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): objectstack-data teaches that the package shipping a `fieldPatches` relabel translates that text in its own `translations` + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-data/SKILL.md`, the `fieldPatches` paragraph: patched text is translated in the patching package's `translations`, under the owner's keys (`objects.crm_account.fields.industry.label`, `.help`, `.options.`); the owner's translation of the text the patch replaced never applies, a pair `.custom` translation comes first on `/meta`, and a locale the package does not translate serves the patch text. This is the skill text for the behaviour `@objectstack/spec` 18 already ships; the docs page `data-modeling/object-extensions` teaches the same. One eval case asks where a dependent package's zh-CN strings for its patch go. The file pays in full by dropping restatement and its token ceiling does not move: the lead-in line under the Quick Reference heading, the second half of the multi-value-lookup note (the Relationship Patterns rows carry it), and the two unique scopes named again under the index example. No schema or runtime change. diff --git a/skills/objectstack-data/SKILL.md b/skills/objectstack-data/SKILL.md index b08bdecba40..b823060cbf8 100644 --- a/skills/objectstack-data/SKILL.md +++ b/skills/objectstack-data/SKILL.md @@ -35,8 +35,6 @@ metadata: ## Quick Reference — Detailed Rules -Detailed rules, with incorrect/correct examples: - - **[Naming Conventions](./rules/naming.md)** — snake_case rules, option values, config properties - **[Field Types](./rules/field-types.md)** — All field types and configs - **[Relationships](./rules/relationships.md)** — lookup vs master_detail, junction patterns, delete behaviors @@ -312,12 +310,9 @@ picker; `formula` takes CEL in `expression` (`F\`...\`` from `@objectstack/spec` | Approval, review, routing, audit trail | not objects: an approval is a flow node (**objectstack-automation**) and its trail is platform history; model only the people it references (approver, reviewer), as `user` fields beside the owner | | Record owner | the platform's `owner_id` (`ownership: 'user'`, the default), also when the request says assignee, 负责人 or 处理人 — never a hand-added owner field, a second owner that owner-scoped visibility and "My records" views never read. A handler the request names apart from the owner is a `user` field that grants no access, with a label no other visible field carries, injected ones included: `owner_id` (Owner, 负责人), `created_by` (创建人), `updated_by` (更新人), `created_at` (创建时间), `updated_at` (更新时间). `ownership: 'none'` only for a shared catalog or a pure junction table | -> **`multiple: true` lookup ≠ junction object.** A multi-value lookup -> (`{ type: 'lookup', reference: 'x', multiple: true }`) is stored and read as an -> **array of ids** on the record — reference elements positionally -> (`{record.tags.0}` in flow values). It is NOT a junction table. Reach for a -> **junction object** (two lookups) only when the relationship itself carries -> attributes (role, added_at, …). +> **`multiple: true` lookup ≠ junction object.** A multi-value lookup is stored +> and read as an **array of ids** on the record — reference elements positionally +> (`{record.tags.0}` in flow values). ### Validation Patterns @@ -354,8 +349,7 @@ indexes: [ ``` See [rules/indexing.md](./rules/indexing.md) for composite indexes, unique scope -(`'organization'` / `'global'` — on a declared index bare `unique: true` is -refused), the retired `type` / `partial`, and partial / gin / gist indexes at the +(on a declared index bare `unique: true` is refused), the retired `type` / `partial`, and partial / gin / gist indexes at the database layer. --- @@ -380,6 +374,11 @@ text; between two extensions the higher `priority` wins. A patch naming a field or option value the target lacks is refused at install and by `os validate`, and a `picklist`-bound field's options are never patchable. Example: `defineObjectExtension({ extend: 'crm_account', fieldPatches: { industry: { label: 'Sector' }, type: { options: { customer: { label: 'Client' } } } } })`. +Translate patched text in the patching package's `translations`, under the +owner's keys (`objects.crm_account.fields.industry.label`, `.help`, +`.options.`): the owner's translation of the replaced text never applies, a +pair `.custom` translation comes first on `/meta`, and an untranslated locale +serves the patch text. **An object an installed package ships** is extended from the base's paired `.custom` package (`hotcrm.custom`; **objectstack-platform** diff --git a/skills/objectstack-data/evals/objects-fields-relationships.json b/skills/objectstack-data/evals/objects-fields-relationships.json index b70e73571cb..447afd2999f 100644 --- a/skills/objectstack-data/evals/objects-fields-relationships.json +++ b/skills/objectstack-data/evals/objects-fields-relationships.json @@ -362,6 +362,26 @@ "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:" + ] + } } ] }