Skip to content

Commit 784ed9f

Browse files
committed
test(spec): the recursive-schema input pins stop asserting the retired FieldNode form
#4252 landed while this branch was open and pinned the INPUT half of every recursive schema — including two probes that assert the `{ field, fields, alias }` select entry is assignable. Both changes merge without a git conflict and are jointly wrong: the exact shape AGENTS.md's multi-agent discipline #10 warns about. `FieldNode` is no longer recursive, so `FieldNodeSchema` infers both halves itself rather than carrying a `z.ZodType<Output, Input>` annotation. Its probes stay anyway — this file's job is that the input side is CHECKED, and a `z.string()` someone re-widens to `z.ZodType<FieldNode>` fails here exactly as a dropped type parameter would. The positive probe becomes a dotted path (the replacement the removal prescribes) and the object form joins the negative side. `wiredFieldNode` needs no change: `z.input<typeof FieldNodeSchema>` is `string`, so `42` is still the error the suppression expects. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EskBioEkCCJpGz3SvPQDxx
1 parent b08e6db commit 784ed9f

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

packages/spec/src/recursive-schema-input-assertions.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import type {
7373
/** The authoring shape: only `object` is required, `expand` recurses. */
7474
export const queryInput: QueryInput = {
7575
object: 'account',
76-
fields: ['name', { field: 'owner', fields: ['email'] }],
76+
fields: ['name', 'owner.email'],
7777
expand: { owner: { object: 'user', fields: ['name'] } },
7878
};
7979

@@ -97,13 +97,25 @@ export const joinNotANumber: JoinNodeInput = 42;
9797
// @ts-expect-error — `type` must be one of the four declared join kinds
9898
export const joinBadType: JoinNodeInput = { type: 'sideways', object: 'c', on: {} };
9999

100-
/** A select entry is a bare name or a nested relation select. */
100+
/**
101+
* A select entry is a field name, optionally dotted through a relationship.
102+
*
103+
* `FieldNode` stopped being recursive in #4196 — the `{ field, fields, alias }`
104+
* member it used to carry was declared-but-inert and is gone, so
105+
* `FieldNodeSchema` infers both halves itself rather than carrying a
106+
* `z.ZodType<Output, Input>` annotation. The probes stay: this file's job is that
107+
* the input side is CHECKED, and a `z.string()` that someone re-widens to
108+
* `z.ZodType<FieldNode>` fails here exactly as a dropped type parameter would.
109+
*/
101110
export const fieldNodeString: FieldNode = 'name';
102-
export const fieldNodeNested: FieldNode = { field: 'owner', fields: ['email'], alias: 'o' };
111+
export const fieldNodeDotted: FieldNode = 'owner.email';
103112

104113
// @ts-expect-error — a select entry is not a number
105114
export const fieldNodeNotANumber: FieldNode = 42;
106115

116+
// @ts-expect-error — nor the nested-select object form retired in #4196
117+
export const fieldNodeNotTheRetiredForm: FieldNode = { field: 'owner', fields: ['email'] };
118+
107119
/* ── data/filter.zod.ts ────────────────────────────────────────────────────── */
108120

109121
/**

0 commit comments

Comments
 (0)