Skip to content

Commit a36bf3a

Browse files
committed
docs(skills): the formula skill says the build refuses date subtraction
The "No date arithmetic" note in objectstack-formula said `end - start` does not fault and yields a duration stored as `{}`. With the formula gate refusing bare date subtraction, the note now says the build refuses both `date + n` and `end - start` and prescribes `daysBetween(a, b)`. The dashboards rule, the analytics eval prompt and a formula eval stop describing a stored formula that subtracts dates. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAjkjQLh4kZsuRAM4iV
1 parent a4015ab commit a36bf3a

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-formula says the build refuses date subtraction (`end - start`), and the skills stop describing a stored formula that subtracts dates
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Before.** The "No date arithmetic" note in `objectstack-formula` said `end - start` "does not fault — it yields a `duration` stored as `{}`", which read as a shape that builds. `objectstack-ui` `rules/dashboards.md` and an analytics eval described a leave-days formula written as `end - start`, and a formula eval explained `record.close_date - today()` as "a duration stored as `{}`".
11+
- **Now.** The note says the build refuses both `date + n` and `end - start`: a date or date-time mixed with a number, or minus another, reads `null`, and `today()` / `now()` minus a date field reads `{}`. It prescribes `daysBetween(a, b)` and keeps the Want / Write table. The leave-days formula is written `daysBetween(start, end)` in the dashboards rule and `daysBetween(record.start_date, record.end_date)` in the eval prompt, and the formula eval says the build refuses `record.close_date - today()`.
12+
- The formula gate change itself ships in `@objectstack/formula` (`formula-date-subtraction-refused`). `SKILL.md` and `rules/dashboards.md` stay under their token ceilings (no ceiling moves). No schema, key, command or behaviour changes.

‎skills/objectstack-formula/SKILL.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ tests: every entry resolves at runtime, and this table documents them all.
148148
| `date(s)` / `datetime(s)` | timestamp | Parse an ISO date / date-time string to a timestamp |
149149
| `isoDate(t)` / `isoDatetime(t)` | string | Timestamp to UTC ISO text, `2026-10-08` / `2026-10-08T17:55:06.123Z`. Text in? `isoDate(date(s))` |
150150

151-
> **No date arithmetic.** A date mixed with a number faults and the build
152-
> rejects it; `end - start` does not fault — it yields a `duration` stored as
153-
> `{}`.
151+
> **No date arithmetic.** The build refuses `date + n` and `end - start`: a
152+
> date or date-time mixed with a number, or minus another, reads `null`, and
153+
> `today()` / `now()` minus a date field reads `{}`. Use `daysBetween(a, b)`.
154154
155155
| Want | Write — never `end - start`, `date + n`, `today() + 30` |
156156
|:---|:---|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{
3535
"id": 4,
3636
"prompt": "Demo opportunities should close 45 days after the package is installed, and a formula should show how many days remain until close.",
37-
"expected_output": "Seed value as a CEL envelope, `close_date: cel`daysFromNow(45)``, never a JS `Date` / `Date.now()` (two `os build` runs must be byte-identical). Days remaining is `daysBetween(today(), record.close_date)` — never `record.close_date - today()` (a duration stored as `{}`) and never date arithmetic on `today()` (it faults).",
37+
"expected_output": "Seed value as a CEL envelope, `close_date: cel`daysFromNow(45)``, never a JS `Date` / `Date.now()` (two `os build` runs must be byte-identical). Days remaining is `daysBetween(today(), record.close_date)` — never `record.close_date - today()` (the build refuses it) and never date arithmetic on `today()` (it faults).",
3838
"files": [],
3939
"assertions": {
4040
"must_contain": ["cel`", "daysFromNow(", "daysBetween("],

‎skills/objectstack-ui/evals/analytics-inline-vs-dataset.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
},
5656
{
5757
"id": 6,
58-
"prompt": "leave_request shows days_requested, a formula (end_date - start_date, returnType 'number'), on its form; keep it. Add a KPI widget totalling days requested this quarter. Emit the metadata.",
58+
"prompt": "leave_request shows days_requested, a formula (daysBetween(record.start_date, record.end_date), returnType 'number'), on its form; keep it. Add a KPI widget totalling days requested this quarter. Emit the metadata.",
5959
"expected_output": "Never sums the formula (virtual, whatever its returnType): adds a stored number a beforeInsert/beforeUpdate hook keeps in step and sums that, or titles the widget as the count it is.",
6060
"files": [],
6161
"assertions": {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Standardized answers to the recurring ambiguous cases:
9797
or boolean field (`percent` not under `sum`; `min`/`max` also dates); a `formula`
9898
has no column: refused whatever its `returnType` says. Store the number
9999
(user-entered, a `summary` rollup, or hook-kept) or title the widget the `count`
100-
it is. Leave days: `sum` over the `formula` `days_requested` (`end - start`) is
100+
it is. Leave days: `sum` over the `formula` `days_requested` (`daysBetween(start, end)`) is
101101
refused (`date` fields: no `duration`) ⇒ a stored `number` `days_count` a
102102
`beforeInsert`/`beforeUpdate` hook writes, then `{ name: 'days_sum', aggregate: 'sum', field: 'days_count' }`.
103103
- **Breakdown by a multi-value field.** `multiselect`/`checkboxes`/`tags` and

0 commit comments

Comments
 (0)