Skip to content

Commit d11756a

Browse files
docs(skills): teach the record write's text envelope and its organization-language key (#34499)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9QtbmWARfNoXczSYr8gtC8v)_ Fixes #34434 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:两份对外技能补上已落地的行为(#34438):`objectstack-automation` 教流程 `create_record` / `update_record` 的字段值可以写成文本信封 `{ dialect: 'template', source }`,按组织语言写入;`objectstack-i18n` 写出它的译文键 `flows.FLOW.records.NODE_ID.fields.FIELD`。 - **为什么改**:AI 作者只读 `skills/**`。不教的话,中文组织的应用(hotcrm 的工单升级)会继续写英文裸字符串,平台原样存进记录,没人告诉作者有标记文本的写法。 - **风险与回滚**:只改技能文本,不改运行时。automation 文件的 token 天花板按实测从 6861 抬到 6903(+42),先删了三处别处已有的重复句来付账。回滚 = revert 本 PR。 - **先看**:`skills/objectstack-automation/SKILL.md`(Valid-but-silently-wrong 第 1 条新增的六行,以及被删的三处);`scripts/check-skills-token-ratchet.mjs`(automation 行的抬升与算式);`skills/objectstack-i18n/SKILL.md`(flows 深层键那一段)。 - **两分钟验证**:`node scripts/check-skills-token-ratchet.mjs`,预期 automation 显示 `6903 / 6903`、i18n 显示 `6219 / 6333`,整体通过。 - **需要你做的**:受治理面(`skills/**`),等你批准后由席位落地。 ## What changes - **`skills/objectstack-automation/SKILL.md`**, Valid-but-silently-wrong item 1: after the text-slot paragraph, a `create_record` / `update_record` `fields` value takes a third form, the text envelope `{ dialect: 'template', source }`, for a sentence people read. Its `source` is a text slot (the paragraph above it: `{{ }}` holes, a single-brace token refused). It is written in the organization's language (the Localization setting if set, else the app's `i18n.defaultLocale`; the key lives in objectstack-i18n), never the run starter's; untranslated, the authored text is written; an unreadable setting fails the node. A bare string stays a literal and is never translated. Each clause was read against what #34438 landed: `FlowRecordFieldValueSchema` (`packages/spec/src/automation/builtin-node-config.zod.ts`), `resolveFieldValues` (`packages/services/service-automation/src/builtin/crud-nodes.ts`), `resolveOrganizationLocale` (`packages/core/src/organization-locale.ts`) and `content/docs/automation/flows.mdx` § "Text a record keeps". - **`skills/objectstack-i18n/SKILL.md`**, the paragraph naming the keys that sit deeper than their group's `label`: it now names three, adding `flows.{flow}.records.{node_id}.fields.{field}` for a field marked with the text envelope, picked in the organization's language, never the run starter's; `os i18n extract --no-objects-only` scaffolds all three (the walker branch in `packages/lint/src/i18n-walk.ts`, pinned by `packages/cli/test/i18n-flow-record-text-coverage.test.ts`). The coverage check reads the same walker, so no new wording was needed for it. - **Paid down first** in `objectstack-automation/SKILL.md` (restatements with another home): 1. The CEL callout's "Contract, stdlib, legacy → CEL table: **objectstack-formula**." Survives in the same file's frontmatter description: "CEL expressions in flow conditions / edge guards: load objectstack-formula alongside." 2. The Trigger Configuration lead-in "A flow around it also owns `label`, `type`, `nodes` and the `edges` `FlowSchema` requires:". Survives in `references/examples-flows.md`, whose flows show every top-level key. 3. Item 3's `'helpdesk.aiTriageStub': … // pure — the default` row of the `functions` example. Survives in the same item: "A flow `function` is a PURE compute step"; the `billing.sync` row that declares `effect: 'writes'` stays. - **`scripts/check-skills-token-ratchet.mjs`**: the `objectstack-automation/SKILL.md` row moves 6861 → 6903, the measured remainder after the cuts, pinned at the measurement, with the byte arithmetic in the row comment. Raise path: the standing maintainer ruling 「A:先削重复,余额按实测提高」 (2026-10-27, ruling record 6513306068, letter B). The `objectstack-i18n` row is unchanged (headroom 187 → 114). The state-introspection route after the State Machines pointer was cut at first and is restored: `packages/rest/src/meta-state-route-doc-spelling.test.ts` (`test:repo`) pins this file as one of the route's teaching sites, and Test Core shard 2/8 went red on it at 7101d3c. - **`.changeset/34434-skills-flow-record-text.md`**: `'@objectstack/skills': patch`. Not in scope: hooks and actions (#34374). No eval case was added (the claim allows at most one per skill; none was needed to carry the teaching, and each would cost tokens in a priced file). ## Line and token readings (`skills/**`) | File | Lines before → after | Tokens before → after (ceiling) | |:--|:--|:--| | `skills/objectstack-automation/SKILL.md` | 460 → 462 (+2) | 6858 → 6903 (6861 → 6903) | | `skills/objectstack-i18n/SKILL.md` | 530 → 533 (+3) | 6146 → 6219 (6333) | | All `skills/*/SKILL.md` | 4599 → 4604 (+5) | 59380 → 59498 (+118) | Line budget from the claim: net +3 lines on each of the two files; both are within it. Tokens are the ratchet's `ceil(priced bytes / 4)`, read from `node scripts/check-skills-token-ratchet.mjs` before (origin/main 24b6ae5) and after. ## Tests None changed or added: the diff is skill text, a ratchet row and a changeset. `pnpm --filter @objectstack/rest exec vitest run --project repo` at 0085ff5: 5 files, 300 passed, 23 skipped (it reads this skill). ## Verification Gate results at the final head are in the os-dev report on #34434 and in this PR's check runs. <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmSXPDB46NVRepWVrL3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 52ec26f commit d11756a

4 files changed

Lines changed: 50 additions & 9 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): teach a flow record write's text envelope and its organization-language key
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`objectstack-automation` now says that a `create_record` / `update_record` `fields` value takes a third form beside the literal and the CEL envelope: the text envelope `{ dialect: 'template', source }`, for a sentence people read. Its `source` is a text slot, it is written in the organization's language (the Localization setting when somebody set it, else the app's `i18n.defaultLocale`), never in the language of the person who started the run, a missing translation writes the authored text, and a Localization setting that cannot be read fails the node. A bare string stays a literal and is never translated.
11+
12+
`objectstack-i18n` names the key that translation lives at, `flows.FLOW.records.NODE_ID.fields.FIELD`, beside the other keys that sit deeper than their group's `label`, and says `os i18n extract --no-objects-only` scaffolds it.
13+
14+
To pay for the text, `objectstack-automation` drops three sentences that are said elsewhere: the CEL callout's pointer to `objectstack-formula` (the skill's description already says to load it), the Trigger Configuration lead-in listing a flow's top-level keys (the examples reference shows whole flows), and the pure-function row of the `functions` example (the same item says a flow function is a pure compute step).

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,29 @@ export const CEILINGS = new Map([
612612
// status to a flow door: +37 bytes, no further restatement left to cut).
613613
// Pinned AT the measurement.
614614
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 20) / 4) == ceil(27443 / 4)
615-
['skills/objectstack-automation/SKILL.md', 6861],
615+
// 6861 -> 6903 (2026-11-16, card #34434, the skills follow-up of #34062):
616+
// silently-wrong item 1 teaches the third `create_record` / `update_record`
617+
// `fields` form, the text envelope `{ dialect: 'template', source }`: written
618+
// in the organization's language (Localization setting, else the app's
619+
// `i18n.defaultLocale`), never the run starter's; untranslated, the authored
620+
// text; an unreadable setting fails the node; a bare string stays a literal.
621+
// Raise path the standing ruling 「A:先削重复,余额按实测提高」 (ruling record
622+
// 6513306068, letter B). PAID DOWN FIRST — three restatements cut, each keeping
623+
// its other home: the CEL callout's "Contract, stdlib, legacy → CEL table:
624+
// objectstack-formula" (the frontmatter description's "load
625+
// objectstack-formula alongside"); the Trigger Configuration lead-in naming
626+
// the flow's `label` / `type` / `nodes` / `edges` (references/examples-flows.md's
627+
// whole flows); item 3's `// pure — the default` function row (the same item's
628+
// "A flow `function` is a PURE compute step"). The state-introspection route
629+
// after the State Machines pointer is NOT a cut: packages/rest's
630+
// meta-state-route-doc-spelling test pins this file as one of its teaching
631+
// sites. Arithmetic in priced bytes (stamp line excluded), against `main`'s
632+
// 27431 (headroom 3): the diff's added lines carry 441 bytes and its removed
633+
// lines 261 (a trimmed line counted on both sides), net +180, so the LANDED
634+
// priced text is 27611 bytes -> ceil(27611 / 4) = 6903; the ceiling moves +42,
635+
// the measured remainder only. Pinned AT the measurement.
636+
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 20) / 4) == ceil(27611 / 4)
637+
['skills/objectstack-automation/SKILL.md', 6903],
616638
// 13783 -> 13892 (2026-08-31 app-repo-principles raise, see the block above).
617639
// The invariant-vs-transition-gate choice, placed in the field-conditional-rule
618640
// bullet list where the tool is actually picked. Both wrong picks are silent:

