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

Commit b45d463

Browse files
fix(types,cli): element:number validates, with the spec's dataSource waiver (objectui#10872, batch 2) (#10908)
Part of #10872 Clause-②: yes **The hold is lifted.** Seat ruling option (c), posted on objectui#10872, held this PR behind objectui#10909. That card merged as PR objectui#10944 (`dd0d78f74d`): the `element:number` renderer now reads `dataSource.object` (with `properties.filter` AND-combined with the binding's), and the registration declares `dataSource`. So the `dataSource` form this arm accepts now renders its metric. The code here was never narrowed. A base merge of `main` gave one CI run on the combined tree before landing. Batch 2 of objectui#10872: `element:number`, the one ADR-0080 public block with a spec `ComponentPropsMap` row that batch 1 held, now validates on both faces in both binding forms the spec accepts. Its row requires `object`, and the spec's props gate waives exactly that member beside a `dataSource.object`; the arm mirrors that waiver by reference. The card stays open for the blocks still held (Acceptance notes). ## What changed - **`packages/types/src/zod/public-blocks.zod.ts`**: `ElementNumberBlockSchema`, a member of `PublicBlockComponentSchema`. - `properties` is the spec row by reference with `object` alone made optional (below). - `dataSource` is declared as the spec's `ElementDataSourceSchema`, by reference through `stripImportedDefaults`. It is the same schema `PageComponentSchema.dataSource` is. - A node refinement (`elementNumberObjectIsSupplied`) restores the row's requiredness wherever the waiver does not apply. - The module docblock gains the waiver section and drops `element:number` from the held list. - **`packages/types/src/zod/index.zod.ts`**: `ElementNumberBlockSchema` is on the `./zod` barrel. - **`packages/types/src/zod/imported-defaults.ts`**: comment only. The walker docblock's `lazy` paragraph now names the one clean import it rebuilds (see "The waiver"). - **`packages/types/src/zod/README.md`**: the public-block group lists the arm. - **Ledgers**: - one `EXCLUSIONS` row in `zod-mirror-parity.test.ts`; - two `IMPORTED` rows (`ElementNumberPropsSchema`, `ElementDataSourceSchema`) in `imported-defaults-8317.test.ts`, plus `REBUILT_CLEAN` (see "The waiver"); - `element:number` added to the batch-1 pin file's measured population. - **Ratchet**: `NAMESPACED_REFUSED_AT_TYPE` falls 398 → 397 with the batch-1 messages. The bare pin stays 76. A batch-2 row names the armed key, and two in-process `objectui validate` rows cover the change end to end. - **Changesets**: - new: `.changeset/10872-element-number-arm.md` (`'@object-ui/types': minor`, the `Clause-②: yes` line); - dated notes in the objectui#10533 form, frontmatter byte-identical, on `.changeset/10872-public-block-zod-arms.md` (its "less `element:number`" and "Not armed in this release" item stop describing the release) and on `.changeset/8317-strip-imported-defaults.md` (its "identity function on a subtree with nothing to strip" no longer holds for `ElementDataSourceSchema`). - **Merge**: `origin/main` `9f0c84a448` was merged in, including objectui#10897 (Serial). ## H1: measured on `main` (`6a7f24e92`), before any edit Both forms are refused at `type`, on both faces (`safeValidateSchema`, the face `objectui validate` runs, and `StrictAnyComponentSchema`): - `{ "type": "element:number", "properties": { "object": "opportunity", "aggregate": "count" } }` gives `[{"code":"invalid_union","path":"type","message":"Invalid input"}]`, tolerant and strict alike. - `{ "type": "element:number", "dataSource": { "object": "opportunity" }, "properties": { "aggregate": "sum", "field": "amount" } }` gives the same output, tolerant and strict alike. Taught or shipped `element:number` documents, and the form each uses. Each zero was read beside a lit control on the same instrument: - **objectui**: 0 in `content/docs`, `skills`, `examples` (control: `element:text` hits `skills/objectui/rules/protocol.md`). The one producer is the page designer's block inspector (`block-config.ts` `element:number` fields): an object picker writing `properties.object`, which is the **props form**. - **objectstack `origin/main`**: 0 in `examples` (the showcase included; control: `element:text` hits 5 example page files). `content/docs/ui/pages.mdx` and `content/docs/references/ui/page.mdx` name the type in the vocabulary only, with no document. - **objectstack spec fixtures** (by test name): - "should accept element:number component" uses the **props form**; - "PageComponent dataSource integration" uses **both forms at once** (`properties.object` and `dataSource.object`); - the migration `element-number-filter-rule-array` prescribes a **props-form** bag with a rule-array `filter`. - Nothing taught or shipped uses the dataSource-only form for `element:number`. The spec gate's own dataSource-only specimen is `element:record_picker`. ## The waiver, and how it is by reference - **The spec gate**: `validateComponentProps` (`@objectstack/lint`) skips, per `DATASOURCE_SUPPLIED_PROP` / `suppliedByDataSource`, the row issue at `object` when `dataSource.object` is a non-empty string, and judges a bag only when present. Its test "does not report the required `object` prop when `dataSource` supplies it" pins that. - **The bag**: `stripImportedDefaults(ElementNumberPropsSchema).partial({ object: true })`. - zod 4's `.partial(mask)` clones the row's own def: strictness and the custom unknown-key guidance travel. The row's own registry metadata does not, because a clone sets no parent. The row has no top-level `.describe()`, so nothing is lost. - It wraps only the masked member in `ZodOptional` around the row's own `object` schema, and hands every other member through as the same object. - A pin asserts this member by member: every non-`object` member is `toBe` the row's, and `object` unwraps to the row's. - `.partial()` throws on an object carrying refinements. That is the loud answer if the spec ever adds one: the waiver is then re-decided rather than silently losing the check. The row has none on installed 17.4.0 or on objectstack `origin/main`. - **The refinement**: a bag that is a record and omits `object` is refused at `properties.object` (code `custom`, `params.code` `ELEMENT_NUMBER_OBJECT_REQUIRED`), unless `dataSource` is a record whose `object` is a non-empty string (the gate's `strName`). The message names both fixes. It runs with `when: () => true`, the `objectql.zod.ts` named-view precedent, so a missing `object` is reported beside another bag issue, as the gate reports it. - **One deliberate difference from the gate's code**: - The waiver covers an OMITTED `object`, which is how the gate's own docblock states it ("the one prop whose absence this rule does NOT report") and how this card's order states it ("may omit `properties.object`"). - The gate's `suppliedByDataSource` matches the issue by path alone, so it also passes `"object": 7` beside a binding. The arm leaves that to the row to refuse. - A pin row holds it: "the waiver covers an OMITTED `object` only". - **Reading of "neither"**: a node carrying a bag with no `object` and no binding is refused. A node with no bag at all (`{ "type": "element:number" }`) is accepted, as the gate skips a node without `properties` and as every batch-1 arm leaves its bag optional (the batch-1 minimal-document row covers it). - **`dataSource` through the boundary**: `ElementDataSourceSchema` carries no default but reaches a `z.lazy` (the recursive filter clause), and the walker's `lazy` arm always rebuilds. So it is the first clean import the boundary returns as an equal-answering clone rather than the spec's own object. Measured: the lazy count stays 4, because it is the same node already in the graph. - `imported-defaults-8317.test.ts` went red on exactly its two invariants: the identity row for `ElementDataSourceSchema`, and the lazy-owner row whose message says "update the docblock". - So the file now names the set: `REBUILT_CLEAN`, held equal to what the graph re-derives, asserted not reference-equal. The accept-set differential already covers every `IMPORTED` row. - The walker docblock says the same. No strip moved. ## Pins and ablation New pin file `packages/types/src/__tests__/element-number-arm-10872.test.ts`, the batch-1 pin population, and the ratchet file. - **Red on base, green on head.** - `public-blocks.zod.ts` and `index.zod.ts` were set to base `6a7f24e92` (on disk, `ElementNumberBlockSchema` count 0 in both) at head `3293f7a084`: 3 files, `27 failed | 107 passed (134)`. Restored with `git checkout HEAD --`, the HEAD blob hash equal to the disk hash and `git diff HEAD` empty. - Red on base: - minimal `properties.object` document, both faces; - `dataSource.object` document with no `properties.object`, both faces; - neither, refused at `properties.object`; - reported beside another bag issue; - empty or non-string `dataSource.object` supplies nothing; - omitted-only waiver; - spec-invalid member refused at the member, by reference (`format`, and the record-form `filter` the spec migration retired); - undeclared bag member refused by name; - taught and shipped documents validate; - named export and union member; - the three by-reference rows; - the differential's 5 accept-verdict probes; - ratchet: the count row, and the batch-2 row; - the two `objectui validate` rows; - the batch-1 file's `element:number` rows and its union-population row. - The differential's 9 refuse-verdict probes are green on base by construction: base refuses every `element:number` document at `type`. - Head: `5 passed (5)`, `354 passed (354)` over the new pin file, the batch-1 pin file, `imported-defaults-8317`, `zod-mirror-parity` and the ratchet file, at `278ee02ff2`. - **Ablation: remove the waiver.** - At head `3293f7a084`, the line `if (dataSourceSuppliesObject(node)) return;` was replaced by a marker comment through a script that refuses unless the anchor count is exactly 1. On disk after the mutation: anchor count 0, marker count 1. A trap restored it: HEAD blob `c848ddf759` equals the disk hash, anchor 1, marker 0, `git diff HEAD` empty. - Result `3 failed | 131 passed (134)`, and exactly the dataSource-form rows reddened: - "a `dataSource.object` document with no `properties.object` is accepted on both faces"; - the differential row "bag without object, dataSource.object"; - the `objectui validate` row "validates `element:number` in both of its binding forms". - The subject resolves to `src` in both suites (relative imports in `packages/types`; the root vitest alias maps `@object-ui/types/zod` to `src` for the CLI file), so no `dist` build sits between the mutation and the reading. ## The arm-list consumer sweep (a gate) - **Search**: `git grep -l` over every test file for `AnyComponentSchema`, `nodeOracles`, `KNOWN_SCHEMA_TYPES`, `PUBLIC_BLOCKS`, `PublicBlockComponentSchema`, `block-config-schema-parity-8216`, `registry-inputs-spec-parity`, `StrictAnyComponentSchema`, `stripImportedDefaults`, `ElementDataSourceSchema`, and `handler-key-read-sites` (the handler-key checker's arm table). That is 111 files at the final tree. - **Runs**, all under the verify lock: - `packages/types/` and `packages/cli/` whole, plus the 8 `scripts` hits: `294 passed (294)` files, `6398 passed (6398)` tests, at `379833972c`; - the 46 other hits: `46 passed (46)` files, `824 passed (824)` tests, at `379833972c`; - `zod-subpath-single-module-8598.dist.spec.tsx` in the opt-in `dist` project on a rebuilt `@object-ui/types`: `1 passed (1)`. - Before the merge, the same population (110 files) ran green at `3293f7a084`: 63 + 46 files. - **Every file's verdict is PASS**: - `apps/console` (7): `component-input-union-specimens.test.ts`, `element-data-source-input-injection.test.tsx`, `ga-honoured-inputs-author-reach.test.ts`, `html-tier-manifest.test.ts`, `public-contract.test.ts`, `registry-inputs-spec-parity.test.ts`, `unfulfilled-chart-stubs-8760.test.tsx` - `examples/schema-catalog` (2): `overlay-trigger-mirror-6939.test.tsx`, `safe-validate-corpus-6318.test.ts` - `packages/app-shell` (4): `ReportView.dataSourceObjectKey.test.tsx`, `phase1-page-blocks.render.test.tsx`, `block-config-schema-parity-8216.test.ts`, `page-tabs-item-value-8278.test.tsx` - `packages/cli` (8): `check-known-types.test.ts`, `check-unknown-type-case-suggestion.test.ts`, `check-validity-recogniser.test.ts`, `registered-types-validate-ratchet-10859.test.ts`, `retired-view-dashboard-key-9533.test.ts`, `unfulfilled-chart-stubs-retired-8760.test.ts`, `validate-root-path-line.test.ts`, `validate-union-arm-selection.test.ts` - `packages/components` (6): `page-container-authorable-keys.test.tsx`, `react-page-scope.test.tsx`, `record-picker-inputs-spec-parity.test.ts`, `text-input-inputs-spec-parity.test.ts`, `container-declaration-census.test.tsx`, `container-declaration-ratchet.test.tsx` - `packages/core` (2): `html-tier-intrinsics.test.ts`, `public-tier.test.ts` - `packages/layout` (1): `page-header-authorable-keys.test.tsx` - `packages/plugin-calendar` (3): `ObjectCalendar.recordSourceMembers-8314.test.tsx`, `ObjectCalendar.sortMembersReachTheWire-8171.test.tsx`, `dataKeysAreDeclaredAndHonoured-8314.test.ts` - `packages/plugin-dashboard` (3): `dashboardAuthoredInputs.test.tsx`, `objectMetricDrillDownMembers-8071.test.tsx`, `objectMetricTrendMembers-8071.test.tsx` - `packages/plugin-detail` (5): `detail-handler-slots-7804.test.tsx`, `detail-view-handler-slots-9447.test.tsx`, `detailSectionHeaderColorEnum-6955.test.ts`, `recordDetailsInputs.spec-parity.test.ts`, `recordRelatedListInputs.spec-parity.test.ts` - `packages/plugin-form` (1): `ObjectForm.elementDataSource.test.tsx` - `packages/plugin-grid` (3): `gridArrayArmOrderby-8973.test.tsx`, `gridDataInputContract.test.ts`, `gridFilterInputSpelling.test.tsx` - `packages/plugin-kanban` (1): `handlerKeyDispositionsMeasured-7804.test.tsx` - `packages/plugin-map` (1): `index.bareMapKeyRetired-10393.test.tsx` - `packages/plugin-tree` (2): `ObjectTree.overlayTitleI18n.test.tsx`, `registration.publicTier-10064.test.tsx` - `packages/plugin-view` (1): `objectViewHostSurface.test.tsx` - `packages/react` (2): `ElementDataSourceGate.malformedFilter-10789.test.tsx`, `ElementDataSourceGate.test.tsx` - `packages/sdui-parser` (1): `member-kind-8067.test.ts` - `packages/test-support` (1): `spec-tombstones.test.ts` - `packages/types` (49): `action-callback-retired-7068.test.ts`, `ai-insights-retired-8800.test.ts`, `ai-node-faces-agree-10874.test.ts`, `ai-zod-arms-10859.test.ts`, `any-component-union-fanout.test.ts`, `app-hidden-catalogue-flag-7542.test.ts`, `arm-named-export-8784.test.ts`, `bare-kanban-node-key-retired-8802.test.ts`, `block-family-retired-4895.test.ts`, `breadcrumb-object-tree-nameable-7917.test.ts`, `calendar-flat-color-allday-8466.test.ts`, `chart-axis-config-7690.test.ts`, `chat-message-avatar-keys-7295.test.ts`, `combobox-command-optional-6033.test.ts`, `content-channel-e3-residual-9256.test.ts`, `content-channel-family-d-9256.test.ts`, `content-channel-per-component-8284.test.ts`, `dashboard-daterange-spec-10334.test.ts`, `detail-view-field-options-10296.test.ts`, `element-number-arm-10872.test.ts`, `gantt-flat-config-declared-keys.test.ts`, `imported-defaults-8317.test.ts`, `imported-defaults-describe-9034.test.ts`, `imported-defaults-rest-less-tuple-9088.test.ts`, `input-wrapper-class-mirrored-8072.test.ts`, `kanban-calendar-filter-sort-8174.test.ts`, `nav-separator-mirror-refusal-10867.test.ts`, `navigation-spec-parity.test.ts`, `node-recursion-point-8344.test.ts`, `node-slot-registered-arms-8499.test.ts`, `object-chart-axis-config-10518.test.ts`, `object-kanban-group-by-limit-7322.test.ts`, `object-view-unmirrored-keys-7779.test.ts`, `objectql-union-arms-7363.test.ts`, `page-body-arity-8310.test.ts`, `phase2-schemas.test.ts`, `public-block-arms-10872.test.ts`, `registry-meta-carry-9102.test.ts`, `shorthand-input-type-refusal-8762.test.ts`, `spec-subschema-parity.test.ts`, `strict-authoring-face-8345.test.ts`, `text-value-retired-6951.test.ts`, `timeline-item-element-6356.test.ts`, `timeline-readme-schema-example-10824.test.ts`, `tree-view-data-retired-6951.test.ts`, `zod-lazy-getter-identity-7918.test.ts`, `zod-mirror-authors-no-defaults-7735.test.ts`, `zod-mirror-parity.test.ts`, `zod-subpath-single-module-8598.dist.spec.tsx` - `scripts` (8): `body-dialect-census.test.ts`, `check-component-surface-parity.test.ts`, `check-handler-key-read-sites.test.ts`, `check-installed-spec-pin-claims.test.ts`, `check-prompt-component-keys.test.ts`, `component-node-vocabulary-7434.test.ts`, `known-schema-types-derivation-5115.test.ts`, `spec-symbol-ledger-types-7265.test.ts` ## Fix round 1 (head `fe8f6a6aad`) Contract review at `278ee02ff2` was FAIL on sequencing, not code; see the held note at the top. It asked for one text-and-test commit: - **Changeset wording.** `.changeset/10872-element-number-arm.md` now says an undeclared prop "is refused by name (`unrecognized_keys` on `properties`)". The out-of-range `format` and the record-form `filter` stay "refused at that member", which is what the row reports for them. The `dataSource` example is kept: it becomes true of the renderer when objectui#10909 lands. - **Docblock.** The `.partial()` docblock no longer claims the row's `.describe()` text travels. The clone sets no parent, so registry metadata does not inherit, and the row carries no top-level description anyway. Comment only. - **REBUILT_CLEAN, measured where the rebuild happens.** Four new rows in `element-number-arm-10872.test.ts` go through `dataSource.filter`, which is the member whose subtree reaches the recursive filter clause's `z.lazy`, rebuilt by the boundary: - a record filter, accepted; - a nested `$and` / `$or`, accepted; - `filter: 5`, refused; - a non-object clause inside `$and`, refused. Each row asserts the spec's own `ElementDataSourceSchema` verdict first (non-vacuity), then the same verdict on the arm's member, on `PageComponentSchema`, and on the node through both faces. The strict face rebuilds that lazy a second time. `-t 'through the rebuilt binding answers'` gives `4 passed | 28 skipped (32)`. - **Retitle.** The differential is titled as what it is: the spec node schema plus the test's model of the spec gate's documented reading (`specGateAccepts`), not the gate itself. - **Readings at `fe8f6a6aad`**, all under the verify lock: - `element-number-arm-10872.test.ts`, `imported-defaults-8317.test.ts` and the ratchet file give `Test Files 3 passed (3)` and `Tests 228 passed (228)`; - `pnpm --filter @object-ui/types run type-check` exits 0; - `check:control-bytes`, `check:new-line-citations` (0 new), `check-changeset-presence`, `check-changeset-no-major` and `check:changeset-claims` all exit 0. - **Merge-tree:** `git merge-tree --write-tree` against a fresh `origin/main` `733fd5ac65` is clean (exit 0). `main` was not merged in. ## Gates Derived by hand from the root `package.json` and `.github/workflows/`: objectui has no `dispatch-gates.mjs`. Each line gives the verdict the gate prints, at head `278ee02ff2` unless noted. - `node scripts/check-changeset-presence.mjs`: exit 0, "9 source file(s) of 2 released package(s) changed, and this change declares 1 changeset(s)". - `check-changeset-no-major.mjs` and `check-changeset-fixed.mjs`: exit 0. - `pnpm check:changeset-claims`: exit 0. It is report-only, and it flagged 22 pending changesets naming a touched file. Each was read. The two sentences made false got the dated notes above. Of the rest: - `8344-node-recursion-point-redirect.md`'s module counts are unchanged (no new category module); - `8317-strip-imported-defaults.md`'s "107 component arms" census has been past since batch 1 and is left as a reading. - `pnpm check:pending-changeset-literals`: exit 0. - `pnpm check:handler-key-reads`: exit 0, "OK 129 arm(s) … 50 judged". - `pnpm check:element-data-source-declaration`: exit 0. - `pnpm check:spec-symbols`: exit 0. - `pnpm check:new-line-citations`: "VERDICT new-cross-file-line-citations: 0 new citation(s)". - `pnpm check:control-bytes`: exit 0. - `pnpm check:installed-pin-claims`: OK. - `pnpm check:test-path-roots`: exit 0. - `node scripts/check-governed-queue-guard.mjs --test` over the 12 changed paths: "NOT GOVERNED". - **Type checks**, at `379833972c`, after the merge: - `pnpm --filter @object-ui/types run type-check`: exit 0. Its `tsconfig.test.json` includes the pin files; it reported a TS2559 in the new pin before the fix. - `pnpm --filter @object-ui/types run build`: "dist completeness: 1 package(s) complete". - `pnpm --filter @object-ui/cli run type-check`: exit 0, with the ratchet file in its program (`--listFiles`), on the `@object-ui/cli^...` closure built under the lock. - **ESLint, a declared narrowing.** - Population: the 8 changed `.ts` files, each resolved through the root `eslint.config.js`. - The `--format json` output has 8 files, 0 errors and 0 warnings. - Invariance: the config enables no type-aware linting (no `parserOptions.project` / `projectService`), and no local rule in `eslint-rules/` reads another file. So the diff cannot move the verdict of an untouched file. - **NOT MEASURED: `check:readme-exports`.** - Reason: PREREQUISITE NOT MET. 27 of 40 packages are unbuilt, and the gate's own population floor refuses the run ("the population COLLAPSED"). - This diff's one README edit (`packages/types/src/zod/README.md`) is a prose sentence and one name in a bullet list, with no fenced block and no import binding. - The `readme-exports` workflow builds and runs it. ## Serial - PR objectui#10897 (seat 1), which holds `zod-mirror-parity.test.ts` and `objectql*.ts`, merged as `775e0795bc` while this batch was in flight. - This batch's one row in that file is an `EXCLUSIONS` entry beside the batch-1 public-block rows, outside #10897's hunks. - `git merge-tree --write-tree` of this branch against #10897's head `31bb63bcbd` gives exit 0, and against `origin/main` `9f0c84a448` exit 0, both before and after the merge commit. No other open PR was re-listed. - `origin/main` `9f0c84a448` is an ancestor of the head (`merge-base --is-ancestor`, exit 0). ## Acceptance notes (what stays held) - **Still refused at `type`**, unchanged from batch 1 per ruling `5862923926`: - `action:button`, `action:group`, `action:menu`, `action:icon`, and `element:definition-list` / `element:repeater`, waiting on objectstack-ai/objectstack#20371; - `record:line_items`, which has no spec row, per the spec's own string-arm ledger. - **Not declared here**: the flat-props channel and the other envelope keys (`events`, `responsiveStyles`, `aria`, `visibility`, `responsive`). `dataSource` is declared on `element:number` only, because this waiver needs it. - **The ratchet only falls**: namespaced 397, bare 76. - **The renderer gap, now objectui#10909, which this PR is held behind**: measured at runtime. The `element:number` renderer (`ElementNumberRenderer`, `@object-ui/components`) reads its object from the `properties` bag only and never reads `dataSource`. - Probe: a real `SchemaRenderer`, the real registry, and an adapter with `aggregate` / `find` spies. - `{ type: element:number, properties: { object: contact, aggregate: count } }` calls `aggregate('contact', …)` and paints `7`. - `{ type: element:number, dataSource: { object: contact }, properties: { aggregate: count } }` calls neither `aggregate` nor `find` and paints `—`. - So the dataSource form that the spec gate waives, and that this arm accepts, would validate on both doors (`os validate` and `objectui validate`) and render an empty metric if this PR landed first. That is why it is held. - This PR does not narrow the validator around it: a declared-but-unhonoured binding is an implementation gap on the renderer side. - Seam: `spec:PageComponentSchema.dataSource (ElementDataSourceSchema.object)` → `renderer:ElementNumberRenderer`. - **Filed upstream by the seat**: the spec gate's `suppliedByDataSource` waives any issue at `object`, not only its absence (objectstack-ai/objectstack#20400). The arm follows the gate's docblock and refuses a wrong-typed `object` beside a binding. - **Spec drift ahead**: the installed spec (17.4.0) types `ElementDataSourceSchema.filter` as the record form, while objectstack `origin/main` has moved it to the rule-array form (migration `element-data-source-and-object-block-filter-rule-array`). The arm follows at the next spec bump, by reference. Today the spec fixture's rule-array `dataSource.filter` is refused by the installed spec and by this arm alike, which is why the taught-document row carries that fixture without its `filter`. Session `session_014mXUNuFomfj24w7s1pZzhN` (`domain:ui` seat 2 dispatch, os-dev, `mode:subagent`). --- _Generated by [Claude Code](https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7d82957 commit b45d463

