Skip to content

Commit 14899df

Browse files
committed
docs(skills): the ui actions rule keeps the refusals bundle key and names the texts key beside it
The `_actions` key spelling is graded by the ui bundle's own evals, and the with-skill arm reads that bundle only, so it stays. Paid by two sentences that restated the example right below them; the ratchet row moves by the measured remainder. Two eval assertions no longer require text the prompt hands the answerer or the bundle does not teach. Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 81eae9a commit 14899df

5 files changed

Lines changed: 30 additions & 26 deletions

File tree

‎.changeset/34962-i18n-skill-texts.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ Metadata-protocol: none
99

1010
- `objectstack-i18n`: the top-level group list names `mappings` (`mappings.{mapping}.label`, an import mapping's label by its `name`). The paragraph on keys picked in the organization's language now covers the sentences a hook or a `script` action declares in `texts` and writes through `ctx.text`: `hooks.{hook}.texts.{key}.message` and `_actions.{action_name}.texts.{key}.message`, also under `globalActions`.
1111
- `objectstack-i18n`: the caveat that label serving reads inline text as `defaultLocale` text is removed, because serving honours `i18n.sourceLocale`. What is still true stays: validation and refusal messages read labels through `t()`, which falls back to `fallbackLocale`, else `defaultLocale`, so an English-source app with a zh-CN default still declares `fallbackLocale: 'en'`.
12-
- `objectstack-ui` `rules/actions.md`: a `script` action declares a sentence it writes into a record under `texts` and asks for it with `ctx.text`. The rule covers the organization's language, a missing translation, an unreadable Localization setting and an undeclared key. The refusals paragraph points at the i18n skill for its bundle keys instead of spelling them.
12+
- `objectstack-ui` `rules/actions.md`: a `script` action declares a sentence it writes into a record under `texts` and asks for it with `ctx.text`. The rule covers the organization's language, the `texts.<key>.message` key beside the refusals key, a missing translation, an unreadable Localization setting and an undeclared key. Two sentences that restated the example below them are shorter.
13+
- `objectstack-i18n` pays for its new text in the same file. It drops a sentence that restated the option-key paragraph, two flags from the `extract --help` list that are taught in place, two partial copies of the group list, and the empty "Translate" step.
1314
- Evals: the i18n set gains a `mappings` case and a hook-texts bundle-key case, and case 11 states the remaining `t()` reason for `fallbackLocale: 'en'`. The ui set gains an action `texts` case.

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,20 +1424,22 @@ export const CEILINGS = new Map([
14241424
// in the text that row moved in). Same ruling as the lines above (2026-10-27, tap A):
14251425
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068).
14261426
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12720 / 4)
1427-
// 3180 -> 3334 (#35097): a script action writes a sentence in the organization's language.
1427+
// 3180 -> 3333 (#35097): a script action writes a sentence in the organization's language.
14281428
// One H3 after the refusals paragraph: declare it under `texts`, ask for it with `ctx.text`, the
1429-
// missing-translation and unreadable-setting answers, and when an undeclared key is refused;
1430-
// the bundle keys are the i18n skill's and only pointed at. PAID DOWN FIRST by 29 bytes of
1431-
// restatement in this file: the refusals paragraph no longer spells the bundle key
1432-
// `objects.<object>._actions.<action>.refusals.<CODE>.message`, which objectstack-i18n owns
1433-
// (its `_actions.{action_name}.refusals.{CODE}` row), and points there instead. Nothing else
1434-
// in the file restates another passage (see the 2777 -> 2808 note above), so the same ruling's
1435-
// second half carries the rest. Arithmetic: the text adds 644 bytes, the cut removes 29, so
1436-
// the file is 12720 -> 13335 bytes -> 3334 tokens, zero headroom before, ceiling +154, the
1437-
// measured remainder only, pinned AT the measurement. Same ruling (2026-10-27, tap A):
1438-
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B).
1439-
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(13335 / 4)
1440-
['skills/objectstack-ui/rules/actions.md', 3334],
1429+
// missing-translation and unreadable-setting answers, when an undeclared key is refused, and the
1430+
// `texts.<key>.message` key beside the refusals key the paragraph above spells (that key stays:
1431+
// the bundle's evals grade `_actions` and the with-skill arm reads this bundle only). PAID DOWN
1432+
// FIRST by 53 bytes of restatement in this file, each of an example right below its sentence:
1433+
// " as `${result.output.NAME}`" in the `onSuccess` sentence (27; the Convert Lead block's
1434+
// `${result.output.opportunity_id}` shows the spelling) and "`{recordId}` placeholder; " in the
1435+
// `newTabUrl` sentence (26; the Open PDF block's `newTabUrl: '/api/v1/invoice/{recordId}/pdf'`
1436+
// shows it). Nothing else in the file restates another passage (see the 2777 -> 2808 note
1437+
// above), so the same ruling's second half carries the rest. Arithmetic: the text adds 663
1438+
// bytes, the cuts remove 53, so the file is 12720 -> 13330 bytes -> 3333 tokens, zero headroom
1439+
// before, ceiling +153, the measured remainder only, pinned AT the measurement. Same ruling
1440+
// (2026-10-27, tap A): 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B).
1441+
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(13330 / 4)
1442+
['skills/objectstack-ui/rules/actions.md', 3333],
14411443
// 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top,
14421444
// anchors to the file's existing headings, nothing else changed. +162 tokens,
14431445
// zero headroom to absorb any of it, ceiling +162. Maintainer ruling

