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
11 changes: 11 additions & 0 deletions .changeset/21714-report-form-joined-block-dataset-picker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@objectstack/spec": patch
---

`reportForm`: the "Joined blocks" repeater's `dataset` column now declares `widget: 'ref:dataset'` and `required: true`. Studio's report inspector draws a joined report's block `dataset` as the dataset picker, with the required marker, instead of a free-text cell with no marker.

Clause-②: no

- **Why.** A `joined` report refuses a block that binds no `dataset`, at `blocks.N.dataset`. The form offered that column as plain text and did not mark it, so a newly added block failed on save.
- **Which renderer honours it.** The pinned console registers `ref:dataset` in its widget registry. Its repeater takes each column's widget and `required` from the row spec, in both the grid and the card layout.
- ⛔ Only this one form row changes. No schema, parse, export or accept-set change: `JoinedReportBlockSchema.dataset` stays optional on the block shape, and the joined arm's refusal is unchanged.
17 changes: 17 additions & 0 deletions packages/spec/src/ui/report-joined-block-dataset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { describe, expect, it } from 'vitest';
import { getMetadataTypeSchema } from '../kernel/metadata-type-schemas';
import { MIGRATIONS_BY_MAJOR, RETIRED_KEYS_BY_MAJOR } from '../migrations/registry';
import { ObjectStackDefinitionSchema, defineStack } from '../stack.zod';
import { reportForm } from './report.form';
import { JoinedReportBlockSchema, ReportSchema, defineReport } from './report.zod';

const ENTRY_ID = 'ui-report-joined-block-dataset-required';
Expand Down Expand Up @@ -245,6 +246,22 @@ describe('the joined reports measured at the census parse unchanged', () => {
});
});

describe('the report form offers a block\'s `dataset` as the dataset picker, marked required (#21714)', () => {
it('the "Joined blocks" repeater\'s `dataset` row declares `widget: \'ref:dataset\'` and `required: true`', () => {
// Studio's report inspector renders this row spec: the widget hint picks
// the cell's control, and `required` draws the column's marker and the
// cell's `aria-required`. Without both, a new block is a free-text cell the
// refusal above rejects on save.
const blocks = (reportForm.sections as any[])
.flatMap((s) => s.fields ?? [])
.find((f: any) => f?.field === 'blocks');
expect(blocks?.type).toBe('repeater');
const row = (blocks.fields as any[]).find((f) => f?.field === 'dataset');
expect(row?.widget).toBe('ref:dataset');
expect(row?.required).toBe(true);
});
});

describe('the ADR-0087 ledger', () => {
it('registers one D3 entry at protocol 18, with no D2 conversion, prescribing the binding', () => {
const entries = MIGRATIONS_BY_MAJOR[18]!.semantic.filter((e) => e.id === ENTRY_ID);
Expand Down
6 changes: 5 additions & 1 deletion packages/spec/src/ui/report.form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const reportForm = defineForm({
// A `chart` input sat here until #20161: the key was removed from
// `JoinedReportBlockSchema` because no renderer ever drew a block
// chart, so this control offered a setting that plotted nothing.
{ field: 'dataset', label: 'Dataset' },
// #21714: a joined report refuses a block that binds no `dataset`
// (#21702), so this column declares the `ref:dataset` picker the
// top-level binding declares, marked required: a block is bound
// in the form before save.
{ field: 'dataset', label: 'Dataset', widget: 'ref:dataset', required: true },
{ field: 'rows', label: 'Rows' },
{ field: 'columns', label: 'Columns' },
{ field: 'values', label: 'Values' },
Expand Down
Loading