Skip to content

Commit b74aada

Browse files
committed
chore(spec): declare the two measure refinements' dropped-refinement sites and regenerate the dataset reference page
Claude-Session: https://claude.ai/code/session_01UtnxvdiN376GF3sgXwAw4d Co-authored-by: Claude <noreply@anthropic.com>
1 parent e4b7ec9 commit b74aada

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎content/docs/references/ui/dataset.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const result = DatasetSchema.parse(data);
8383
| **name** | `string` | ✅ | Measure name — e.g. "revenue"; defined once |
8484
| **label** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
8585
| **aggregate** | `Enum<'count' \| 'sum' \| 'avg' \| 'min' \| 'max' \| 'count_distinct'>` | optional | Aggregation (sum/avg/count/...); omit when `derived` is set |
86-
| **field** | `string` | optional | Aggregated field: a base field, a relationship path, or "*"; optional for count(*). Never a SQL expression. |
86+
| **field** | `string` | optional | Aggregated field: a base field, a relationship path, or "*" for a count; optional for count(*). Never a SQL expression. |
8787
| **filter** | `any` | optional | |
8888
| **format** | `string` | optional | Numeral pattern for a NUMERIC measure — grouping, decimals, percent; e.g. "0,0.00", "0.0%". An amount takes its symbol from `currency`, not from a "$" in the pattern. A DATE-valued measure never reads a date pattern: `"YYYY-MM-DD"` renders that arm's default face. A date or datetime value reads `format` as a display style — `short` or `relative`, honoured on both. |
8989
| **currency** | `string` | optional | Display currency code (ISO 4217) |
@@ -124,7 +124,7 @@ const result = DatasetSchema.parse(data);
124124
| **name** | `string` | ✅ | Measure name — e.g. "revenue"; defined once |
125125
| **label** | `string \| Record<string, string>` | optional | Display label — the default-language string, or an inline locale map (`{ en, "zh-CN" }`) resolved at render time |
126126
| **aggregate** | `Enum<'count' \| 'sum' \| 'avg' \| 'min' \| 'max' \| 'count_distinct'>` | optional | Aggregation (sum/avg/count/...); omit when `derived` is set |
127-
| **field** | `string` | optional | Aggregated field: a base field, a relationship path, or "*"; optional for count(*). Never a SQL expression. |
127+
| **field** | `string` | optional | Aggregated field: a base field, a relationship path, or "*" for a count; optional for count(*). Never a SQL expression. |
128128
| **filter** | `any` | optional | |
129129
| **format** | `string` | optional | Numeral pattern for a NUMERIC measure — grouping, decimals, percent; e.g. "0,0.00", "0.0%". An amount takes its symbol from `currency`, not from a "$" in the pattern. A DATE-valued measure never reads a date pattern: `"YYYY-MM-DD"` renders that arm's default face. A date or datetime value reads `format` as a display style — `short` or `relative`, honoured on both. |
130130
| **currency** | `string` | optional | Display currency code (ISO 4217) |

