@objectstack/lint 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +50 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -9
- package/dist/index.d.ts +60 -9
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -29,10 +29,13 @@ __export(index_exports, {
|
|
|
29
29
|
STYLE_UNKNOWN_CSS_PROPERTY: () => STYLE_UNKNOWN_CSS_PROPERTY,
|
|
30
30
|
STYLE_UNKNOWN_TOKEN: () => STYLE_UNKNOWN_TOKEN,
|
|
31
31
|
TABLE_COUNT_ONLY: () => TABLE_COUNT_ONLY,
|
|
32
|
+
TITLE_FORMAT_RETIRED: () => TITLE_FORMAT_RETIRED,
|
|
33
|
+
TITLE_UNRESOLVABLE: () => TITLE_UNRESOLVABLE,
|
|
32
34
|
WIDGET_DATASET_UNKNOWN: () => WIDGET_DATASET_UNKNOWN,
|
|
33
35
|
WIDGET_DIMENSION_UNKNOWN: () => WIDGET_DIMENSION_UNKNOWN,
|
|
34
36
|
WIDGET_MEASURE_UNKNOWN: () => WIDGET_MEASURE_UNKNOWN,
|
|
35
37
|
validateJsxPages: () => validateJsxPages,
|
|
38
|
+
validateRecordTitle: () => validateRecordTitle,
|
|
36
39
|
validateResponsiveStyles: () => validateResponsiveStyles,
|
|
37
40
|
validateStackExpressions: () => validateStackExpressions,
|
|
38
41
|
validateWidgetBindings: () => validateWidgetBindings
|
|
@@ -759,6 +762,50 @@ function validateJsxPages(stack, opts = {}) {
|
|
|
759
762
|
}
|
|
760
763
|
return findings;
|
|
761
764
|
}
|
|
765
|
+
|
|
766
|
+
// src/validate-record-title.ts
|
|
767
|
+
var import_data2 = require("@objectstack/spec/data");
|
|
768
|
+
var TITLE_FORMAT_RETIRED = "title-format-retired";
|
|
769
|
+
var TITLE_UNRESOLVABLE = "title-unresolvable";
|
|
770
|
+
function asArray5(v) {
|
|
771
|
+
if (Array.isArray(v)) return v;
|
|
772
|
+
if (v && typeof v === "object") {
|
|
773
|
+
return Object.entries(v).map(([name, def]) => ({ name, ...def }));
|
|
774
|
+
}
|
|
775
|
+
return [];
|
|
776
|
+
}
|
|
777
|
+
function validateRecordTitle(stack) {
|
|
778
|
+
const findings = [];
|
|
779
|
+
const objects = asArray5(stack.objects);
|
|
780
|
+
for (let i = 0; i < objects.length; i++) {
|
|
781
|
+
const obj = objects[i];
|
|
782
|
+
const objName = typeof obj.name === "string" ? obj.name : `(object ${i})`;
|
|
783
|
+
const where = `object "${objName}"`;
|
|
784
|
+
const path = `objects[${i}]`;
|
|
785
|
+
if (obj.titleFormat !== void 0 && obj.titleFormat !== null && obj.titleFormat !== "") {
|
|
786
|
+
findings.push({
|
|
787
|
+
severity: "warning",
|
|
788
|
+
rule: TITLE_FORMAT_RETIRED,
|
|
789
|
+
where,
|
|
790
|
+
path,
|
|
791
|
+
message: `${objName}: titleFormat is retired (ADR-0079) \u2014 migrate to nameField (single field) or a formula field designated nameField`,
|
|
792
|
+
hint: `titleFormat is a render-only template the server cannot return or query, and an explicit nameField now takes precedence. For a single-field title set nameField: '<field>'. For a composite title, add a formula field (returnType: 'text') and designate it via nameField.`
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
const completeness = (0, import_data2.objectTitleCompleteness)(obj);
|
|
796
|
+
if (completeness.status === "none") {
|
|
797
|
+
findings.push({
|
|
798
|
+
severity: "warning",
|
|
799
|
+
rule: TITLE_UNRESOLVABLE,
|
|
800
|
+
where,
|
|
801
|
+
path,
|
|
802
|
+
message: `${objName}: no resolvable record title \u2014 records will have no meaningful name (no nameField and no title-eligible field to derive one)`,
|
|
803
|
+
hint: `Set nameField to a text/email field (or a formula field with returnType: 'text'), or add a text field named "name"/"title". The runtime auto-provisions a primary and falls back to "Record #<id>", but an explicit title is far more useful.`
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return findings;
|
|
808
|
+
}
|
|
762
809
|
// Annotate the CommonJS export names for ESM import in node:
|
|
763
810
|
0 && (module.exports = {
|
|
764
811
|
CHART_CONFIG_MISSING,
|
|
@@ -770,10 +817,13 @@ function validateJsxPages(stack, opts = {}) {
|
|
|
770
817
|
STYLE_UNKNOWN_CSS_PROPERTY,
|
|
771
818
|
STYLE_UNKNOWN_TOKEN,
|
|
772
819
|
TABLE_COUNT_ONLY,
|
|
820
|
+
TITLE_FORMAT_RETIRED,
|
|
821
|
+
TITLE_UNRESOLVABLE,
|
|
773
822
|
WIDGET_DATASET_UNKNOWN,
|
|
774
823
|
WIDGET_DIMENSION_UNKNOWN,
|
|
775
824
|
WIDGET_MEASURE_UNKNOWN,
|
|
776
825
|
validateJsxPages,
|
|
826
|
+
validateRecordTitle,
|
|
777
827
|
validateResponsiveStyles,
|
|
778
828
|
validateStackExpressions,
|
|
779
829
|
validateWidgetBindings
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/validate-widget-bindings.ts","../src/validate-expressions.ts","../src/validate-responsive-styles.ts","../src/validate-jsx-pages.ts"],"sourcesContent":["// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// @objectstack/lint — public API.\n//\n// Static, build-time validation over an ObjectStack metadata graph. Every rule\n// is a pure `(stack) => Finding[]` function: no I/O, no runtime, no filesystem\n// — it operates on an in-memory, schema-parsed stack object. Shared by the\n// CLI's `os validate`/`compile` AND any other consumer (e.g. AI authoring) so\n// hand-authored and generated apps are held to the same bar (ADR-0019).\n//\n// Dependency direction is one-way: lint → @objectstack/spec (the contract).\n// It never depends on a runtime, and it is never bundled into a frontend.\n\nexport {\n validateWidgetBindings,\n WIDGET_DATASET_UNKNOWN,\n WIDGET_DIMENSION_UNKNOWN,\n WIDGET_MEASURE_UNKNOWN,\n CHART_FIELD_UNKNOWN,\n CHART_CONFIG_MISSING,\n TABLE_COUNT_ONLY,\n MEASURE_AGGREGATE_INCOHERENT,\n} from './validate-widget-bindings.js';\nexport type { WidgetBindingFinding, WidgetBindingSeverity } from './validate-widget-bindings.js';\n\nexport { validateStackExpressions } from './validate-expressions.js';\nexport type { ExprIssue } from './validate-expressions.js';\n\nexport {\n validateResponsiveStyles,\n STYLE_NODE_MISSING_ID,\n STYLE_CLASSNAME_TAILWIND,\n STYLE_RESPONSIVE_NO_BASE,\n STYLE_UNKNOWN_CSS_PROPERTY,\n STYLE_UNKNOWN_TOKEN,\n} from './validate-responsive-styles.js';\nexport type { StyleFinding, StyleSeverity } from './validate-responsive-styles.js';\nexport { validateJsxPages } from './validate-jsx-pages.js';\nexport type { JsxPageFinding, JsxPageSeverity } from './validate-jsx-pages.js';\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { isIncoherentAggregate } from '@objectstack/spec/data';\n\n/**\n * Build-time dashboard widget binding diagnostics (issues #1719, #1721).\n *\n * Runs at `objectstack validate`/`compile`/`build` AFTER the stack has been\n * schema-parsed, so every widget's `dataset` reference can be linked to its\n * `defineDataset` and each entry in `dimensions`/`values` resolved to a\n * declared dimension/measure. This is the semantic/cross-reference phase —\n * the rules here cannot run during plain Zod parsing of the raw widget\n * literal (the dataset may even live in another package of the stack).\n *\n * Reference-integrity rules (#1721) — severity `error`, the page is broken:\n *\n * - `widget-dataset-unknown` — `dataset` does not resolve to a declared\n * `Dataset`.\n * - `widget-dimension-unknown` — a `dimensions[]` entry is not a dimension\n * name on the bound dataset.\n * - `widget-measure-unknown` — a `values[]` entry is not a measure name on\n * the bound dataset.\n * - `chart-field-unknown` — a `chartConfig` binding names a field the query\n * result will not contain: `xAxis.field` must be one of the widget's\n * dimensions (or a dataset dimension), and each `yAxis[].field` /\n * `series[].name` must be one of the widget's selected measures\n * (`values`). Post-cutover (ADR-0021) the result rows are keyed by\n * measure NAME (e.g. `sum_amount`), not the base column (`amount`) — a\n * stale base-column reference renders the axis but an empty series.\n *\n * Advisory rules — severity `warning`, build stays green:\n *\n * - `chart-config-missing` — a chart-type widget (bar/line/pie/…) has no\n * `chartConfig`, so the renderer cannot tell which measure to plot.\n * - `table-count-only` (#1719) — a `table`/`pivot` widget whose selected\n * measures are ALL `aggregate: 'count'` and which declares no\n * `dimensions` asks the analytics service for a single summary row. That\n * is the shape a `metric` widget wants — for a table it almost always\n * means the author wanted a per-record listing, which is not an\n * analytics dataset at all (model it as an object-bound ListView,\n * ADR-0017). Evaluated on the WIDGET's binding, not the dataset.\n * - `measure-aggregate-incoherent` — a dataset measure aggregates its field\n * in a way that produces a meaningless number: today, SUM (or\n * `count_distinct`) of a `percent`/rate field, whose total routinely\n * exceeds 100%. Rates must AVG. Checked once per dataset (independent of\n * any widget) when the bound object's field types are known.\n *\n * Warnings can be deliberately suppressed per widget via\n * `suppressWarnings: ['<rule-id>']`; errors cannot — they describe a\n * binding the analytics service cannot satisfy.\n */\n\nexport const WIDGET_DATASET_UNKNOWN = 'widget-dataset-unknown';\nexport const WIDGET_DIMENSION_UNKNOWN = 'widget-dimension-unknown';\nexport const WIDGET_MEASURE_UNKNOWN = 'widget-measure-unknown';\nexport const CHART_FIELD_UNKNOWN = 'chart-field-unknown';\nexport const CHART_CONFIG_MISSING = 'chart-config-missing';\nexport const TABLE_COUNT_ONLY = 'table-count-only';\nexport const MEASURE_AGGREGATE_INCOHERENT = 'measure-aggregate-incoherent';\n\nexport type WidgetBindingSeverity = 'error' | 'warning';\n\nexport interface WidgetBindingFinding {\n /** `error` = unresolvable binding (broken page); `warning` = advisory. */\n severity: WidgetBindingSeverity;\n /** Diagnostic rule id (registry entry), e.g. `widget-measure-unknown`. */\n rule: string;\n /** Human-readable location, e.g. `dashboard \"x\" › widget \"y\"`. */\n where: string;\n /** Config path, e.g. `dashboards[0].widgets[3]`. */\n path: string;\n /** What is wrong. */\n message: string;\n /** How to fix (or deliberately suppress) it. */\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce a collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\nfunction asStrings(v: unknown): string[] {\n return Array.isArray(v) ? v.filter((s): s is string => typeof s === 'string') : [];\n}\n\n/**\n * Chart families whose renderer needs a `chartConfig` measure mapping.\n * Single-value types (metric/kpi/gauge/…) plot their lone value and tabular\n * types (table/pivot) render every column, so they are exempt.\n */\nconst CHART_TYPES = new Set([\n 'bar', 'horizontal-bar', 'column',\n 'line', 'area',\n 'pie', 'donut', 'funnel',\n 'scatter', 'treemap', 'sankey', 'radar',\n]);\n\nfunction levenshtein(a: string, b: string): number {\n const m = a.length, n = b.length;\n let prev = Array.from({ length: n + 1 }, (_, j) => j);\n for (let i = 1; i <= m; i++) {\n const cur = [i];\n for (let j = 1; j <= n; j++) {\n cur[j] = Math.min(\n prev[j] + 1,\n cur[j - 1] + 1,\n prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),\n );\n }\n prev = cur;\n }\n return prev[n];\n}\n\n/**\n * Nearest declared name for a typo'd/stale reference, or undefined when\n * nothing is close. Containment is checked first because the cutover's\n * canonical drift is base column → prefixed measure name (`amount` →\n * `sum_amount`), which is far in edit distance but obvious to a human.\n */\nfunction didYouMean(input: string, candidates: Iterable<string>): string | undefined {\n let best: string | undefined;\n let bestScore = Infinity;\n for (const c of candidates) {\n let score: number;\n if (input.length >= 3 && (c.includes(input) || input.includes(c))) {\n score = Math.abs(c.length - input.length);\n } else {\n const d = levenshtein(input, c);\n if (d > Math.max(2, Math.floor(input.length / 3))) continue;\n score = 100 + d;\n }\n if (score < bestScore) { bestScore = score; best = c; }\n }\n return best;\n}\n\nfunction suggest(input: string, candidates: Iterable<string>): string {\n const s = didYouMean(input, candidates);\n return s ? ` Did you mean \"${s}\"?` : '';\n}\n\nfunction list(names: Iterable<string>): string {\n const arr = [...names];\n return arr.length > 0 ? arr.join(', ') : '(none)';\n}\n\n/**\n * Validate every dashboard widget's dataset binding. Returns the list of\n * findings (empty = clean). Caller decides how to surface them: `error`\n * findings describe bindings the analytics service cannot satisfy and\n * should fail validate/build; `warning` findings are advisory and must\n * never fail the build on their own.\n */\nexport function validateWidgetBindings(stack: AnyRec): WidgetBindingFinding[] {\n const findings: WidgetBindingFinding[] = [];\n\n const datasets = new Map<string, AnyRec>();\n for (const ds of asArray(stack.datasets)) {\n if (typeof ds.name === 'string') datasets.set(ds.name, ds);\n }\n\n // ── (0) dataset measures aggregate their field coherently ──\n // A measure that SUMs a percentage/rate field produces a meaningless total\n // (it can exceed 100%); rates must AVG. This is a dataset-level defect (it\n // does not depend on any widget), so it is checked once over every dataset\n // whose object's field types are known. Advisory — the page still renders.\n const objectFieldTypes = new Map<string, Map<string, string>>();\n for (const o of asArray(stack.objects)) {\n if (typeof o.name !== 'string') continue;\n const fm = new Map<string, string>();\n for (const f of asArray(o.fields)) {\n if (typeof f.name === 'string' && typeof f.type === 'string') fm.set(f.name, f.type);\n }\n objectFieldTypes.set(o.name, fm);\n }\n const datasetList = asArray(stack.datasets);\n for (let i = 0; i < datasetList.length; i++) {\n const ds = datasetList[i];\n const fieldTypes = typeof ds.object === 'string' ? objectFieldTypes.get(ds.object) : undefined;\n if (!fieldTypes) continue; // cannot judge without the object's field types\n const dsMeasures = asArray(ds.measures);\n for (let k = 0; k < dsMeasures.length; k++) {\n const m = dsMeasures[k];\n const field = typeof m.field === 'string' ? m.field : undefined;\n const aggregate = typeof m.aggregate === 'string' ? m.aggregate : undefined;\n if (!field || !aggregate) continue; // count(*) and underivable measures are fine\n const ftype = fieldTypes.get(field);\n if (ftype && isIncoherentAggregate(aggregate, ftype)) {\n findings.push({\n severity: 'warning',\n rule: MEASURE_AGGREGATE_INCOHERENT,\n where: `dataset \"${typeof ds.name === 'string' ? ds.name : `(dataset ${i})`}\" › measure \"${typeof m.name === 'string' ? m.name : `(measure ${k})`}\"`,\n path: `datasets[${i}].measures[${k}]`,\n message:\n `measure \"${m.name}\" applies ${aggregate} to ${ftype} field \"${field}\" — ` +\n `summed percentages are meaningless (they can exceed 100%).`,\n hint:\n `Use aggregate \"avg\" for percentage/rate fields (or \"count\" of records). ` +\n `If a running total is genuinely intended, suppress with: ` +\n `suppressWarnings: ['${MEASURE_AGGREGATE_INCOHERENT}'] on the measure.`,\n });\n }\n }\n }\n\n const dashboards = asArray(stack.dashboards);\n for (let i = 0; i < dashboards.length; i++) {\n const dash = dashboards[i];\n const dashName = typeof dash.name === 'string' ? dash.name : `(dashboard ${i})`;\n const widgets = Array.isArray(dash.widgets) ? (dash.widgets as AnyRec[]) : [];\n\n for (let j = 0; j < widgets.length; j++) {\n const w = widgets[j];\n const widgetId = typeof w.id === 'string' ? w.id : `(widget ${j})`;\n const where = `dashboard \"${dashName}\" › widget \"${widgetId}\"`;\n const path = `dashboards[${i}].widgets[${j}]`;\n const suppressed = (rule: string): boolean =>\n Array.isArray(w.suppressWarnings) && w.suppressWarnings.includes(rule);\n const push = (f: Omit<WidgetBindingFinding, 'where' | 'path'>): void => {\n if (f.severity === 'warning' && suppressed(f.rule)) return;\n findings.push({ ...f, where, path });\n };\n\n // ── (a) dataset reference resolves ──\n const dsName = typeof w.dataset === 'string' ? w.dataset : undefined;\n const dataset = dsName ? datasets.get(dsName) : undefined;\n if (dsName && !dataset) {\n push({\n severity: 'error',\n rule: WIDGET_DATASET_UNKNOWN,\n message: `dataset \"${dsName}\" does not resolve to a declared dataset.`,\n hint:\n `Declared datasets: ${list(datasets.keys())}.${suggest(dsName, datasets.keys())} ` +\n `Define the dataset with defineDataset() or fix the reference (ADR-0021).`,\n });\n }\n // Without a resolved dataset there is nothing to check names against.\n if (!dataset) continue;\n\n const dimensionNames = new Set<string>();\n for (const d of asArray(dataset.dimensions)) {\n if (typeof d.name === 'string') dimensionNames.add(d.name);\n }\n const measures = new Map<string, AnyRec>();\n for (const m of asArray(dataset.measures)) {\n if (typeof m.name === 'string') measures.set(m.name, m);\n }\n\n // ── (b) every dimensions[] entry is a dataset dimension ──\n const dims = asStrings(w.dimensions);\n for (let k = 0; k < dims.length; k++) {\n if (dimensionNames.has(dims[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_DIMENSION_UNKNOWN,\n message:\n `dimensions[${k}] \"${dims[k]}\" is not a dimension of dataset ` +\n `\"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint:\n `Widgets select dataset dimensions BY NAME.${suggest(dims[k], dimensionNames)} ` +\n `Add the dimension to the dataset or fix the reference.`,\n });\n }\n\n // ── (c) every values[] entry is a dataset measure ──\n const values = asStrings(w.values);\n for (let k = 0; k < values.length; k++) {\n if (measures.has(values[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_MEASURE_UNKNOWN,\n message:\n `values[${k}] \"${values[k]}\" is not a measure of dataset ` +\n `\"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint:\n `Widgets select dataset measures BY NAME, not by base column.` +\n `${suggest(values[k], measures.keys())} ` +\n `Add the measure to the dataset or fix the reference.`,\n });\n }\n\n // ── (d) chartConfig bindings resolve against the widget's selection ──\n const chartConfig = (w.chartConfig && typeof w.chartConfig === 'object')\n ? (w.chartConfig as AnyRec)\n : undefined;\n const isChartType = typeof w.type === 'string' && CHART_TYPES.has(w.type);\n\n if (chartConfig) {\n // The query result carries the widget's selected dimensions and\n // measures; resolve every chartConfig field against that shape.\n const selectedValues = new Set(values.filter((v) => measures.has(v)));\n\n const xAxis = (chartConfig.xAxis && typeof chartConfig.xAxis === 'object')\n ? (chartConfig.xAxis as AnyRec)\n : undefined;\n // A field naming an entry of the widget's own (already-validated)\n // selection is not re-reported here — rules (b)/(c) own that error.\n if (xAxis && typeof xAxis.field === 'string'\n && !dimensionNames.has(xAxis.field) && !dims.includes(xAxis.field)) {\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message:\n `chartConfig.xAxis.field \"${xAxis.field}\" does not resolve to a ` +\n `dimension of dataset \"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint: `Point xAxis.field at a dataset dimension name.${suggest(xAxis.field, dimensionNames)}`,\n });\n }\n\n const measureField = (label: string, field: string): void => {\n if (values.includes(field)) return; // resolvable, or already errored via rule (c)\n const declaredButUnselected = measures.has(field);\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message: declaredButUnselected\n ? `chartConfig.${label} \"${field}\" is a measure of dataset \"${dsName}\" ` +\n `but is not selected in the widget's values (${list(values)}), so the ` +\n `query result will not contain it.`\n : `chartConfig.${label} \"${field}\" does not resolve to a measure of ` +\n `dataset \"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint: declaredButUnselected\n ? `Add \"${field}\" to the widget's values, or bind the chart to a selected measure.`\n : `Post-cutover data is keyed by the dataset's measure NAME, not the ` +\n `base column.${suggest(field, selectedValues.size > 0 ? selectedValues : measures.keys())}`,\n });\n };\n\n const yAxes = Array.isArray(chartConfig.yAxis) ? (chartConfig.yAxis as AnyRec[]) : [];\n for (let k = 0; k < yAxes.length; k++) {\n const field = yAxes[k]?.field;\n if (typeof field === 'string') measureField(`yAxis[${k}].field`, field);\n }\n const series = Array.isArray(chartConfig.series) ? (chartConfig.series as AnyRec[]) : [];\n for (let k = 0; k < series.length; k++) {\n const name = series[k]?.name;\n if (typeof name === 'string') measureField(`series[${k}].name`, name);\n }\n } else if (isChartType) {\n push({\n severity: 'warning',\n rule: CHART_CONFIG_MISSING,\n message:\n `chart-type widget ('${w.type}') has no chartConfig — the renderer ` +\n `cannot determine which measure to plot, so the series renders empty.`,\n hint:\n `Add chartConfig with xAxis.field set to a dimension (${list(dims)}) and ` +\n `yAxis[].field set to a measure name (${list(values)}). If the default ` +\n `rendering is intentional, suppress with: suppressWarnings: ['${CHART_CONFIG_MISSING}']`,\n });\n }\n\n // ── (e) table/pivot bound to a count-only, dimensionless selection ──\n if (w.type !== 'table' && w.type !== 'pivot') continue;\n // Grouped by at least one dimension → genuinely aggregated rows.\n if (dims.length > 0) continue;\n if (values.length === 0) continue;\n const resolved = values.map((v) => measures.get(v));\n // An unresolvable measure name already errored above — don't guess here.\n if (resolved.some((m) => !m)) continue;\n\n // Derived measures combine other measures; treat them as non-count even\n // when their (ignored) `aggregate` says otherwise.\n const countOnly = resolved.every((m) => m!.aggregate === 'count' && !m!.derived);\n if (!countOnly) continue;\n\n push({\n severity: 'warning',\n rule: TABLE_COUNT_ONLY,\n message:\n `a '${w.type}' widget bound to dataset \"${dsName}\" selects only count ` +\n `measure(s) (${values.join(', ')}) and no dimensions, so it renders a ` +\n `single summary row — not a per-record list.`,\n hint:\n `A flat record listing is not an analytics dataset. Model it as an ` +\n `object-bound ListView (ADR-0017) surfaced through app navigation, and ` +\n `use a 'metric' widget here if you only need the count. If a single-row ` +\n `table is intentional, add an explicit dimension or suppress with: ` +\n `suppressWarnings: ['${TABLE_COUNT_ONLY}']`,\n });\n }\n }\n\n return findings;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Build-time expression validation (ADR-0032 §Decision 1a + 1b).\n *\n * Runs at `objectstack compile`, where the whole normalized stack is in hand —\n * so flow conditions can be checked against the *resolved* object schema\n * (field existence) in addition to CEL syntax. Uses the one shared validator\n * from `@objectstack/formula`, so the verdict matches `registerFlow` and the\n * agent `validate_expression` tool exactly.\n *\n * Scope (v1): flow predicates (start/decision `config.condition` + edge\n * `condition`), object validation-rule / formula predicates, and UI action\n * `visible` / `disabled` predicates. Each error is located (flow/object/action\n * + node/edge/field) with a corrective message.\n */\n\nimport { validateExpression } from '@objectstack/formula';\n\nexport interface ExprIssue {\n where: string;\n message: string;\n source: string;\n /**\n * `error` fails the build (e.g. a bare ref in a record-scoped formula). `warning`\n * is advisory and never fails it (e.g. a possible field typo in a flattened flow\n * condition, which might be a flow variable). Absent ⇒ treat as `error`.\n */\n severity?: 'error' | 'warning';\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce an `objects` collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** object name → set of its field names, for schema-aware field checks. */\nfunction buildFieldIndex(objects: AnyRec[]): Map<string, string[]> {\n const idx = new Map<string, string[]>();\n for (const obj of objects) {\n const name = typeof obj.name === 'string' ? obj.name : undefined;\n if (!name) continue;\n const fields = obj.fields;\n let names: string[] = [];\n if (Array.isArray(fields)) names = fields.map(f => (f as AnyRec).name).filter((n): n is string => typeof n === 'string');\n else if (fields && typeof fields === 'object') names = Object.keys(fields as AnyRec);\n idx.set(name, names);\n }\n return idx;\n}\n\n/**\n * Validate every predicate in the stack. Returns the list of issues (empty =\n * clean). Caller decides how to surface / whether to fail the build.\n */\nexport function validateStackExpressions(stack: AnyRec): ExprIssue[] {\n const issues: ExprIssue[] = [];\n const objects = asArray(stack.objects);\n const fieldIndex = buildFieldIndex(objects);\n\n const check = (\n where: string,\n raw: unknown,\n objectName?: string,\n scope: 'record' | 'flattened' = 'flattened',\n ): void => {\n if (raw == null) return;\n const fields = objectName ? fieldIndex.get(objectName) : undefined;\n const res = validateExpression('predicate', raw as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields, scope } : { scope });\n for (const e of res.errors) issues.push({ where, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where, message: w.message, source: w.source, severity: 'warning' });\n };\n\n // ── Flows ──────────────────────────────────────────────────────────\n for (const flow of asArray(stack.flows)) {\n const flowName = typeof flow.name === 'string' ? flow.name : '(unnamed flow)';\n const nodes = Array.isArray(flow.nodes) ? (flow.nodes as AnyRec[]) : [];\n const edges = Array.isArray(flow.edges) ? (flow.edges as AnyRec[]) : [];\n // The record-change target object — `record.*` refs resolve against it.\n const startNode = nodes.find(n => n.type === 'start');\n const startCfg = (startNode?.config ?? {}) as AnyRec;\n const objectName = typeof startCfg.objectName === 'string' ? startCfg.objectName : undefined;\n\n for (const node of nodes) {\n const cfg = (node.config ?? {}) as AnyRec;\n check(`flow '${flowName}' · node '${node.id}' (${node.type}) condition`, cfg.condition, objectName);\n // #1870 — a `script` node must declare a callable target (`actionType` or\n // `function`). A node with neither is a silent no-op that otherwise passes\n // build. (Function *existence* isn't checkable here — functions are code,\n // not serialized into the artifact — so this is a structural check; the\n // runtime verifies the named function is actually registered.)\n if (node.type === 'script') {\n // `function` is canonical; `functionName` is an accepted alias.\n const fn =\n (typeof cfg.function === 'string' ? cfg.function.trim() : '') ||\n (typeof cfg.functionName === 'string' ? cfg.functionName.trim() : '');\n const action = typeof cfg.actionType === 'string' ? cfg.actionType.trim() : '';\n // Inline `config.script` (a JS body) is also a declared form — the\n // built-in runtime doesn't execute it (warned at run time), but the node\n // is not the empty no-op this check targets, so don't flag it.\n const inline = typeof cfg.script === 'string' ? cfg.script.trim() : '';\n if (!fn && !action && !inline) {\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node declares neither \\`actionType\\` nor \\`function\\` — it would do nothing at runtime. ` +\n `Name a built-in action (e.g. \\`actionType: 'email'\\`) or a registered function ` +\n `(\\`function: 'my_fn'\\`, registered via \\`defineStack({ functions })\\`).`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n } else if (action === 'invoke_function' && !fn) {\n // `actionType: 'invoke_function'` is a marker that names no callable on\n // its own — the function name must be in `function`/`functionName`.\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node uses \\`actionType: 'invoke_function'\\` but no \\`function\\` (or \\`functionName\\`) — ` +\n `it names no callable. Set \\`function: 'my_fn'\\` and register it via \\`defineStack({ functions })\\`.`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n }\n }\n }\n for (const edge of edges) {\n check(`flow '${flowName}' · edge '${edge.id}' (${edge.source}→${edge.target}) condition`, edge.condition, objectName);\n }\n }\n\n // ── Object validation-rule + formula predicates ────────────────────\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n const validations = obj.validations ?? obj.validationRules;\n for (const rule of asArray(validations)) {\n const where = `object '${objectName}' · validation '${(rule.name as string) ?? '?'}'`;\n // Common predicate keys across rule shapes. Validation predicates are\n // `record`-scoped — no field flattening — so bare refs are flagged (#1928).\n check(where, rule.expression ?? rule.predicate ?? rule.condition ?? rule.formula, objectName, 'record');\n // `conditional` rules carry a nested `when` predicate (record-scoped).\n check(`${where} when`, (rule as AnyRec).when, objectName, 'record');\n }\n // Field-level formulas (computed fields) reference the same object.\n const fields = obj.fields;\n const fieldList = Array.isArray(fields)\n ? (fields as AnyRec[])\n : (fields && typeof fields === 'object' ? Object.values(fields as AnyRec) as AnyRec[] : []);\n\n // ── ADR-0062 D7 — reject `field.columnName` on external objects ──────\n // `field.columnName` (localField → physicalColumn) is the managed-object\n // mechanism; it is NOT applied by the driver's query pipeline for federated\n // objects, where `external.columnMap` (remoteColumn → localField) is the\n // authoritative — and inverse — mapping. Allowing both would be a silent\n // dual-source ambiguity, so reject `columnName` on any object that declares\n // an `external` binding (a federated object). Managed objects are untouched.\n if (obj.external != null) {\n const fieldEntries: Array<[string, AnyRec]> = Array.isArray(fields)\n ? (fields as AnyRec[]).map((f) => [((f as AnyRec)?.name as string) ?? '?', f as AnyRec])\n : (fields && typeof fields === 'object'\n ? (Object.entries(fields as AnyRec) as Array<[string, AnyRec]>)\n : []);\n for (const [fname, fdef] of fieldEntries) {\n if (fdef && typeof fdef === 'object' && (fdef as AnyRec).columnName != null) {\n issues.push({\n where: `object '${objectName}' · field '${fname}'`,\n message:\n `external object '${objectName}': field '${fname}' sets columnName='${String((fdef as AnyRec).columnName)}', ` +\n `which is not supported on federated objects (ADR-0062 D7). The driver's query pipeline ignores ` +\n `field.columnName for external objects; map remote columns via the datasource's external.columnMap instead.`,\n source: `columnName='${String((fdef as AnyRec).columnName)}'`,\n severity: 'error',\n });\n }\n }\n }\n\n for (const f of fieldList) {\n // Field-level conditional rules are server-enforced (rule-validator) and\n // record-scoped — a bare ref silently fails the rule (required/readonly\n // not enforced = data-integrity hole). #1928 class, same as actions.\n if (f && typeof f === 'object') {\n const fname = (f.name as string) ?? '?';\n for (const key of ['requiredWhen', 'readonlyWhen', 'conditionalRequired', 'visibleWhen'] as const) {\n check(`object '${objectName}' · field '${fname}' ${key}`, (f as AnyRec)[key], objectName, 'record');\n }\n }\n if (f && typeof f === 'object' && f.formula) {\n // formulas are `value` role (any return type), still CEL. They are\n // `record`-scoped — `record.<field>`, never bare — so flag bare refs (#1928).\n const res = validateExpression('value', f.formula as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields: fieldIndex.get(objectName), scope: 'record' } : { scope: 'record' });\n const fieldWhere = `object '${objectName}' · field '${(f.name as string) ?? '?'}' formula`;\n for (const e of res.errors) issues.push({ where: fieldWhere, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where: fieldWhere, message: w.message, source: w.source, severity: 'warning' });\n }\n }\n }\n\n // ── Action `visible` / `disabled` predicates ───────────────────────\n // Record-scoped, same as validation rules: a record-header / row action's\n // `visible` is evaluated by ActionEngine against `{ record, recordId,\n // objectName, user, … }` with fail-closed semantics, so a BARE field ref\n // (`done` instead of `record.done`) throws and the action is silently hidden\n // on every record (the trap behind the #2183 \"Mark Done never hides\" hunt).\n // Flagging it here turns that into a build error with a corrective message.\n // `disabled` may be a boolean (skip) or a predicate (check).\n const seenActions = new Set<string>();\n const checkAction = (where: string, action: AnyRec, objectName?: string): void => {\n const obj = objectName\n ?? (typeof action.objectName === 'string' ? action.objectName : undefined)\n ?? (typeof action.object === 'string' ? action.object : undefined);\n const name = typeof action.name === 'string' ? action.name : '?';\n const key = `${obj ?? ''}:${name}`;\n if (seenActions.has(key)) return; // de-dup (actions are merged onto objects AND kept top-level)\n seenActions.add(key);\n check(`${where} · action '${name}' visible`, action.visible, obj, 'record');\n if (typeof action.disabled !== 'boolean') {\n check(`${where} · action '${name}' disabled`, action.disabled, obj, 'record');\n }\n };\n for (const action of asArray(stack.actions)) {\n checkAction('stack', action);\n }\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n for (const action of asArray(obj.actions)) {\n checkAction(`object '${objectName}'`, action, objectName);\n }\n }\n\n // ── Sharing-rule predicates (security-critical, record-scoped) ─────\n // A criteria sharing rule's `condition` decides which rows a principal sees.\n // It is evaluated against the record, so a bare ref silently changes access.\n for (const rule of asArray(stack.sharingRules)) {\n const ruleObj = typeof rule.object === 'string' ? rule.object : undefined;\n const where = `sharingRule '${(rule.name as string) ?? '?'}'${ruleObj ? ` (${ruleObj})` : ''} condition`;\n check(where, rule.condition ?? rule.criteria ?? rule.predicate, ruleObj, 'record');\n }\n\n // ── Hook `condition` predicates (record-scoped gate) ───────────────\n // A lifecycle hook's `condition` skips the handler when false; it is\n // evaluated against the record, so a bare ref silently makes the hook\n // run on every record (or never) instead of the intended subset.\n for (const hook of asArray(stack.hooks)) {\n const hookObj = typeof hook.object === 'string' ? hook.object : undefined; // array targets → no single field set\n check(`hook '${(hook.name as string) ?? '?'}'${hookObj ? ` (${hookObj})` : ''} condition`, hook.condition, hookObj, 'record');\n }\n\n return issues;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for the SDUI scoped-styling model (ADR-0065).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019): the same bar holds for\n// hand-authored and AI-generated pages, run from `os validate`/`compile` and\n// reusable by AI authoring. It catches the deterministic ways a `responsiveStyles`\n// block silently fails or drifts — the class of mistake an AI author is most\n// likely to make — *before* render, with actionable hints it can self-correct on.\n//\n// What it does NOT catch: whether the result looks good. Visual/semantic quality\n// (contrast, balance, \"is it ugly\") is only catchable by rendering + a VLM gate,\n// which is a separate, render-time concern (ADR-0065 §Decision-5).\n\nexport type StyleSeverity = 'error' | 'warning';\n\nexport interface StyleFinding {\n severity: StyleSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"pricing\" › node \"plan_solo\"`. */\n where: string;\n /** Config path, e.g. `pages[0].regions[0].components[1]`. */\n path: string;\n message: string;\n hint: string;\n}\n\n// Rule ids (registry entries).\nexport const STYLE_NODE_MISSING_ID = 'style-node-missing-id';\nexport const STYLE_CLASSNAME_TAILWIND = 'style-classname-tailwind';\nexport const STYLE_RESPONSIVE_NO_BASE = 'style-responsive-no-base';\nexport const STYLE_UNKNOWN_CSS_PROPERTY = 'style-unknown-css-property';\nexport const STYLE_UNKNOWN_TOKEN = 'style-unknown-token';\n\ntype AnyRec = Record<string, unknown>;\n\nconst BREAKPOINTS = ['large', 'medium', 'small', 'xsmall'] as const;\n\n/** SDUI design-token palette (ADR-0065) + base theme tokens, referenced as\n * `var(--name)`. Authors should resolve values against these. Kept in sync with\n * `apps/console/src/index.css` / `@object-ui/components` `:root`. */\nconst KNOWN_TOKENS = new Set<string>([\n // SDUI tokens\n 'space-1', 'space-2', 'space-3', 'space-4', 'space-5', 'space-6', 'space-8', 'space-10', 'space-12',\n 'radius', 'radius-sm', 'radius-md', 'radius-lg', 'radius-xl',\n 'shadow-sm', 'shadow-md', 'shadow-lg',\n 'surface', 'surface-sunken', 'text-strong', 'text-muted', 'brand', 'brand-foreground', 'hairline',\n // Base theme tokens (shadcn) — usually wrapped as hsl(var(--x)).\n 'background', 'foreground', 'card', 'card-foreground', 'popover', 'popover-foreground',\n 'primary', 'primary-foreground', 'secondary', 'secondary-foreground',\n 'muted', 'muted-foreground', 'accent', 'accent-foreground',\n 'destructive', 'destructive-foreground', 'border', 'input', 'ring',\n 'success', 'success-foreground', 'warning', 'warning-foreground',\n 'chart-1', 'chart-2', 'chart-3', 'chart-4', 'chart-5',\n]);\n\n/** Common CSS properties (camelCase) an SDUI block realistically sets. Generous\n * on purpose: an unknown property is only a *warning* (typo catcher), never a\n * blocker. Custom properties (`--x`) are always allowed. */\nconst KNOWN_CSS_PROPERTIES = new Set<string>([\n 'display', 'position', 'top', 'right', 'bottom', 'left', 'inset', 'zIndex', 'overflow', 'overflowX', 'overflowY', 'visibility', 'boxSizing', 'float', 'clear',\n 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'aspectRatio',\n 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginInline', 'marginBlock',\n 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingInline', 'paddingBlock',\n 'flex', 'flexDirection', 'flexWrap', 'flexGrow', 'flexShrink', 'flexBasis', 'alignItems', 'alignContent', 'alignSelf', 'justifyContent', 'justifyItems', 'justifySelf', 'gap', 'rowGap', 'columnGap', 'order', 'placeItems', 'placeContent',\n 'grid', 'gridTemplate', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridColumn', 'gridRow', 'gridArea', 'gridAutoFlow', 'gridAutoColumns', 'gridAutoRows',\n 'color', 'backgroundColor', 'background', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat', 'backgroundClip', 'opacity', 'mixBlendMode',\n 'fontSize', 'fontWeight', 'fontFamily', 'fontStyle', 'lineHeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'textOverflow', 'whiteSpace', 'wordBreak', 'overflowWrap', 'fontVariantNumeric', 'verticalAlign', 'textShadow',\n 'border', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'borderColor', 'borderWidth', 'borderStyle', 'borderRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'outline', 'outlineOffset',\n 'boxShadow', 'transform', 'transformOrigin', 'transition', 'transitionProperty', 'transitionDuration', 'transitionTimingFunction', 'transitionDelay', 'animation', 'filter', 'backdropFilter', 'willChange',\n 'cursor', 'pointerEvents', 'userSelect', 'objectFit', 'objectPosition', 'content',\n]);\n\nconst VAR_RE = /var\\(\\s*--([a-zA-Z0-9-]+)\\s*[,)]/g;\n\n// High-precision Tailwind-utility detection. A `className` in page metadata is\n// \"Tailwind-looking\" if any token is a responsive/state variant, an arbitrary\n// `[…]` value, a known utility stem followed by a Tailwind *value* (number /\n// fraction / size keyword), or a bare layout utility. Tuned to NOT trip on\n// ordinary custom class names (e.g. `my-custom-scope`, `os-s-plan_solo`).\nconst TW_VARIANT = /^(sm|md|lg|xl|2xl|hover|focus|active|disabled|dark|group-hover|peer-[a-z]+|first|last|odd|even):/;\nconst TW_STEM_VALUE = /^-?(p|m|px|py|pt|pb|pl|pr|mx|my|mt|mb|ml|mr|gap|gap-x|gap-y|space-x|space-y|w|h|min-w|max-w|min-h|max-h|size|text|leading|tracking|bg|border|rounded|shadow|ring|opacity|inset|top|bottom|left|right|z|order|col|row|grid-cols|grid-rows|basis)-(\\d+(\\.\\d+)?|\\d+\\/\\d+|px|full|auto|none|screen|min|max|fit|xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl)$/;\nconst TW_BARE = /^(flex|grid|block|inline|inline-block|inline-flex|hidden|contents|table|flow-root|grow|shrink|truncate|italic|underline|uppercase|lowercase|capitalize|antialiased|absolute|relative|fixed|sticky|static|isolate|flex-col|flex-row|flex-wrap|flex-nowrap|items-center|items-start|items-end|items-stretch|justify-center|justify-between|justify-around|justify-start|justify-end|text-center|text-left|text-right|font-bold|font-semibold|font-medium|font-normal|tabular-nums)$/;\n\nfunction looksLikeTailwind(className: string): boolean {\n return className.split(/\\s+/).some((tok) => {\n if (!tok) return false;\n if (TW_VARIANT.test(tok)) return true;\n if (/\\[[^\\]]+\\]/.test(tok)) return true; // arbitrary value, e.g. p-[13px]\n if (TW_STEM_VALUE.test(tok)) return true;\n if (TW_BARE.test(tok)) return true;\n return false;\n });\n}\n\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** Child nodes can hang off `children`, `properties.children`, `body`, or\n * `properties.body` depending on block type — collect them all. */\nfunction childrenOf(node: AnyRec): AnyRec[] {\n const props = (node.properties as AnyRec) ?? {};\n const out: AnyRec[] = [];\n for (const c of [node.children, props.children, node.body, props.body]) {\n if (Array.isArray(c)) out.push(...(c.filter((x) => x && typeof x === 'object') as AnyRec[]));\n }\n return out;\n}\n\nfunction checkNode(node: AnyRec, pageName: string, path: string, findings: StyleFinding[]): void {\n const id = typeof node.id === 'string' ? node.id : undefined;\n const type = typeof node.type === 'string' ? node.type : 'node';\n const where = `page \"${pageName}\" › ${id ? `node \"${id}\"` : `<${type}>`}`;\n const rs = node.responsiveStyles as AnyRec | undefined;\n const hasRs = !!rs && typeof rs === 'object' && BREAKPOINTS.some((b) => rs[b]);\n\n // (1) responsiveStyles needs an id to scope to — else the CSS is dropped.\n if (hasRs && !id) {\n findings.push({\n severity: 'error', rule: STYLE_NODE_MISSING_ID, where, path,\n message: `Node has responsiveStyles but no \\`id\\`; scoped CSS cannot be generated and the styles are silently dropped.`,\n hint: `Add a stable \\`id\\` to this node.`,\n });\n }\n\n // (2) responsive breakpoint without a `large` base → unstyled at desktop.\n if (hasRs && !rs!.large && BREAKPOINTS.slice(1).some((b) => rs![b])) {\n findings.push({\n severity: 'warning', rule: STYLE_RESPONSIVE_NO_BASE, where, path,\n message: `responsiveStyles sets a smaller breakpoint but no \\`large\\` base; the node is unstyled at desktop width.`,\n hint: `Put the unconditional/base styles under \\`responsiveStyles.large\\` (desktop-first).`,\n });\n }\n\n // (3) className that looks like Tailwind → won't render from metadata.\n if (typeof node.className === 'string' && node.className.trim() && looksLikeTailwind(node.className)) {\n findings.push({\n severity: 'warning', rule: STYLE_CLASSNAME_TAILWIND, where, path,\n message: `\\`className\\` contains Tailwind-looking utilities (\"${node.className.trim().slice(0, 60)}\"); these are not compiled from metadata and will silently do nothing.`,\n hint: `Style this node with \\`responsiveStyles\\` + design tokens instead of \\`className\\` (ADR-0065).`,\n });\n }\n\n // (4)+(5) unknown CSS property / unknown token inside each breakpoint map.\n if (rs && typeof rs === 'object') {\n for (const bp of BREAKPOINTS) {\n const map = rs[bp] as AnyRec | undefined;\n if (!map || typeof map !== 'object') continue;\n for (const [prop, value] of Object.entries(map)) {\n if (!prop.startsWith('--') && !KNOWN_CSS_PROPERTIES.has(prop)) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_CSS_PROPERTY, where, path: `${path}.responsiveStyles.${bp}`,\n message: `Unknown CSS property \"${prop}\" (typo?); if unintended it will not apply.`,\n hint: `Use a camelCase CSS property name (e.g. \\`flexDirection\\`, \\`backgroundColor\\`).`,\n });\n }\n if (typeof value === 'string') {\n let m: RegExpExecArray | null;\n VAR_RE.lastIndex = 0;\n while ((m = VAR_RE.exec(value))) {\n const token = m[1];\n if (!KNOWN_TOKENS.has(token) && !token.startsWith('tw-')) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_TOKEN, where, path: `${path}.responsiveStyles.${bp}.${prop}`,\n message: `References unknown design token \\`var(--${token})\\` (typo?); it will not resolve.`,\n hint: `Use a token from the ADR-0065 palette (e.g. \\`var(--space-6)\\`, \\`var(--surface)\\`, \\`hsl(var(--primary))\\`).`,\n });\n }\n }\n }\n }\n }\n }\n\n // Recurse.\n const kids = childrenOf(node);\n for (let i = 0; i < kids.length; i++) {\n checkNode(kids[i], pageName, `${path}.children[${i}]`, findings);\n }\n}\n\n/**\n * Validate every page's component tree for SDUI styling correctness (ADR-0065).\n * Returns findings (empty = clean). `error` findings describe styles that are\n * silently dropped and should fail validate/build; `warning` findings are\n * advisory (typos, drift, footguns).\n */\nexport function validateResponsiveStyles(stack: AnyRec): StyleFinding[] {\n const findings: StyleFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n const pageName = typeof page.name === 'string' ? page.name : `pages[${p}]`;\n const regions = asArray(page.regions);\n for (let r = 0; r < regions.length; r++) {\n const components = asArray(regions[r].components);\n for (let c = 0; c < components.length; c++) {\n checkNode(components[c], pageName, `pages[${p}].regions[${r}].components[${c}]`, findings);\n }\n }\n }\n return findings;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for AI-authored JSX-source pages (ADR-0080).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019), run from `os validate` / `os\n// build`. A `kind:'jsx'` page's `source` is a constrained JSX/Tailwind string\n// compiled (parsed, never executed) to the SDUI tree at save time. This gate\n// parses it at author time so malformed source fails loudly (ADR-0078) instead\n// of being stored and breaking only at render.\n//\n// Scope: parse-level — syntax, tag matching, and forbidden constructs (event\n// handlers, dangerouslySetInnerHTML). Full component/prop whitelist validation\n// needs the registry manifest (a cross-repo artifact); when that is wired,\n// thread it through `compile()` here. Until then this catches the structural\n// class of error an AI author is most likely to emit.\n\nimport { parseJsx, compile, type Manifest } from '@objectstack/sdui-parser';\n\nexport type JsxPageSeverity = 'error' | 'warning';\n\nexport interface JsxPageFinding {\n severity: JsxPageSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"command_center\" › <flex>`. */\n where: string;\n /** Config path, e.g. `pages[3].source`. */\n path: string;\n message: string;\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\nconst asArray = (v: unknown): AnyRec[] => (Array.isArray(v) ? (v as AnyRec[]) : []);\n\nexport function validateJsxPages(stack: AnyRec, opts: { manifest?: Manifest } = {}): JsxPageFinding[] {\n const findings: JsxPageFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n if (!page || page.kind !== 'jsx') continue;\n const name = String(page.name ?? `#${p}`);\n const source = page.source;\n if (typeof source !== 'string' || source.trim() === '') {\n // (PageSchema's superRefine also covers this; keep it for the build path.)\n findings.push({\n severity: 'error',\n rule: 'jsx-page-empty-source',\n where: `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: \"kind:'jsx' page has no `source`.\",\n hint: 'Author the page as a constrained JSX/Tailwind string in `source`.',\n });\n continue;\n }\n // With a component manifest, do full validation (unknown component, missing/\n // wrong prop, bad enum, bindings); without it, parse-level (syntax/structure).\n const { diagnostics } = opts.manifest ? compile(source, opts.manifest) : parseJsx(source);\n for (const d of diagnostics) {\n findings.push({\n severity: d.severity,\n rule: `jsx-${d.code}`,\n where: d.tag ? `page \"${name}\" › <${d.tag}>` : `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: d.message,\n hint: 'The source is parsed (never executed) and compiled to the SDUI tree at save time — fix the JSX.',\n });\n }\n }\n return findings;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAAsC;AAkD/B,IAAM,yBAAyB;AAC/B,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAC/B,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AACzB,IAAM,+BAA+B;AAsB5C,SAAS,QAAQ,GAAsB;AACrC,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO;AAC7B,MAAI,KAAK,OAAO,MAAM,UAAU;AAC9B,WAAO,OAAO,QAAQ,CAAW,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAI,IAAe,EAAE;AAAA,EACxF;AACA,SAAO,CAAC;AACV;AAEA,SAAS,UAAU,GAAsB;AACvC,SAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC;AACnF;AAOA,IAAM,cAAc,oBAAI,IAAI;AAAA,EAC1B;AAAA,EAAO;AAAA,EAAkB;AAAA,EACzB;AAAA,EAAQ;AAAA,EACR;AAAA,EAAO;AAAA,EAAS;AAAA,EAChB;AAAA,EAAW;AAAA,EAAW;AA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AAM,CAAC;AACpB,QAAI,CAAC,QAAQ,KAAK,SAAS,MAAO;AAClC,UAAM,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,EAAE;AACxC,UAAM,SAAS,KAAK;AACpB,QAAI,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,IAAI;AAEtD,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO,SAAS,IAAI;AAAA,QACpB,MAAM,SAAS,CAAC;AAAA,QAChB,SAAS;AAAA,QACT,MAAM;AAAA,MACR,CAAC;AACD;AAAA,IACF;AAGA,UAAM,EAAE,YAAY,IAAI,KAAK,eAAW,4BAAQ,QAAQ,KAAK,QAAQ,QAAI,6BAAS,MAAM;AACxF,eAAW,KAAK,aAAa;AAC3B,eAAS,KAAK;AAAA,QACZ,UAAU,EAAE;AAAA,QACZ,MAAM,OAAO,EAAE,IAAI;AAAA,QACnB,OAAO,EAAE,MAAM,SAAS,IAAI,aAAQ,EAAE,GAAG,MAAM,SAAS,IAAI;AAAA,QAC5D,MAAM,SAAS,CAAC;AAAA,QAChB,SAAS,EAAE;AAAA,QACX,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;","names":["asArray","asArray","asArray"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/validate-widget-bindings.ts","../src/validate-expressions.ts","../src/validate-responsive-styles.ts","../src/validate-jsx-pages.ts","../src/validate-record-title.ts"],"sourcesContent":["// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// @objectstack/lint — public API.\n//\n// Static, build-time validation over an ObjectStack metadata graph. Every rule\n// is a pure `(stack) => Finding[]` function: no I/O, no runtime, no filesystem\n// — it operates on an in-memory, schema-parsed stack object. Shared by the\n// CLI's `os validate`/`compile` AND any other consumer (e.g. AI authoring) so\n// hand-authored and generated apps are held to the same bar (ADR-0019).\n//\n// Dependency direction is one-way: lint → @objectstack/spec (the contract).\n// It never depends on a runtime, and it is never bundled into a frontend.\n\nexport {\n validateWidgetBindings,\n WIDGET_DATASET_UNKNOWN,\n WIDGET_DIMENSION_UNKNOWN,\n WIDGET_MEASURE_UNKNOWN,\n CHART_FIELD_UNKNOWN,\n CHART_CONFIG_MISSING,\n TABLE_COUNT_ONLY,\n MEASURE_AGGREGATE_INCOHERENT,\n} from './validate-widget-bindings.js';\nexport type { WidgetBindingFinding, WidgetBindingSeverity } from './validate-widget-bindings.js';\n\nexport { validateStackExpressions } from './validate-expressions.js';\nexport type { ExprIssue } from './validate-expressions.js';\n\nexport {\n validateResponsiveStyles,\n STYLE_NODE_MISSING_ID,\n STYLE_CLASSNAME_TAILWIND,\n STYLE_RESPONSIVE_NO_BASE,\n STYLE_UNKNOWN_CSS_PROPERTY,\n STYLE_UNKNOWN_TOKEN,\n} from './validate-responsive-styles.js';\nexport type { StyleFinding, StyleSeverity } from './validate-responsive-styles.js';\nexport { validateJsxPages } from './validate-jsx-pages.js';\nexport type { JsxPageFinding, JsxPageSeverity } from './validate-jsx-pages.js';\n\nexport {\n validateRecordTitle,\n TITLE_FORMAT_RETIRED,\n TITLE_UNRESOLVABLE,\n} from './validate-record-title.js';\nexport type { RecordTitleFinding, RecordTitleSeverity } from './validate-record-title.js';\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { isIncoherentAggregate } from '@objectstack/spec/data';\n\n/**\n * Build-time dashboard widget binding diagnostics (issues #1719, #1721).\n *\n * Runs at `objectstack validate`/`compile`/`build` AFTER the stack has been\n * schema-parsed, so every widget's `dataset` reference can be linked to its\n * `defineDataset` and each entry in `dimensions`/`values` resolved to a\n * declared dimension/measure. This is the semantic/cross-reference phase —\n * the rules here cannot run during plain Zod parsing of the raw widget\n * literal (the dataset may even live in another package of the stack).\n *\n * Reference-integrity rules (#1721) — severity `error`, the page is broken:\n *\n * - `widget-dataset-unknown` — `dataset` does not resolve to a declared\n * `Dataset`.\n * - `widget-dimension-unknown` — a `dimensions[]` entry is not a dimension\n * name on the bound dataset.\n * - `widget-measure-unknown` — a `values[]` entry is not a measure name on\n * the bound dataset.\n * - `chart-field-unknown` — a `chartConfig` binding names a field the query\n * result will not contain: `xAxis.field` must be one of the widget's\n * dimensions (or a dataset dimension), and each `yAxis[].field` /\n * `series[].name` must be one of the widget's selected measures\n * (`values`). Post-cutover (ADR-0021) the result rows are keyed by\n * measure NAME (e.g. `sum_amount`), not the base column (`amount`) — a\n * stale base-column reference renders the axis but an empty series.\n *\n * Advisory rules — severity `warning`, build stays green:\n *\n * - `chart-config-missing` — a chart-type widget (bar/line/pie/…) has no\n * `chartConfig`, so the renderer cannot tell which measure to plot.\n * - `table-count-only` (#1719) — a `table`/`pivot` widget whose selected\n * measures are ALL `aggregate: 'count'` and which declares no\n * `dimensions` asks the analytics service for a single summary row. That\n * is the shape a `metric` widget wants — for a table it almost always\n * means the author wanted a per-record listing, which is not an\n * analytics dataset at all (model it as an object-bound ListView,\n * ADR-0017). Evaluated on the WIDGET's binding, not the dataset.\n * - `measure-aggregate-incoherent` — a dataset measure aggregates its field\n * in a way that produces a meaningless number: today, SUM (or\n * `count_distinct`) of a `percent`/rate field, whose total routinely\n * exceeds 100%. Rates must AVG. Checked once per dataset (independent of\n * any widget) when the bound object's field types are known.\n *\n * Warnings can be deliberately suppressed per widget via\n * `suppressWarnings: ['<rule-id>']`; errors cannot — they describe a\n * binding the analytics service cannot satisfy.\n */\n\nexport const WIDGET_DATASET_UNKNOWN = 'widget-dataset-unknown';\nexport const WIDGET_DIMENSION_UNKNOWN = 'widget-dimension-unknown';\nexport const WIDGET_MEASURE_UNKNOWN = 'widget-measure-unknown';\nexport const CHART_FIELD_UNKNOWN = 'chart-field-unknown';\nexport const CHART_CONFIG_MISSING = 'chart-config-missing';\nexport const TABLE_COUNT_ONLY = 'table-count-only';\nexport const MEASURE_AGGREGATE_INCOHERENT = 'measure-aggregate-incoherent';\n\nexport type WidgetBindingSeverity = 'error' | 'warning';\n\nexport interface WidgetBindingFinding {\n /** `error` = unresolvable binding (broken page); `warning` = advisory. */\n severity: WidgetBindingSeverity;\n /** Diagnostic rule id (registry entry), e.g. `widget-measure-unknown`. */\n rule: string;\n /** Human-readable location, e.g. `dashboard \"x\" › widget \"y\"`. */\n where: string;\n /** Config path, e.g. `dashboards[0].widgets[3]`. */\n path: string;\n /** What is wrong. */\n message: string;\n /** How to fix (or deliberately suppress) it. */\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce a collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\nfunction asStrings(v: unknown): string[] {\n return Array.isArray(v) ? v.filter((s): s is string => typeof s === 'string') : [];\n}\n\n/**\n * Chart families whose renderer needs a `chartConfig` measure mapping.\n * Single-value types (metric/kpi/gauge/…) plot their lone value and tabular\n * types (table/pivot) render every column, so they are exempt.\n */\nconst CHART_TYPES = new Set([\n 'bar', 'horizontal-bar', 'column',\n 'line', 'area',\n 'pie', 'donut', 'funnel',\n 'scatter', 'treemap', 'sankey', 'radar',\n]);\n\nfunction levenshtein(a: string, b: string): number {\n const m = a.length, n = b.length;\n let prev = Array.from({ length: n + 1 }, (_, j) => j);\n for (let i = 1; i <= m; i++) {\n const cur = [i];\n for (let j = 1; j <= n; j++) {\n cur[j] = Math.min(\n prev[j] + 1,\n cur[j - 1] + 1,\n prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),\n );\n }\n prev = cur;\n }\n return prev[n];\n}\n\n/**\n * Nearest declared name for a typo'd/stale reference, or undefined when\n * nothing is close. Containment is checked first because the cutover's\n * canonical drift is base column → prefixed measure name (`amount` →\n * `sum_amount`), which is far in edit distance but obvious to a human.\n */\nfunction didYouMean(input: string, candidates: Iterable<string>): string | undefined {\n let best: string | undefined;\n let bestScore = Infinity;\n for (const c of candidates) {\n let score: number;\n if (input.length >= 3 && (c.includes(input) || input.includes(c))) {\n score = Math.abs(c.length - input.length);\n } else {\n const d = levenshtein(input, c);\n if (d > Math.max(2, Math.floor(input.length / 3))) continue;\n score = 100 + d;\n }\n if (score < bestScore) { bestScore = score; best = c; }\n }\n return best;\n}\n\nfunction suggest(input: string, candidates: Iterable<string>): string {\n const s = didYouMean(input, candidates);\n return s ? ` Did you mean \"${s}\"?` : '';\n}\n\nfunction list(names: Iterable<string>): string {\n const arr = [...names];\n return arr.length > 0 ? arr.join(', ') : '(none)';\n}\n\n/**\n * Validate every dashboard widget's dataset binding. Returns the list of\n * findings (empty = clean). Caller decides how to surface them: `error`\n * findings describe bindings the analytics service cannot satisfy and\n * should fail validate/build; `warning` findings are advisory and must\n * never fail the build on their own.\n */\nexport function validateWidgetBindings(stack: AnyRec): WidgetBindingFinding[] {\n const findings: WidgetBindingFinding[] = [];\n\n const datasets = new Map<string, AnyRec>();\n for (const ds of asArray(stack.datasets)) {\n if (typeof ds.name === 'string') datasets.set(ds.name, ds);\n }\n\n // ── (0) dataset measures aggregate their field coherently ──\n // A measure that SUMs a percentage/rate field produces a meaningless total\n // (it can exceed 100%); rates must AVG. This is a dataset-level defect (it\n // does not depend on any widget), so it is checked once over every dataset\n // whose object's field types are known. Advisory — the page still renders.\n const objectFieldTypes = new Map<string, Map<string, string>>();\n for (const o of asArray(stack.objects)) {\n if (typeof o.name !== 'string') continue;\n const fm = new Map<string, string>();\n for (const f of asArray(o.fields)) {\n if (typeof f.name === 'string' && typeof f.type === 'string') fm.set(f.name, f.type);\n }\n objectFieldTypes.set(o.name, fm);\n }\n const datasetList = asArray(stack.datasets);\n for (let i = 0; i < datasetList.length; i++) {\n const ds = datasetList[i];\n const fieldTypes = typeof ds.object === 'string' ? objectFieldTypes.get(ds.object) : undefined;\n if (!fieldTypes) continue; // cannot judge without the object's field types\n const dsMeasures = asArray(ds.measures);\n for (let k = 0; k < dsMeasures.length; k++) {\n const m = dsMeasures[k];\n const field = typeof m.field === 'string' ? m.field : undefined;\n const aggregate = typeof m.aggregate === 'string' ? m.aggregate : undefined;\n if (!field || !aggregate) continue; // count(*) and underivable measures are fine\n const ftype = fieldTypes.get(field);\n if (ftype && isIncoherentAggregate(aggregate, ftype)) {\n findings.push({\n severity: 'warning',\n rule: MEASURE_AGGREGATE_INCOHERENT,\n where: `dataset \"${typeof ds.name === 'string' ? ds.name : `(dataset ${i})`}\" › measure \"${typeof m.name === 'string' ? m.name : `(measure ${k})`}\"`,\n path: `datasets[${i}].measures[${k}]`,\n message:\n `measure \"${m.name}\" applies ${aggregate} to ${ftype} field \"${field}\" — ` +\n `summed percentages are meaningless (they can exceed 100%).`,\n hint:\n `Use aggregate \"avg\" for percentage/rate fields (or \"count\" of records). ` +\n `If a running total is genuinely intended, suppress with: ` +\n `suppressWarnings: ['${MEASURE_AGGREGATE_INCOHERENT}'] on the measure.`,\n });\n }\n }\n }\n\n const dashboards = asArray(stack.dashboards);\n for (let i = 0; i < dashboards.length; i++) {\n const dash = dashboards[i];\n const dashName = typeof dash.name === 'string' ? dash.name : `(dashboard ${i})`;\n const widgets = Array.isArray(dash.widgets) ? (dash.widgets as AnyRec[]) : [];\n\n for (let j = 0; j < widgets.length; j++) {\n const w = widgets[j];\n const widgetId = typeof w.id === 'string' ? w.id : `(widget ${j})`;\n const where = `dashboard \"${dashName}\" › widget \"${widgetId}\"`;\n const path = `dashboards[${i}].widgets[${j}]`;\n const suppressed = (rule: string): boolean =>\n Array.isArray(w.suppressWarnings) && w.suppressWarnings.includes(rule);\n const push = (f: Omit<WidgetBindingFinding, 'where' | 'path'>): void => {\n if (f.severity === 'warning' && suppressed(f.rule)) return;\n findings.push({ ...f, where, path });\n };\n\n // ── (a) dataset reference resolves ──\n const dsName = typeof w.dataset === 'string' ? w.dataset : undefined;\n const dataset = dsName ? datasets.get(dsName) : undefined;\n if (dsName && !dataset) {\n push({\n severity: 'error',\n rule: WIDGET_DATASET_UNKNOWN,\n message: `dataset \"${dsName}\" does not resolve to a declared dataset.`,\n hint:\n `Declared datasets: ${list(datasets.keys())}.${suggest(dsName, datasets.keys())} ` +\n `Define the dataset with defineDataset() or fix the reference (ADR-0021).`,\n });\n }\n // Without a resolved dataset there is nothing to check names against.\n if (!dataset) continue;\n\n const dimensionNames = new Set<string>();\n for (const d of asArray(dataset.dimensions)) {\n if (typeof d.name === 'string') dimensionNames.add(d.name);\n }\n const measures = new Map<string, AnyRec>();\n for (const m of asArray(dataset.measures)) {\n if (typeof m.name === 'string') measures.set(m.name, m);\n }\n\n // ── (b) every dimensions[] entry is a dataset dimension ──\n const dims = asStrings(w.dimensions);\n for (let k = 0; k < dims.length; k++) {\n if (dimensionNames.has(dims[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_DIMENSION_UNKNOWN,\n message:\n `dimensions[${k}] \"${dims[k]}\" is not a dimension of dataset ` +\n `\"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint:\n `Widgets select dataset dimensions BY NAME.${suggest(dims[k], dimensionNames)} ` +\n `Add the dimension to the dataset or fix the reference.`,\n });\n }\n\n // ── (c) every values[] entry is a dataset measure ──\n const values = asStrings(w.values);\n for (let k = 0; k < values.length; k++) {\n if (measures.has(values[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_MEASURE_UNKNOWN,\n message:\n `values[${k}] \"${values[k]}\" is not a measure of dataset ` +\n `\"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint:\n `Widgets select dataset measures BY NAME, not by base column.` +\n `${suggest(values[k], measures.keys())} ` +\n `Add the measure to the dataset or fix the reference.`,\n });\n }\n\n // ── (d) chartConfig bindings resolve against the widget's selection ──\n const chartConfig = (w.chartConfig && typeof w.chartConfig === 'object')\n ? (w.chartConfig as AnyRec)\n : undefined;\n const isChartType = typeof w.type === 'string' && CHART_TYPES.has(w.type);\n\n if (chartConfig) {\n // The query result carries the widget's selected dimensions and\n // measures; resolve every chartConfig field against that shape.\n const selectedValues = new Set(values.filter((v) => measures.has(v)));\n\n const xAxis = (chartConfig.xAxis && typeof chartConfig.xAxis === 'object')\n ? (chartConfig.xAxis as AnyRec)\n : undefined;\n // A field naming an entry of the widget's own (already-validated)\n // selection is not re-reported here — rules (b)/(c) own that error.\n if (xAxis && typeof xAxis.field === 'string'\n && !dimensionNames.has(xAxis.field) && !dims.includes(xAxis.field)) {\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message:\n `chartConfig.xAxis.field \"${xAxis.field}\" does not resolve to a ` +\n `dimension of dataset \"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint: `Point xAxis.field at a dataset dimension name.${suggest(xAxis.field, dimensionNames)}`,\n });\n }\n\n const measureField = (label: string, field: string): void => {\n if (values.includes(field)) return; // resolvable, or already errored via rule (c)\n const declaredButUnselected = measures.has(field);\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message: declaredButUnselected\n ? `chartConfig.${label} \"${field}\" is a measure of dataset \"${dsName}\" ` +\n `but is not selected in the widget's values (${list(values)}), so the ` +\n `query result will not contain it.`\n : `chartConfig.${label} \"${field}\" does not resolve to a measure of ` +\n `dataset \"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint: declaredButUnselected\n ? `Add \"${field}\" to the widget's values, or bind the chart to a selected measure.`\n : `Post-cutover data is keyed by the dataset's measure NAME, not the ` +\n `base column.${suggest(field, selectedValues.size > 0 ? selectedValues : measures.keys())}`,\n });\n };\n\n const yAxes = Array.isArray(chartConfig.yAxis) ? (chartConfig.yAxis as AnyRec[]) : [];\n for (let k = 0; k < yAxes.length; k++) {\n const field = yAxes[k]?.field;\n if (typeof field === 'string') measureField(`yAxis[${k}].field`, field);\n }\n const series = Array.isArray(chartConfig.series) ? (chartConfig.series as AnyRec[]) : [];\n for (let k = 0; k < series.length; k++) {\n const name = series[k]?.name;\n if (typeof name === 'string') measureField(`series[${k}].name`, name);\n }\n } else if (isChartType) {\n push({\n severity: 'warning',\n rule: CHART_CONFIG_MISSING,\n message:\n `chart-type widget ('${w.type}') has no chartConfig — the renderer ` +\n `cannot determine which measure to plot, so the series renders empty.`,\n hint:\n `Add chartConfig with xAxis.field set to a dimension (${list(dims)}) and ` +\n `yAxis[].field set to a measure name (${list(values)}). If the default ` +\n `rendering is intentional, suppress with: suppressWarnings: ['${CHART_CONFIG_MISSING}']`,\n });\n }\n\n // ── (e) table/pivot bound to a count-only, dimensionless selection ──\n if (w.type !== 'table' && w.type !== 'pivot') continue;\n // Grouped by at least one dimension → genuinely aggregated rows.\n if (dims.length > 0) continue;\n if (values.length === 0) continue;\n const resolved = values.map((v) => measures.get(v));\n // An unresolvable measure name already errored above — don't guess here.\n if (resolved.some((m) => !m)) continue;\n\n // Derived measures combine other measures; treat them as non-count even\n // when their (ignored) `aggregate` says otherwise.\n const countOnly = resolved.every((m) => m!.aggregate === 'count' && !m!.derived);\n if (!countOnly) continue;\n\n push({\n severity: 'warning',\n rule: TABLE_COUNT_ONLY,\n message:\n `a '${w.type}' widget bound to dataset \"${dsName}\" selects only count ` +\n `measure(s) (${values.join(', ')}) and no dimensions, so it renders a ` +\n `single summary row — not a per-record list.`,\n hint:\n `A flat record listing is not an analytics dataset. Model it as an ` +\n `object-bound ListView (ADR-0017) surfaced through app navigation, and ` +\n `use a 'metric' widget here if you only need the count. If a single-row ` +\n `table is intentional, add an explicit dimension or suppress with: ` +\n `suppressWarnings: ['${TABLE_COUNT_ONLY}']`,\n });\n }\n }\n\n return findings;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Build-time expression validation (ADR-0032 §Decision 1a + 1b).\n *\n * Runs at `objectstack compile`, where the whole normalized stack is in hand —\n * so flow conditions can be checked against the *resolved* object schema\n * (field existence) in addition to CEL syntax. Uses the one shared validator\n * from `@objectstack/formula`, so the verdict matches `registerFlow` and the\n * agent `validate_expression` tool exactly.\n *\n * Scope (v1): flow predicates (start/decision `config.condition` + edge\n * `condition`), object validation-rule / formula predicates, and UI action\n * `visible` / `disabled` predicates. Each error is located (flow/object/action\n * + node/edge/field) with a corrective message.\n */\n\nimport { validateExpression } from '@objectstack/formula';\n\nexport interface ExprIssue {\n where: string;\n message: string;\n source: string;\n /**\n * `error` fails the build (e.g. a bare ref in a record-scoped formula). `warning`\n * is advisory and never fails it (e.g. a possible field typo in a flattened flow\n * condition, which might be a flow variable). Absent ⇒ treat as `error`.\n */\n severity?: 'error' | 'warning';\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce an `objects` collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** object name → set of its field names, for schema-aware field checks. */\nfunction buildFieldIndex(objects: AnyRec[]): Map<string, string[]> {\n const idx = new Map<string, string[]>();\n for (const obj of objects) {\n const name = typeof obj.name === 'string' ? obj.name : undefined;\n if (!name) continue;\n const fields = obj.fields;\n let names: string[] = [];\n if (Array.isArray(fields)) names = fields.map(f => (f as AnyRec).name).filter((n): n is string => typeof n === 'string');\n else if (fields && typeof fields === 'object') names = Object.keys(fields as AnyRec);\n idx.set(name, names);\n }\n return idx;\n}\n\n/**\n * Validate every predicate in the stack. Returns the list of issues (empty =\n * clean). Caller decides how to surface / whether to fail the build.\n */\nexport function validateStackExpressions(stack: AnyRec): ExprIssue[] {\n const issues: ExprIssue[] = [];\n const objects = asArray(stack.objects);\n const fieldIndex = buildFieldIndex(objects);\n\n const check = (\n where: string,\n raw: unknown,\n objectName?: string,\n scope: 'record' | 'flattened' = 'flattened',\n ): void => {\n if (raw == null) return;\n const fields = objectName ? fieldIndex.get(objectName) : undefined;\n const res = validateExpression('predicate', raw as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields, scope } : { scope });\n for (const e of res.errors) issues.push({ where, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where, message: w.message, source: w.source, severity: 'warning' });\n };\n\n // ── Flows ──────────────────────────────────────────────────────────\n for (const flow of asArray(stack.flows)) {\n const flowName = typeof flow.name === 'string' ? flow.name : '(unnamed flow)';\n const nodes = Array.isArray(flow.nodes) ? (flow.nodes as AnyRec[]) : [];\n const edges = Array.isArray(flow.edges) ? (flow.edges as AnyRec[]) : [];\n // The record-change target object — `record.*` refs resolve against it.\n const startNode = nodes.find(n => n.type === 'start');\n const startCfg = (startNode?.config ?? {}) as AnyRec;\n const objectName = typeof startCfg.objectName === 'string' ? startCfg.objectName : undefined;\n\n for (const node of nodes) {\n const cfg = (node.config ?? {}) as AnyRec;\n check(`flow '${flowName}' · node '${node.id}' (${node.type}) condition`, cfg.condition, objectName);\n // #1870 — a `script` node must declare a callable target (`actionType` or\n // `function`). A node with neither is a silent no-op that otherwise passes\n // build. (Function *existence* isn't checkable here — functions are code,\n // not serialized into the artifact — so this is a structural check; the\n // runtime verifies the named function is actually registered.)\n if (node.type === 'script') {\n // `function` is canonical; `functionName` is an accepted alias.\n const fn =\n (typeof cfg.function === 'string' ? cfg.function.trim() : '') ||\n (typeof cfg.functionName === 'string' ? cfg.functionName.trim() : '');\n const action = typeof cfg.actionType === 'string' ? cfg.actionType.trim() : '';\n // Inline `config.script` (a JS body) is also a declared form — the\n // built-in runtime doesn't execute it (warned at run time), but the node\n // is not the empty no-op this check targets, so don't flag it.\n const inline = typeof cfg.script === 'string' ? cfg.script.trim() : '';\n if (!fn && !action && !inline) {\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node declares neither \\`actionType\\` nor \\`function\\` — it would do nothing at runtime. ` +\n `Name a built-in action (e.g. \\`actionType: 'email'\\`) or a registered function ` +\n `(\\`function: 'my_fn'\\`, registered via \\`defineStack({ functions })\\`).`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n } else if (action === 'invoke_function' && !fn) {\n // `actionType: 'invoke_function'` is a marker that names no callable on\n // its own — the function name must be in `function`/`functionName`.\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node uses \\`actionType: 'invoke_function'\\` but no \\`function\\` (or \\`functionName\\`) — ` +\n `it names no callable. Set \\`function: 'my_fn'\\` and register it via \\`defineStack({ functions })\\`.`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n }\n }\n }\n for (const edge of edges) {\n check(`flow '${flowName}' · edge '${edge.id}' (${edge.source}→${edge.target}) condition`, edge.condition, objectName);\n }\n }\n\n // ── Object validation-rule + formula predicates ────────────────────\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n const validations = obj.validations ?? obj.validationRules;\n for (const rule of asArray(validations)) {\n const where = `object '${objectName}' · validation '${(rule.name as string) ?? '?'}'`;\n // Common predicate keys across rule shapes. Validation predicates are\n // `record`-scoped — no field flattening — so bare refs are flagged (#1928).\n check(where, rule.expression ?? rule.predicate ?? rule.condition ?? rule.formula, objectName, 'record');\n // `conditional` rules carry a nested `when` predicate (record-scoped).\n check(`${where} when`, (rule as AnyRec).when, objectName, 'record');\n }\n // Field-level formulas (computed fields) reference the same object.\n const fields = obj.fields;\n const fieldList = Array.isArray(fields)\n ? (fields as AnyRec[])\n : (fields && typeof fields === 'object' ? Object.values(fields as AnyRec) as AnyRec[] : []);\n\n // ── ADR-0062 D7 — reject `field.columnName` on external objects ──────\n // `field.columnName` (localField → physicalColumn) is the managed-object\n // mechanism; it is NOT applied by the driver's query pipeline for federated\n // objects, where `external.columnMap` (remoteColumn → localField) is the\n // authoritative — and inverse — mapping. Allowing both would be a silent\n // dual-source ambiguity, so reject `columnName` on any object that declares\n // an `external` binding (a federated object). Managed objects are untouched.\n if (obj.external != null) {\n const fieldEntries: Array<[string, AnyRec]> = Array.isArray(fields)\n ? (fields as AnyRec[]).map((f) => [((f as AnyRec)?.name as string) ?? '?', f as AnyRec])\n : (fields && typeof fields === 'object'\n ? (Object.entries(fields as AnyRec) as Array<[string, AnyRec]>)\n : []);\n for (const [fname, fdef] of fieldEntries) {\n if (fdef && typeof fdef === 'object' && (fdef as AnyRec).columnName != null) {\n issues.push({\n where: `object '${objectName}' · field '${fname}'`,\n message:\n `external object '${objectName}': field '${fname}' sets columnName='${String((fdef as AnyRec).columnName)}', ` +\n `which is not supported on federated objects (ADR-0062 D7). The driver's query pipeline ignores ` +\n `field.columnName for external objects; map remote columns via the datasource's external.columnMap instead.`,\n source: `columnName='${String((fdef as AnyRec).columnName)}'`,\n severity: 'error',\n });\n }\n }\n }\n\n for (const f of fieldList) {\n // Field-level conditional rules are server-enforced (rule-validator) and\n // record-scoped — a bare ref silently fails the rule (required/readonly\n // not enforced = data-integrity hole). #1928 class, same as actions.\n if (f && typeof f === 'object') {\n const fname = (f.name as string) ?? '?';\n for (const key of ['requiredWhen', 'readonlyWhen', 'conditionalRequired', 'visibleWhen'] as const) {\n check(`object '${objectName}' · field '${fname}' ${key}`, (f as AnyRec)[key], objectName, 'record');\n }\n }\n if (f && typeof f === 'object' && f.formula) {\n // formulas are `value` role (any return type), still CEL. They are\n // `record`-scoped — `record.<field>`, never bare — so flag bare refs (#1928).\n const res = validateExpression('value', f.formula as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields: fieldIndex.get(objectName), scope: 'record' } : { scope: 'record' });\n const fieldWhere = `object '${objectName}' · field '${(f.name as string) ?? '?'}' formula`;\n for (const e of res.errors) issues.push({ where: fieldWhere, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where: fieldWhere, message: w.message, source: w.source, severity: 'warning' });\n }\n }\n }\n\n // ── Action `visible` / `disabled` predicates ───────────────────────\n // Record-scoped, same as validation rules: a record-header / row action's\n // `visible` is evaluated by ActionEngine against `{ record, recordId,\n // objectName, user, … }` with fail-closed semantics, so a BARE field ref\n // (`done` instead of `record.done`) throws and the action is silently hidden\n // on every record (the trap behind the #2183 \"Mark Done never hides\" hunt).\n // Flagging it here turns that into a build error with a corrective message.\n // `disabled` may be a boolean (skip) or a predicate (check).\n const seenActions = new Set<string>();\n const checkAction = (where: string, action: AnyRec, objectName?: string): void => {\n const obj = objectName\n ?? (typeof action.objectName === 'string' ? action.objectName : undefined)\n ?? (typeof action.object === 'string' ? action.object : undefined);\n const name = typeof action.name === 'string' ? action.name : '?';\n const key = `${obj ?? ''}:${name}`;\n if (seenActions.has(key)) return; // de-dup (actions are merged onto objects AND kept top-level)\n seenActions.add(key);\n check(`${where} · action '${name}' visible`, action.visible, obj, 'record');\n if (typeof action.disabled !== 'boolean') {\n check(`${where} · action '${name}' disabled`, action.disabled, obj, 'record');\n }\n };\n for (const action of asArray(stack.actions)) {\n checkAction('stack', action);\n }\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n for (const action of asArray(obj.actions)) {\n checkAction(`object '${objectName}'`, action, objectName);\n }\n }\n\n // ── Sharing-rule predicates (security-critical, record-scoped) ─────\n // A criteria sharing rule's `condition` decides which rows a principal sees.\n // It is evaluated against the record, so a bare ref silently changes access.\n for (const rule of asArray(stack.sharingRules)) {\n const ruleObj = typeof rule.object === 'string' ? rule.object : undefined;\n const where = `sharingRule '${(rule.name as string) ?? '?'}'${ruleObj ? ` (${ruleObj})` : ''} condition`;\n check(where, rule.condition ?? rule.criteria ?? rule.predicate, ruleObj, 'record');\n }\n\n // ── Hook `condition` predicates (record-scoped gate) ───────────────\n // A lifecycle hook's `condition` skips the handler when false; it is\n // evaluated against the record, so a bare ref silently makes the hook\n // run on every record (or never) instead of the intended subset.\n for (const hook of asArray(stack.hooks)) {\n const hookObj = typeof hook.object === 'string' ? hook.object : undefined; // array targets → no single field set\n check(`hook '${(hook.name as string) ?? '?'}'${hookObj ? ` (${hookObj})` : ''} condition`, hook.condition, hookObj, 'record');\n }\n\n return issues;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for the SDUI scoped-styling model (ADR-0065).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019): the same bar holds for\n// hand-authored and AI-generated pages, run from `os validate`/`compile` and\n// reusable by AI authoring. It catches the deterministic ways a `responsiveStyles`\n// block silently fails or drifts — the class of mistake an AI author is most\n// likely to make — *before* render, with actionable hints it can self-correct on.\n//\n// What it does NOT catch: whether the result looks good. Visual/semantic quality\n// (contrast, balance, \"is it ugly\") is only catchable by rendering + a VLM gate,\n// which is a separate, render-time concern (ADR-0065 §Decision-5).\n\nexport type StyleSeverity = 'error' | 'warning';\n\nexport interface StyleFinding {\n severity: StyleSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"pricing\" › node \"plan_solo\"`. */\n where: string;\n /** Config path, e.g. `pages[0].regions[0].components[1]`. */\n path: string;\n message: string;\n hint: string;\n}\n\n// Rule ids (registry entries).\nexport const STYLE_NODE_MISSING_ID = 'style-node-missing-id';\nexport const STYLE_CLASSNAME_TAILWIND = 'style-classname-tailwind';\nexport const STYLE_RESPONSIVE_NO_BASE = 'style-responsive-no-base';\nexport const STYLE_UNKNOWN_CSS_PROPERTY = 'style-unknown-css-property';\nexport const STYLE_UNKNOWN_TOKEN = 'style-unknown-token';\n\ntype AnyRec = Record<string, unknown>;\n\nconst BREAKPOINTS = ['large', 'medium', 'small', 'xsmall'] as const;\n\n/** SDUI design-token palette (ADR-0065) + base theme tokens, referenced as\n * `var(--name)`. Authors should resolve values against these. Kept in sync with\n * `apps/console/src/index.css` / `@object-ui/components` `:root`. */\nconst KNOWN_TOKENS = new Set<string>([\n // SDUI tokens\n 'space-1', 'space-2', 'space-3', 'space-4', 'space-5', 'space-6', 'space-8', 'space-10', 'space-12',\n 'radius', 'radius-sm', 'radius-md', 'radius-lg', 'radius-xl',\n 'shadow-sm', 'shadow-md', 'shadow-lg',\n 'surface', 'surface-sunken', 'text-strong', 'text-muted', 'brand', 'brand-foreground', 'hairline',\n // Base theme tokens (shadcn) — usually wrapped as hsl(var(--x)).\n 'background', 'foreground', 'card', 'card-foreground', 'popover', 'popover-foreground',\n 'primary', 'primary-foreground', 'secondary', 'secondary-foreground',\n 'muted', 'muted-foreground', 'accent', 'accent-foreground',\n 'destructive', 'destructive-foreground', 'border', 'input', 'ring',\n 'success', 'success-foreground', 'warning', 'warning-foreground',\n 'chart-1', 'chart-2', 'chart-3', 'chart-4', 'chart-5',\n]);\n\n/** Common CSS properties (camelCase) an SDUI block realistically sets. Generous\n * on purpose: an unknown property is only a *warning* (typo catcher), never a\n * blocker. Custom properties (`--x`) are always allowed. */\nconst KNOWN_CSS_PROPERTIES = new Set<string>([\n 'display', 'position', 'top', 'right', 'bottom', 'left', 'inset', 'zIndex', 'overflow', 'overflowX', 'overflowY', 'visibility', 'boxSizing', 'float', 'clear',\n 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'aspectRatio',\n 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginInline', 'marginBlock',\n 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingInline', 'paddingBlock',\n 'flex', 'flexDirection', 'flexWrap', 'flexGrow', 'flexShrink', 'flexBasis', 'alignItems', 'alignContent', 'alignSelf', 'justifyContent', 'justifyItems', 'justifySelf', 'gap', 'rowGap', 'columnGap', 'order', 'placeItems', 'placeContent',\n 'grid', 'gridTemplate', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridColumn', 'gridRow', 'gridArea', 'gridAutoFlow', 'gridAutoColumns', 'gridAutoRows',\n 'color', 'backgroundColor', 'background', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat', 'backgroundClip', 'opacity', 'mixBlendMode',\n 'fontSize', 'fontWeight', 'fontFamily', 'fontStyle', 'lineHeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'textOverflow', 'whiteSpace', 'wordBreak', 'overflowWrap', 'fontVariantNumeric', 'verticalAlign', 'textShadow',\n 'border', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'borderColor', 'borderWidth', 'borderStyle', 'borderRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'outline', 'outlineOffset',\n 'boxShadow', 'transform', 'transformOrigin', 'transition', 'transitionProperty', 'transitionDuration', 'transitionTimingFunction', 'transitionDelay', 'animation', 'filter', 'backdropFilter', 'willChange',\n 'cursor', 'pointerEvents', 'userSelect', 'objectFit', 'objectPosition', 'content',\n]);\n\nconst VAR_RE = /var\\(\\s*--([a-zA-Z0-9-]+)\\s*[,)]/g;\n\n// High-precision Tailwind-utility detection. A `className` in page metadata is\n// \"Tailwind-looking\" if any token is a responsive/state variant, an arbitrary\n// `[…]` value, a known utility stem followed by a Tailwind *value* (number /\n// fraction / size keyword), or a bare layout utility. Tuned to NOT trip on\n// ordinary custom class names (e.g. `my-custom-scope`, `os-s-plan_solo`).\nconst TW_VARIANT = /^(sm|md|lg|xl|2xl|hover|focus|active|disabled|dark|group-hover|peer-[a-z]+|first|last|odd|even):/;\nconst TW_STEM_VALUE = /^-?(p|m|px|py|pt|pb|pl|pr|mx|my|mt|mb|ml|mr|gap|gap-x|gap-y|space-x|space-y|w|h|min-w|max-w|min-h|max-h|size|text|leading|tracking|bg|border|rounded|shadow|ring|opacity|inset|top|bottom|left|right|z|order|col|row|grid-cols|grid-rows|basis)-(\\d+(\\.\\d+)?|\\d+\\/\\d+|px|full|auto|none|screen|min|max|fit|xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl)$/;\nconst TW_BARE = /^(flex|grid|block|inline|inline-block|inline-flex|hidden|contents|table|flow-root|grow|shrink|truncate|italic|underline|uppercase|lowercase|capitalize|antialiased|absolute|relative|fixed|sticky|static|isolate|flex-col|flex-row|flex-wrap|flex-nowrap|items-center|items-start|items-end|items-stretch|justify-center|justify-between|justify-around|justify-start|justify-end|text-center|text-left|text-right|font-bold|font-semibold|font-medium|font-normal|tabular-nums)$/;\n\nfunction looksLikeTailwind(className: string): boolean {\n return className.split(/\\s+/).some((tok) => {\n if (!tok) return false;\n if (TW_VARIANT.test(tok)) return true;\n if (/\\[[^\\]]+\\]/.test(tok)) return true; // arbitrary value, e.g. p-[13px]\n if (TW_STEM_VALUE.test(tok)) return true;\n if (TW_BARE.test(tok)) return true;\n return false;\n });\n}\n\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** Child nodes can hang off `children`, `properties.children`, `body`, or\n * `properties.body` depending on block type — collect them all. */\nfunction childrenOf(node: AnyRec): AnyRec[] {\n const props = (node.properties as AnyRec) ?? {};\n const out: AnyRec[] = [];\n for (const c of [node.children, props.children, node.body, props.body]) {\n if (Array.isArray(c)) out.push(...(c.filter((x) => x && typeof x === 'object') as AnyRec[]));\n }\n return out;\n}\n\nfunction checkNode(node: AnyRec, pageName: string, path: string, findings: StyleFinding[]): void {\n const id = typeof node.id === 'string' ? node.id : undefined;\n const type = typeof node.type === 'string' ? node.type : 'node';\n const where = `page \"${pageName}\" › ${id ? `node \"${id}\"` : `<${type}>`}`;\n const rs = node.responsiveStyles as AnyRec | undefined;\n const hasRs = !!rs && typeof rs === 'object' && BREAKPOINTS.some((b) => rs[b]);\n\n // (1) responsiveStyles needs an id to scope to — else the CSS is dropped.\n if (hasRs && !id) {\n findings.push({\n severity: 'error', rule: STYLE_NODE_MISSING_ID, where, path,\n message: `Node has responsiveStyles but no \\`id\\`; scoped CSS cannot be generated and the styles are silently dropped.`,\n hint: `Add a stable \\`id\\` to this node.`,\n });\n }\n\n // (2) responsive breakpoint without a `large` base → unstyled at desktop.\n if (hasRs && !rs!.large && BREAKPOINTS.slice(1).some((b) => rs![b])) {\n findings.push({\n severity: 'warning', rule: STYLE_RESPONSIVE_NO_BASE, where, path,\n message: `responsiveStyles sets a smaller breakpoint but no \\`large\\` base; the node is unstyled at desktop width.`,\n hint: `Put the unconditional/base styles under \\`responsiveStyles.large\\` (desktop-first).`,\n });\n }\n\n // (3) className that looks like Tailwind → won't render from metadata.\n if (typeof node.className === 'string' && node.className.trim() && looksLikeTailwind(node.className)) {\n findings.push({\n severity: 'warning', rule: STYLE_CLASSNAME_TAILWIND, where, path,\n message: `\\`className\\` contains Tailwind-looking utilities (\"${node.className.trim().slice(0, 60)}\"); these are not compiled from metadata and will silently do nothing.`,\n hint: `Style this node with \\`responsiveStyles\\` + design tokens instead of \\`className\\` (ADR-0065).`,\n });\n }\n\n // (4)+(5) unknown CSS property / unknown token inside each breakpoint map.\n if (rs && typeof rs === 'object') {\n for (const bp of BREAKPOINTS) {\n const map = rs[bp] as AnyRec | undefined;\n if (!map || typeof map !== 'object') continue;\n for (const [prop, value] of Object.entries(map)) {\n if (!prop.startsWith('--') && !KNOWN_CSS_PROPERTIES.has(prop)) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_CSS_PROPERTY, where, path: `${path}.responsiveStyles.${bp}`,\n message: `Unknown CSS property \"${prop}\" (typo?); if unintended it will not apply.`,\n hint: `Use a camelCase CSS property name (e.g. \\`flexDirection\\`, \\`backgroundColor\\`).`,\n });\n }\n if (typeof value === 'string') {\n let m: RegExpExecArray | null;\n VAR_RE.lastIndex = 0;\n while ((m = VAR_RE.exec(value))) {\n const token = m[1];\n if (!KNOWN_TOKENS.has(token) && !token.startsWith('tw-')) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_TOKEN, where, path: `${path}.responsiveStyles.${bp}.${prop}`,\n message: `References unknown design token \\`var(--${token})\\` (typo?); it will not resolve.`,\n hint: `Use a token from the ADR-0065 palette (e.g. \\`var(--space-6)\\`, \\`var(--surface)\\`, \\`hsl(var(--primary))\\`).`,\n });\n }\n }\n }\n }\n }\n }\n\n // Recurse.\n const kids = childrenOf(node);\n for (let i = 0; i < kids.length; i++) {\n checkNode(kids[i], pageName, `${path}.children[${i}]`, findings);\n }\n}\n\n/**\n * Validate every page's component tree for SDUI styling correctness (ADR-0065).\n * Returns findings (empty = clean). `error` findings describe styles that are\n * silently dropped and should fail validate/build; `warning` findings are\n * advisory (typos, drift, footguns).\n */\nexport function validateResponsiveStyles(stack: AnyRec): StyleFinding[] {\n const findings: StyleFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n const pageName = typeof page.name === 'string' ? page.name : `pages[${p}]`;\n const regions = asArray(page.regions);\n for (let r = 0; r < regions.length; r++) {\n const components = asArray(regions[r].components);\n for (let c = 0; c < components.length; c++) {\n checkNode(components[c], pageName, `pages[${p}].regions[${r}].components[${c}]`, findings);\n }\n }\n }\n return findings;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for AI-authored JSX-source pages (ADR-0080).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019), run from `os validate` / `os\n// build`. A `kind:'jsx'` page's `source` is a constrained JSX/Tailwind string\n// compiled (parsed, never executed) to the SDUI tree at save time. This gate\n// parses it at author time so malformed source fails loudly (ADR-0078) instead\n// of being stored and breaking only at render.\n//\n// Scope: parse-level — syntax, tag matching, and forbidden constructs (event\n// handlers, dangerouslySetInnerHTML). Full component/prop whitelist validation\n// needs the registry manifest (a cross-repo artifact); when that is wired,\n// thread it through `compile()` here. Until then this catches the structural\n// class of error an AI author is most likely to emit.\n\nimport { parseJsx, compile, type Manifest } from '@objectstack/sdui-parser';\n\nexport type JsxPageSeverity = 'error' | 'warning';\n\nexport interface JsxPageFinding {\n severity: JsxPageSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"command_center\" › <flex>`. */\n where: string;\n /** Config path, e.g. `pages[3].source`. */\n path: string;\n message: string;\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\nconst asArray = (v: unknown): AnyRec[] => (Array.isArray(v) ? (v as AnyRec[]) : []);\n\nexport function validateJsxPages(stack: AnyRec, opts: { manifest?: Manifest } = {}): JsxPageFinding[] {\n const findings: JsxPageFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n if (!page || page.kind !== 'jsx') continue;\n const name = String(page.name ?? `#${p}`);\n const source = page.source;\n if (typeof source !== 'string' || source.trim() === '') {\n // (PageSchema's superRefine also covers this; keep it for the build path.)\n findings.push({\n severity: 'error',\n rule: 'jsx-page-empty-source',\n where: `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: \"kind:'jsx' page has no `source`.\",\n hint: 'Author the page as a constrained JSX/Tailwind string in `source`.',\n });\n continue;\n }\n // With a component manifest, do full validation (unknown component, missing/\n // wrong prop, bad enum, bindings); without it, parse-level (syntax/structure).\n const { diagnostics } = opts.manifest ? compile(source, opts.manifest) : parseJsx(source);\n for (const d of diagnostics) {\n findings.push({\n severity: d.severity,\n rule: `jsx-${d.code}`,\n where: d.tag ? `page \"${name}\" › <${d.tag}>` : `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: d.message,\n hint: 'The source is parsed (never executed) and compiled to the SDUI tree at save time — fix the JSX.',\n });\n }\n }\n return findings;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { objectTitleCompleteness } from '@objectstack/spec/data';\nimport type { DisplayNameObjectMeta } from '@objectstack/spec/data';\n\n/**\n * Build-time record-title diagnostics (ADR-0079).\n *\n * A record's human title is a structural invariant: every object resolves a\n * primary title from a real STORED field via `nameField` (the canonical\n * pointer; `displayNameField` is the deprecated alias) or a deterministic\n * derivation. Two authoring smells are flagged here so `os build`/`os lint`,\n * the MCP authoring surface, and hand-authoring all get the coverage cloud\n * graph-lint already has (the ADR-0078 \"not cloud-only\" principle):\n *\n * - `title-format-retired` — the object declares a `titleFormat`. That field\n * is a RENDER-ONLY template the server can neither return nor query; ADR-0079\n * retires it in favour of `nameField`. The schema still parses it (existing\n * metadata keeps loading), so this is advisory, not an error.\n * - `title-unresolvable` — `objectTitleCompleteness` reports `status: 'none'`:\n * no `nameField`/`displayNameField` pointer and no title-eligible field to\n * derive one from. Records will have no meaningful title (the runtime falls\n * back to the auto-provisioned primary / `Record #<id>` floor), so this is a\n * warning, not an error — nothing is fully broken.\n *\n * Both are warnings: the auto-provision transform and the id floor mean a\n * green build never ships a fully title-less object. Reuses the shared spec\n * predicate (`@objectstack/spec/data` → display-name) so cloud and framework\n * classify titles identically.\n */\n\nexport const TITLE_FORMAT_RETIRED = 'title-format-retired';\nexport const TITLE_UNRESOLVABLE = 'title-unresolvable';\n\nexport type RecordTitleSeverity = 'error' | 'warning';\n\nexport interface RecordTitleFinding {\n /** Always `warning` today — both rules are advisory (see module note). */\n severity: RecordTitleSeverity;\n /** Diagnostic rule id (registry entry), e.g. `title-format-retired`. */\n rule: string;\n /** Human-readable location, e.g. `object \"invoice\"`. */\n where: string;\n /** Config path, e.g. `objects[3]`. */\n path: string;\n /** What is wrong. */\n message: string;\n /** How to fix it. */\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce a collection (array or name-keyed map) to an array of records. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/**\n * Validate every object's record-title declaration. Returns the list of\n * findings (empty = clean). Both rules are advisory (`warning`): the caller\n * must never fail the build on them alone — auto-provision + the `Record #<id>`\n * floor guarantee a resolvable title at runtime.\n */\nexport function validateRecordTitle(stack: AnyRec): RecordTitleFinding[] {\n const findings: RecordTitleFinding[] = [];\n\n const objects = asArray(stack.objects);\n for (let i = 0; i < objects.length; i++) {\n const obj = objects[i];\n const objName = typeof obj.name === 'string' ? obj.name : `(object ${i})`;\n const where = `object \"${objName}\"`;\n const path = `objects[${i}]`;\n\n // ── (a) titleFormat is retired (ADR-0079) ──\n // Render-only template the server cannot return or query. Still parsed by\n // the schema for back-compat, so advisory.\n if (obj.titleFormat !== undefined && obj.titleFormat !== null && obj.titleFormat !== '') {\n findings.push({\n severity: 'warning',\n rule: TITLE_FORMAT_RETIRED,\n where,\n path,\n message:\n `${objName}: titleFormat is retired (ADR-0079) — migrate to nameField ` +\n `(single field) or a formula field designated nameField`,\n hint:\n `titleFormat is a render-only template the server cannot return or ` +\n `query, and an explicit nameField now takes precedence. For a ` +\n `single-field title set nameField: '<field>'. For a composite title, ` +\n `add a formula field (returnType: 'text') and designate it via ` +\n `nameField.`,\n });\n }\n\n // ── (b) no resolvable title (status: 'none') ──\n // Reuse the shared spec predicate so cloud graph-lint and framework lint\n // classify titles identically. `none` = no pointer AND nothing derivable.\n const completeness = objectTitleCompleteness(obj as DisplayNameObjectMeta);\n if (completeness.status === 'none') {\n findings.push({\n severity: 'warning',\n rule: TITLE_UNRESOLVABLE,\n where,\n path,\n message:\n `${objName}: no resolvable record title — records will have no ` +\n `meaningful name (no nameField and no title-eligible field to derive one)`,\n hint:\n `Set nameField to a text/email field (or a formula field with ` +\n `returnType: 'text'), or add a text field named \"name\"/\"title\". The ` +\n `runtime auto-provisions a primary and falls back to \"Record #<id>\", ` +\n `but an explicit title is far more useful.`,\n });\n }\n }\n\n return findings;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,kBAAsC;AAkD/B,IAAM,yBAAyB;AAC/B,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAC/B,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AACzB,IAAM,+BAA+B;AAsB5C,SAAS,QAAQ,GAAsB;AACrC,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO;AAC7B,MAAI,KAAK,OAAO,MAAM,UAAU;AAC9B,WAAO,OAAO,QAAQ,CAAW,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,EAAE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AM,QAAQ,CAAC,EAAG,QAAO;AAC7B,MAAI,KAAK,OAAO,MAAM,UAAU;AAC9B,WAAO,OAAO,QAAQ,CAAW,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAI,IAAe,EAAE;AAAA,EACxF;AACA,SAAO,CAAC;AACV;AAQO,SAAS,oBAAoB,OAAqC;AACvE,QAAM,WAAiC,CAAC;AAExC,QAAM,UAAUA,SAAQ,MAAM,OAAO;AACrC,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,MAAM,QAAQ,CAAC;AACrB,UAAM,UAAU,OAAO,IAAI,SAAS,WAAW,IAAI,OAAO,WAAW,CAAC;AACtE,UAAM,QAAQ,WAAW,OAAO;AAChC,UAAM,OAAO,WAAW,CAAC;AAKzB,QAAI,IAAI,gBAAgB,UAAa,IAAI,gBAAgB,QAAQ,IAAI,gBAAgB,IAAI;AACvF,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,SACE,GAAG,OAAO;AAAA,QAEZ,MACE;AAAA,MAKJ,CAAC;AAAA,IACH;AAKA,UAAM,mBAAe,sCAAwB,GAA4B;AACzE,QAAI,aAAa,WAAW,QAAQ;AAClC,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,SACE,GAAG,OAAO;AAAA,QAEZ,MACE;AAAA,MAIJ,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":["asArray","asArray","asArray","import_data","asArray"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -69,7 +69,7 @@ interface WidgetBindingFinding {
|
|
|
69
69
|
/** How to fix (or deliberately suppress) it. */
|
|
70
70
|
hint: string;
|
|
71
71
|
}
|
|
72
|
-
type AnyRec$
|
|
72
|
+
type AnyRec$4 = Record<string, unknown>;
|
|
73
73
|
/**
|
|
74
74
|
* Validate every dashboard widget's dataset binding. Returns the list of
|
|
75
75
|
* findings (empty = clean). Caller decides how to surface them: `error`
|
|
@@ -77,7 +77,7 @@ type AnyRec$3 = Record<string, unknown>;
|
|
|
77
77
|
* should fail validate/build; `warning` findings are advisory and must
|
|
78
78
|
* never fail the build on their own.
|
|
79
79
|
*/
|
|
80
|
-
declare function validateWidgetBindings(stack: AnyRec$
|
|
80
|
+
declare function validateWidgetBindings(stack: AnyRec$4): WidgetBindingFinding[];
|
|
81
81
|
|
|
82
82
|
interface ExprIssue {
|
|
83
83
|
where: string;
|
|
@@ -90,12 +90,12 @@ interface ExprIssue {
|
|
|
90
90
|
*/
|
|
91
91
|
severity?: 'error' | 'warning';
|
|
92
92
|
}
|
|
93
|
-
type AnyRec$
|
|
93
|
+
type AnyRec$3 = Record<string, unknown>;
|
|
94
94
|
/**
|
|
95
95
|
* Validate every predicate in the stack. Returns the list of issues (empty =
|
|
96
96
|
* clean). Caller decides how to surface / whether to fail the build.
|
|
97
97
|
*/
|
|
98
|
-
declare function validateStackExpressions(stack: AnyRec$
|
|
98
|
+
declare function validateStackExpressions(stack: AnyRec$3): ExprIssue[];
|
|
99
99
|
|
|
100
100
|
type StyleSeverity = 'error' | 'warning';
|
|
101
101
|
interface StyleFinding {
|
|
@@ -113,14 +113,14 @@ declare const STYLE_CLASSNAME_TAILWIND = "style-classname-tailwind";
|
|
|
113
113
|
declare const STYLE_RESPONSIVE_NO_BASE = "style-responsive-no-base";
|
|
114
114
|
declare const STYLE_UNKNOWN_CSS_PROPERTY = "style-unknown-css-property";
|
|
115
115
|
declare const STYLE_UNKNOWN_TOKEN = "style-unknown-token";
|
|
116
|
-
type AnyRec$
|
|
116
|
+
type AnyRec$2 = Record<string, unknown>;
|
|
117
117
|
/**
|
|
118
118
|
* Validate every page's component tree for SDUI styling correctness (ADR-0065).
|
|
119
119
|
* Returns findings (empty = clean). `error` findings describe styles that are
|
|
120
120
|
* silently dropped and should fail validate/build; `warning` findings are
|
|
121
121
|
* advisory (typos, drift, footguns).
|
|
122
122
|
*/
|
|
123
|
-
declare function validateResponsiveStyles(stack: AnyRec$
|
|
123
|
+
declare function validateResponsiveStyles(stack: AnyRec$2): StyleFinding[];
|
|
124
124
|
|
|
125
125
|
type JsxPageSeverity = 'error' | 'warning';
|
|
126
126
|
interface JsxPageFinding {
|
|
@@ -133,9 +133,60 @@ interface JsxPageFinding {
|
|
|
133
133
|
message: string;
|
|
134
134
|
hint: string;
|
|
135
135
|
}
|
|
136
|
-
type AnyRec = Record<string, unknown>;
|
|
137
|
-
declare function validateJsxPages(stack: AnyRec, opts?: {
|
|
136
|
+
type AnyRec$1 = Record<string, unknown>;
|
|
137
|
+
declare function validateJsxPages(stack: AnyRec$1, opts?: {
|
|
138
138
|
manifest?: Manifest;
|
|
139
139
|
}): JsxPageFinding[];
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Build-time record-title diagnostics (ADR-0079).
|
|
143
|
+
*
|
|
144
|
+
* A record's human title is a structural invariant: every object resolves a
|
|
145
|
+
* primary title from a real STORED field via `nameField` (the canonical
|
|
146
|
+
* pointer; `displayNameField` is the deprecated alias) or a deterministic
|
|
147
|
+
* derivation. Two authoring smells are flagged here so `os build`/`os lint`,
|
|
148
|
+
* the MCP authoring surface, and hand-authoring all get the coverage cloud
|
|
149
|
+
* graph-lint already has (the ADR-0078 "not cloud-only" principle):
|
|
150
|
+
*
|
|
151
|
+
* - `title-format-retired` — the object declares a `titleFormat`. That field
|
|
152
|
+
* is a RENDER-ONLY template the server can neither return nor query; ADR-0079
|
|
153
|
+
* retires it in favour of `nameField`. The schema still parses it (existing
|
|
154
|
+
* metadata keeps loading), so this is advisory, not an error.
|
|
155
|
+
* - `title-unresolvable` — `objectTitleCompleteness` reports `status: 'none'`:
|
|
156
|
+
* no `nameField`/`displayNameField` pointer and no title-eligible field to
|
|
157
|
+
* derive one from. Records will have no meaningful title (the runtime falls
|
|
158
|
+
* back to the auto-provisioned primary / `Record #<id>` floor), so this is a
|
|
159
|
+
* warning, not an error — nothing is fully broken.
|
|
160
|
+
*
|
|
161
|
+
* Both are warnings: the auto-provision transform and the id floor mean a
|
|
162
|
+
* green build never ships a fully title-less object. Reuses the shared spec
|
|
163
|
+
* predicate (`@objectstack/spec/data` → display-name) so cloud and framework
|
|
164
|
+
* classify titles identically.
|
|
165
|
+
*/
|
|
166
|
+
declare const TITLE_FORMAT_RETIRED = "title-format-retired";
|
|
167
|
+
declare const TITLE_UNRESOLVABLE = "title-unresolvable";
|
|
168
|
+
type RecordTitleSeverity = 'error' | 'warning';
|
|
169
|
+
interface RecordTitleFinding {
|
|
170
|
+
/** Always `warning` today — both rules are advisory (see module note). */
|
|
171
|
+
severity: RecordTitleSeverity;
|
|
172
|
+
/** Diagnostic rule id (registry entry), e.g. `title-format-retired`. */
|
|
173
|
+
rule: string;
|
|
174
|
+
/** Human-readable location, e.g. `object "invoice"`. */
|
|
175
|
+
where: string;
|
|
176
|
+
/** Config path, e.g. `objects[3]`. */
|
|
177
|
+
path: string;
|
|
178
|
+
/** What is wrong. */
|
|
179
|
+
message: string;
|
|
180
|
+
/** How to fix it. */
|
|
181
|
+
hint: string;
|
|
182
|
+
}
|
|
183
|
+
type AnyRec = Record<string, unknown>;
|
|
184
|
+
/**
|
|
185
|
+
* Validate every object's record-title declaration. Returns the list of
|
|
186
|
+
* findings (empty = clean). Both rules are advisory (`warning`): the caller
|
|
187
|
+
* must never fail the build on them alone — auto-provision + the `Record #<id>`
|
|
188
|
+
* floor guarantee a resolvable title at runtime.
|
|
189
|
+
*/
|
|
190
|
+
declare function validateRecordTitle(stack: AnyRec): RecordTitleFinding[];
|
|
191
|
+
|
|
192
|
+
export { CHART_CONFIG_MISSING, CHART_FIELD_UNKNOWN, type ExprIssue, type JsxPageFinding, type JsxPageSeverity, MEASURE_AGGREGATE_INCOHERENT, type RecordTitleFinding, type RecordTitleSeverity, STYLE_CLASSNAME_TAILWIND, STYLE_NODE_MISSING_ID, STYLE_RESPONSIVE_NO_BASE, STYLE_UNKNOWN_CSS_PROPERTY, STYLE_UNKNOWN_TOKEN, type StyleFinding, type StyleSeverity, TABLE_COUNT_ONLY, TITLE_FORMAT_RETIRED, TITLE_UNRESOLVABLE, WIDGET_DATASET_UNKNOWN, WIDGET_DIMENSION_UNKNOWN, WIDGET_MEASURE_UNKNOWN, type WidgetBindingFinding, type WidgetBindingSeverity, validateJsxPages, validateRecordTitle, validateResponsiveStyles, validateStackExpressions, validateWidgetBindings };
|
package/dist/index.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ interface WidgetBindingFinding {
|
|
|
69
69
|
/** How to fix (or deliberately suppress) it. */
|
|
70
70
|
hint: string;
|
|
71
71
|
}
|
|
72
|
-
type AnyRec$
|
|
72
|
+
type AnyRec$4 = Record<string, unknown>;
|
|
73
73
|
/**
|
|
74
74
|
* Validate every dashboard widget's dataset binding. Returns the list of
|
|
75
75
|
* findings (empty = clean). Caller decides how to surface them: `error`
|
|
@@ -77,7 +77,7 @@ type AnyRec$3 = Record<string, unknown>;
|
|
|
77
77
|
* should fail validate/build; `warning` findings are advisory and must
|
|
78
78
|
* never fail the build on their own.
|
|
79
79
|
*/
|
|
80
|
-
declare function validateWidgetBindings(stack: AnyRec$
|
|
80
|
+
declare function validateWidgetBindings(stack: AnyRec$4): WidgetBindingFinding[];
|
|
81
81
|
|
|
82
82
|
interface ExprIssue {
|
|
83
83
|
where: string;
|
|
@@ -90,12 +90,12 @@ interface ExprIssue {
|
|
|
90
90
|
*/
|
|
91
91
|
severity?: 'error' | 'warning';
|
|
92
92
|
}
|
|
93
|
-
type AnyRec$
|
|
93
|
+
type AnyRec$3 = Record<string, unknown>;
|
|
94
94
|
/**
|
|
95
95
|
* Validate every predicate in the stack. Returns the list of issues (empty =
|
|
96
96
|
* clean). Caller decides how to surface / whether to fail the build.
|
|
97
97
|
*/
|
|
98
|
-
declare function validateStackExpressions(stack: AnyRec$
|
|
98
|
+
declare function validateStackExpressions(stack: AnyRec$3): ExprIssue[];
|
|
99
99
|
|
|
100
100
|
type StyleSeverity = 'error' | 'warning';
|
|
101
101
|
interface StyleFinding {
|
|
@@ -113,14 +113,14 @@ declare const STYLE_CLASSNAME_TAILWIND = "style-classname-tailwind";
|
|
|
113
113
|
declare const STYLE_RESPONSIVE_NO_BASE = "style-responsive-no-base";
|
|
114
114
|
declare const STYLE_UNKNOWN_CSS_PROPERTY = "style-unknown-css-property";
|
|
115
115
|
declare const STYLE_UNKNOWN_TOKEN = "style-unknown-token";
|
|
116
|
-
type AnyRec$
|
|
116
|
+
type AnyRec$2 = Record<string, unknown>;
|
|
117
117
|
/**
|
|
118
118
|
* Validate every page's component tree for SDUI styling correctness (ADR-0065).
|
|
119
119
|
* Returns findings (empty = clean). `error` findings describe styles that are
|
|
120
120
|
* silently dropped and should fail validate/build; `warning` findings are
|
|
121
121
|
* advisory (typos, drift, footguns).
|
|
122
122
|
*/
|
|
123
|
-
declare function validateResponsiveStyles(stack: AnyRec$
|
|
123
|
+
declare function validateResponsiveStyles(stack: AnyRec$2): StyleFinding[];
|
|
124
124
|
|
|
125
125
|
type JsxPageSeverity = 'error' | 'warning';
|
|
126
126
|
interface JsxPageFinding {
|
|
@@ -133,9 +133,60 @@ interface JsxPageFinding {
|
|
|
133
133
|
message: string;
|
|
134
134
|
hint: string;
|
|
135
135
|
}
|
|
136
|
-
type AnyRec = Record<string, unknown>;
|
|
137
|
-
declare function validateJsxPages(stack: AnyRec, opts?: {
|
|
136
|
+
type AnyRec$1 = Record<string, unknown>;
|
|
137
|
+
declare function validateJsxPages(stack: AnyRec$1, opts?: {
|
|
138
138
|
manifest?: Manifest;
|
|
139
139
|
}): JsxPageFinding[];
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Build-time record-title diagnostics (ADR-0079).
|
|
143
|
+
*
|
|
144
|
+
* A record's human title is a structural invariant: every object resolves a
|
|
145
|
+
* primary title from a real STORED field via `nameField` (the canonical
|
|
146
|
+
* pointer; `displayNameField` is the deprecated alias) or a deterministic
|
|
147
|
+
* derivation. Two authoring smells are flagged here so `os build`/`os lint`,
|
|
148
|
+
* the MCP authoring surface, and hand-authoring all get the coverage cloud
|
|
149
|
+
* graph-lint already has (the ADR-0078 "not cloud-only" principle):
|
|
150
|
+
*
|
|
151
|
+
* - `title-format-retired` — the object declares a `titleFormat`. That field
|
|
152
|
+
* is a RENDER-ONLY template the server can neither return nor query; ADR-0079
|
|
153
|
+
* retires it in favour of `nameField`. The schema still parses it (existing
|
|
154
|
+
* metadata keeps loading), so this is advisory, not an error.
|
|
155
|
+
* - `title-unresolvable` — `objectTitleCompleteness` reports `status: 'none'`:
|
|
156
|
+
* no `nameField`/`displayNameField` pointer and no title-eligible field to
|
|
157
|
+
* derive one from. Records will have no meaningful title (the runtime falls
|
|
158
|
+
* back to the auto-provisioned primary / `Record #<id>` floor), so this is a
|
|
159
|
+
* warning, not an error — nothing is fully broken.
|
|
160
|
+
*
|
|
161
|
+
* Both are warnings: the auto-provision transform and the id floor mean a
|
|
162
|
+
* green build never ships a fully title-less object. Reuses the shared spec
|
|
163
|
+
* predicate (`@objectstack/spec/data` → display-name) so cloud and framework
|
|
164
|
+
* classify titles identically.
|
|
165
|
+
*/
|
|
166
|
+
declare const TITLE_FORMAT_RETIRED = "title-format-retired";
|
|
167
|
+
declare const TITLE_UNRESOLVABLE = "title-unresolvable";
|
|
168
|
+
type RecordTitleSeverity = 'error' | 'warning';
|
|
169
|
+
interface RecordTitleFinding {
|
|
170
|
+
/** Always `warning` today — both rules are advisory (see module note). */
|
|
171
|
+
severity: RecordTitleSeverity;
|
|
172
|
+
/** Diagnostic rule id (registry entry), e.g. `title-format-retired`. */
|
|
173
|
+
rule: string;
|
|
174
|
+
/** Human-readable location, e.g. `object "invoice"`. */
|
|
175
|
+
where: string;
|
|
176
|
+
/** Config path, e.g. `objects[3]`. */
|
|
177
|
+
path: string;
|
|
178
|
+
/** What is wrong. */
|
|
179
|
+
message: string;
|
|
180
|
+
/** How to fix it. */
|
|
181
|
+
hint: string;
|
|
182
|
+
}
|
|
183
|
+
type AnyRec = Record<string, unknown>;
|
|
184
|
+
/**
|
|
185
|
+
* Validate every object's record-title declaration. Returns the list of
|
|
186
|
+
* findings (empty = clean). Both rules are advisory (`warning`): the caller
|
|
187
|
+
* must never fail the build on them alone — auto-provision + the `Record #<id>`
|
|
188
|
+
* floor guarantee a resolvable title at runtime.
|
|
189
|
+
*/
|
|
190
|
+
declare function validateRecordTitle(stack: AnyRec): RecordTitleFinding[];
|
|
191
|
+
|
|
192
|
+
export { CHART_CONFIG_MISSING, CHART_FIELD_UNKNOWN, type ExprIssue, type JsxPageFinding, type JsxPageSeverity, MEASURE_AGGREGATE_INCOHERENT, type RecordTitleFinding, type RecordTitleSeverity, STYLE_CLASSNAME_TAILWIND, STYLE_NODE_MISSING_ID, STYLE_RESPONSIVE_NO_BASE, STYLE_UNKNOWN_CSS_PROPERTY, STYLE_UNKNOWN_TOKEN, type StyleFinding, type StyleSeverity, TABLE_COUNT_ONLY, TITLE_FORMAT_RETIRED, TITLE_UNRESOLVABLE, WIDGET_DATASET_UNKNOWN, WIDGET_DIMENSION_UNKNOWN, WIDGET_MEASURE_UNKNOWN, type WidgetBindingFinding, type WidgetBindingSeverity, validateJsxPages, validateRecordTitle, validateResponsiveStyles, validateStackExpressions, validateWidgetBindings };
|
package/dist/index.js
CHANGED
|
@@ -718,6 +718,50 @@ function validateJsxPages(stack, opts = {}) {
|
|
|
718
718
|
}
|
|
719
719
|
return findings;
|
|
720
720
|
}
|
|
721
|
+
|
|
722
|
+
// src/validate-record-title.ts
|
|
723
|
+
import { objectTitleCompleteness } from "@objectstack/spec/data";
|
|
724
|
+
var TITLE_FORMAT_RETIRED = "title-format-retired";
|
|
725
|
+
var TITLE_UNRESOLVABLE = "title-unresolvable";
|
|
726
|
+
function asArray5(v) {
|
|
727
|
+
if (Array.isArray(v)) return v;
|
|
728
|
+
if (v && typeof v === "object") {
|
|
729
|
+
return Object.entries(v).map(([name, def]) => ({ name, ...def }));
|
|
730
|
+
}
|
|
731
|
+
return [];
|
|
732
|
+
}
|
|
733
|
+
function validateRecordTitle(stack) {
|
|
734
|
+
const findings = [];
|
|
735
|
+
const objects = asArray5(stack.objects);
|
|
736
|
+
for (let i = 0; i < objects.length; i++) {
|
|
737
|
+
const obj = objects[i];
|
|
738
|
+
const objName = typeof obj.name === "string" ? obj.name : `(object ${i})`;
|
|
739
|
+
const where = `object "${objName}"`;
|
|
740
|
+
const path = `objects[${i}]`;
|
|
741
|
+
if (obj.titleFormat !== void 0 && obj.titleFormat !== null && obj.titleFormat !== "") {
|
|
742
|
+
findings.push({
|
|
743
|
+
severity: "warning",
|
|
744
|
+
rule: TITLE_FORMAT_RETIRED,
|
|
745
|
+
where,
|
|
746
|
+
path,
|
|
747
|
+
message: `${objName}: titleFormat is retired (ADR-0079) \u2014 migrate to nameField (single field) or a formula field designated nameField`,
|
|
748
|
+
hint: `titleFormat is a render-only template the server cannot return or query, and an explicit nameField now takes precedence. For a single-field title set nameField: '<field>'. For a composite title, add a formula field (returnType: 'text') and designate it via nameField.`
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
const completeness = objectTitleCompleteness(obj);
|
|
752
|
+
if (completeness.status === "none") {
|
|
753
|
+
findings.push({
|
|
754
|
+
severity: "warning",
|
|
755
|
+
rule: TITLE_UNRESOLVABLE,
|
|
756
|
+
where,
|
|
757
|
+
path,
|
|
758
|
+
message: `${objName}: no resolvable record title \u2014 records will have no meaningful name (no nameField and no title-eligible field to derive one)`,
|
|
759
|
+
hint: `Set nameField to a text/email field (or a formula field with returnType: 'text'), or add a text field named "name"/"title". The runtime auto-provisions a primary and falls back to "Record #<id>", but an explicit title is far more useful.`
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return findings;
|
|
764
|
+
}
|
|
721
765
|
export {
|
|
722
766
|
CHART_CONFIG_MISSING,
|
|
723
767
|
CHART_FIELD_UNKNOWN,
|
|
@@ -728,10 +772,13 @@ export {
|
|
|
728
772
|
STYLE_UNKNOWN_CSS_PROPERTY,
|
|
729
773
|
STYLE_UNKNOWN_TOKEN,
|
|
730
774
|
TABLE_COUNT_ONLY,
|
|
775
|
+
TITLE_FORMAT_RETIRED,
|
|
776
|
+
TITLE_UNRESOLVABLE,
|
|
731
777
|
WIDGET_DATASET_UNKNOWN,
|
|
732
778
|
WIDGET_DIMENSION_UNKNOWN,
|
|
733
779
|
WIDGET_MEASURE_UNKNOWN,
|
|
734
780
|
validateJsxPages,
|
|
781
|
+
validateRecordTitle,
|
|
735
782
|
validateResponsiveStyles,
|
|
736
783
|
validateStackExpressions,
|
|
737
784
|
validateWidgetBindings
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/validate-widget-bindings.ts","../src/validate-expressions.ts","../src/validate-responsive-styles.ts","../src/validate-jsx-pages.ts"],"sourcesContent":["// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { isIncoherentAggregate } from '@objectstack/spec/data';\n\n/**\n * Build-time dashboard widget binding diagnostics (issues #1719, #1721).\n *\n * Runs at `objectstack validate`/`compile`/`build` AFTER the stack has been\n * schema-parsed, so every widget's `dataset` reference can be linked to its\n * `defineDataset` and each entry in `dimensions`/`values` resolved to a\n * declared dimension/measure. This is the semantic/cross-reference phase —\n * the rules here cannot run during plain Zod parsing of the raw widget\n * literal (the dataset may even live in another package of the stack).\n *\n * Reference-integrity rules (#1721) — severity `error`, the page is broken:\n *\n * - `widget-dataset-unknown` — `dataset` does not resolve to a declared\n * `Dataset`.\n * - `widget-dimension-unknown` — a `dimensions[]` entry is not a dimension\n * name on the bound dataset.\n * - `widget-measure-unknown` — a `values[]` entry is not a measure name on\n * the bound dataset.\n * - `chart-field-unknown` — a `chartConfig` binding names a field the query\n * result will not contain: `xAxis.field` must be one of the widget's\n * dimensions (or a dataset dimension), and each `yAxis[].field` /\n * `series[].name` must be one of the widget's selected measures\n * (`values`). Post-cutover (ADR-0021) the result rows are keyed by\n * measure NAME (e.g. `sum_amount`), not the base column (`amount`) — a\n * stale base-column reference renders the axis but an empty series.\n *\n * Advisory rules — severity `warning`, build stays green:\n *\n * - `chart-config-missing` — a chart-type widget (bar/line/pie/…) has no\n * `chartConfig`, so the renderer cannot tell which measure to plot.\n * - `table-count-only` (#1719) — a `table`/`pivot` widget whose selected\n * measures are ALL `aggregate: 'count'` and which declares no\n * `dimensions` asks the analytics service for a single summary row. That\n * is the shape a `metric` widget wants — for a table it almost always\n * means the author wanted a per-record listing, which is not an\n * analytics dataset at all (model it as an object-bound ListView,\n * ADR-0017). Evaluated on the WIDGET's binding, not the dataset.\n * - `measure-aggregate-incoherent` — a dataset measure aggregates its field\n * in a way that produces a meaningless number: today, SUM (or\n * `count_distinct`) of a `percent`/rate field, whose total routinely\n * exceeds 100%. Rates must AVG. Checked once per dataset (independent of\n * any widget) when the bound object's field types are known.\n *\n * Warnings can be deliberately suppressed per widget via\n * `suppressWarnings: ['<rule-id>']`; errors cannot — they describe a\n * binding the analytics service cannot satisfy.\n */\n\nexport const WIDGET_DATASET_UNKNOWN = 'widget-dataset-unknown';\nexport const WIDGET_DIMENSION_UNKNOWN = 'widget-dimension-unknown';\nexport const WIDGET_MEASURE_UNKNOWN = 'widget-measure-unknown';\nexport const CHART_FIELD_UNKNOWN = 'chart-field-unknown';\nexport const CHART_CONFIG_MISSING = 'chart-config-missing';\nexport const TABLE_COUNT_ONLY = 'table-count-only';\nexport const MEASURE_AGGREGATE_INCOHERENT = 'measure-aggregate-incoherent';\n\nexport type WidgetBindingSeverity = 'error' | 'warning';\n\nexport interface WidgetBindingFinding {\n /** `error` = unresolvable binding (broken page); `warning` = advisory. */\n severity: WidgetBindingSeverity;\n /** Diagnostic rule id (registry entry), e.g. `widget-measure-unknown`. */\n rule: string;\n /** Human-readable location, e.g. `dashboard \"x\" › widget \"y\"`. */\n where: string;\n /** Config path, e.g. `dashboards[0].widgets[3]`. */\n path: string;\n /** What is wrong. */\n message: string;\n /** How to fix (or deliberately suppress) it. */\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce a collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\nfunction asStrings(v: unknown): string[] {\n return Array.isArray(v) ? v.filter((s): s is string => typeof s === 'string') : [];\n}\n\n/**\n * Chart families whose renderer needs a `chartConfig` measure mapping.\n * Single-value types (metric/kpi/gauge/…) plot their lone value and tabular\n * types (table/pivot) render every column, so they are exempt.\n */\nconst CHART_TYPES = new Set([\n 'bar', 'horizontal-bar', 'column',\n 'line', 'area',\n 'pie', 'donut', 'funnel',\n 'scatter', 'treemap', 'sankey', 'radar',\n]);\n\nfunction levenshtein(a: string, b: string): number {\n const m = a.length, n = b.length;\n let prev = Array.from({ length: n + 1 }, (_, j) => j);\n for (let i = 1; i <= m; i++) {\n const cur = [i];\n for (let j = 1; j <= n; j++) {\n cur[j] = Math.min(\n prev[j] + 1,\n cur[j - 1] + 1,\n prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),\n );\n }\n prev = cur;\n }\n return prev[n];\n}\n\n/**\n * Nearest declared name for a typo'd/stale reference, or undefined when\n * nothing is close. Containment is checked first because the cutover's\n * canonical drift is base column → prefixed measure name (`amount` →\n * `sum_amount`), which is far in edit distance but obvious to a human.\n */\nfunction didYouMean(input: string, candidates: Iterable<string>): string | undefined {\n let best: string | undefined;\n let bestScore = Infinity;\n for (const c of candidates) {\n let score: number;\n if (input.length >= 3 && (c.includes(input) || input.includes(c))) {\n score = Math.abs(c.length - input.length);\n } else {\n const d = levenshtein(input, c);\n if (d > Math.max(2, Math.floor(input.length / 3))) continue;\n score = 100 + d;\n }\n if (score < bestScore) { bestScore = score; best = c; }\n }\n return best;\n}\n\nfunction suggest(input: string, candidates: Iterable<string>): string {\n const s = didYouMean(input, candidates);\n return s ? ` Did you mean \"${s}\"?` : '';\n}\n\nfunction list(names: Iterable<string>): string {\n const arr = [...names];\n return arr.length > 0 ? arr.join(', ') : '(none)';\n}\n\n/**\n * Validate every dashboard widget's dataset binding. Returns the list of\n * findings (empty = clean). Caller decides how to surface them: `error`\n * findings describe bindings the analytics service cannot satisfy and\n * should fail validate/build; `warning` findings are advisory and must\n * never fail the build on their own.\n */\nexport function validateWidgetBindings(stack: AnyRec): WidgetBindingFinding[] {\n const findings: WidgetBindingFinding[] = [];\n\n const datasets = new Map<string, AnyRec>();\n for (const ds of asArray(stack.datasets)) {\n if (typeof ds.name === 'string') datasets.set(ds.name, ds);\n }\n\n // ── (0) dataset measures aggregate their field coherently ──\n // A measure that SUMs a percentage/rate field produces a meaningless total\n // (it can exceed 100%); rates must AVG. This is a dataset-level defect (it\n // does not depend on any widget), so it is checked once over every dataset\n // whose object's field types are known. Advisory — the page still renders.\n const objectFieldTypes = new Map<string, Map<string, string>>();\n for (const o of asArray(stack.objects)) {\n if (typeof o.name !== 'string') continue;\n const fm = new Map<string, string>();\n for (const f of asArray(o.fields)) {\n if (typeof f.name === 'string' && typeof f.type === 'string') fm.set(f.name, f.type);\n }\n objectFieldTypes.set(o.name, fm);\n }\n const datasetList = asArray(stack.datasets);\n for (let i = 0; i < datasetList.length; i++) {\n const ds = datasetList[i];\n const fieldTypes = typeof ds.object === 'string' ? objectFieldTypes.get(ds.object) : undefined;\n if (!fieldTypes) continue; // cannot judge without the object's field types\n const dsMeasures = asArray(ds.measures);\n for (let k = 0; k < dsMeasures.length; k++) {\n const m = dsMeasures[k];\n const field = typeof m.field === 'string' ? m.field : undefined;\n const aggregate = typeof m.aggregate === 'string' ? m.aggregate : undefined;\n if (!field || !aggregate) continue; // count(*) and underivable measures are fine\n const ftype = fieldTypes.get(field);\n if (ftype && isIncoherentAggregate(aggregate, ftype)) {\n findings.push({\n severity: 'warning',\n rule: MEASURE_AGGREGATE_INCOHERENT,\n where: `dataset \"${typeof ds.name === 'string' ? ds.name : `(dataset ${i})`}\" › measure \"${typeof m.name === 'string' ? m.name : `(measure ${k})`}\"`,\n path: `datasets[${i}].measures[${k}]`,\n message:\n `measure \"${m.name}\" applies ${aggregate} to ${ftype} field \"${field}\" — ` +\n `summed percentages are meaningless (they can exceed 100%).`,\n hint:\n `Use aggregate \"avg\" for percentage/rate fields (or \"count\" of records). ` +\n `If a running total is genuinely intended, suppress with: ` +\n `suppressWarnings: ['${MEASURE_AGGREGATE_INCOHERENT}'] on the measure.`,\n });\n }\n }\n }\n\n const dashboards = asArray(stack.dashboards);\n for (let i = 0; i < dashboards.length; i++) {\n const dash = dashboards[i];\n const dashName = typeof dash.name === 'string' ? dash.name : `(dashboard ${i})`;\n const widgets = Array.isArray(dash.widgets) ? (dash.widgets as AnyRec[]) : [];\n\n for (let j = 0; j < widgets.length; j++) {\n const w = widgets[j];\n const widgetId = typeof w.id === 'string' ? w.id : `(widget ${j})`;\n const where = `dashboard \"${dashName}\" › widget \"${widgetId}\"`;\n const path = `dashboards[${i}].widgets[${j}]`;\n const suppressed = (rule: string): boolean =>\n Array.isArray(w.suppressWarnings) && w.suppressWarnings.includes(rule);\n const push = (f: Omit<WidgetBindingFinding, 'where' | 'path'>): void => {\n if (f.severity === 'warning' && suppressed(f.rule)) return;\n findings.push({ ...f, where, path });\n };\n\n // ── (a) dataset reference resolves ──\n const dsName = typeof w.dataset === 'string' ? w.dataset : undefined;\n const dataset = dsName ? datasets.get(dsName) : undefined;\n if (dsName && !dataset) {\n push({\n severity: 'error',\n rule: WIDGET_DATASET_UNKNOWN,\n message: `dataset \"${dsName}\" does not resolve to a declared dataset.`,\n hint:\n `Declared datasets: ${list(datasets.keys())}.${suggest(dsName, datasets.keys())} ` +\n `Define the dataset with defineDataset() or fix the reference (ADR-0021).`,\n });\n }\n // Without a resolved dataset there is nothing to check names against.\n if (!dataset) continue;\n\n const dimensionNames = new Set<string>();\n for (const d of asArray(dataset.dimensions)) {\n if (typeof d.name === 'string') dimensionNames.add(d.name);\n }\n const measures = new Map<string, AnyRec>();\n for (const m of asArray(dataset.measures)) {\n if (typeof m.name === 'string') measures.set(m.name, m);\n }\n\n // ── (b) every dimensions[] entry is a dataset dimension ──\n const dims = asStrings(w.dimensions);\n for (let k = 0; k < dims.length; k++) {\n if (dimensionNames.has(dims[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_DIMENSION_UNKNOWN,\n message:\n `dimensions[${k}] \"${dims[k]}\" is not a dimension of dataset ` +\n `\"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint:\n `Widgets select dataset dimensions BY NAME.${suggest(dims[k], dimensionNames)} ` +\n `Add the dimension to the dataset or fix the reference.`,\n });\n }\n\n // ── (c) every values[] entry is a dataset measure ──\n const values = asStrings(w.values);\n for (let k = 0; k < values.length; k++) {\n if (measures.has(values[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_MEASURE_UNKNOWN,\n message:\n `values[${k}] \"${values[k]}\" is not a measure of dataset ` +\n `\"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint:\n `Widgets select dataset measures BY NAME, not by base column.` +\n `${suggest(values[k], measures.keys())} ` +\n `Add the measure to the dataset or fix the reference.`,\n });\n }\n\n // ── (d) chartConfig bindings resolve against the widget's selection ──\n const chartConfig = (w.chartConfig && typeof w.chartConfig === 'object')\n ? (w.chartConfig as AnyRec)\n : undefined;\n const isChartType = typeof w.type === 'string' && CHART_TYPES.has(w.type);\n\n if (chartConfig) {\n // The query result carries the widget's selected dimensions and\n // measures; resolve every chartConfig field against that shape.\n const selectedValues = new Set(values.filter((v) => measures.has(v)));\n\n const xAxis = (chartConfig.xAxis && typeof chartConfig.xAxis === 'object')\n ? (chartConfig.xAxis as AnyRec)\n : undefined;\n // A field naming an entry of the widget's own (already-validated)\n // selection is not re-reported here — rules (b)/(c) own that error.\n if (xAxis && typeof xAxis.field === 'string'\n && !dimensionNames.has(xAxis.field) && !dims.includes(xAxis.field)) {\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message:\n `chartConfig.xAxis.field \"${xAxis.field}\" does not resolve to a ` +\n `dimension of dataset \"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint: `Point xAxis.field at a dataset dimension name.${suggest(xAxis.field, dimensionNames)}`,\n });\n }\n\n const measureField = (label: string, field: string): void => {\n if (values.includes(field)) return; // resolvable, or already errored via rule (c)\n const declaredButUnselected = measures.has(field);\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message: declaredButUnselected\n ? `chartConfig.${label} \"${field}\" is a measure of dataset \"${dsName}\" ` +\n `but is not selected in the widget's values (${list(values)}), so the ` +\n `query result will not contain it.`\n : `chartConfig.${label} \"${field}\" does not resolve to a measure of ` +\n `dataset \"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint: declaredButUnselected\n ? `Add \"${field}\" to the widget's values, or bind the chart to a selected measure.`\n : `Post-cutover data is keyed by the dataset's measure NAME, not the ` +\n `base column.${suggest(field, selectedValues.size > 0 ? selectedValues : measures.keys())}`,\n });\n };\n\n const yAxes = Array.isArray(chartConfig.yAxis) ? (chartConfig.yAxis as AnyRec[]) : [];\n for (let k = 0; k < yAxes.length; k++) {\n const field = yAxes[k]?.field;\n if (typeof field === 'string') measureField(`yAxis[${k}].field`, field);\n }\n const series = Array.isArray(chartConfig.series) ? (chartConfig.series as AnyRec[]) : [];\n for (let k = 0; k < series.length; k++) {\n const name = series[k]?.name;\n if (typeof name === 'string') measureField(`series[${k}].name`, name);\n }\n } else if (isChartType) {\n push({\n severity: 'warning',\n rule: CHART_CONFIG_MISSING,\n message:\n `chart-type widget ('${w.type}') has no chartConfig — the renderer ` +\n `cannot determine which measure to plot, so the series renders empty.`,\n hint:\n `Add chartConfig with xAxis.field set to a dimension (${list(dims)}) and ` +\n `yAxis[].field set to a measure name (${list(values)}). If the default ` +\n `rendering is intentional, suppress with: suppressWarnings: ['${CHART_CONFIG_MISSING}']`,\n });\n }\n\n // ── (e) table/pivot bound to a count-only, dimensionless selection ──\n if (w.type !== 'table' && w.type !== 'pivot') continue;\n // Grouped by at least one dimension → genuinely aggregated rows.\n if (dims.length > 0) continue;\n if (values.length === 0) continue;\n const resolved = values.map((v) => measures.get(v));\n // An unresolvable measure name already errored above — don't guess here.\n if (resolved.some((m) => !m)) continue;\n\n // Derived measures combine other measures; treat them as non-count even\n // when their (ignored) `aggregate` says otherwise.\n const countOnly = resolved.every((m) => m!.aggregate === 'count' && !m!.derived);\n if (!countOnly) continue;\n\n push({\n severity: 'warning',\n rule: TABLE_COUNT_ONLY,\n message:\n `a '${w.type}' widget bound to dataset \"${dsName}\" selects only count ` +\n `measure(s) (${values.join(', ')}) and no dimensions, so it renders a ` +\n `single summary row — not a per-record list.`,\n hint:\n `A flat record listing is not an analytics dataset. Model it as an ` +\n `object-bound ListView (ADR-0017) surfaced through app navigation, and ` +\n `use a 'metric' widget here if you only need the count. If a single-row ` +\n `table is intentional, add an explicit dimension or suppress with: ` +\n `suppressWarnings: ['${TABLE_COUNT_ONLY}']`,\n });\n }\n }\n\n return findings;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Build-time expression validation (ADR-0032 §Decision 1a + 1b).\n *\n * Runs at `objectstack compile`, where the whole normalized stack is in hand —\n * so flow conditions can be checked against the *resolved* object schema\n * (field existence) in addition to CEL syntax. Uses the one shared validator\n * from `@objectstack/formula`, so the verdict matches `registerFlow` and the\n * agent `validate_expression` tool exactly.\n *\n * Scope (v1): flow predicates (start/decision `config.condition` + edge\n * `condition`), object validation-rule / formula predicates, and UI action\n * `visible` / `disabled` predicates. Each error is located (flow/object/action\n * + node/edge/field) with a corrective message.\n */\n\nimport { validateExpression } from '@objectstack/formula';\n\nexport interface ExprIssue {\n where: string;\n message: string;\n source: string;\n /**\n * `error` fails the build (e.g. a bare ref in a record-scoped formula). `warning`\n * is advisory and never fails it (e.g. a possible field typo in a flattened flow\n * condition, which might be a flow variable). Absent ⇒ treat as `error`.\n */\n severity?: 'error' | 'warning';\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce an `objects` collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** object name → set of its field names, for schema-aware field checks. */\nfunction buildFieldIndex(objects: AnyRec[]): Map<string, string[]> {\n const idx = new Map<string, string[]>();\n for (const obj of objects) {\n const name = typeof obj.name === 'string' ? obj.name : undefined;\n if (!name) continue;\n const fields = obj.fields;\n let names: string[] = [];\n if (Array.isArray(fields)) names = fields.map(f => (f as AnyRec).name).filter((n): n is string => typeof n === 'string');\n else if (fields && typeof fields === 'object') names = Object.keys(fields as AnyRec);\n idx.set(name, names);\n }\n return idx;\n}\n\n/**\n * Validate every predicate in the stack. Returns the list of issues (empty =\n * clean). Caller decides how to surface / whether to fail the build.\n */\nexport function validateStackExpressions(stack: AnyRec): ExprIssue[] {\n const issues: ExprIssue[] = [];\n const objects = asArray(stack.objects);\n const fieldIndex = buildFieldIndex(objects);\n\n const check = (\n where: string,\n raw: unknown,\n objectName?: string,\n scope: 'record' | 'flattened' = 'flattened',\n ): void => {\n if (raw == null) return;\n const fields = objectName ? fieldIndex.get(objectName) : undefined;\n const res = validateExpression('predicate', raw as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields, scope } : { scope });\n for (const e of res.errors) issues.push({ where, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where, message: w.message, source: w.source, severity: 'warning' });\n };\n\n // ── Flows ──────────────────────────────────────────────────────────\n for (const flow of asArray(stack.flows)) {\n const flowName = typeof flow.name === 'string' ? flow.name : '(unnamed flow)';\n const nodes = Array.isArray(flow.nodes) ? (flow.nodes as AnyRec[]) : [];\n const edges = Array.isArray(flow.edges) ? (flow.edges as AnyRec[]) : [];\n // The record-change target object — `record.*` refs resolve against it.\n const startNode = nodes.find(n => n.type === 'start');\n const startCfg = (startNode?.config ?? {}) as AnyRec;\n const objectName = typeof startCfg.objectName === 'string' ? startCfg.objectName : undefined;\n\n for (const node of nodes) {\n const cfg = (node.config ?? {}) as AnyRec;\n check(`flow '${flowName}' · node '${node.id}' (${node.type}) condition`, cfg.condition, objectName);\n // #1870 — a `script` node must declare a callable target (`actionType` or\n // `function`). A node with neither is a silent no-op that otherwise passes\n // build. (Function *existence* isn't checkable here — functions are code,\n // not serialized into the artifact — so this is a structural check; the\n // runtime verifies the named function is actually registered.)\n if (node.type === 'script') {\n // `function` is canonical; `functionName` is an accepted alias.\n const fn =\n (typeof cfg.function === 'string' ? cfg.function.trim() : '') ||\n (typeof cfg.functionName === 'string' ? cfg.functionName.trim() : '');\n const action = typeof cfg.actionType === 'string' ? cfg.actionType.trim() : '';\n // Inline `config.script` (a JS body) is also a declared form — the\n // built-in runtime doesn't execute it (warned at run time), but the node\n // is not the empty no-op this check targets, so don't flag it.\n const inline = typeof cfg.script === 'string' ? cfg.script.trim() : '';\n if (!fn && !action && !inline) {\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node declares neither \\`actionType\\` nor \\`function\\` — it would do nothing at runtime. ` +\n `Name a built-in action (e.g. \\`actionType: 'email'\\`) or a registered function ` +\n `(\\`function: 'my_fn'\\`, registered via \\`defineStack({ functions })\\`).`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n } else if (action === 'invoke_function' && !fn) {\n // `actionType: 'invoke_function'` is a marker that names no callable on\n // its own — the function name must be in `function`/`functionName`.\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node uses \\`actionType: 'invoke_function'\\` but no \\`function\\` (or \\`functionName\\`) — ` +\n `it names no callable. Set \\`function: 'my_fn'\\` and register it via \\`defineStack({ functions })\\`.`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n }\n }\n }\n for (const edge of edges) {\n check(`flow '${flowName}' · edge '${edge.id}' (${edge.source}→${edge.target}) condition`, edge.condition, objectName);\n }\n }\n\n // ── Object validation-rule + formula predicates ────────────────────\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n const validations = obj.validations ?? obj.validationRules;\n for (const rule of asArray(validations)) {\n const where = `object '${objectName}' · validation '${(rule.name as string) ?? '?'}'`;\n // Common predicate keys across rule shapes. Validation predicates are\n // `record`-scoped — no field flattening — so bare refs are flagged (#1928).\n check(where, rule.expression ?? rule.predicate ?? rule.condition ?? rule.formula, objectName, 'record');\n // `conditional` rules carry a nested `when` predicate (record-scoped).\n check(`${where} when`, (rule as AnyRec).when, objectName, 'record');\n }\n // Field-level formulas (computed fields) reference the same object.\n const fields = obj.fields;\n const fieldList = Array.isArray(fields)\n ? (fields as AnyRec[])\n : (fields && typeof fields === 'object' ? Object.values(fields as AnyRec) as AnyRec[] : []);\n\n // ── ADR-0062 D7 — reject `field.columnName` on external objects ──────\n // `field.columnName` (localField → physicalColumn) is the managed-object\n // mechanism; it is NOT applied by the driver's query pipeline for federated\n // objects, where `external.columnMap` (remoteColumn → localField) is the\n // authoritative — and inverse — mapping. Allowing both would be a silent\n // dual-source ambiguity, so reject `columnName` on any object that declares\n // an `external` binding (a federated object). Managed objects are untouched.\n if (obj.external != null) {\n const fieldEntries: Array<[string, AnyRec]> = Array.isArray(fields)\n ? (fields as AnyRec[]).map((f) => [((f as AnyRec)?.name as string) ?? '?', f as AnyRec])\n : (fields && typeof fields === 'object'\n ? (Object.entries(fields as AnyRec) as Array<[string, AnyRec]>)\n : []);\n for (const [fname, fdef] of fieldEntries) {\n if (fdef && typeof fdef === 'object' && (fdef as AnyRec).columnName != null) {\n issues.push({\n where: `object '${objectName}' · field '${fname}'`,\n message:\n `external object '${objectName}': field '${fname}' sets columnName='${String((fdef as AnyRec).columnName)}', ` +\n `which is not supported on federated objects (ADR-0062 D7). The driver's query pipeline ignores ` +\n `field.columnName for external objects; map remote columns via the datasource's external.columnMap instead.`,\n source: `columnName='${String((fdef as AnyRec).columnName)}'`,\n severity: 'error',\n });\n }\n }\n }\n\n for (const f of fieldList) {\n // Field-level conditional rules are server-enforced (rule-validator) and\n // record-scoped — a bare ref silently fails the rule (required/readonly\n // not enforced = data-integrity hole). #1928 class, same as actions.\n if (f && typeof f === 'object') {\n const fname = (f.name as string) ?? '?';\n for (const key of ['requiredWhen', 'readonlyWhen', 'conditionalRequired', 'visibleWhen'] as const) {\n check(`object '${objectName}' · field '${fname}' ${key}`, (f as AnyRec)[key], objectName, 'record');\n }\n }\n if (f && typeof f === 'object' && f.formula) {\n // formulas are `value` role (any return type), still CEL. They are\n // `record`-scoped — `record.<field>`, never bare — so flag bare refs (#1928).\n const res = validateExpression('value', f.formula as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields: fieldIndex.get(objectName), scope: 'record' } : { scope: 'record' });\n const fieldWhere = `object '${objectName}' · field '${(f.name as string) ?? '?'}' formula`;\n for (const e of res.errors) issues.push({ where: fieldWhere, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where: fieldWhere, message: w.message, source: w.source, severity: 'warning' });\n }\n }\n }\n\n // ── Action `visible` / `disabled` predicates ───────────────────────\n // Record-scoped, same as validation rules: a record-header / row action's\n // `visible` is evaluated by ActionEngine against `{ record, recordId,\n // objectName, user, … }` with fail-closed semantics, so a BARE field ref\n // (`done` instead of `record.done`) throws and the action is silently hidden\n // on every record (the trap behind the #2183 \"Mark Done never hides\" hunt).\n // Flagging it here turns that into a build error with a corrective message.\n // `disabled` may be a boolean (skip) or a predicate (check).\n const seenActions = new Set<string>();\n const checkAction = (where: string, action: AnyRec, objectName?: string): void => {\n const obj = objectName\n ?? (typeof action.objectName === 'string' ? action.objectName : undefined)\n ?? (typeof action.object === 'string' ? action.object : undefined);\n const name = typeof action.name === 'string' ? action.name : '?';\n const key = `${obj ?? ''}:${name}`;\n if (seenActions.has(key)) return; // de-dup (actions are merged onto objects AND kept top-level)\n seenActions.add(key);\n check(`${where} · action '${name}' visible`, action.visible, obj, 'record');\n if (typeof action.disabled !== 'boolean') {\n check(`${where} · action '${name}' disabled`, action.disabled, obj, 'record');\n }\n };\n for (const action of asArray(stack.actions)) {\n checkAction('stack', action);\n }\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n for (const action of asArray(obj.actions)) {\n checkAction(`object '${objectName}'`, action, objectName);\n }\n }\n\n // ── Sharing-rule predicates (security-critical, record-scoped) ─────\n // A criteria sharing rule's `condition` decides which rows a principal sees.\n // It is evaluated against the record, so a bare ref silently changes access.\n for (const rule of asArray(stack.sharingRules)) {\n const ruleObj = typeof rule.object === 'string' ? rule.object : undefined;\n const where = `sharingRule '${(rule.name as string) ?? '?'}'${ruleObj ? ` (${ruleObj})` : ''} condition`;\n check(where, rule.condition ?? rule.criteria ?? rule.predicate, ruleObj, 'record');\n }\n\n // ── Hook `condition` predicates (record-scoped gate) ───────────────\n // A lifecycle hook's `condition` skips the handler when false; it is\n // evaluated against the record, so a bare ref silently makes the hook\n // run on every record (or never) instead of the intended subset.\n for (const hook of asArray(stack.hooks)) {\n const hookObj = typeof hook.object === 'string' ? hook.object : undefined; // array targets → no single field set\n check(`hook '${(hook.name as string) ?? '?'}'${hookObj ? ` (${hookObj})` : ''} condition`, hook.condition, hookObj, 'record');\n }\n\n return issues;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for the SDUI scoped-styling model (ADR-0065).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019): the same bar holds for\n// hand-authored and AI-generated pages, run from `os validate`/`compile` and\n// reusable by AI authoring. It catches the deterministic ways a `responsiveStyles`\n// block silently fails or drifts — the class of mistake an AI author is most\n// likely to make — *before* render, with actionable hints it can self-correct on.\n//\n// What it does NOT catch: whether the result looks good. Visual/semantic quality\n// (contrast, balance, \"is it ugly\") is only catchable by rendering + a VLM gate,\n// which is a separate, render-time concern (ADR-0065 §Decision-5).\n\nexport type StyleSeverity = 'error' | 'warning';\n\nexport interface StyleFinding {\n severity: StyleSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"pricing\" › node \"plan_solo\"`. */\n where: string;\n /** Config path, e.g. `pages[0].regions[0].components[1]`. */\n path: string;\n message: string;\n hint: string;\n}\n\n// Rule ids (registry entries).\nexport const STYLE_NODE_MISSING_ID = 'style-node-missing-id';\nexport const STYLE_CLASSNAME_TAILWIND = 'style-classname-tailwind';\nexport const STYLE_RESPONSIVE_NO_BASE = 'style-responsive-no-base';\nexport const STYLE_UNKNOWN_CSS_PROPERTY = 'style-unknown-css-property';\nexport const STYLE_UNKNOWN_TOKEN = 'style-unknown-token';\n\ntype AnyRec = Record<string, unknown>;\n\nconst BREAKPOINTS = ['large', 'medium', 'small', 'xsmall'] as const;\n\n/** SDUI design-token palette (ADR-0065) + base theme tokens, referenced as\n * `var(--name)`. Authors should resolve values against these. Kept in sync with\n * `apps/console/src/index.css` / `@object-ui/components` `:root`. */\nconst KNOWN_TOKENS = new Set<string>([\n // SDUI tokens\n 'space-1', 'space-2', 'space-3', 'space-4', 'space-5', 'space-6', 'space-8', 'space-10', 'space-12',\n 'radius', 'radius-sm', 'radius-md', 'radius-lg', 'radius-xl',\n 'shadow-sm', 'shadow-md', 'shadow-lg',\n 'surface', 'surface-sunken', 'text-strong', 'text-muted', 'brand', 'brand-foreground', 'hairline',\n // Base theme tokens (shadcn) — usually wrapped as hsl(var(--x)).\n 'background', 'foreground', 'card', 'card-foreground', 'popover', 'popover-foreground',\n 'primary', 'primary-foreground', 'secondary', 'secondary-foreground',\n 'muted', 'muted-foreground', 'accent', 'accent-foreground',\n 'destructive', 'destructive-foreground', 'border', 'input', 'ring',\n 'success', 'success-foreground', 'warning', 'warning-foreground',\n 'chart-1', 'chart-2', 'chart-3', 'chart-4', 'chart-5',\n]);\n\n/** Common CSS properties (camelCase) an SDUI block realistically sets. Generous\n * on purpose: an unknown property is only a *warning* (typo catcher), never a\n * blocker. Custom properties (`--x`) are always allowed. */\nconst KNOWN_CSS_PROPERTIES = new Set<string>([\n 'display', 'position', 'top', 'right', 'bottom', 'left', 'inset', 'zIndex', 'overflow', 'overflowX', 'overflowY', 'visibility', 'boxSizing', 'float', 'clear',\n 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'aspectRatio',\n 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginInline', 'marginBlock',\n 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingInline', 'paddingBlock',\n 'flex', 'flexDirection', 'flexWrap', 'flexGrow', 'flexShrink', 'flexBasis', 'alignItems', 'alignContent', 'alignSelf', 'justifyContent', 'justifyItems', 'justifySelf', 'gap', 'rowGap', 'columnGap', 'order', 'placeItems', 'placeContent',\n 'grid', 'gridTemplate', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridColumn', 'gridRow', 'gridArea', 'gridAutoFlow', 'gridAutoColumns', 'gridAutoRows',\n 'color', 'backgroundColor', 'background', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat', 'backgroundClip', 'opacity', 'mixBlendMode',\n 'fontSize', 'fontWeight', 'fontFamily', 'fontStyle', 'lineHeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'textOverflow', 'whiteSpace', 'wordBreak', 'overflowWrap', 'fontVariantNumeric', 'verticalAlign', 'textShadow',\n 'border', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'borderColor', 'borderWidth', 'borderStyle', 'borderRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'outline', 'outlineOffset',\n 'boxShadow', 'transform', 'transformOrigin', 'transition', 'transitionProperty', 'transitionDuration', 'transitionTimingFunction', 'transitionDelay', 'animation', 'filter', 'backdropFilter', 'willChange',\n 'cursor', 'pointerEvents', 'userSelect', 'objectFit', 'objectPosition', 'content',\n]);\n\nconst VAR_RE = /var\\(\\s*--([a-zA-Z0-9-]+)\\s*[,)]/g;\n\n// High-precision Tailwind-utility detection. A `className` in page metadata is\n// \"Tailwind-looking\" if any token is a responsive/state variant, an arbitrary\n// `[…]` value, a known utility stem followed by a Tailwind *value* (number /\n// fraction / size keyword), or a bare layout utility. Tuned to NOT trip on\n// ordinary custom class names (e.g. `my-custom-scope`, `os-s-plan_solo`).\nconst TW_VARIANT = /^(sm|md|lg|xl|2xl|hover|focus|active|disabled|dark|group-hover|peer-[a-z]+|first|last|odd|even):/;\nconst TW_STEM_VALUE = /^-?(p|m|px|py|pt|pb|pl|pr|mx|my|mt|mb|ml|mr|gap|gap-x|gap-y|space-x|space-y|w|h|min-w|max-w|min-h|max-h|size|text|leading|tracking|bg|border|rounded|shadow|ring|opacity|inset|top|bottom|left|right|z|order|col|row|grid-cols|grid-rows|basis)-(\\d+(\\.\\d+)?|\\d+\\/\\d+|px|full|auto|none|screen|min|max|fit|xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl)$/;\nconst TW_BARE = /^(flex|grid|block|inline|inline-block|inline-flex|hidden|contents|table|flow-root|grow|shrink|truncate|italic|underline|uppercase|lowercase|capitalize|antialiased|absolute|relative|fixed|sticky|static|isolate|flex-col|flex-row|flex-wrap|flex-nowrap|items-center|items-start|items-end|items-stretch|justify-center|justify-between|justify-around|justify-start|justify-end|text-center|text-left|text-right|font-bold|font-semibold|font-medium|font-normal|tabular-nums)$/;\n\nfunction looksLikeTailwind(className: string): boolean {\n return className.split(/\\s+/).some((tok) => {\n if (!tok) return false;\n if (TW_VARIANT.test(tok)) return true;\n if (/\\[[^\\]]+\\]/.test(tok)) return true; // arbitrary value, e.g. p-[13px]\n if (TW_STEM_VALUE.test(tok)) return true;\n if (TW_BARE.test(tok)) return true;\n return false;\n });\n}\n\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** Child nodes can hang off `children`, `properties.children`, `body`, or\n * `properties.body` depending on block type — collect them all. */\nfunction childrenOf(node: AnyRec): AnyRec[] {\n const props = (node.properties as AnyRec) ?? {};\n const out: AnyRec[] = [];\n for (const c of [node.children, props.children, node.body, props.body]) {\n if (Array.isArray(c)) out.push(...(c.filter((x) => x && typeof x === 'object') as AnyRec[]));\n }\n return out;\n}\n\nfunction checkNode(node: AnyRec, pageName: string, path: string, findings: StyleFinding[]): void {\n const id = typeof node.id === 'string' ? node.id : undefined;\n const type = typeof node.type === 'string' ? node.type : 'node';\n const where = `page \"${pageName}\" › ${id ? `node \"${id}\"` : `<${type}>`}`;\n const rs = node.responsiveStyles as AnyRec | undefined;\n const hasRs = !!rs && typeof rs === 'object' && BREAKPOINTS.some((b) => rs[b]);\n\n // (1) responsiveStyles needs an id to scope to — else the CSS is dropped.\n if (hasRs && !id) {\n findings.push({\n severity: 'error', rule: STYLE_NODE_MISSING_ID, where, path,\n message: `Node has responsiveStyles but no \\`id\\`; scoped CSS cannot be generated and the styles are silently dropped.`,\n hint: `Add a stable \\`id\\` to this node.`,\n });\n }\n\n // (2) responsive breakpoint without a `large` base → unstyled at desktop.\n if (hasRs && !rs!.large && BREAKPOINTS.slice(1).some((b) => rs![b])) {\n findings.push({\n severity: 'warning', rule: STYLE_RESPONSIVE_NO_BASE, where, path,\n message: `responsiveStyles sets a smaller breakpoint but no \\`large\\` base; the node is unstyled at desktop width.`,\n hint: `Put the unconditional/base styles under \\`responsiveStyles.large\\` (desktop-first).`,\n });\n }\n\n // (3) className that looks like Tailwind → won't render from metadata.\n if (typeof node.className === 'string' && node.className.trim() && looksLikeTailwind(node.className)) {\n findings.push({\n severity: 'warning', rule: STYLE_CLASSNAME_TAILWIND, where, path,\n message: `\\`className\\` contains Tailwind-looking utilities (\"${node.className.trim().slice(0, 60)}\"); these are not compiled from metadata and will silently do nothing.`,\n hint: `Style this node with \\`responsiveStyles\\` + design tokens instead of \\`className\\` (ADR-0065).`,\n });\n }\n\n // (4)+(5) unknown CSS property / unknown token inside each breakpoint map.\n if (rs && typeof rs === 'object') {\n for (const bp of BREAKPOINTS) {\n const map = rs[bp] as AnyRec | undefined;\n if (!map || typeof map !== 'object') continue;\n for (const [prop, value] of Object.entries(map)) {\n if (!prop.startsWith('--') && !KNOWN_CSS_PROPERTIES.has(prop)) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_CSS_PROPERTY, where, path: `${path}.responsiveStyles.${bp}`,\n message: `Unknown CSS property \"${prop}\" (typo?); if unintended it will not apply.`,\n hint: `Use a camelCase CSS property name (e.g. \\`flexDirection\\`, \\`backgroundColor\\`).`,\n });\n }\n if (typeof value === 'string') {\n let m: RegExpExecArray | null;\n VAR_RE.lastIndex = 0;\n while ((m = VAR_RE.exec(value))) {\n const token = m[1];\n if (!KNOWN_TOKENS.has(token) && !token.startsWith('tw-')) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_TOKEN, where, path: `${path}.responsiveStyles.${bp}.${prop}`,\n message: `References unknown design token \\`var(--${token})\\` (typo?); it will not resolve.`,\n hint: `Use a token from the ADR-0065 palette (e.g. \\`var(--space-6)\\`, \\`var(--surface)\\`, \\`hsl(var(--primary))\\`).`,\n });\n }\n }\n }\n }\n }\n }\n\n // Recurse.\n const kids = childrenOf(node);\n for (let i = 0; i < kids.length; i++) {\n checkNode(kids[i], pageName, `${path}.children[${i}]`, findings);\n }\n}\n\n/**\n * Validate every page's component tree for SDUI styling correctness (ADR-0065).\n * Returns findings (empty = clean). `error` findings describe styles that are\n * silently dropped and should fail validate/build; `warning` findings are\n * advisory (typos, drift, footguns).\n */\nexport function validateResponsiveStyles(stack: AnyRec): StyleFinding[] {\n const findings: StyleFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n const pageName = typeof page.name === 'string' ? page.name : `pages[${p}]`;\n const regions = asArray(page.regions);\n for (let r = 0; r < regions.length; r++) {\n const components = asArray(regions[r].components);\n for (let c = 0; c < components.length; c++) {\n checkNode(components[c], pageName, `pages[${p}].regions[${r}].components[${c}]`, findings);\n }\n }\n }\n return findings;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for AI-authored JSX-source pages (ADR-0080).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019), run from `os validate` / `os\n// build`. A `kind:'jsx'` page's `source` is a constrained JSX/Tailwind string\n// compiled (parsed, never executed) to the SDUI tree at save time. This gate\n// parses it at author time so malformed source fails loudly (ADR-0078) instead\n// of being stored and breaking only at render.\n//\n// Scope: parse-level — syntax, tag matching, and forbidden constructs (event\n// handlers, dangerouslySetInnerHTML). Full component/prop whitelist validation\n// needs the registry manifest (a cross-repo artifact); when that is wired,\n// thread it through `compile()` here. Until then this catches the structural\n// class of error an AI author is most likely to emit.\n\nimport { parseJsx, compile, type Manifest } from '@objectstack/sdui-parser';\n\nexport type JsxPageSeverity = 'error' | 'warning';\n\nexport interface JsxPageFinding {\n severity: JsxPageSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"command_center\" › <flex>`. */\n where: string;\n /** Config path, e.g. `pages[3].source`. */\n path: string;\n message: string;\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\nconst asArray = (v: unknown): AnyRec[] => (Array.isArray(v) ? (v as AnyRec[]) : []);\n\nexport function validateJsxPages(stack: AnyRec, opts: { manifest?: Manifest } = {}): JsxPageFinding[] {\n const findings: JsxPageFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n if (!page || page.kind !== 'jsx') continue;\n const name = String(page.name ?? `#${p}`);\n const source = page.source;\n if (typeof source !== 'string' || source.trim() === '') {\n // (PageSchema's superRefine also covers this; keep it for the build path.)\n findings.push({\n severity: 'error',\n rule: 'jsx-page-empty-source',\n where: `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: \"kind:'jsx' page has no `source`.\",\n hint: 'Author the page as a constrained JSX/Tailwind string in `source`.',\n });\n continue;\n }\n // With a component manifest, do full validation (unknown component, missing/\n // wrong prop, bad enum, bindings); without it, parse-level (syntax/structure).\n const { diagnostics } = opts.manifest ? compile(source, opts.manifest) : parseJsx(source);\n for (const d of diagnostics) {\n findings.push({\n severity: d.severity,\n rule: `jsx-${d.code}`,\n where: d.tag ? `page \"${name}\" › <${d.tag}>` : `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: d.message,\n hint: 'The source is parsed (never executed) and compiled to the SDUI tree at save time — fix the JSX.',\n });\n }\n }\n return findings;\n}\n"],"mappings":";AAEA,SAAS,6BAA6B;AAkD/B,IAAM,yBAAyB;AAC/B,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAC/B,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AACzB,IAAM,+BAA+B;AAsB5C,SAAS,QAAQ,GAAsB;AACrC,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO;AAC7B,MAAI,KAAK,OAAO,MAAM,UAAU;AAC9B,WAAO,OAAO,QAAQ,CAAW,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAI,IAAe,EAAE;AAAA,EACxF;AACA,SAAO,CAAC;AACV;AAEA,SAAS,UAAU,GAAsB;AACvC,SAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC;AACnF;AAOA,IAAM,cAAc,oBAAI,IAAI;AAAA,EAC1B;AAAA,EAAO;AAAA,EAAkB;AAAA,EACzB;AAAA,EAAQ;AAAA,EACR;AAAA,EAAO;AAAA,EAAS;AAAA,EAChB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAU;AAClC,CAAC;AAED,SAAS,YAAY,GAAW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C,QAAQ,KAAK,SAAS,MAAO;AAClC,UAAM,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,EAAE;AACxC,UAAM,SAAS,KAAK;AACpB,QAAI,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,IAAI;AAEtD,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO,SAAS,IAAI;AAAA,QACpB,MAAM,SAAS,CAAC;AAAA,QAChB,SAAS;AAAA,QACT,MAAM;AAAA,MACR,CAAC;AACD;AAAA,IACF;AAGA,UAAM,EAAE,YAAY,IAAI,KAAK,WAAW,QAAQ,QAAQ,KAAK,QAAQ,IAAI,SAAS,MAAM;AACxF,eAAW,KAAK,aAAa;AAC3B,eAAS,KAAK;AAAA,QACZ,UAAU,EAAE;AAAA,QACZ,MAAM,OAAO,EAAE,IAAI;AAAA,QACnB,OAAO,EAAE,MAAM,SAAS,IAAI,aAAQ,EAAE,GAAG,MAAM,SAAS,IAAI;AAAA,QAC5D,MAAM,SAAS,CAAC;AAAA,QAChB,SAAS,EAAE;AAAA,QACX,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;","names":["asArray","asArray","asArray"]}
|
|
1
|
+
{"version":3,"sources":["../src/validate-widget-bindings.ts","../src/validate-expressions.ts","../src/validate-responsive-styles.ts","../src/validate-jsx-pages.ts","../src/validate-record-title.ts"],"sourcesContent":["// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { isIncoherentAggregate } from '@objectstack/spec/data';\n\n/**\n * Build-time dashboard widget binding diagnostics (issues #1719, #1721).\n *\n * Runs at `objectstack validate`/`compile`/`build` AFTER the stack has been\n * schema-parsed, so every widget's `dataset` reference can be linked to its\n * `defineDataset` and each entry in `dimensions`/`values` resolved to a\n * declared dimension/measure. This is the semantic/cross-reference phase —\n * the rules here cannot run during plain Zod parsing of the raw widget\n * literal (the dataset may even live in another package of the stack).\n *\n * Reference-integrity rules (#1721) — severity `error`, the page is broken:\n *\n * - `widget-dataset-unknown` — `dataset` does not resolve to a declared\n * `Dataset`.\n * - `widget-dimension-unknown` — a `dimensions[]` entry is not a dimension\n * name on the bound dataset.\n * - `widget-measure-unknown` — a `values[]` entry is not a measure name on\n * the bound dataset.\n * - `chart-field-unknown` — a `chartConfig` binding names a field the query\n * result will not contain: `xAxis.field` must be one of the widget's\n * dimensions (or a dataset dimension), and each `yAxis[].field` /\n * `series[].name` must be one of the widget's selected measures\n * (`values`). Post-cutover (ADR-0021) the result rows are keyed by\n * measure NAME (e.g. `sum_amount`), not the base column (`amount`) — a\n * stale base-column reference renders the axis but an empty series.\n *\n * Advisory rules — severity `warning`, build stays green:\n *\n * - `chart-config-missing` — a chart-type widget (bar/line/pie/…) has no\n * `chartConfig`, so the renderer cannot tell which measure to plot.\n * - `table-count-only` (#1719) — a `table`/`pivot` widget whose selected\n * measures are ALL `aggregate: 'count'` and which declares no\n * `dimensions` asks the analytics service for a single summary row. That\n * is the shape a `metric` widget wants — for a table it almost always\n * means the author wanted a per-record listing, which is not an\n * analytics dataset at all (model it as an object-bound ListView,\n * ADR-0017). Evaluated on the WIDGET's binding, not the dataset.\n * - `measure-aggregate-incoherent` — a dataset measure aggregates its field\n * in a way that produces a meaningless number: today, SUM (or\n * `count_distinct`) of a `percent`/rate field, whose total routinely\n * exceeds 100%. Rates must AVG. Checked once per dataset (independent of\n * any widget) when the bound object's field types are known.\n *\n * Warnings can be deliberately suppressed per widget via\n * `suppressWarnings: ['<rule-id>']`; errors cannot — they describe a\n * binding the analytics service cannot satisfy.\n */\n\nexport const WIDGET_DATASET_UNKNOWN = 'widget-dataset-unknown';\nexport const WIDGET_DIMENSION_UNKNOWN = 'widget-dimension-unknown';\nexport const WIDGET_MEASURE_UNKNOWN = 'widget-measure-unknown';\nexport const CHART_FIELD_UNKNOWN = 'chart-field-unknown';\nexport const CHART_CONFIG_MISSING = 'chart-config-missing';\nexport const TABLE_COUNT_ONLY = 'table-count-only';\nexport const MEASURE_AGGREGATE_INCOHERENT = 'measure-aggregate-incoherent';\n\nexport type WidgetBindingSeverity = 'error' | 'warning';\n\nexport interface WidgetBindingFinding {\n /** `error` = unresolvable binding (broken page); `warning` = advisory. */\n severity: WidgetBindingSeverity;\n /** Diagnostic rule id (registry entry), e.g. `widget-measure-unknown`. */\n rule: string;\n /** Human-readable location, e.g. `dashboard \"x\" › widget \"y\"`. */\n where: string;\n /** Config path, e.g. `dashboards[0].widgets[3]`. */\n path: string;\n /** What is wrong. */\n message: string;\n /** How to fix (or deliberately suppress) it. */\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce a collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\nfunction asStrings(v: unknown): string[] {\n return Array.isArray(v) ? v.filter((s): s is string => typeof s === 'string') : [];\n}\n\n/**\n * Chart families whose renderer needs a `chartConfig` measure mapping.\n * Single-value types (metric/kpi/gauge/…) plot their lone value and tabular\n * types (table/pivot) render every column, so they are exempt.\n */\nconst CHART_TYPES = new Set([\n 'bar', 'horizontal-bar', 'column',\n 'line', 'area',\n 'pie', 'donut', 'funnel',\n 'scatter', 'treemap', 'sankey', 'radar',\n]);\n\nfunction levenshtein(a: string, b: string): number {\n const m = a.length, n = b.length;\n let prev = Array.from({ length: n + 1 }, (_, j) => j);\n for (let i = 1; i <= m; i++) {\n const cur = [i];\n for (let j = 1; j <= n; j++) {\n cur[j] = Math.min(\n prev[j] + 1,\n cur[j - 1] + 1,\n prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),\n );\n }\n prev = cur;\n }\n return prev[n];\n}\n\n/**\n * Nearest declared name for a typo'd/stale reference, or undefined when\n * nothing is close. Containment is checked first because the cutover's\n * canonical drift is base column → prefixed measure name (`amount` →\n * `sum_amount`), which is far in edit distance but obvious to a human.\n */\nfunction didYouMean(input: string, candidates: Iterable<string>): string | undefined {\n let best: string | undefined;\n let bestScore = Infinity;\n for (const c of candidates) {\n let score: number;\n if (input.length >= 3 && (c.includes(input) || input.includes(c))) {\n score = Math.abs(c.length - input.length);\n } else {\n const d = levenshtein(input, c);\n if (d > Math.max(2, Math.floor(input.length / 3))) continue;\n score = 100 + d;\n }\n if (score < bestScore) { bestScore = score; best = c; }\n }\n return best;\n}\n\nfunction suggest(input: string, candidates: Iterable<string>): string {\n const s = didYouMean(input, candidates);\n return s ? ` Did you mean \"${s}\"?` : '';\n}\n\nfunction list(names: Iterable<string>): string {\n const arr = [...names];\n return arr.length > 0 ? arr.join(', ') : '(none)';\n}\n\n/**\n * Validate every dashboard widget's dataset binding. Returns the list of\n * findings (empty = clean). Caller decides how to surface them: `error`\n * findings describe bindings the analytics service cannot satisfy and\n * should fail validate/build; `warning` findings are advisory and must\n * never fail the build on their own.\n */\nexport function validateWidgetBindings(stack: AnyRec): WidgetBindingFinding[] {\n const findings: WidgetBindingFinding[] = [];\n\n const datasets = new Map<string, AnyRec>();\n for (const ds of asArray(stack.datasets)) {\n if (typeof ds.name === 'string') datasets.set(ds.name, ds);\n }\n\n // ── (0) dataset measures aggregate their field coherently ──\n // A measure that SUMs a percentage/rate field produces a meaningless total\n // (it can exceed 100%); rates must AVG. This is a dataset-level defect (it\n // does not depend on any widget), so it is checked once over every dataset\n // whose object's field types are known. Advisory — the page still renders.\n const objectFieldTypes = new Map<string, Map<string, string>>();\n for (const o of asArray(stack.objects)) {\n if (typeof o.name !== 'string') continue;\n const fm = new Map<string, string>();\n for (const f of asArray(o.fields)) {\n if (typeof f.name === 'string' && typeof f.type === 'string') fm.set(f.name, f.type);\n }\n objectFieldTypes.set(o.name, fm);\n }\n const datasetList = asArray(stack.datasets);\n for (let i = 0; i < datasetList.length; i++) {\n const ds = datasetList[i];\n const fieldTypes = typeof ds.object === 'string' ? objectFieldTypes.get(ds.object) : undefined;\n if (!fieldTypes) continue; // cannot judge without the object's field types\n const dsMeasures = asArray(ds.measures);\n for (let k = 0; k < dsMeasures.length; k++) {\n const m = dsMeasures[k];\n const field = typeof m.field === 'string' ? m.field : undefined;\n const aggregate = typeof m.aggregate === 'string' ? m.aggregate : undefined;\n if (!field || !aggregate) continue; // count(*) and underivable measures are fine\n const ftype = fieldTypes.get(field);\n if (ftype && isIncoherentAggregate(aggregate, ftype)) {\n findings.push({\n severity: 'warning',\n rule: MEASURE_AGGREGATE_INCOHERENT,\n where: `dataset \"${typeof ds.name === 'string' ? ds.name : `(dataset ${i})`}\" › measure \"${typeof m.name === 'string' ? m.name : `(measure ${k})`}\"`,\n path: `datasets[${i}].measures[${k}]`,\n message:\n `measure \"${m.name}\" applies ${aggregate} to ${ftype} field \"${field}\" — ` +\n `summed percentages are meaningless (they can exceed 100%).`,\n hint:\n `Use aggregate \"avg\" for percentage/rate fields (or \"count\" of records). ` +\n `If a running total is genuinely intended, suppress with: ` +\n `suppressWarnings: ['${MEASURE_AGGREGATE_INCOHERENT}'] on the measure.`,\n });\n }\n }\n }\n\n const dashboards = asArray(stack.dashboards);\n for (let i = 0; i < dashboards.length; i++) {\n const dash = dashboards[i];\n const dashName = typeof dash.name === 'string' ? dash.name : `(dashboard ${i})`;\n const widgets = Array.isArray(dash.widgets) ? (dash.widgets as AnyRec[]) : [];\n\n for (let j = 0; j < widgets.length; j++) {\n const w = widgets[j];\n const widgetId = typeof w.id === 'string' ? w.id : `(widget ${j})`;\n const where = `dashboard \"${dashName}\" › widget \"${widgetId}\"`;\n const path = `dashboards[${i}].widgets[${j}]`;\n const suppressed = (rule: string): boolean =>\n Array.isArray(w.suppressWarnings) && w.suppressWarnings.includes(rule);\n const push = (f: Omit<WidgetBindingFinding, 'where' | 'path'>): void => {\n if (f.severity === 'warning' && suppressed(f.rule)) return;\n findings.push({ ...f, where, path });\n };\n\n // ── (a) dataset reference resolves ──\n const dsName = typeof w.dataset === 'string' ? w.dataset : undefined;\n const dataset = dsName ? datasets.get(dsName) : undefined;\n if (dsName && !dataset) {\n push({\n severity: 'error',\n rule: WIDGET_DATASET_UNKNOWN,\n message: `dataset \"${dsName}\" does not resolve to a declared dataset.`,\n hint:\n `Declared datasets: ${list(datasets.keys())}.${suggest(dsName, datasets.keys())} ` +\n `Define the dataset with defineDataset() or fix the reference (ADR-0021).`,\n });\n }\n // Without a resolved dataset there is nothing to check names against.\n if (!dataset) continue;\n\n const dimensionNames = new Set<string>();\n for (const d of asArray(dataset.dimensions)) {\n if (typeof d.name === 'string') dimensionNames.add(d.name);\n }\n const measures = new Map<string, AnyRec>();\n for (const m of asArray(dataset.measures)) {\n if (typeof m.name === 'string') measures.set(m.name, m);\n }\n\n // ── (b) every dimensions[] entry is a dataset dimension ──\n const dims = asStrings(w.dimensions);\n for (let k = 0; k < dims.length; k++) {\n if (dimensionNames.has(dims[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_DIMENSION_UNKNOWN,\n message:\n `dimensions[${k}] \"${dims[k]}\" is not a dimension of dataset ` +\n `\"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint:\n `Widgets select dataset dimensions BY NAME.${suggest(dims[k], dimensionNames)} ` +\n `Add the dimension to the dataset or fix the reference.`,\n });\n }\n\n // ── (c) every values[] entry is a dataset measure ──\n const values = asStrings(w.values);\n for (let k = 0; k < values.length; k++) {\n if (measures.has(values[k])) continue;\n push({\n severity: 'error',\n rule: WIDGET_MEASURE_UNKNOWN,\n message:\n `values[${k}] \"${values[k]}\" is not a measure of dataset ` +\n `\"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint:\n `Widgets select dataset measures BY NAME, not by base column.` +\n `${suggest(values[k], measures.keys())} ` +\n `Add the measure to the dataset or fix the reference.`,\n });\n }\n\n // ── (d) chartConfig bindings resolve against the widget's selection ──\n const chartConfig = (w.chartConfig && typeof w.chartConfig === 'object')\n ? (w.chartConfig as AnyRec)\n : undefined;\n const isChartType = typeof w.type === 'string' && CHART_TYPES.has(w.type);\n\n if (chartConfig) {\n // The query result carries the widget's selected dimensions and\n // measures; resolve every chartConfig field against that shape.\n const selectedValues = new Set(values.filter((v) => measures.has(v)));\n\n const xAxis = (chartConfig.xAxis && typeof chartConfig.xAxis === 'object')\n ? (chartConfig.xAxis as AnyRec)\n : undefined;\n // A field naming an entry of the widget's own (already-validated)\n // selection is not re-reported here — rules (b)/(c) own that error.\n if (xAxis && typeof xAxis.field === 'string'\n && !dimensionNames.has(xAxis.field) && !dims.includes(xAxis.field)) {\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message:\n `chartConfig.xAxis.field \"${xAxis.field}\" does not resolve to a ` +\n `dimension of dataset \"${dsName}\" (declared dimensions: ${list(dimensionNames)}).`,\n hint: `Point xAxis.field at a dataset dimension name.${suggest(xAxis.field, dimensionNames)}`,\n });\n }\n\n const measureField = (label: string, field: string): void => {\n if (values.includes(field)) return; // resolvable, or already errored via rule (c)\n const declaredButUnselected = measures.has(field);\n push({\n severity: 'error',\n rule: CHART_FIELD_UNKNOWN,\n message: declaredButUnselected\n ? `chartConfig.${label} \"${field}\" is a measure of dataset \"${dsName}\" ` +\n `but is not selected in the widget's values (${list(values)}), so the ` +\n `query result will not contain it.`\n : `chartConfig.${label} \"${field}\" does not resolve to a measure of ` +\n `dataset \"${dsName}\" (declared measures: ${list(measures.keys())}).`,\n hint: declaredButUnselected\n ? `Add \"${field}\" to the widget's values, or bind the chart to a selected measure.`\n : `Post-cutover data is keyed by the dataset's measure NAME, not the ` +\n `base column.${suggest(field, selectedValues.size > 0 ? selectedValues : measures.keys())}`,\n });\n };\n\n const yAxes = Array.isArray(chartConfig.yAxis) ? (chartConfig.yAxis as AnyRec[]) : [];\n for (let k = 0; k < yAxes.length; k++) {\n const field = yAxes[k]?.field;\n if (typeof field === 'string') measureField(`yAxis[${k}].field`, field);\n }\n const series = Array.isArray(chartConfig.series) ? (chartConfig.series as AnyRec[]) : [];\n for (let k = 0; k < series.length; k++) {\n const name = series[k]?.name;\n if (typeof name === 'string') measureField(`series[${k}].name`, name);\n }\n } else if (isChartType) {\n push({\n severity: 'warning',\n rule: CHART_CONFIG_MISSING,\n message:\n `chart-type widget ('${w.type}') has no chartConfig — the renderer ` +\n `cannot determine which measure to plot, so the series renders empty.`,\n hint:\n `Add chartConfig with xAxis.field set to a dimension (${list(dims)}) and ` +\n `yAxis[].field set to a measure name (${list(values)}). If the default ` +\n `rendering is intentional, suppress with: suppressWarnings: ['${CHART_CONFIG_MISSING}']`,\n });\n }\n\n // ── (e) table/pivot bound to a count-only, dimensionless selection ──\n if (w.type !== 'table' && w.type !== 'pivot') continue;\n // Grouped by at least one dimension → genuinely aggregated rows.\n if (dims.length > 0) continue;\n if (values.length === 0) continue;\n const resolved = values.map((v) => measures.get(v));\n // An unresolvable measure name already errored above — don't guess here.\n if (resolved.some((m) => !m)) continue;\n\n // Derived measures combine other measures; treat them as non-count even\n // when their (ignored) `aggregate` says otherwise.\n const countOnly = resolved.every((m) => m!.aggregate === 'count' && !m!.derived);\n if (!countOnly) continue;\n\n push({\n severity: 'warning',\n rule: TABLE_COUNT_ONLY,\n message:\n `a '${w.type}' widget bound to dataset \"${dsName}\" selects only count ` +\n `measure(s) (${values.join(', ')}) and no dimensions, so it renders a ` +\n `single summary row — not a per-record list.`,\n hint:\n `A flat record listing is not an analytics dataset. Model it as an ` +\n `object-bound ListView (ADR-0017) surfaced through app navigation, and ` +\n `use a 'metric' widget here if you only need the count. If a single-row ` +\n `table is intentional, add an explicit dimension or suppress with: ` +\n `suppressWarnings: ['${TABLE_COUNT_ONLY}']`,\n });\n }\n }\n\n return findings;\n}\n","// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\n/**\n * Build-time expression validation (ADR-0032 §Decision 1a + 1b).\n *\n * Runs at `objectstack compile`, where the whole normalized stack is in hand —\n * so flow conditions can be checked against the *resolved* object schema\n * (field existence) in addition to CEL syntax. Uses the one shared validator\n * from `@objectstack/formula`, so the verdict matches `registerFlow` and the\n * agent `validate_expression` tool exactly.\n *\n * Scope (v1): flow predicates (start/decision `config.condition` + edge\n * `condition`), object validation-rule / formula predicates, and UI action\n * `visible` / `disabled` predicates. Each error is located (flow/object/action\n * + node/edge/field) with a corrective message.\n */\n\nimport { validateExpression } from '@objectstack/formula';\n\nexport interface ExprIssue {\n where: string;\n message: string;\n source: string;\n /**\n * `error` fails the build (e.g. a bare ref in a record-scoped formula). `warning`\n * is advisory and never fails it (e.g. a possible field typo in a flattened flow\n * condition, which might be a flow variable). Absent ⇒ treat as `error`.\n */\n severity?: 'error' | 'warning';\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce an `objects` collection (array or name-keyed map) to an array. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** object name → set of its field names, for schema-aware field checks. */\nfunction buildFieldIndex(objects: AnyRec[]): Map<string, string[]> {\n const idx = new Map<string, string[]>();\n for (const obj of objects) {\n const name = typeof obj.name === 'string' ? obj.name : undefined;\n if (!name) continue;\n const fields = obj.fields;\n let names: string[] = [];\n if (Array.isArray(fields)) names = fields.map(f => (f as AnyRec).name).filter((n): n is string => typeof n === 'string');\n else if (fields && typeof fields === 'object') names = Object.keys(fields as AnyRec);\n idx.set(name, names);\n }\n return idx;\n}\n\n/**\n * Validate every predicate in the stack. Returns the list of issues (empty =\n * clean). Caller decides how to surface / whether to fail the build.\n */\nexport function validateStackExpressions(stack: AnyRec): ExprIssue[] {\n const issues: ExprIssue[] = [];\n const objects = asArray(stack.objects);\n const fieldIndex = buildFieldIndex(objects);\n\n const check = (\n where: string,\n raw: unknown,\n objectName?: string,\n scope: 'record' | 'flattened' = 'flattened',\n ): void => {\n if (raw == null) return;\n const fields = objectName ? fieldIndex.get(objectName) : undefined;\n const res = validateExpression('predicate', raw as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields, scope } : { scope });\n for (const e of res.errors) issues.push({ where, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where, message: w.message, source: w.source, severity: 'warning' });\n };\n\n // ── Flows ──────────────────────────────────────────────────────────\n for (const flow of asArray(stack.flows)) {\n const flowName = typeof flow.name === 'string' ? flow.name : '(unnamed flow)';\n const nodes = Array.isArray(flow.nodes) ? (flow.nodes as AnyRec[]) : [];\n const edges = Array.isArray(flow.edges) ? (flow.edges as AnyRec[]) : [];\n // The record-change target object — `record.*` refs resolve against it.\n const startNode = nodes.find(n => n.type === 'start');\n const startCfg = (startNode?.config ?? {}) as AnyRec;\n const objectName = typeof startCfg.objectName === 'string' ? startCfg.objectName : undefined;\n\n for (const node of nodes) {\n const cfg = (node.config ?? {}) as AnyRec;\n check(`flow '${flowName}' · node '${node.id}' (${node.type}) condition`, cfg.condition, objectName);\n // #1870 — a `script` node must declare a callable target (`actionType` or\n // `function`). A node with neither is a silent no-op that otherwise passes\n // build. (Function *existence* isn't checkable here — functions are code,\n // not serialized into the artifact — so this is a structural check; the\n // runtime verifies the named function is actually registered.)\n if (node.type === 'script') {\n // `function` is canonical; `functionName` is an accepted alias.\n const fn =\n (typeof cfg.function === 'string' ? cfg.function.trim() : '') ||\n (typeof cfg.functionName === 'string' ? cfg.functionName.trim() : '');\n const action = typeof cfg.actionType === 'string' ? cfg.actionType.trim() : '';\n // Inline `config.script` (a JS body) is also a declared form — the\n // built-in runtime doesn't execute it (warned at run time), but the node\n // is not the empty no-op this check targets, so don't flag it.\n const inline = typeof cfg.script === 'string' ? cfg.script.trim() : '';\n if (!fn && !action && !inline) {\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node declares neither \\`actionType\\` nor \\`function\\` — it would do nothing at runtime. ` +\n `Name a built-in action (e.g. \\`actionType: 'email'\\`) or a registered function ` +\n `(\\`function: 'my_fn'\\`, registered via \\`defineStack({ functions })\\`).`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n } else if (action === 'invoke_function' && !fn) {\n // `actionType: 'invoke_function'` is a marker that names no callable on\n // its own — the function name must be in `function`/`functionName`.\n issues.push({\n where: `flow '${flowName}' · node '${node.id}' (script) callable`,\n message:\n `script node uses \\`actionType: 'invoke_function'\\` but no \\`function\\` (or \\`functionName\\`) — ` +\n `it names no callable. Set \\`function: 'my_fn'\\` and register it via \\`defineStack({ functions })\\`.`,\n source: JSON.stringify({ id: node.id, type: node.type, config: cfg }),\n });\n }\n }\n }\n for (const edge of edges) {\n check(`flow '${flowName}' · edge '${edge.id}' (${edge.source}→${edge.target}) condition`, edge.condition, objectName);\n }\n }\n\n // ── Object validation-rule + formula predicates ────────────────────\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n const validations = obj.validations ?? obj.validationRules;\n for (const rule of asArray(validations)) {\n const where = `object '${objectName}' · validation '${(rule.name as string) ?? '?'}'`;\n // Common predicate keys across rule shapes. Validation predicates are\n // `record`-scoped — no field flattening — so bare refs are flagged (#1928).\n check(where, rule.expression ?? rule.predicate ?? rule.condition ?? rule.formula, objectName, 'record');\n // `conditional` rules carry a nested `when` predicate (record-scoped).\n check(`${where} when`, (rule as AnyRec).when, objectName, 'record');\n }\n // Field-level formulas (computed fields) reference the same object.\n const fields = obj.fields;\n const fieldList = Array.isArray(fields)\n ? (fields as AnyRec[])\n : (fields && typeof fields === 'object' ? Object.values(fields as AnyRec) as AnyRec[] : []);\n\n // ── ADR-0062 D7 — reject `field.columnName` on external objects ──────\n // `field.columnName` (localField → physicalColumn) is the managed-object\n // mechanism; it is NOT applied by the driver's query pipeline for federated\n // objects, where `external.columnMap` (remoteColumn → localField) is the\n // authoritative — and inverse — mapping. Allowing both would be a silent\n // dual-source ambiguity, so reject `columnName` on any object that declares\n // an `external` binding (a federated object). Managed objects are untouched.\n if (obj.external != null) {\n const fieldEntries: Array<[string, AnyRec]> = Array.isArray(fields)\n ? (fields as AnyRec[]).map((f) => [((f as AnyRec)?.name as string) ?? '?', f as AnyRec])\n : (fields && typeof fields === 'object'\n ? (Object.entries(fields as AnyRec) as Array<[string, AnyRec]>)\n : []);\n for (const [fname, fdef] of fieldEntries) {\n if (fdef && typeof fdef === 'object' && (fdef as AnyRec).columnName != null) {\n issues.push({\n where: `object '${objectName}' · field '${fname}'`,\n message:\n `external object '${objectName}': field '${fname}' sets columnName='${String((fdef as AnyRec).columnName)}', ` +\n `which is not supported on federated objects (ADR-0062 D7). The driver's query pipeline ignores ` +\n `field.columnName for external objects; map remote columns via the datasource's external.columnMap instead.`,\n source: `columnName='${String((fdef as AnyRec).columnName)}'`,\n severity: 'error',\n });\n }\n }\n }\n\n for (const f of fieldList) {\n // Field-level conditional rules are server-enforced (rule-validator) and\n // record-scoped — a bare ref silently fails the rule (required/readonly\n // not enforced = data-integrity hole). #1928 class, same as actions.\n if (f && typeof f === 'object') {\n const fname = (f.name as string) ?? '?';\n for (const key of ['requiredWhen', 'readonlyWhen', 'conditionalRequired', 'visibleWhen'] as const) {\n check(`object '${objectName}' · field '${fname}' ${key}`, (f as AnyRec)[key], objectName, 'record');\n }\n }\n if (f && typeof f === 'object' && f.formula) {\n // formulas are `value` role (any return type), still CEL. They are\n // `record`-scoped — `record.<field>`, never bare — so flag bare refs (#1928).\n const res = validateExpression('value', f.formula as string | { dialect?: string; source?: string },\n objectName ? { objectName, fields: fieldIndex.get(objectName), scope: 'record' } : { scope: 'record' });\n const fieldWhere = `object '${objectName}' · field '${(f.name as string) ?? '?'}' formula`;\n for (const e of res.errors) issues.push({ where: fieldWhere, message: e.message, source: e.source, severity: 'error' });\n for (const w of res.warnings) issues.push({ where: fieldWhere, message: w.message, source: w.source, severity: 'warning' });\n }\n }\n }\n\n // ── Action `visible` / `disabled` predicates ───────────────────────\n // Record-scoped, same as validation rules: a record-header / row action's\n // `visible` is evaluated by ActionEngine against `{ record, recordId,\n // objectName, user, … }` with fail-closed semantics, so a BARE field ref\n // (`done` instead of `record.done`) throws and the action is silently hidden\n // on every record (the trap behind the #2183 \"Mark Done never hides\" hunt).\n // Flagging it here turns that into a build error with a corrective message.\n // `disabled` may be a boolean (skip) or a predicate (check).\n const seenActions = new Set<string>();\n const checkAction = (where: string, action: AnyRec, objectName?: string): void => {\n const obj = objectName\n ?? (typeof action.objectName === 'string' ? action.objectName : undefined)\n ?? (typeof action.object === 'string' ? action.object : undefined);\n const name = typeof action.name === 'string' ? action.name : '?';\n const key = `${obj ?? ''}:${name}`;\n if (seenActions.has(key)) return; // de-dup (actions are merged onto objects AND kept top-level)\n seenActions.add(key);\n check(`${where} · action '${name}' visible`, action.visible, obj, 'record');\n if (typeof action.disabled !== 'boolean') {\n check(`${where} · action '${name}' disabled`, action.disabled, obj, 'record');\n }\n };\n for (const action of asArray(stack.actions)) {\n checkAction('stack', action);\n }\n for (const obj of objects) {\n const objectName = typeof obj.name === 'string' ? obj.name : undefined;\n for (const action of asArray(obj.actions)) {\n checkAction(`object '${objectName}'`, action, objectName);\n }\n }\n\n // ── Sharing-rule predicates (security-critical, record-scoped) ─────\n // A criteria sharing rule's `condition` decides which rows a principal sees.\n // It is evaluated against the record, so a bare ref silently changes access.\n for (const rule of asArray(stack.sharingRules)) {\n const ruleObj = typeof rule.object === 'string' ? rule.object : undefined;\n const where = `sharingRule '${(rule.name as string) ?? '?'}'${ruleObj ? ` (${ruleObj})` : ''} condition`;\n check(where, rule.condition ?? rule.criteria ?? rule.predicate, ruleObj, 'record');\n }\n\n // ── Hook `condition` predicates (record-scoped gate) ───────────────\n // A lifecycle hook's `condition` skips the handler when false; it is\n // evaluated against the record, so a bare ref silently makes the hook\n // run on every record (or never) instead of the intended subset.\n for (const hook of asArray(stack.hooks)) {\n const hookObj = typeof hook.object === 'string' ? hook.object : undefined; // array targets → no single field set\n check(`hook '${(hook.name as string) ?? '?'}'${hookObj ? ` (${hookObj})` : ''} condition`, hook.condition, hookObj, 'record');\n }\n\n return issues;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for the SDUI scoped-styling model (ADR-0065).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019): the same bar holds for\n// hand-authored and AI-generated pages, run from `os validate`/`compile` and\n// reusable by AI authoring. It catches the deterministic ways a `responsiveStyles`\n// block silently fails or drifts — the class of mistake an AI author is most\n// likely to make — *before* render, with actionable hints it can self-correct on.\n//\n// What it does NOT catch: whether the result looks good. Visual/semantic quality\n// (contrast, balance, \"is it ugly\") is only catchable by rendering + a VLM gate,\n// which is a separate, render-time concern (ADR-0065 §Decision-5).\n\nexport type StyleSeverity = 'error' | 'warning';\n\nexport interface StyleFinding {\n severity: StyleSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"pricing\" › node \"plan_solo\"`. */\n where: string;\n /** Config path, e.g. `pages[0].regions[0].components[1]`. */\n path: string;\n message: string;\n hint: string;\n}\n\n// Rule ids (registry entries).\nexport const STYLE_NODE_MISSING_ID = 'style-node-missing-id';\nexport const STYLE_CLASSNAME_TAILWIND = 'style-classname-tailwind';\nexport const STYLE_RESPONSIVE_NO_BASE = 'style-responsive-no-base';\nexport const STYLE_UNKNOWN_CSS_PROPERTY = 'style-unknown-css-property';\nexport const STYLE_UNKNOWN_TOKEN = 'style-unknown-token';\n\ntype AnyRec = Record<string, unknown>;\n\nconst BREAKPOINTS = ['large', 'medium', 'small', 'xsmall'] as const;\n\n/** SDUI design-token palette (ADR-0065) + base theme tokens, referenced as\n * `var(--name)`. Authors should resolve values against these. Kept in sync with\n * `apps/console/src/index.css` / `@object-ui/components` `:root`. */\nconst KNOWN_TOKENS = new Set<string>([\n // SDUI tokens\n 'space-1', 'space-2', 'space-3', 'space-4', 'space-5', 'space-6', 'space-8', 'space-10', 'space-12',\n 'radius', 'radius-sm', 'radius-md', 'radius-lg', 'radius-xl',\n 'shadow-sm', 'shadow-md', 'shadow-lg',\n 'surface', 'surface-sunken', 'text-strong', 'text-muted', 'brand', 'brand-foreground', 'hairline',\n // Base theme tokens (shadcn) — usually wrapped as hsl(var(--x)).\n 'background', 'foreground', 'card', 'card-foreground', 'popover', 'popover-foreground',\n 'primary', 'primary-foreground', 'secondary', 'secondary-foreground',\n 'muted', 'muted-foreground', 'accent', 'accent-foreground',\n 'destructive', 'destructive-foreground', 'border', 'input', 'ring',\n 'success', 'success-foreground', 'warning', 'warning-foreground',\n 'chart-1', 'chart-2', 'chart-3', 'chart-4', 'chart-5',\n]);\n\n/** Common CSS properties (camelCase) an SDUI block realistically sets. Generous\n * on purpose: an unknown property is only a *warning* (typo catcher), never a\n * blocker. Custom properties (`--x`) are always allowed. */\nconst KNOWN_CSS_PROPERTIES = new Set<string>([\n 'display', 'position', 'top', 'right', 'bottom', 'left', 'inset', 'zIndex', 'overflow', 'overflowX', 'overflowY', 'visibility', 'boxSizing', 'float', 'clear',\n 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'aspectRatio',\n 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginInline', 'marginBlock',\n 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingInline', 'paddingBlock',\n 'flex', 'flexDirection', 'flexWrap', 'flexGrow', 'flexShrink', 'flexBasis', 'alignItems', 'alignContent', 'alignSelf', 'justifyContent', 'justifyItems', 'justifySelf', 'gap', 'rowGap', 'columnGap', 'order', 'placeItems', 'placeContent',\n 'grid', 'gridTemplate', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridColumn', 'gridRow', 'gridArea', 'gridAutoFlow', 'gridAutoColumns', 'gridAutoRows',\n 'color', 'backgroundColor', 'background', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat', 'backgroundClip', 'opacity', 'mixBlendMode',\n 'fontSize', 'fontWeight', 'fontFamily', 'fontStyle', 'lineHeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'textOverflow', 'whiteSpace', 'wordBreak', 'overflowWrap', 'fontVariantNumeric', 'verticalAlign', 'textShadow',\n 'border', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft', 'borderColor', 'borderWidth', 'borderStyle', 'borderRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'outline', 'outlineOffset',\n 'boxShadow', 'transform', 'transformOrigin', 'transition', 'transitionProperty', 'transitionDuration', 'transitionTimingFunction', 'transitionDelay', 'animation', 'filter', 'backdropFilter', 'willChange',\n 'cursor', 'pointerEvents', 'userSelect', 'objectFit', 'objectPosition', 'content',\n]);\n\nconst VAR_RE = /var\\(\\s*--([a-zA-Z0-9-]+)\\s*[,)]/g;\n\n// High-precision Tailwind-utility detection. A `className` in page metadata is\n// \"Tailwind-looking\" if any token is a responsive/state variant, an arbitrary\n// `[…]` value, a known utility stem followed by a Tailwind *value* (number /\n// fraction / size keyword), or a bare layout utility. Tuned to NOT trip on\n// ordinary custom class names (e.g. `my-custom-scope`, `os-s-plan_solo`).\nconst TW_VARIANT = /^(sm|md|lg|xl|2xl|hover|focus|active|disabled|dark|group-hover|peer-[a-z]+|first|last|odd|even):/;\nconst TW_STEM_VALUE = /^-?(p|m|px|py|pt|pb|pl|pr|mx|my|mt|mb|ml|mr|gap|gap-x|gap-y|space-x|space-y|w|h|min-w|max-w|min-h|max-h|size|text|leading|tracking|bg|border|rounded|shadow|ring|opacity|inset|top|bottom|left|right|z|order|col|row|grid-cols|grid-rows|basis)-(\\d+(\\.\\d+)?|\\d+\\/\\d+|px|full|auto|none|screen|min|max|fit|xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl)$/;\nconst TW_BARE = /^(flex|grid|block|inline|inline-block|inline-flex|hidden|contents|table|flow-root|grow|shrink|truncate|italic|underline|uppercase|lowercase|capitalize|antialiased|absolute|relative|fixed|sticky|static|isolate|flex-col|flex-row|flex-wrap|flex-nowrap|items-center|items-start|items-end|items-stretch|justify-center|justify-between|justify-around|justify-start|justify-end|text-center|text-left|text-right|font-bold|font-semibold|font-medium|font-normal|tabular-nums)$/;\n\nfunction looksLikeTailwind(className: string): boolean {\n return className.split(/\\s+/).some((tok) => {\n if (!tok) return false;\n if (TW_VARIANT.test(tok)) return true;\n if (/\\[[^\\]]+\\]/.test(tok)) return true; // arbitrary value, e.g. p-[13px]\n if (TW_STEM_VALUE.test(tok)) return true;\n if (TW_BARE.test(tok)) return true;\n return false;\n });\n}\n\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/** Child nodes can hang off `children`, `properties.children`, `body`, or\n * `properties.body` depending on block type — collect them all. */\nfunction childrenOf(node: AnyRec): AnyRec[] {\n const props = (node.properties as AnyRec) ?? {};\n const out: AnyRec[] = [];\n for (const c of [node.children, props.children, node.body, props.body]) {\n if (Array.isArray(c)) out.push(...(c.filter((x) => x && typeof x === 'object') as AnyRec[]));\n }\n return out;\n}\n\nfunction checkNode(node: AnyRec, pageName: string, path: string, findings: StyleFinding[]): void {\n const id = typeof node.id === 'string' ? node.id : undefined;\n const type = typeof node.type === 'string' ? node.type : 'node';\n const where = `page \"${pageName}\" › ${id ? `node \"${id}\"` : `<${type}>`}`;\n const rs = node.responsiveStyles as AnyRec | undefined;\n const hasRs = !!rs && typeof rs === 'object' && BREAKPOINTS.some((b) => rs[b]);\n\n // (1) responsiveStyles needs an id to scope to — else the CSS is dropped.\n if (hasRs && !id) {\n findings.push({\n severity: 'error', rule: STYLE_NODE_MISSING_ID, where, path,\n message: `Node has responsiveStyles but no \\`id\\`; scoped CSS cannot be generated and the styles are silently dropped.`,\n hint: `Add a stable \\`id\\` to this node.`,\n });\n }\n\n // (2) responsive breakpoint without a `large` base → unstyled at desktop.\n if (hasRs && !rs!.large && BREAKPOINTS.slice(1).some((b) => rs![b])) {\n findings.push({\n severity: 'warning', rule: STYLE_RESPONSIVE_NO_BASE, where, path,\n message: `responsiveStyles sets a smaller breakpoint but no \\`large\\` base; the node is unstyled at desktop width.`,\n hint: `Put the unconditional/base styles under \\`responsiveStyles.large\\` (desktop-first).`,\n });\n }\n\n // (3) className that looks like Tailwind → won't render from metadata.\n if (typeof node.className === 'string' && node.className.trim() && looksLikeTailwind(node.className)) {\n findings.push({\n severity: 'warning', rule: STYLE_CLASSNAME_TAILWIND, where, path,\n message: `\\`className\\` contains Tailwind-looking utilities (\"${node.className.trim().slice(0, 60)}\"); these are not compiled from metadata and will silently do nothing.`,\n hint: `Style this node with \\`responsiveStyles\\` + design tokens instead of \\`className\\` (ADR-0065).`,\n });\n }\n\n // (4)+(5) unknown CSS property / unknown token inside each breakpoint map.\n if (rs && typeof rs === 'object') {\n for (const bp of BREAKPOINTS) {\n const map = rs[bp] as AnyRec | undefined;\n if (!map || typeof map !== 'object') continue;\n for (const [prop, value] of Object.entries(map)) {\n if (!prop.startsWith('--') && !KNOWN_CSS_PROPERTIES.has(prop)) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_CSS_PROPERTY, where, path: `${path}.responsiveStyles.${bp}`,\n message: `Unknown CSS property \"${prop}\" (typo?); if unintended it will not apply.`,\n hint: `Use a camelCase CSS property name (e.g. \\`flexDirection\\`, \\`backgroundColor\\`).`,\n });\n }\n if (typeof value === 'string') {\n let m: RegExpExecArray | null;\n VAR_RE.lastIndex = 0;\n while ((m = VAR_RE.exec(value))) {\n const token = m[1];\n if (!KNOWN_TOKENS.has(token) && !token.startsWith('tw-')) {\n findings.push({\n severity: 'warning', rule: STYLE_UNKNOWN_TOKEN, where, path: `${path}.responsiveStyles.${bp}.${prop}`,\n message: `References unknown design token \\`var(--${token})\\` (typo?); it will not resolve.`,\n hint: `Use a token from the ADR-0065 palette (e.g. \\`var(--space-6)\\`, \\`var(--surface)\\`, \\`hsl(var(--primary))\\`).`,\n });\n }\n }\n }\n }\n }\n }\n\n // Recurse.\n const kids = childrenOf(node);\n for (let i = 0; i < kids.length; i++) {\n checkNode(kids[i], pageName, `${path}.children[${i}]`, findings);\n }\n}\n\n/**\n * Validate every page's component tree for SDUI styling correctness (ADR-0065).\n * Returns findings (empty = clean). `error` findings describe styles that are\n * silently dropped and should fail validate/build; `warning` findings are\n * advisory (typos, drift, footguns).\n */\nexport function validateResponsiveStyles(stack: AnyRec): StyleFinding[] {\n const findings: StyleFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n const pageName = typeof page.name === 'string' ? page.name : `pages[${p}]`;\n const regions = asArray(page.regions);\n for (let r = 0; r < regions.length; r++) {\n const components = asArray(regions[r].components);\n for (let c = 0; c < components.length; c++) {\n checkNode(components[c], pageName, `pages[${p}].regions[${r}].components[${c}]`, findings);\n }\n }\n }\n return findings;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n//\n// Build-time diagnostics for AI-authored JSX-source pages (ADR-0080).\n//\n// A pure `(stack) => Finding[]` rule (ADR-0019), run from `os validate` / `os\n// build`. A `kind:'jsx'` page's `source` is a constrained JSX/Tailwind string\n// compiled (parsed, never executed) to the SDUI tree at save time. This gate\n// parses it at author time so malformed source fails loudly (ADR-0078) instead\n// of being stored and breaking only at render.\n//\n// Scope: parse-level — syntax, tag matching, and forbidden constructs (event\n// handlers, dangerouslySetInnerHTML). Full component/prop whitelist validation\n// needs the registry manifest (a cross-repo artifact); when that is wired,\n// thread it through `compile()` here. Until then this catches the structural\n// class of error an AI author is most likely to emit.\n\nimport { parseJsx, compile, type Manifest } from '@objectstack/sdui-parser';\n\nexport type JsxPageSeverity = 'error' | 'warning';\n\nexport interface JsxPageFinding {\n severity: JsxPageSeverity;\n rule: string;\n /** Human-readable location, e.g. `page \"command_center\" › <flex>`. */\n where: string;\n /** Config path, e.g. `pages[3].source`. */\n path: string;\n message: string;\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\nconst asArray = (v: unknown): AnyRec[] => (Array.isArray(v) ? (v as AnyRec[]) : []);\n\nexport function validateJsxPages(stack: AnyRec, opts: { manifest?: Manifest } = {}): JsxPageFinding[] {\n const findings: JsxPageFinding[] = [];\n const pages = asArray(stack.pages);\n for (let p = 0; p < pages.length; p++) {\n const page = pages[p];\n if (!page || page.kind !== 'jsx') continue;\n const name = String(page.name ?? `#${p}`);\n const source = page.source;\n if (typeof source !== 'string' || source.trim() === '') {\n // (PageSchema's superRefine also covers this; keep it for the build path.)\n findings.push({\n severity: 'error',\n rule: 'jsx-page-empty-source',\n where: `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: \"kind:'jsx' page has no `source`.\",\n hint: 'Author the page as a constrained JSX/Tailwind string in `source`.',\n });\n continue;\n }\n // With a component manifest, do full validation (unknown component, missing/\n // wrong prop, bad enum, bindings); without it, parse-level (syntax/structure).\n const { diagnostics } = opts.manifest ? compile(source, opts.manifest) : parseJsx(source);\n for (const d of diagnostics) {\n findings.push({\n severity: d.severity,\n rule: `jsx-${d.code}`,\n where: d.tag ? `page \"${name}\" › <${d.tag}>` : `page \"${name}\"`,\n path: `pages[${p}].source`,\n message: d.message,\n hint: 'The source is parsed (never executed) and compiled to the SDUI tree at save time — fix the JSX.',\n });\n }\n }\n return findings;\n}\n","// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport { objectTitleCompleteness } from '@objectstack/spec/data';\nimport type { DisplayNameObjectMeta } from '@objectstack/spec/data';\n\n/**\n * Build-time record-title diagnostics (ADR-0079).\n *\n * A record's human title is a structural invariant: every object resolves a\n * primary title from a real STORED field via `nameField` (the canonical\n * pointer; `displayNameField` is the deprecated alias) or a deterministic\n * derivation. Two authoring smells are flagged here so `os build`/`os lint`,\n * the MCP authoring surface, and hand-authoring all get the coverage cloud\n * graph-lint already has (the ADR-0078 \"not cloud-only\" principle):\n *\n * - `title-format-retired` — the object declares a `titleFormat`. That field\n * is a RENDER-ONLY template the server can neither return nor query; ADR-0079\n * retires it in favour of `nameField`. The schema still parses it (existing\n * metadata keeps loading), so this is advisory, not an error.\n * - `title-unresolvable` — `objectTitleCompleteness` reports `status: 'none'`:\n * no `nameField`/`displayNameField` pointer and no title-eligible field to\n * derive one from. Records will have no meaningful title (the runtime falls\n * back to the auto-provisioned primary / `Record #<id>` floor), so this is a\n * warning, not an error — nothing is fully broken.\n *\n * Both are warnings: the auto-provision transform and the id floor mean a\n * green build never ships a fully title-less object. Reuses the shared spec\n * predicate (`@objectstack/spec/data` → display-name) so cloud and framework\n * classify titles identically.\n */\n\nexport const TITLE_FORMAT_RETIRED = 'title-format-retired';\nexport const TITLE_UNRESOLVABLE = 'title-unresolvable';\n\nexport type RecordTitleSeverity = 'error' | 'warning';\n\nexport interface RecordTitleFinding {\n /** Always `warning` today — both rules are advisory (see module note). */\n severity: RecordTitleSeverity;\n /** Diagnostic rule id (registry entry), e.g. `title-format-retired`. */\n rule: string;\n /** Human-readable location, e.g. `object \"invoice\"`. */\n where: string;\n /** Config path, e.g. `objects[3]`. */\n path: string;\n /** What is wrong. */\n message: string;\n /** How to fix it. */\n hint: string;\n}\n\ntype AnyRec = Record<string, unknown>;\n\n/** Coerce a collection (array or name-keyed map) to an array of records. */\nfunction asArray(v: unknown): AnyRec[] {\n if (Array.isArray(v)) return v as AnyRec[];\n if (v && typeof v === 'object') {\n return Object.entries(v as AnyRec).map(([name, def]) => ({ name, ...(def as AnyRec) }));\n }\n return [];\n}\n\n/**\n * Validate every object's record-title declaration. Returns the list of\n * findings (empty = clean). Both rules are advisory (`warning`): the caller\n * must never fail the build on them alone — auto-provision + the `Record #<id>`\n * floor guarantee a resolvable title at runtime.\n */\nexport function validateRecordTitle(stack: AnyRec): RecordTitleFinding[] {\n const findings: RecordTitleFinding[] = [];\n\n const objects = asArray(stack.objects);\n for (let i = 0; i < objects.length; i++) {\n const obj = objects[i];\n const objName = typeof obj.name === 'string' ? obj.name : `(object ${i})`;\n const where = `object \"${objName}\"`;\n const path = `objects[${i}]`;\n\n // ── (a) titleFormat is retired (ADR-0079) ──\n // Render-only template the server cannot return or query. Still parsed by\n // the schema for back-compat, so advisory.\n if (obj.titleFormat !== undefined && obj.titleFormat !== null && obj.titleFormat !== '') {\n findings.push({\n severity: 'warning',\n rule: TITLE_FORMAT_RETIRED,\n where,\n path,\n message:\n `${objName}: titleFormat is retired (ADR-0079) — migrate to nameField ` +\n `(single field) or a formula field designated nameField`,\n hint:\n `titleFormat is a render-only template the server cannot return or ` +\n `query, and an explicit nameField now takes precedence. For a ` +\n `single-field title set nameField: '<field>'. For a composite title, ` +\n `add a formula field (returnType: 'text') and designate it via ` +\n `nameField.`,\n });\n }\n\n // ── (b) no resolvable title (status: 'none') ──\n // Reuse the shared spec predicate so cloud graph-lint and framework lint\n // classify titles identically. `none` = no pointer AND nothing derivable.\n const completeness = objectTitleCompleteness(obj as DisplayNameObjectMeta);\n if (completeness.status === 'none') {\n findings.push({\n severity: 'warning',\n rule: TITLE_UNRESOLVABLE,\n where,\n path,\n message:\n `${objName}: no resolvable record title — records will have no ` +\n `meaningful name (no nameField and no title-eligible field to derive one)`,\n hint:\n `Set nameField to a text/email field (or a formula field with ` +\n `returnType: 'text'), or add a text field named \"name\"/\"title\". The ` +\n `runtime auto-provisions a primary and falls back to \"Record #<id>\", ` +\n `but an explicit title is far more useful.`,\n });\n }\n }\n\n return findings;\n}\n"],"mappings":";AAEA,SAAS,6BAA6B;AAkD/B,IAAM,yBAAyB;AAC/B,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAC/B,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AACzB,IAAM,+BAA+B;AAsB5C,SAAS,QAAQ,GAAsB;AACrC,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO;AAC7B,MAAI,KAAK,OAAO,MAAM,UAAU;AAC9B,WAAO,OAAO,QAAQ,CAAW,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAI,IAAe,EAAE;AAAA,EACxF;AACA,SAAO,CAAC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AI,KAAK,OAAO,MAAM,UAAU;AAC9B,WAAO,OAAO,QAAQ,CAAW,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAI,IAAe,EAAE;AAAA,EACxF;AACA,SAAO,CAAC;AACV;AAQO,SAAS,oBAAoB,OAAqC;AACvE,QAAM,WAAiC,CAAC;AAExC,QAAM,UAAUA,SAAQ,MAAM,OAAO;AACrC,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,MAAM,QAAQ,CAAC;AACrB,UAAM,UAAU,OAAO,IAAI,SAAS,WAAW,IAAI,OAAO,WAAW,CAAC;AACtE,UAAM,QAAQ,WAAW,OAAO;AAChC,UAAM,OAAO,WAAW,CAAC;AAKzB,QAAI,IAAI,gBAAgB,UAAa,IAAI,gBAAgB,QAAQ,IAAI,gBAAgB,IAAI;AACvF,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,SACE,GAAG,OAAO;AAAA,QAEZ,MACE;AAAA,MAKJ,CAAC;AAAA,IACH;AAKA,UAAM,eAAe,wBAAwB,GAA4B;AACzE,QAAI,aAAa,WAAW,QAAQ;AAClC,eAAS,KAAK;AAAA,QACZ,UAAU;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,SACE,GAAG,OAAO;AAAA,QAEZ,MACE;AAAA,MAIJ,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":["asArray","asArray","asArray","asArray"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/lint",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Static, build-time validation for an ObjectStack metadata graph — dashboard widget bindings, CEL/predicate expressions, and more. Pure (stack) => Issue[] functions shared by the CLI's `os validate` and any other consumer (e.g. AI authoring). Depends on @objectstack/spec; never on a runtime.",
|
|
6
6
|
"type": "module",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@objectstack/spec": "11.
|
|
18
|
-
"@objectstack/formula": "11.
|
|
19
|
-
"@objectstack/sdui-parser": "11.
|
|
17
|
+
"@objectstack/spec": "11.3.0",
|
|
18
|
+
"@objectstack/formula": "11.3.0",
|
|
19
|
+
"@objectstack/sdui-parser": "11.3.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/node": "^26.0.
|
|
22
|
+
"@types/node": "^26.0.1",
|
|
23
23
|
"typescript": "^6.0.3",
|
|
24
24
|
"vitest": "^4.1.9"
|
|
25
25
|
},
|