STET

agent_patch

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

6310 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-4/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-4/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-4/app/packages/zod/src/v4/classic/tests/map.test.ts b/app/packages/zod/src/v4/classic/tests/map.test.ts
index 47c1971..d18d42e 100644
--- a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/classic/tests/map.test.ts
+++ b/app/packages/zod/src/v4/classic/tests/map.test.ts
@@ -3,6 +3,10 @@ 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();
 
 test("type inference", () => {
   expectTypeOf<stringMap>().toEqualTypeOf<Map<string, string>>();
@@ -24,6 +28,49 @@ test("valid parse", () => {
   `);
 });
 
+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"]]));
+  }).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("valid parse async", async () => {
   const asyncMap = z.map(
     z.string().refine(async () => false, "bad key"),
@@ -60,6 +107,81 @@ test("throws when a Set is given", () => {
   }
 });
 
+test("failing when parsing empty map in nonempty()", () => {
+  const result = nonEmpty.safeParse(new Map());
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "too_small",
+        "inclusive": true,
+        "message": "Too small: expected map to have >=1 entries",
+        "minimum": 1,
+        "origin": "map",
+        "path": [],
+      },
+    ]
+  `);
+});
+
+test("failing when map is smaller than min()", () => {
+  const result = minTwo.safeParse(new Map([["a", "1"]]));
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "too_small",
+        "inclusive": true,
+        "message": "Too small: expected map to have >=2 entries",
+        "minimum": 2,
+        "origin": "map",
+        "path": [],
+      },
+    ]
+  `);
+});
+
+test("failing when map is bigger than max()", () => {
+  const result = maxTwo.safeParse(
+    new Map([
+      ["a", "1"],
+      ["b", "2"],
+      ["c", "3"],
+    ])
+  );
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "too_big",
+        "inclusive": true,
+        "maximum": 2,
+        "message": "Too big: expected map to have <=2 entries",
+        "origin": "map",
+        "path": [],
+      },
+    ]
+  `);
+});
+
+test("failing when map size does not equal size()", () => {
+  const result = justTwo.safeParse(new Map([["a", "1"]]));
+  expect(result.success).toEqual(false);
+  expect(result.error!.issues).toMatchInlineSnapshot(`
+    [
+      {
+        "code": "too_small",
+        "exact": true,
+        "inclusive": true,
+        "message": "Too small: expected map to have >=2 entries",
+        "minimum": 2,
+        "origin": "map",
+        "path": [],
+      },
+    ]
+  `);
+});
+
 test("throws when the given map has invalid key and invalid input", () => {
   const result = stringMap.safeParse(new Map([[42, Symbol()]]));
   expect(result.success).toEqual(false);
diff --git a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/locales/en.ts b/app/packages/zod/src/v4/locales/en.ts
index b97d035..0bc79eb 100644
--- a/tmp/agent-patch-flux-pr-5316.1-of-1.2026-02-27__21-30-28__gpt-5-4/app/packages/zod/src/v4/locales/en.ts
+++ b/app/packages/zod/src/v4/locales/en.ts
@@ -30,6 +30,7 @@ const error: () => errors.$ZodErrorMap = () => {
     string: { unit: "characters", verb: "to have" },
     file: { unit: "bytes", verb: "to have" },
     array: { unit: "items", verb: "to have" },
+    map: { unit: "entries", verb: "to have" },
     set: { unit: "items", verb: "to have" },
   };