You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(formula,lint): advisory type-soundness warnings for expressions (#1928 tier 4)
A `Field.formula` or record-scoped predicate that uses a text or boolean field
with an arithmetic (`+ - * / %`) or ordering (`< > <= >=`) operator against a
number faults the runtime overload and silently evaluates to null (e.g.
`record.title * 2`, `record.is_active + 1`). The build now surfaces this as a
NON-blocking warning naming the offending field.
Honours the ADR-0032 design law — flag only what the runtime would also fail:
number/currency/percent/date/datetime fields are declared `dyn`, so the cases
the runtime rescues never warn (`amount / 100` via registerOperator,
`due == today()` and numeric-string/ISO-date values via the string-hydration
retry, numeric-coded select options). Equality (`==`/`!=`) is excluded — a
heterogeneous equality is runtime-safe.
- formula: new `firstTypeMismatch` + optional `fieldTypes` hint on
`validateExpression`; a narrow spec-type -> CEL-type map (only free-text ->
string, boolean/toggle -> bool; everything else dyn).
- lint: `validateStackExpressions` threads each object's field types into every
record-scoped site (formula fields, validations, action/hook/sharing
predicates). Warnings are advisory in build/validate, fatal only under --strict.
Tests: formula 215 (+9), lint 230 (+3). Green on cel-js 8.0.0.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hnji7EEYR2mGt6pY53a8Bm
0 commit comments