12 files changed

Lines changed: 585 additions & 25 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/types': minor
3+
---
4+
5+
`safeValidateSchema` — and so `objectui validate` — accepts `element:number`, the ADR-0080 public block held back from batch 1, in both of the binding forms `@objectstack/spec` accepts (objectui#10872, batch 2).
6+
7+
**Clause-②: yes** — the accept set of `AnyComponentSchema` widens by one `type` literal, and `@object-ui/types/zod` exports one new schema, `ElementNumberBlockSchema`. Nothing that parsed before is refused now.
8+
9+
**What it was.** `element:number` is registered, curated as platform contract by ADR-0080 and declared by the spec (`ComponentPropsMap['element:number']`), while `AnyComponentSchema` carried no arm for it — so every `element:number` document was refused with `invalid_union` at `type`, and `objectui validate` reported "Schema validation failed" for any page that placed one.
10+
11+
**What changed, in observable terms.**
12+
13+
- `@object-ui/types/zod` exports `ElementNumberBlockSchema`, a member of `PublicBlockComponentSchema`; the strict authoring face (`StrictAnyComponentSchema`) accepts the same documents, closed to undeclared keys like every other arm.
14+
- The props live where the spec puts them: `properties`, read by reference from the block's `ComponentPropsMap` row — its members, value types, retired-key refusals and strictness. `{ "type": "element:number", "properties": { "object": "order", "aggregate": "count" } }` is accepted; a `format` outside `number` / `currency` / `percent`, or a record-form `filter` (the spec's migration `element-number-filter-rule-array`), is refused at that member, and an undeclared prop is refused by name (`unrecognized_keys` on `properties`).
15+
- The spec's one waiver is mirrored: the row requires `object`, and a bag may omit it when the node's `dataSource.object` is a non-empty object name, as the spec's props gate (`validateComponentProps` in `@objectstack/lint`) waives it. `{ "type": "element:number", "dataSource": { "object": "order" }, "properties": { "aggregate": "sum", "field": "total" } }` is accepted.
16+
- A bag that names its object nowhere is refused at `properties.object`, with a message naming both fixes (set `properties.object`, or bind `dataSource.object`). An empty or non-string `dataSource.object` supplies nothing. The waiver covers an omitted `object` only: a wrong one (`"object": 7`) is refused even beside a binding.
17+
- `dataSource` is declared on the node as the spec's `ElementDataSourceSchema`, by reference — the schema `PageComponentSchema.dataSource` is — so its members and its alias refusals (`objectName` → `object`) are the spec's, and the strict face judges a `dataSource` rather than refusing it as undeclared.
18+
- A node with no `properties` bag is not judged against the row, as for every other public block and as the spec's props gate does.

