STET

agent_patch

runs/2026-02-27__21-30-28__gpt-5-1-codex-mini/flux-pr-5222/flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/agent-logs/agent.patch

11760 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/jsr.json b/app/packages/zod/jsr.json
index 7d10eab..aeb3ec5 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/jsr.json
+++ b/app/packages/zod/jsr.json
@@ -1,6 +1,6 @@
 {
   "name": "@zod/zod",
-  "version": "4.1.5",
+  "version": "4.1.6",
   "exports": {
     "./package.json": "./package.json",
     ".": "./src/index.ts",
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/package.json b/app/packages/zod/package.json
index 772f9c9..0560885 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/package.json
+++ b/app/packages/zod/package.json
@@ -1,6 +1,6 @@
 {
   "name": "zod",
-  "version": "4.1.5",
+  "version": "4.1.6",
   "type": "module",
   "license": "MIT",
   "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -126,7 +126,7 @@
   "scripts": {
     "clean": "git clean -xdf . -e node_modules",
     "build": "zshy --project tsconfig.build.json",
-    "postbuild": "pnpm biome check --write .",
+    "postbuild": "tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .",
     "test:watch": "pnpm vitest",
     "test": "pnpm vitest run",
     "prepublishOnly": "tsx ../../scripts/check-versions.ts"
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/classic/schemas.ts b/app/packages/zod/src/v4/classic/schemas.ts
index 3e7934b..61b965c 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/classic/schemas.ts
+++ b/app/packages/zod/src/v4/classic/schemas.ts
@@ -1766,7 +1766,10 @@ export function _default<T extends core.SomeType>(
     type: "default",
     innerType: innerType as any as core.$ZodType,
     get defaultValue() {
-      return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      const resolved =
+        typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      util.assertDefined(resolved, "Default value must not be undefined.");
+      return resolved;
     },
   }) as any;
 }
@@ -1794,7 +1797,10 @@ export function prefault<T extends core.SomeType>(
     type: "prefault",
     innerType: innerType as any as core.$ZodType,
     get defaultValue() {
-      return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      const resolved =
+        typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      util.assertDefined(resolved, "Prefault value must not be undefined.");
+      return resolved;
     },
   }) as any;
 }
@@ -1931,8 +1937,8 @@ export function codec<const A extends core.SomeType, B extends core.SomeType = c
   in_: A,
   out: B,
   params: {
-    decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.input<B>;
-    encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.output<A>;
+    decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
+    encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
   }
 ): ZodCodec<A, B> {
   return new ZodCodec({
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/api.ts b/app/packages/zod/src/v4/core/api.ts
index 1206f2b..af754fb 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/api.ts
+++ b/app/packages/zod/src/v4/core/api.ts
@@ -1321,7 +1321,10 @@ export function _default<T extends schemas.$ZodObject>(
     type: "default",
     innerType,
     get defaultValue() {
-      return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      const resolved =
+        typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      util.assertDefined(resolved, "Default value must not be undefined.");
+      return resolved;
     },
   }) as any;
 }
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/schemas.ts b/app/packages/zod/src/v4/core/schemas.ts
index 3cc6ae7..2b2aa2a 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/schemas.ts
+++ b/app/packages/zod/src/v4/core/schemas.ts
@@ -3593,9 +3593,9 @@ export interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType =
   in: A;
   out: B;
   /** Only defined inside $ZodCodec instances. */
-  transform?: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => core.input<B>;
+  transform?: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
   /** Only defined inside $ZodCodec instances. */
-  reverseTransform?: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => core.output<A>;
+  reverseTransform?: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
 }
 
 export interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
