colinhacks/zod

14 rules learned from 1,000 merged PRs: the files and habits in colinhacks/zod that kept needing a fix after merge.

Merged PRs read
1,000
Needed a fix
87 (8.8%)
Reverted
5
Merged between
2023-01-03 and 2026-11-06

Tested on new PRs: it didn't hold here

3 of the 21 code PRs that breached a rule needed a fix (14%), and every recent code PR breached a rule, so there is nothing to compare against. PRs that breached a rule did not clearly need a fix more often, so the rules did not hold here.

Rules were learned from older PRs, then tested on later PRs they hadn't seen. How we tested

Fix-prone files and folders

PRs that touched these paths needed a follow-up fix more often than the 9% repo average. Counts are PRs that touched the path.

  1. Hotspot: packages/zod/src/v4/core/errors.ts

    8 of 17 earlier PRs that changed this needed a fix.

    9 clean, 8 fixed (47%)
  2. Hotspot: packages/zod/src/v4/core/memoizer.ts

    6 of 13 earlier PRs that changed this needed a fix.

    7 clean, 6 fixed (46%)
  3. Fragile area: packages/tsc/

    4 of 10 earlier PRs that changed this needed a fix.

    6 clean, 4 fixed (40%)
  4. Fragile area: packages/treeshake/

    12 of 31 earlier PRs that changed this needed a fix.

    19 clean, 12 fixed (39%)
  5. Hotspot: packages/zod/src/v4/core/core.ts

    8 of 21 earlier PRs that changed this needed a fix.

    13 clean, 8 fixed (38%)
  6. Hotspot: packages/zod/src/v4/mini/schemas.ts

    21 of 56 earlier PRs that changed this needed a fix.

    35 clean, 21 fixed (38%)
  7. Hotspot: packages/zod/src/v4/core/json-schema-processors.ts

    9 of 24 earlier PRs that changed this needed a fix.

    15 clean, 9 fixed (38%)
  8. Hotspot: packages/zod/src/v4/classic/from-json-schema.ts

    6 of 16 earlier PRs that changed this needed a fix.

    10 clean, 6 fixed (38%)
  9. Hotspot: packages/zod/src/v4/core/to-json-schema.ts

    16 of 49 earlier PRs that changed this needed a fix.

    33 clean, 16 fixed (33%)
  10. Hotspot: packages/zod/src/v4/classic/schemas.ts

    27 of 83 earlier PRs that changed this needed a fix.

    56 clean, 27 fixed (33%)
  11. Hotspot: packages/zod/src/v4/core/util.ts

    19 of 59 earlier PRs that changed this needed a fix.

    40 clean, 19 fixed (32%)
  12. Fragile area: packages/resolution/

    4 of 13 earlier PRs that changed this needed a fix.

    9 clean, 4 fixed (31%)
  13. Fragile area: packages/mini/

    4 of 14 earlier PRs that changed this needed a fix.

    10 clean, 4 fixed (29%)
  14. Hotspot: packages/zod/src/v4/locales/en.ts

    3 of 11 earlier PRs that changed this needed a fix.

    8 clean, 3 fixed (27%)

Conventions

Habits most PRs here follow, where PRs that broke them needed a fix more often. Counts on each bar are the PRs that broke it.

No habit here made the list.

Recent PRs that needed a fix

Rules flagged 174 recent PRs, and 36 of those needed a fix (21%), against 12% of all recent PRs. These are the 15 with the strongest rule that needed a fix, with the PR that fixed each.

PRTitleSizeRule it breachedWhat happened
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()` +1,743 -186 touches packages/zod/src/v4/core/errors.ts9 clean, 8 fixed fixed in #5556, 7 days later
perf(compile): for-in record walk, cheaper issue finalization, and a generative compile differential +755 -29 touches packages/zod/src/v4/core/errors.ts9 clean, 8 fixed fixed in #6570, same day
fix(v4): complete reserved-key hardening +309 -39 touches packages/zod/src/v4/core/errors.ts9 clean, 8 fixed fixed in #6386, same day
feat(v4): expose the owning schema on check-originated issues +177 -1 touches packages/zod/src/v4/core/errors.ts9 clean, 8 fixed fixed in #6426, 1 day later
fix(errors): use own-property semantics in every error-tree walker +128 -23 touches packages/zod/src/v4/core/errors.ts9 clean, 8 fixed fixed in #6367, 4 days later
feat(v4): parse input containing reference cycles +865 -10 touches packages/zod/src/v4/core/memoizer.ts7 clean, 6 fixed fixed in #6443, 4 days later
fix(v4): parse recursive schemas built by a factory +511 -172 touches packages/zod/src/v4/core/memoizer.ts7 clean, 6 fixed fixed in #6572, 8 days later
feat(v4): make z.properties() a schema, and give z.instanceof() a .properties() method +560 -34 touches packages/zod/src/v4/core/memoizer.ts7 clean, 6 fixed fixed in #6582, 9 days later
feat(v4): expose the memoizer through z.config() so zod/mini can opt in +289 -127 touches packages/zod/src/v4/core/memoizer.ts7 clean, 6 fixed fixed in #6500, 1 day later
fix(v4): stop the memoizer copying every issue below each recursive node +126 -9 touches packages/zod/src/v4/core/memoizer.ts7 clean, 6 fixed fixed in #6707, same day
Zod 4.1 +4,353 -498 touches packages/treeshake/19 clean, 12 fixed fixed in #5145, 2 days later
perf(v4): build the safeParse error on first read +173 -84 touches packages/treeshake/19 clean, 12 fixed fixed in #6543, same day
perf(v4): halve schema construction cost; keep instances in fast-properties mode +1,649 -216 touches packages/zod/src/v4/core/core.ts13 clean, 8 fixed fixed in #6404, 1 day later
perf(memory): install derived internals on a per-constructor prototype +106 -57 touches packages/zod/src/v4/core/core.ts13 clean, 8 fixed fixed in #6429, same day
perf(v4): validate without building the output, and keep schemas out of dictionary mode +633 -202 touches packages/zod/src/v4/mini/schemas.ts35 clean, 21 fixed fixed in #6488, same day

Get this for your own repo

Precall reads your repo's history the same way and comments on new PRs that touch the spots that kept breaking. Download the rules file for colinhacks/zod.