‎skills/objectstack-automation/SKILL.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Also vendor-integration callbacks and **assignment rules**.
2727
> **Predicates and conditions are CEL** — every `condition` / `guard` /
2828
> `entryCondition` / filter `value` is an **Expression** envelope: a plain CEL
2929
> string, or the `P\`...\`` / `cel\`...\`` tag (author-time validation); pick one
30-
> per file. Contract, stdlib, legacy → CEL table: **objectstack-formula**.
30+
> per file.
3131
3232
---
3333

@@ -251,6 +251,12 @@ Most are caught by `objectstack build`:
251251
is refused with its `{{ }}` spelling. A date or the run user has no hole:
252252
assign it first (`assignments: { v: { dialect: 'cel', source:
253253
'current_user.id' } }`), then write `{{ v }}`.
254+
`create_record` / `update_record` `fields` also take a text slot, marked
255+
`{ dialect: 'template', source }`, for a sentence people read. It is written
256+
in the organization's language (Localization setting if set, else
257+
`i18n.defaultLocale`; key: **objectstack-i18n**), never the run starter's;
258+
untranslated, the authored text; an unreadable setting fails the node. A
259+
bare string stays a literal, never translated.
254260

255261
2. **`create_record`'s `outputVariable` holds the created RECORD, not its id.**
256262
❌ `fields: { ref: { dialect: 'cel', source: 'newRec' } }`
@@ -294,7 +300,6 @@ Most are caught by `objectstack build`:
294300