‎.changeset/10872-public-block-zod-arms.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
- A prop written directly on the node rather than inside `properties` is not judged against the block's row. A key the shared node base (`BaseSchema`) does not declare, such as `{ "type": "record:details", "columns": "2" }`, passes the tolerant face and is refused by the strict face. A key the base does declare is judged by the base instead. `children` (`page:card`, `page:section`, `page:footer`, `page:sidebar`), `label` and `disabled` (`element:button`) and `visible` (`record:alert`) are judged against the base's own types. `body` (`page:card`, `record:alert`) is refused on both faces by the base's objectui#6771 retirement: write a `record:alert` banner's `body` inside `properties`.
1616
- `page:tabs` also refuses an authored `onTabChange`, by name: it is the callback `@object-ui/app-shell` injects onto the node to write `?tab=` back, a runtime slot a React host fills (objectui#6124), and a JSON value there was never a working handler — delete the key.
1717
- Not armed in this release, and still refused at `type`: `element:number` (its row's required `object` is waived by the spec when the node binds through `dataSource`, which the row alone would refuse), `record:line_items` (the spec has no row for it yet), `element:definition-list` and `element:repeater` (the spec's `element:` vocabulary does not declare them), and `action:button`, `action:group`, `action:menu` and `action:icon` (no spec row yet; one is being measured from the renderers' read points upstream, objectstack-ai/objectstack#20371).
18+
19+
⚠️ **Dated note, 2026-09-28 — `element:number` armed — objectui#10872 batch 2.** Later in this same release `element:number` is armed as well (`ElementNumberBlockSchema`, with the spec's `dataSource` waiver on its required `object`), so the lead sentence's "less `element:number`" and the first item of the "Not armed in this release" bullet no longer describe the release as a whole; the other held blocks are still refused at `type`. The rest of this entry is kept as the reading of this change.

‎.changeset/8317-strip-imported-defaults.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ any of the 107 component arms.
5757
repository's release train). This is reversible into it — every strip becomes a no-op
5858
the day the spec adopts the same principle, because the boundary is the identity
5959
function on a subtree with nothing to strip.
60+
61+
⚠️ **Dated note, 2026-09-28 — one clean import is rebuilt — objectui#10872 batch 2.** Later in this same release the `element:number` arm imports the spec's `ElementDataSourceSchema` through this boundary. It carries no default but reaches a `z.lazy` (the recursive filter clause), and the walker always rebuilds a `lazy`, so for that one import the boundary returns an equal-answering clone rather than the spec's own object: "the identity function on a subtree with nothing to strip" holds for every other clean import, not that one. Nothing is stripped from it and its accept set does not move. The rest of this entry is kept as the reading of this change.

‎packages/cli/src/__tests__/registered-types-validate-ratchet-10859.test.ts‎

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ const REFUSED_AT_TYPE = 73;
7474
/**
7575
* The head's refused count over the NAMESPACED keys (objectui#10872 batch 1:
7676
* 418 on `main` before it, minus the twenty ADR-0080 public blocks armed from
77-
* their `@objectstack/spec` `ComponentPropsMap` rows). LOWER it when a batch
78-
* arms more keys; never raise it.
77+
* their `@objectstack/spec` `ComponentPropsMap` rows; batch 2: minus
78+
* `element:number`, armed with the spec's `dataSource` waiver). LOWER it when
79+
* a batch arms more keys; never raise it.
7980
*/
80-
const NAMESPACED_REFUSED_AT_TYPE = 398;
81+
const NAMESPACED_REFUSED_AT_TYPE = 397;
8182

8283
/** The bare registry keys — the population the card measured. */
8384
const BARE_KEYS = KNOWN_SCHEMA_TYPES.filter((key) => !key.includes(':'));
@@ -96,6 +97,9 @@ const ARMED_PUBLIC_BLOCKS_10872 = [
9697
'element:text', 'element:button', 'element:divider',
9798
] as const;
9899

100+
/** The public block objectui#10872 batch 2 armed. */
101+
const ARMED_PUBLIC_BLOCKS_10872_BATCH_2 = ['element:number'] as const;
102+
99103
/** Is `type` unclaimed by every arm of the validator's root union? */
100104
function refusedAtType(type: string): boolean {
101105
const result = safeValidateSchema({ type });
@@ -185,6 +189,13 @@ describe('registered NAMESPACED component types refused at `type` — a ratchet
185189
expect(refusedAtType(key), key).toBe(false);
186190
}
187191
});
192+
193+
it('counts the public block objectui#10872 batch 2 armed', () => {
194+
for (const key of ARMED_PUBLIC_BLOCKS_10872_BATCH_2) {
195+
expect(NAMESPACED_KEYS, key).toContain(key);
196+
expect(refusedAtType(key), key).toBe(false);
197+
}
198+
});
188199
});
189200

