Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit dcbf0b2

Browse files
os-warrenclaude
andauthored
feat(types,plugin-kanban): execute the batch #70 ruling on the kanban arm (#8799)
* feat(types,plugin-kanban): execute the batch #70 ruling on the `kanban` arm Retire `allowCollapse` / `cardTemplates` / `columnWidths` (declared on both faces, read by no registered board) and `titleField` (the legacy spelling of `cardTitle`; the `object-kanban` arm keeps its own) as named refusals on both faces. Declare `navigation`, which `ObjectKanban` reads and no face named, on the gantt precedent objectui#5903 — the `(schema as any)` cast goes. Move `objectFields` off the schema bag onto `KanbanRendererProps` as a real React prop: an internal channel from the one caller that fetched the object definition, not an authoring surface. Fixes #7742 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jmxdo7bmeqCQHLSfmLVX9w * test(types,plugin-kanban): pin both accept-set directions and the objectFields channel The batch #70 ruling moves the `kanban` arm's accept set in both directions in one change, so a file that pinned only one half would pass on a change that forgot the other. Every refusal is asserted at its own path with an undeclared key on the same parse as the control (a `.passthrough()` object accepts unknown keys, so "the document failed" proves nothing alone), `navigation` is asserted to JUDGE its value rather than merely admit it, and the sibling `object-kanban` arm is asserted to still accept `titleField`. The `objectFields` pin discriminates the two channels behaviourally through an outcome only the field catalogue can produce, with the prop leg asserted first as the firing control for the schema leg's negative. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jmxdo7bmeqCQHLSfmLVX9w * docs(plugin-kanban,changeset): scope the `objectFields` claim to the `kanban` arm The move takes `objectFields` off the schema READ PATH, and on the ruled `kanban` arm that closes the key outright — `ObjectKanbanRenderer` serves that type key and discards its rest-spread (`void _props;`). It does NOT make the key author-unreachable in general: `objectFields` is absent from `SchemaRenderer`'s stripped-metadata list, so on the schema-only `kanban-ui` entry an authored value survives the generic prop spread and lands on the very prop this change introduced. Measured through the real `SchemaRenderer` — a `kanban-ui` node with an authored `objectFields` paints the card; the same node without it, and the same document as `type: "kanban"`, do not. Three texts read as if the general claim held, and the changeset is the one that ships: a changeset is this PR's input to the release notes, so a measured-false claim there becomes a release note. All three now state the scope at the arm level rather than dropping the claim: - .changeset/7742-kanban-arm-batch70.md - the KanbanRendererProps docblock in packages/plugin-kanban/src/index.tsx - the pin file's docblock, and the pin file's NAME Renamed objectFieldsIsNotAuthorable-7742.test.tsx to objectFieldsIsAPropNotASchemaKey-7742.test.tsx. Its describes were always accurate; only the filename claimed the generality the measurement refutes, and a filename is the widest-reach text here — it prints in every vitest run and in every file listing. Nothing in the repo referenced the old path, the two imports are same-directory relative, and check-type-check-coverage enumerates test files from the package root, so coverage is re-derived from disk (42/42 packages). Also corrects the countsAreWindowed docblock, whose "same shape as objectFields above" pointer this PR's own move had inverted, and the stale "Absent on the schema-only kanban-ui entry" line that the new scope paragraph contradicted. Wording only: no behaviour, no refusal, no declaration, no pin assertion and no ablation leg is touched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jmxdo7bmeqCQHLSfmLVX9w --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b89583b commit dcbf0b2

9 files changed

