STET

agent_patch

runs/2026-02-27__21-30-28__gpt-5-3-codex/flux-pr-5316/flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/agent-logs/agent.patch

7651 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/schemas.ts b/app/packages/zod/src/v4/classic/schemas.ts
index 968e8cf..737446a 100644
--- a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/schemas.ts
+++ b/app/packages/zod/src/v4/classic/schemas.ts
@@ -1540,6 +1540,10 @@ export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends
   "~standard": ZodStandardSchemaWithJSON<this>;
   keyType: Key;
   valueType: Value;
+  min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
+  nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
+  max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
+  size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
 }
 export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor("ZodMap", (inst, def) => {
   core.$ZodMap.init(inst, def);
@@ -1547,6 +1551,10 @@ export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor
   inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);
   inst.keyType = def.keyType;
   inst.valueType = def.valueType;
+  inst.min = (...args) => inst.check(core._minSize(...args));
+  inst.nonempty = (params) => inst.check(core._minSize(1, params));
+  inst.max = (...args) => inst.check(core._maxSize(...args));
+  inst.size = (...args) => inst.check(core._size(...args));
 });
 
 export function map<Key extends core.SomeType, Value extends core.SomeType>(
diff --git a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/tests/map.test.ts b/app/packages/zod/src/v4/classic/tests/map.test.ts
index 47c1971..40ffafa 100644
--- a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/tests/map.test.ts
+++ b/app/packages/zod/src/v4/classic/tests/map.test.ts
@@ -3,6 +3,11 @@ import * as z from "zod/v4";
 
 const stringMap = z.map(z.string(), z.string());
 type stringMap = z.infer<typeof stringMap>;
+const minTwo = z.map(z.string(), z.string()).min(2);
+const maxTwo = z.map(z.string(), z.string()).max(2);
+const justTwo = z.map(z.string(), z.string()).size(2);
+const nonEmpty = z.map(z.string(), z.string()).nonempty();
+const nonEmptyMax = z.map(z.string(), z.string()).nonempty().max(2);
 
 test("type inference", () => {
   expectTypeOf<stringMap>().toEqualTypeOf<Map<string, string>>();
@@ -194,3 +199,123 @@ test("map with object keys", () => {
     ]]
   `);
 });
+
+test("valid parse: size-related methods", () => {
+  expect(() => {
+    minTwo.parse(
+      new Map([
+        ["a", "1"],
+        ["b", "2"],
+      ])
+    );
+    minTwo.parse(
+      new Map([
+        ["a", "1"],
+        ["b", "2"],
+        ["c", "3"],
+      ])
+    );
+    maxTwo.parse(
+      new Map([
+        ["a", "1"],
+        ["b", "2"],
+      ])
+    );
+    maxTwo.parse(new Map([["a", "1"]]));
+    justTwo.parse(
+      new Map([
+        ["a", "1"],
+        ["b", "2"],
+      ])
+    );
+    nonEmpty.parse(new Map([["a", "1"]]));
+    nonEmptyMax.parse(new Map([["a", "1"]]));
+  }).not.toThrow();
+
+  const sizeZeroResult = stringMap.parse(new Map());
+  expect(sizeZeroResult.size).toBe(0);
+
+  const sizeTwoResult = minTwo.parse(
+    new Map([
+      ["a", "1"],
+      ["b", "2"],
+    ])
+  );
+  expect(sizeTwoResult.size).toBe(2);
+});
+
+test("failing when parsing empty map in nonempty", () => {
+  const result = nonEmpty.safeParse(new Map());
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues.length).toEqual(1);
+  expect(result.error!.issues[0].code).toEqual("too_small");
+});
+
+test("failing when map is smaller than min()", () => {
+  const result = minTwo.safeParse(new Map([["just_one", "1"]]));
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues.length).toEqual(1);
+  expect(result.error!.issues[0].code).toEqual("too_small");
+});
+
+test("failing when map is bigger than max()", () => {
+  const result = maxTwo.safeParse(
+    new Map([
+      ["one", "1"],
+      ["two", "2"],
+      ["three", "3"],
+    ])
+  );
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues.length).toEqual(1);
+  expect(result.error!.issues[0].code).toEqual("too_big");
+});
+
+test("min/max", () => {
+  const schema = z.map(z.string(), z.string()).min(2).max(3);
+
+  const r1 = schema.safeParse(
+    new Map([
+      ["a", "1"],
+      ["b", "2"],
+    ])
+  );
+  expect(r1.success).toEqual(true);
+
+  const r2 = schema.safeParse(new Map([["a", "1"]]));
+  expect(r2.success).toEqual(false);
+  expect(r2.error!.issues).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "too_small",
+        "inclusive": true,
+        "message": "Too small: expected map to have >=2 entries",
+        "minimum": 2,
+        "origin": "map",
+        "path": [],
+      },
+    ]
+  `);
+
+  const r3 = schema.safeParse(
+    new Map([
+      ["a", "1"],
+      ["b", "2"],
+      ["c", "3"],
+      ["d", "4"],
+    ])
+  );
+  expect(r3.success).toEqual(false);
+  expect(r3.error!.issues).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "too_big",
+        "inclusive": true,
+        "maximum": 3,
+        "message": "Too big: expected map to have <=3 entries",
+        "origin": "map",
+        "path": [],
+      },
+    ]
+  `);
+});
diff --git a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/errors.ts b/app/packages/zod/src/v4/core/errors.ts
index 19fe1f2..8caac1c 100644
--- a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/errors.ts
+++ b/app/packages/zod/src/v4/core/errors.ts
@@ -25,7 +25,7 @@ export interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
 
 export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
   readonly code: "too_big";
-  readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
+  readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "map" | "file" | (string & {});
   readonly maximum: number | bigint;
   readonly inclusive?: boolean;
   readonly exact?: boolean;
@@ -34,7 +34,7 @@ export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
 
 export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
   readonly code: "too_small";
-  readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
+  readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "map" | "file" | (string & {});
   readonly minimum: number | bigint;
   /** True if the allowable range includes the minimum */
   readonly inclusive?: boolean;
diff --git a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/locales/en.ts b/app/packages/zod/src/v4/locales/en.ts
index b97d035..7edcbe0 100644
--- a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/locales/en.ts
+++ b/app/packages/zod/src/v4/locales/en.ts
@@ -31,6 +31,7 @@ const error: () => errors.$ZodErrorMap = () => {
     file: { unit: "bytes", verb: "to have" },
     array: { unit: "items", verb: "to have" },
     set: { unit: "items", verb: "to have" },
+    map: { unit: "entries", verb: "to have" },
   };
 
   function getSizing(origin: string): { unit: string; verb: string } | null {