Repository navigation
Commit 99589f9
Fixes #21000
Clause-②: no (narrowing)
Dispatched by the claim `5955932074` (PM loop round 1, `domain:spec`
seat 1, session `session_01UtnxvdiN376GF3sgXwAw4d`), on triage's answer
B `5952826307`: the enum retirement only. The row wildcard boundary is
#21409's (landed as `b79301000c`, merged here).
## What this does
**`@objectstack/spec`: `AggregationMetricType` loses `number`, `string`
and `boolean`** (ADR-0049 enforce-or-remove, grade `5923362062`).
- They declared "a custom SQL expression returning a number / string /
boolean": the measure's `sql` was the whole computation. Since ruling D
on #20943 (`5d5e679873`), a cube member's `sql` is a column reference,
so the three had nothing left to compute.
- The enum is declared through `enumWithRetiredValues`
(`shared/retired-key.ts`), the house value-level mechanism. The six
aggregates (`count`, `sum`, `avg`, `min`, `max`, `count_distinct`) are
the whole vocabulary.
- An authored retired type fails `tsc`, because it is gone from the
type. It is refused at parse with a named prescription, at the enum, at
a metric's `type` and at a cube's `measures.METRIC.type`.
- The prescription names the aggregate that fits: `sum`, `avg`, `min` or
`max` over the column; `count` over `'*'` or over a column; or
`count_distinct`. A per-row value becomes a stored or formula field of
the object that the measure aggregates. A value derived from measures is
`derived: { op, of }` on an ADR-0021 dataset.
- A value the enum never declared keeps zod's own message.
- The prescriptions are module-private, so the export surface does not
grow.
- **ADR-0087:** D3 entry `cube-metric-expression-types-retired`
(`migrations/entries/semantic/`), with a step-18 rationale fragment
(order 62). `registry.ts` was regenerated by `gen:migration-registry`
after each merge, never edited by hand.
- There is no D2 conversion, by design: the column alone does not say
which aggregate the author meant, and a stored cube is refused, never
rewritten.
- There is no `RETIRED_KEYS_BY_MAJOR` row, because no key left the
shape.
- **Liveness:** the `analytics_cube` row `measures.type` stays `live`,
re-verified 2026-10-02. The narrowing is recorded, and the evidence now
names `aggregateOfMeasure` instead of the partition.
- **Generated:** only `content/docs/references/data/analytics.mdx`
moved, losing the three values from the enum list and from both `type`
cells.
- `api-surface`, `authorable-surface`, `json-schema.manifest` and
`api-surface-signatures` are byte-identical, as the playbook predicts
for an enum-value narrowing.
- `spec-changes.json` and the upgrade guide stay at protocol 17, and
both checks are green.
- The module header gained an `@module data/analytics` marker. Without
it, moving the imports below the header dropped the page's opening
paragraph: `lib/file-description.ts` rule 3 does not select a block
inside the import list without the marker. The page's description is
byte-identical to `main`.
- The neighbouring `CUBE_MEMBER_SQL` docblock no longer says that the
ObjectQL path refuses the partition, in the present tense.
**`@objectstack/service-analytics`: the `EXPRESSION_METRIC_TYPES`
partition is deleted.** It is replaced by ONE verdict both strategies
call, `aggregateOfMeasure` (`strategies/native-sql-strategy.ts`).
- `aggregateOfMeasure` admits a type this runtime lowers (the
`AGGREGATE_SQL` keys, pinned EQUAL to the enum's options). It refuses
everything else with the SPEC's own words,
`AggregationMetricType.safeParse(type)`, so the runtime keeps no list of
metric types, retired or otherwise.
- `NativeSQLStrategy#resolveMeasureSql` asks it before anything is
lowered. The verbatim emit is gone, and so is the unrecognised-type
throw it replaced.
- `ObjectQLStrategy#resolveMeasureAggregation` asks it at the one
resolver both doors call. The `INVALID_FIELD` arm for the partition is
gone.
- Comments that named the partition or the three types are updated:
`plugin.ts` (the bridge's comment, its docblock, and its runtime
message, which said "a custom-SQL measure is refused earlier"),
`preview-evaluator.ts`, `analytics-service.ts`,
`cube-measure-field-type-door.ts` and `dataset-refusal.ts`.
**`@objectstack/lint` (test and comment only).** #21435 landed between
my merges with a pin asserting that the three types sit outside the
aggregate table. That is false after this retirement, so the assertion
now reads `[]`. The skip-5 `silent` case is kept. No changeset is
needed: a comment and a test, nothing in the published output changes.
## Clause-②, measured
`node scripts/pm/check-widening-tells.mjs --declaration no --diff` (the
merge-base diff against `b79301000c`) exits 0, with no widening tell.
Three key lines are reported as a stated silence. They are the
retired-member prescription entries `number:` / `string:` / `boolean:`
in the `enumWithRetiredValues` map, which are refusals, not accept-set
members.
No export-listing row was added (`check:api-surface` green,
byte-identical), so the line is `Clause-②: no (narrowing)`. Both
changesets are BREAKING, with `!`, a **BREAKING** banner, the
`(narrowing)` arm, exactly one ADR-0087 marker (`registered
cube-metric-expression-types-retired`) and `minor`.
## Census (examples, packages, platform objects, objectui)
The instrument is an AST walk over every object-literal member of a
`measures:` record. It covered 7,654 `.ts`/`.js` files under
`examples/**` and `packages/**` at `4ec505761d`, platform objects
included.
- 321 measure entries in total. Lit control: `count` 164, `sum` 71.
- Retired-type entries: 7. All are deliberate refusal fixtures in the
`service-analytics` tests, built without the parse.
- Zero hits in `examples/**`, in non-test `packages/**`, in `skills/**`
and in `content/docs/**` (one cube example there, `count` / `sum`).
- `examples/app-showcase/src/data/analytics/showcase.cube.ts`: 3
measures (`count`, `sum`, `avg`). Its three `type: 'string'` lines (48,
53, 63) are **dimensions**. `DimensionType` is a separate enum,
unchanged, and pinned in the new test file.
- JSON fixtures carrying record-form `measures`: zero.
- objectui at the `.objectui-sha` pin `89cad75d55`: 0 mentions of
`AggregationMetricType`, and 0 record-form measure entries over 528
files that mention `measures`. Control: `clientValidation.ts` names
`CubeSchema`. The Console Pin Gate is not at risk: no export left.
## Premise check (zone 2)
1. **Holds.** On `68c5ab7eba`, `AggregationMetricType`
(`data/analytics.zod.ts:27`) listed the three, and `MetricSchema.type`
used it. Measured through `AnalyticsService` with a column `sql`:
- the raw-SQL path SERVED the column unaggregated: `SELECT status AS
"status", amount AS "m" FROM "orders" GROUP BY status`;
- the ObjectQL path refused the measure `INVALID_FIELD` / 400.
2. `api/analytics.zod.ts:231`: the `/analytics/meta` member's describe
("Aggregation type for a measure (`AggregationMetricType`)") is not made
false by the retirement, so it is not edited.
3. That `type` is a separate `z.string()` field, deliberately not the
enum, because the projection copies the value verbatim. Measured: it is
not the enum.
## What a stored cube carrying a retired type meets (fail closed, never
stood down)
**Pinned in `cube-metric-expression-types-retirement.test.ts`:**
- the artifact boot door (`ObjectStackDefinitionSchema`, the parse
`MetadataPlugin` runs a built artifact through) refuses it at
`analyticsCubes.0.measures.m.type` with the prescription;
- `defineStack` refuses it with `STACK_SCHEMA_INVALID` / 422;
- `defineCube` and the `analytics_cube` write door
(`getMetadataTypeSchema('analytics_cube')`, what `PUT
/api/v1/meta/analytics_cube/NAME` validates) refuse it too;
- the rehydration seam (`applyConversionsToStoredItem`) replays NOTHING
over it. Control: the same row's retired sub-day granularity IS
rewritten, so the seam is live. The stored row reaches the parse as
stored, and the parse refuses it.
**Measured through the real dispatcher routes** (a temporary
`packages/runtime` probe, not committed), for a cube a host registers
in-process WITHOUT the parse:
- `POST /api/v1/analytics/query` and `POST /api/v1/analytics/sql`, on
both strategies: `500`, with `error.message` carrying the spec's
prescription verbatim. Nothing executed.
- `sum` control: `200`.
- `GET /api/v1/analytics/meta`: `200`, listing the measure with `type:
"number"` as registered (see the Acceptance notes).
## Merges (serial constraints)
- `0d182f0549` merged `main` at `3a6d92f78b`, bringing PR #21424
(#21376, the NativeSQL filter-compile region) and PR #21425 (#21293, its
registry entry). Clean.
- `587d9d4b63` merged `main` at `d7d5b4f96a`. One hand conflict, in the
`objectql-strategy.ts` import from `native-sql-strategy.js`: #21440
added `windowClauseSql`, and both are kept.
- `4ec505761d` merged `main` at `b79301000c`, bringing PR #21431
(#21409, the count-only boundary). One hand conflict, in the
`analytics.zod.ts` imports: `enumWithRetiredValues` and #21409's
`ANALYTICS_COLUMN_PATH` / `rowWildcardOutsideCount` /
`rowWildcardOutsideCountRefusal`, both kept.
- Every merge went through `scripts/pm/os-regen-merge.sh`. Its step 4
was run each time, and `gen:migration-registry` afterwards wrote no
diff.
- **Registry reading at `4ec505761d`:** 349 semantic, 244 retired-key
and 212 retired-def entries. The siblings' ids
`analytics-row-wildcard-outside-count-refused` and
`dashboard-widget-single-series-multi-measure-refused` appear at the
same counts as on `main` (1 each).
`cube-metric-expression-types-retired` appears twice: the semantic entry
and its step-18 rationale fragment.
- **Ledger reading at `4ec505761d`:** the `measures.sql` and
`dimensions.sql` notes carry #21409's count-only wording and no longer
name this card. `measures.type` carries this retirement's own wording.
## Tests (head `4ec505761d`)
- `@objectstack/spec`:
- `vitest --project local`: 602 files, 17737 passed, 1 todo;
- `--project repo`: 43 of 49 files, 705 passed (the other six are NOT
MEASURED, below);
- `typecheck` (`tsc`, scripts, test layer): OK. The new
`@ts-expect-error` (a typed `Metric` with `type: 'number'`) sits in the
compiled test program.
- `@objectstack/service-analytics`: 170 files, 3846 passed, 126 skipped.
`typecheck` OK.
- The reverse verification happened on the way: a fixture typed `Cube`
with `type: 'number'` failed `tsc` with TS2322 against the rebuilt
`.d.ts` until it was cast.
- `@objectstack/lint`: 119 files, 5592 passed. `typecheck` OK.
## Ablations
Both run from the committed tree through `scripts/ablation-replace.mjs`.
In each, the anchor hit once and the blob changed; the restore was
proved by blob equal to `HEAD` and an empty `git diff HEAD`. Both
subjects resolve from `src`, so no rebuild was needed.
- **The runtime verdict admits every string** (`aggregateOfMeasure`'s
table check removed): 28 failed, 12 passed, over `metric-type-coverage`,
`measure-expression-both-strategies` and `measure-expression-sql`.
- Every refusal case went red: both strategies, both doors, and the
drift case.
- The admitted-aggregate, cross-object-twin and coverage-equality cases
stayed green, which is the predicted direction.
- **The spec's `number` prescription is unmapped:** 8 failed, 17 passed
in `cube-metric-expression-types-retirement.test.ts`. Every `number`
door pin went red; the `string` / `boolean` pins and the controls stayed
green.
## Gates
`node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--commands` at `4ec505761d` derived 117 families. All 117 were run, each
exit code recorded, and `--ran` answered "117 derived, 117 run, 0
NOT-MEASURED (a DERIVED zero)". Among them:
- `check-adr-0087-registration` ("2 declared-breaking changeset(s), each
carrying an ADR-0087 disposition");
- `check-changeset-no-major`;
- `check:generated` ("All 15 generated artifacts are up to date");
- `check:liveness`, `check:doc-authoring`, `check:nul-bytes` and
`check:skill-examples` (after building the client closure);
- `check:type-check-debt` (325 s);
- `check:dual-build-cjs-loads` (after a whole-repo build, 71 of 72 tasks
cached).
**NOT MEASURED**
- `@objectstack/spec` repo-project files `build-schemas-check-mode`,
`dist-freshness`, `dist-freshness-adoption`,
`publish-smoke-boot-failure`, `publish-smoke-port-collision` and
`schema-tree-freshness`. Reason: they drive whole builds and exercise
build tooling this diff does not touch.
- `@objectstack/cli` integration tier, declared to CI.
## Acceptance notes
- **`GET /analytics/meta` still lists a host-registered unparsed cube's
measure with its retired `type`**, while the query doors refuse it. This
is pre-existing for any enum-invalid type (`median` read the same at
base). It is reachable only by a host that registers a cube literal
without `CubeSchema`, because every parsing door refuses it first. Not
filed; carrier: none.
- **A stored `analytics_cube` row** read at `GET
/api/v1/meta/analytics_cube/NAME` comes back as stored. Stored rows keep
being read (the runtime gate's D4 asymmetry), and no conversion rewrites
it (pinned at the seam).
- Re-saving it is refused with the prescription (the write door pin).
- The analytics registry has no metadata read path (#20965's
measurement), so such a row reaches no query.
- The HTTP read itself was NOT MEASURED through the route.
- **The ObjectQL envelope for the three moves from `INVALID_FIELD` / 400
to the undeclared-500 tier.** The message is readable and carries the
prescription. This is the tier `dataset-refusal.ts` assigns to a cube
that never met the parse, and the changeset says so.
- A never-declared type (`median`) on the ObjectQL path is now refused
at the resolver in the same tier. Before, it was forwarded to
`executeAggregate`: the auto-bridge refused it, a host's own executor
received it, and `/analytics/sql` echoed `MEDIAN(amount)`.
- `aggregate-bridge-function-vocabulary.test.ts` therefore pins both
seams. The bridge is driven directly through the service's strategy
context, because no cube path reaches it with a non-aggregate method any
more.
- **The `measures.sql` ledger note** (#20943's, re-pointed by #21409)
was made false by this diff, as at-tier record `5959409102` ruled. It
was corrected in patch round 2 (`4278601b82`): both runtime expression
branches are gone (the gate's stand-down with #20965, the raw-SQL
verbatim emit here). What remains for a cube that reaches the service
without meeting the parse is `qualifyAndRegisterJoin` passing a
non-column `sql` through inside the aggregate, measured through
`generateSql`.
- **The prescriptions say "removed … in @objectstack/spec 17.7.0"**,
assuming the next release is a minor (the label is 17.6.0, which is
published). If the next release is cut as a major, those runtime strings
need the new number.
- **Files beyond the claim's list**, all comments or tests that named
the partition or the types, or that the merges made false:
- `service-analytics`: `analytics-service.ts`,
`cube-measure-field-type-door.ts`, `dataset-refusal.ts`, and the tests
`aggregate-bridge-function-vocabulary`,
`caller-member-column-reference-gate`,
`cube-authored-format-granularity`, `field-read-admission-gate` and
`unlisted-refusal-envelope`;
- `lint`: `validate-dataset-measure-aggregates` (source comment and
test).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01UtnxvdiN376GF3sgXwAw4d)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1fd5664 commit 99589f9
27 files changed
Lines changed: 1005 additions & 420 deletions
File tree
- .changeset
- content/docs/references/data
- packages
- lint/src
- services/service-analytics/src
- __tests__
- strategies
- spec
- liveness
- src
- data
- migrations
- entries/semantic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 43 | | |
47 | 44 | | |
48 | 45 | | |
| |||
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
129 | | - | |
| 126 | + | |
130 | 127 | | |
131 | 128 | | |
132 | 129 | | |
| |||
146 | 143 | | |
147 | 144 | | |
148 | 145 | | |
149 | | - | |
| 146 | + | |
150 | 147 | | |
151 | 148 | | |
152 | 149 | | |
| |||
219 | 216 | | |
220 | 217 | | |
221 | 218 | | |
222 | | - | |
| 219 | + | |
223 | 220 | | |
224 | 221 | | |
225 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
890 | | - | |
| 889 | + | |
| 890 | + | |
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
| |||
980 | 980 | | |
981 | 981 | | |
982 | 982 | | |
983 | | - | |
984 | | - | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
985 | 988 | | |
986 | 989 | | |
987 | 990 | | |
| |||
1002 | 1005 | | |
1003 | 1006 | | |
1004 | 1007 | | |
1005 | | - | |
| 1008 | + | |
| 1009 | + | |
1006 | 1010 | | |
1007 | 1011 | | |
1008 | 1012 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
31 | 41 | | |
32 | 42 | | |
33 | 43 | | |
| |||
114 | 124 | | |
115 | 125 | | |
116 | 126 | | |
117 | | - | |
| 127 | + | |
118 | 128 | | |
119 | | - | |
120 | | - | |
| 129 | + | |
| 130 | + | |
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
126 | 162 | | |
127 | 163 | | |
128 | 164 | | |
| |||
0 commit comments