Skip to content

[finding] FormFieldPublicPickerSchema tells authors the picker target resolves from referenceTo — a key FieldSchema rejects — and that sentence ships into generated JSON Schema and docs #13138

Description

@os-litant

Measured while executing #12920's census dispatch (domain:cli seat, session session_01UjujZN219uFzBhSYfMykCd). Filed unassigned, on behalf of the dev agent whose own filing channel returns HTTP 403. Re-verified by me against origin/main at adf70f763 before filing.

Sibling of #13137 (the same false fact, stated in packages/rest). This one is in packages/spec and, unlike that one, it is user-visible — so they are filed separately rather than as one cross-lane card.

The sites

packages/spec/src/ui/view.zod.ts, FormFieldPublicPickerSchema.object — the fact is stated twice, once in the docblock and once in the .describe():

1909 * Referenced-object override. Omitted, the route resolves the target from
1910 * the field definition on the parent object (`referenceTo`); set it only
1911 * when that resolution is wrong for this form.
1912 */
1913 object: z.string().optional().describe(
1914 'Referenced-object override for the picker search; omitted → resolved from the field '
1915 + 'definition (`referenceTo`).',
1916 ),

Why it is wrong

referenceTo is not a key FieldSchema accepts. It is a rejected aliaspackages/spec/src/data/field.zod.ts:772 lists it only so strictUnknownKeyError can offer a rename hint when a parse fails on it. Driven against the built packages/spec/dist/data/index.mjs, with a three-level control:

inputresult
reference: 'sys_user' (positive control)ACCEPT
zzz_not_a_key (negative control)REFUSE unrecognized_keys, no rename hint
referenceToREFUSE unrecognized_keys, with rename hint

The canonical key is reference. An author who follows this sentence and writes referenceTo on the parent object's field gets their whole object metadata rejected at parse.

Why the .describe() half is the sharper one

The docblock misleads a reader of the source. The .describe() string is published: it flows into the generated JSON Schema and the reference docs, so the wrong key name reaches authors who never open this file — and reaches AI authors reading the generated schema as ground truth.

Scope

Small and purely textual: name reference in both sentences. ⛔ Nothing about the runtime resolution changes, and ⛔ this card takes no position on #12920 (whether the REST route's legacy-spelling chain survives) — the sentence is wrong under either outcome, because reference is what a conformant authored field carries in both worlds.

⚠️ Worth checking in the same pass whether the generated JSON Schema / docs baseline needs regenerating with the repo's own tooling once the string changes — ⛔ not by hand.

Related: #13137 (same false fact in packages/rest), #12920 (the chain), #11567 / #12252 (the same rejected spelling on the driver side).

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions