{
  "schemaVersion": 1,
  "operation": "production-advisory-review",
  "repository": "colinhacks/zod",
  "baseSha": "ccc1514404929ce5df69f3ceb105a8ddd1ebdc07",
  "headSha": "b1077f05f85450cf53108714973bf7c8d9e3c35d",
  "model": "gpt-6.1-sol",
  "memory": "disabled",
  "performedAt": "2026-10-28T20:42:50.002Z",
  "manifest": [
    {
      "path": "packages/zod/src/v4/core/core.ts",
      "sha": "ccc1514404929ce5df69f3ceb105a8ddd1ebdc07",
      "sha256": "2b8f68a8ad2e753fb72437254ef0eb27e9eb1f69f955098600e4288e01a34df7"
    },
    {
      "path": "packages/zod/src/v4/core/util.ts",
      "sha": "ccc1514404929ce5df69f3ceb105a8ddd1ebdc07",
      "sha256": "85f50e21ac890d44e66d2306bb11218c518f3b66869929e68895c1d4bc1e11d6"
    },
    {
      "path": "packages/zod/src/v4/core/schemas.ts",
      "sha": "ccc1514404929ce5df69f3ceb105a8ddd1ebdc07",
      "sha256": "f61ff33ef3d5c87ca9bcd87c138ebf04df57883ea01f0839899d3b611a574c29"
    },
    {
      "path": "packages/zod/src/v4/classic/tests/optin-ladder.test.ts",
      "sha": "ccc1514404929ce5df69f3ceb105a8ddd1ebdc07",
      "sha256": "5a75e1d595e6e9f85dc9e488976afb8e5d739bb96050340b63607448904d5211"
    },
    {
      "path": "packages/zod/src/v4/classic/tests/lazy.test.ts",
      "sha": "ccc1514404929ce5df69f3ceb105a8ddd1ebdc07",
      "sha256": "4136e711b5e496f94c3e5c7befc8f6909a6dc3750696ce40e1f0a67d27be7342"
    }
  ],
  "changedFiles": [
    {
      "path": "packages/zod/src/v4/classic/tests/lazy.test.ts",
      "sha": "d7d4d4efd67a76f1df75ce0ee7b9b2a9017a9c6e",
      "patchSha256": "1ef8eb15157e76de364f1d6f58cbf01ada817a86f77b8f7a0fa5f294cb8924b7"
    },
    {
      "path": "packages/zod/src/v4/core/core.ts",
      "sha": "1d65cc812437a24a616a6e7476c88574e7fb8842",
      "patchSha256": "800cab8c8df9f9abc721ccfedffcce010ba4d109ef9f64416e6e492757d888dd"
    },
    {
      "path": "packages/zod/src/v4/core/schemas.ts",
      "sha": "7dc010402dbefd758725868e7cb204ac2f9a1130",
      "patchSha256": "ec79376572036b79019ca042cd01b616d4f816f83cb0682fef8c7b1359760886"
    },
    {
      "path": "packages/zod/src/v4/core/util.ts",
      "sha": "a57f9c9f66bfbd304004f8784495ade8eee049e5",
      "patchSha256": "df6e685b2971d80f7ac9936214c8eb19aaaa20292dfce60f431c1e721514a12c"
    }
  ],
  "configuration": "Production reviewPullRequestWithAI + deterministic checks; bounded pre-existing base-test context; no history miner, runtime detector, future fix, labels or ground-truth harness. Memory variants differ only by base-only discovered guards. API timeout 90s; transport retries disabled.",
  "limitation": "One historical change; correlated case outcomes. Review-level advisory detection, not verified runtime behavior or broad production accuracy.",
  "usage": {
    "provider": "openai",
    "operation": "pr_review",
    "model": "gpt-6.1-sol",
    "responseId": "resp_037ba28db73ebdb2006ae25e4a4af487d1ae76634b61fc9849",
    "inputTokens": 8386,
    "cachedInputTokens": 0,
    "cacheWriteInputTokens": 8383,
    "outputTokens": 952,
    "reasoningTokens": 329,
    "totalTokens": 9338,
    "estimatedCostUsd": 0.0304835,
    "inputPricePerMillionUsd": 2,
    "cachedInputPricePerMillionUsd": 0.1,
    "cacheWritePricePerMillionUsd": 2.5,
    "outputPricePerMillionUsd": 10,
    "longContextApplied": false,
    "pricingVersion": "2026-10-08"
  },
  "status": "completed",
  "result": {
    "findings": [
      {
        "ruleId": "ai-incomplete_refactor",
        "category": "reliability",
        "behaviorCategory": "changed_data_semantics",
        "severity": "warning",
        "title": "ExactOptional loses its values and pattern overrides",
        "description": "$ZodExactOptional initializes $ZodOptional first, which now installs values and pattern on the same internals prototype. Its subsequent override calls return early because those keys already exist, leaving ordinary optional metadata that admits undefined and an empty-string pattern despite ExactOptional's explicit requirement not to add undefined.",
        "behaviorChange": {
          "before": "ExactOptional replaced Optional's derived values and pattern with the inner schema's metadata.",
          "after": "The first prototype installation wins, so ExactOptional retains Optional's undefined-extended values and optional pattern.",
          "impact": "ExactOptional exposes incorrect finite-value and pattern metadata to consumers, inconsistent with its delegated parsing behavior."
        },
        "intent": "likely_unintentional",
        "evidence": "defineLazyInternal returns on `key in proto`, while $ZodExactOptional calls $ZodOptional.init before attempting to override both keys under the comment `Override values/pattern to NOT add undefined`.",
        "protectedBehaviorKey": null,
        "filePath": "packages/zod/src/v4/core/util.ts",
        "lineStart": null,
        "lineEnd": null,
        "codeSnippet": null,
        "suggestedFix": "Preserve derived-initializer overrides when installing shared internal accessors.\n\nChanges:\n\n1. Allow ExactOptional to install its own values and pattern computations without retaining the earlier Optional computations.\n2. Add regression tests checking ExactOptional metadata after Optional initialization.\n\nVerify:\n\n- Verify a literal's exactOptional wrapper exposes exactly the inner values, without undefined.\n- Verify exactOptional preserves the inner pattern, while ordinary optional still adds undefined and makes the pattern optional.\n- Retain the existing test that exactOptional permits an absent object key but rejects an explicitly undefined value.",
        "fixSearchText": null,
        "fixReplacementText": null,
        "fixEdits": []
      }
    ],
    "behaviorOutcomes": [],
    "behaviorDiscoveries": [
      {
        "behaviorKey": "098727a3ce329d8f256312bc27174564e903651e66d7e9907dc8fbcc36d3c71e",
        "behavior": "An outer optional wrapper preserves an inner default, including through nullable, readonly, catch, pipe, union, and lazy wrappers.",
        "reason": "The refactored optin computations determine whether absence propagates or an inner default executes.",
        "sourceType": "test",
        "confidence": 1,
        "evidence": "The existing `ladder: the top rung survives every wrapper order` test expects each wrapped default to parse undefined as \"D\".",
        "filePath": "packages/zod/src/v4/classic/tests/optin-ladder.test.ts",
        "lineStart": null,
        "lineEnd": null
      }
    ]
  },
  "durationMs": 23262
}
