Skip to content

Commit eb7b09d

Browse files
docs(skills): objectstack-data teaches translating fieldPatches text in the patching package's own translations (#35039)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_ Fixes #34785 Clause-②: no Metadata-protocol: none Served-tier: CONTRACT_REVIEW_TIER ## 维护者速读 - 改了什么:`objectstack-data` 技能的 `fieldPatches` 段落加了一句,说明补丁改写的标签、帮助文字、选项名由发补丁的包在自己的 `translations` 里翻译;另加一条评测用例。 - 为什么改:这个行为已随 PR #34784 上线,文档页也已写明,但对外发布的技能还没教,写元数据的 agent 不知道译文该放哪。 - 风险与回滚:纯文字,无代码、无 schema 变化;为付字数删了同文件三处重复表述。回滚即 revert 本 PR。 - 先看:`skills/objectstack-data/SKILL.md`(新增的那句,以及「multiple: true lookup」提示块被删的后半段,风险最高)、`skills/objectstack-data/evals/objects-fields-relationships.json`(用例 21)。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 `skills/objectstack-data/SKILL.md is 6665 tokens (ceiling 6665; headroom 0)`,整体退出 0。 - 需要你做的:无。`check-governed-merges` 判为 Tier H(`skills/**`),按低风险 skills 通道(2026-11-14 #33501 裁决)由席位落地:前提是本 head 有席位达档合同审记录,且写明 `Security-touching: no`。 ## What changes `skills/objectstack-data/SKILL.md`, the `fieldPatches` paragraph, gains one sentence after the example: > Translate patched text in the patching package's `translations`, under the owner's keys (`objects.crm_account.fields.industry.label`, `.help`, `.options.VALUE`): 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. (In the file the last key is spelled with the option value in angle brackets; it is written `VALUE` here so the body survives the sanitizer.) Each clause was checked against the merged code of PR #34784 (commit `071323e1e7`), not only the docs page: | Clause | Where the code says so | | --- | --- | | the patching package's own translations | `patchTranslationBundlesOf` in `packages/rest/src/meta-item-read-gate.ts` reads `getPackageTranslationBundle(packageId)` per patching package | | the owner's keys | `translateObject` in `packages/spec/src/system/i18n-resolver.ts` looks the slot up with `lookupObjectFieldAttr` (`label`, `help`) and `lookupObjectFieldOption` (`options`) in the catalog `partCatalog` picks | | the owner's translation never applies | `partCatalog` returns the patch catalog or the pair's for a changed slot, never the deployment catalog | | the pair comes first on `/meta` | `patchCatalogsOf` lays the pair bundle over the package's; `form-routes.ts` passes no `pairBundle`, so the public form has no pair rank, which is why the sentence says `/meta` | | an untranslated locale serves the patch text | no catalog hit leaves the served value as is | `skills/objectstack-data/evals/objects-fields-relationships.json` gains case 21: a dependent package that already patches `crm_account` asks where its zh-CN strings go. A root changeset, `@objectstack/skills` patch. ### How the new text is paid for The file was at 6657 of 6665 tokens. The sentence adds 327 priced bytes; three cuts in the same file delete 295, and the row does not move. `scripts/check-skills-token-ratchet.mjs` is untouched. | Cut | Text that still carries it | | --- | --- | | The lead-in line "Detailed rules, with incorrect/correct examples:" under the Quick Reference heading | The heading itself ("Quick Reference — Detailed Rules"); "incorrect/correct examples" stays in Naming Rules Summary | | The multi-value-lookup note: the inline `{ type: 'lookup', reference: 'x', multiple: true }` spelling, and "It is NOT a junction table. Reach for a junction object (two lookups) only when the relationship itself carries attributes (role, added_at, …)." | The note's own title ("`multiple: true` lookup ≠ junction object") and the two Relationship Patterns rows above it: "Many-to-Many (simple): multi-value `lookup` (`multiple: true`), an array column of ids" and "Many-to-Many (with attributes): Junction object with two `lookup` fields". The positional-read sentence is kept | | "`'organization'` / `'global'` —" in the pointer under the index example | The example block right above it: `unique: 'organization'` (unique per organization) and `unique: 'global'` (unique platform-wide) | | Reading | Before | After | | --- | --- | --- | | `skills/objectstack-data/SKILL.md`, lines | 473 | 472 | | `skills/objectstack-data/SKILL.md`, tokens (ceiling 6665) | 6657 | 6665 | | All 12 `skills/*/SKILL.md`, lines | 4730 | 4729 | | All 12 `skills/*/SKILL.md`, tokens | 61622 | 61630 | | The eval file (unpriced), lines | 367 | 386 | ## Tests Text only; no package test applies and nothing was ablated. <details><summary>Eval assertions, checked by script on ba3ed91</summary> For both JSON files under `skills/objectstack-data/evals/`: every `must_contain` token is a substring of its case's `expected_output`, no `must_not_contain` token is, and the ids are distinct. Result: 24 cases and 21 cases, 0 violations. Case 21's tokens carry no whitespace or quoting (`translations`, `acme_billing`, `zh-CN`, `objects`, `crm_account`, `industry`, `customer`; forbidden: the key spelling `overrides:`, as cases 5 and 7 spell it, so a correct answer that says a pair translation overrides the package's still passes), because `packages/qa/scenarios/src/skill-evals/grade.ts` matches literal case-sensitive substrings with no normalisation. No token depends on whitespace, quoting or line breaks. Left out on purpose: the placement itself (that the strings sit in `acme_billing`'s own bundle and not in HotCRM's files, and that the entry is nested under `objects.crm_account.fields`) cannot be told from a wrong placement by a layout-free token, so no assertion checks it. It is stated in `expected_output` only. </details> ## Acceptance notes - The claim's file surface names "the `fieldPatches` paragraph only" in `SKILL.md`. The three cuts are outside that paragraph; the dispatch order asks for the payment to come from restatement in the same file, and each cut is listed above. - Not taught, to keep to one sentence: the same rule also covers `inlineTitle` and `relatedListTitle`, and with two patching packages the slot reads the package whose text it serves. The docs page carries the longer form. - Noted, not changed: the sentence "Not the same key as object-level `ownership` …" in the paragraph above reads as if its subject was removed earlier. Not measured (shallow checkout), not touched. - `skills/objectstack-data/evals/README.md` lists what each fixture covers and is not on the file surface, so it does not mention the new case. - Open PRs #35022 and #33849 touch the same two files; `overlap-check` merges both cleanly. #35022 adds no case 21, and #33849 changes only the unpriced version stamp line. ## Verification Head `ba3ed91491`, base `origin/main` 4443014. Round 2 (contract review 6964628467, S1 and N1) changes only case 21's assertion tokens. On `ba3ed91491`: the eval script check above, `node scripts/check-skills-token-ratchet.mjs` exit 0 with `skills/objectstack-data/SKILL.md is 6665 tokens (ceiling 6665; headroom 0)`, `node scripts/check-nul-bytes.mjs` exit 0 and `node scripts/pm/overlap-check.mjs` `VERDICT clean exit 0`. The other derived families were not re-run on this head (NOT MEASURED on `ba3ed91491`, reason: a two-line change to an unpriced eval fixture; CI runs them); the readings below are from `0b60aa4ce7`. <details><summary>Derived gates: 48 derived, 46 exit 0, 2 NOT MEASURED</summary> `node scripts/pm/dispatch-gates.mjs --commands` derives 48 commands for the three paths. All 48 were run on `0b60aa4ce7`, exit code captured before any pipe: - 46 exit 0, among them `node scripts/check-skills-token-ratchet.mjs` (and its `--self-test`), `pnpm --filter @objectstack/spec run check:skill-docs`, `pnpm --filter @objectstack/lint run check:doc-formula-expressions`, `pnpm check:skill-links`, `pnpm check:skill-identifier-liveness`, `pnpm check:skill-compatibility`, `pnpm check:skill-frame-sync`, `pnpm check:doc-authoring`, `pnpm check:nul-bytes`, `pnpm check:published-files`, `pnpm check:dts-closure`, `pnpm check:sourcemap-no-sources-content`. - NOT MEASURED: `pnpm check:dual-build-cjs-loads` and `pnpm check:lean-entry-closure`, both exit 3 ("Run `pnpm build` first"), reason: they need a full-repo build, and only the `@objectstack/lint` dependency closure was built here. CI runs them. `node scripts/pm/dispatch-gates.mjs --ran`: `48 derived famil(ies) accounted for — 46 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)`. Build: `pnpm --workspace-concurrency=2 --filter '@objectstack/lint...' build` under the verify lock, `VERDICT command-exit 0`. `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` against `origin/main` and PR heads #35022 and #33849. Not run locally, declared to CI: `test:repo`, the repo-wide lint, the full dogfood battery (no `!` in the title, no narrowing arm). </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0ad4f48 commit eb7b09d