Lines changed: 651 additions & 58 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
'@object-ui/types': minor
3+
'@object-ui/plugin-kanban': minor
4+
---
5+
6+
**BREAKING (scored `minor` per this repo's version-alignment convention)** — the
7+
`'kanban'` arm retires four accepted spellings and declares one read it never
8+
named (objectui#7742, ADR-0049, maintainer decision batch #70, 2026-09-07:
9+
「同意」).
10+
11+
The accept set moves in **both** directions in one change, which is why the PR
12+
carries `needs:contract-review`.
13+
14+
## Narrowing — four keys the `'kanban'` arm no longer accepts
15+
16+
Each is a `?: never` tombstone on the TypeScript face and a named refusal arm on
17+
the `@object-ui/types/zod` mirror, so a document that names one is **refused by
18+
name** with the remedy in the message. ⛔ None is dropped instead of refused:
19+
`BaseSchema` is `.passthrough()`, so a dropped key is *kept*, not refused — the
20+
failure objectui#7664's own first cut shipped at `onCardClick`.
21+
22+
- **`allowCollapse`, `cardTemplates`, `columnWidths`** — declared on both faces
23+
since the dialect was carried over, and read by **no registered board**.
24+
Re-measured for this change over `packages/plugin-kanban/src`, every file
25+
including tests: 0 hits / 0 files each, with `groupBy` (85 hits / 27 files),
26+
`cardTitle` (18/9) and `coverImageField` (17/3) firing as controls on the same
27+
instrument. An author who wrote `allowCollapse: true` validated green and got
28+
a board that never collapsed off that key. Each capability exists on a
29+
*different* channel, and the refusal message names it: a lane's own
30+
`columns[].collapsed` for collapsing, a `templates` component prop for card
31+
templates, a `useColumnWidths` hook option for widths. Wiring a board-level
32+
switch to any of them would be new behaviour and is not ordered here.
33+
`CardTemplate` and `ColumnWidthConfig` stay exported — the prop and the hook
34+
still consume the types.
35+
- **`titleField`** — ⚠️ **not** an inertness retirement, and reading it as one
36+
gets the mechanism backwards. `ObjectKanban` still reads the key and the read
37+
stays, because the **sibling `object-kanban` arm declares it and keeps it**
38+
(objectui#7322 item ②). What retires is *this* arm's acceptance of the legacy
39+
spelling: one arm, one spelling, and the refusal points at `cardTitle`. A
40+
`type: "object-kanban"` document naming `titleField` still validates and still
41+
renders; a `type: "kanban"` one is now refused. The key was never declared on
42+
this face before — it rode `BaseSchema`'s index signature — so this is the
43+
first time this face judges it at all.
44+
45+
## Widening — one key the board reads and no face named
46+
47+
- **`navigation`** is now declared on `KanbanSchema` (both faces), on the gantt
48+
precedent objectui#5903. `ObjectKanban` reads it to choose the record-detail
49+
overlay mode and defaults it to a drawer; until now an authored overlay mode
50+
rode `BaseSchema`'s `[key: string]: any` — admitted, never examined — and the
51+
read site had to spell itself `(schema as any).navigation`. That cast is gone.
52+
The member list is `@objectstack/spec`'s `NavigationConfig` by reference, not
53+
restated, so the vocabulary cannot fork.
54+
55+
## `@object-ui/plugin-kanban` — `objectFields` moves from the schema bag to a React prop
56+
57+
`objectFields` (the fetched object's field definitions, which card conditional
58+
formatting needs so a rule comparing a relation sees the stored foreign key) is
59+
now a **React prop on `KanbanRendererProps`**, a sibling of `schema`, rather than
60+
a member of the `schema` bag. `ObjectKanban` — the one caller that fetches the
61+
object definition — injects it there. Callers that render `KanbanRenderer`
62+
directly and passed `objectFields` inside `schema` must move it to the prop.
63+
64+
⚠️ **What this closes, stated at the arm level** — measured through the real
65+
`SchemaRenderer`, not assumed. It closes the *schema read path*, and on the
66+
`'kanban'` arm that closes the key outright: `ObjectKanbanRenderer` serves that
67+
type key and discards its rest-spread (`void _props;`), so an authored
68+
`objectFields` on a `type: "kanban"` node reaches nothing. It does **not** make
69+
`objectFields` unreachable to an author in general. On the schema-only
70+
`'kanban-ui'` entry, which `KanbanRenderer` serves directly, the key is absent
71+
from `SchemaRenderer`'s stripped-metadata list, so it survives that renderer's
72+
generic prop spread and arrives on the very prop this change adds — an authored
73+
`objectFields` still reaches `resolveConditionalFormatting` there, as it did
74+
before, and no schema face declares or judges it. Closing that entry is a
75+
separate change and is not made here.

‎content/docs/api/schema-reference.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,15 +973,15 @@ A static board carries its cards inline:
973973
| `columns` | `KanbanColumn[]` | Lanes, each with `id`, `title`, `cards`, and optional `limit` / `className` / `collapsed`. A card has `id`, `title`, optional `description` and `badges`. |
974974
| `quickAdd` | `boolean` | Show a Quick Add button at the bottom of each column. |
975975
| `coverImageField` | `string` | Field whose URL renders as the card cover image. |
976-
| `allowCollapse` | `boolean` | Allow columns to be collapsed. |
977976
| `conditionalFormatting` | `KanbanConditionalFormattingRule[]` | Card colouring rules — native `{ field, operator, value }` or spec `{ condition, style }`. |
978-
| `cardTemplates` | `CardTemplate[]` | Predefined quick-add templates. |
979-
| `columnWidths` | `ColumnWidthConfig` | Column width configuration. |
980977
| `grouping` | `GroupingConfig` | ListView grouping config; its first field is the swimlane fallback. |
978+
| `navigation` | `ViewNavigationConfig` | Record navigation behaviour when a card is clicked (drawer / dialog / page). Defaults to an inline right-side drawer. |
981979
| `onCardMove` | `function` | Runtime slot supplied by a React host, `(cardId, fromColumnId, toColumnId, newIndex)`; not authorable in JSON. |
982980
| `onCardClick` | `function` | Runtime slot supplied by a React host, `(card, event?)`; not authorable in JSON. On the object-bound board the host's handler runs alongside the record-detail overlay. |
983981
| `onQuickAdd` | `function` | Runtime slot supplied by a React host, `(columnId, title)`; not authorable in JSON. |
984982

983+
> Four spellings the `kanban` arm once accepted are now refused by name (objectui#7742, ADR-0049). `allowCollapse`, `cardTemplates` and `columnWidths` were declared and read by no registered board — collapse a lane with `columns[].collapsed`; card templates and column widths reach the board through a component prop and a hook option, not through the node. `titleField` is the legacy spelling of `cardTitle` and is retired on this arm only: write `cardTitle`. An `object-kanban` node still accepts `titleField`.
984+
985985
> The former `@object-ui/types` kanban dialect — `DeclarativeKanbanSchema`, with a board-level `draggable`, a column `color` and card `labels` / `priority` — was retired in objectui#7664: no registered renderer read it, so a board written that way validated and rendered empty. `draggable` and a column `color` are now refused by name; a static board written with `columns[].cards[]` as above is the same document in both dialects and renders every card.
986986
987987
**Related:** [ObjectViewSchema](#objectviewschema), [ObjectGridSchema](#objectgridschema)

‎packages/plugin-kanban/src/ObjectKanban.tsx‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,10 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
902902
// CLOSED, not open — do not re-open it as a cleanup. If bucket-vocabulary
903903
// unification ever becomes a product direction that is a fresh ruling,
904904
// with visual-regression evidence across all four surfaces in one stroke.
905-
const navConfig = (schema as any).navigation ?? { mode: 'drawer' };
905+
// `navigation` is DECLARED on `KanbanSchema` since objectui#7742 (gantt
906+
// precedent objectui#5903), so this read is typed rather than cast. It stayed
907+
// `(schema as any)` for exactly as long as no schema face named the key.
908+
const navConfig = schema.navigation ?? { mode: 'drawer' };
906909
// When this kanban is embedded in an ObjectView, the parent provides
907910
// `onRowClick`/`onCardClick` and owns the unified record-detail overlay.
908911
// We must always forward to the parent in that case — otherwise we'd open
@@ -1143,23 +1146,30 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
11431146

11441147
return (
11451148
<>
1146-
<KanbanRenderer schema={{
1147-
...effectiveSchema,
1149+
<KanbanRenderer
11481150
// Card conditional formatting evaluates against the card record, and
11491151
// this fetch expands relations (`buildExpandFields` above) exactly as
11501152
// the grid's does. Handing the renderer the object's field types is
11511153
// what lets a rule comparing a relation see the stored foreign key
11521154
// instead of the expanded record (objectui#3501).
1153-
objectFields: objectDef?.fields,
1154-
// objectui#8307 — the lane headers count rows that came back, so when
1155-
// the fetch saturated its window they must say `77+`, not `77`.
1156-
countsAreWindowed,
1157-
onCardClick: (card: any, event?: any) => {
1158-
navigation.handleClick(card, event);
1159-
onCardClick?.(card);
1160-
},
1161-
onCardMove: handleCardMove,
1162-
}} />
1155+
//
1156+
// A PROP, not a schema key (objectui#7742, decision batch #70): it is an
1157+
// internal channel from the one caller that fetched the object
1158+
// definition, never an authoring surface. On the schema bag it was
1159+
// reachable by an author through `BaseSchema`'s passthrough.
1160+
objectFields={objectDef?.fields}
1161+
schema={{
1162+
...effectiveSchema,
1163+
// objectui#8307 — the lane headers count rows that came back, so when
1164+
// the fetch saturated its window they must say `77+`, not `77`.
1165+
countsAreWindowed,
1166+
onCardClick: (card: any, event?: any) => {
1167+
navigation.handleClick(card, event);
1168+
onCardClick?.(card);
1169+
},
1170+
onCardMove: handleCardMove,
1171+
}}
1172+
/>
11631173
{pendingMove && (
11641174
<RequiredFieldsDialog
11651175
open
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* `objectFields` is a PROP, no longer a key read off the `schema` bag
11+
* (objectui#7742, ADR-0049, maintainer decision batch #70, 2026-09-07).
12+
*
13+
* ## What moved, and why it was a defect
14+
*
15+
* `objectFields` carries the fetched object's field definitions so that a
16+
* conditional-formatting rule comparing a RELATION field sees the stored
17+
* foreign key rather than the record the board's `$expand` substituted for it
18+
* (objectui#3501). Only `ObjectKanban` can know the answer — it is the one
19+
* entry point that fetches an object definition.
20+
*
21+
* It used to travel INSIDE the `schema` bag. That made it reachable by an
22+
* AUTHOR: `BaseSchema` is `.passthrough()`, `SchemaRenderer` hands the node
23+
* down, and on the schema-only `kanban-ui` entry — which has no object schema
24+
* of its own to overwrite it with — an authored `objectFields` reached
25+
* `resolveConditionalFormatting` verbatim. No schema face declared the key, so
26+
* nothing judged it either: an author could hand the predicate layer a
27+
* fabricated field catalogue and change which cards a rule matched. Batch #70
28+
* ruled it an internal channel; it is now a React PROP, a sibling of `schema`.
29+
*
30+
* ## ⚠️ Scope — what the move closes, and what it does NOT
31+
*
32+
* It closes the SCHEMA READ PATH, which is exactly what the assertions below
33+
* pin: `KanbanRenderer` no longer reads `schema.objectFields`. On the `'kanban'`
34+
* arm that closes the key outright — `ObjectKanbanRenderer` serves that type key
35+
* and discards its rest-spread (`void _props;`), so an authored `objectFields`
36+
* on a `type: 'kanban'` node reaches nothing.
37+
*
38+
* ⛔ It does NOT make `objectFields` author-unreachable in general, and this
39+
* file must not be read as claiming that. `objectFields` is absent from
40+
* `SchemaRenderer`'s stripped-metadata list, so on the schema-only `'kanban-ui'`
41+
* entry an authored `objectFields` survives that renderer's generic prop spread
42+
* and arrives on the very prop asserted below. The tests here render
43+
* `KanbanRenderer` DIRECTLY and so never exercise `SchemaRenderer`: that entry
44+
* is measured but NOT pinned here, and closing it is a separate change.
45+
*
46+
* ## How this file discriminates, and why the fixture is shaped this way
47+
*
48+
* The two channels are told apart by an outcome that ONLY the field catalogue
49+
* can produce. The card's `owner` arrives EXPANDED (`{ _id: 'u1' }`), and the
50+
* rule compares `owner` against the bare id `'u1'`:
51+
*
52+
* - with a catalogue naming `owner` a `lookup`, `toPredicateRecord` collapses
53+
* the expanded value back to `'u1'`, the rule MATCHES, and the card is
54+
* painted;
55+
* - with no catalogue, `owner` stays an object, the rule does NOT match, and
56+
* the card is unpainted.
57+
*
58+
* So "painted" is a positive reading of the channel and "unpainted" is a
59+
* negative one — and the positive case is asserted FIRST, as the firing control
60+
* for the negative. Without it, "the schema key did nothing" would also be
61+
* produced by a fixture that never worked on either channel, which is the
62+
* failure mode this pairing exists to rule out.
63+
*/
64+
65+
import { describe, it, expect } from 'vitest';
66+
import { render, screen } from '@testing-library/react';
67+
import React from 'react';
68+
import { KanbanRenderer } from '../index';
69+
70+
// Pay the board's lazy chunk at import time, not inside a `findBy` budget
71+
// (AGENTS.md 测试纪律). The specifier stays byte-identical to the one in
72+
// `../index` — ESM caches by resolved specifier, so this is what makes that
73+
// module's own `React.lazy` factory resolve immediately.
74+
import '../KanbanImpl';
75+
76+
/** The paint the matching rule applies — a colour no other element uses. */
77+
const PAINT = 'rgb(255, 0, 0)';
78+
79+
const RULE = [{ field: 'owner', operator: 'equals', value: 'u1', backgroundColor: PAINT }];
80+
81+
/** `owner` arrives EXPANDED, the way the board's own `$expand` delivers it. */
82+
const CARD = { id: 'c1', title: 'Painted card', owner: { _id: 'u1', name: 'Ann' } };
83+
84+
/** The catalogue that makes `owner` collapsible. `lookup` is an expandable type. */
85+
const FIELD_CATALOGUE = { owner: { type: 'lookup' } };
86+
87+
const BOARD = {
88+
type: 'kanban',
89+
columns: [{ id: 'todo', title: 'To Do', cards: [CARD] }],
90+
conditionalFormatting: RULE,
91+
} as const;
92+
93+
/** The rendered card's own background, read off the element the title sits in. */
94+
async function paintOfTheCard(): Promise<string> {
95+
const title = await screen.findByText('Painted card');
96+
let el: HTMLElement | null = title;
97+
while (el) {
98+
const bg = el.style?.backgroundColor;
99+
if (bg) return bg;
100+
el = el.parentElement;
101+
}
102+
return '';
103+
}
104+
105+
describe('`objectFields` reaches the predicate layer as a PROP (objectui#7742)', () => {
106+
it('THE CONTROL — passed as a prop, the relation rule matches and the card is painted', async () => {
107+
// ⭐ Asserted first and on purpose. It proves the fixture CAN produce a
108+
// paint, so the negative below is a reading about the channel and not about
109+
// a rule that never matched on any channel.
110+
render(<KanbanRenderer schema={BOARD as never} objectFields={FIELD_CATALOGUE} />);
111+
expect(await paintOfTheCard()).toBe(PAINT);
112+
});
113+
});
114+
115+
describe('`objectFields` is no longer read off the schema bag (objectui#7742)', () => {
116+
it('an AUTHORED `objectFields` inside `schema` does not reach the predicate layer', async () => {
117+
// The same catalogue, the same rule, the same card — written where an
118+
// author can write it. It must now do nothing.
119+
render(
120+
<KanbanRenderer schema={{ ...BOARD, objectFields: FIELD_CATALOGUE } as never} />,
121+
);
122+
expect(await paintOfTheCard()).not.toBe(PAINT);
123+
});
124+
125+
it('and with neither channel supplied the card is unpainted — the paint is not unconditional', async () => {
126+
// The third leg: without it, "unpainted" above could be the board's default
127+
// for every card and would say nothing about `objectFields` at all.
128+
render(<KanbanRenderer schema={BOARD as never} />);
129+
expect(await paintOfTheCard()).not.toBe(PAINT);
130+
});
131+
});

0 commit comments

Comments
 (0)