‎packages/spec/dropped-refinements.baseline.json‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"description": "Shrink-only ledger of every PUBLISHED JSON Schema that is STILL WIDER than the Zod type it was generated from, because a rule written as `.refine()` reaches the runtime and not the file (#18670). `z.toJSONSchema()` has no arm for a `custom` check: a plain record, the same record with a `.refine()`, and the same record with an ABORTING `.refine()` all project byte-identically (measured on zod 4.4.3, the version packages/spec resolves). So a document one of these files ACCEPTS can still be refused at parse time, and an author -- or an AI -- validating against packages/spec/json-schema/** finds out a release later. Each `sites` path is a position under that schema at which a refinement is dropped; the same paths are written onto the artifact itself as `x-dropped-refinements`. Item 2 closed the first patterns: a refinement DECLARED through the closed list in src/shared/refinement-projection.ts is emitted into the published file, reads `projected` rather than `dropped`, and its row LEAVES this ledger in the same PR -- which is why the ledger shrinks and never grows on a repair. Every refinement outside that closed list stays here, and adding an arm to the list is a public-contract decision, not a refactor. Hand-edited on purpose and with no `gen:` script: a generator would let a new gap be admitted by running a command instead of by a decision, which is the silence this ledger exists to end. Adding, removing or moving a site fails packages/spec/scripts/build-schemas.ts until the line moves with it, and the failure prints the corrected entry in full. ⛔ Do not delete or weaken a refinement to shorten this file -- the runtime rule is correct; it is the projection that is silent, and the remedy is to teach the closed list a NAMED pattern, never to drop the rule.",
33
"measured": {
44
"zod": "4.4.3",
5-
"publishedSchemasWithDroppedRefinements": 215,
6-
"droppedRefinementSites": 635,
5+
"publishedSchemasWithDroppedRefinements": 217,
6+
"droppedRefinementSites": 647,
77
"refinementSitesThatDidProject": 369,
88
"refinementSitesWithNoJsonFormToCompare": 0
99
},
@@ -64,13 +64,15 @@
6464
"manifest.actions.element.in.ai.outputSchema",
6565
"manifest.actions.element.in.params.element.in",
6666
"manifest.agents.element.structuredOutput.schema",
67+
"manifest.analyticsCubes.element.measures.valueType",
6768
"manifest.connectors.element.out",
6869
"manifest.dashboards.element.globalFilters.element",
6970
"manifest.dashboards.element.widgets.element",
7071
"manifest.dashboards.element.widgets.element.filter",
7172
"manifest.datasets.element",
7273
"manifest.datasets.element.filter",
7374
"manifest.datasets.element.include.element",
75+
"manifest.datasets.element.measures.element",
7476
"manifest.datasets.element.measures.element.filter",
7577
"manifest.datasources.element",
7678
"manifest.flows.element",
@@ -169,13 +171,15 @@
169171
"data.options[1].manifest.actions.element.in.ai.outputSchema",
170172
"data.options[1].manifest.actions.element.in.params.element.in",
171173
"data.options[1].manifest.agents.element.structuredOutput.schema",
174+
"data.options[1].manifest.analyticsCubes.element.measures.valueType",
172175
"data.options[1].manifest.connectors.element.out",
173176
"data.options[1].manifest.dashboards.element.globalFilters.element",
174177
"data.options[1].manifest.dashboards.element.widgets.element",
175178
"data.options[1].manifest.dashboards.element.widgets.element.filter",
176179
"data.options[1].manifest.datasets.element",
177180
"data.options[1].manifest.datasets.element.filter",
178181
"data.options[1].manifest.datasets.element.include.element",
182+
"data.options[1].manifest.datasets.element.measures.element",
179183
"data.options[1].manifest.datasets.element.measures.element.filter",
180184
"data.options[1].manifest.datasources.element",
181185
"data.options[1].manifest.flows.element",
@@ -259,13 +263,15 @@
259263
"options[1].manifest.actions.element.in.ai.outputSchema",
260264
"options[1].manifest.actions.element.in.params.element.in",
261265
"options[1].manifest.agents.element.structuredOutput.schema",
266+
"options[1].manifest.analyticsCubes.element.measures.valueType",
262267
"options[1].manifest.connectors.element.out",
263268
"options[1].manifest.dashboards.element.globalFilters.element",
264269
"options[1].manifest.dashboards.element.widgets.element",
265270
"options[1].manifest.dashboards.element.widgets.element.filter",
266271
"options[1].manifest.datasets.element",
267272
"options[1].manifest.datasets.element.filter",
268273
"options[1].manifest.datasets.element.include.element",
274+
"options[1].manifest.datasets.element.measures.element",
269275
"options[1].manifest.datasets.element.measures.element.filter",
270276
"options[1].manifest.datasources.element",
271277
"options[1].manifest.flows.element",
@@ -309,13 +315,15 @@
309315
"data.packages.element.options[1].manifest.actions.element.in.ai.outputSchema",
310316
"data.packages.element.options[1].manifest.actions.element.in.params.element.in",
311317
"data.packages.element.options[1].manifest.agents.element.structuredOutput.schema",
318+
"data.packages.element.options[1].manifest.analyticsCubes.element.measures.valueType",
312319
"data.packages.element.options[1].manifest.connectors.element.out",
313320
"data.packages.element.options[1].manifest.dashboards.element.globalFilters.element",
314321
"data.packages.element.options[1].manifest.dashboards.element.widgets.element",
315322
"data.packages.element.options[1].manifest.dashboards.element.widgets.element.filter",
316323
"data.packages.element.options[1].manifest.datasets.element",
317324
"data.packages.element.options[1].manifest.datasets.element.filter",
318325
"data.packages.element.options[1].manifest.datasets.element.include.element",
326+
"data.packages.element.options[1].manifest.datasets.element.measures.element",
319327
"data.packages.element.options[1].manifest.datasets.element.measures.element.filter",
320328
"data.packages.element.options[1].manifest.datasources.element",
321329
"data.packages.element.options[1].manifest.flows.element",
@@ -551,6 +559,11 @@
551559
""
552560
]
553561
},
562+
"data/Cube": {
563+
"sites": [
564+
"measures.valueType"
565+
]
566+
},
554567
"data/DataEngineAggregateOptions": {
555568
"sites": [
556569
"filter.options[1].lazy"
@@ -726,6 +739,11 @@
726739
"key"
727740
]
728741
},
742+
"data/Metric": {
743+
"sites": [
744+
""
745+
]
746+
},
729747
"data/MongoConfig": {
730748
"sites": [
731749
"",
@@ -1211,11 +1229,13 @@
12111229
"filter",
12121230
"filter.lazy",
12131231
"include.element",
1232+
"measures.element",
12141233
"measures.element.filter"
12151234
]
12161235
},
12171236
"ui/DatasetMeasure": {
12181237
"sites": [
1238+
"",
12191239
"filter",
12201240
"filter.lazy"
12211241
]

0 commit comments

Comments
 (0)