Repository navigation
feat(plugin-kanban,plugin-calendar): declare the filter input both renderers read - #8186
Conversation
…enderers read objectui#7712 — ADR-0049 enforce-or-remove, resolved toward DECLARE. Both `ObjectKanban` and `ObjectCalendar` send an authored `filter` to the query as `$filter`, and `@objectstack/spec`'s `ComponentPropsMap` declares the key on both blocks. None of the four registrations that publish those two renderers listed it in `inputs`, so `sdui-parser`'s `validateTree` reported `unknown-prop` on the html tier for the one spelling that works — objectui#6678's shape, where a correct write draws the same diagnostic as a write that does nothing. Declared `type: 'array'` on all four, matching `object-grid`'s `GRID_QUERY_INPUTS` and `object-metric`. Hand-declared per key against the spec rather than derived from the neighbouring `ElementDataSourceMapping`: that mapping also carries kanban's `limit`, which the spec's strict props schema refuses by name, so a mechanical derivation would publish a key the save gate rejects. Pinned in both packages against a manifest built from the LIVE registry, with a genuinely-unknown prop as the control on the same call, plus the spec's own key verdict. Docs: the `filter` row the two plugin pages omitted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract review — PASS. Clause-② binds and clears. Held only on CI convergence.PM seat, session Clause-② fires on the accept/reject leg — The dev corrected my dispatch twice, and both corrections verified① Four registrations, not the six my order named. I passed along a count from an earlier seat without measuring it. Verified independently: Declaring ② The "derive inputs from the mapping" idea — which I relayed as a promising direction — was measured and correctly REJECTED. I read the mapping myself: const OBJECT_KANBAN_DATA_SOURCE: ElementDataSourceMapping = {
filter: true,
limit: 'limit', // ← the reason derivation fails
…Deriving inputs from that bag would also publish The Also right
⭐ The most valuable thing filed here is #8176The console's reverse-direction parity gate ( Grades applied: #8171
Held only on CI convergence: at review time Generated by Claude Code |
…n filter (objectui#10666) (objectstack-ai#10729) Fixes objectstack-ai#10666 Clause-②: yes — `@object-ui/react` gains one hook export, `useResolvedFilter`. It is additive, and existing callers are unchanged. This is the sweep half of the family closure card, under seat answer B (comment 5838380906) and the re-scoped claim 5838679906. PR objectui#10705 fixed `object-gallery` (part 1). This PR fixes the eleven remaining census nodes and closes the card. ## What changed **One shared hold, exported from `@object-ui/react`.** `useResolvedFilter(filter, scope)` sits beside `useFilterScope`. It is `plugin-list`'s `useResolvedAuthoredFilter` together with its comparator `isSameAuthoredFilter`, moved into `packages/react/src/hooks/useResolvedFilter.ts` (git records a rename). The plugin-list module is deleted, and `ListView` and `ObjectGallery` import the shared hook. The hold, its key (the authored filter compared by structure, plus the scope's three members read one by one) and the comparator are unchanged. `@object-ui/react` already depended on `@object-ui/core`, so it can import `resolveFilterPlaceholders` directly. - **One addition to the hold (a fork, see below).** A filter that the resolver leaves unchanged (it has no token, or only tokens the scope cannot resolve) is handed out as the authored value itself. The resolver's structurally equal copy is not used. So a token-free filter reaches `$filter` by identity, as it did before. - **Docs.** The hook has JSDoc, and `packages/react/README.md` has a new "useFilterScope / useResolvedFilter" section. `check:readme-exports --list` judges both names `real`. **The eleven nodes.** Each node now reads its own filter through the hold. The query and the fetch effect's key read the held value, never the raw filter. | node | file | what now reads the held value | |---|---|---| | `object-calendar` | `plugin-calendar/src/ObjectCalendar.tsx` | the object `find`, the inline `ValueDataSource` `find`, and the effect deps | | `object-gantt` | `plugin-gantt/src/ObjectGantt.tsx` | `reload`'s `find`, and both dependency lists | | `object-kanban` | `plugin-kanban/src/ObjectKanban.tsx` | the `find`, and the effect deps | | `object-map` | `plugin-map/src/ObjectMap.tsx` | the object and inline `find`s, the committed-query key, and the effect deps | | `object-timeline` | `plugin-timeline/src/ObjectTimeline.tsx` | the `find`; `filterKey` (already a content key) is now taken over the held value | | `object-tree` | `plugin-tree/src/ObjectTree.tsx` | the object and inline `find`s, and the effect deps | | `record:related_list` | `plugin-detail/src/RelatedList.tsx` | `toFilterNodeSafely` and `filterKey`, before the merge with the parent scope | | `record:line_items` | `plugin-form/src/LineItemsPanel.tsx` | `toFilterNodeSafely` and `filterKey`, before the merge with the parent scope (no save-in-flight hunk is touched) | | `element:repeater` | `components/src/renderers/basic/data-list.tsx` | `query.$filter` and `filterKey` | | `element:number` | `components/src/renderers/basic/elements.tsx` | the `aggregate` filter, the `find` fallback's `$filter`, and `filterKey` | | `element:record_picker` | `components/src/renderers/basic/record-picker.tsx` | the winning `composed?.filter ?? props.filter`, then `$filter` and `filterKey` | **`@object-ui/types`, prose only.** The `filter` docblocks on `ObjectMapSchema`, `ObjectTreeSchema`, `ObjectGanttSchema`, `ObjectCalendarSchema`, `ObjectKanbanSchema`, `ObjectChartSchema` and `ObjectGallerySchema` used to say "forwarded verbatim as `$filter`". They now say the context tokens are resolved first. The five matching zod `.describe()` strings and one import comment were changed the same way. No type changed. **Changeset:** `.changeset/10666-filter-token-sweep.md`: `@object-ui/react` minor, `@object-ui/types` patch, and each node package patch (`plugin-calendar`, `plugin-gantt`, `plugin-kanban`, `plugin-map`, `plugin-timeline`, `plugin-tree`, `plugin-detail`, `plugin-form`, `plugin-list`, `components`). None is major. ## The pin table: red, then green `apps/console/src/__tests__/filterContextTokensSweep-10666.test.tsx` is one `describe.each` table with 18 rows and 4 cells per row. It lives in `apps/console` because that is the one package that declares all nine node packages (the objectui#4409 dependency-direction method). Each row renders the directly authored node through the real `SchemaRenderer` and its package registration, under `FilterScopeProvider` (`usr_42`, `org_7`), over a data source that records every query. For the inline paths, a spy on `ValueDataSource.prototype.find` records the queries instead. The four cells are: - USER: `{current_user_id}` goes out resolved, and the whole query equals the query the literal id sends. - ORG: `{current_org_id}` goes out resolved. - CONTROL: a token-free filter goes out unchanged (for a pass-through node, it deep-equals the authored filter). - REBUILD: three re-renders that each rebuild an equal token filter add no query. The pins-only commit `5ae7e1159d` ran against the unfixed code: 38 failed, 34 passed (exit 1). The fix is `69d68598df`. | row | red at `5ae7e1159d` | green at head | |---|---|---| | object-calendar (object) | USER, ORG, REBUILD | 4/4 | | object-calendar (inline) | USER, ORG, REBUILD | 4/4 | | object-gantt | USER, ORG, REBUILD | 4/4 | | object-kanban | USER, ORG, REBUILD | 4/4 | | object-map (object) | USER, ORG, REBUILD | 4/4 | | object-map (inline) | USER, ORG, REBUILD | 4/4 | | object-timeline | USER, ORG | 4/4 | | object-tree (object) | USER, ORG, REBUILD | 4/4 | | object-tree (inline) | USER, ORG, REBUILD | 4/4 | | record:related_list | USER, ORG | 4/4 | | record:line_items | USER, ORG | 4/4 | | element:repeater | USER, ORG | 4/4 | | element:number (aggregate) | USER, ORG | 4/4 | | element:number (find fallback) | USER, ORG | 4/4 | | element:record_picker | USER, ORG | 4/4 | | object-gallery (regression) | none | 4/4 | | object-grid (regression) | none | 4/4 | | list-view (regression) | none | 4/4 | - The token cells failed on the literal. An example failure: "object-kanban sent the literal token: expected '[["owner","=","{current_user_id}"]]' not to contain '{current_user_id}'". - The REBUILD cells failed only on the nodes whose fetch effect keyed on the filter's identity. An example: "object-calendar (object) re-queried on a re-render that changed nothing: expected 4 to be 1". - The nodes that were already keyed by content passed REBUILD on base, as expected. Those are timeline, related_list, line_items and the three elements. - CONTROL was green on every row on base, so token-free behaviour is pinned as unchanged. At head `507214a742` (after merging `origin/main`), the table passed 72/72 in one run with the hook test, both objectui#10607 pins, the gallery pin, all four objectui#10657 masked-column pins, the objectui#8176, objectstack-ai#7711 and objectstack-ai#9136 member pins, and the machine-locale census: 13 files, 172 tests passed, exit 0. **Hook unit test.** `packages/react/src/hooks/__tests__/useResolvedFilter.test.tsx` has 10 cells: - it resolves the user and org tokens; - the same reference comes back across same-input re-renders, and across equal rebuilds; - `{now}` is held; - it re-resolves on a change of structure, and on a change of a scope member; - a token-free filter comes back as the authored value, and a resolved one comes back as a new value; - an absent filter passes through; - an unresolvable token stays in place and draws the shared warning. ## Ablation on the shared hook `ablation-replace.mjs` replaced `return held.resolved as T;` with the bare per-render `return resolveFilterPlaceholders(authored, scope) as T;`. - The anchor went from 1 hit to 0, and the blob went from `372374462041` to `8468e2e161e7`. - The run covered the pin table and the hook test: 45 failed and 37 passed (exit 1). - On every identity-keyed node row (calendar, gantt, kanban, map and tree, each on both paths) and on the gallery and list-view regression rows, every cell went red, REBUILD included. The copy minted on every render re-queried without end, which gave "issued no query" readings and 15000ms timeouts. - `object-timeline` USER went red once. - The content-keyed rows stayed green: related_list, line_items and the three elements. There the JSON content key, not the hold, is what keeps the fetch steady. - In the hook test, the four stability cells went red (for example "expected [ [ 'owner', '=', 'usr_42' ] ] to be [ [ 'owner', '=', 'usr_42' ] ]"). - Restore: the blob after restore was `372374462041`, equal to HEAD, and `git diff HEAD` was empty. - `@object-ui/*` resolves to `src/` through the root vitest alias, so this ablation has no `dist/` leg. ## The fork (flagged for the seat) The existing member pins read `$filter` BY IDENTITY: objectui#8176 on `object-kanban` (3 cells), objectui#7711 on `object-calendar` (3 cells) and objectui#9136 on `object-tree` (1 cell). `resolveFilterPlaceholders` copies arrays, so with the hold moved exactly as it was, those 7 cells went red on a token-free filter. - **Taken, option B:** the hold hands out the authored value whenever the resolver changed nothing (one structural comparison per resolution, which runs only when the inputs change). A token-free filter now reaches the query exactly as before, by identity, and no existing pin was edited. - **Not taken, option A:** move the hold byte for byte and relax those 7 cells to `toEqual`. That would weaken pins whose authors chose `toBe` on purpose. The one existing test that was edited is the objectui#8174 SOURCE pin in `packages/types`. It looked for the literal text `$filter: schema.filter` in the kanban and calendar sources, and it now reads both halves of the new chain: `useResolvedFilter(schema.filter, filterScope)` and `$filter: queryFilter`. ## Verification at head `507214a742` Heavy runs went through the shared verify lock. - **Build.** `turbo run build` over the dependency closure of the 12 touched packages: 14 tasks successful. - **Type-check.** `pnpm --filter` over the 12 touched packages, `run type-check`: 12 Done, exit 0. `react`'s `tsconfig.test.json --listFilesOnly` lists the new hook test once. - **Full package suites**, all exit 0: - After the final merge: `plugin-detail` (214 files passed and 1 skipped; 2102 tests passed and 8 skipped); `plugin-form` plus `types` (368 files; 6747 tests passed and 1 skipped); and `components` in two halves (renderers, notifications and ui: 135 files, 1289 tests passed and 10 skipped; `__tests__`: 177 files passed and 1 skipped, 1767 tests passed and 7 skipped). - After the first merge: `plugin-calendar`, `plugin-gantt` and `plugin-timeline`, in one run with `types` and the pins. - Before either merge: `react`, `plugin-kanban`, `plugin-map`, `plugin-tree` and `plugin-list`. Neither merge changed a source file in these packages. - **Gates**, each exit 0: `check:changeset-claims` (report-only), `check:pending-changeset-literals`, `check:new-line-citations` (0 new), `check:control-bytes`, `check-changeset-presence` (20 source files of 13 released packages, 1 changeset), `changeset:check` (no major), `check-changeset-overwrite` (1 added, 0 modified), `check:vi-mock-specifiers`, `check:vi-mock-inherit`, `check:vi-mock-override-shape`, `check:phantom-deps`, `check:self-import`, `check:test-path-roots`, `check:unreferenced-sources`, `check-type-check-coverage`, `check:side-effects-array`, and `check-governed-queue-guard --test` (NOT GOVERNED, 22 paths). - **README exports.** `check:readme-exports --list` judges `useFilterScope` and `useResolvedFilter` in `packages/react/README.md` `real`. The whole-tree run exits non-zero only because 22 packages were not built in this worktree (0 fabricated after the rebuild), so the whole-tree verdict is NOT MEASURED. - **eslint**, plain form, on the 20 changed TS files: 0 errors. Warnings, merge-base against head: unchanged in every modified file except `record-picker.tsx`, which went from 11 to 10. The new files have 0, except the pin table, which has 1. - **NOT MEASURED:** `check:eager-closure` and `check:sdui-registration-pins` (both need a console production build); repo-wide `pnpm lint` and the full test farm, which belong to CI. ## Merges Two merges of `origin/main`: - `bd254f7637`: one import-line conflict in `RelatedList.tsx`, resolved as a union. It keeps objectui#10690's `useSettledSchema` and adds `useFilterScope` and `useResolvedFilter`. - `507214a742`: brings in objectui#10657 (masked columns). It merged with no conflict, and both behaviours hold: `RelatedList`'s `masked` column stamping, and its held resolved scope filter. Draft PR objectui#10650's save-in-flight hunks in `LineItemsPanel.tsx` are not touched. This PR changes only the `filter` read there. ## Acceptance notes - **Fewer queries, by design.** On the five identity-keyed nodes, a host that rebuilds an equal filter inline no longer re-queries. A structurally different filter, or a new user or organization, still re-queries. - **Date macros** in these nodes' own filters now resolve on the client, in the browser's local time, as they already do for `list-view`, `object-grid` and `object-view`. Before, the server resolved them in the tenant's time zone. - **The second copy.** `plugin-grid`'s `ObjectGrid.tsx` still holds its own copy of the hold and the comparator (`useResolvedGridFilters`, from PR objectui#10656). The claim did not cover that file. It could become `useResolvedFilter({ filter, defaultFilters }, scope)`, with the same behaviour. - **Stale prose outside this surface.** Some sentences now describe the old read: pending changesets from objectui#8174 and objectstack-ai#8186 describe the renderers as "lowering `schema.filter` onto `$filter`"; the objectui#8176 pin's header says "nothing between the schema and that call reads a member key"; and `content/docs/api/schema-reference.md` still carries "forwarded verbatim as `$filter`" in its `ObjectKanbanSchema` table. None of these was edited here. - **Against ObjectStack**, the server also expands `{current_user_id}` for a signed-in request, so there this is defence in depth. The session behind this change is `https://claude.ai/code/session_01D486C1axmXnrkJMNUfz2eb` (domain:ui seat 3, dispatched dev). --- _Generated by [Claude Code](https://claude.ai/code/session_01D486C1axmXnrkJMNUfz2eb)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #7712
ADR-0049 enforce-or-remove on
filter, resolved toward declare. Both renderers read the key,@objectstack/specdeclares it, and only the registrations were missing it — so the registrations are what moved.What changed
Four registration
inputslists gain one entry each,{ name: 'filter', type: 'array', description: … }:packages/plugin-kanban/src/index.tsx—plugin-kanban:object-kanbanandview:kanbanpackages/plugin-calendar/src/index.tsx—plugin-calendar:object-calendarandview:calendarPlus a pin per package, the
filterrow the two plugin doc pages omitted,@object-ui/sdui-parserdeclared in both packages' devDependencies (the pins import it;tsccaught that it was undeclared,check:phantom-depsagrees), and a changeset (minoron both packages — this repo forbidsmajor).needs:contract-review(Clause-② = yes)Adding an
inputsentry changes what a published authoring tier accepts: a key rejected today stops being rejected. The label is attached and this PR stays draft — the PM lands it.The narrower reading is on the record too, because it is what the measurements support: the spec already declares
filteron both blocks, so this restores declared = enforced rather than widening past the contract.ComponentPropsMap['object-kanban']and['object-calendar']bothsafeParsean authoredfiltertosuccess: true, while the same strict schemas refuse an undeclared control key by name on the same call.Premise verification — measured vs claimed
Everything in the card, its triage and the dispatch was re-measured on
origin/main9bfd618before the first edit. The premise holds, with three corrections.schema.filterObjectKanban.tsx:363,ObjectCalendar.tsx:478(dep arrays:391/:514)safeParse, not the.d.ts: accepted on both; control key refused on the same callunknown-proptodayTAG has no prop "filter"on both kanban tagsObjectKanban.tsx:263/ObjectCalendar.tsx:454; measured 363 / 478. Register-call anchors also moved (:208 :313 :420 :434to:208 :307 :414 :427; theinputs:lines are:216 :348 :421 :434, which is what the second seat measured)The
filter: truetrap did not catch this seat. Measured on9bfd618:plugin-kanban/src/index.tsx:390,plugin-calendar/src/index.tsx:66and theplugin-grid/src/index.tsx:76that triage cited are allElementDataSourceMappingconstants, not registrationinputs. The correct control isplugin-grid/src/index.tsx:218—{ name: 'filter', type: 'array', description: … }— andplugin-dashboard/src/index.tsx:207is a second one. The four entries added here are that shape.Correction to row 6, and why it matters.
plugin-kanban/src/index.tsxregisters four tags, but only two are served byObjectKanbanRenderer.kanban-uiandkanban-enhancedare the static-column board (KanbanRendererand an inline renderer), which never readschema.filter, andComponentPropsMapcarries no row for either. Declaringfilterthere would publish a key nothing reads — this defect in the other direction. So the edit is 2 + 2 tags. The dispatch's "six registrations" is the count of registrations in the two files, not the count that reads the key.Why hand-declared, not derived from the mapping
The suggestion was to derive the
inputsentry from theElementDataSourceMappingbeside these registrations, the wayregister()derives thedataSourceinput (objectui#6678). Measured, that derivation is wrong here:OBJECT_KANBAN_DATA_SOURCEalso carrieslimit, andComponentPropsMap['object-kanban']refuseslimitby name (unrecognized_keys: ["limit"]). Emitting it would publish a key the save gate cannot store and put the manifest at odds with the manifest-to-spec parity check. So each key is declared against the spec, per key — which is what the per-key check asked for.Evidence
Reproduction (before the fix) — the kanban pin, 4 failed / 3 passed. The three that passed are the controls (a genuinely unknown prop is reported on both tags; the spec's key verdict), so the red rows were the declaration and nothing else.
After the fix — dependency-closure build exit 0; both full package suites green (
plugin-kanban26 files / 137 tests,plugin-calendar26 files / 152 tests);type-checkgreen in both packages, including each one'stsconfig.test.json, so the pins are compiled and not merely executed; the two pins re-run on the final HEAD, 2 files / 14 tests.Ablation — with the fix committed, the
object-kanbandeclaration was mutated on disk (name: 'filter'toname: 'filterZZZ', first occurrence). The mutation was proved to have landed before anything was read: anchor counts 2 to 1 and 0 to 1, plus a changedgit hash-object(e2006771…tofe9930c2…). The pin then went RED — 2 failed / 5 passed, and the two reds are exactly theobject-kanbanrows whileview:kanbanstayed green, which is what makes the pin per-tag rather than per-file. Restore was proved by state, not by an exit code:git hash-objectequal togit rev-parse HEAD:packages/plugin-kanban/src/index.tsx, an emptygit diff HEAD, and the anchors back at 2 / 0. That blob hash is still the one at this PR's HEAD, so the ablation is re-checkable against what you are reading.No build is needed for any of that to be honest: the root
vitest.config.mtsaliases@object-ui/*to each package'ssrc, so a staledistcannot make the ablation falsely green.Left to CI, declared:
check:doc-snippetsandcheck:spec-floorsboth need a whole-workspace build (spec-floorsreports 12no-artifactfindings, every one of them a package this branch never built, none about this diff), andcheck:sdui-registration-pinsweighs a built console bundle.⭐ The blind spot this does NOT close (named, as the triage asked)
check:react-blocks-declaration-parityruns manifest to spec. A key the spec declares and the manifest omits is structurally outside what it ratchets, so fixing these four registrations does not make the next omission loud.This PR adds a measurement the triage did not have: the console does carry the reverse direction (
apps/console/src/__tests__/registry-inputs-spec-parity.test.ts,undiscoverableSpecKeysat:387), and it could not see this defect either. Itscoveredset is built fromComponentRegistry.getConfig, which reads loaded registrations only (Registry.ts:649), while the console registers every plugin block withregisterLazy(register-plugins.ts:107-:129). So both blocks were unjudged and uncounted. Filed as #8176 with the one-line verification. ⛔ Not ridden on this PR.Out-of-scope findings, filed unassigned (⛔ not folded in)
object-calendarregistrations declare nosortinput whileObjectCalendarreadsschema.sortand the spec declares it — #7712's defect, one key over #8171 —object-calendaromitssorton the same two registrations: spec-declared, renderer-read (ObjectCalendar.tsx:479), the same defect one key over. The positive half of the per-key measurement.ObjectKanbanSchemateachlimiton anobject-kanban, the renderer reads it as$top— and the spec's strictComponentPropsMaprefuses it by name #8172 — kanban'slimit: the docs (a whole section atplugin-kanban.mdx:151),ObjectKanbanSchemaand the renderer all say yes; the spec's strict props schema refuses it by name. A contract decision, not a renderer patch. The negative half.ObjectKanbanSchemaandObjectCalendarSchemadeclare nofilter(and nosort) — the fourth face of the key #7712 declares everywhere else #8174 —@object-ui/typesdeclares neitherfilternorsortonObjectKanbanSchema/ObjectCalendarSchema— the fourth declaration face, bounded honestly against finding(types):BaseSchemacloses with[key: string]: any(packages/types/src/base.ts:467), so NO annotation on any node schema can catch a misspelled metadata key — measured green by a planted probe while the type, optionality and payload-member probes all went red #7927.registry-inputs-spec-parity's reverse direction judges only EAGERLY registered blocks, so every lazily-registeredobject-*plugin block sits outside it — the structural reason #7712 was invisible to both ratchets #8176 — the console parity gate's lazy-registration blind spot, above.Name-collision check
This change exports no new name: it adds object literals inside existing
inputsarrays plus two test files.filterhere is an input name in a registration — the same keyobject-grid,object-metric,record:related_listandplugin-listalready publish — not an exported symbol, so there is no second authority to collide with,export *re-exports included.🤖 Generated with Claude Code
https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
Generated by Claude Code