Skip to content

perf(lint): add zod-prefer-lazy-schema oxlint plugin and Main/Shared ratchet - #50160

Merged
nwparker merged 2 commits into
mainfrom
perf/oxlint-zod-prefer-lazy-schema-rule
Nov 26, 2026
Merged

nwparker merged 2 commits into
mainfrom
perf/oxlint-zod-prefer-lazy-schema-rule

Conversation

@nwparker

@nwparker nwparker commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a custom oxlint JS plugin rule (zod-prefer-lazy-schema/prefer-lazy-schema, modeled on bun/zod-prefer-lazy-schema) and a downward-only count ratchet across src/main and src/shared:

  • config/oxlint-plugins/zod-prefer-lazy-schema.mjs: reports eager module-load Zod schema construction (z.*(...) and top-level .extend/.omit/.pick/.partial/.merge/.required/.nullable/.optional/.array on *Schema/*Params/*Body identifiers), while allowing lazyZodSchema(() => ...), z.lazy(() => ...), function-scoped schemas, and non-schema utilities (z.globalRegistry, z.toJSONSchema, z.compile, etc.).
  • config/oxlint-zod-prefer-lazy-ratchet.json, config/scripts/static-analysis/ratchets/main-startup/check-zod-prefer-lazy-ratchet.mjs, config/zod-prefer-lazy-baseline.txt: ratchets the remaining 1,529 grandfathered eager schemas across 384 files downward and blocks any new eager top-level Zod schema in src/main or src/shared.
  • Wired into package.json (check:zod-prefer-lazy-ratchet), config/oxlint-performance-audit.json, check-changed-selection.mjs, and run-lint.mjs.

Performance

  • Prevents future memory regressions from new eager module-load Zod v4 schemas (which retain ~22 MiB per 1,000 schemas in V8 heap) while running in ~1.9s during pnpm check:changed.

Verification

  • pnpm check:zod-prefer-lazy-ratchet passes (1,529 grandfathered across 384 files).
  • pnpm check:changed --base=perf/cache-resolve-environment-misses-and-require-store-file passed all 53 checks.
Files Added Deleted Net
Test 0 0 0 0
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​653 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​653

@nwparker
nwparker changed the base branch from perf/cache-resolve-environment-misses-and-require-store-file to main November 26, 2026 23:44
@nwparker
nwparker merged commit 35eb7e5 into main Nov 26, 2026
68 of 69 checks passed
@nwparker
nwparker deleted the perf/oxlint-zod-prefer-lazy-schema-rule branch November 26, 2026 23:48
AmoabaKelvin added a commit that referenced this pull request Nov 27, 2026
#49406 added an eager schema to connector-params.ts while #50160 set its ratchet baseline, failing ratchets on main.
AmoabaKelvin added a commit that referenced this pull request Nov 27, 2026
#49406 added an eager schema to connector-params.ts while #50160 set its ratchet baseline, failing ratchets on main.
AmoabaKelvin added a commit that referenced this pull request Nov 27, 2026
…schema (#50170)

* fix(i18n): drop the stale Traditional Chinese MCP remove message on the phone

#49475 replaced mobile mcpServers.removeMessage; #50002 then translated the old key, failing mobile locale validation on main.

* fix(connectors): build the wake reply place schema lazily

#49406 added an eager schema to connector-params.ts while #50160 set its ratchet baseline, failing ratchets on main.
Daily-AC added a commit to Daily-AC/orca that referenced this pull request Nov 30, 2026
Upstream main now ratchets eager top-level Zod schemas in src/main and
src/shared to zero for new files (stablyai#50160).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant