Commit 2f2a0b2
skills(formula): optimization flight — cut the cron/template quickrefs and section-5 narration, teach virtual formula fields and fault-open form predicates (net −844 tokens) (#14563)
* skills(formula): collapse cron + template surfaces to one row each (FRM-F-06 / A-01 / G-05 / B-04 / F-07)
The frontmatter routes cron away ("Do not use for ... cron schedules") while the
body taught it across four sections; the corpus authors zero of it (`cron` 0,
`tmpl` 0, any formatter 0). Both are live surfaces, so each keeps ONE
schema-pointing row with its carriers; the two quick-reference sections and the
formatter table go.
- FRM-F-06 / A-01: `### Cron surfaces`, `### Template surfaces`, `## Cron quick
reference` and `## Template quick reference` collapse into one
`### Cron and template surfaces` table, two rows, pointing at
`shared/expression.zod.ts` for the full carrier list.
- FRM-G-05: the deprecated `visibleOn` / `visibility` alias row leaves the CEL
surfaces table; the two `Object.titleFormat` notes dedupe to one carrier cell.
- FRM-B-04: the third "no js dialect" restatement goes; the canonical one in
Core contract stays.
- FRM-F-07: the view-list-filter prohibition now names the alternative it was
withholding — date macro tokens, with the pointer to objectstack-query
`rules/filters.md`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(formula): diet section 5 — drop cost narration and the pre-17 history (FRM-D-05 / D-04 / B-03)
Section 5 was 20.7% of the file (1,241 tok). The rules in it are load-bearing;
the narration around them was not.
- FRM-D-04: the pre-protocol-17 `logger.warn` history goes. Two rules were
buried in it and survive in one sentence: `before*` and `after*` abort alike
with no `onError` escape, and a condition that does not compile aborts the
same way.
- FRM-D-05: the `before*` exception restated the table row above it at 165
tokens — it is now one clause pointing back at that row. The per-row bulk
semantics keep their ADR-0058 statement; the query-count and fetch-cost
narration goes.
- FRM-B-03: the `has()`-on-a-declared-field rule was stated once for `record`
and again for `previous`. It is now one statement covering both, in the
`has()` section where the rule lives.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(formula): cut retired history, roadmap and self-restatement (FRM-D-01 / B-07 / B-06 / D-09 / D-07 / D-02 / B-05 / D-03 / G-03 / G-01 / G-02 / G-04 / E-03)
- FRM-D-01 / B-07: "Strategic context" — why CEL was picked over the deleted
Salesforce-flavor engine — was the first content after the H1. An author
emitting a predicate does not need the engine-selection history.
- FRM-B-06: ADR-0032 was stated three times, and "Verify your work" cross-refs
the top-of-file note that carried it. One statement now, in "Verify your
work", and it keeps both halves the callout had: build fails with a located
did-you-mean, and the runtime throws.
- FRM-D-09: the `type Expression` block transcribed `shared/expression.zod.ts`.
One sentence and the pointer replace it.
- FRM-D-07 / D-02: "you do not learn three languages" and the roadmap for
emitting `ast` go; the envelope rule they both carried survives once.
The auto-wrap fact moved to the cron/template row in the previous commit.
- FRM-B-05: "Determinism contract" restated the seed pattern's own note. The
three numbered conditions fold into that note.
- FRM-D-03 / G-03: "Open questions" cited `CelExprSchema` twice; the symbol
exists nowhere in the repo (0 hits outside this file).
- FRM-G-01: the CLI is `os`, not `objectstack` — 5 mentions, now 0.
- FRM-G-02: the frontmatter pins 17.x; the retired milestone numbers are gone.
- FRM-G-04: a CEL string literal takes either quote; the corpus writes double
quotes inside P` ` more than ten times, so "(always)" was false.
- FRM-E-03: `* 100.0` was a cel-js workaround. `registerNumericCoercions`
(`packages/formula/src/stdlib.ts`) registers the mixed `double op int` /
`int op double` overloads, so `* 100` is correct now.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(formula): teach the three contract facts the package omitted (FRM-F-01 / F-03 / F-02 / F-04 / B-01 / B-02 / E-01 / D-08)
The corpus measurement behind these: `type: 'formula'` fields have zero live
usages and the only hits are a removal test; flow/trigger conditions are
authored five times and the scope was taught wrong; field conditional rules are
the second-commonest task and two of their roots were missing.
- FRM-F-01: a `formula` field is virtual — `where` / `orderBy` /
`searchableFields` on one are refused `400 INVALID_FIELD` at both doors
(`packages/spec/src/migrations/entries/semantic/17.engine-find-formula-filter-refused.ts`;
`packages/objectql/src/filter-comparand-shape.ts`). The filter and sort axes
were taught nowhere in the catalog. Remedy is the stored column, in the same
words the sort and search axes already use.
- FRM-F-03: a form-view `visibleWhen` is client-side only and faults OPEN
(`packages/spec/src/ui/view.zod.ts` `FormFieldSchema` / `FormSectionSchema`;
`packages/metadata-core/src/form-predicate-root-policy.ts`). The package
taught fault-closed globally, so the note says where each holds.
- FRM-F-02: the `parent` root (line-item cell `readonlyWhen` / `requiredWhen`,
`packages/spec/src/data/field.zod.ts`) and the `data` root (metadata-editing
forms, `BOUND_FORM_VIEW_PREDICATE_ROOTS`) join the cheat-sheet.
- FRM-F-04: flow conditions bind bare identifiers — the automation engine
spreads the record's variables to top level
(`packages/services/service-automation/src/engine.ts`). The translation
table's first row implied the opposite universally.
- FRM-B-02 / B-01: the `node_modules/@objectstack/formula/` pointer named a
package that ships `dist` only, which this file already says is unreadable.
Its slot goes to `references/_index.md`, which every other domain package
links and this one orphaned.
- FRM-E-01: the predicate pattern block is now type-checked. Both previously
marked blocks were the cron and template quick references, so no "Mandatory
pattern" was checked at all.
- FRM-D-08: the no-date-arithmetic rule carried five prescriptions as prose.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(formula): say this is the companion package, and stop routing cron away (FRM-A-02 / A-01)
Four host skills end their description with "load objectstack-formula
alongside" (objectstack-data, -ui, -api, -automation); this one never said it
was that companion, so an author reading it cold had no way to know why it had
been loaded.
FRM-A-01: the description also said "Do not use for ... cron schedules" while
the body taught cron across four sections. The body now carries one
schema-pointing cron row, so the exclusion goes and the Skill Boundaries table
keeps the routing to objectstack-automation.
`skills/README.md` and `content/docs/ai/skills-reference.mdx` are the generator
output of `pnpm --filter @objectstack/spec gen:skill-docs` — both move, and
nothing in them is hand-edited.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(formula): regenerate skill docs after merging main
Generator output only (`pnpm --filter @objectstack/spec gen:skill-docs`), re-run
after the merge so it derives from all 11 SKILL.md files at the merged tree
rather than at the pre-merge one. The whole diff is the FRM-A-02 description
edit; nothing here is hand-written.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(formula): correct the sort refusal code and the cron/template pointer (contract review round 1)
Two spans failed in-seat contract review; both were verified at source before
editing and both are paid in-file — the file lands back on 5,158 tokens exactly,
no growth.
FAIL 1 (FRM-F-01, the query-axis note). The three axes do not share one error
code. `where` and `searchableFields` answer `400 INVALID_FIELD`, but `orderBy`
answers `400 INVALID_SORT` — `assertOrderByIsMaterializable` sets
`err.code = 'INVALID_SORT'` at the engine seam
(`packages/objectql/src/engine.ts`), and `assertSortFieldsExist` does the same
at the ingress. An agent branching on the code would have branched wrong on the
sort refusal. Both codes are now named.
FAIL 2 (the cron/template pointer). The paragraph sent readers to
`shared/expression.zod.ts` for "the formatter whitelist and the cron alias
set", and that file carries neither. Worse, the sets used to live in the quick
references this flight deleted, so the pointer was the last mention of both —
and this same file correctly says `@objectstack/formula` ships `dist` only, so
"go read it" resolves to nothing. Now: the seven aliases are inlined in the cron
row from `packages/formula/src/cron-engine.ts`, the template row names
`TEMPLATE_FORMATTERS` (really exported from `@objectstack/formula`, derived
from the formatter table in `packages/formula/src/template-engine.ts`) as the
introspectable whitelist, and the `expression.zod.ts` pointer is narrowed to
the carrier lists it does declare.
Paid by cutting narration of the same class this flight exists to remove: the
`asc`/`desc` anecdote from the new note, and the Skill Boundaries cron
parenthetical now that the surfaces table names `Job.schedule.expression` and
the dialect.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 1007134 commit 2f2a0b2
3 files changed
Lines changed: 105 additions & 207 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
0 commit comments