Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/25873-report-date-range.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@object-ui/plugin-report': patch
'@object-ui/i18n': patch
---

feat(plugin-report): a report that declares `dateRange` draws a period chip and runs every query inside the chosen window

Clause-②: no
Metadata-protocol: none

`ReportSchema.dateRange` (`{ dimension?, defaultRange, allowCustomRange }`) was accepted but read by nothing, so a report showed every period whatever it declared. The report page now reads it:

- **The chip.** A non-joined report that declares `dateRange` draws a date-range chip above its body: All time, the dashboard's presets under the dashboard's labels, and Custom… (two date inputs) unless `allowCustomRange: false`. It opens on `defaultRange`, or `this_month` when that is absent; `custom` opens the custom pick with no window until both ends are named.
- **The window.** The active window rides every dataset query the report makes (the grouped table, the matrix cross-tab and the embedded chart) as one `selection.timeDimensions` entry `{ dimension, dateRange }` with no `granularity`: a preset goes by name, a custom pick as `[start, end]`, and All time sends no entry. The server ANDs it with `runtimeFilter` and the dataset's own filter. A new pick re-queries.
- **The dimension.** A declared `dimension` is sent as written. Omitted, the renderer reads the dataset definition before any query and uses its one `type: 'date'` dimension; a dataset with none or several draws that authoring error in place of the report and queries nothing.
- **Unchanged without it.** A report that does not declare `dateRange` draws no chip, reads no dataset definition and posts exactly the selection it posted before. A `joined` report (where the spec refuses `dateRange`) is not affected.