‎skills/objectstack-i18n/evals/bundles-locales-coverage.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@
144144
{
145145
"id": 15,
146146
"prompt": "The `lead_follow_up` hook declares `texts: { follow_up_subject: { message: 'Follow up with qualified lead: {{ lead }}', params: ['lead'] } }` and writes a task subject with `ctx.text('follow_up_subject', { lead: ctx.input.name })`. Our organization works in zh-CN, but the tasks still read English. Which bundle key translates it, and whose language is picked?",
147-
"expected_output": "`hooks.lead_follow_up.texts.follow_up_subject.message` in the zh-CN bundle, keyed by the hook's `name` (not under `objects` or `messages`), the translation keeping its `{{ lead }}` hole, which the runtime fills after picking it: `'跟进已确认的线索:{{ lead }}'`. It is picked in the organization's language — the Localization setting if somebody set it, else `i18n.defaultLocale` — never the language of the person whose save fired the hook. With no translation the declared sentence is written, filled.",
147+
"expected_output": "`hooks.lead_follow_up.texts.follow_up_subject.message` in the zh-CN bundle, keyed by the hook's `name` (not under `objects` or `messages`), the translation keeping its `{{ lead }}` hole, which the runtime fills after picking it: `'跟进已确认的线索:{{ lead }}'`. It is picked in the organization's language — the Localization setting if somebody set it, else `i18n.defaultLocale` — never the language of the person whose save fired the hook.",
148148
"files": [],
149149
"assertions": {
150-
"must_contain": ["hooks", "lead_follow_up", "texts", "follow_up_subject", "{{ lead }}", "defaultLocale"],
150+
"must_contain": ["hooks", "lead_follow_up", "texts", "follow_up_subject", "defaultLocale"],
151151
"must_not_contain": ["messages: {", "_hooks"]
152152
}
153153
}

‎skills/objectstack-ui/evals/views-apps-actions-pages.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
"files": [],
209209
"assertions": {
210210
"must_contain": ["texts", "email_subject", "ctx.text", "_actions"],
211-
"must_not_contain": ["'Email: ' +", "hooks.send_email"]
211+
"must_not_contain": ["hooks.send_email"]
212212
}
213213
}
214214
]

‎skills/objectstack-ui/rules/actions.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const ReassignLeadAction = defineAction({
6464

6565
## Examples
6666

67-
`onSuccess` hops once the flow run completes, not when it pauses at a screen; its URL template reads an `isOutput` variable as `${result.output.NAME}`:
67+
`onSuccess` hops once the flow run completes, not when it pauses at a screen; its URL template reads an `isOutput` variable:
6868

6969
<!-- os:check -->
7070
```typescript
@@ -137,18 +137,19 @@ Bodies execute **trusted** (`ctx.api` /
137137
with a `js` body (an inline `target` function is lowered to one; any other action is refused the
138138
key) declares `refusals` and throws the code, as `crm_add_invoice_line` below does: the catalogue,
139139
throws and checks are a hook's (objectstack-data → Lifecycle Hooks → Declared refusals). The
140-
sentence is answered as `userMessage`, translated under the action's `refusals` keys
141-
(objectstack-i18n); the console's failure toast shows it unless the action authors `errorMessage`.
140+
sentence is answered as `userMessage`, translated at
141+
`objects.<object>._actions.<action>.refusals.<CODE>.message` (objectstack-i18n); the console's
142+
failure toast shows it unless the action authors `errorMessage`.
142143

143144
### Writing in the organization's language (`texts`)
144145

145-
A sentence the body writes into a record (an activity's subject) is read by the whole
146-
organization: the same actions declare it under `texts` and ask for it by key —
146+
A sentence the body writes into a record (an activity's subject) is read organization-wide:
147+
the same actions declare it under `texts` and ask for it by key —
147148
`texts: { email_subject: { message: 'Email: {{ subject }}', params: ['subject'] } }`, then
148149
`await ctx.text('email_subject', { subject: input.subject })`. It answers in the organization's
149-
language, never the caller's (keys: objectstack-i18n); with no translation the declared sentence
150-
is written, filled; an unreadable Localization setting rejects. An undeclared key is refused: at
151-
save when named literally, else at run.
150+
language, never the caller's, translated at the same node's `texts.<key>.message`; with no
151+
translation the declared sentence is written, filled; an unreadable Localization setting
152+
rejects. An undeclared key is refused at save when named literally, else at run.
152153

153154
## Opening in a New Tab
154155

@@ -177,7 +178,7 @@ export const PrintA3Action = defineAction({
177178
A redirect URL **computed after a fetch**: `opensInNewTab:
178179
true` pre-opens the tab synchronously on click (no popup blocker), then navigates
179180
it to the handler's `redirectUrl`. `newTabUrl` skips the round-trip — a backend
180-
path starting with `/` (`{recordId}` placeholder; an external URL is refused, use
181+
path starting with `/` (an external URL is refused, use
181182
`openIn`), valid only with `opensInNewTab: true`; the endpoint enforces its own
182183
auth (the tab carries no in-app session).
183184

0 commit comments

Comments
 (0)