190201
/* ── End to end: the README document through `objectui validate` ─────────── */
@@ -293,4 +304,39 @@ describe('objectui validate — a page built from ADR-0080 public blocks (object
293304
expect(text).toContain('inventedProp10872');
294305
expect(exitCodes).toEqual([1]);
295306
});
307+
308+
it('validates `element:number` in both of its binding forms (objectui#10872 batch 2)', async () => {
309+
// The props form, and the `dataSource` form the spec's props gate waives
310+
// `properties.object` for.
311+
const page = {
312+
type: 'page',
313+
children: [
314+
{ type: 'element:number', properties: { object: 'order', aggregate: 'count' } },
315+
{ type: 'element:number', dataSource: { object: 'order' }, properties: { aggregate: 'sum', field: 'total' } },
316+
],
317+
};
318+
const file = join(dir, 'element-number-page.json');
319+
writeFileSync(file, JSON.stringify(page, null, 2), 'utf-8');
320+
321+
await validate(file);
322+
323+
const text = out.join('\n').replace(ANSI, '');
324+
expect(text).not.toContain('Schema validation failed');
325+
expect(text).toContain('Schema is valid');
326+
expect(exitCodes).toEqual([0]);
327+
});
328+
329+
it('refuses an `element:number` that names its object nowhere, at `properties.object`', async () => {
330+
// The control that keeps the row above from passing for the wrong reason.
331+
const page = { type: 'page', children: [{ type: 'element:number', properties: { aggregate: 'count' } }] };
332+
const file = join(dir, 'element-number-page-refused.json');
333+
writeFileSync(file, JSON.stringify(page, null, 2), 'utf-8');
334+
335+
await validate(file);
336+
337+
const text = out.join('\n').replace(ANSI, '');
338+
expect(text).toContain('Schema validation failed');
339+
expect(text).toContain('dataSource.object');
340+
expect(exitCodes).toEqual([1]);
341+
});
296342
});

0 commit comments

Comments
 (0)