Repository navigation
perf(rpc): restore compiled Zod request schemas without override - #17374
Conversation
📝 WalkthroughWalkthroughThe production Zod dependency now targets version 4.5.4. The workspace excludes this version from the minimum release-age rule. RPC parameter schemas are compiled once per schema instance and cached in a Merge Risk: 🔵 Low · up to The RPC validation optimization retains the existing parser fallback, but the PR also exempts Zod 4.5.4 from the three-day dependency release-age gate, creating a bounded supply-chain risk. The change is mergeable with explicit owner awareness, or after removing the exception or documenting an equivalent approval control. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkResolution Add completed What Changed and Why sections, provide the required Linked Issue entry with an issue reference, add Visual Proof with exactly N/A and a reason because this is not a UI change, document Testing and platforms, complete AI Disclosure when applicable, and complete the Review, Agent skill upstream boundary, Notes, and Checklist sections. Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (2 skipped: 2 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThe PR upgrades Zod to 4.5.4 and restores lazy, identity-cached compilation of RPC request schemas.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains in the eligible follow-up review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/main/runtime/rpc/dispatcher-request-parsing.ts | Adds lazy compilation and WeakMap caching before RPC parameter validation. |
| src/main/runtime/rpc/dispatcher-request-parsing.test.ts | Adds coverage for repeated valid requests, validation-error formatting, and transform output. |
| package.json | Upgrades the root Zod dependency from 4.4.3 to 4.5.4. |
| pnpm-lock.yaml | Locks Zod 4.5.4 and updates dependent peer-resolution snapshots. |
| pnpm-workspace.yaml | Temporarily excludes Zod 4.5.4 from the three-day minimum-release-age gate. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[RPC request] --> B{Method has params schema?}
B -- No --> C[Return undefined params]
B -- Yes --> D{Compiled parser cached?}
D -- Yes --> E[Reuse compiled parser]
D -- No --> F[Compile schema]
F --> G[Cache by schema identity]
G --> E
E --> H[safeParse request params]
H -- Valid --> I[Return parsed value]
H -- Invalid --> J[Return invalid_argument response]
Reviews (2): Last reviewed commit: "chore(deps): pin zod 4.5.4 and except it..." | Re-trigger Greptile
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run reviewed the full four-file diff: the zod bump to ~4.5.0, the restored lazy compile() fast path in dispatcher-request-parsing.ts, and the new test file.
zod4.5.0 bump —package.jsonandpnpm-lock.yamlmovezodfrom~4.4.3to~4.5.0, which is what makes thecompilenamed export available (absent in 4.4.3).- Lazy identity-cached compilation —
getCompiledParamscompiles each request schema once in a module-levelWeakMap, then parses through the cached schema. Unsupported schemas (async transforms/refinements,z.xor(), recursion,z.coerce.*,.catch(callback)) eject back to the original parser via zod's owncompile()fallback, and without{ strict: true }no throw path exists, so no try/catch is needed. - Regression tests — the new test file pins parse output, custom validation-error message preservation, and transform output through the compiled path.
ℹ️ Merge is time-gated by the dependency age gate
[email protected] is younger than the repo's three-day minimumReleaseAge, so pnpm install (and CI) will keep failing until it ages — this PR intentionally does not re-add the minimumReleaseAgeExclude override from #17353. Nothing in the diff needs to change; the merge is blocked on calendar time, not on this code.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
4.5.4 is the first release fixing isRecursiveSchema (upstream 84e416f, stablyai#6500), which compile() calls on every schema — on 4.5.0 it fired .default() factories at compile time. Verified: compile-time factory calls 0 on 4.5.4, 1 on 4.5.0.
457b681 to
b51bfa3
Compare
|
Rebased onto Why 4.5.4, not 4.5.0: 4.5.4 is the first release containing the upstream fix to Exception added to minimumReleaseAgeExclude:
- [email protected]
- [email protected]Local verification: Two follow-ups worth tracking separately:
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 951d0d5e-78e3-4e01-90fb-6f83c2e6e493
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
package.jsonpnpm-workspace.yamlsrc/main/runtime/rpc/dispatcher-request-parsing.test.tssrc/main/runtime/rpc/dispatcher-request-parsing.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| # zod 4.5.4 was published 2026-08-29T17:55Z; it clears the 3-day gate on 2026-09-01T17:55Z. | ||
| minimumReleaseAgeExclude: | ||
| - [email protected] | ||
| - [email protected] |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
printf '%s\n' '--- repository conventions ---'
for f in /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/*/*.md; do
[ -f "$f" ] && { head -5 "$f"; case "$f" in *pnpm*|*workspace*|*dependency*|*supply*|*security*) cat "$f";; esac; }
done
printf '%s\n' '--- workspace configuration ---'
cat -n pnpm-workspace.yaml
printf '%s\n' '--- relevant change summary ---'
git diff --stat -- pnpm-workspace.yaml
git diff -- pnpm-workspace.yamlRepository: stablyai/orca
Length of output: 10060
🌐 Web query:
pnpm minimumReleaseAgeExclude configuration semantics
💡 Result:
The minimumReleaseAgeExclude configuration in pnpm allows users to bypass the minimumReleaseAge restriction for specific dependencies, ensuring they can be installed immediately regardless of their publication time [1][2]. This setting is useful for trusted internal packages or when immediate access to a new release is required [3]. Semantics and Usage: - Scope: The setting accepts a list of strings [1][2]. Entries can specify package names, glob patterns (e.g., @myorg/*), or specific versions (e.g., [email protected]) [3][1][2]. - Versioning: For specific version exclusions, you can provide single versions or use a disjunction (||) to list multiple versions for a package [1][2]. - Pattern Matching: It supports glob patterns, allowing for broad exclusions such as an entire organization's scope [4][3][1]. - Configuration Layer: It is primarily configured in pnpm-workspace.yaml (or global config files) [5][3]. CLI flags are also available for per-invocation overrides (--minimum-release-age-exclude) [6]. Key Technical Notes: - Behavior with Multiple Entries: When providing multiple exact-version entries for the same package, it is recommended to use a single disjunction (||) entry to ensure consistent behavior across different pnpm operations [7]. - Evolution: The setting was introduced in v10.16.0 [1][2][8]. Pattern support was added in v10.17.0, and specific version support followed in v10.19.0 [1][2]. - Related Settings: This setting operates in conjunction with minimumReleaseAge, which defines the age threshold (in minutes) for package installation [1][2][8]. As of pnpm v11, minimumReleaseAge defaults to 1440 minutes (one day) [3].
Citations:
- 1: https://pnpm.io/settings/dependency-resolution
- 2: https://pnpm.io/10.x/settings
- 3: https://charpeni.com/blog/protecting-against-compromised-packages-with-minimum-release-age
- 4: GitHub pull request 9984 in pnpm/pnpm (link omitted to avoid creating a cross-reference)
- 5: https://pnpm.io/settings
- 6: GitHub pull request 11232 in pnpm/pnpm (link omitted to avoid creating a cross-reference)
- 7: GitHub issue 12463 in pnpm/pnpm (link omitted to avoid creating a cross-reference)
- 8: https://pnpm.io/blog/releases/10.16
Security Misconfiguration (CWE-693)
Reachability: External · Exploitability: Difficult
Keep the Zod release-age gate enabled.
Remove [email protected] from minimumReleaseAgeExclude. This entry bypasses the three-day dependency-age control before September 1, 2026, at 17:55 UTC.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run reviewed the incremental delta since the prior Pullfrog review (457b681a): the zod pin moved from ~4.5.0 to ~4.5.4, and a release-age-gate waiver was added. The dispatcher-request-parsing.ts and test-file changes are unchanged from the prior review.
zod~4.5.4pin —package.jsonandpnpm-lock.yamlmovezodfrom~4.5.0to~4.5.4; the@stablyai/playwright*peer references in the lockfile follow.- Release-age waiver —
pnpm-workspace.yamladds[email protected]tominimumReleaseAgeExclude(exact version, matching the resolved lockfile entry), unblocking installs now that[email protected]is younger than the three-day gate.
ℹ️ PR title and description now contradict the diff
The title (...without override) and body (does not add a zod minimumReleaseAgeExclude override, block installs until [email protected] reaches the configured three-day age) still describe the pre-waiver state. The diff now adds - [email protected] to minimumReleaseAgeExclude and pins [email protected], so update the title/body before merging to keep the merged commit description accurate.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…blyai#17374) * perf(rpc): compile Zod request schemas lazily * chore(deps): pin zod 4.5.4 and except it from the release-age gate 4.5.4 is the first release fixing isRecursiveSchema (upstream 84e416f, stablyai#6500), which compile() calls on every schema — on 4.5.0 it fired .default() factories at compile time. Verified: compile-time factory calls 0 on 4.5.4, 1 on 4.5.0.

Restore the Zod 4.5 compiled request-schema fast path from #17353 after #17368 reverted it for the dependency age exception.
This keeps lazy identity-cached compilation with normal-parser fallback for unsupported schemas, but does not add a zod minimumReleaseAgeExclude override.
The repository age gate may block installs until [email protected] reaches the configured three-day age.
ELI5
RPC requests are checked against a recipe. The first request now turns that recipe into a fast checker and remembers it by schema identity; later requests reuse it instead of rebuilding the checker. Schemas that Zod cannot compile keep using the existing runtime parser.
Performance Measurement
Reproduce on Node with Zod 4.5.0 using one representative request schema and 2,000,000 valid
safeParsecalls. Warm both paths before timing steady state and compareschema.safeParsewith one-timecompile(schema).safeParse:The predecessor's representative Zod 4.5 run recorded approximately 215 ms interpreted versus 14 ms compiled: about 15× faster and 93.5% less validation time. Exact timing varies by host and JIT state. Deterministically, repeated requests incur one lazy compile/cache miss per schema and then reuse the compiled parser; startup does not eagerly compile the 600+ RPC schemas.
User-Facing Trade-offs
None observed for RPC callers. Unsupported schemas (transforms, async refinements, and other compiler refusals) automatically use the existing runtime parser; valid output and error formatting remain unchanged. The dependency-age note above is an install-time repository constraint, not a runtime behavior change.