3 files changed

Lines changed: 39 additions & 10 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-data teaches that the package shipping a `fieldPatches` relabel translates that text in its own `translations`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`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.<value>`); 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.

‎skills/objectstack-data/SKILL.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ metadata:
3535

3636
## Quick Reference — Detailed Rules
3737

38-
Detailed rules, with incorrect/correct examples:
39-
4038
- **[Naming Conventions](./rules/naming.md)** — snake_case rules, option values, config properties
4139
- **[Field Types](./rules/field-types.md)** — All field types and configs
4240
- **[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`
312310
| 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 |
313311
| 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 |
314312

315-
> **`multiple: true` lookup ≠ junction object.** A multi-value lookup
316-
> (`{ type: 'lookup', reference: 'x', multiple: true }`) is stored and read as an
317-
> **array of ids** on the record — reference elements positionally
318-
> (`{record.tags.0}` in flow values). It is NOT a junction table. Reach for a
319-
> **junction object** (two lookups) only when the relationship itself carries
320-
> attributes (role, added_at, …).
313+
> **`multiple: true` lookup ≠ junction object.** A multi-value lookup is stored
314+
> and read as an **array of ids** on the record — reference elements positionally
315+
> (`{record.tags.0}` in flow values).
321316
322317
### Validation Patterns
323318

@@ -354,8 +349,7 @@ indexes: [
354349
```
355350

356351
See [rules/indexing.md](./rules/indexing.md) for composite indexes, unique scope
357-
(`'organization'` / `'global'` — on a declared index bare `unique: true` is
358-
refused), the retired `type` / `partial`, and partial / gin / gist indexes at the
352+
(on a declared index bare `unique: true` is refused), the retired `type` / `partial`, and partial / gin / gist indexes at the
359353
database layer.
360354

361355
---
@@ -380,6 +374,11 @@ text; between two extensions the higher `priority` wins. A patch naming a field
380374
or option value the target lacks is refused at install and by `os validate`, and
381375
a `picklist`-bound field's options are never patchable. Example:
382376
`defineObjectExtension({ extend: 'crm_account', fieldPatches: { industry: { label: 'Sector' }, type: { options: { customer: { label: 'Client' } } } } })`.
377+
Translate patched text in the patching package's `translations`, under the
378+
owner's keys (`objects.crm_account.fields.industry.label`, `.help`,
379+
`.options.<value>`): the owner's translation of the replaced text never applies, a
380+
pair `.custom` translation comes first on `/meta`, and an untranslated locale
381+
serves the patch text.
383382

384383
**An object an installed package ships** is extended from the
385384
base's paired `.custom` package (`hotcrm.custom`; **objectstack-platform**

‎skills/objectstack-data/evals/objects-fields-relationships.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,26 @@
362362
"defaultCurrency: 'USD'"
363363
]
364364
}
365+
},
366+
{
367+
"id": 21,
368+
"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?",
369+
"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.",
370+
"files": [],
371+
"assertions": {
372+
"must_contain": [
373+
"translations",
374+
"acme_billing",
375+
"zh-CN",
376+
"objects",
377+
"crm_account",
378+
"industry",
379+
"customer"
380+
],
381+
"must_not_contain": [
382+
"overrides:"
383+
]
384+
}
365385
}
366386
]
367387
}

0 commit comments

Comments
 (0)