@@ -3653,8 +3653,8 @@ function handlePipeResult(left: ParsePayload, next: $ZodType, ctx: ParseContextI
 ////////////////////////////////////////////
 ////////////////////////////////////////////
 export interface $ZodCodecDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodPipeDef<A, B> {
-  transform: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => core.input<B>;
-  reverseTransform: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => core.output<A>;
+  transform: (value: core.output<A>, payload: ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
+  reverseTransform: (value: core.input<B>, payload: ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
 }
 
 export interface $ZodCodecInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType>
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/util.ts b/app/packages/zod/src/v4/core/util.ts
index d5b6ad5..96780ae 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/util.ts
+++ b/app/packages/zod/src/v4/core/util.ts
@@ -238,6 +238,12 @@ export function nullish(input: any): boolean {
   return input === null || input === undefined;
 }
 
+export function assertDefined<T>(value: T, message = "Value must not be undefined"): asserts value is Exclude<T, undefined> {
+  if (value === undefined) {
+    throw new TypeError(message);
+  }
+}
+
 export function cleanRegex(source: string): string {
   const start = source.startsWith("^") ? 1 : 0;
   const end = source.endsWith("$") ? source.length - 1 : source.length;
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/versions.ts b/app/packages/zod/src/v4/core/versions.ts
index 5903bc9..a92c935 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/core/versions.ts
+++ b/app/packages/zod/src/v4/core/versions.ts
@@ -1,5 +1,5 @@
 export const version = {
   major: 4,
   minor: 1,
-  patch: 5 as number,
+  patch: 6 as number,
 } as const;
diff --git a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/mini/schemas.ts b/app/packages/zod/src/v4/mini/schemas.ts
index 1c05c35..fca963d 100644
--- a/tmp/agent-patch-flux-pr-5222.1-of-1.2026-02-27__21-30-28__gpt-5-1-codex-mini/app/packages/zod/src/v4/mini/schemas.ts
+++ b/app/packages/zod/src/v4/mini/schemas.ts
@@ -1305,7 +1305,10 @@ export function _default<T extends SomeType>(
     type: "default",
     innerType: innerType as any as core.$ZodType,
     get defaultValue() {
-      return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      const resolved =
+        typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      util.assertDefined(resolved, "Default value must not be undefined.");
+      return resolved;
     },
   }) as any;
 }
@@ -1330,7 +1333,10 @@ export function prefault<T extends SomeType>(
     type: "prefault",
     innerType: innerType as any as core.$ZodType,
     get defaultValue() {
-      return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      const resolved =
+        typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
+      util.assertDefined(resolved, "Prefault value must not be undefined.");
+      return resolved;
     },
   }) as any;
 }
@@ -1460,8 +1466,8 @@ export function codec<const A extends SomeType, B extends core.SomeType = core.$
   in_: A,
   out: B,
   params: {
-    decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.input<B>;
-    encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.output<A>;
+    decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => util.MaybeAsync<core.input<B>>;
+    encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => util.MaybeAsync<core.output<A>>;
   }
 ): ZodMiniCodec<A, B> {
   return new ZodMiniCodec({
diff --git a/app/scripts/write-stub-package-jsons.ts b/app/scripts/write-stub-package-jsons.ts
new file mode 100644
index 0000000..b937fb6
--- /dev/null
+++ b/app/scripts/write-stub-package-jsons.ts
@@ -0,0 +1,53 @@
+import { readdir, writeFile } from "node:fs/promises";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+
+const __dirname = fileURLToPath(new URL(".", import.meta.url));
+const zodPackageDirectory = join(__dirname, "..", "packages", "zod");
+
+export const STUB_PACKAGE_JSON_CONTENT = {
+  type: "module",
+  main: "./index.cjs",
+  module: "./index.js",
+  types: "./index.d.cts",
+} as const;
+
+const IGNORED_DIRECTORIES = new Set(["node_modules", ".git", "src"]);
+
+export async function findIndexJsFiles(directory: string): Promise<string[]> {
+  const entries = await readdir(directory, { withFileTypes: true });
+  const matches: string[] = [];
+  for (const entry of entries) {
+    if (entry.isDirectory()) {
+      if (IGNORED_DIRECTORIES.has(entry.name)) {
+        continue;
+      }
+      matches.push(...(await findIndexJsFiles(join(directory, entry.name))));
+      continue;
+    }
+    if (entry.isFile() && entry.name === "index.js") {
+      matches.push(join(directory, entry.name));
+    }
+  }
+  return matches;
+}
+
+async function writeStubManifest(directory: string) {
+  if (directory === zodPackageDirectory) {
+    return;
+  }
+  const manifestPath = join(directory, "package.json");
+  await writeFile(manifestPath, JSON.stringify(STUB_PACKAGE_JSON_CONTENT, null, 2) + "\n", "utf8");
+}
+
+async function main() {
+  const indexFiles = await findIndexJsFiles(zodPackageDirectory);
+  const indexDirectories = Array.from(new Set(indexFiles.map((file) => dirname(file))))
+    .filter((dir) => dir !== zodPackageDirectory);
+  await Promise.all(indexDirectories.map(writeStubManifest));
+}
+
+main().catch((error) => {
+  console.error(error);
+  process.exitCode = 1;
+});