agent_patch
runs/2026-02-27__21-30-28__gpt-5-4/flux-pr-4568/flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/agent-logs/agent.patch
5372 bytes
diff --git a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/core/function.ts b/app/packages/zod/src/v4/core/function.ts
index 1e9a469..b11bd5b 100644
--- a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/core/function.ts
+++ b/app/packages/zod/src/v4/core/function.ts
@@ -26,20 +26,20 @@ export type $ZodFunctionIn = $ZodFunctionArgs;
export type $ZodFunctionOut = schemas.$ZodType;
export type $InferInnerFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
- ...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["output"]
-) => Returns["_zod"]["input"];
+ ...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
+) => core.input<Returns>;
export type $InferInnerFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
- ...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["output"]
-) => util.MaybeAsync<Returns["_zod"]["input"]>;
+ ...args: $ZodFunctionIn extends Args ? never[] : core.output<Args>
+) => util.MaybeAsync<core.input<Returns>>;
export type $InferOuterFunctionType<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
- ...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["input"]
-) => Returns["_zod"]["output"];
+ ...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
+) => core.output<Returns>;
export type $InferOuterFunctionTypeAsync<Args extends $ZodFunctionIn, Returns extends $ZodFunctionOut> = (
- ...args: $ZodFunctionIn extends Args ? never[] : Args["_zod"]["input"]
-) => util.MaybeAsync<Returns["_zod"]["output"]>;
+ ...args: $ZodFunctionIn extends Args ? never[] : core.input<Args>
+) => util.MaybeAsync<core.output<Returns>>;
export class $ZodFunction<
Args extends $ZodFunctionIn = $ZodFunctionIn,
diff --git a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/mini/schemas.ts b/app/packages/zod/src/v4/mini/schemas.ts
index 5cf6d42..0f3c8d9 100644
--- a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/mini/schemas.ts
+++ b/app/packages/zod/src/v4/mini/schemas.ts
@@ -5,7 +5,7 @@ import * as parse from "./parse.js";
type SomeType = core.$ZodType;
export interface ZodMiniType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
- check(...checks: (core.CheckFn<this["_zod"]["output"]> | core.$ZodCheck<this["_zod"]["output"]>)[]): this;
+ check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
clone(def?: this["_zod"]["def"], params?: { parent: boolean }): this;
register<R extends core.$ZodRegistry>(
registry: R,
diff --git a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/mini/tests/functions.test.ts b/app/packages/zod/src/v4/mini/tests/functions.test.ts
index bdec1ae..eb48764 100644
--- a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/mini/tests/functions.test.ts
+++ b/app/packages/zod/src/v4/mini/tests/functions.test.ts
@@ -1,8 +1,29 @@
-import { expect, test } from "vitest";
-// import * as z from "zod/v4/core";
+import { expect, expectTypeOf, test } from "vitest";
+import * as z from "zod/v4-mini";
test("z.function", () => {
- expect(true).toEqual(true);
+ const schema = z.function({
+ input: [z.object({ name: z.string() })],
+ output: z.object({ id: z.number() }),
+ });
+
+ type input = (typeof schema)["_input"];
+ expectTypeOf<input>().toEqualTypeOf<(arg: { name: string }) => { id: number }>();
+
+ const fn = schema.implement(({ name }) => ({ id: name.length }));
+ expect(fn({ name: "abcd" })).toEqual({ id: 4 });
+});
+
+test("z.function preserves branded object IO", () => {
+ const schema = z.function({
+ input: [z.object({ name: z.string().brand<"Name">() })],
+ output: z.object({ id: z.number() }).brand<"UserId">(),
+ });
+
+ type input = (typeof schema)["_input"];
+ expectTypeOf<input>().toEqualTypeOf<
+ (arg: { name: string & z.$brand<"Name"> }) => { id: number } & z.$brand<"UserId">
+ >();
});
// test("z.function", () => {
diff --git a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/mini/tests/index.test.ts b/app/packages/zod/src/v4/mini/tests/index.test.ts
index d1ab967..24a66e5 100644
--- a/tmp/agent-patch-flux-pr-4568.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/mini/tests/index.test.ts
+++ b/app/packages/zod/src/v4/mini/tests/index.test.ts
@@ -666,6 +666,28 @@ test("z.refine", () => {
expect(() => z.parse(a, "hi")).toThrow();
});
+test("z.refine preserves object output through check and pipe", () => {
+ const a = z
+ .pipe(
+ z.object({
+ name: z.string(),
+ }),
+ z.transform((val: { name: string }) => ({
+ name: val.name,
+ slug: val.name.toLowerCase(),
+ }))
+ )
+ .check(
+ z.refine((val) => {
+ expectTypeOf(val).toEqualTypeOf<{ name: string; slug: string }>();
+ return val.slug.length > 0;
+ })
+ );
+
+ type a = z.output<typeof a>;
+ expectTypeOf<a>().toEqualTypeOf<{ name: string; slug: string }>();
+});
+
// test("z.superRefine", () => {
// const a = z.number([
// z.superRefine((val, ctx) => {