Skip to content

publicPicker.sort is read by the public lookup route but stays undeclared after #7467 — one key of the enforced-never-declarable gap remains #7485

Description

@os-zhuang

Found while implementing #7467 (declaring publicPicker on FormFieldSchema, per the maintainer ruling 「宣告」). Filed, not fixed: the ruling and the card bound that change to the card's four-key enumeration (displayFields, maxResults, filter, object), so a fifth key needs its own ruling rather than a rider.

The gap

GET /forms/:slug/lookup/:field in packages/rest/src/rest-server.ts performs a FIFTH read the #7467 card's enumeration did not include: the findData call's sort is

sort: picker.sort ?? [{ field: displayFields[0], order: 'asc' }]

FormFieldPublicPickerSchema (landed by #7467) deliberately does not declare sort — the block is strict, so a form authoring publicPicker.sort is a loud unrecognized_keys parse error. That leaves sort in exactly the state the parent card was filed about, scoped to one key: enforced by the route, declarable nowhere. Authors get the fallback (first display field, ascending) and cannot change it.

This is pinned as intentional in packages/spec/src/ui/view-public-picker.test.ts (picker.sort is NOT declarable — undeclared reads stay loud until ruled on), so the state is loud, measured, and revisitable — but it still needs a disposition.

Decision needed

Same fork as the parent card, one key wide:

  1. Declare it. Add sort to FormFieldPublicPickerSchema, deriving the shape from the route's actual read (an array passed verbatim to findData's query.sort; the route's own fallback is [{ field, order: 'asc' }], so the narrow declaration is Array<{ field: string, order: 'asc' | 'desc' }>). Flip the pin test.
  2. Retire the read. Drop picker.sort ?? from the route so the fallback is the only behavior, closing the mirror-gap by removal (spec-property-retirement playbook, route side).

Given the parent ruling chose declaration for the block itself, option 1 is the consistent direction — but it changes the public acceptance surface, so it is a maintainer call, not dispatchable.

Related: #7467, #3022, ADR-0049, ADR-0089.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions