Skip to content

lint: refuse an incoherent dataset measure (aggregate × field type) at authoring time, from the spec's compatibility matrix (lint leg of #16099) #16354

Description

@os-zhuang

Lint leg of #16099, split by director ruling (decision batch #59, 2026-09-06, "both legs, table in spec").

Blocked-by: #16353 (the AggregationFunction × FieldType compatibility matrix, exported from @objectstack/spec). This card consumes that table; it declares no rows of its own.

Scope

  • A packages/lint rule over dataset measures: for each { aggregate, field }, resolve the field's declared type from the object schema lint already loads and refuse the pair when isAggregateCompatibleWithFieldType says no.
  • Message names the aggregate, the field, its type, and the accepted types for that aggregate — so the author's fix is visible without reading the spec.
  • Sibling to the compile-time leg on No layer refuses an incoherent aggregate / field-type pair — a dataset measure avg over a datetime works on SQLite and errors on Postgres #16099 (dataset-compiler, services): this rule reaches the author earliest; it cannot see a dataset assembled at runtime, which is why both legs exist.
  • Tests: the positive control from the card (avg over datetime fires), a negative control (avg over number silent), and sum over percent (fires — the row analytics-service.ts already calls incoherent).

Acceptance

  • rule consumes the spec table; no local copy of the rows
  • documented in the lint rule reference
  • changeset present

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions