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(spec,cli): validate dataset measure aggregation by field semantics (#2208)
A measure that SUMs a percentage/rate field produces a meaningless total (it
can exceed 100%); rates must AVG. Authoring tools and `os validate` had no
notion of this, so a hand-authored — or AI-authored — dataset could summon a
"win-probability" measure as SUM and pass every check.
- @objectstack/spec/data: new aggregation-policy — `defaultAggregateFor`
(rates AVG, amounts SUM) and `isIncoherentAggregate`. The single source of
truth for field→aggregation semantics, shared by authoring (dataset
derivation) and validation so the two cannot drift.
- @objectstack/cli validateWidgetBindings: new `measure-aggregate-incoherent`
advisory — checks every dataset's measures against its object's field types
and flags SUM/count_distinct of a percent field. Runs at
validate/compile/build through the existing widget-binding pass; never
false-positives when the object's field types are unknown.
Tests: spec policy unit tests + cli validator cases (sum-on-percent flagged,
avg clean, currency-sum clean, no-objects no-op, count_distinct flagged).
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
0 commit comments