`@object-ui/i18n` gains `report.dateRange.from`, `report.dateRange.to`, `report.dateRange.datasetUnreadable` and `report.dateRange.noSingleDateDimension` in all ten locale packs; the preset labels reuse `dashboard.filters.*`.
18 changes: 11 additions & 7 deletions packages/lint/src/lint-liveness-properties.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2294,23 +2294,27 @@ describe('#26146 — ledger rows below the child level are graded and counted',
// ── #26548: a report's period and export are declared before the renderer reads them ──
//
// `report` joined TYPE_COLLECTIONS with its ledger's first warned rows:
// `dateRange` and `exportOptions` are `planned` + `authorWarn` until the
// Console report page reads them. Read off the SHIPPED ledger, so the flip to
// `live` (which drops `authorWarn`) turns the warning half of this block red
// on purpose — rewrite it as a silence pin in that same edit.
describe('report period and export (#26548 — planned until the report renderer reads them)', () => {
// `dateRange` and `exportOptions` shipped `planned` + `authorWarn` until the
// Console report page read them. `dateRange` is `live` since #25873's renderer
// slice (the report page draws its chip and windows every query), so its
// warning pin turned red at that flip ON PURPOSE and is re-subjected to the
// silence. `exportOptions` is still `planned` and is authored in the SAME call:
// one ledger load, one warning, so the silence is a reading and not a lint
// that stopped loading ledgers (which also answers []).
describe('report period and export (#26548 — dateRange live, exportOptions planned until the renderer reads it)', () => {
const report = (extra: Record<string, unknown> = {}) => ({
reports: [{ name: 'pipeline', label: 'Pipeline', type: 'summary', dataset: 'sales', rows: ['stage'], values: ['revenue'], ...extra }],
});

it('warns on each key, at the report, with the row\'s author hint', () => {
it('warns on exportOptions only, at the report, with the row\'s author hint; dateRange is silent', () => {
const findings = lintLivenessProperties(report({ dateRange: { dimension: 'close_date' }, exportOptions: { formats: ['csv'] } }));
const planned = findings.filter((f) => f.rule === 'liveness-planned-property');
expect(planned.map((f) => f.message.match(/`(dateRange|exportOptions)`/)?.[1]).sort()).toEqual(['dateRange', 'exportOptions']);
expect(planned.map((f) => f.message.match(/`(dateRange|exportOptions)`/)?.[1]).sort()).toEqual(['exportOptions']);
for (const f of planned) {
expect(f.where).toContain("report 'pipeline'");
expect(f.hint).toMatch(/^Keep it, but nothing reads it yet: the Console report page draws no /);
}
expect(findings.filter((f) => /`dateRange`/.test(f.message))).toEqual([]);
});

it('CONTROL — a report declaring neither key draws no warning', () => {
Expand Down
33 changes: 16 additions & 17 deletions packages/spec/liveness/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,28 @@
"note": "objectui: DatasetReportChart plots `chart.xAxis` (dataset dimension) × `chart.yAxis` (measure) via useDatasetRows, honoring `type`/`title` (framework#1890/#3441). Supersedes the 2026-06 audit's DEAD finding. Sub-key `groupBy` stays experimental (its own describe marker) — the dataset renderer plots a single series and never reads it. Live on NON-joined reports only (#20161, re-read at the `.objectui-sha` pin f8a9d0fb): the one `report.chart` read (DatasetReportRenderer.tsx:1557) sits after the joined branch's return (:1462-1524), so on a `type: 'joined'` report the schema's refinement REFUSES `chart` rather than accepting a key nothing reads. A `joined` report draws no chart (packages/spec/src/ui/report.zod.ts, the joined-chart prescription, #20161; read point moved out of spec source, #23434): at objectui @f8a9d0fb0596 packages/plugin-report/src/DatasetReportRenderer.tsx#DatasetReportRenderer the joined branch draws each block as a `DatasetMatrixTable` / `DatasetReportTable` and returns before the one `report.chart` read, and no renderer reads a block's `chart`."
},
"dateRange": {
"status": "planned",
"verifiedAt": "2026-10-27",
"authorWarn": true,
"authorHint": "Keep it, but nothing reads it yet: the Console report page draws no date-range chip, so the report still shows every period until the report renderer reads this key.",
"note": "PLANNED RECORD (#26548, the spec half of ruling 6408567749 on #25873, letter B). The report period `{ dimension?, defaultRange, allowCustomRange }`: `defaultRange` / `allowCustomRange` are the dashboard declaration verbatim (DATE_RANGE_DEFAULT_RANGES, defaults this_month / true, held equal by report-date-range-export.test.ts); `dimension` names a dataset dimension that declares `type: date` (omitted = the dataset declares exactly one). The four dataset-aware cases are judged by the `@objectstack/lint` rule validate-report-date-range.ts at os validate / os build and at the report publish door. Refused on a `joined` container. PLANNED, not live: no renderer reads it. The report page posts its selection through `useDatasetRows` in ui/packages/plugin-report/src/DatasetReportRenderer.tsx#DatasetReportRenderer with no `timeDimensions` entry, and no source under ui/packages/plugin-report/src/ names `dateRange` (0 hits outside tests). The renderer contract is the TSDoc on `ReportSchema.dateRange`: the active window rides `selection.timeDimensions: [{ dimension, dateRange }]` with no `granularity` (a filter window ANDed with `runtimeFilter`), which the analytics service already accepts. Carrier: #25873, the ui renderer card, Blocked-by this one. Flip to `live` on the commit that cites the renderer read point, and drop `authorWarn` / `authorHint` in that same edit.",
"status": "live",
"verifiedAt": "2026-10-28",
"evidence": "ui/packages/plugin-report/src/DatasetReportRenderer.tsx#useDatasetRows, ui/packages/plugin-report/src/ReportDateRange.tsx#reportTimeWindow",
"note": "#25873 (ruling 6408567749, letter B; spec half #26548). The report period `{ dimension?, defaultRange, allowCustomRange }`: `defaultRange` / `allowCustomRange` are the dashboard declaration verbatim (DATE_RANGE_DEFAULT_RANGES, defaults this_month / true, held equal by report-date-range-export.test.ts); `dimension` names a dataset dimension that declares `type: date` (omitted = the dataset declares exactly one). The four dataset-aware cases are judged by the `@objectstack/lint` rule validate-report-date-range.ts at os validate / os build and at the report publish door. Refused on a `joined` container, and not read there. LIVE: a non-joined report that declares it draws a date-range chip (ReportDateRange.tsx#ReportDateRangeControl: All time, the dashboard's DATE_RANGE_PRESETS under the `dashboard.filters.range.*` labels, Custom… when allowed), and the active window rides every dataset query the report makes (grouped table, matrix cross-tab, embedded chart) through the single fetch choke point DatasetReportRenderer.tsx#useDatasetRows as ONE `selection.timeDimensions` entry `{ dimension, dateRange }` with no `granularity`: a preset by name, a custom pick as `[start, end]`, All time as no entry. The window is part of the refetch signature, so a new pick re-queries. A report without `dateRange` posts the selection it always did (no `timeDimensions` key, no chip, no dataset-definition read). Pinned by ui/packages/plugin-report/src/__tests__/DatasetReportRenderer.dateRange-25873.test.tsx.",
"children": {
"dimension": {
"status": "planned",
"verifiedAt": "2026-10-27",
"evidence": "packages/spec/src/ui/report.zod.ts#ReportSchema (declares `dimension` on the closed `dateRange` block)",
"note": "The dataset dimension the window applies to. Planned with its container: no renderer reads it. Its dataset-aware checks are live in lint (validate-report-date-range.ts: unknown, not a date, omitted with several date dimensions, omitted with none)."
"status": "live",
"verifiedAt": "2026-10-28",
"evidence": "ui/packages/plugin-report/src/ReportDateRange.tsx#useReportDateDimension",
"note": "The dataset dimension the window applies to. Declared, it is the `timeDimensions[].dimension` verbatim; omitted, the renderer reads the dataset definition (`/api/v1/meta/dataset/NAME` through the host's `apiFetch`, the ObjectChart dataset read) BEFORE any query and uses its one `type: date` dimension. Zero or several draws the authoring error in place of the report and queries nothing, so no unwindowed table renders under a period chip. Its dataset-aware checks are also live in lint (validate-report-date-range.ts)."
},
"defaultRange": {
"status": "planned",
"verifiedAt": "2026-10-27",
"evidence": "packages/spec/src/ui/report.zod.ts#ReportSchema (declares `defaultRange` over DATE_RANGE_DEFAULT_RANGES, default this_month)",
"note": "The preset the report opens on, the dashboard declaration verbatim. Planned with its container: no renderer reads it."
"status": "live",
"verifiedAt": "2026-10-28",
"evidence": "ui/packages/plugin-report/src/ReportDateRange.tsx#initialReportPeriod",
"note": "The preset the report opens on, the dashboard declaration verbatim; absent opens on the spec default this_month. `custom` opens the custom pick with no window (the spec's sentinel) until both ends are named."
},
"allowCustomRange": {
"status": "planned",
"verifiedAt": "2026-10-27",
"evidence": "packages/spec/src/ui/report.zod.ts#ReportSchema (declares `allowCustomRange`, default true)",
"note": "Whether the viewer may pick a custom range, the dashboard declaration verbatim. Planned with its container: no renderer reads it."
"status": "live",
"verifiedAt": "2026-10-28",
"evidence": "ui/packages/plugin-report/src/ReportDateRange.tsx#ReportDateRangeControl",
"note": "Whether the chip offers Custom… (two date inputs whose `[start, end]` goes on the wire). `false` removes the item; absent = true."
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/liveness/state-counts/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ committed anywhere: `check:liveness` sums the shards when it reads them.

| Type | live | exp | elsewhere | dead | planned | classified |
|---|---|---|---|---|---|---|
| `report` | 21 | 0 | 0 | 0 | 6 | 27 |
| `report` | 24 | 0 | 0 | 0 | 3 | 27 |
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3418,6 +3418,12 @@ const ar = {
totals: "الإجماليات",
loading: "جارٍ التحميل…",
forbiddenMessage: "ليست لديك صلاحية لعرض البيانات الخاصة بهذا التقرير.",
dateRange: {
from: "من",
to: "إلى",
datasetUnreadable: "لا تحدد الفترة الزمنية لهذا التقرير أي بُعد، وتعذّرت قراءة مجموعة البيانات \"{{dataset}}\" للعثور على بُعد التاريخ ({{reason}}).",
noSingleDateDimension: "لا تحدد الفترة الزمنية لهذا التقرير أي بُعد، وتعلن مجموعة البيانات \"{{dataset}}\" عن {{total}} من أبعاد التاريخ ({{found}}) بينما يلزم بُعد واحد بالضبط. حدّد بُعد التاريخ في dateRange.dimension الخاص بالتقرير.",
},
aggregate: {
count: "عدد",
countDistinct: "عدد الفريد",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3177,6 +3177,12 @@ const de = {
totals: "Summen",
loading: "Wird geladen…",
forbiddenMessage: "Sie haben keine Berechtigung, die Daten dieses Berichts anzuzeigen.",
dateRange: {
from: "Von",
to: "Bis",
datasetUnreadable: "Der Zeitraum dieses Berichts nennt keine Dimension, und das Dataset {{dataset}} konnte nicht gelesen werden, um seine Datumsdimension zu finden ({{reason}}).",
noSingleDateDimension: "Der Zeitraum dieses Berichts nennt keine Dimension, und das Dataset {{dataset}} deklariert {{total}} Datumsdimensionen ({{found}}), benötigt wird genau eine. Nennen Sie die Datumsdimension in dateRange.dimension des Berichts.",
},
aggregate: {
count: "Anzahl",
countDistinct: "Eindeutige Anzahl",
Expand Down
7 changes: 7 additions & 0 deletions ui/packages/i18n/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,13 @@ const en = {
loading: 'Loading…',
// objectui#12330 — the report's no-access state; its title is `dashboard.widgetForbiddenTitle`.
forbiddenMessage: 'You don’t have permission to view the data behind this report.',
// objectstack-ai/objectstack#25873 — the report period chip (`ReportSchema.dateRange`); its preset labels are `dashboard.filters.*`.
dateRange: {
from: 'From',
to: 'To',
datasetUnreadable: 'This report’s date range names no dimension, and the “{{dataset}}” dataset could not be read to find its date dimension ({{reason}}).',
noSingleDateDimension: 'This report’s date range names no dimension, and the “{{dataset}}” dataset declares {{total}} date dimensions ({{found}}) where it needs exactly one. Name the date dimension in the report’s dateRange.dimension.',
},
aggregate: {
count: 'Count',
countDistinct: 'Distinct Count',
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3238,6 +3238,12 @@ const es = {
totals: "Totales",
loading: "Cargando…",
forbiddenMessage: "No tienes permiso para ver los datos de este informe.",
dateRange: {
from: "Desde",
to: "Hasta",
datasetUnreadable: "El periodo de este informe no indica ninguna dimensión y no se pudo leer el conjunto de datos «{{dataset}}» para encontrar su dimensión de fecha ({{reason}}).",
noSingleDateDimension: "El periodo de este informe no indica ninguna dimensión y el conjunto de datos «{{dataset}}» declara {{total}} dimensiones de fecha ({{found}}) cuando necesita exactamente una. Indique la dimensión de fecha en dateRange.dimension del informe.",
},
aggregate: {
count: "Contar",
countDistinct: "Contar únicos",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3234,6 +3234,12 @@ const fr = {
totals: "Totaux",
loading: "Chargement…",
forbiddenMessage: "Vous n’avez pas l’autorisation de voir les données de ce rapport.",
dateRange: {
from: "Du",
to: "Au",
datasetUnreadable: "La période de ce rapport ne nomme aucune dimension, et le jeu de données « {{dataset}} » n’a pas pu être lu pour trouver sa dimension de date ({{reason}}).",
noSingleDateDimension: "La période de ce rapport ne nomme aucune dimension, et le jeu de données « {{dataset}} » déclare {{total}} dimensions de date ({{found}}) alors qu’il en faut exactement une. Nommez la dimension de date dans dateRange.dimension du rapport.",
},
aggregate: {
count: "Compter",
countDistinct: "Compter distincts",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3179,6 +3179,12 @@ const ja = {
totals: "合計",
loading: "読み込み中…",
forbiddenMessage: "このレポートのデータを表示する権限がありません。",
dateRange: {
from: "開始",
to: "終了",
datasetUnreadable: "このレポートの期間はディメンションを指定しておらず、データセット「{{dataset}}」を読み込んで日付ディメンションを特定できませんでした({{reason}})。",
noSingleDateDimension: "このレポートの期間はディメンションを指定しておらず、データセット「{{dataset}}」は日付ディメンションを {{total}} 個宣言しています({{found}})。ちょうど 1 個である必要があります。レポートの dateRange.dimension で日付ディメンションを指定してください。",
},
aggregate: {
count: "件数",
countDistinct: "ユニーク件数",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3176,6 +3176,12 @@ const ko = {
totals: "합계",
loading: "로딩 중…",
forbiddenMessage: "이 보고서의 데이터를 볼 수 있는 권한이 없습니다.",
dateRange: {
from: "시작",
to: "종료",
datasetUnreadable: "이 보고서의 기간에 차원이 지정되지 않았으며, 날짜 차원을 찾기 위해 “{{dataset}}” 데이터셋을 읽을 수 없습니다({{reason}}).",
noSingleDateDimension: "이 보고서의 기간에 차원이 지정되지 않았으며, “{{dataset}}” 데이터셋은 날짜 차원을 {{total}}개 선언합니다({{found}}). 정확히 하나여야 합니다. 보고서의 dateRange.dimension에 날짜 차원을 지정하세요.",
},
aggregate: {
count: "개수",
countDistinct: "고유 개수",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3233,6 +3233,12 @@ const pt = {
totals: "Totais",
loading: "Carregando…",
forbiddenMessage: "Você não tem permissão para ver os dados deste relatório.",
dateRange: {
from: "De",
to: "Até",
datasetUnreadable: "O período deste relatório não indica nenhuma dimensão, e não foi possível ler o conjunto de dados “{{dataset}}” para encontrar sua dimensão de data ({{reason}}).",
noSingleDateDimension: "O período deste relatório não indica nenhuma dimensão, e o conjunto de dados “{{dataset}}” declara {{total}} dimensões de data ({{found}}) quando precisa de exatamente uma. Indique a dimensão de data em dateRange.dimension do relatório.",
},
aggregate: {
count: "Contar",
countDistinct: "Contar distintos",
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/i18n/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3308,6 +3308,12 @@ const ru = {
totals: "Итоги",
loading: "Загрузка…",
forbiddenMessage: "У вас нет прав на просмотр данных этого отчёта.",
dateRange: {
from: "С",
to: "По",
datasetUnreadable: "Период этого отчёта не указывает измерение, и не удалось прочитать набор данных «{{dataset}}», чтобы найти его измерение даты ({{reason}}).",
noSingleDateDimension: "Период этого отчёта не указывает измерение, а набор данных «{{dataset}}» объявляет измерений даты: {{total}} ({{found}}), тогда как нужно ровно одно. Укажите измерение даты в dateRange.dimension отчёта.",
},
aggregate: {
count: "Количество",
countDistinct: "Уникальные",
Expand Down
Loading
Loading