Skip to content

Commit b3863b7

Browse files
docs(skills): objectstack-formula teaches label() over a multi-select and the timestamp() refusal over a date field (#34484)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9171vgqqqLwGXb1ijPmb3ta)_ Fixes #34444 Fixes #34450 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:对外发布的 `objectstack-formula` 技能补两句已上线行为——`label()` 用在多选字段上会按读者语言读出每个已选项的标签、按存储顺序用 `, ` 连接(空选择读 `''`);`timestamp()` 只认完整时间戳文本,对日期字段会被构建拒绝(`date-text-call`),日期平移要写 `isoDate(addDays(record.d, n))`。各配一条 eval。 - 为什么改:这两项行为分别由 #34443、#34447 落地,但 AI 作者只读技能、不读文档页;不教的话会继续给每个选项建一个字段,或写出 `timestamp(record.borrow_date) + duration('168h')` 这种每行都失败的公式。 - 风险与回滚:只改技能文本、eval、token 棘轮一行和 changeset,不动任何代码与契约。先删三处重复内容付账,余下 +11 token 按维护者常设裁决「A:先削重复,余额按实测提高」抬上限(5997 → 6008)。回滚即 revert。 - 先看:`skills/objectstack-formula/SKILL.md`(`label(record.f)` 行与 `Plus CEL built-ins` 段,以及三处删除)、`scripts/check-skills-token-ratchet.mjs` 的 formula 行注释、`skills/objectstack-formula/evals/cel-predicates-formulas.json` 新增的 11、12 两条。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 formula 行读 `6008 / 6008`,全部文件在上限内。 - 需要你做的:审批这个受治理 PR(Tier H,`skills/**`);席位会在 L1 与达档契约复审通过后补席位记录再请审。 ## What changes `skills/objectstack-formula/SKILL.md`, the published formula skill, now teaches two behaviours `@objectstack/formula` already ships: 1. **`label()` over a multi-select** (#34444, the `Skills-docs:` follow-up of PR #34443). The `label(record.f)` row adds: a multi-select (`multiple: true`) reads each selected label in stored order, joined with `, `; `''` for null *or an empty selection*. Wording follows `content/docs/data-modeling/formulas.mdx` as PR #34443 landed it. 2. **`timestamp()` over a date field is refused** (#34450, the `Skills-docs:` follow-up of PR #34447). The built-ins line that lists `timestamp(s)` adds: `timestamp()` parses only a full ISO instant, so over a `date` field (`YYYY-MM-DD`) the build refuses it (`date-text-call`), `+ duration(…)` included; shift a date with `isoDate(addDays(record.d, n))`. Wording follows the formulas page row PR #34447 landed and the `firstDateTextCall` docblock in `packages/formula/src/cel-engine.ts` (a `datetime` field's text is an instant and is not refused, so the sentence names the `date` field only). `skills/objectstack-formula/evals/cel-predicates-formulas.json` gains one case per card (ids 11 and 12). **Token ceiling — paid down first, raised by the measured remainder.** The file sat at headroom 9. Under the standing maintainer ruling of 2026-10-27, verbatim and untranslated, 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B), three restatements were cut, each keeping another home: | Cut | Its other home | |:---|:---| | `has()` paragraph: "To check for "value present and non-blank" use the stdlib helper `isBlank()` or compare to `null` explicitly." | the cheat-sheet `Null check` row (`record.foo == null` or `isBlank(record.foo)`) and the next paragraph's "`!= null` is the whole guard" | | template section: "`shared/expression.zod.ts` declares both surfaces and their carriers." | Core contract ("declared as `Expression` / `ExpressionInput` in `shared/expression.zod.ts`"), the table's `Carriers` column, and See also | | translation-table note: "on update and delete events it is bound per matched row — see §5" | the §5 `previous` table's `after*` / `before*` / bulk rows; the note keeps its pointer `(§5)` | Arithmetic in priced bytes (stamp line excluded), against `main`'s 23952: the text adds 321, the cuts remove 243, landed 24030 → `ceil(24030 / 4)` = 6008. The row moves 5997 → 6008 (+11), pinned at the measurement, with the arithmetic in the row comment. No re-wrap was used to pay. **Line and token readings (os-dev.md, `skills/**`):** | | before | after | |:---|---:|---:| | `skills/objectstack-formula/SKILL.md` lines | 492 | 493 | | `skills/objectstack-formula/SKILL.md` tokens | 5988 | 6008 | | all `skills/**/SKILL.md` lines (whole package) | 4592 | 4593 | | all `skills/**/SKILL.md` tokens | +0 elsewhere | +20 (this file only) | Net line budget set at the claim: +4 on the SKILL.md; used +1. ## Tests No code changes. The two eval cases are the exercise: id 11 asserts `label(record.no_margin_reasons)` and refuses a hand-built `joinNonEmpty`; id 12 asserts `isoDate(addDays(record.borrow_date, 7))` and refuses `timestamp(record.borrow_date)`. No existing test was changed. ## Acceptance notes - Fold: one PR for two cards that edit the same file (claim 6931123459 on #34444, member claim 6931145551 on #34450); one commit per card plus one paydown commit. - Model tier: the `--tier` reading is MANDATORY `CONTRACT_REVIEW_TIER` for `skills/**`; this PR was authored at `TIER_DEFAULT` under the proactive low-headroom downgrade (claim `Container & model:` line). The compensating control is the at-tier contract review routed by the seat to the review seat. Contract review owed. - Out of scope: the "Shift a date" row of the Dates table already names `addDays`; it is unchanged. ## Verification `node scripts/pm/dispatch-gates.mjs --commands` derives 66 commands for this diff. They run serially under the verify lock after a full `pnpm build`; the `CMD :: exit N` ledger and its `--ran` reconciliation are posted as a PR comment on the final head when the run ends. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no names added) - [x] 3. No formatter ran. (the only script edit is a comment block and one number in `scripts/check-skills-token-ratchet.mjs`; CI's lint job judges it) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. (a two-card fold of the same file, both claims name this branch) - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. (the 维护者速读 block excepted) - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmSXPDB46NVRepWVrL3 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d11756a commit b3863b7

4 files changed

Lines changed: 58 additions & 7 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): `objectstack-formula` teaches `label()` over a multi-select and the `timestamp()` refusal over a date field
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The `label(record.f)` row of the `objectstack-formula` built-ins table now says what a select with `multiple: true` reads: each selected value's option label in the reader's locale, in the order the record stores them, joined with `, `; an empty selection reads `''`, as null does.
11+
12+
The built-ins line that lists `timestamp(s)` now says that `timestamp()` parses only a full ISO instant, so over a `date` field (its `YYYY-MM-DD` text) the build refuses it as `date-text-call`, inside `+ duration(…)` arithmetic too, and that a date is shifted with `isoDate(addDays(record.d, n))`. Both are the behaviour `@objectstack/formula` already ships; the skill only teaches it. One eval case covers each.
13+
14+
Paid down first under the standing ruling 「A:先削重复,余额按实测提高」 (ruling record 6513306068): three restatements were cut, each keeping another home — the `has()` paragraph's null-check sentence (the cheat-sheet `Null check` row), the template section's `shared/expression.zod.ts` sentence (Core contract and See also), and the translation-table note's per-matched-row clause (the §5 `previous` table). The token ceiling moves by the measured remainder, +11 (5997 → 6008).

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,23 @@ export const CEILINGS = new Map([
684684
// raise path is the standing 2026-10-27 ruling, verbatim and untranslated:
685685
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068).
686686
['skills/objectstack-data/SKILL.md', 6665],
687-
['skills/objectstack-formula/SKILL.md', 5997], // -53 (was 6055), then -5 A2′ (was 6002)
687+
// 5997 -> 6008 (the formula skills follow-ups of PRs #34443 and #34447): the
688+
// `label(record.f)` row teaches a multi-select (`multiple: true`) reading each
689+
// selected label in stored order, joined with `, `, and the built-ins line
690+
// teaches that `timestamp()` over a `date` field is refused (`date-text-call`)
691+
// and that a date shifts with `isoDate(addDays(record.d, n))`. Raise path the
692+
// standing ruling 「A:先削重复,余额按实测提高」 (ruling record 6513306068,
693+
// letter B). PAID DOWN FIRST — three restatements cut, each keeping its other
694+
// home (listed in the PR body): the `has()` paragraph's null-check sentence
695+
// (the cheat-sheet `Null check` row), the template section's
696+
// `shared/expression.zod.ts` sentence (Core contract and See also), and the
697+
// translation-table note's per-matched-row clause (§5's table). Arithmetic in
698+
// priced bytes (stamp line excluded), against `main`'s 23952 (headroom 9): the
699+
// text adds 321, the cuts remove 243, so the LANDED priced text is 24030
700+
// bytes -> ceil(24030 / 4) = 6008; the ceiling moves +11, the measured
701+
// remainder only. Pinned AT the measurement.
702+
// ceil(($(wc -c < skills/objectstack-formula/SKILL.md) - 20) / 4) == ceil(24030 / 4)
703+
['skills/objectstack-formula/SKILL.md', 6008], // -53 (was 6055), then -5 A2′ (was 6002), then +11 (was 5997)
688704
['skills/objectstack-i18n/SKILL.md', 6333], // -11 (was 6349), then -5 A2′ (was 6338)
689705
// 12705 -> 12984 (2026-08-31 app-repo-principles raise, see the block above).
690706
// The largest of the five and the frame the other four are read under: what an

‎skills/objectstack-formula/SKILL.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ ADR-0068 — spec field docs write predicates like `current_user.positions`.
9191
### `has()` is NOT a null check
9292

9393
`has(record.x)` is **true whenever the key exists**, even when its value is
94-
`null`. To check for "value present and non-blank" use the stdlib helper
95-
`isBlank()` or compare to `null` explicitly.
94+
`null`.
9695

9796
Every server-evaluated predicate — validation rules, `requiredWhen`, option
9897
`visibleWhen`, `readonlyWhen`, hook `condition`, the flow trigger record —
@@ -213,10 +212,13 @@ tests: every entry resolves at runtime, and this table documents them all.
213212

214213
| Function | Returns | Notes |
215214
|:---|:---|:---|
216-
| `label(record.f)` | string | A select value's option label in the reader's locale: `'v' + string(record.version_no) + ' · ' + label(record.kind)` reads `v2 · 清稿` (zh-CN), `v2 · Clean` (en-US). Only `record.<field>`; `''` for null. A stored (non-formula) field stores the declared label. Formula fields only: in a predicate (validation, visibility, hook) it faults, so compare the stored value |
215+
| `label(record.f)` | string | A select value's option label in the reader's locale: `'v' + string(record.version_no) + ' · ' + label(record.kind)` reads `v2 · 清稿` (zh-CN), `v2 · Clean` (en-US). Only `record.<field>`; `''` for null or an empty selection. A multi-select (`multiple: true`) reads each selected label in stored order, joined with `, `. A stored (non-formula) field stores the declared label. Formula fields only: in a predicate (validation, visibility, hook) it faults, so compare the stored value |
217216

218217
Plus CEL built-ins: `has(x)`, `size(x)`, `int(x)`, `string(x)`, `bool(x)`,
219-
`double(x)`, `timestamp(s)`, `duration(s)`.
218+
`double(x)`, `timestamp(s)`, `duration(s)`. `timestamp()` parses only a full
219+
ISO instant, so over a `date` field (`YYYY-MM-DD`) the build refuses it
220+
(`date-text-call`), `+ duration(…)` included; shift a date with
221+
`isoDate(addDays(record.d, n))`.
220222

221223
> Receiver methods (`s.split(',')`,
222224
> `list.map(...)`) are called on a value, never bare, and are not in this table;
@@ -399,7 +401,7 @@ When migrating Salesforce-flavor metadata, apply these rules in order:
399401

400402
> ⚠️ `OLD.x` and `ISCHANGED(x)` both land on `previous.x`, which is `null` on an
401403
> insert event and **fails the write** there unless guarded by `previous != null
402-
> &&`; on update and delete events it is bound per matched row — see §5.
404+
> &&` (§5).
403405
404406
> ⚠️ **Flow conditions are the exception to row 1.** The engine spreads the
405407
> trigger record's fields, nulls included, to top level wherever no flow variable
@@ -463,7 +465,6 @@ a bare string (auto-wrapped) or their helper, and read the same variable scope.
463465
| `cron` | `` cron`0 6 * * MON` `` | 5- or 6-field cron, or one of `@yearly` `@annually` `@monthly` `@weekly` `@daily` `@hourly` `@reboot` | `Job.schedule.expression` (canonical) |
464466
| `template` | `` tmpl`Hello {{ record.first_name }}` `` | `{{ path }}` or `{{ path \| formatter[:arg] }}` — double braces only, no conditionals; the formatter whitelist is `TEMPLATE_FORMATTERS`, exported from `@objectstack/formula` | `system/email-template` `subject` / `bodyHtml` / `bodyText`, `ai/model-registry` `promptTemplate.system` / `.user`, `Object.titleFormat` (a save and `os validate` refuse it; move it to `nameField`, ADR-0079) |
465467

466-
`shared/expression.zod.ts` declares both surfaces and their carriers.
467468
Missing template paths render as the empty string. Move logic into a CEL field.
468469
A `currency` argument is a
469470
literal code (`currency:EUR`); only an email template may read it from the send's

‎skills/objectstack-formula/evals/cel-predicates-formulas.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,26 @@
100100
"must_contain": ["isoDate(date(record.start_at))", "F`"],
101101
"must_not_contain": ["isoDate(record.start_at)", "{record."]
102102
}
103+
},
104+
{
105+
"id": 11,
106+
"prompt": "On `quote_line`, `no_margin_reasons` is a select field with `multiple: true`. Add a `margin_note` formula that shows the selected reasons as text, in the reader's language.",
107+
"expected_output": "`F`label(record.no_margin_reasons)``. On a multi-select, `label()` reads each selected value's option label in the reader's locale, in the order the record stores them, joined with `, ` (`No sales price, No customer` to an `en-US` reader); an empty selection reads `''`. No per-option ternary or extra field is needed.",
108+
"files": [],
109+
"assertions": {
110+
"must_contain": ["label(record.no_margin_reasons)", "F`"],
111+
"must_not_contain": ["joinNonEmpty", "{record."]
112+
}
113+
},
114+
{
115+
"id": 12,
116+
"prompt": "On `loan`, add a `due_on` formula: 7 days after the `borrow_date` date field, as `YYYY-MM-DD` text.",
117+
"expected_output": "`F`isoDate(addDays(record.borrow_date, 7))``. A `date` field reads as its `YYYY-MM-DD` text, and `timestamp()` parses only a full ISO instant, so the build refuses `timestamp()` over the field, alone or plus a duration (`date-text-call`). `addDays` shifts the date by whole days and `isoDate` keeps the result a date.",
118+
"files": [],
119+
"assertions": {
120+
"must_contain": ["isoDate(addDays(record.borrow_date, 7))", "F`"],
121+
"must_not_contain": ["timestamp(record.borrow_date)", "{record."]
122+
}
103123
}
104124
]
105125
}

0 commit comments

Comments
 (0)