295301
```ts
296302
defineStack({ functions: {
297-
'helpdesk.aiTriageStub': (ctx) => ({ ai_category: 'other' }), // pure — the default
298303
'billing.sync': { handler: syncBilling, effect: 'writes' },
299304
} });
300305
```
@@ -406,9 +411,6 @@ the **start node `config`**:
406411

407412
### Trigger Configuration — on the `start` node
408413

409-
A flow around it also owns `label`, `type`, `nodes` and the `edges`
410-
`FlowSchema` requires:
411-
412414
```typescript
413415
{
414416
id: 'start',

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,14 @@ book once carried stays retired), `metadataForms`, `settingsCommon`; `reports`,
183183
`datasets.{dataset}.{dimensions,measures}.{member}` (a member's `synonyms` have no key: one
184184
authored list carries every language), and a joined report's block headings sit at
185185
`reports.{report}.blocks.{block_name}.{label,description}`, keyed by the block's required `name`.
186-
Two keys sit deeper than their group's `label`: a `page:tabs` item at
186+
Three keys sit deeper than their group's `label`: a `page:tabs` item at
187187
`pages.{page}.components.{tabs_id}.items.{value}.label` (by the item's `value`; an item without
188-
one has no key) and an approval step at `flows.{flow}.approvals.{node_id}.label`.
188+
one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, and the text a
189+
`create_record` / `update_record` writes into a field marked `{ dialect: 'template', source }` at
190+
`flows.{flow}.records.{node_id}.fields.{field}`, picked in the organization's language (the
191+
Localization setting if set, else `i18n.defaultLocale`; never the run starter's).
189192
`os i18n extract --no-objects-only` scaffolds every group above but `messages` and
190-
`settingsCommon`, both keys included. The `inlineTitle` and report-block keys, as the
193+
`settingsCommon`, all three keys included. The `inlineTitle` and report-block keys, as the
191194
shipped `app-crm` and `app-showcase` bundles spell them for `zh-CN`:
192195

193196
```typescript

0 commit comments

Comments
 (0)